Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 06/16/17 in all areas

  1. For this I would think you need to use the unqiue ID of the mob. This ID is persistent across world reloads and what not. The ID is a UUID, not a simple integer.
    2 points
  2. Please post the latest version of your code and the latest FML log (logs/fml-client-latest.log in the game directory). It's not the direct cause of the error, but you're passing a ResourceLocation to EntityRenderer#enableLightmap (when you invoke it via the Method) even though the method doesn't have any parameters. EntityRenderer#enableLightmap is also a public method, so there's no need to invoke it via reflection. When you do use reflection, mark the field containing the Field/Method object as final.
    2 points
  3. Hi everyone! Recently I added a GUI to my block, but it doesn't work. It has inventory and it's has been tested, but GUI don't opens. This is my GITHUB Repo: https://github.com/IvanSteklow/VanillaExtras/tree/master/src/main/java/ivansteklow/vanillaex HELP ME PLS!
    1 point
  4. An integer represents a lot of values. As for whether it is good to use or not depends on what you want to use it for. What is it you are trying to do?
    1 point
  5. Ok, I clean my code and added GuiHandler in both sides, but it doesn't work!
    1 point
  6. Hi everyone! I have a problem with onBlockActivated event. More about my block: This is block that gives water (Infinity Water Jar), but it doesn't work. Code: public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, @Nullable ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) { ItemStack itemstack = playerIn.getHeldItem(hand); if (itemstack.isEmpty()) { return true; } else { Item item = heldItem.getItem(); if (item == Items.BUCKET) { itemstack.shrink(1); if (itemstack.isEmpty()) { playerIn.setHeldItem(hand, new ItemStack(Items.WATER_BUCKET)); } else if (!playerIn.inventory.addItemStackToInventory(new ItemStack(Items.WATER_BUCKET))) { playerIn.dropItem(new ItemStack(Items.WATER_BUCKET), false); } return true; } else if (item == Items.GLASS_BOTTLE) { ItemStack itemstack1 = PotionUtils.addPotionToItemStack(new ItemStack(Items.POTIONITEM), PotionTypes.WATER); if (itemstack.isEmpty()) { playerIn.setHeldItem(hand, itemstack1); } else if (!playerIn.inventory.addItemStackToInventory(itemstack1)) { playerIn.dropItem(itemstack1, false); } else if (playerIn instanceof EntityPlayerMP) { ((EntityPlayerMP) playerIn).sendContainerToPlayer(playerIn.inventoryContainer); } return true; } return false; } HELP ME PLS!
    1 point
  7. Thank you for all, I really forgot that I use new version of MC Simply I have ready method from my old mod.
    1 point
  8. Thank you (and to everyone else who helped) when I get back around to modding Ill implement it! edit: It worked first time, excelent.
    1 point
  9. I have creative tab, but my item with metadata don't want to register in this tab. There is empty slot.
    1 point
  10. Launch command promt and in it write: gradlew eclipse It can repair project file
    1 point
  11. Use @SubscribeEvent public static livingDropsEvent(LivingDropsEvent event){ }
    1 point
  12. I agree with you: https://github.com/IvanSteklow/VanillaExtras And this is the API: https://github.com/IvanSteklow/isDevCore
    1 point
  13. Here I'll show the final code that definitly works for me: //spawn structure if (!worldIn.isRemote) { WorldServer worldserver = (WorldServer) worldIn; MinecraftServer minecraftserver = worldIn.getMinecraftServer(); TemplateManager templatemanager = worldserver.getStructureTemplateManager(); ResourceLocation loc = new ResourceLocation(Reference.MOD_ID,"t1"); Template template = templatemanager.getTemplate(minecraftserver, loc); Utils.getLogger().info("=======0======="+template); if (template != null) { worldIn.notifyBlockUpdate(pos, iblockstate, iblockstate, 3); PlacementSettings placementsettings = (new PlacementSettings()).setMirror(Mirror.NONE) .setRotation(Rotation.NONE).setIgnoreEntities(false).setChunk((ChunkPos) null) .setReplacedBlock((Block) null).setIgnoreStructureBlock(false); Utils.getLogger().info("=======1======="+loc); template.addBlocksToWorld(worldIn, pos, placementsettings); Utils.getLogger().info("========2======="+pos); } }
    1 point
  14. Mmmm, then i have no clue why this is not working for you I'll post here an example of working class i'm using that spawns an obelisk in the world public class WorldGenObelisk { private int mirror; private int rotation; public WorldGenObelisk(BlockPos pos, World world) { mirror = MW.rand.nextInt(Mirror.values().length); rotation = MW.rand.nextInt(Rotation.values().length); this.loadStructure(pos, world, "obelisk", true); } public void loadStructure(BlockPos pos, World world, String name, boolean check) { boolean flag = false; if (!world.isRemote) { WorldServer worldserver = (WorldServer) world; MinecraftServer minecraftserver = world.getMinecraftServer(); TemplateManager templatemanager = worldserver.getStructureTemplateManager(); ResourceLocation loc = new ResourceLocation(MW.MODID, name); Template template = templatemanager.func_189942_b(minecraftserver, loc); if (template != null) { IBlockState iblockstate = world.getBlockState(pos); world.notifyBlockUpdate(pos, iblockstate, iblockstate, 3); flag = true; if (check) { for (int i = 0; i < template.getSize().getX(); i++) { for (int j = 0; j < template.getSize().getZ(); j++) { BlockPos down = pos.add(i, -1, j); Block b = world.getBlockState(down).getBlock(); if (!b.equals(Blocks.SAND)) { flag = false; } } } } if (flag) { PlacementSettings placementsettings = (new PlacementSettings()).setMirror(Mirror.values()[mirror]) .setRotation(Rotation.values()[rotation]).setIgnoreEntities(false).setChunk((ChunkPos) null) .setReplacedBlock((Block) null).setIgnoreStructureBlock(true); template.addBlocksToWorldChunk(world, pos.down(), placementsettings); } } } } } This class is called from the WorldGenMinable class, in the generateOverworld method (so where you put the code to spawn ores) by doing this if (world.getBiomeGenForCoords(new BlockPos(x, 60, z)).equals(Biomes.DESERT) && random.nextInt(70) == 1) { int randPosX = x + random.nextInt(35); int randPosZ = z + random.nextInt(35); int randPosY = 60 + random.nextInt(255 - 64); BlockPos position = new BlockPos(randPosX, randPosY, randPosZ); if (!(world.getBlockState(world.getTopSolidOrLiquidBlock(position)).getBlock().equals(Blocks.WATER))) new WorldGenObelisk(world.getTopSolidOrLiquidBlock(position), world); } Notice that in the structure class it will also check if the spawn area is a valid area, you can remove that if you want. I hope this help, if not you can try looking at how Structure Blocks load structures and edit that code (since is exactly what i've done, maybe some small changes has been made but since is still 1.10.2 i don't think so)
    1 point
×
×
  • Create New...

Important Information

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