remove now unused animated block

This commit is contained in:
2025-08-15 14:39:00 +02:00
parent aa0073905c
commit 82de8a3a01
6 changed files with 3 additions and 105 deletions

View File

@@ -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(

View File

@@ -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<Block> BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, IBG.MOD_ID);
public static final RegistryObject<Block> ANIMATED_BLOCK = BLOCKS.register("animated_block",
() -> new AnimatedBlock(BlockBehaviour.Properties.copy(Blocks.IRON_BLOCK).noOcclusion()));
public static final RegistryObject<Block> PART = BLOCKS.register(
"part",
() -> new PartBlock(BlockBehaviour.Properties.of().noOcclusion().strength(2.0F)));
private static <T extends Block> RegistryObject<Item> registerBlockItem(String name, RegistryObject<T> block) {
return ModItems.ITEMS_REGISTER.register(name, () -> new BlockItem(block.get(), new Item.Properties()));
}
public static void register(IEventBus eventBus) {
BLOCKS.register(eventBus);
}

View File

@@ -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;
}
}

View File

@@ -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;
}

View File

@@ -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 <T extends GeoAnimatable> PlayState predicate(AnimationState<T> 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();
}
}

View File

@@ -14,10 +14,6 @@ public class ModBlockEntities {
public static final DeferredRegister<BlockEntityType<?>> BLOCK_ENTITIES = DeferredRegister
.create(ForgeRegistries.BLOCK_ENTITY_TYPES, IBG.MOD_ID);
public static final RegistryObject<BlockEntityType<AnimatedBlockEntity>> ANIMATED_BLOCK_ENTITY = BLOCK_ENTITIES
.register("animated_block_entity", () -> BlockEntityType.Builder.of(AnimatedBlockEntity::new,
ModBlocks.ANIMATED_BLOCK.get()).build(null));
public static final RegistryObject<BlockEntityType<PartBE>> PART_BE = BLOCK_ENTITIES.register("part",
() -> BlockEntityType.Builder.of(PartBE::new, ModBlocks.PART.get())
.build(null));