Jump to content

[1.14.4]Need help finding problem for TileEntities


DarkAssassin

Recommended Posts

 

it doesn´t matter how long i look, i cannot find the error.

 

the log says:

[Server thread/WARN] [minecraft/TileEntity]: Block entity invalid: minecraft:mob_spawner 

but i dont find or remember writing mob_spawner i always wrote spawner. 

Spoiler

 

the code i think that has the error (it doesnt show any in my IDE)


public class MobSpawner extends Block{
    
    public MobSpawner(Properties properties) {
        super(Properties.create(Material.IRON).hardnessAndResistance(3.0f, 3.0f).sound(SoundType.METAL));
        setRegistryName("minecraft:spawner");     
    } 
    @Override
    public TileEntity createTileEntity(BlockState state, IBlockReader world) {
        return new MobSpawnerTileEntity();
    }
    public BlockRenderLayer getRenderLayer()
    {
        return BlockRenderLayer.TRANSLUCENT;
    }
    
    @Override
    public boolean hasTileEntity(BlockState state) {
        return true;
    }
}

@Mod("spawntweak")
public class SpawnTweak{ 
    public static SpawnTweak instance;
    public static final String modid = "spawntweak";
    private static final Logger logger = LogManager.getLogger(modid);
    public SpawnTweak() {
        instance=this;
        FMLJavaModLoadingContext.get().getModEventBus().addListener(this::setup);
        FMLJavaModLoadingContext.get().getModEventBus().addListener(this::clientRegistries);
        MinecraftForge.EVENT_BUS.register(this);  
        }    
private void setup(final FMLCommonSetupEvent event) {        
        logger.info("setup registered");       
    }
    private void clientRegistries(final FMLClientSetupEvent event) {    
        logger.info("client registered");    
    }
    @Mod.EventBusSubscriber(bus=Mod.EventBusSubscriber.Bus.MOD)
    public static class RegistryEvents{
        
        

        @SubscribeEvent
        public static void registerBlocks(final RegistryEvent.Register<Block> event) {
            event.getRegistry().registerAll(

            BlockList.spawner = new MobSpawner(null)
);
            logger.info("Blocks registered");
        }

        
        @SubscribeEvent
        public static void registerTileEntety(RegistryEvent.Register<TileEntityType<?>> event) {           
         TileEntityType<?> type = TileEntityType.Builder.create(MobSpawnerTileEntity::new,  BlockList.spawner).build(null);
          type.setRegistryName("minecraft:spawner");
          event.getRegistry().register(type);
        }
       
    }    
        
    }    
    

the MobSpawnerTileEntity is just the vanilla code

 

Here are my other classes but i think they are ok beacause they are mostly vanilla libaries

 

 

 

Edit: ok the official tag is minecraft:mob_spawner and not spawner, but why is it gone?

Edit2: ive now changed all minecraft:spawner to minecraft:mob_spawner. now i cannot pick up the "spawners"(prev. just blocks without the tile entity) with middle click anymore and after using / setblock minecraft crashed and gave this output:

[02:29:55] [Server thread/ERROR] [minecraft/Chunk]: A TileEntity type fabian.spawntweak.lists.MobSpawnerTileEntity has thrown an exception trying to write state. It will not persist, Report this to the mod author
java.lang.RuntimeException: class fabian.spawntweak.lists.MobSpawnerTileEntity is missing a mapping! This is a bug!
        at net.minecraft.tileentity.TileEntity.writeInternal(TileEntity.java:72) ~[?:?] {re:classloading}
        at net.minecraft.tileentity.TileEntity.write(TileEntity.java:66) ~[?:?] {re:classloading}
        at fabian.spawntweak.lists.MobSpawnerTileEntity.write(MobSpawnerTileEntity.java:72) ~[?:?] {re:classloading}
        at net.minecraft.world.chunk.Chunk.func_223134_j(Chunk.java:444) ~[?:?] {re:classloading}
        at net.minecraft.world.chunk.storage.ChunkSerializer.write(ChunkSerializer.java:303) ~[?:?] {re:classloading}
        at net.minecraft.world.server.ChunkManager.func_219229_a(ChunkManager.java:677) ~[?:?] {re:classloading}
        at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:174) [?:1.8.0_241] {}
        at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:175) [?:1.8.0_241] {}
        at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193) [?:1.8.0_241] {}
        at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1382) [?:1.8.0_241] {}
        at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:482) [?:1.8.0_241] {}
        at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472) [?:1.8.0_241] {}
        at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151) [?:1.8.0_241] {}
        at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174) [?:1.8.0_241] {}
        at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) [?:1.8.0_241] {}
        at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:418) [?:1.8.0_241] {}
        at net.minecraft.world.server.ChunkManager.save(ChunkManager.java:336) [?:?] {re:classloading}
        at net.minecraft.world.server.ServerChunkProvider.save(ServerChunkProvider.java:309) [?:?] {re:classloading,pl:accesstransformer:B}
        at net.minecraft.world.server.ServerWorld.save(ServerWorld.java:770) [?:?] {re:classloading}
        at net.minecraft.server.MinecraftServer.save(MinecraftServer.java:528) [?:?] {re:classloading,pl:accesstransformer:B}
        at net.minecraft.server.MinecraftServer.stopServer(MinecraftServer.java:571) [?:?] {re:classloading,pl:accesstransformer:B}
        at net.minecraft.server.integrated.IntegratedServer.stopServer(IntegratedServer.java:235) [?:?] {re:classloading,pl:runtimedistcleaner:A}
        at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:685) [?:?] {re:classloading,pl:accesstransformer:B}
        at java.lang.Thread.run(Thread.java:748) [?:1.8.0_241] {}

