you mustn't create a new tileentity because it will not be associated with a physical block and will not update values. one moment and I'll write the correction.
you forgot the @EventHandler over init BUT you don't need it because you can use the Load function that is called on init because you put FMLInitializationEvent as argument.
and you don't have to put NetworkRegistry.INSTANCE.newSimpleChannel(((Mod) Main.class.getAnnotation(Mod.class)).modid()); but you have to put
MessagesHandler.registerPackets();
remove the init that you created and rename Load TO init.
ops for the readInt() my bad i thinked they was number (because i wasn't looking at your code when realising the packet) because the var name num(ber)1 ecc
for the sync problem you have to call sync() when you finished to check neighbours:
public void checkForNeighbors() {
World world = this.worldObj;
int x = this.xCoord;
int y = this.yCoord;
int z = this.zCoord;
if (world.getBlock(x - 1, y, z) == GunnCraftBlocks.Pipe){
num1 = true;
System.out.println("tested block left true");
}
if (world.getBlock(x + 1, y, z) == GunnCraftBlocks.Pipe){
num2 = true;
System.out.println("tested block right true");
}
if (world.getBlock(x, y, z - 1) == GunnCraftBlocks.Pipe){
num3 = true;
System.out.println("tested block front true");
}
if (world.getBlock(x, y, z + 1) == GunnCraftBlocks.Pipe){
num4 = true;
System.out.println("tested block back true");
}
if (world.getBlock(x, y + 1, z) == GunnCraftBlocks.Pipe){
num5 = true;
System.out.println("tested block top true");
}
if (world.getBlock(x, y - 1, z) == GunnCraftBlocks.Pipe){
num6 = true;
System.out.println("tested block bottom true");
}
sync()
}
P.S.
I don't know where you call the check but i suggest you to do this in your block to update only when necessary (calling it every tick would lag the server cause to getBlock iteraction):
@Override
public void onNeighborBlockChange(World world, int x, int y, int z, Block par5) {
if (!world.isRemote) {
TileEntityPipe tileEntity = (TileEntityPipe) world.getTileEntity(x, y, z);
if (tileEntity != null) {
tileEntity.checkForNeighbors();
}
}
}
P.S. I modified checkForNeighbors to take the tile world and coords because pass other coords wouldn't make any sense considering it saves the vars into an instance of tile
P.S. Rename the Handler.java to something like MessageSyncTile.java (because the handler is a subclass) and for TargetPoint you have only to import it from cpw.mods.fml.common.network.NetworkRegistry.TargetPoint
@Override
public void markDirty()
{
writeToNBT(Minecraft.getMinecraft().thePlayer.inventory.getCurrentItem().getTagCompound());
for (int i = 0; i < getSizeInventory(); ++i)
{
if (getStackInSlot(i) != null && getStackInSlot(i).stackSize == 0)
{
itemslots[i] = null;
}
}
}
because first you have to save your content and then you can set all slots to null.
P.S. the line Minecraft.getMinecraft().thePlayer will crash your minecraft when exexuted on client side. I suggest you to pass the EntityPlayer instance that opened the backpack in your constructor, save it in a variable and then reuse it
For that you can use EntityLiving#setAttackTarget(EntityLivingBase) and pass the entity you want to attack as argument. Obviusly you have to pass a specific entity instance existing in the world
1
ok i made some instructions: https://gist.github.com/andry08/9619269677de92e36d5a
then tell if it worked
1
AHHH.... you made an epic mistake...
you mustn't create a new tileentity because it will not be associated with a physical block and will not update values. one moment and I'll write the correction.
1
try breaking and re-placing the pipes
1
sorry for the late reply...
you forgot the @EventHandler over init BUT you don't need it because you can use the Load function that is called on init because you put FMLInitializationEvent as argument.
and you don't have to put NetworkRegistry.INSTANCE.newSimpleChannel(((Mod) Main.class.getAnnotation(Mod.class)).modid()); but you have to put
remove the init that you created and rename Load TO init.
finally it should look like this
after that you have to go in MessagesHandler and modify the line
to
you made a lot of mistakes, you need to follow some tutorials next time like this: http://www.minecraftforge.net/forum/index.php/topic,20135.0.html
1
You have to initalize packet, put this in your main class init:
and also did you modify Main with your main class?
1
what contain the line 84 of TileEntityPipe and can you upload the entire crash on pastebin and link it here?
0
simply insert this:
1
ops for the readInt() my bad i thinked they was number (because i wasn't looking at your code when realising the packet) because the var name num(ber)1 ecc
for the sync problem you have to call sync() when you finished to check neighbours:
P.S.
I don't know where you call the check but i suggest you to do this in your block to update only when necessary (calling it every tick would lag the server cause to getBlock iteraction):
P.S. I modified checkForNeighbors to take the tile world and coords because pass other coords wouldn't make any sense considering it saves the vars into an instance of tile
0
get player instance then do instance.getGameProfile().isLegacy()
it returns a boolean that is if it is premium or not
P.S. sSMinecrafterSs the UUID in cracked player is generated with
0
save the arena as schematic and then import it, I made a little util to do this (works with worldedit 6)
I don't know if it works with asyncWE but I think it should make it work asynchronously too.
And remember that this forum is focused on forge modding and not bukkit plugin, the next time I suggest you to post it to bukkit forums
1
as I wrote before you need to create a message, i posted to you only the handler.
I edited the handler.java and now it is the complete message https://gist.github.com/andry08/1efedbb708310e4d5a5d
And this is the MessagesHandler that miss https://gist.github.com/andry08/4408c68c532f531a398c
P.S. Rename the Handler.java to something like MessageSyncTile.java (because the handler is a subclass) and for TargetPoint you have only to import it from cpw.mods.fml.common.network.NetworkRegistry.TargetPoint
1
You need to sync the server tile entity with the client, ths code may help you:
https://gist.github.com/andry08/1efedbb708310e4d5a5d (you have to create a message, this is going to be the handler)
https://gist.github.com/andry08/4ab90d2632b981d5d63e (you have to put this in your tile)
you have to change
to your custom messages handler and your custom packet
1
I think your code should be like this:
because first you have to save your content and then you can set all slots to null.
P.S. the line Minecraft.getMinecraft().thePlayer will crash your minecraft when exexuted on client side. I suggest you to pass the EntityPlayer instance that opened the backpack in your constructor, save it in a variable and then reuse it
0
your code already do what you want. it shoots an EntityRepulsorBolt when you right click it
0
For that you can use EntityLiving#setAttackTarget(EntityLivingBase) and pass the entity you want to attack as argument. Obviusly you have to pass a specific entity instance existing in the world