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


  • Posts

  • Joined

  • Last visited

  • Days Won


MSpace-Dev last won the day on November 14 2017

MSpace-Dev had the most liked content!


  • Gender
  • URL
  • Location
    South Africa

Recent Profile Visitors

2217 profile views

MSpace-Dev's Achievements

Creeper Killer

Creeper Killer (4/8)



  1. https://github.com/MSpaceDev/CustomChests/tree/1.14.4/src/main/java/com/mspacedev
  2. I have a class called FileManager that manages many things to do with my custom mod files. I'm trying to create a static constant that allows me to reference an array of files whenever I want. However, my program throws an ExceptionInInitializerError. I took a similar test to a basic static void main program, and the program compiled fine. I can't see what I'm doing wrong in my main program below. Here are the relevant files: Log: [11:26:14] [Client thread/ERROR] [ne.mi.fm.ja.FMLModContainer/]: Exception caught during firing event: null Index: 1 Listeners: 0: NORMAL 1: ASM: class com.mspacedev.ModEventSubscriber onRegisterBlocks(Lnet/minecraftforge/event/RegistryEvent$Register;)V 2: ASM: class com.mspacedev.ModEventSubscriber onRegisterItems(Lnet/minecraftforge/event/RegistryEvent$Register;)V java.lang.ExceptionInInitializerError at com.mspacedev.util.Data$Chests.getChestProperties(Data.java:16) at com.mspacedev.ModEventSubscriber.onRegisterBlocks(ModEventSubscriber.java:28) at net.minecraftforge.eventbus.ASMEventHandler_0_ModEventSubscriber_onRegisterBlocks_Register.invoke(.dynamic) at net.minecraftforge.eventbus.ASMEventHandler.invoke(ASMEventHandler.java:80) FileManager: // Files public static final ArrayList<File> chestFiles = getFilesInPath("customchests/chests/"); private static ArrayList<File> getFilesInPath(final String pathName) { ArrayList<File> files = new ArrayList<>(); File folder = new File(pathName); for (final File fileEntry : folder.listFiles()) { if (fileEntry.isDirectory()) continue; files.add(new File(fileEntry.getName())); } return files; } I call this in my RegistryEvent.Register<Block> function: if (!FileManager.chestFiles.isEmpty()) And it returns a NullReferenceException because of the earlier ExceptionInInitializerError
  3. Ah, thanks. I will look into it further tomorrow morning. I have to head off to sleep, but hope I can get something working. Forge 1.14 is a rather large step in the right direction from what I've seen so far!
  4. How would I achieve something like that roughly? Any suggestions / resources I can look into?
  5. I want to expand my mod's features lots in 1.14.4. I want users to be able to specify mobIDs from other mods in JSON to initialise a new item, block and entity for the specified id. To do this, I need to be able to dynamically create these objects. It would be perfect for my mod. You will be able to see that at a quick glance I think: https://www.curseforge.com/minecraft/mc-mods/monster-totems
  6. So, creating new entity types based on other mods is impossible?
  7. Well, that actually does not run. DeferredWorkQueue#runLater does not get called.
  8. I've been doing some research. What are your thoughts on this method? @SubscribeEvent public static void onRegisterEntities(final RegistryEvent.Register<EntityType<?>> event) { DeferredWorkQueue.runLater(() -> { entityBuilder(event); }); } private static void entityBuilder(final RegistryEvent.Register<EntityType<?>> event) { ArrayList<EntityType<?>> all_entities; all_entities = (ArrayList<EntityType<?>>) event.getRegistry().getValues(); Main.LOGGER.debug("ALL LOADED ENTITIES:"); all_entities.forEach(p -> Main.LOGGER.debug(p)); } And will I be able to register new entities under new IDs using the methods within EntityType and ForgeRegistries.ENTITIES? (If I don't go with this method ^)
  9. Is it possible to get all loaded entities in the registry (from all other mods) at runtime, to then be able to spawn in said entity within my mod? I feel it might be possible now, with how structured the registry events are in 1.14. I am also trying to generate new entities at runtime based on this by using a builder pattern of sorts.
  10. In FG 2.3, there was a function called replace. It has now been removed / changed in 1.14.4. Here is the function in FG 2.3. /** * Add a source replacement mapping * * @param token The token to replace * @param replacement The value to replace with */ public void replace(Object token, Object replacement) { replacements.put(token.toString(), replacement); } /** * Add a map of source replacement mappings * * @param map A map of tokens -&gt; replacements */ public void replace(Map<Object, Object> map) { for (Entry<Object, Object> e : map.entrySet()) { replace(e.getKey(), e.getValue()); } } This was useful as it allowed me to edit my version in only gradle.properties replace "@VERSION@", project.version replaceIn "utils.Reference.java"
  11. Ah, I see thanks. Got it working nicely like this @Override public boolean shouldRefresh(World world, BlockPos pos, IBlockState oldState, IBlockState newState) { // Only refresh if new state is not an instance of BlockTotemBase return !(newState.getBlock() instanceof BlockTotemBase); }
  12. I've set TileEntity#shouldRefresh to false so that I can update the blockstate without it resetting its values. However, this makes the tile entity persist when its block is broken. I've added world.removeTileEntity(pos) in theBlock#blockBreak override function. However, the TE still persists. I can verify it is getting called. Am I missing something here? @Override public void breakBlock(World worldIn, BlockPos pos, IBlockState state) { if (!worldIn.isRemote) { if (worldIn.getTileEntity(pos) != null) { if (worldIn.getTileEntity(pos) instanceof TileEntityTotemBase) { TileEntityTotemBase totemBase = (TileEntityTotemBase) worldIn.getTileEntity(pos); // Update totem on Client totemBase.setTotemProperties(); totemBase.sendUpdates(); } } } worldIn.removeTileEntity(pos); // Redundant as super() calls it anyways. Probably need some other calls to remove TE! super.breakBlock(worldIn, pos, state); }
  13. Ah, alright, got it! Will stick to blockstates then
  14. Yes, I saw it's using 2 entirely different blocks. Is that a recommended way to do it? Would I have to create a new Block class for every block where I want its texture to change at runtime?
  15. I have a custom tile entity that can switch between 2 states, simply with bool = !bool When this switch happens, I would like to change one of the texture references in the model.JSON to switch to another texture. How can I achieve this. (There are multiple textures in the single model) I noticed the furnace DOES NOT use blockstates for this. So, interested in how that was done. If not, I will end up using blockstates. Thanks
  • Create New...

Important Information

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