someone on here with the same error said that he forgot to register it but i thought i had registered it here: 

@SubscribeEvent
public static void registerTileEntety(RegistryEvent.Register<TileEntityType<?>> event) {           
         TileEntityType<?> type = TileEntityType.Builder.create(MobSpawnerTileEntity::new,  BlockList.spawner).build(null);
          type.setRegistryName("minecraft:spawner");
          event.getRegistry().register(type);
        }

Edit 3 : i have now(for the vanilla textures that are for the block minecraft:spawner) changed the block in blockList back to spawner but left the id minecraft:mob_spawner. now the texture is shown again and if placed after /give(for some reason the command was now /give (id:)minecraft:spawner) the pig and fire particles appear for a brief moment and then minecraft crashes again with the same error

Edited by DarkAssassin
Link to comment
Share on other sites

38 minutes ago, poopoodice said:

where do you override it?

i just realised that i dont override, i just make a block with the same id but the tile entity doesn´t correctly work when using a different id  either

he said that i should override Blocks.SPAWNER but how can i do that?

 

when using the id minecraft:spawner the spawner block is just a block and minecraft:mob_spawner does not exist but the log still says :

[Server thread/WARN] [minecraft/TileEntity]: Block entity invalid: minecraft:mob_spawner 

but when using the id minecraft:mob_spawner the game instantly crashes whan confronted with that block and this error log:

[02:29:55] [Server thread/ERROR] [minecraft/Chunk]: A TileEntity type fabian.spawntweak.lists.MobSpawnerTileEntity has thrown an exception trying to write state. It will not persist, Report this to the mod author java.lang.RuntimeException: class fabian.spawntweak.lists.MobSpawnerTileEntity is missing a mapping! This is a bug!         at net.minecraft.tileentity.TileEntity.writeInternal(TileEntity.java:72) ~[?:?] {re:classloading}         at net.minecraft.tileentity.TileEntity.write(TileEntity.java:66) ~[?:?] {re:classloading}         at fabian.spawntweak.lists.MobSpawnerTileEntity.write(MobSpawnerTileEntity.java:72) ~[?:?] {re:classloading}         at net.minecraft.world.chunk.Chunk.func_223134_j(Chunk.java:444) ~[?:?] {re:classloading}         at net.minecraft.world.chunk.storage.ChunkSerializer.write(ChunkSerializer.java:303) ~[?:?] {re:classloading}         at net.minecraft.world.server.ChunkManager.func_219229_a(ChunkManager.java:677) ~[?:?] {re:classloading}         at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:174) [?:1.8.0_241] {}         at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:175) [?:1.8.0_241] {}         at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193) [?:1.8.0_241] {}         at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1382) [?:1.8.0_241] {}         at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:482) [?:1.8.0_241] {}         at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472) [?:1.8.0_241] {}         at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151) [?:1.8.0_241] {}         at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174) [?:1.8.0_241] {}         at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) [?:1.8.0_241] {}         at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:418) [?:1.8.0_241] {}         at net.minecraft.world.server.ChunkManager.save(ChunkManager.java:336) [?:?] {re:classloading}         at net.minecraft.world.server.ServerChunkProvider.save(ServerChunkProvider.java:309) [?:?] {re:classloading,pl:accesstransformer:B}         at net.minecraft.world.server.ServerWorld.save(ServerWorld.java:770) [?:?] {re:classloading}         at net.minecraft.server.MinecraftServer.save(MinecraftServer.java:528) [?:?] {re:classloading,pl:accesstransformer:B}         at net.minecraft.server.MinecraftServer.stopServer(MinecraftServer.java:571) [?:?] {re:classloading,pl:accesstransformer:B}         at net.minecraft.server.integrated.IntegratedServer.stopServer(IntegratedServer.java:235) [?:?] {re:classloading,pl:runtimedistcleaner:A}         at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:685) [?:?] {re:classloading,pl:accesstransformer:B}         at java.lang.Thread.run(Thread.java:748) [?:1.8.0_241] {}

