diff --git a/src/main/java/com/imbgt/ibg/IBG.java b/src/main/java/com/imbgt/ibg/IBG.java index 61ed3a5..1c11901 100644 --- a/src/main/java/com/imbgt/ibg/IBG.java +++ b/src/main/java/com/imbgt/ibg/IBG.java @@ -65,8 +65,6 @@ public class IBG { public static class ClientModEvents { @SubscribeEvent public static void onClientSetup(FMLClientSetupEvent event) { - BlockEntityRenderers.register(ModBlockEntities.ANIMATED_BLOCK_ENTITY.get(), - AnimatedBlockRenderer::new); event.enqueueWork(() -> { var latheDef = GTRegistries.MACHINES.get( diff --git a/src/main/java/com/imbgt/ibg/block/ModBlocks.java b/src/main/java/com/imbgt/ibg/block/ModBlocks.java index c48fb9c..a4560e8 100644 --- a/src/main/java/com/imbgt/ibg/block/ModBlocks.java +++ b/src/main/java/com/imbgt/ibg/block/ModBlocks.java @@ -1,14 +1,9 @@ package com.imbgt.ibg.block; import com.imbgt.ibg.IBG; -import com.imbgt.ibg.block.custom.AnimatedBlock; import com.imbgt.ibg.block.custom.PartBlock; -import com.imbgt.ibg.item.ModItems; -import net.minecraft.world.item.BlockItem; -import net.minecraft.world.item.Item; import net.minecraft.world.level.block.Block; -import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraftforge.eventbus.api.IEventBus; import net.minecraftforge.registries.DeferredRegister; @@ -18,17 +13,10 @@ import net.minecraftforge.registries.RegistryObject; public class ModBlocks { public static final DeferredRegister BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, IBG.MOD_ID); - public static final RegistryObject ANIMATED_BLOCK = BLOCKS.register("animated_block", - () -> new AnimatedBlock(BlockBehaviour.Properties.copy(Blocks.IRON_BLOCK).noOcclusion())); - public static final RegistryObject PART = BLOCKS.register( "part", () -> new PartBlock(BlockBehaviour.Properties.of().noOcclusion().strength(2.0F))); - private static RegistryObject registerBlockItem(String name, RegistryObject block) { - return ModItems.ITEMS_REGISTER.register(name, () -> new BlockItem(block.get(), new Item.Properties())); - } - public static void register(IEventBus eventBus) { BLOCKS.register(eventBus); } diff --git a/src/main/java/com/imbgt/ibg/block/custom/AnimatedBlock.java b/src/main/java/com/imbgt/ibg/block/custom/AnimatedBlock.java deleted file mode 100644 index 362ef24..0000000 --- a/src/main/java/com/imbgt/ibg/block/custom/AnimatedBlock.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.imbgt.ibg.block.custom; - -import org.jetbrains.annotations.Nullable; - -import com.imbgt.ibg.block.entity.AnimatedBlockEntity; - -import net.minecraft.core.BlockPos; -import net.minecraft.world.level.BlockGetter; -import net.minecraft.world.level.block.BaseEntityBlock; -import net.minecraft.world.level.block.Block; -import net.minecraft.world.level.block.RenderShape; -import net.minecraft.world.level.block.entity.BlockEntity; -import net.minecraft.world.level.block.state.BlockState; -import net.minecraft.world.phys.shapes.CollisionContext; -import net.minecraft.world.phys.shapes.VoxelShape; - -public class AnimatedBlock extends BaseEntityBlock { - public static final VoxelShape SHAPE = Block.box(0, 0, 0, 16, 12, 16); - - public AnimatedBlock(Properties properties) { - super(properties); - } - - @Override - public VoxelShape getShape(BlockState pState, BlockGetter pLevel, BlockPos pPos, CollisionContext pContext) { - return SHAPE; - } - - @Nullable - @Override - public BlockEntity newBlockEntity(BlockPos blockPos, BlockState state) { - return new AnimatedBlockEntity(blockPos, state); - } - - @Override - public RenderShape getRenderShape(BlockState state) { - return RenderShape.ENTITYBLOCK_ANIMATED; - } -} diff --git a/src/main/java/com/imbgt/ibg/block/custom/PartBlock.java b/src/main/java/com/imbgt/ibg/block/custom/PartBlock.java index ff36b82..c4909f9 100644 --- a/src/main/java/com/imbgt/ibg/block/custom/PartBlock.java +++ b/src/main/java/com/imbgt/ibg/block/custom/PartBlock.java @@ -157,9 +157,9 @@ public class PartBlock extends Block implements EntityBlock { if (master == null) { IBG.LOGGER.info("nul"); // // No master? Clean up. - // level.setBlock(pos, Blocks.AIR.defaultBlockState(), - // Block.UPDATE_CLIENTS | Block.UPDATE_KNOWN_SHAPE | - // Block.UPDATE_SUPPRESS_DROPS); + level.setBlock(pos, Blocks.AIR.defaultBlockState(), + Block.UPDATE_CLIENTS | Block.UPDATE_KNOWN_SHAPE | + Block.UPDATE_SUPPRESS_DROPS); return; } diff --git a/src/main/java/com/imbgt/ibg/block/entity/AnimatedBlockEntity.java b/src/main/java/com/imbgt/ibg/block/entity/AnimatedBlockEntity.java deleted file mode 100644 index 5884e2d..0000000 --- a/src/main/java/com/imbgt/ibg/block/entity/AnimatedBlockEntity.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.imbgt.ibg.block.entity; - -import net.minecraft.core.BlockPos; -import net.minecraft.world.level.block.entity.BlockEntity; -import net.minecraft.world.level.block.state.BlockState; -import software.bernie.geckolib.animatable.GeoBlockEntity; -import software.bernie.geckolib.core.animatable.GeoAnimatable; -import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache; -import software.bernie.geckolib.core.animatable.instance.SingletonAnimatableInstanceCache; -import software.bernie.geckolib.core.animation.AnimatableManager; -import software.bernie.geckolib.core.animation.Animation; -import software.bernie.geckolib.core.animation.AnimationController; -import software.bernie.geckolib.core.animation.AnimationState; -import software.bernie.geckolib.core.animation.RawAnimation; -import software.bernie.geckolib.core.object.PlayState; -import software.bernie.geckolib.util.RenderUtils; - -public class AnimatedBlockEntity extends BlockEntity implements GeoBlockEntity { - - private AnimatableInstanceCache cache = new SingletonAnimatableInstanceCache(this); - - public AnimatedBlockEntity(BlockPos pos, BlockState state) { - super(ModBlockEntities.ANIMATED_BLOCK_ENTITY.get(), pos, state); - } - - @Override - public void registerControllers(AnimatableManager.ControllerRegistrar controllerRegistrar) { - controllerRegistrar.add(new AnimationController<>(this, "controller", 0, this::predicate)); - } - - private PlayState predicate(AnimationState tAnimationState) { - tAnimationState.getController().setAnimation(RawAnimation.begin().then("idle", Animation.LoopType.LOOP)); - return PlayState.CONTINUE; - } - - @Override - public AnimatableInstanceCache getAnimatableInstanceCache() { - return cache; - } - - @Override - public double getTick(Object blockEntity) { - return RenderUtils.getCurrentTick(); - } -} diff --git a/src/main/java/com/imbgt/ibg/block/entity/ModBlockEntities.java b/src/main/java/com/imbgt/ibg/block/entity/ModBlockEntities.java index e5963d8..8d7eeeb 100644 --- a/src/main/java/com/imbgt/ibg/block/entity/ModBlockEntities.java +++ b/src/main/java/com/imbgt/ibg/block/entity/ModBlockEntities.java @@ -14,10 +14,6 @@ public class ModBlockEntities { public static final DeferredRegister> BLOCK_ENTITIES = DeferredRegister .create(ForgeRegistries.BLOCK_ENTITY_TYPES, IBG.MOD_ID); - public static final RegistryObject> ANIMATED_BLOCK_ENTITY = BLOCK_ENTITIES - .register("animated_block_entity", () -> BlockEntityType.Builder.of(AnimatedBlockEntity::new, - ModBlocks.ANIMATED_BLOCK.get()).build(null)); - public static final RegistryObject> PART_BE = BLOCK_ENTITIES.register("part", () -> BlockEntityType.Builder.of(PartBE::new, ModBlocks.PART.get()) .build(null));