Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

[1.16.5] Block entity invalid when implement ITickableEntity


Recommended Posts

When I place block with tickable tile entity, this happens

[13:36:59] [Render thread/WARN] [minecraft/TileEntity]: Block entity invalid: futurearmour:fabricator_controller_tet @ BlockPos{x=-149, y=4, z=341}
[13:36:59] [Server thread/WARN] [minecraft/TileEntity]: Block entity invalid: futurearmour:fabricator_controller_tet @ BlockPos{x=-149, y=4, z=341}

 

Tile Entity:

Spoiler

package com.spu.futurearmour.content.tileentities;

import com.spu.futurearmour.setup.TileEntityTypeRegistry;
import net.minecraft.tileentity.ITickableTileEntity;
import net.minecraft.tileentity.TileEntity;

import java.util.UUID;

public class FabricatorControllerTileEntity extends TileEntity implements ITickableTileEntity {
    public FabricatorControllerTileEntity() {
        super(TileEntityTypeRegistry.FABRICATOR_CONTROLLER_TILE_ENTITY_TYPE.get());
    }

    @Override
    public void tick() {

    }
}

 

 

Block:

Spoiler

package com.spu.futurearmour.content.blocks.fabricator;

import com.spu.futurearmour.content.tileentities.FabricatorControllerTileEntity;
import net.minecraft.block.*;
import net.minecraft.block.material.Material;
import net.minecraft.item.BlockItemUseContext;
import net.minecraft.state.DirectionProperty;
import net.minecraft.state.StateContainer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Direction;
import net.minecraft.world.IBlockReader;

import javax.annotation.Nullable;

public class FabricatorController extends Block {
    public static final DirectionProperty FACING = HorizontalBlock.FACING;

    public FabricatorController() {
        super(AbstractBlock.Properties.of(Material.HEAVY_METAL)
        .strength(5)
        .sound(SoundType.METAL));

        this.registerDefaultState(this.stateDefinition.any().setValue(FACING, Direction.NORTH));
    }

    @SuppressWarnings("deprecation")
    public BlockRenderType getRenderShape(BlockState blockState) {
        return BlockRenderType.MODEL;
    }

    public BlockState getStateForPlacement(BlockItemUseContext itemUseContext) {
        return this.defaultBlockState().setValue(FACING, itemUseContext.getHorizontalDirection().getOpposite());
    }

    protected void createBlockStateDefinition(StateContainer.Builder<Block, BlockState> stateBuilder) {
        stateBuilder.add(FACING);
    }

    @Override
    public boolean hasTileEntity(BlockState state) {
        return true;
    }

    @Nullable
    @Override
    public TileEntity createTileEntity(BlockState state, IBlockReader world) {
        return new FabricatorControllerTileEntity();
    }
}

 

 

Registration:

Spoiler

package com.spu.futurearmour.setup;

import com.spu.futurearmour.content.ModItemModelsProperties;

public class Registration {
    public static void register(){
        BlockRegistry.register();
        TileEntityTypeRegistry.register();
        ItemRegistry.register();
    }

    public static void registerClientOnly(){
        ModItemModelsProperties.register();
    }
}

 

Spoiler

package com.spu.futurearmour.setup;

import com.spu.futurearmour.FutureArmour;
import com.spu.futurearmour.content.blocks.*;
import com.spu.futurearmour.content.blocks.fabricator.FabricatorController;
import net.minecraft.block.Block;
import net.minecraft.item.BlockItem;
import net.minecraft.item.Item;
import net.minecraftforge.fml.RegistryObject;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.ForgeRegistries;

public class BlockRegistry {
    public static final DeferredRegister<Block> BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, FutureArmour.MOD_ID);

    public static void register(){
        BLOCKS.register(FMLJavaModLoadingContext.get().getModEventBus());
    }

    public static final RegistryObject<FabricatorController> FABRICATOR_CONTROLLER_BLOCK =
            BLOCKS.register("fabricator_controller_block", () -> new FabricatorController());
    public static final RegistryObject<Item> FABRICATOR_CONTROLLER_BLOCK_ITEM =
            ItemRegistry.ITEMS.register("fabricator_controller_block", ()->
                    new BlockItem(FABRICATOR_CONTROLLER_BLOCK.get(), new Item.Properties().tab(FutureArmour.ITEM_GROUP)));
}

 

Spoiler

package com.spu.futurearmour.setup;

import com.spu.futurearmour.FutureArmour;
import com.spu.futurearmour.content.tileentities.FabricatorControllerTileEntity;
import net.minecraft.tileentity.TileEntityType;
import net.minecraftforge.fml.RegistryObject;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.ForgeRegistries;

public class TileEntityTypeRegistry {
    public static final DeferredRegister<TileEntityType<?>> TILE_ENTITY_TYPES = DeferredRegister.create(ForgeRegistries.TILE_ENTITIES, FutureArmour.MOD_ID);

    public static void register() {
        TILE_ENTITY_TYPES.register(FMLJavaModLoadingContext.get().getModEventBus());
    }

    public static final RegistryObject<TileEntityType<FabricatorControllerTileEntity>> FABRICATOR_CONTROLLER_TILE_ENTITY_TYPE =
            TILE_ENTITY_TYPES.register("fabricator_controller_tet", () ->
                    TileEntityType.Builder.of(FabricatorControllerTileEntity::new).build(null));
}

 

