Jump to content

TehStoneMan

Forge Modder
  • Posts

    81
  • Joined

  • Last visited

Everything posted by TehStoneMan

  1. This is the current state of my source code : https://github.com/TehStoneMan/BetterStorageToo/tree/1.14 When trying to access my capability, I get this error: [17Aug2019 14:00:13.553] [Server thread/INFO] [betterstorage/]: ==== net.minecraftforge.common.capabilities.Capability@5a8110de ==== [17Aug2019 14:00:13.554] [Server thread/ERROR] [net.minecraft.world.chunk.Chunk/]: A TileEntity type io.github.tehstoneman.betterstorage.common.tileentity.TileEntityCrate has thrown an exception trying to write state. It will not persist, Report this to the mod author java.lang.ClassCastException: net.minecraftforge.common.capabilities.Capability cannot be cast to io.github.tehstoneman.betterstorage.common.world.storage.CrateStorage at io.github.tehstoneman.betterstorage.common.tileentity.TileEntityCrate.getCrateStackHandler(TileEntityCrate.java:93) ~[?:?] at io.github.tehstoneman.betterstorage.common.tileentity.TileEntityCrate.getNumCrates(TileEntityCrate.java:316) ~[?:?] at io.github.tehstoneman.betterstorage.common.tileentity.TileEntityCrate.write(TileEntityCrate.java:389) ~[?:?] at net.minecraft.world.chunk.Chunk.func_223134_j(Chunk.java:432) ~[?:?] at net.minecraft.world.chunk.storage.ChunkSerializer.write(ChunkSerializer.java:303) ~[?:?] at net.minecraft.world.server.ChunkManager.func_219229_a(ChunkManager.java:674) ~[?:?] at java.util.stream.ReferencePipeline$2$1.accept(Unknown Source) [?:1.8.0_211] at java.util.stream.ReferencePipeline$2$1.accept(Unknown Source) [?:1.8.0_211] at java.util.stream.ReferencePipeline$3$1.accept(Unknown Source) [?:1.8.0_211] at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(Unknown Source) [?:1.8.0_211] at java.util.stream.AbstractPipeline.copyInto(Unknown Source) [?:1.8.0_211] at java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source) [?:1.8.0_211] at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(Unknown Source) [?:1.8.0_211] at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(Unknown Source) [?:1.8.0_211] at java.util.stream.AbstractPipeline.evaluate(Unknown Source) [?:1.8.0_211] at java.util.stream.ReferencePipeline.forEach(Unknown Source) [?:1.8.0_211] at net.minecraft.world.server.ChunkManager.save(ChunkManager.java:333) [?:?] at net.minecraft.world.server.ServerChunkProvider.save(SourceFile:319) [?:?] at net.minecraft.world.server.ServerWorld.save(ServerWorld.java:746) [?:?] at net.minecraft.server.MinecraftServer.save(MinecraftServer.java:513) [?:?] at net.minecraft.server.MinecraftServer.stopServer(MinecraftServer.java:553) [?:?] at net.minecraft.server.integrated.IntegratedServer.stopServer(IntegratedServer.java:210) [?:?] at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:661) [?:?] at java.lang.Thread.run(Unknown Source) [?:1.8.0_211]
  2. I am trying to use a world capability as part of a storage system, but I am not sure how they work. I have tried following examples I have found, but don't know how to properly access it. I have previously used WorldSaveData, but that method no longer appears to be available in 1.14 Can anybody give me any advice?
  3. I finally figured out the problem - When registering the TileEntity, I needed to include the block it was connected to. @Mod.EventBusSubscriber( bus = Mod.EventBusSubscriber.Bus.MOD ) public class RegistryEventHandler { @SubscribeEvent public static void onTileEntityRegistry( final RegistryEvent.Register< TileEntityType< ? > > event ) { final IForgeRegistry< TileEntityType< ? > > registry = event.getRegistry(); registry.register( TileEntityType.Builder.create( TileEntityLocker::new, BetterStorageBlocks.LOCKER ).build( null ).setRegistryName( ModInfo.MOD_ID, "locker" ) ); // /\- Need list of blocks that use this TileEntity } }
  4. @Mod.EventBusSubscriber( bus = Mod.EventBusSubscriber.Bus.MOD ) public class RegistryEventHandler { @SubscribeEvent public static void onTileEntityRegistry( final RegistryEvent.Register< TileEntityType< ? > > event ) { final IForgeRegistry< TileEntityType< ? > > registry = event.getRegistry(); registry.register( TileEntityType.Builder.create( TileEntityLocker::new ).build( null ).setRegistryName( ModInfo.MOD_ID, "locker" ) ); } } @ObjectHolder( ModInfo.MOD_ID ) public final class BetterStorageTileEntityTypes { @ObjectHolder( "locker" ) public static TileEntityType< TileEntityLocker > LOCKER; } public class TileEntityLocker extends TileEntityLockable { protected int ticksSinceSync; public TileEntityLocker( TileEntityType< ? > tileEntityTypeIn ) { super( tileEntityTypeIn ); } public TileEntityLocker() { super( BetterStorageTileEntityTypes.LOCKER ); } }
  5. The TE is registered. I did have a problem with that, but was solved in another thread. What difference does removing @OnlyIn make?
  6. OK, now that I have my TileEntity working, I can't get it to render. As far as I can tell, the renderer is being registered, or at least there are no errors to say otherwise, but the renderer does not appear to be called. @Mod( ModInfo.MOD_ID ) public class BetterStorage { .... public BetterStorage() { ... FMLJavaModLoadingContext.get().getModEventBus().addListener( ClientEvents::clientStartup ); ... } } public class ClientEvents { public static void clientStartup( final FMLClientSetupEvent event ) { // do something that can only be done on the client BetterStorage.LOGGER.info( "==== Got game settings {} ====", event.getMinecraftSupplier().get().gameSettings ); // <-- Does output to log ClientRegistry.bindTileEntitySpecialRenderer( TileEntityLocker.class, new TileEntityLockerRenderer() ); } } @OnlyIn( Dist.CLIENT ) public class TileEntityLockerRenderer extends TileEntityRenderer< TileEntityLocker > { ... @Override public void render( TileEntityLocker tileEntityLocker, double x, double y, double z, float partialTicks, int destroyStage ) { BetterStorage.LOGGER.info( "Rendering Locker" ); ... } }
  7. Thank you. I was wondering about that since the method I used to set them up in 1.13 seems to be no longer available.
  8. First off, I said that it is new to -->ME<--, and how would I learn to use something that I did not know even exists when everything I have done up to now has worked without any reference to things that I may be missing?
  9. Here: package io.github.tehstoneman.betterstorage.common.tileentity; import net.minecraft.tileentity.TileEntityType; public final class BetterStorageTileEntityTypes { public static TileEntityType< TileEntityCrate > CRATE; public static TileEntityType< TileEntityReinforcedChest > REINFORCED_CHEST; public static TileEntityType< TileEntityLocker > LOCKER; public static TileEntityType< TileEntityReinforcedLocker > REINFORCED_LOCKER; } I guess @ObjectHolder is something new to me - I have not seen it before.
  10. TileEntity public class TileEntityLocker extends TileEntityLockable { public TileEntityLocker() { super( BetterStorageTileEntityTypes.LOCKER ); } } Registering @Mod.EventBusSubscriber( bus = Mod.EventBusSubscriber.Bus.MOD ) public class RegistryEventHandler { .... @SubscribeEvent public static void onTileEntityRegistry( final RegistryEvent.Register< TileEntityType< ? > > event ) { final IForgeRegistry< TileEntityType< ? > > registry = event.getRegistry(); registry.register( TileEntityType.Builder.create( TileEntityLocker::new ).build( null ).setRegistryName( ModInfo.MOD_ID, "locker" ) ); } } Error [20:09:38.492] [Server thread/ERROR] [minecraft/Chunk]: A TileEntity type io.github.tehstoneman.betterstorage.common.tileentity.TileEntityLocker has thrown an exception trying to write state. It will not persist, Report this to the mod author java.lang.RuntimeException: class io.github.tehstoneman.betterstorage.common.tileentity.TileEntityLocker is missing a mapping! This is a bug! at net.minecraft.tileentity.TileEntity.writeInternal(TileEntity.java:63) ~[?:?] {pl:accesstransformer:B} at net.minecraft.tileentity.TileEntity.write(TileEntity.java:57) ~[?:?] {pl:accesstransformer:B} at net.minecraft.world.chunk.Chunk.func_223134_j(Chunk.java:431) ~[?:?] {} at net.minecraft.world.chunk.storage.ChunkSerializer.write(ChunkSerializer.java:302) ~[?:?] {} at net.minecraft.world.chunk.ChunkManager.func_219229_a(ChunkManager.java:660) ~[?:?] {} at java.util.stream.ReferencePipeline$2$1.accept(Unknown Source) [?:1.8.0_211] {} at java.util.stream.ReferencePipeline$2$1.accept(Unknown Source) [?:1.8.0_211] {} at java.util.stream.ReferencePipeline$3$1.accept(Unknown Source) [?:1.8.0_211] {} at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(Unknown Source) [?:1.8.0_211] {} at java.util.stream.AbstractPipeline.copyInto(Unknown Source) [?:1.8.0_211] {} at java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source) [?:1.8.0_211] {} at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(Unknown Source) [?:1.8.0_211] {} at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(Unknown Source) [?:1.8.0_211] {} at java.util.stream.AbstractPipeline.evaluate(Unknown Source) [?:1.8.0_211] {} at java.util.stream.ReferencePipeline.forEach(Unknown Source) [?:1.8.0_211] {} at net.minecraft.world.chunk.ChunkManager.save(ChunkManager.java:319) [?:?] {} at net.minecraft.world.chunk.ServerChunkProvider.save(SourceFile:277) [?:?] {pl:accesstransformer:B} at net.minecraft.world.ServerWorld.save(ServerWorld.java:733) [?:?] {pl:accesstransformer:B} at net.minecraft.server.MinecraftServer.save(MinecraftServer.java:501) [?:?] {pl:accesstransformer:B} at net.minecraft.server.MinecraftServer.stopServer(MinecraftServer.java:541) [?:?] {pl:accesstransformer:B} at net.minecraft.server.integrated.IntegratedServer.stopServer(IntegratedServer.java:210) [?:?] {pl:runtimedistcleaner:A} at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:646) [?:?] {pl:accesstransformer:B} at java.lang.Thread.run(Unknown Source) [?:1.8.0_211] {}
  11. How are TIleEntites registered in 1.14.2? I have tried whatever examples I could find, but I am still getting "missing mapping" errors.
  12. When I look at ISaveDataAccess, all I see is a bunch of func_... with no understanding of what they actually do.
  13. This is the part I am having trouble with: public class CrateStackCollection extends WorldSavedData { ... public static CrateStackCollection get( World world ) { final CrateStackCollection collection = (CrateStackCollection)world.loadData( CrateStackCollection.class, filename ); if( collection == null ) { collection = new CrateStackCollection(); world.setData( filename, collection ); } return collection; } ... } The problem appears to be that world.loadData and world.setData are undefined in 1.13. I have also tried, as suggested by the Forge docs: ... public static CrateStackCollection get( World world ) { MapStorage storage = world.getMapStorage(); final CrateStackCollection collection = (CrateStackCollection)storage.getOrLoadData( CrateStackCollection.class, filename ); if( collection == null ) { collection = new CrateStackCollection(); storage.setData( filename, collection ); } return collection; } ... But that also does not work for a whole different set of reasons. (I believe that part of the docs may not have been updated to 1.13 yet)
  14. Trying to update a mod to 1.13, and previous methods of saving WorldSaveData to World don't seem to work. How does this work in 1.13?
  15. Moving the code to the ModelRegistryEvent fixed the problem. Thanks. Still getting used to how things work now in 1.12
  16. The code above is located in my ClientProxy preInit(). Here is my state mapper public class SizeStateMap extends StateMapperBase { @Override protected ModelResourceLocation getModelResourceLocation( IBlockState state ) { String size = state.getValue( BlockLockable.CONNECTED ) ? "_large" : "_small"; String name = Block.REGISTRY.getNameForObject( state.getBlock() ).toString() + size; Map < IProperty<?>, Comparable<? >> map = Maps. < IProperty<?>, Comparable<? >> newLinkedHashMap(state.getProperties()); map.remove( BlockHorizontal.FACING ); map.remove( BlockLockable.CONNECTED ); if( map.containsKey( BlockDoor.HINGE )) { name += "_" + state.getValue( BlockDoor.HINGE ).getName(); map.remove( BlockDoor.HINGE ); } return new ModelResourceLocation( new ResourceLocation( name ), getPropertyString( map ) ); } }
  17. Hello. I am having a problem with a custom state map for a set of blocks. I set up three blocks using the same custom state map, but only the first block appears, the other two are missing model blocks. Even if I reorder the blocks in the code, it is still only the first block that has the custom state map applied appears. For example, if I have MyStateMap stateMap = new MyStateMap(); ModelLoader.setCustomStateMapper( block1, stateMap ); ModelLoader.setCustomStateMapper( block2, stateMap ); ModelLoader.setCustomStateMapper( block3, stateMap ); then block1 appears as the proper model, but block2 and block3 are missing models. If I move block1 to the bottom, block2 appears normal, but block1 and block3 are missing models. This did seem to work in previous Minecraft versions.
  18. Thanks everybody. That should be all the information I need. As for the client needing to know the owner, it would only be the owner's name (not sure, haven't decided that part yet), and I suppose that can just be stored along with the UUID if needed.
  19. But with several different methods to get the player UUID, which one do I use? The information is to be stored in the tile entity, to be used to determine who can and cannot break the block, as well as which GUI to display on right-click.
  20. I'm looking for a way to record a block owner (as in, the player who placed the block). I already have a tile entity attached to the block. I am mainly interested in the most efficient way to store this info, compare it to players interacting with the block, and saving it to NBT. Does anybody have any suggestions?
  21. I'm not sure if I am doing this right. My UV are still upside-down. Using Forge 1722 vender.json: { "forge-marker": 1, "variants": { "normal": { "model": "cashcraft:vender.obj", "custom": { "flip-v": true } } } } This is a intended to be a multi-block structure (model and textures not yet finalized). I am using an ISmartBlock to switch between the single block (normal Minecraft blockmodel) and the multiblock (obj model) depending on the structure of the blocks. The image here shows the model as rendered in Blender compared to in-game. http://i1318.photobucket.com/albums/t651/Peter_McMurray/ModelCompare.png[/img] (The glass at the "top" of the inverted model in the screenshot is supposed to be transparent, but that's a problem for another time as it is not used in this version of the model)
  22. Does anybody know the correct OBJ export settings to use for exporting from Blender to 1.8.9? I have the model loading through a blockstates .JSON file, and appears to render correctly ("Appears" - can't tell if it is actually facing the right direction), but the texture UVs seem to be upside down.
  23. While that may be a potential solution, I would prefer not to use tile entities for this as the block could be used to fill a large area.
×
×
  • Create New...

Important Information

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