Jump to content

myWitch

Members
  • Posts

    5
  • Joined

  • Last visited

  • Days Won

    1

myWitch last won the day on June 10 2017

myWitch had the most liked content!

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

myWitch's Achievements

Tree Puncher

Tree Puncher (2/8)

3

Reputation

  1. 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); } }
  2. Thank you very much for your attention, finally it's working! I'll tell you what was wrong, maybe someone will need it. I started with deep debug of these lines: ResourceLocation loc = new ResourceLocation(Reference.MOD_ID,"t1.nbt"); Template template = templatemanager.getTemplate(minecraftserver, loc); And I've found that now minecraft simply adds ".nbt", no need to put it here in a file name! So, file extension was doubles and I've got no structure as a result.
  3. ResourceLocation loc = new ResourceLocation(Reference.MOD_ID,"structures/t1.nbt"); - if I change this code to the one below - it's also not working, I tried indeed (( ResourceLocation loc = new ResourceLocation(Reference.MOD_ID,"t1.nbt");
  4. JimilT92, thank you very much for your answer. I tried this too with no success ((( actually I tried tones of variants, including rewriting of addBlocksToWorld function... Here is the last variant that gives not null template, but nothing spawns, so I'm really stuck on it :((( I put this code right into onItemRightClick, but I think it doesn't matter if I put it somewhere as a separate function... Test file t1.nbt is in structures folder and I checked it by using structure block loading - it's good. You can also see some variants that I've tried in commented lines... If you can give me any ideas I would be realy happy )) It's the last thing to be solved for my mod. if (!worldIn.isRemote) { WorldServer worldserver = (WorldServer) worldIn; MinecraftServer minecraftserver = worldIn.getMinecraftServer(); TemplateManager templatemanager = worldserver.getStructureTemplateManager(); ResourceLocation loc = new ResourceLocation(Reference.MOD_ID,"structures/t1.nbt"); Template template = templatemanager.getTemplate(minecraftserver, loc); //.get(minecraftserver, new ResourceLocation(Reference.MOD_ID,"t1.nbt")); 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, new BlockRotationProcessor(pos, placementsettings), placementsettings, 1); //template.addBlocksToWorld(worldIn, pos.add(0, 1, 0), placementsettings); template.addBlocksToWorldChunk(worldIn, pos, placementsettings); Utils.getLogger().info("========2======="+template); } }
  5. I have the same problem now, and nothing is generated in the world (on test item right click), no metter do I use get or getTemplate functions, maybe someone can help? I tried everything... Here is my code: if (!worldIn.isRemote) { WorldServer worldserver = (WorldServer) worldIn; MinecraftServer minecraftserver = worldIn.getMinecraftServer(); TemplateManager templatemanager = worldserver.getStructureTemplateManager(); Template template = templatemanager.get(minecraftserver, new ResourceLocation(Reference.MOD_ID,"structures/test2.nbt")); Utils.getLogger().info("=======1======="+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); template.addBlocksToWorld(worldIn, pos.add(0, 1, 0), placementsettings); Utils.getLogger().info("========2======="+template); } } Console gives me this result for loggers: =======1=======net.minecraft.world.gen.structure.template.Template@1bca1033 ========2=======net.minecraft.world.gen.structure.template.Template@1bca1033
×
×
  • Create New...

Important Information

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