Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 09/19/17 in all areas

  1. It works yes, but it causes other chunks to be loaded. You can see here for more information here But basically in this case, you problem is your setBlock doesn't have any flags passed in so it notifies the neighbors of the change, which if you're on a chunk border loads the other chunk.
    1 point
  2. https://en.wikipedia.org/w/index.php?title=Fallow
    1 point
  3. That isn't a good attitude. How do you think people who write the tutorials figure it out? No one tells them, they just look at the source and use their Java education to figure things out. Also, if someone already has a tutorial to do exactly what you want to do, then what is the fun in making a mod then? You always will need to figure out a lot for your own mod. Anyway, it isn't nice to expect other people to figure out everything for you. Although people on the forum will certainly try to give you some help, you need to also put in some work yourself.
    1 point
  4. Here's your tutorial for networking, since nobody linked it before: https://mcforge.readthedocs.io/en/latest/networking/simpleimpl/ Honestly. Packets are very important and you should learn it at some point or another. With a lot of capabilities it's hard to get the client updated, My sollution was to send all capability updates in a synchronisation packet when the player logs in. Here's an example that I'm currently using to send capability info to the client: public class SmallMessage implements IMessage { public SmallMessage(){} private NBTTagCompound toSend; public SmallMessage(NBTTagCompound tag){ this.toSend = tag; } @Override public void toBytes(ByteBuf buf) { ByteBufUtils.writeTag(buf, this.toSend); } @Override public void fromBytes(ByteBuf buf) { this.toSend = ByteBufUtils.readTag(buf); } public static class MessageHandler implements IMessageHandler<SmallMessage, IMessage> { @Override public IMessage onMessage(final SmallMessage content, final MessageContext ctx) { FMLCommonHandler.instance().getWorldThread(ctx.netHandler).addScheduledTask(new Runnable(){ @Override public void run(){ final IBarHandler handler = Minecraft.getMinecraft().thePlayer.getCapability(CAPABILITY_BAR, null); NBTTagCompound tag = content.toSend; handler.setMana(tag.getInteger("mana")); handler.setHealth(tag.getInteger("health")); handler.setFatigue(tag.getInteger("fatigue")); } }); return null; } } } and I call it using if(player.hasCapability(CAPABILITY_BAR, null)) { final IBarHandler instance = getHandler(player); final NBTTagCompound tag = new NBTTagCompound(); tag.setInteger("mana", instance.getMana()); tag.setInteger("health", instance.getHealth()); tag.setInteger("fatigue", instance.getFatigue()); Main.packetHandler.barWrapper.sendTo(new SmallMessage(tag), (EntityPlayerMP) player); } Obviously you could easily add whatever information to the NBTTagCompound or even work with TagLists and such. The rest of the code is initiated in the way you see in the documentations linked above. If you read it through thoroughly you should be able to get a packet working.
    1 point
  5. You should also never statically construct your blocks/items. So really you need to go through and cleanup your code. Yes, it's work, but you should do it. @Draco18sThere IS reason to use @ObjectHolder for your own items, that his current method doesn't support. OVERRIDES. If anyone comes along and says "Screw you I want to override the functionality of your item" then you just silently detect and use it. This way doesn't support that.
    1 point
×
×
  • Create New...

Important Information

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