Skip to content

Commit

Permalink
Improve: Trash can will clear itself when reload chunk.
Browse files Browse the repository at this point in the history
Fix: missing attribute in marting car.
Bump Version to 1.4.46

Took 53 minutes
  • Loading branch information
xkball committed Dec 23, 2024
1 parent a289f1d commit e34216d
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ mod_name=Power Tool
# The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default.
mod_license=GPL-3.0
# The mod version. See https://semver.org/
mod_version=1.4.45
mod_version=1.4.46
# The group ID for the mod. It is only important when publishing as an artifact to a Maven repository.
# This should match the base package used for the mod sources.
# See https://maven.apache.org/guides/mini/guide-naming-conventions.html
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
public class TrashCanWithContainerBlockEntity extends BaseContainerBlockEntity {

private NonNullList<ItemStack> items = NonNullList.withSize(1, ItemStack.EMPTY);
private boolean init = false;

public TrashCanWithContainerBlockEntity(BlockPos pos, BlockState blockState) {
super(PowerToolBlocks.TRASH_CAN_WITH_CONTAINER_BLOCK_ENTITY.get(), pos, blockState);
Expand Down Expand Up @@ -61,6 +62,10 @@ public int getContainerSize() {
protected void loadAdditional(CompoundTag tag, HolderLookup.Provider registries) {
super.loadAdditional(tag, registries);
ContainerHelper.loadAllItems(tag, this.items, registries);
if(!this.init){
items.clear();
init = true;
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public static void renderText(Font font, Component component, float x, float y,
Matrix4f matrix4f = new Matrix4f(matrix);
renderBackground(font,backgroundColor,packedLightCoords,x,y,font.width(component),dropShadow,matrix4f,buffer);
if (dropShadow) {
font.drawInBatch(text, x, y, color, true, matrix, buffer, Font.DisplayMode.NORMAL,VanillaUtils.TRANSPARENT , packedLightCoords);
font.drawInBatch(text, x, y, color, true, matrix, buffer, Font.DisplayMode.SEE_THROUGH,VanillaUtils.TRANSPARENT , packedLightCoords);
matrix4f.translate(SHADOW_OFFSET);
}
font.drawInBatch(text, x, y, color, false, matrix4f, buffer, Font.DisplayMode.NORMAL, VanillaUtils.TRANSPARENT, packedLightCoords);
Expand All @@ -122,7 +122,7 @@ public static void renderText(Font font,String text,float x, float y, int color,
}

public static void renderBackground(Font font,int backgroundColor, int packedLightCoords,float x,float y,int length,boolean append,Matrix4f matrix, MultiBufferSource buffer){
if (backgroundColor != 0) {
if (backgroundColor != 0 && backgroundColor != VanillaUtils.TRANSPARENT) {
float f = (float)(backgroundColor >> 24 & 0xFF) / 255.0F;
float f1 = (float)(backgroundColor >> 16 & 0xFF) / 255.0F;
float f2 = (float)(backgroundColor >> 8 & 0xFF) / 255.0F;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ public void setDamage(float value) {
}

public static AttributeSupplier createAttributes() {
return AttributeSupplier.builder()
return LivingEntity.createLivingAttributes()
.add(Attributes.MAX_HEALTH, 1)
.add(Attributes.STEP_HEIGHT, 1)
.add(Attributes.MOVEMENT_SPEED, 0.7)
Expand Down

0 comments on commit e34216d

Please sign in to comment.