Jump to content

American2050

Members
  • Posts

    553
  • Joined

Everything posted by American2050

  1. Anyone any hint? I'm not sure how to set the Dragon to the correct phase, and even then, if that fixes the issue, or the dragon just wont move on the overworld. Thanks a lot.
  2. It's called when a block is break, it works on 1.7 and it works ok on servers from what I have seen also. This part of the code, the one that can spawn the dragon, is called when the block that triggers it gets powered. public void onNeighborBlockChange(World world, BlockPos pos, IBlockState state, Block neighborBlock) { if (!world.isRemote) { if (this.activated && !world.isBlockPowered(pos)) { world.scheduleBlockUpdate(pos, this, 4, 1); } else if (!this.activated && world.isBlockPowered(pos)) { //world.setBlock(x, y, z, Blocks.lit_redstone_lamp, 0, 2); gotActivated(world, pos); } } } gotActivated is a little bit of code to decide different possibilities: public void gotActivated(World world, BlockPos pos) { //Let's remove the water MAMBuilder.placeBlock(world, pos.add(0,+2,0), Blocks.air.getDefaultState()); //Let's remove the pressure plate MAMBuilder.placeBlock(world, pos.add(0,+1,0), Blocks.air.getDefaultState()); //Let's remove the block itself MAMBuilder.placeBlock(world, pos, Blocks.air.getDefaultState()); final int randOutput = (int) (Math.random() * 17); if(randOutput<= { goodThings(world, pos); } else if (randOutput>=9 && randOutput <=12) { regularThings(world, pos); } else { badThings(world, pos); } } badThings is the one that has the chance to spawn dragons. public static void badThings(World world, BlockPos pos) { MAMBuilder.cleanAreaFromBlockBis(world, pos, 5, 5, 7, 0); final int badTimes = (int) (Math.random() * 6)+3; for(int a=0; a <=badTimes; a++) { Entity entityX1; final int j = (int) ((Math.random() * 15)+5); final int rand = (int) (Math.random() * 19); if (ModInfo.DEBUG_MODE){ System.out.println("<< IrishLuck - SM IS: "+rand+" >>"); } switch(rand) { case 0: //BLAZE for(int i=1; i<=j; i++) { entityX1 = new EntityBlaze(world);Stuff.setEntityPos(entityX1, pos.getX(), pos.getY(), pos.getZ());world.spawnEntityInWorld(entityX1); } break; case 1: //CAVE SPIDER for(int i=1; i<=j; i++) { entityX1 = new EntityCaveSpider(world);Stuff.setEntityPos(entityX1, pos.getX(), pos.getY(), pos.getZ());world.spawnEntityInWorld(entityX1); } break; case 2: //CREEPER for(int i=1; i<=j; i++) { entityX1 = new EntityCreeper(world);Stuff.setEntityPos(entityX1, pos.getX(), pos.getY(), pos.getZ());world.spawnEntityInWorld(entityX1); } break; case 3: //ENDERMAN for(int i=1; i<=j; i++) { entityX1 = new EntityEnderman(world);Stuff.setEntityPos(entityX1, pos.getX(), pos.getY(), pos.getZ());world.spawnEntityInWorld(entityX1); } break; case 4: //GHAST for(int i=1; i<=j; i++) { entityX1 = new EntityGhast(world);Stuff.setEntityPos(entityX1, pos.getX(), pos.getY(), pos.getZ());world.spawnEntityInWorld(entityX1); } break; case 5: //IRON GOLEM for(int i=1; i<=j; i++) { entityX1 = new EntityIronGolem(world);Stuff.setEntityPos(entityX1, pos.getX(), pos.getY(), pos.getZ());world.spawnEntityInWorld(entityX1); } break; case 6: //MAGMA CUBE for(int i=1; i<=j; i++) { entityX1 = new EntityMagmaCube(world);Stuff.setEntityPos(entityX1, pos.getX(), pos.getY(), pos.getZ());world.spawnEntityInWorld(entityX1); } break; case 7: //PIG ZOMBIE for(int i=1; i<=j; i++) { entityX1 = new EntityPigZombie(world);Stuff.setEntityPos(entityX1, pos.getX(), pos.getY(), pos.getZ());world.spawnEntityInWorld(entityX1); } break; case 8: //SILVERFISH for(int i=1; i<=j; i++) { entityX1 = new EntitySilverfish(world);Stuff.setEntityPos(entityX1, pos.getX(), pos.getY(), pos.getZ());world.spawnEntityInWorld(entityX1); } break; case 9: //SKELETON for(int i=1; i<=j; i++) { entityX1 = new EntitySkeleton(world);Stuff.setEntityPos(entityX1, pos.getX(), pos.getY(), pos.getZ());world.spawnEntityInWorld(entityX1); } break; case 10: //SLIME for(int i=1; i<=j; i++) { entityX1 = new EntitySlime(world);Stuff.setEntityPos(entityX1, pos.getX(), pos.getY(), pos.getZ());world.spawnEntityInWorld(entityX1); } break; case 11: //SNOWMAN for(int i=1; i<=j; i++) { entityX1 = new EntitySnowman(world);Stuff.setEntityPos(entityX1, pos.getX(), pos.getY(), pos.getZ());world.spawnEntityInWorld(entityX1); } break; case 12: //SPIDER for(int i=1; i<=j; i++) { entityX1 = new EntitySpider(world);Stuff.setEntityPos(entityX1, pos.getX(), pos.getY(), pos.getZ());world.spawnEntityInWorld(entityX1); } break; case 13: //WITCH for(int i=1; i<=j; i++) { entityX1 = new EntityWitch(world);Stuff.setEntityPos(entityX1, pos.getX(), pos.getY(), pos.getZ());world.spawnEntityInWorld(entityX1); } break; case 14: //ZOMBIE for(int i=1; i<=j; i++) { entityX1 = new EntityZombie(world);Stuff.setEntityPos(entityX1, pos.getX(), pos.getY(), pos.getZ());world.spawnEntityInWorld(entityX1); } break; case 15: //SHULKER for(int i=1; i<=j; i++) { entityX1 = new EntityShulker(world);Stuff.setEntityPos(entityX1, pos.getX(), pos.getY(), pos.getZ());world.spawnEntityInWorld(entityX1); } break; case 16: //ENDERMITE for(int i=1; i<=j; i++) { entityX1 = new EntityEndermite(world);Stuff.setEntityPos(entityX1, pos.getX(), pos.getY(), pos.getZ());world.spawnEntityInWorld(entityX1); } break; case 17: //WHITER entityX1 = new EntityWither(world);Stuff.setEntityPos(entityX1, pos.getX(), pos.getY()+2, pos.getZ());world.spawnEntityInWorld(entityX1); break; case 18: //DRAGON entityX1 = new EntityDragon(world); Stuff.setEntityPos(entityX1, pos.getX(), pos.getY()+2, pos.getZ()); world.spawnEntityInWorld(entityX1); break; default: for(int i=1; i<=j; i++) { entityX1 = new EntityBlaze(world);Stuff.setEntityPos(entityX1, pos.getX(), pos.getY()+1, pos.getZ());world.spawnEntityInWorld(entityX1); } } } Stuff.setEntityPos just do this public static void setEntityPos(Entity entity, double x, double y, double z) { double doubleX = (Math.random()*2) - 1; double doubleZ = (Math.random()*2) - 1; entity.setPosition(x+0.5+doubleX, y+0.5, z+0.5+doubleZ); } Any other mob works perfectly, either in 1.9 or 1.7, but the Dragon on 1.9 is broken somehow.
  3. Hello, I have a problem with the Ender Dragon that I spawn with my mod, when it spawn, it does nothing, it just stand still waving the wings and you can't attack him or anything. I was told that in 1.9 it could be for something related with the phases of the dragon, but I'm not sure how should I set that phase before spawning the dragon in the world. Any ideas? This is how I spawned it with the code I had for 1.7 entityX1 = new EntityDragon(world); entityX1.setPosition(pos.getX(), pos.getY()+2, pos.getZ()); world.spawnEntityInWorld(entityX1);
  4. Not sure if this question goes here or not, well, here is the "problem" Whenever I use the gradlew build on Forge 1.9 it creates 2 files, never happened on 1.7.10 where it always creates only 1. What is the "xxx-sources" used for? I have also see some 1.9 mods that come on a .zip file and ask for installation to drop both files on the Mods folder, isn't that "wrong"? Thanks a lot.
  5. In 1.7.10 I used ChatComponentText to print out messages to a player on the chat, but in 1.9 that it missing. Any idea what's the new way to make it? Thanks a lot. PS: How would someone go on, for example a server, if you want the message to appear in all players chat?
  6. Thanks I will be around on the weekend or next week and hopefully we can meet there. Thanks a lot once again
  7. And how would I go sending the "custom texture" (changing one) to the json file in models? Thanks in advance.
  8. Thanks, I will start from there, using a TE. PS: No, it doesn't need to move, but if using a TE will give me this opportunity, it wouldn't hurt neither, gonna check how the TESR works on 1.8.9 and go from there Honestly I thought it was all .json files now.
  9. I forgot the image to illustrate the idea. The Model will render with the texture of the block the player right clicked it with. Like this: But that block I would have to be able to send the texture from the block code itself, as it could be Vanilla ores, as Iron, Gold, Lapis, and so on, but also modded ores like Copper, Tin, Lead, etc. Does this clarifies the idea? PS: Yes, it isn't really what player "is" holding, but what he was holding when he right clicked it, it doesn't matter if after clicking it, the player start holding a different block
  10. Sorry first of all, I didn't know ho to ask this question. Basically what I have is a Custom Model Block that on the center has an Ore block, in the image you will see for example an Iron Ore. Question is easy. I have 2 Models, one with Ore on it, and one without, problem is that I need the one with the Ore Texture, to change, depending on what the player clicks the empty block with. Examples: Iron Ore, Gold Ore, Emerald Ore, Diamond Ore and also, I would need it to work accepting Ores from the ore dictionary, like Coppers, Lead, Aluminum, and other stuff. Back to the question, once I analyze what the player right clicked my empty block with, how can I apply the texture of the block he was holding to my model?
  11. Thanks, well thats what I thought, but... don't ask me why, it's returning the correct side, even when after breaking a block from one of its sides I end up watching the top face of a block, the method still return the correct side and not top. I intentionally did those test, thinking the same way, that it will do the raytrace once the block is not there anymore and it will return the face of the next block I will be looking at, but no, it returns the right face.
  12. Apparently this is gonna work. MovingObjectPosition movingobjectposition = this.getMovingObjectPositionFromPlayer(worldIn, (EntityPlayer) playerIn, false); if (movingobjectposition == null) { return false; } else { System.out.println(movingobjectposition); } Now time to create the switch statement but that's the easy part. Let me know if you see anything wrong in here guys, thanks a lot once again, as always you are great.
  13. Yes I need it to be accurate. Even if Im looking down, it doesnt necesarily mean I hit the block on his top, I could have hit it on any of the 4 faces (sides) too. Thanks for the suggestion about using events, I think that will have to be the way to go for this. PS: I was just playing around with the RayTrace that Draco suggested and also came to my mind the same, that I will look for a block, once the block isn't there anymore, so I'm not sure I can make that work neither. I'm also not sure, what the second vec3 that "worldIn.rayTraceBlocks" needs is? Anyone know? As for first vec3 I think it needs "playerIn.getLookVec();" but I'm not sure what the 2nd one is.
  14. CoolAlias this is why that wont work for what I need. See how I here get to break 3 different block and however the data is always the same. I bet it does work to know where the "empty" block is (The air that share faces with the other 3) but not to know what side I hit the other blocks from. PS: I should have represent it, poiting that I can also break the same block hitting it on any of the 3 faces I can see.
  15. Will give it a try, but in my head I think something will fail here, as this is only considering the rotation pitch but even having those angles I bet player still can see 3 sides of any block. The EnumFacing that is for example on Flint and Steel would be great to have here, but not sure how to acomplish that yet. public boolean onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ)
  16. Thanks Coolalias, I will look into that. I saw about EnumFacing on the Flint and Steel code. Will see how to implement that. Draco18s I need it so, once the player break the block I need to break the 8 that are around it but I need to know where those 8 are, so if he hit the block, on the "North" face of the block (or South), then I break the 1 above and below, the one to the east and west and all the corresponding corners. Now if he hit it from Top or Bottom, I remove all the surrounding ones on the same Y level. That would be the final goal.
  17. I thought that would be a possibility, but I discard it as them I thought I can be at the same position and I can see 3 faces of the block. Now if we consider the direction the player is looking at (Was this the VEC3 or something like that?) maybe then I could be able to know what side he broke. Isn't there any method to get that on an easier way? Does anyone has an example on how that would be done? Thanks a lot.
  18. I need to know, when an special tool I'm making calls the "onBlockDestroyed" how can I know from what side the player broke it. onBlockDestroyed(ItemStack stack, World worldIn, Block blockIn, BlockPos pos, EntityLivingBase playerIn) I basically need to know North or South // East or West // Top or Bottom Thanks for the help.
  19. No worries man, but whenever you can that would be interesting I think it's a cool think to learn so we dont forget to change the version on any place, right now I got used to have to change it by hand 3 times in 3 different places, but knowing it can be automated makes me want to try that
  20. Ohhh so I change it only on the build.gradle and when I "build" the mod it will place it there for me? Nice, didn't know that was how it works... Do I still need to change it by hand on my code itself, for example in Info.java or whatever we use? public static final String VERSION = "1.8.9-0.0.1"; Or is there a way to set up everything so we only need to change it in 1 place?
  21. I'm looking for some tutorial on how to use this on the mcmod.info files. I always see this come already with the placeholder mod created when installing forge, but actually never knew how to use it. Thanks a lot.
  22. Thanks you. I will be mainly used to detect block under the player itself, no mobs or other entities. Haven't consider cases where the player may be jumping, so I'm gonna take a look at that also and see how it goes.
  23. Thanks guys, gonna try those fix Yes really not worried so far with the cases where they are sneaking at the edge of some blocks, will start with the basic for now Thanks.
  24. Would this be a correct way to bring the block the player is standing on? int playerX = (int) (player.posX); int playerY = (int) player.posY; int playerZ = (int) (player.posZ); if (player.posX<0) { playerX = playerX-1; } if (player.posZ<0) { playerZ = playerZ-1; } Block getBlock = world.getBlock(playerX, playerY-1, playerZ); System.out.println(getBlock.getLocalizedName()); System.out.println("Doubles - X: "+ player.posX + " - Y: " + player.posY + " - Z: " + player.posZ); System.out.println("Integers - X: "+ playerX + " - Y: " + playerY + " - Z: " + playerZ); Without the if statements all blocks on the negative coordinates were returning wrong blocks. I also notice that this is not perfect in case the player is standing on blocks edges, for example when holding sneak. But that wouldn't matter, what I like to know if that fix for when player is on negative coordinates is ok, or it should be done in a different way? Thanks.
×
×
  • Create New...

Important Information

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