Any suggestions?

Link to post
Share on other sites

Do not put a DeferredRegister and its entries in separate classes (mainly FABRICATOR_CONTROLLER_BLOCK_ITEM and ItemRegistry.ITEMS). Either move FABRICATOR_CONTROLLER_BLOCK_ITEM or make a secondary DeferredRegister for items in BlockRegistry.

You have told your TileEntityType that no blocks are valid for it, hence it reports this fact. Pass the valid blocks to the of method.

  • Like 1
Link to post
Share on other sites
1 hour ago, diesieben07 said:

Do not put a DeferredRegister and its entries in separate classes (mainly FABRICATOR_CONTROLLER_BLOCK_ITEM and ItemRegistry.ITEMS). Either move FABRICATOR_CONTROLLER_BLOCK_ITEM or make a secondary DeferredRegister for items in BlockRegistry.

You have told your TileEntityType that no blocks are valid for it, hence it reports this fact. Pass the valid blocks to the of method.

Wow that was quick, thanks a lot!

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • I don't even have Optifine installed and the game doesn't start, it crashes right away
    • public enum ModArmorMaterial implements IArmorMaterial { ARGENTITE(Alcamod.ModID + ":argentite", 40, new int[] { 3, 6, 8, 3 }, 12, SoundEvents.ITEM_ARMOR_EQUIP_GENERIC, 3.5F, 0.15F, () -> { return Ingredient.fromItems(ModItems.ARGENTITE_INGOT.get()); }), AZURITE(Alcamod.ModID + ":azurite", 45, new int[] { 3, 6, 8, 3 }, 10, SoundEvents.ITEM_ARMOR_EQUIP_GENERIC, 3.7F, 0.16F, () -> { return Ingredient.fromItems(ModItems.AZURITE_INGOT.get()); }), EMATITE(Alcamod.ModID + ":ematite", 50, new int[] { 3, 6, 8, 3 }, 8, SoundEvents.ITEM_ARMOR_EQUIP_GENERIC, 4.0F, 0.17F, () -> { return Ingredient.fromItems(ModItems.EMATITE_INGOT.get()); }), BARITE(Alcamod.ModID + ":barite", 60, new int[] { 3, 6, 8, 3 }, 6, SoundEvents.ITEM_ARMOR_EQUIP_GENERIC, 4.2F, 0.19F, () -> { return Ingredient.fromItems(ModItems.BARITE_INGOT.get()); }), UNPOWERED_NETHER_STAR(Alcamod.ModID + ":unpowered_nether_star", 70, new int[] { 3, 6, 8, 3 }, 6, SoundEvents.ITEM_ARMOR_EQUIP_GENERIC, 4.0F, 0.21F, () -> { return Ingredient.fromItems(Items.NETHER_STAR.getItem()); }), NETHER_STAR(Alcamod.ModID + ":nether_star", 80, new int[] { 3, 6, 8, 3 }, 2, SoundEvents.ITEM_ARMOR_EQUIP_GENERIC, 5.0F, 0.35F, () -> { return Ingredient.fromItems(ModItems.POWERED_NETHER_STAR.get()); }), INVERTED_NETHER_STAR(Alcamod.ModID + ":inverted_nether_star", 100, new int[] { 3, 6, 8, 3 }, 2, SoundEvents.ITEM_ARMOR_EQUIP_GENERIC, 6.0F, 0.60F, () -> { return Ingredient.fromItems(ModItems.INVERTED_NETHER_STAR.get()); }); private static final int[] MAX_DAMAGE_ARRAY = new int[] { 11, 16, 15, 13 }; private final String name; private final int maxDamageFactor; private final int[] damageReductionAmountArray; private final int enchantability; private final SoundEvent soundEvent; private final float toughness; private final float knockBackResistance; private final Supplier<Ingredient> repairMaterial; ModArmorMaterial(String name, int maxDamageFactor, int[] damageReductionAmountArray, int enchantability, SoundEvent soundEvent, float toughness, float knockbackResistance, Supplier<Ingredient> repairMaterial) { this.name = name; this.maxDamageFactor = maxDamageFactor; this.damageReductionAmountArray = damageReductionAmountArray; this.enchantability = enchantability; this.soundEvent = soundEvent; this.toughness = toughness; this.repairMaterial = repairMaterial; this.knockBackResistance = knockbackResistance; } @Override public int getDurability(EquipmentSlotType slotIn) { return MAX_DAMAGE_ARRAY[slotIn.getIndex()] * this.maxDamageFactor; } @Override public int getDamageReductionAmount(EquipmentSlotType slotIn) { return this.damageReductionAmountArray[slotIn.getIndex()]; } @Override public int getEnchantability() { return this.enchantability; } @Override public SoundEvent getSoundEvent() { return this.soundEvent; } @Override public Ingredient getRepairMaterial() { return this.repairMaterial.get(); } @Override public String getName() { return this.name; } @OnlyIn( Dist.CLIENT ) @Override public float getToughness() { return this.toughness; } public float getKnockbackResistance() { return this.knockBackResistance; } }  
    • Just upload it here or use pastbin.
    • And how to show the debug.log?  
  • Topics

  • Who's Online (See full list)

×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.