It will avoid you having to save and write data all the time and willbe overall more effective.
I think the variable method is more efficient, the variable will be updated only when a neighbour block updates.
World interaction usually are a bit more slow than the variable reading
1) Blocks are singletons, if you use a variable here it will be identical for every block.
2) In your rendering code you are still referencing the metadata but as you said you don't want to use it
In your onNeighborBlockChange you have to get your TileEntityVerticalTrafficLight instance and set the variable in it (move the variable to your TileEntity).
Then in renderTileEntityAt there is an argument that pass the TE, check if it is instanceof TileEntityVerticalTrafficLight and get the variable from it.
DONE
First try writing the code yourself then if you have errors post your attempts and what errors give you
P.S. how didn't you get a crash? I mean in this code:
public VerticalTrafficLight traffic;
private int power = traffic.powered;
you are not setting traffic, it will be always null. How does it didn't threw a NullPointerException?
Keep in mind that Items are singletons, so you can't store this in a field of your Item class. Either store it in the ItemStack's NBT (if the flag is per-stack) or in an IExtendedEntityProperties (if the flag is per-entity).
Ops, I forgot every time this detail
sorry for the bad answer, you need to save the boolean directly to nbt
I tried your code (the one without tile-entity) and it worked. it showed "World: Overworld".
the second part of code doesn't have any problem.
the first can have an error finding the values. try printing out with System.out.println() the values and check that the values (dimension id in particular) are not null or -1 (don't test it in nether because the nether's dimension id is -1 )
make a boolean switch and set it to true/false when the sword is clicked.
relying on that boolean set the entity fire value to a very high value (to the max Integer.MAX_VALUE/20) (because in setfire function it will be multiplied by 20 that's the tick rate) and set it to 0 when the state is not equal.
set Entity in fire by using Entity.setFire(int) .
Remember to save the boolean or when the world reloads it will be resetted.
No, it will work only client side (it will crash server side)
You have to obtain the player and the world from command sender (after that execute the code linked above):
if (!(sender instanceof EntityPlayer)){
return; //block the command execution because not executed by a player (for example command blocks or console)
}
EntityPlayer player = (EntityPlayer) sender;
World world = sender.getEntityWorld();
0
Sorry, can you please post your updated Block, TileEntity and Renderer classes?
It would be easier because you removed some errors.
1
I think the variable method is more efficient, the variable will be updated only when a neighbour block updates.
World interaction usually are a bit more slow than the variable reading
0
You are not checking for null value in the last condition:
you have to put a check before like this:
obviously you put the other conditions before but i don't want to copy all the whole part and you need to do this in the elseif part too
0
In bankai ichigo packet class what's in the line 66?
the code is pretty damaged because of forum editor. the next time use gist to post your code and link it there.
1
1) Blocks are singletons, if you use a variable here it will be identical for every block.
2) In your rendering code you are still referencing the metadata but as you said you don't want to use it
In your onNeighborBlockChange you have to get your TileEntityVerticalTrafficLight instance and set the variable in it (move the variable to your TileEntity).
Then in renderTileEntityAt there is an argument that pass the TE, check if it is instanceof TileEntityVerticalTrafficLight and get the variable from it.
DONE
First try writing the code yourself then if you have errors post your attempts and what errors give you
P.S. how didn't you get a crash? I mean in this code:
you are not setting traffic, it will be always null. How does it didn't threw a NullPointerException?
0
If you need that the player can look around while gui is opened you need to put this in initGui:
BUT if you need that player can move too using keyboard you need to render an overlay using events (if you don't know how to do that use google ).
you can take an example checking how the player list works (the one that opens with the tab key)
0
As said here BossStatus is CLIENT side only.
check if (world.isRemote) before calling BossStatus
EDIT: in your case since you don't have a worl instance check the side with:
1
I tried it and for me it works.
There is only a little problem with your code, you have to check that it will be executed only server side with a check over the flight code:
1
try posting your item's class
0
Ops, I forgot every time this detail
sorry for the bad answer, you need to save the boolean directly to nbt
0
I tried your code (the one without tile-entity) and it worked. it showed "World: Overworld".
the second part of code doesn't have any problem.
the first can have an error finding the values. try printing out with System.out.println() the values and check that the values (dimension id in particular) are not null or -1 (don't test it in nether because the nether's dimension id is -1 )
0
make a boolean switch and set it to true/false when the sword is clicked.
relying on that boolean set the entity fire value to a very high value (to the max Integer.MAX_VALUE/20) (because in setfire function it will be multiplied by 20 that's the tick rate) and set it to 0 when the state is not equal.
set Entity in fire by using Entity.setFire(int) .
Remember to save the boolean or when the world reloads it will be resetted.
0
did you implement ISpecialArmor? that's the only cause to that error...
Post on gist what you tried (the class) and name it with .java extension for syntax highlighting
1
No, it will work only client side (it will crash server side)
You have to obtain the player and the world from command sender (after that execute the code linked above):
1
If you want this for client-side (but I don't think) you can use Minecraft.objectMouseOver like this: https://bitbucket.org/ProfMobius/waila/src/72aa774fa0acacf4b4328559c9b5a1b5d25e958c/src/main/java/mcp/mobius/waila/overlay/RayTracing.java?fileviewer=file-view-default#RayTracing.java-48,44
If you want to do this server-side you can use this:
http://www.minecraftforum.net/forums/mapping-and-modding/minecraft-mods/modification-development/2132650-solved-1-7-2-forge-block-player-is-looking-at?comment=4
BUT remember to replace the first line (because it changed in 1.7.10) to this:
http://www.minecraftforum.net/forums/mapping-and-modding/minecraft-mods/modification-development/2132650-solved-1-7-2-forge-block-player-is-looking-at?comment=22
remember to check if they are not null in both sides