Jump to content

OreCruncher

Forge Modder
  • Posts

    165
  • Joined

  • Last visited

Everything posted by OreCruncher

  1. 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!
  2. 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?
  3. It's not the big things that get me when moving to a new Minecraft version - it's these small details. Thanks!
  4. 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?
  5. 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.
  6. 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.
  7. I am adding some diagnostic code to my mod that will cross check the registered IBlockStates with the mods configuration. I want to identify blocks that don't match any rules in the configuration. It's a niche need.
  8. So I could do something like traverse the Block registry calling getBlockState() on each entry, and then iterating over getValidStates() result.
  9. Is there a collection kept somewhere that has all the registered IBlockStates? I figured there has to be one - just can't find it for some reason. Maybe I need more coffee.
  10. 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.
  11. 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?
  12. Sounds like it could be used as an AFK machine...
  13. Village information is kept server side.
  14. 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.
  15. 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); }
  16. No, not doing anything like that. Essentially creating a TargetPoint and and re-broadcasting a packet using sendToAllAround(). Thanks!
  17. 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?
  18. 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.
  19. 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" ]
  20. 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).
  21. Wow. I knew something Draco didn't. *puffs out chest*
  22. 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?
  23. 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.
×
×
  • Create New...

Important Information

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