EDIT: Looking back on this, I may make the blocks TileEntities so that they can tick at an equal rate and not use tickRandomly because as it states, it's random and I need an equal tick rate.
Don't want to give away too many spoilers, but I need to check if a player is standing on a block and if they are, give them a potion effect.
I have been using this code in the blocks class file:
public void onEntityWalking(World world, int par2, int par3, int par4, Entity entity) { if(entity instanceof EntityLivingBase){ ((EntityLivingBase) entity).addPotionEffect(new PotionEffect(Potion.blindness.getId(), 20, 10)); } }
However, this only runs the code when the event, 'onEntityWalking' occurs - so when an entity moves(player, mob etc) I'd like the code to continuously refresh the potion effect whilst the player is standing on the block.
A loop that runs, but breaks when they move to a different block, problem is; how does one loop in java!?
I understand loops and how they work, but I really don't understand how forge handles the game. Does every function run once through the MainRegistry class or is it continuously ran?
Anyway! My next attempt at the code also in the block class:
public void onEntityCollidedWithBlock(World world, int par2, int par3, int par4, Entity entity){
System.out.println("Ran Function!");
int x = MathHelper.floor_double(entity.posX);
int y = MathHelper.floor_double(entity.posY-0.2D - (double)entity.yOffset);
int z = MathHelper.floor_double(entity.posZ);
System.out.println(entity.worldObj.getBlock(x, y, z));
Just entities, you should probably add the values as int nextFloats for the dungeon loot rather than a static final, keep the values public so they can be accessed by nei etc
0
Kami, exploration etc?
0
Well, unless there's a method in the client to prevent block placement, there won't be a good way to do it
You could have an array which stores the block data of where not to place and then send a packet to the client to stop them placing it
you could refuse the packet, but I don't think that method exists either
0
Forge modification or a plugin?
0
EDIT: Looking back on this, I may make the blocks TileEntities so that they can tick at an equal rate and not use tickRandomly because as it states, it's random and I need an equal tick rate.
Don't want to give away too many spoilers, but I need to check if a player is standing on a block and if they are, give them a potion effect.
I have been using this code in the blocks class file:
public void onEntityWalking(World world, int par2, int par3, int par4, Entity entity) {
if(entity instanceof EntityLivingBase){
((EntityLivingBase) entity).addPotionEffect(new PotionEffect(Potion.blindness.getId(), 20, 10));
}
}
However, this only runs the code when the event, 'onEntityWalking' occurs - so when an entity moves(player, mob etc) I'd like the code to continuously refresh the potion effect whilst the player is standing on the block.
A loop that runs, but breaks when they move to a different block, problem is; how does one loop in java!?
I understand loops and how they work, but I really don't understand how forge handles the game. Does every function run once through the MainRegistry class or is it continuously ran?
Anyway! My next attempt at the code also in the block class:
public void onEntityCollidedWithBlock(World world, int par2, int par3, int par4, Entity entity){
System.out.println("Ran Function!");
int x = MathHelper.floor_double(entity.posX);
int y = MathHelper.floor_double(entity.posY-0.2D - (double)entity.yOffset);
int z = MathHelper.floor_double(entity.posZ);
System.out.println(entity.worldObj.getBlock(x, y, z));
if (entity.worldObj.getBlock(x, y, z) != null){
Block blindnessPotionBlock = Mblocks.blindnessPotionBlock;
if (entity.worldObj.getBlock(x, y, z) == blindnessPotionBlock ){
if(entity instanceof EntityLivingBase){
((EntityLivingBase) entity).addPotionEffect(new PotionEffect(Potion.blindness.getId(), 20, 10));
}
}
}
}
Couldn't find the code button.....if there is one.
0
Sounds good
0
Caloxeno, I'm sure you have great ideas!
But modders are looking for unique ideas, mods like bigreactors, simple but I bet it was hard to get that idea, chisel the same concept
if you have any 'Unique Ideas' then please let me know.
These ideas should be mod pack worthy, ie not 'Cats+' it should be mods like gregtech, TE thaumcraft etc
0
Same here, looking for ideas. I suggest you read a book, might be stupid. But it WILL give you ideas, youll see things from a different perspective.
Even if its a book like the hunger games, its a dystopian era, that might give you some ideas.
0
Just entities, you should probably add the values as int nextFloats for the dungeon loot rather than a static final, keep the values public so they can be accessed by nei etc