Jump to content

Leaderboard

Popular Content

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

  1. It's a pain in the ass. Stop now. If you want to look at what I did in 1.7.10 (which involved heavy use of things that shant be talked about) you can have a look at my event handler class: https://github.com/Draco18s/HarderStuff/blob/master/src/main/java/com/draco18s/wildlife/WildlifeEventHandler.java Roughly: 1) store the original biome data, we need to keep records of what they are so we can calculate time offsets properly 2) modify the shit out of these numbers because some of them are garbage. We also need to calculate the variance delta (deserts have greater temperature variance than oceans because of water's thermal capacity) 3) get the current date, look up the seasonal sine waves, multiply by variance delta, add to the base value, apply back to the biome It's ugly and there's hacks all over the place. One of the most annoying was having to deal with ice. Ice doesn't melt on its own, but water will freeze. Have fun handling that.
    1 point
  2. you have the IBlockState of the block in the event. That state contains properties. See BlockStone to see which ones(hint - it's the VARIANT property). You can get a value of that property from the blockstate you have... And then you would just compare that value to see if it is a regular stone block or diorite/whatever. Something like if (event.getState().getValue(BlockStone.VARIANT) == BlockStone.EnumType.STONE) Edit: Here is a documentation that explains blockstates.
    1 point
  3. Just use the MDK as normal and replace the generated src folder with his...?
    1 point
  4. SRG stands for Searge. He is one of the guys that works/worked on MCP, possibly the one that came up with that naming system.
    1 point
  5. EDIT: I've looked at the Strucutre Block class and i found out how to load a structure. But for some reason if i generate a new world and (for example) try to load this structure right-clicking an item it seems like the game can't find the structure (wich is stored in the structures folder into resources). This is the dummy item class i use to "spawn" the structure public class ItemMW extends Item { public ItemMW(CreativeTabs tab) { this.setCreativeTab(tab); } @Override public ActionResult<ItemStack> onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn, EnumHand hand) { if (!worldIn.isRemote) this.func_189714_c(playerIn.getPosition(), worldIn); return super.onItemRightClick(itemStackIn, worldIn, playerIn, hand); } public boolean func_189714_c(BlockPos pos, World world) { WorldServer worldserver = (WorldServer) world; MinecraftServer minecraftserver = world.getMinecraftServer(); TemplateManager templatemanager = worldserver.getStructureTemplateManager(); Template template = templatemanager.func_189942_b(minecraftserver, new ResourceLocation(MW.MODID + ":" + "structures/pagoda.nbt")); if(template == null) { System.out.println("NO STRUCTURE"); return false; } BlockPos blockpos2 = template.getSize(); IBlockState iblockstate = world.getBlockState(pos); world.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); template.addBlocksToWorldChunk(world, pos.add(0, 1, 0), placementsettings); return true; } } The NBT file is stored into resources-assets-mw-structures-pagoda.nbt (mw is the mod id) EDIT 2: Found out a way to make it works. The problem was (as i suspected) in the ResourceLocation, that for some reason pointed at a wrong location. By changing that i can spawn my structure and also integrating this function into (for example) a biome class i can spawn it randomly in the world using the nbt file public void loadStructure(BlockPos pos, World world, String name) { 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); PlacementSettings placementsettings = (new PlacementSettings()).setMirror(Mirror.NONE) .setRotation(Rotation.NONE).setIgnoreEntities(false).setChunk((ChunkPos) null) .setReplacedBlock((Block) null).setIgnoreStructureBlock(false); template.addBlocksToWorldChunk(world, pos.add(0, 1, 0), placementsettings); } }
    1 point
×
×
  • Create New...

Important Information

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