-
Posts
197 -
Joined
-
Last visited
-
Days Won
1
Everything posted by That_Martin_Guy
-
[1.12] Can not register to a locked registry
That_Martin_Guy replied to Chuckinator's topic in Modder Support
Making variables is the most fundemental property of any programming language. Please, do look up a java tutorial before starting to mod. You will not make any progress otherwise. -
[1.12] Can not register to a locked registry
That_Martin_Guy replied to Chuckinator's topic in Modder Support
public void registerItems(RegistryEvent.Register<Item>event) You wrote the type and parameter name in the same word twice in different classes. This will never work. Also, you need to store the items in variables, you can't just do create new objects and be done with it. If you ever want to check if the player is holding your sword, for example, you can't because you don't have it stored in a variable. -
Items are singletons. If you set a variable for one it will affect all items. You need to attach either meta data or nbt to an ItemStack instance of the item.
-
[1.12] Can not register to a locked registry
That_Martin_Guy replied to Chuckinator's topic in Modder Support
Show code. -
[1.12] Can not register to a locked registry
That_Martin_Guy replied to Chuckinator's topic in Modder Support
Do not manually call registerItems. Just annotate it with SubscribeEvent and its class with Mod#EventBusSubscriber and it will automatically be called as long as it's static (it currently isn't). -
[1.12] How to use ByteBufUtils#readRegistryEvent
That_Martin_Guy replied to That_Martin_Guy's topic in Modder Support
I had read through that multiple times and had somehow missed the third overload. Not 100% sure it is what I want though. EDIT: Whether or not those methods are what I want (I doubt they are) the packet works perfectly with that method call. Thanks! -
You should only call setUnlocalizedName inside the item class, not when you instantiate its variable. It returns an Item, not ItemIronnugget. I have been corrected. This is irrelevant.
-
Before this post gets closed because it's in 1.7.10, why are you creating a brand new class for the iron nugget if you are going to do literally nothing in it? Why not just make ItemIronnugget a type of Item?
-
[1.12] Minecraft creating and registering items and blocks
That_Martin_Guy replied to Chuckinator's topic in Modder Support
Subscribe to the RegistryEvent#Register<T> event. The type should be the type you want to register (Item, Block etc). Then use getRegistry#register(T) to register the item/block/etc. Choonster has an example here (although it's not the way I prefer doing it). -
I need to play a sound on the client from a server called method, so I thought of using a custom made packet. I found a method in ByteBufUtils called readRegistryEvent, and since SoundEvent implements IForgeRegistryEntry.Impl I thought I would be able to use this to send the packet. However, I'm not sure how to call this method properly because of the second parameter. public static <T extends IForgeRegistryEntry<T>> T readRegistryEntry(@Nonnull ByteBuf in, @Nonnull IForgeRegistry<T> registry). Perhaps this is too related to java for this forum, but I'm not sure how I would use this method properly.
-
[1.12] Server crash when registering client message
That_Martin_Guy posted a topic in Modder Support
I've done a similar message on a previous version, but this one crashes when I run it on the server. Specifically, when I do this line. Not sure why, since it works fine in this 1.11.2 version. EDIT: Log: ---- Minecraft Crash Report ---- // Don't be sad, have a hug! <3 Time: 2017-07-04 08:58 Description: Exception in server tick loop net.minecraftforge.fml.common.LoaderExceptionModCrash: Caught exception from The Darkness (thedarkness) Caused by: java.lang.NoClassDefFoundError: net/minecraft/client/multiplayer/WorldClient at java.lang.Class.getDeclaredConstructors0(Native Method) at java.lang.Class.privateGetDeclaredConstructors(Class.java:2671) at java.lang.Class.getConstructor0(Class.java:3075) at java.lang.Class.newInstance(Class.java:412) at net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper.instantiate(SimpleNetworkWrapper.java:171) at net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper.registerMessage(SimpleNetworkWrapper.java:164) at thatmartinguy.thedarkness.TheDarkness.preInit(TheDarkness.java:48) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at net.minecraftforge.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:630) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at com.google.common.eventbus.Subscriber.invokeSubscriberMethod(Subscriber.java:91) at com.google.common.eventbus.Subscriber$SynchronizedSubscriber.invokeSubscriberMethod(Subscriber.java:150) at com.google.common.eventbus.Subscriber$1.run(Subscriber.java:76) at com.google.common.util.concurrent.MoreExecutors$DirectExecutor.execute(MoreExecutors.java:399) at com.google.common.eventbus.Subscriber.dispatchEvent(Subscriber.java:71) at com.google.common.eventbus.Dispatcher$PerThreadQueuedDispatcher.dispatch(Dispatcher.java:116) at com.google.common.eventbus.EventBus.post(EventBus.java:217) at net.minecraftforge.fml.common.LoadController.sendEventToModContainer(LoadController.java:252) at net.minecraftforge.fml.common.LoadController.propogateStateMessage(LoadController.java:230) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at com.google.common.eventbus.Subscriber.invokeSubscriberMethod(Subscriber.java:91) at com.google.common.eventbus.Subscriber$SynchronizedSubscriber.invokeSubscriberMethod(Subscriber.java:150) at com.google.common.eventbus.Subscriber$1.run(Subscriber.java:76) at com.google.common.util.concurrent.MoreExecutors$DirectExecutor.execute(MoreExecutors.java:399) at com.google.common.eventbus.Subscriber.dispatchEvent(Subscriber.java:71) at com.google.common.eventbus.Dispatcher$PerThreadQueuedDispatcher.dispatch(Dispatcher.java:116) at com.google.common.eventbus.EventBus.post(EventBus.java:217) at net.minecraftforge.fml.common.LoadController.distributeStateMessage(LoadController.java:147) at net.minecraftforge.fml.common.Loader.preinitializeMods(Loader.java:604) at net.minecraftforge.fml.server.FMLServerHandler.beginServerLoading(FMLServerHandler.java:98) at net.minecraftforge.fml.common.FMLCommonHandler.onServerStart(FMLCommonHandler.java:335) at net.minecraft.server.dedicated.DedicatedServer.init(DedicatedServer.java:125) at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:549) at java.lang.Thread.run(Thread.java:748) Caused by: java.lang.ClassNotFoundException: net.minecraft.client.multiplayer.WorldClient at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:191) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ... 43 more Caused by: net.minecraftforge.fml.common.asm.ASMTransformerWrapper$TransformerException: Exception in class transformer net.minecraftforge.fml.common.asm.transformers.SideTransformer@5486ee92 from coremod FMLCorePlugin at net.minecraftforge.fml.common.asm.ASMTransformerWrapper$TransformerWrapper.transform(ASMTransformerWrapper.java:262) at net.minecraft.launchwrapper.LaunchClassLoader.runTransformers(LaunchClassLoader.java:279) at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:176) ... 45 more Caused by: java.lang.RuntimeException: Attempted to load class net/minecraft/client/multiplayer/WorldClient for invalid side SERVER at net.minecraftforge.fml.common.asm.transformers.SideTransformer.transform(SideTransformer.java:62) at net.minecraftforge.fml.common.asm.ASMTransformerWrapper$TransformerWrapper.transform(ASMTransformerWrapper.java:258) ... 47 more A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- System Details -- Details: Minecraft Version: 1.12 Operating System: Windows 10 (amd64) version 10.0 Java Version: 1.8.0_131, Oracle Corporation Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation Memory: 439347552 bytes (418 MB) / 566231040 bytes (540 MB) up to 1780482048 bytes (1698 MB) JVM Flags: 0 total; IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0 FML: MCP 9.40 Powered by Forge 14.21.1.2387 5 mods loaded, 5 mods active States: 'U' = Unloaded 'L' = Loaded 'C' = Constructed 'H' = Pre-initialized 'I' = Initialized 'J' = Post-initialized 'A' = Available 'D' = Disabled 'E' = Errored UCH minecraft{1.12} [Minecraft] (minecraft.jar) UCH mcp{9.19} [Minecraft Coder Pack] (minecraft.jar) UCH FML{8.0.99.99} [Forge Mod Loader] (forgeSrc-1.12-14.21.1.2387.jar) UCH forge{14.21.1.2387} [Minecraft Forge] (forgeSrc-1.12-14.21.1.2387.jar) UCE thedarkness{0.0.1} [The Darkness] (TheDarkness) Loaded coremods (and transformers): Profiler Position: N/A (disabled) Is Modded: Definitely; Server brand changed to 'fml,forge' Type: Dedicated Server (map_server.txt) -
[1.12] [RESOLVED] Shulker box doesn't generate
That_Martin_Guy replied to That_Martin_Guy's topic in Modder Support
It works now! Thanks guys! Diff for anyone curious on how I did it. -
[1.12] [RESOLVED] Shulker box doesn't generate
That_Martin_Guy replied to That_Martin_Guy's topic in Modder Support
The reason I created that is because that's what diesieben told me to try it (atleast the way I interpreted it, which might be the wrong way). Besides, passing in the normal block coordinates without shift-right doesn't generate it either. -
[1.12] [RESOLVED] Shulker box doesn't generate
That_Martin_Guy replied to That_Martin_Guy's topic in Modder Support
World#getChunkFromCoords already uses shift right: public Chunk getChunkFromBlockCoords(BlockPos pos) { return this.getChunkFromChunkCoords(pos.getX() >> 4, pos.getZ() >> 4); } . Either way, this didn't work. -
[1.12] [RESOLVED] Shulker box doesn't generate
That_Martin_Guy replied to That_Martin_Guy's topic in Modder Support
Still doesn't generate. Code EDIT: Actually I got an idea. Let me try it. EDIT 2: Shoot. It didn't work. Here's what I tried. -
[1.12] [RESOLVED] Shulker box doesn't generate
That_Martin_Guy replied to That_Martin_Guy's topic in Modder Support
Would you mind showing me the line were I set the position at 0? I'm sorry but I'm really confused here. -
[1.12] [RESOLVED] Shulker box doesn't generate
That_Martin_Guy replied to That_Martin_Guy's topic in Modder Support
How do I call it at 0? I thought I based it off of the player's spawn position. -
[1.12] [RESOLVED] Shulker box doesn't generate
That_Martin_Guy replied to That_Martin_Guy's topic in Modder Support
I don't really understand that. Like I said I haven't messed with world generation yet. Also, I don't think I explained this properly, but I want this shulker box to spawn at the edge of the obsidian platform the player spawns on in the end 100% of the time, then never again. -
[1.12] [RESOLVED] Shulker box doesn't generate
That_Martin_Guy replied to That_Martin_Guy's topic in Modder Support
I'm not sure, I haven't messed with world generation before. I looked at Choonster's test mod while doing it, and he seemed to do something very similar to what I did. Changing it to 100 doesn't work. Are you sure that is the case? That doesn't really help much -
I am trying to generate a shulker box with a single item inside in this class. The problem is that it simply doesn't generate at all. Forge doesn't give me any related to the loot table (only rendering errors because I don't have any renderer for my items and blocks). Any ideas? EDIT: A solution has been found. Feel free to look at this diff.
-
When talking about proxies I mostly see people use them for rendering code in the client or common code which can be used for both, but are usually called in the main mod class nowadays instead of the CommonProxy. Even Choonster's test mod's DedicatedServerProxy is only used for handling errors were something is called on the wrong side. My question is ultimately what you would put in this class that would not work in common or client code.
-
[1.10.2] Lamp won't update lighting properly
That_Martin_Guy replied to That_Martin_Guy's topic in Modder Support
Does anyone have an idea? It would be horrible if I can't fix this mod-breaking bug. -
[1.10.2] Lamp won't update lighting properly
That_Martin_Guy replied to That_Martin_Guy's topic in Modder Support
I managed to fix the lighting- somewhat. I just now realised that I was using Block#lightLevel to update my lighting, instead of the actual base light level like I had intended. A new variable has been introduced and the setLightLevel parameter that I passed in has also been updated. The multipliers for the lighting are a bit too high, though, and it gets brighter than minecraft can handle. A small tweak to them will fix it though. Still, though, the lighting only updates when the block is draining, not when it gets charged. Why is this? -
[1.10.2] Lamp won't update lighting properly
That_Martin_Guy replied to That_Martin_Guy's topic in Modder Support
The block correctly calculates energy (log excerpt as proof). It just doesn't update when charging AFAIK. -
[1.10.2] Lamp won't update lighting properly
That_Martin_Guy replied to That_Martin_Guy's topic in Modder Support
Finally some progress! The block can actually get to HIGH now. Still a problem, however. The lighting values aren't correct. In a cycle of HIGH -> MEDIUM -> LOW -> EMPTY it should, with the blockLightBulb instance I created, have a lighting cycle like this (if drained): 15 -> 6 -> 3 -> 0, but it goes like this: 0 -> 9 -> 12 -> 0. I tried using Math.round on the return values in getLightValue, but it didn't change. I definitely should've mentioned this earlier since it has always been a ever since I got the lighting to actually update at all. Also, the block still doesn't update lighting when charging up. The main change from the previous code is that it actually logs HIGH, unlike any previous experiment. Github