From e34216d4bb899b2dd9631e7dca87db53be32b34a Mon Sep 17 00:00:00 2001 From: xkball <45330674+xkball@users.noreply.github.com> Date: Tue, 24 Dec 2024 00:15:49 +0800 Subject: [PATCH] Improve: Trash can will clear itself when reload chunk. Fix: missing attribute in marting car. Bump Version to 1.4.46 Took 53 minutes --- gradle.properties | 2 +- .../block/entity/TrashCanWithContainerBlockEntity.java | 5 +++++ .../holo_sign/HolographicSignBlockEntityRenderer.java | 4 ++-- .../java/org/teacon/powertool/entity/MartingCarEntity.java | 2 +- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/gradle.properties b/gradle.properties index af20b9d..46a23ee 100644 --- a/gradle.properties +++ b/gradle.properties @@ -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 diff --git a/src/main/java/org/teacon/powertool/block/entity/TrashCanWithContainerBlockEntity.java b/src/main/java/org/teacon/powertool/block/entity/TrashCanWithContainerBlockEntity.java index 4956f40..a8d5806 100644 --- a/src/main/java/org/teacon/powertool/block/entity/TrashCanWithContainerBlockEntity.java +++ b/src/main/java/org/teacon/powertool/block/entity/TrashCanWithContainerBlockEntity.java @@ -22,6 +22,7 @@ public class TrashCanWithContainerBlockEntity extends BaseContainerBlockEntity { private NonNullList 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); @@ -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 diff --git a/src/main/java/org/teacon/powertool/client/renders/holo_sign/HolographicSignBlockEntityRenderer.java b/src/main/java/org/teacon/powertool/client/renders/holo_sign/HolographicSignBlockEntityRenderer.java index 3d72751..8fb4f92 100644 --- a/src/main/java/org/teacon/powertool/client/renders/holo_sign/HolographicSignBlockEntityRenderer.java +++ b/src/main/java/org/teacon/powertool/client/renders/holo_sign/HolographicSignBlockEntityRenderer.java @@ -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); @@ -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; diff --git a/src/main/java/org/teacon/powertool/entity/MartingCarEntity.java b/src/main/java/org/teacon/powertool/entity/MartingCarEntity.java index f1e3991..5e80bb8 100644 --- a/src/main/java/org/teacon/powertool/entity/MartingCarEntity.java +++ b/src/main/java/org/teacon/powertool/entity/MartingCarEntity.java @@ -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)