#loader contenttweaker // exerts of this piece of code are taken from Jivine Journey 2, by Atricos import mods.contenttweaker.VanillaFactory; import mods.contenttweaker.Item; import mods.contenttweaker.IItemRightClick; import mods.contenttweaker.Commands; import mods.contenttweaker.ItemFood; import mods.contenttweaker.IItemFoodEaten; import mods.contenttweaker.MutableItemStack; import mods.contenttweaker.Hand; import mods.contenttweaker.World; import mods.contenttweaker.IItemUpdate; import mods.contenttweaker.Player; import crafttweaker.player.IPlayer; // function taken from Divine Journey function checkBiomesAtPositions(biomeName as string, player_pos as crafttweaker.util.Position3f, biomeLocations as int[][], world as crafttweaker.world.IWorld) as int { var numOfMatches = 0 as int; var check_pos as crafttweaker.util.Position3f; var add_x = 0 as int; var add_z = 0 as int; for coord_pair in biomeLocations { add_x = coord_pair[0]; add_z = coord_pair[1]; check_pos = crafttweaker.util.Position3f.create(player_pos.x + add_x, player_pos.y, player_pos.z + add_z); if(world.getBiome(check_pos).name == biomeName) { numOfMatches += 1; } } return numOfMatches; } var markofthesamurai = VanillaFactory.createItem("mark_of_the_samurai"); markofthesamurai.maxStackSize = 1; markofthesamurai.itemRightClick = function(stack, world, player, hand) { if(world.remote) { return "FAIL"; } // check if player is in right dimension if(player.getDimension() != 163) { player.sendChat("You gotta be in rhenia in a volcanic biome"); return "FAIL"; } // obtain position under player var playerpos = player.position as crafttweaker.util.Position3f; // locations to place biomes val OminousBiomeLocations = [[0,0],[1,0],[0,1],[-1,0],[0,-1]] as int[][]; val VolcanicBiomeLocations = [[1,1],[1,-1],[-1,1],[-1,-1]] as int[][]; // biome to pattern val OminousBiomeName = "Ominous Woods" as string; val VolcanicBiomeName = "Volcanic" as string; // get number of matches val OminousMatches = checkBiomesAtPositions(OminousBiomeName, playerpos, OminousBiomeLocations, world) as int; val VolcanicMatches = checkBiomesAtPositions(VolcanicBiomeName, playerpos, VolcanicBiomeLocations, world) as int; player.sendChat("Use the arcane terraformer to create a plus sign of Ominous Woods biome!"); player.sendChat("Stand in the center and use this item!"); if((OminousMatches+VolcanicMatches) == 9) { Commands.call("give @p contenttweaker:sword_shield", player, world, true, true); stack.shrink(1); return "PASS"; } else { player.sendChat("Shape is incomplete!"); return "FAIL"; } }; markofthesamurai.register();