Jump to content

MrJake

Members
  • Posts

    28
  • Joined

  • Last visited

Everything posted by MrJake

  1. After 2 years I found a solution in the Beacon code. Here, If someone would still need it(Override it on a SpecialRenderer): public boolean isGlobalRenderer(TileEntityBeacon te) { return true; }
  2. Sorry, I've updated my master branch. https://github.com/MrJake222/AUNIS/blob/98f04c1373c63c6f15bd69aa259c14c9d7eed478/src/main/java/mrjake/aunis/tileentity/StargateBaseTile.java
  3. Hi, I'm trying to make my mod OpenComputers-compatible, but only as a soft-dependency. But the game keeps crashing when I try to place the block with this TileEntity: https://github.com/MrJake222/AUNIS/blob/master/src/main/java/mrjake/aunis/tileentity/StargateBaseTile.java What am I doing wrong here? EDIT: Crash: https://pastebin.com/qkcYTeri
  4. You cannot reference client code from common code(i.e. loaded from both sides). You need to use proxies. Show your code.
  5. Hi, I've overridden these two methods(according to TileEntity docs? @Override public NBTTagCompound getUpdateTag() { NBTTagCompound compound = new NBTTagCompound(); getStargateRendererState().toNBT(compound); getUpgradeRendererState().toNBT(compound); return compound; } @Override public void handleUpdateTag(NBTTagCompound compound) { getRendererState().fromNBT(compound); getUpgradeRendererState().fromNBT(compound); } The problem is, the first method is called and returns correct compound but the second is never ever called I'm trying to sync the data on world's load. Reloading the world, flying beyond render distance, nothing helps. Any help appreciated!
  6. Hi, I want to achieve effect simillar to holding a map. I want to know how to enable player's hand rendering. I've only stumbled across old threads about it... Any help appreciated
  7. Hi, I'm trying to add blockless fluid to my mod. I don't want for it to be placeable in world. Since "canPlaceInWorld" is final, the only way to do it will be not registering a block for it. But then, the texture in machines and buckets go missing... Do I need a blockstate or what? Do I need to load the textures somehow? Please help. Log doesn't show any errors... https://gist.github.com/MrJake222/79f71576c151d4fe6ea7d508f0712390
  8. So I did a little digging and updated the mappings to the last stable for 1.12 from http://export.mcpbot.bspk.rs and it works! My build.gradle now(fragment): Thanks for suggestions!
  9. Here you are: https://gist.github.com/MrJake222/01ff760421b2d2d07831736508e6d9a7 Also attached full latest.log.
  10. I guess these map obfuscated names to their human-readable form. Frankly, I haven't heard of them so, default?
  11. Hi, I'm trying to get latest Mekanism API to work, but I cannot cope with this exception... https://github.com/mekanism/Mekanism/blob/1.12/src/main/java/mekanism/api/util/BlockInfo.java Older versions of this API use getUnlocalizedName() in this place. I found out that this is 1.13 thing(getTranslationKey) but I'm not sure how standalone Mekanism works then... Am I missing something or implementing APIs wrong? Same method, older API works perfectly...
  12. Yes, It kind of made sense to me, after thinking a bit longer. References also matter... I'm trying to find a reasonable solution. Why not use @SideOnly after all? I have an interface to synchronize my Tileentity states(and opening GUIs) setup like this: @Override @SideOnly(Side.CLIENT) public void setState(EnumStateType stateType, State state) { switch (stateType) { case GUI_STATE: openGui = new RingsGUI(pos, (RingsGuiState) state); Minecraft.getMinecraft().displayGuiScreen(openGui); break; default: break; } }
  13. Nice explanation, thanks. I'll probably stick to the simple channel.
  14. So, what's the diffrence between these two? Are there some docs regarding EventDrivenChannel?
  15. I suppose that with regular channel it's not possible? I've tried that(Not registering client-side packets on dedicated server) and it crashed with unknown enumerator error.
  16. Hi, Question as in topic. I'm trying to get my mod working on a dedicated server and keep getting a java.lang.NoClassDefFoundError: net/minecraft/client/entity/EntityPlayerSP exception. I understand the concept of sides and I'm registering my packet with correct receiving side: INSTANCE.registerMessage(PacketHandler.class, Packet.class, id, Side.CLIENT); id++; As the handler should only be run on client side, I thought it would be OK to use this: EntityPlayer player = Minecraft.getMinecraft().player; World world = player.getEntityWorld(); So again, why this class is instantiated when it's only supposed to be called on the receiving side(which is the logical client)? Should I wrap this up in a proxy and use side specific methods? (Seems kind of useless as it shouldn't be called on server...)
  17. I think it did the job. Thanks ?
  18. Hi, I have a block which has two variants(like wood). When broken, it correctly drops expected item. But when picked up, it stacks up and gets replaced with the other variant(no matter what variant was picked up) I use this code to drop correct items: @Override public void getDrops(NonNullList<ItemStack> drops, IBlockAccess world, BlockPos pos, IBlockState state, int fortune) { int meta = 0; switch (state.getValue(AunisProps.MEMBER_VARIANT)) { case CHEVRON: meta = 8; break; case RING: meta = 0; break; } drops.add(new ItemStack(AunisBlocks.stargateMemberBlock, 1, meta)); } Any help appreciated.
  19. http://shadowfacts.net/tutorials/forge-modding-112/ Great guide, I learned basic modding from there. He takes exactly the same task you're talking about in last 3 posts. Hope It helps Happy modding
  20. Gah, nevermind... This is what mislead me... Now it works INSTANCE.registerMessage(DHDButtonClickedToServer.DHDButtonClickedHandler.class, DHDButtonClickedToServer.class, id, Side.SERVER); id++; INSTANCE.registerMessage(DHDActivateButtonToClient.DHDActivateButtonHandler.class, DHDActivateButtonToClient.class, id, Side.CLIENT); id++;
  21. I was doing it right, so there's another reason my packet is not registered... This is what I have. Any help appreciated On client side I call this: DHDButtonClickedToServer message = new DHDButtonClickedToServer(button, pos); AunisPacketHandler.INSTANCE.sendToServer(message); Aunis.info("DHDButtonClickedToServer sent"); And this works: [16:09:22] [main/INFO] [aunis]: DHDButtonClickedToServer sent But it doesnt get received: package mrjake.aunis.packet; import io.netty.buffer.ByteBuf; import mrjake.aunis.Aunis; import net.minecraft.util.math.BlockPos; import net.minecraftforge.fml.common.network.NetworkRegistry.TargetPoint; import net.minecraftforge.fml.common.network.simpleimpl.IMessage; import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler; import net.minecraftforge.fml.common.network.simpleimpl.MessageContext; // Send from client to server public class DHDButtonClickedToServer implements IMessage { public DHDButtonClickedToServer() {} private int buttonID; private BlockPos dhdPos; public DHDButtonClickedToServer(int buttonID, BlockPos pos) { this.buttonID = buttonID; this.dhdPos = pos; } @Override public void toBytes(ByteBuf buf) { buf.writeInt(buttonID); buf.writeInt(dhdPos.getX()); buf.writeInt(dhdPos.getY()); buf.writeInt(dhdPos.getZ()); } @Override public void fromBytes(ByteBuf buf) { buttonID = buf.readInt(); dhdPos = new BlockPos(buf.readInt(), buf.readInt(), buf.readInt()); } public static class DHDButtonClickedHandler implements IMessageHandler<DHDButtonClickedToServer, IMessage>{ @Override public IMessage onMessage(DHDButtonClickedToServer message, MessageContext ctx) { Aunis.info("DHDButtonClickedToServer received buttonID:"+message.buttonID+" dhdPos:"+message.dhdPos.toString()); ctx.getServerHandler().player.getServerWorld().addScheduledTask(new Runnable() { @Override public void run() { Aunis.info("DHDButtonClickedToServer received buttonID:"+message.buttonID+" dhdPos:"+message.dhdPos.toString()); } }); BlockPos pos = message.dhdPos; DHDActivateButtonToClient activateMessage = new DHDActivateButtonToClient(message.buttonID, pos); TargetPoint point = new TargetPoint(ctx.getServerHandler().player.getEntityWorld().provider.getDimension(), pos.getX(), pos.getY(), pos.getZ(), 64); AunisPacketHandler.INSTANCE.sendToAllAround(activateMessage, point); return null; } } } Registrations is done as follows: package mrjake.aunis.packet; import mrjake.aunis.Aunis; import net.minecraftforge.fml.common.network.NetworkRegistry; import net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper; import net.minecraftforge.fml.relauncher.Side; public class AunisPacketHandler { public static SimpleNetworkWrapper INSTANCE = NetworkRegistry.INSTANCE.newSimpleChannel("aunis"); public static void registerPackets() { int id = 0; INSTANCE.registerMessage(DHDButtonClickedToServer.DHDButtonClickedHandler.class, DHDButtonClickedToServer.class, id, Side.SERVER); INSTANCE.registerMessage(DHDActivateButtonToClient.DHDActivateButtonHandler.class, DHDActivateButtonToClient.class, id, Side.CLIENT); id++; Aunis.info("Registering packets for AUNIS"); } } And in main mod class: @EventHandler public void preInit(FMLPreInitializationEvent event) { logger = event.getModLog(); proxy.registerRenderers(); AunisPacketHandler.registerPackets(); } [16:09:03] [main/INFO] [aunis]: Registering packets for AUNIS
  22. Hi, I find forge docs missing really crucial info. It mentions calling INSTANCE.registerMessage(MyMessageHandler.class, MyMessage.class, 0, Side.Server); but it never tells where to run it or on which side to call it. I found some other mods calling it in FMLPreInitializationEvent but this event is called on client side only(Is it supposed to?). So, where and when should I register my custom packets?
  23. Yes, but my gate will be made to look good in Minecraft and IMO SGCraft and even Lanteacraft gates(7x7) are little bit too small. In terms of code I got *some* inspirations of Greg's mod. But enough offtopic I need my gate rendered.
  24. Oh, there is this misleading comment I left behind... I was offsetting my box of course. Sorry ;)
×
×
  • Create New...

Important Information

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