ok i figured out that if the tileentityid is minecraft:mob_spawner the game crashes 

if the blockid is minecraft:spawner it replaces the original one

if the tileentityid is minecraft:spawner it does nothing.

Edited by DarkAssassin
Link to comment
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.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
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.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Hello, im kind of a newbie on creating mods, and i been trying to make simples mods so far, Right now, i'm creating a mod which detect an specific type of mob and kill it if reach a certain number, by far the mod is detecting the mob and counting them but at the time it reach the limit number, it don't do anything. The Game don't tweak, don't crash, just i't don't run the method i call, which is kill().   public InteractionResultHolder<ItemStack> use(Level pLevel, Player pPlayer, InteractionHand pUsedHand) { final var TotalCows = pLevel.getNearbyEntities(Cow.class, TargetingConditions.forNonCombat(), pPlayer, pPlayer.getBoundingBox().inflate(5)); if(pLevel.isClientSide){ if(pPlayer.getItemInHand(InteractionHand.MAIN_HAND).getItem() == this.asItem()){ if(!TotalCows.isEmpty()){ if(TotalCows.get(0).isAlive()){ TotalCows.get(0).kill(); } }else{ pPlayer.sendSystemMessage(Component.literal("No hay vacas")); } } } The sendSystemMessage is get triggered, and when i change the method .kill() by any other like send a message it got called, can i get some tips, and a clue of what i'm missing
    • UPD: I DID IT   @Override public void applyEffectTick(LivingEntity livingEntity, int pAmplifier) { Level level = livingEntity.level(); if (!level.isClientSide()) { Holder<DamageType> entropyHolder = level .registryAccess() .registryOrThrow(Registries.DAMAGE_TYPE) .getHolderOrThrow(GTDamageTypes.ENTROPY_KEY); livingEntity.hurt(new DamageSource(entropyHolder), 1); } super.applyEffectTick(livingEntity, pAmplifier); }  
    • So I came to this public class ModDamageTypes{ public static void bootstrap(BootstapContext<DamageType> context) { context.register(GTDamageTypes.ENTROPY_KEY, new DamageType(GrimTales.MOD_ID + "_entropy", 0.1f)); } } public class GTDamageTypes implements DamageTypes { public static final ResourceKey<DamageType> ENTROPY_KEY = register("entropy"); private static ResourceKey<DamageType> register(String name) { return ResourceKey.create(Registries.DAMAGE_TYPE, new ResourceLocation(GrimTales.MOD_ID, name)); } } public class ModWorldGenProvider extends DatapackBuiltinEntriesProvider { public static final RegistrySetBuilder BUILDER = new RegistrySetBuilder() .add(Registries.DAMAGE_TYPE, ModDamageTypes::bootstrap); public ModWorldGenProvider(PackOutput output, CompletableFuture<HolderLookup.Provider> registries) { super(output, registries, BUILDER, Set.of(GrimTales.MOD_ID)); } But! I still have an issue that, I cannot just use Holder.direct, due to it will create error that "Required type:  Holder<DamageType>  Provided : Holder<ResourceKey<DamageType>>" And I still have no clue how to fix it
    • Yea, unless someone else sees this and has a solution in the next 4 or 5 hours, I’m just gonna reinstall the modpack. Thanks for trying to help me out.
    • Sadly, no it didn't work, although the window for minecraft startup stayed longer. do you have anymore recommendations?
  • Topics

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.