OreCruncher
Forge Modder-
Posts
165 -
Joined
-
Last visited
Everything posted by OreCruncher
-
[1.12] ForgeRegistries.SOUND_EVENTS gets reset?
OreCruncher replied to OreCruncher's topic in Modder Support
That gave me a clue. My class is annotated with: @Mod.EventBusSubscriber(value = Side.CLIENT) I will make the changes and see what goes. Thanks! EDIT: That was indeed the issue. Thank again! -
With my mod in single player I can lookup a SoundEvent in either the Minecraft or Forge sound registries during gameplay. However, it *appears* that if I connect to a remote server those registries get reset because of the registry sync between client and server - the server never fires the sound registration event so no sounds get registered so the registries are empty. Am I understanding the situation correctly? If I am, is this intended behavior?
-
[1.12] Biome.getBiomeName() is client side only?
OreCruncher replied to OreCruncher's topic in Modder Support
It's not the big things that get me when moving to a new Minecraft version - it's these small details. Thanks! -
For 1.10/1.11 Biome.getBiomeName() was accessible server side. For 1.12 it is marked client side only. Is this an oversight or is there something I need to be concerned with and come up with an alternate way to get the property when running on a dedicated 1.12 server?
-
Contributing to Forge - building client/server jar?
OreCruncher replied to MCB's topic in Modder Support
I run into things like obfuscation and timing related things. I can't say precisely in this particular case it would apply to Forge itself, but in my experience I don't release any Minecraft code unless I run it "retail" in a live test environment. -
Contributing to Forge - building client/server jar?
OreCruncher replied to MCB's topic in Modder Support
There are bugs for my mod that I only find when running on a real server and not in a dev environment. So, to me, the request is not to far fetched. -
For this I would think you need to use the unqiue ID of the mob. This ID is persistent across world reloads and what not. The ID is a UUID, not a simple integer.
-
An integer represents a lot of values. As for whether it is good to use or not depends on what you want to use it for. What is it you are trying to do?
-
Sounds like it could be used as an AFK machine...
-
Village information is kept server side.
-
[1.10.2][1.11.2] Server side message handling
OreCruncher replied to OreCruncher's topic in Modder Support
OK - I have a theory. What I think is happening is that the main server thread is trying to send the client a packet at the same time the server netty thread is doing routing. One stomps on the other causing the channel to lose its mind. I put in code to synchronize access to the channel and I haven't seen the issue reappear. Keeping my fingers crossed. -
[1.10.2][1.11.2] Server side message handling
OreCruncher replied to OreCruncher's topic in Modder Support
Follow on .... how stable is sendToAllAround()? I occasionally get the following exception when processing messages server side: May 15, 2017 10:23:03 AM io.netty.channel.embedded.EmbeddedChannel recordException WARNING: More than one exception was raised. Will report only the first one and log others. java.lang.RuntimeException: DIMENSION expects an integer argument at net.minecraftforge.fml.common.network.FMLOutboundHandler$OutboundTarget$6.validateArgs(FMLOutboundHandler.java:171) at net.minecraftforge.fml.common.network.FMLOutboundHandler.write(FMLOutboundHandler.java:282) at io.netty.channel.AbstractChannelHandlerContext.invokeWrite(AbstractChannelHandlerContext.java:658) at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:716) at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:651) at io.netty.handler.codec.MessageToMessageEncoder.write(MessageToMessageEncoder.java:112) at io.netty.handler.codec.MessageToMessageCodec.write(MessageToMessageCodec.java:116) at io.netty.channel.AbstractChannelHandlerContext.invokeWrite(AbstractChannelHandlerContext.java:658) at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:716) at io.netty.channel.AbstractChannelHandlerContext.writeAndFlush(AbstractChannelHandlerContext.java:706) at io.netty.channel.AbstractChannelHandlerContext.writeAndFlush(AbstractChannelHandlerContext.java:741) at io.netty.channel.DefaultChannelPipeline.writeAndFlush(DefaultChannelPipeline.java:895) at io.netty.channel.AbstractChannel.writeAndFlush(AbstractChannel.java:240) at net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper.sendToAllAround(SimpleNetworkWrapper.java:268) at org.blockartistry.DynSurround.network.Network.sendToAllAround(Network.java:128) at org.blockartistry.DynSurround.network.PacketPlaySound$PacketHandler.onMessage(PacketPlaySound.java:57) at org.blockartistry.DynSurround.network.PacketPlaySound$PacketHandler.onMessage(PacketPlaySound.java:1) at net.minecraftforge.fml.common.network.simpleimpl.SimpleChannelHandlerWrapper.channelRead0(SimpleChannelHandlerWrapper.java:56) at net.minecraftforge.fml.common.network.simpleimpl.SimpleChannelHandlerWrapper.channelRead0(SimpleChannelHandlerWrapper.java:36) at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:105) The TargetPoint data used when doing the sendToAllAround() is embedded in the packet from the client. Here is the packet handler: public static class PacketHandler implements IMessageHandler<PacketPlaySound, IMessage> { @Override @Nullable public IMessage onMessage(@Nonnull final PacketPlaySound message, @Nullable final MessageContext ctx) { if (ctx.side == Side.CLIENT) { // Don't forward if it the current player sent it final EntityPlayer player = EnvironState.getPlayer(); if (player != null && message.locus.entityId != player.getEntityId()) Network.postEvent(new PlayDistributedSoundEvent(message.soundClass, message.nbt)); } else { // No event - turn around quick and broadcast to necessary // clients. This should take place on a Netty thread. Network.sendToAllAround(message.locus, message); } return null; } } "locus" is a the TargetPoint in the incoming packet. Network.sendToAllAround() is a simple wrapper: public static void sendToAllAround(@Nonnull final Locus point, @Nonnull final IMessage msg) { NETWORK.sendToAllAround(msg, point); } And NETWORK is: private static final SimpleNetworkWrapper NETWORK = NetworkRegistry.INSTANCE.newSimpleChannel(DSurround.MOD_ID); So, how stable is it? What is "DIMENSION expects an integer argument" telling me as a modder? EDIT: Packet registrations in case it has bearing. PacketPlaySound is registered both as a client-to-server message as well as server-to-client message: public static void initialize() { // Server -> Client messages NETWORK.registerMessage(PacketWeatherUpdate.PacketHandler.class, PacketWeatherUpdate.class, ++discriminator, Side.CLIENT); NETWORK.registerMessage(PacketHealthChange.PacketHandler.class, PacketHealthChange.class, ++discriminator, Side.CLIENT); NETWORK.registerMessage(PacketSpeechBubble.PacketHandler.class, PacketSpeechBubble.class, ++discriminator, Side.CLIENT); NETWORK.registerMessage(PacketEntityEmote.PacketHandler.class, PacketEntityEmote.class, ++discriminator, Side.CLIENT); NETWORK.registerMessage(PacketThunder.PacketHandler.class, PacketThunder.class, ++discriminator, Side.CLIENT); NETWORK.registerMessage(PacketEnvironment.PacketHandler.class, PacketEnvironment.class, ++discriminator, Side.CLIENT); NETWORK.registerMessage(PacketServerData.PacketHandler.class, PacketServerData.class, ++discriminator, Side.CLIENT); NETWORK.registerMessage(PacketDisplayFootprint.PacketHandler.class, PacketDisplayFootprint.class, ++discriminator, Side.CLIENT); NETWORK.registerMessage(PacketPlaySound.PacketHandler.class, PacketPlaySound.class, ++discriminator, Side.CLIENT); // Client -> Server messages NETWORK.registerMessage(PacketDisplayFootprint.PacketHandler.class, PacketDisplayFootprint.class, ++discriminator, Side.SERVER); NETWORK.registerMessage(PacketPlaySound.PacketHandler.class, PacketPlaySound.class, ++discriminator, Side.SERVER); } -
[1.10.2][1.11.2] Server side message handling
OreCruncher replied to OreCruncher's topic in Modder Support
No, not doing anything like that. Essentially creating a TargetPoint and and re-broadcasting a packet using sendToAllAround(). Thanks! -
Server side I receive a message from a client. While executing on the Netty thread I want to send that packet out to additional clients (essentially a star routing pattern). Is it safe to handle all that on the Netty thread, or should I post a task to the Server thread and route from there?
-
[1.11.2] How to make variable water level in a block
OreCruncher replied to TheUnlocked's topic in Modder Support
I haven't done anything like this myself, but have you looked at how Minecraft handles the standard water block? IIRC it has a concept of how much space is left in the block based on the metadata. -
FYI - sounds are non-streaming by default so you could take some shortcuts in your definition: "bullet_flyby": { "category" : "player", "sounds": [ "modid:bullet/flyby01", "modid:bullet/flyby02", "modid:bullet/flyby03", "modid:bullet/flyby04", "modid:bullet/flyby05", "modid:bullet/flyby06", "modid:bullet/flyby07", "modid:bullet/flyby08", "modid:bullet/flyby09" ]
-
Two things I do if I want to understand something from someone's mod: Look at Github to see if the mod's code is published. A lot of authors (including myself) make mod code available there. I use JD-Gui (a Java Decompiler in GUI form) to look at JARs. This is tougher because the Minecraft names are obsfucated and will require a decoder ring especially if you are new to modding Minecraft. And kudos for not wanting to copy something outright. Make sure you obey any license terms related to a mod's source. Some are very open (like Public Domain or MIT) or very restrictive (All rights reserved, PERIOD).
-
[Forge 1.10.2] How to make new line in the language file.
OreCruncher replied to lethinh's topic in Modder Support
Wow. I knew something Draco didn't. *puffs out chest* -
Any open source projects which are good for learning from.
OreCruncher replied to DireDoesGames's topic in Modder Support
https://github.com/Choonster-Minecraft-Mods/TestMod3 -
Cool. Thanks!
-
What are the rules for Biome object instances present in the Biomes.REGISTRY map? For example, after the preinit phase could a Biome object reference be used as an identity for comparison or should the biome ID be used?
-
[Forge 1.10.2] How to use java reflector to access private method?
OreCruncher replied to lethinh's topic in Modder Support
You could use the Forge reflection helper. I use it in my mod right here to access fields. There are methods in ReflectionHelper to grab hold of methods as well.