Jump to content

dwilby

Members
  • Posts

    23
  • Joined

  • Last visited

Converted

  • Gender
    Male
  • URL
    https://github.com/dannowilby/Argh

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

dwilby's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. In my mod I am changing the state of a large number of blocks every so often. I have noticed that with the greater number of blocks that I change the state, the laggier it gets. I'm currently calling world.setBlockState for every block I want to change. Is there a way I can batch block state updates to the world?
  2. I'm adding a new system for my custom set of tools and want to create a registry to hold the values for their components--I'm trying to recreate something like tinker's construct. Anyway, I can't seem to register the registry correctly. It seems to run without error, but it doesn't seem to be calling my methods. When calling GameRegistry.findRegistry in the init and postinit methods, it throws a null pointer exception because the registry isn't found. @Mod.EventHandler public void preinit(FMLPreInitializationEvent e) { Log.logger = e.getModLog(); BlockRegistry.init(); MinecraftForge.EVENT_BUS.register(new BlockRegistry()); ItemRegistry.init(); MinecraftForge.EVENT_BUS.register(new ItemRegistry()); MaterialRegistry.init(); MinecraftForge.EVENT_BUS.register(new MaterialRegistry()); TileEntityRegistry.init(); proxy.preinit(e); } public class ToolMaterial extends IForgeRegistryEntry.Impl<ToolMaterial> { private String name; private float efficiency; private float durability; private float modifier; private int harvest; public ToolMaterial(String name, float efficiency, float durability, float modifier, int harvest) { this.durability = durability; this.efficiency = efficiency; this.modifier = modifier; this.harvest = harvest; this.name = name; this.setRegistryName(new ResourceLocation(Argh.MODID, name)); } public float getDurability() { return this.durability; } public float getEfficiency() { return this.efficiency; } public float getModifier() { return this.modifier; } public int getHarvestLevel() { return this.harvest; } public String getName() { return this.name; } public static class PhantomToolMaterial extends ToolMaterial { public PhantomToolMaterial(String name) { super(name, 0, 0, 0, 0); } } } public class MaterialRegistry { public static final ToolMaterial IRON = new ToolMaterial("iron", 15.0f, 100.0f, 0.5f, 0); public static final ToolMaterial DIAMOND = new ToolMaterial("diamond", 30.0f, 200.0f, 1.1f, 3); public static List<ToolMaterial> materials; public static void init() { materials = new ArrayList<ToolMaterial>(); materials.add(IRON); materials.add(DIAMOND); } @SubscribeEvent public void createMaterialRegistry(RegistryEvent.NewRegistry nr) { Log.info("Registering event triggering"); RegistryBuilder<ToolMaterial> rb = new RegistryBuilder<ToolMaterial>(); rb.add(new AddCallback<ToolMaterial>() { @Override public void onAdd(IForgeRegistryInternal<ToolMaterial> owner, RegistryManager stage, int id, ToolMaterial obj, ToolMaterial oldObj) { Log.info("Registering " + obj.getName() + " in association with " + oldObj.getName()); } }).set(new DummyFactory<ToolMaterial>() { @Override public ToolMaterial createDummy(ResourceLocation key) { return new ToolMaterial.PhantomToolMaterial(key.toString()); } }).set(new MissingFactory<ToolMaterial>() { @Override public ToolMaterial createMissing(ResourceLocation key, boolean isNetwork) { return new ToolMaterial.PhantomToolMaterial(key.toString()); } }) .allowModification() .setName(new ResourceLocation(Argh.MODID, "tool_materials")) .create(); Log.info("Finished triggering"); } @SubscribeEvent public void registerMaterials(RegistryEvent.Register<ToolMaterial> r) { for(ToolMaterial t : materials) r.getRegistry().register(t); } }
  3. Have you tried creating an invisible entity which follows the player around and giving that a nameplate? Just an idea
  4. Is there a way to add a custom tile entity to positions that have vanilla blocks? I have tried to do so in my custom tile entity, however when I go back and get the added tile entity with: world.getTileEntity(pos) it returns null. Just after I add it to the world, I can get it using that method, but it is like they disappear; the methods still run and there are still tile entities with those positions, but there is no way to get to them via position. I debugged by adding them to a hashmap with their positions and could get the tile entity but still returned null upon trying their corresponding positions. Here is a picture:
  5. @Choonster It still does not work. I clean installed Forge 1.12-14.21.0.2373 but I still get the same error.
  6. I still get the error. I'll repost the error log just incase there is a small change, but I believe it is the same. java.lang.NoClassDefFoundError: net/minecraftforge/registries/IForgeRegistryEntry at java.lang.Class.forName0(Native Method) ~[?:1.8.0_121] at java.lang.Class.forName(Unknown Source) ~[?:1.8.0_121] at net.minecraftforge.fml.common.AutomaticEventSubscriber.inject(AutomaticEventSubscriber.java:82) ~[forgeSrc-1.11.2-13.20.0.2228.jar:?] at net.minecraftforge.fml.common.FMLModContainer.constructMod(FMLModContainer.java:621) ~[forgeSrc-1.11.2-13.20.0.2228.jar:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_121] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_121] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_121] at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_121] at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) ~[guava-17.0.jar:?] at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) ~[guava-17.0.jar:?] at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) ~[guava-17.0.jar:?] at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) ~[guava-17.0.jar:?] at com.google.common.eventbus.EventBus.post(EventBus.java:275) ~[guava-17.0.jar:?] at net.minecraftforge.fml.common.LoadController.sendEventToModContainer(LoadController.java:246) ~[forgeSrc-1.11.2-13.20.0.2228.jar:?] at net.minecraftforge.fml.common.LoadController.propogateStateMessage(LoadController.java:224) ~[forgeSrc-1.11.2-13.20.0.2228.jar:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_121] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_121] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_121] at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_121] at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) ~[guava-17.0.jar:?] at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) ~[guava-17.0.jar:?] at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) ~[guava-17.0.jar:?] at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) ~[guava-17.0.jar:?] at com.google.common.eventbus.EventBus.post(EventBus.java:275) ~[guava-17.0.jar:?] at net.minecraftforge.fml.common.LoadController.distributeStateMessage(LoadController.java:147) [LoadController.class:?] at net.minecraftforge.fml.common.Loader.loadMods(Loader.java:563) [Loader.class:?] at net.minecraftforge.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:229) [FMLClientHandler.class:?] at net.minecraft.client.Minecraft.init(Minecraft.java:478) [Minecraft.class:?] at net.minecraft.client.Minecraft.run(Minecraft.java:387) [Minecraft.class:?] at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_121] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_121] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_121] at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_121] at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?] at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_121] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_121] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_121] at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_121] at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?] at GradleStart.main(GradleStart.java:26) [start/:?] Caused by: java.lang.ClassNotFoundException: net.minecraftforge.registries.IForgeRegistryEntry at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:191) ~[launchwrapper-1.12.jar:?] at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_121] at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_121] ... 42 more Caused by: java.lang.NullPointerException at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:182) ~[launchwrapper-1.12.jar:?] at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_121] at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_121] ... 42 more [16:47:18] [Client thread/INFO] [STDOUT]: [net.minecraft.init.Bootstrap:printToSYSOUT:600]: ---- Minecraft Crash Report ---- // Don't be sad. I'll do better next time, I promise! Time: 6/26/17 4:47 PM Description: There was a severe problem during mod loading that has caused the game to fail net.minecraftforge.fml.common.LoaderExceptionModCrash: Caught exception from Argh Mod 3 (argh) Caused by: java.lang.NoClassDefFoundError: net/minecraftforge/registries/IForgeRegistryEntry at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Unknown Source) at net.minecraftforge.fml.common.AutomaticEventSubscriber.inject(AutomaticEventSubscriber.java:82) at net.minecraftforge.fml.common.FMLModContainer.constructMod(FMLModContainer.java:621) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) at com.google.common.eventbus.EventBus.post(EventBus.java:275) at net.minecraftforge.fml.common.LoadController.sendEventToModContainer(LoadController.java:246) at net.minecraftforge.fml.common.LoadController.propogateStateMessage(LoadController.java:224) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) at com.google.common.eventbus.EventBus.post(EventBus.java:275) at net.minecraftforge.fml.common.LoadController.distributeStateMessage(LoadController.java:147) at net.minecraftforge.fml.common.Loader.loadMods(Loader.java:563) at net.minecraftforge.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:229) at net.minecraft.client.Minecraft.init(Minecraft.java:478) at net.minecraft.client.Minecraft.run(Minecraft.java:387) at net.minecraft.client.main.Main.main(Main.java:118) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) at net.minecraft.launchwrapper.Launch.main(Launch.java:28) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) at GradleStart.main(GradleStart.java:26) Caused by: java.lang.ClassNotFoundException: net.minecraftforge.registries.IForgeRegistryEntry at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:191) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) ... 42 more Caused by: java.lang.NullPointerException at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:182) ... 44 more
  7. I'm using version 1.11.2-13.20.0.2228 and I have installed it properly.
  8. I get an error, which I posted above, and have no knowledge on how to remedy it.
  9. My project: https://github.com/dannowilby/Argh
  10. Ya, sorry, I understand where you register the blocks, but where do you call the class that registers the blocks?
×
×
  • Create New...

Important Information

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