diff --git a/src/main/java/foundationgames/enhancedblockentities/mixin/DecoratedPotBlockEntityMixin.java b/src/main/java/foundationgames/enhancedblockentities/mixin/DecoratedPotBlockEntityMixin.java index aecc91d..5cff5fc 100644 --- a/src/main/java/foundationgames/enhancedblockentities/mixin/DecoratedPotBlockEntityMixin.java +++ b/src/main/java/foundationgames/enhancedblockentities/mixin/DecoratedPotBlockEntityMixin.java @@ -1,67 +1,73 @@ -package foundationgames.enhancedblockentities.mixin; - -import foundationgames.enhancedblockentities.util.WorldUtil; -import foundationgames.enhancedblockentities.util.duck.AppearanceStateHolder; -import net.minecraft.block.entity.DecoratedPotBlockEntity; -import net.minecraft.nbt.NbtCompound; -import net.minecraft.registry.RegistryWrapper; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Unique; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; - -@Mixin(DecoratedPotBlockEntity.class) -public class DecoratedPotBlockEntityMixin implements AppearanceStateHolder { - @Unique private int enhanced_bes$modelState = 0; - @Unique private int enhanced_bes$renderState = 0; - - @Inject(method = "readNbt", at = @At("TAIL")) - private void enhanced_bes$updateChunkOnPatternsLoaded(NbtCompound nbt, RegistryWrapper.WrapperLookup rwl, CallbackInfo ci) { - var self = (DecoratedPotBlockEntity)(Object)this; - - if (self.getWorld() != null && self.getWorld().isClient()) { - WorldUtil.rebuildChunk(self.getWorld(), self.getPos()); - } - } - - @Inject(method = "onSyncedBlockEvent", at = @At(value = "RETURN", shift = At.Shift.BEFORE, ordinal = 0)) - private void enhanced_bes$updateOnWobble(int type, int data, CallbackInfoReturnable cir) { - var self = (DecoratedPotBlockEntity)(Object)this; - var world = self.getWorld(); - - if (self.lastWobbleType == null) { - return; - } - - this.updateAppearanceState(1, world, self.getPos()); - - WorldUtil.scheduleTimed(world, self.lastWobbleTime + self.lastWobbleType.lengthInTicks, - () -> { - if (self.getWorld().getTime() >= self.lastWobbleTime + self.lastWobbleType.lengthInTicks) { - this.updateAppearanceState(0, world, self.getPos()); - } - }); - } - - @Override - public int getModelState() { - return enhanced_bes$modelState; - } - - @Override - public void setModelState(int state) { - this.enhanced_bes$modelState = state; - } - - @Override - public int getRenderState() { - return enhanced_bes$renderState; - } - - @Override - public void setRenderState(int state) { - this.enhanced_bes$renderState = state; - } -} +/* */ package foundationgames.enhancedblockentities.mixin; +/* */ import foundationgames.enhancedblockentities.util.WorldUtil; +/* */ import foundationgames.enhancedblockentities.util.duck.AppearanceStateHolder; +/* */ import net.minecraft.class_1937; +/* */ import net.minecraft.class_2487; +/* */ import net.minecraft.class_8172; +/* */ import org.spongepowered.asm.mixin.Mixin; +/* */ import org.spongepowered.asm.mixin.Unique; +/* */ import org.spongepowered.asm.mixin.injection.At; +/* */ import org.spongepowered.asm.mixin.injection.Inject; +/* */ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +/* */ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; +/* */ +/* */ @Mixin({class_8172.class}) +/* */ public class DecoratedPotBlockEntityMixin implements AppearanceStateHolder { +/* */ @Unique +/* 17 */ private int enhanced_bes$modelState = 0; @Unique +/* 18 */ private int enhanced_bes$renderState = 0; +/* */ +/* */ @Inject(method = {"readNbt"}, at = {@At("TAIL")}) +/* */ private void enhanced_bes$updateChunkOnPatternsLoaded(class_2487 nbt, class_8541 registryAccess, CallbackInfo ci) { +/* 22 */ class_8172 self = (class_8172)this; +/* */ +/* 24 */ if (self.method_10997() != null && self.method_10997().method_8608()) { +/* 25 */ WorldUtil.rebuildChunk(self.method_10997(), self.method_11016()); +/* */ } +/* */ } +/* */ +/* */ @Inject(method = {"onSyncedBlockEvent"}, at = {@At(value = "RETURN", shift = At.Shift.BEFORE, ordinal = 0)}) +/* */ private void enhanced_bes$updateOnWobble(int type, int data, CallbackInfoReturnable cir) { +/* 31 */ class_8172 self = (class_8172)this; +/* 32 */ class_1937 world = self.method_10997(); +/* */ +/* 34 */ if (self.field_46662 == null) { +/* */ return; +/* */ } +/* */ +/* 38 */ updateAppearanceState(1, world, self.method_11016()); +/* */ +/* 40 */ WorldUtil.scheduleTimed(world, self.field_46661 + self.field_46662.field_46666, () -> { +/* */ if (self.method_10997().method_8510() >= self.field_46661 + self.field_46662.field_46666) { +/* */ updateAppearanceState(0, world, self.method_11016()); +/* */ } +/* */ }); +/* */ } +/* */ +/* */ +/* */ +/* */ public int getModelState() { +/* 50 */ return this.enhanced_bes$modelState; +/* */ } +/* */ +/* */ +/* */ public void setModelState(int state) { +/* 55 */ this.enhanced_bes$modelState = state; +/* */ } +/* */ +/* */ +/* */ public int getRenderState() { +/* 60 */ return this.enhanced_bes$renderState; +/* */ } +/* */ +/* */ +/* */ public void setRenderState(int state) { +/* 65 */ this.enhanced_bes$renderState = state; +/* */ } +/* */ } + + +/* Location: D:\我的世界\.minecraft\versions\1.21.8生电包\mods\enhancedblockentities-0.11.3 1.21.4.jar!\foundationgames\enhancedblockentities\mixin\DecoratedPotBlockEntityMixin.class + * Java compiler version: 21 (65.0) + * JD-Core Version: 1.1.3 + */ \ No newline at end of file