diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/waterwheel/LargeWaterWheelBlock.java b/src/main/java/com/simibubi/create/content/contraptions/components/waterwheel/LargeWaterWheelBlock.java index 26034bc9c..c2df8e173 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/waterwheel/LargeWaterWheelBlock.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/waterwheel/LargeWaterWheelBlock.java @@ -2,10 +2,10 @@ package com.simibubi.create.content.contraptions.components.waterwheel; import java.util.Random; +import com.simibubi.create.AllBlockEntityTypes; import com.simibubi.create.AllBlocks; -import com.simibubi.create.AllTileEntities; import com.simibubi.create.content.contraptions.base.RotatedPillarKineticBlock; -import com.simibubi.create.foundation.block.ITE; +import com.simibubi.create.foundation.block.IBE; import com.simibubi.create.foundation.utility.Couple; import com.simibubi.create.foundation.utility.Iterate; @@ -30,7 +30,7 @@ import net.minecraft.world.level.block.state.StateDefinition.Builder; import net.minecraft.world.level.block.state.properties.BooleanProperty; import net.minecraft.world.phys.BlockHitResult; -public class LargeWaterWheelBlock extends RotatedPillarKineticBlock implements ITE { +public class LargeWaterWheelBlock extends RotatedPillarKineticBlock implements IBE { public static final BooleanProperty EXTENSION = BooleanProperty.create("extension"); @@ -82,7 +82,7 @@ public class LargeWaterWheelBlock extends RotatedPillarKineticBlock implements I @Override public InteractionResult use(BlockState pState, Level pLevel, BlockPos pPos, Player pPlayer, InteractionHand pHand, BlockHitResult pHit) { - return onTileEntityUse(pLevel, pPos, wwt -> wwt.applyMaterialIfValid(pPlayer.getItemInHand(pHand))); + return onBlockEntityUse(pLevel, pPos, wwt -> wwt.applyMaterialIfValid(pPlayer.getItemInHand(pHand))); } @Override @@ -128,7 +128,7 @@ public class LargeWaterWheelBlock extends RotatedPillarKineticBlock implements I pLevel.setBlockAndUpdate(structurePos, requiredStructure); } } - withTileEntityDo(pLevel, pPos, WaterWheelTileEntity::determineAndApplyFlowScore); + withBlockEntityDo(pLevel, pPos, WaterWheelBlockEntity::determineAndApplyFlowScore); } @Override @@ -137,13 +137,13 @@ public class LargeWaterWheelBlock extends RotatedPillarKineticBlock implements I } @Override - public BlockEntityType getTileEntityType() { - return AllTileEntities.LARGE_WATER_WHEEL.get(); + public BlockEntityType getBlockEntityType() { + return AllBlockEntityTypes.LARGE_WATER_WHEEL.get(); } @Override - public Class getTileEntityClass() { - return LargeWaterWheelTileEntity.class; + public Class getBlockEntityClass() { + return LargeWaterWheelBlockEntity.class; } @Override diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/waterwheel/LargeWaterWheelBlockEntity.java b/src/main/java/com/simibubi/create/content/contraptions/components/waterwheel/LargeWaterWheelBlockEntity.java index 90e5723e5..91bdfb571 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/waterwheel/LargeWaterWheelBlockEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/waterwheel/LargeWaterWheelBlockEntity.java @@ -4,9 +4,9 @@ import net.minecraft.core.BlockPos; import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.state.BlockState; -public class LargeWaterWheelTileEntity extends WaterWheelTileEntity { +public class LargeWaterWheelBlockEntity extends WaterWheelBlockEntity { - public LargeWaterWheelTileEntity(BlockEntityType type, BlockPos pos, BlockState state) { + public LargeWaterWheelBlockEntity(BlockEntityType type, BlockPos pos, BlockState state) { super(type, pos, state); } diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/waterwheel/WaterWheelInstance.java b/src/main/java/com/simibubi/create/content/contraptions/components/waterwheel/WaterWheelInstance.java index 3f209ecea..6a1092226 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/waterwheel/WaterWheelInstance.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/waterwheel/WaterWheelInstance.java @@ -2,11 +2,11 @@ package com.simibubi.create.content.contraptions.components.waterwheel; import com.jozufozu.flywheel.api.MaterialManager; import com.simibubi.create.content.contraptions.base.CutoutRotatingInstance; -import com.simibubi.create.content.contraptions.base.KineticTileEntity; +import com.simibubi.create.content.contraptions.base.KineticBlockEntity; public class WaterWheelInstance extends CutoutRotatingInstance { - public WaterWheelInstance(MaterialManager modelManager, KineticTileEntity tile) { + public WaterWheelInstance(MaterialManager modelManager, KineticBlockEntity tile) { super(modelManager, tile); } diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/waterwheel/WaterWheelStructuralBlock.java b/src/main/java/com/simibubi/create/content/contraptions/components/waterwheel/WaterWheelStructuralBlock.java index e9cbb0bf9..f4ef8be4c 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/waterwheel/WaterWheelStructuralBlock.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/waterwheel/WaterWheelStructuralBlock.java @@ -1,16 +1,19 @@ package com.simibubi.create.content.contraptions.components.waterwheel; +import java.util.HashSet; import java.util.Random; +import java.util.Set; import java.util.function.Consumer; +import org.jetbrains.annotations.Nullable; + import com.simibubi.create.AllBlocks; import com.simibubi.create.content.contraptions.goggles.IProxyHoveringInformation; import com.simibubi.create.content.contraptions.wrench.IWrenchable; -import com.simibubi.create.foundation.block.render.DestroyProgressRenderingHandler; +import com.simibubi.create.foundation.block.render.MultiPosDestructionHandler; import net.minecraft.client.multiplayer.ClientLevel; import net.minecraft.client.particle.ParticleEngine; -import net.minecraft.client.renderer.LevelRenderer; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.server.level.ServerLevel; @@ -156,7 +159,7 @@ public class WaterWheelStructuralBlock extends DirectionalBlock implements IWren return true; } - public static class RenderProperties implements IBlockRenderProperties, DestroyProgressRenderingHandler { + public static class RenderProperties implements IBlockRenderProperties, MultiPosDestructionHandler { @Override public boolean addDestroyEffects(BlockState state, Level Level, BlockPos pos, ParticleEngine manager) { @@ -172,18 +175,18 @@ public class WaterWheelStructuralBlock extends DirectionalBlock implements IWren manager.crack(WaterWheelStructuralBlock.getMaster(level, targetPos, state), bhr.getDirection()); return true; } - return DestroyProgressRenderingHandler.super.addHitEffects(state, level, target, manager); + return IBlockRenderProperties.super.addHitEffects(state, level, target, manager); } @Override - public boolean renderDestroyProgress(ClientLevel level, LevelRenderer renderer, int breakerId, - BlockPos targetPos, int progress, BlockState blockState) { + @Nullable + public Set getExtraPositions(ClientLevel level, BlockPos pos, BlockState blockState, int progress) { WaterWheelStructuralBlock waterWheelStructuralBlock = AllBlocks.WATER_WHEEL_STRUCTURAL.get(); - if (!waterWheelStructuralBlock.stillValid(level, targetPos, blockState, false)) - return true; - BlockPos masterPos = WaterWheelStructuralBlock.getMaster(level, targetPos, blockState); - renderer.destroyBlockProgress(masterPos.hashCode(), masterPos, progress); - return true; + if (!waterWheelStructuralBlock.stillValid(level, pos, blockState, false)) + return null; + HashSet set = new HashSet<>(); + set.add(WaterWheelStructuralBlock.getMaster(level, pos, blockState)); + return set; } }