Jump to content

American2050

Members
  • Posts

    553
  • Joined

Everything posted by American2050

  1. So I noticed that in 1.9.4 what was Items.apple in 1.9 now needs to be changed to Items.APPLE in 1.9.4 My question is, do we really need to go file by file on our mod fixing all the Items or Blocks we used and changing the capitalization on the names, or is there another way of doing this? PS: I'm using Eclipse
  2. Thanks a lot, have been trying to figure out what was going one for long time. I will see if I work an Ender Dragon clon or something to make it work on the Overworld Thanks once again.
  3. So I have a project I was working on Forge for Minecraft 1.9 and now I changed to 1.9.4 I do this by changing the version on the gradlew.build file. This line: minecraft { version = "1.9.4-12.17.0.1932-1.9.4" Then on the cmd I do. gradlew clean, then gradlew setupDecompWorkspace and finally gradlew eclipse Everything goes ok and when I build my mod it builds it ok apparently, because it does works on 1.9.4 but not in 1.9 when I try it on MultiMC However, and here is the problem, when I run Minecraft from inside Eclipse, it's still running the old 1.9 version with Forge 12.16.0.1865 Is there anything I'm missing, or I should just create a new working folder for my 1.9.4 updates? Thanks a lot for the help with this.
  4. I'm having a problem with the Ender Dragon on the Overworld. No matter what Phase I set the Dragon to, whenever it spawn, it goes flying to 0/0, instead of staying where it spawned and fight against the player. Is there any way to change this behavior?
  5. I'm checking a radius of 3, so 1 block each side from where the can (my item) is right clicking.
  6. I'm coding an item like a watering can, that when used on crops it picks a random number for example between 1 and 10 and if the number is 1, then it makes the crop on the check position grow by 1 100% of the time. PS: gonna take a look at that alternative you suggest Thanks.
  7. I'm not sure if this is the best way to do this. I need to force a crop to grow. After doing some checks I call this function: world.forceBlockUpdateTick(checkBlock, pos, random); I'm not sure what that last random does. Is there a way to make it so it causes the crop to grow 100% the time? Thanks.
  8. I have a few problems with using world.destroyBlock I'm using it to break blocks with a custom tool on the surroundings of the main block hit by the player, but what I have problems with is 2 things. One is that I would need that the blocks destroyed, for example Redstone Ores drop also the XP and not just redstone. And second, I would need a method that can also apply the Enchantments on the used tool for this blocks, for example Silk Touch or Fortune. Is there a way to make this, or it would be something I will have to code? Thanks a lot.
  9. Thanks Choonster. I believe this is the right way to do it then. EntitySlime entityLocal = new EntitySlime(world); entityLocal.setPosition(pos.getX(), pos.getY(), pos.getZ()); NBTTagCompound tag = new NBTTagCompound(); entityLocal.writeEntityToNBT(tag);; tag.setInteger("Size", 4); entityLocal.readEntityFromNBT(tag); world.spawnEntityInWorld(entityLocal); Thanks a lot for the help and patience
  10. Well, here is an update. Thanks to the help I got here http://www.minecraftforge.net/forum/index.php/topic,38425.0.html now I am able to spawn the Dragon with a Phase other than the 10 default and the Dragon will actually move now. Problem is... Once spawned in the World, the dragon will flight towards 0/0 and this I have no idea how to fix, even if I do the entity to .setAttackTarget(player); it doesnt care, it just flights towards 0/0
  11. I think I understand what you mean, but, wont this be ok? I'm starting my NBT from the data on the Entity itself, and then just changing the Size to be 4 and then passing it back to the entity. Not sure if I'm missing something, so far it works, but maybe I'm going something wrong. EntitySlime entityLocal = new EntitySlime(world); entityLocal.setPosition(pos.getX(), pos.getY(), pos.getZ()); NBTTagCompound tag = entityLocal.getEntityData(); tag.setInteger("Size", 4); entityLocal.readEntityFromNBT(tag); world.spawnEntityInWorld(entityLocal);
  12. Thanks Choonster, I will take a look into that Log4j I'm using the event RightClickBlock now that works way better for what I was needing
  13. Hi, I'm confuse with the way the PlayerInteractEvent is working in 1.9 I would guess that the event always would return the coordinates de player is looking at, but apparently, for the Main Hand it does return the block the player is looking at, while for the Off Hand it returns the coordinates the player is standing on. Am I right, or I'm missing something here? This is the code: @SubscribeEvent public void onPlayerInteractEvent(PlayerInteractEvent event) { World world = event.getWorld(); BlockPos pos = event.getPos(); EntityPlayer player = event.getEntityPlayer(); if(!world.isRemote) { System.out.println(event.getPos()); System.out.println(event.getHand()); if(world.getBlockState(pos).getBlock() instanceof BlockCrops) { System.out.println("Crops!!!"); } }//END WORLD NO REMOTE } And here is an screenshot ingame and what is show on console. (It didn't print twice, I did right click twice) PS: How can I tell if the event was triggered by a Left click or a Right click? Thanks a lot.
  14. I am having problems setting the size of a slime when I want to spawn them. By default they spawn as small ones, but I want the big ones. This is what I have tried, not sure what I'm doing wrong. private static final DataParameter<Integer> SLIME_SIZE = null; EntitySlime entityLocal = new EntitySlime(world); entityLocal.setPosition(pos.getX(), pos.getY(), pos.getZ()); entityLocal.getDataManager().set(SLIME_SIZE, 4); world.spawnEntityInWorld(entityLocal); I believe that's not the way to do it and that's the reason why it just doesnt work
  15. I'm trying this and still nothing. Not sure what I'm missing here. EntityDragon entityLocal = new EntityDragon(world); Stuff.setEntityPos(entityLocal, pos.getX(), pos.getY()+2, pos.getZ()); entityLocal.getDataManager().set(entityLocal.PHASE, Integer.valueOf(PhaseList.STRAFE_PLAYER.getId())); world.spawnEntityInWorld(entityLocal); If anyone has any clue it would be great. PS: 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); }
  16. To create Primed TNT I need to have an "Igniter" EntityTNTPrimed(World worldIn, double x, double y, double z, EntityLivingBase igniter) But what happens if I dont have an entity to associate the event with? This needs to be called within onNeighborBlockChange How would I go around this?
  17. Thanks, yes I'm updating my dev environment and today I did update them to 1845 and saw already that some things have changed, so I was kinda lost. Gonna update again to the newest Forge from today and start from there fixing what is broken now, hopefully I get it right. Thanks for your patience.
  18. That's something I wasn't doing, and never did on my 1.7.10 Mods. Thanks I'm gonna give that a try and see how it does now. SoundEvent s and Forge's new registry system were only added in 1.9. Earlier versions simply used strings for sound IDs. I must be blind but I can't find any register for sounds on GameRegistry (Did I misunderstood something?)
  19. That's something I wasn't doing, and never did on my 1.7.10 Mods. Thanks I'm gonna give that a try and see how it does now.
  20. Well, I must still be missing something here. EntityPlayer player = (EntityPlayer) event.getEntityLiving(); ResourceLocation location = new ResourceLocation("playmeon:customsound"); SoundEvent sound = new SoundEvent(location); SoundCategory category = SoundCategory.MASTER; World world = event.getEntityLiving().worldObj; // world.playSound(player, player.getPosition(), sound, category, 1.0F, 1.0F); world.playRecord(player.getPosition(), sound);
  21. I'm having problems figuring out how to make a custom sound play in my mod. ResourceLocation location = new ResourceLocation("playmeon:customsound"); SoundEvent sound = new SoundEvent(location); Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.getMasterRecord(sound, 1.0F)); the customsound.ogg is placed on resources/assets/playmeon/sounds/ I also have a sounds.json on resources/assets/playmeon/ { "customsound": {"category": "master","sounds": [{"name": "customsound","stream": false}]}, } But the sound is not playing, I'm getting: [server thread/WARN]: Unable to play unknown soundEvent: playmeon:customsound I wonder what I'm missing/forgetting here...
  22. You can use "onNeighborBlockChange" as for example on the Redstone Lamp.
  23. Thanks coolAlias, yes I just removed it from there, and only use it now surrounding when I drop the items on the floor and when I set the state of the crop back to age 0. Now it looks like this @Override @SuppressWarnings("incomplete-switch") public EnumActionResult onItemUse(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { //HOE if (!player.canPlayerEdit(pos.offset(facing), facing, stack)) { return EnumActionResult.FAIL; } else { int hook = net.minecraftforge.event.ForgeEventFactory.onHoeUse(stack, player, world, pos); if (hook != 0) return hook > 0 ? EnumActionResult.SUCCESS : EnumActionResult.FAIL; IBlockState iblockstate = world.getBlockState(pos); Block block = iblockstate.getBlock(); if (facing != EnumFacing.DOWN && world.isAirBlock(pos.up())) { if (block == Blocks.grass || block == Blocks.grass_path) { this.tillDirt(stack, player, world, pos, Blocks.farmland.getDefaultState()); return EnumActionResult.SUCCESS; } if (block == Blocks.dirt) { switch ((BlockDirt.DirtType)iblockstate.getValue(BlockDirt.VARIANT)) { case DIRT: this.tillDirt(stack, player, world, pos, Blocks.farmland.getDefaultState()); return EnumActionResult.SUCCESS; case COARSE_DIRT: this.tillDirt(stack, player, world, pos, Blocks.dirt.getDefaultState().withProperty(BlockDirt.VARIANT, BlockDirt.DirtType.DIRT)); return EnumActionResult.SUCCESS; } } } } //DONGLE IBlockState checkBlockState = world.getBlockState(pos); Block checkBlock = checkBlockState.getBlock(); if(checkBlock!=null) { if(checkBlock instanceof BlockCarrot) { int meta = checkBlock.getMetaFromState(checkBlockState); if(meta == 7) { if (!world.isRemote) { world.setBlockState(pos, checkBlockState.withProperty(AGE, Integer.valueOf(0)), 3); } final int reward = (int) ((Math.random() * 3)+1); dropX = new ItemStack(Items.carrot,reward,0); flag = true; } }//END CARROT if(checkBlock instanceof BlockPotato) { int meta = checkBlock.getMetaFromState(checkBlockState); if(meta == 7) { if (!world.isRemote) { world.setBlockState(pos, checkBlockState.withProperty(AGE, Integer.valueOf(0)), 3); } final int reward = (int) ((Math.random() * 3)+1); dropX = new ItemStack(Items.potato,reward,0); flag = true; dropX2 = new ItemStack(Items.poisonous_potato,1,0); flag2 = true; } }//END POTATO if(checkBlock instanceof BlockCrops && !(checkBlock instanceof BlockCarrot) && !(checkBlock instanceof BlockPotato) && !(checkBlock instanceof BlockBeetroot)) { int meta = checkBlock.getMetaFromState(checkBlockState); if(meta == 7) { if (!world.isRemote) { world.setBlockState(pos, checkBlockState.withProperty(AGE, Integer.valueOf(0)), 3); } dropX = new ItemStack(Items.wheat,1,0); flag = true; dropX3 = new ItemStack(Items.wheat_seeds,1,0); flag3 = true; } }//END WHEAT if(checkBlock instanceof BlockBeetroot) { int meta = checkBlock.getMetaFromState(checkBlockState); if(meta == 3) { if (!world.isRemote) { world.setBlockState(pos, checkBlockState.withProperty(BEETROOT_AGE, Integer.valueOf(0)), 3); } dropX = new ItemStack(Items.beetroot,1,0); flag = true; dropX3 = new ItemStack(Items.beetroot_seeds,1,0); flag3 = true; } }//END BEETROOT if (flag) { if (!world.isRemote) { itemDropX = new EntityItem(world, pos.getX()+.5, pos.getY()+.5, pos.getZ()+.5, dropX); world.spawnEntityInWorld(itemDropX); stack.damageItem(1, player); flag = false; } } if (flag2) { if (!world.isRemote) { int rand = (int) (Math.random() * 10); if (rand<1){ itemDropX2 = new EntityItem(world, pos.getX()+.5, pos.getY()+.5, pos.getZ()+.5, dropX2); world.spawnEntityInWorld(itemDropX2); } flag2 = false; } } if (flag3) { if (!world.isRemote) { int rand = (int) (Math.random() * 4); if (rand<1){ itemDropX3 = new EntityItem(world, pos.getX()+.5, pos.getY()+.5, pos.getZ()+.5, dropX3); world.spawnEntityInWorld(itemDropX3); } flag3 = false; } } } return EnumActionResult.PASS; } Next step will actually be getting the drops and not "emulating" them, I think that's a better way to code this tool, but I got confused when trying that, but for sure will try again on the near future, so at some point I may come again to ask some doubts I have on how to achieve that, specially when apparently Beetroots makes things a little bit more complicate that wheats, carrots and potatoes. Thanks once again for the help
  24. I guess that is the problem. This is the code, I know it can be improved to make it compatible with crops other than the vanilla one, but as for now I kinda "hardcoded" how it works, gonna improve it on future updates. @Override @SuppressWarnings("incomplete-switch") public EnumActionResult onItemUse(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { if(!world.isRemote) { //HOE if (!player.canPlayerEdit(pos.offset(facing), facing, stack)) { return EnumActionResult.FAIL; } else { int hook = net.minecraftforge.event.ForgeEventFactory.onHoeUse(stack, player, world, pos); if (hook != 0) return hook > 0 ? EnumActionResult.SUCCESS : EnumActionResult.FAIL; IBlockState iblockstate = world.getBlockState(pos); Block block = iblockstate.getBlock(); if (facing != EnumFacing.DOWN && world.isAirBlock(pos.up())) { if (block == Blocks.grass || block == Blocks.grass_path) { this.tillDirt(stack, player, world, pos, Blocks.farmland.getDefaultState()); return EnumActionResult.SUCCESS; } if (block == Blocks.dirt) { switch ((BlockDirt.DirtType)iblockstate.getValue(BlockDirt.VARIANT)) { case DIRT: this.tillDirt(stack, player, world, pos, Blocks.farmland.getDefaultState()); return EnumActionResult.SUCCESS; case COARSE_DIRT: this.tillDirt(stack, player, world, pos, Blocks.dirt.getDefaultState().withProperty(BlockDirt.VARIANT, BlockDirt.DirtType.DIRT)); return EnumActionResult.SUCCESS; } } } } //DONGLE IBlockState checkBlockState = world.getBlockState(pos); Block checkBlock = checkBlockState.getBlock(); if(checkBlock!=null) { if(checkBlock instanceof BlockCarrot) { int meta = checkBlock.getMetaFromState(checkBlockState); if(meta == 7) { world.setBlockState(pos, checkBlockState.withProperty(AGE, Integer.valueOf(0)), 3); final int reward = (int) ((Math.random() * 3)+1); dropX = new ItemStack(Items.carrot,reward,0); flag = true; } }//END CARROT if(checkBlock instanceof BlockPotato) { // System.out.println("It's a potato!"); int meta = checkBlock.getMetaFromState(checkBlockState); // System.out.println("Meta: " + meta); if(meta == 7) { world.setBlockState(pos, checkBlockState.withProperty(AGE, Integer.valueOf(0)), 3); final int reward = (int) ((Math.random() * 3)+1); dropX = new ItemStack(Items.potato,reward,0); flag = true; dropX2 = new ItemStack(Items.poisonous_potato,1,0); flag2 = true; } }//END POTATO if(checkBlock instanceof BlockCrops && !(checkBlock instanceof BlockCarrot) && !(checkBlock instanceof BlockPotato) && !(checkBlock instanceof BlockBeetroot)) { // System.out.println("It's wheat!"); int meta = checkBlock.getMetaFromState(checkBlockState); // System.out.println("Meta: " + meta); if(meta == 7) { world.setBlockState(pos, checkBlockState.withProperty(AGE, Integer.valueOf(0)), 3); dropX = new ItemStack(Items.wheat,1,0); flag = true; dropX3 = new ItemStack(Items.wheat_seeds,1,0); flag3 = true; } }//END WHEAT if(checkBlock instanceof BlockBeetroot) { // System.out.println("It's a beetroot!"); int meta = checkBlock.getMetaFromState(checkBlockState); // System.out.println("Meta: " + meta); if(meta == 3) { world.setBlockState(pos, checkBlockState.withProperty(BEETROOT_AGE, Integer.valueOf(0)), 3); dropX = new ItemStack(Items.beetroot,1,0); flag = true; dropX3 = new ItemStack(Items.beetroot_seeds,1,0); flag3 = true; } }//END BEETROOT if (flag) { itemDropX = new EntityItem(world, pos.getX()+.5, pos.getY()+.5, pos.getZ()+.5, dropX); world.spawnEntityInWorld(itemDropX); stack.damageItem(1, player); flag = false; } if (flag2) { int rand = (int) (Math.random() * 10); if (rand<1){ itemDropX2 = new EntityItem(world, pos.getX()+.5, pos.getY()+.5, pos.getZ()+.5, dropX2); world.spawnEntityInWorld(itemDropX2); } flag2 = false; } if (flag3) { int rand = (int) (Math.random() * 4); if (rand<1){ itemDropX3 = new EntityItem(world, pos.getX()+.5, pos.getY()+.5, pos.getZ()+.5, dropX3); world.spawnEntityInWorld(itemDropX3); } flag3 = false; } } } return EnumActionResult.PASS; } I guess I should remove that first if(!world.isRemote) I always have problems on knowing when or not to use it... Thanks for the answer. PS: tillDirt is the same code that is on the hoes from Minecraft, just with a readable name.
  25. I have created a simple item tool, that works like a hoe with some extra features. Everything works perfect, but the problem is that even when it till the dirt, it doesn't play the sound that the hoes do. Is there anything I should consider when calling a vanilla sound from inside my mod, or it's just something that can't be done? public void tillDirt(ItemStack stack, EntityPlayer player, World world, BlockPos pos, IBlockState state) { world.playSound(player, pos, SoundEvents.item_hoe_till, SoundCategory.BLOCKS, 1.0F, 1.0F); if (!world.isRemote) { world.setBlockState(pos, state, 11); stack.damageItem(1, player); } }
×
×
  • Create New...

Important Information

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