GeoffrySkio
Members-
Posts
6 -
Joined
-
Last visited
GeoffrySkio's Achievements
Tree Puncher (2/8)
1
Reputation
-
Open notepad or another basic text editor, and type cmd.exe into the file. Save the file into the same folder as the jar file, but save it as .bat instead of .txt - this will make a runnable file that will be in the folder you want. Then you should be able to run the command. Step 1: Step 2:
-
If you could give the version number that would help in finding a fix
-
The net message is received on the server side, so you can get the player that sent the message from the MessageContext argument @Override public IMessage onMessage(ClientKeyboardPacket message, MessageContext ctx) { //TODO this currently does nothing because I don't have an entity to give it to int jumpPower = message.getJumpPower(); EntityPlayerMP player = ctx.getServerHandler().player; Entity riding = player.getRidingEntity(); //response packet return null; } This will get you the player, then the entity the player is riding. EDIT: AS for sending messages from client to server, sendTo is for server to client, but sendToServer is for client to server //This would work if it is on the server to the client WhenPigsFly.INSTANCE.sendTo(new ClientKeyboardPacket(90), (EntityPlayerMP) event.player); //This is client to server WhenPigsFly.INSTANCE.sendToServer(new ClientKeyboardPacket(90));
-
Hi, I've been working on a custom fluid (no functionality at the moment), and am trying to get a basic texture implemented, it will only display the purple and black error texture. If anyone can help with this issue that would be amazing. I've had a look at several tutorials, but haven't got it working. Github: https://github.com/Geoffry-Skionfinschii/IonicInnovations plasma.json { "forge_marker": 1, "defaults": { "model": "forge:fluid" }, "variants": { "custom": { "fluid": "plasma" } } } FluidPlasma package net.geoff.ionicinnovations.fluids; import net.geoff.ionicinnovations.IonicInnovations; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fluids.Fluid; public class FluidPlasma extends Fluid { public FluidPlasma() { super("plasma", new ResourceLocation(IonicInnovations.modID, "plasma_still"), new ResourceLocation(IonicInnovations.modID, "plasma_flow")); this.setLuminosity(15); this.setDensity(-1000); this.setTemperature(10000000); this.setGaseous(true); } } IonicFluids package net.geoff.ionicinnovations.fluids; import net.minecraftforge.fluids.FluidRegistry; public class IonicFluids { public static final FluidPlasma FLUID_PLASMA = new FluidPlasma(); static { FluidRegistry.enableUniversalBucket(); } public static void registerFluids() { FluidRegistry.registerFluid(FLUID_PLASMA); FluidRegistry.addBucketForFluid(FLUID_PLASMA); } } Thanks for any help.
-
Oh my god I am such a moron. Thanks a ton, I can't believe it haha, I've spent 2 days straight trying to troubleshoot this. You're the best.
-
Hi, I've been struggling with this issue for a few days and haven't found a viable solution (all methods result in the same error). I've got a GUI that doesn't use container, so I need to send a net message across with the data for the GUI so the player can edit the data. I know the code at the moment has a few issues with its layout, I've been mucking around with it trying to isolate the issue for a while, and it needs a good rewrite and reorganization ;-; Currenty this code runs into the error: [14:14:03] [Server thread/ERROR] [FML]: FMLIndexedMessageCodec exception caught io.netty.handler.codec.EncoderException: java.lang.IndexOutOfBoundsException: readerIndex(0) + length(4) exceeds writerIndex(1): UnpooledByteBufAllocator$InstrumentedUnpooledUnsafeHeapByteBuf(ridx: 0, widx: 1, cap: 256) at io.netty.handler.codec.MessageToMessageEncoder.write(MessageToMessageEncoder.java:106) ~[MessageToMessageEncoder.class:4.1.9.Final] at io.netty.handler.codec.MessageToMessageCodec.write(MessageToMessageCodec.java:116) ~[MessageToMessageCodec.class:4.1.9.Final] at io.netty.channel.AbstractChannelHandlerContext.invokeWrite0(AbstractChannelHandlerContext.java:738) ~[AbstractChannelHandlerContext.class:4.1.9.Final] at io.netty.channel.AbstractChannelHandlerContext.invokeWriteAndFlush(AbstractChannelHandlerContext.java:801) ~[AbstractChannelHandlerContext.class:4.1.9.Final] at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:814) ~[AbstractChannelHandlerContext.class:4.1.9.Final] at io.netty.channel.AbstractChannelHandlerContext.writeAndFlush(AbstractChannelHandlerContext.java:794) ~[AbstractChannelHandlerContext.class:4.1.9.Final] at io.netty.channel.AbstractChannelHandlerContext.writeAndFlush(AbstractChannelHandlerContext.java:831) ~[AbstractChannelHandlerContext.class:4.1.9.Final] at io.netty.channel.DefaultChannelPipeline.writeAndFlush(DefaultChannelPipeline.java:1032) ~[DefaultChannelPipeline.class:4.1.9.Final] at io.netty.channel.AbstractChannel.writeAndFlush(AbstractChannel.java:296) ~[AbstractChannel.class:4.1.9.Final] at net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper.sendTo(SimpleNetworkWrapper.java:250) [SimpleNetworkWrapper.class:?] at net.geoff.forcefield.blocks.forcegenerator.BlockFFGen.onBlockActivated(BlockFFGen.java:31) [BlockFFGen.class:?] at net.minecraft.server.management.PlayerInteractionManager.processRightClickBlock(PlayerInteractionManager.java:472) [PlayerInteractionManager.class:?] at net.minecraft.network.NetHandlerPlayServer.processTryUseItemOnBlock(NetHandlerPlayServer.java:767) [NetHandlerPlayServer.class:?] at net.minecraft.network.play.client.CPacketPlayerTryUseItemOnBlock.processPacket(CPacketPlayerTryUseItemOnBlock.java:68) [CPacketPlayerTryUseItemOnBlock.class:?] at net.minecraft.network.play.client.CPacketPlayerTryUseItemOnBlock.processPacket(CPacketPlayerTryUseItemOnBlock.java:13) [CPacketPlayerTryUseItemOnBlock.class:?] at net.minecraft.network.PacketThreadUtil$1.run(PacketThreadUtil.java:21) [PacketThreadUtil$1.class:?] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_151] at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_151] at net.minecraft.util.Util.runTask(Util.java:53) [Util.class:?] at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:798) [MinecraftServer.class:?] at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:743) [MinecraftServer.class:?] at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:192) [IntegratedServer.class:?] at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:592) [MinecraftServer.class:?] at java.lang.Thread.run(Thread.java:748) [?:1.8.0_151] Caused by: java.lang.IndexOutOfBoundsException: readerIndex(0) + length(4) exceeds writerIndex(1): UnpooledByteBufAllocator$InstrumentedUnpooledUnsafeHeapByteBuf(ridx: 0, widx: 1, cap: 256) at io.netty.buffer.AbstractByteBuf.checkReadableBytes0(AbstractByteBuf.java:1396) ~[AbstractByteBuf.class:4.1.9.Final] at io.netty.buffer.AbstractByteBuf.readInt(AbstractByteBuf.java:766) ~[AbstractByteBuf.class:4.1.9.Final] at net.minecraft.network.PacketBuffer.readInt(PacketBuffer.java:953) ~[PacketBuffer.class:?] at net.geoff.forcefield.network.GuiFFGenOpenMessage.toBytes(GuiFFGenOpenMessage.java:39) ~[GuiFFGenOpenMessage.class:?] at net.minecraftforge.fml.common.network.simpleimpl.SimpleIndexedCodec.encodeInto(SimpleIndexedCodec.java:30) ~[SimpleIndexedCodec.class:?] at net.minecraftforge.fml.common.network.simpleimpl.SimpleIndexedCodec.encodeInto(SimpleIndexedCodec.java:26) ~[SimpleIndexedCodec.class:?] at net.minecraftforge.fml.common.network.FMLIndexedMessageToMessageCodec.encode(FMLIndexedMessageToMessageCodec.java:77) ~[FMLIndexedMessageToMessageCodec.class:?] at io.netty.handler.codec.MessageToMessageCodec$1.encode(MessageToMessageCodec.java:67) ~[MessageToMessageCodec$1.class:4.1.9.Final] at io.netty.handler.codec.MessageToMessageEncoder.write(MessageToMessageEncoder.java:88) ~[MessageToMessageEncoder.class:4.1.9.Final] ... 23 more Relevant Code: ForcefieldMod.java preinit event (and creation of packetHandle var) public static final SimpleNetworkWrapper packetHandle = NetworkRegistry.INSTANCE.newSimpleChannel(ForcefieldMod.modId); public static Logger logger; @Mod.EventHandler public void preInit(FMLPreInitializationEvent event) { logger = event.getModLog(); int netId = 0; packetHandle.registerMessage(GuiFFGenOpenMessage.Handler.class, GuiFFGenOpenMessage.class, netId++, Side.CLIENT); } BlockFFGen.java package net.geoff.forcefield.blocks.forcegenerator; import javax.annotation.Nullable; import net.geoff.forcefield.ForcefieldMod; import net.geoff.forcefield.blocks.BlockTileEntity; import net.geoff.forcefield.network.GuiFFGenOpenMessage; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumHand; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; public class BlockFFGen extends BlockTileEntity<TileEntityFFGen> { public BlockFFGen() { super(Material.ROCK, "forcefield_generator"); } @Override public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) { if (!world.isRemote) { TileEntityFFGen tile = getTileEntity(world, pos); if(player.isSneaking()) { tile.setForceField(!tile.isGenerated); } else { ForcefieldMod.packetHandle.sendTo(new GuiFFGenOpenMessage(tile.xSize,tile.ySize,tile.zSize), (EntityPlayerMP) player); } } return true; } @Override public Class<TileEntityFFGen> getTileEntityClass() { return TileEntityFFGen.class; } @Nullable @Override public TileEntityFFGen createTileEntity(World world, IBlockState state) { return new TileEntityFFGen(); } } GuiFFGenOpenMessage.java package net.geoff.forcefield.network; import io.netty.buffer.ByteBuf; import net.geoff.forcefield.ForcefieldMod; import net.geoff.forcefield.blocks.forcegenerator.GuiFFGen; import net.minecraft.client.Minecraft; import net.minecraftforge.fml.common.network.simpleimpl.IMessage; import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler; import net.minecraftforge.fml.common.network.simpleimpl.MessageContext; public class GuiFFGenOpenMessage implements IMessage { public GuiFFGenOpenMessage() {} private int xSize; private int ySize; private int zSize; public GuiFFGenOpenMessage(int xSize, int ySize, int zSize) { // TODO Auto-generated constructor stub this.xSize = xSize; this.ySize = ySize; this.zSize = zSize; } @Override public void fromBytes(ByteBuf buf) { // TODO Auto-generated method stub ForcefieldMod.logger.info(xSize + "" + ySize + "" + zSize); buf.writeInt(xSize); buf.writeInt(ySize); buf.writeInt(zSize); } @Override public void toBytes(ByteBuf buf) { // TODO Auto-generated method stub ForcefieldMod.logger.info(buf); xSize = buf.readInt(); ySize = buf.readInt(); zSize = buf.readInt(); } public static class Handler implements IMessageHandler<GuiFFGenOpenMessage, IMessage> { @Override public IMessage onMessage(GuiFFGenOpenMessage message, MessageContext ctx) { int x = message.xSize; int y = message.ySize; int z = message.zSize; Minecraft.getMinecraft().addScheduledTask(() -> { Minecraft.getMinecraft().displayGuiScreen(new GuiFFGen(x,y,z)); }); return null; } } } The main reason I'm here is I can't find any posts online that reflect the failure to read the information back from the buffer (I have verified with logger outputs that it is writing the data, but is unable to read the data) Thanks all.