public static void addMarker(ItemStack stack, EntityPlayer player) { if(stack.getItem() == Items.FILLED_MAP) { MapData data = ((ItemMap) Items.FILLED_MAP).getMapData(stack, player.world); if(data != null) data.addTargetDecoration(stack, player.getPosition(), "Pin" + player.getPosition().hashCode(), Type.TARGET_X); } }
mapdata.unlimitedTracking = true; ItemMap.renderBiomePreviewMap(world, itemstack); mapdata.addTargetDecoration(itemstack, treasurePos, "x", Type.TARGET_X);
public static ItemStack createMap(World world, BlockPos pos, TradeInfo info) { BlockPos biomePos = BiomeLocator.spiralOutwardsLookingForBiome(world, info.biome, pos.getX(), pos.getZ()); if(biomePos == null) return ItemStack.EMPTY; int id = world.getUniqueDataId("map"); ItemStack stack = new ItemStack(Items.FILLED_MAP, 1, id); stack.setTranslatableName(info.name); NBTTagCompound cmp = ItemNBTHelper.getCompound(stack, "display", false); cmp.setInteger("MapColor", info.color); ItemNBTHelper.setCompound(stack, "display", cmp); String s = "map_" + id; MapData mapdata = new MapData(s); world.setData(s, mapdata); mapdata.scale = 2; mapdata.xCenter = biomePos.getX() + (int) ((Math.random() - 0.5) * 200); mapdata.zCenter = biomePos.getZ() + (int) ((Math.random() - 0.5) * 200); mapdata.dimension = 0; mapdata.trackingPosition = true; mapdata.unlimitedTracking = true; ItemMap.renderBiomePreviewMap(world, stack); MapData.addTargetDecoration(stack, biomePos, "+", Type.TARGET_X); return stack; }
@Override public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException { World w = getCommandSenderAsPlayer(sender).getEntityWorld(); VampirismWorldData worldData = VampirismWorldData.get(w); BlockPos dungeonPos = worldData.getRandomVampireDungeon(getCommandSenderAsPlayer(sender).getRNG()); ItemStack itemstack = ItemMap.setupNewMap(w, (double) dungeonPos.getX(), (double) dungeonPos.getZ(), (byte) 2, true, true); ItemMap.renderBiomePreviewMap(w, itemstack); MapData.addTargetDecoration(itemstack, dungeonPos, "+", MapDecoration.Type.TARGET_X); getCommandSenderAsPlayer(sender).dropItem(itemstack, false); }
public static void init() { ResourceLocation location = new ResourceLocation("minecraft", "librarian"); VillagerRegistry.VillagerProfession profession = ForgeRegistries.VILLAGER_PROFESSIONS.getValue(location); if(!profession.getRegistryName().equals(location)) { JurassiCraft.getLogger().error("Could not find librarian profession"); } else { VillagerRegistry.VillagerCareer career = profession.getCareer(1); if(career.getName().equals("cartographer")) { career.addTrade(4, (merchant, recipeList, random) -> { if(StructureUtils.getStructureData().isVisitorCenter()) { World world = FMLCommonHandler.instance().getMinecraftServerInstance().getWorld(0); BlockPos blockpos = MapUtils.getVisitorCenterPosition(); ItemStack itemstack = ItemMap.setupNewMap(world, blockpos.getX(), blockpos.getZ(), (byte)2, true, true); ItemMap.renderBiomePreviewMap(world, itemstack); MapData.addTargetDecoration(itemstack, blockpos, "+", MapDecoration.Type.MANSION); itemstack.setTranslatableName("filled_map.jurassicraft.visitorcenter"); recipeList.add(new MerchantRecipe(new ItemStack(Items.EMERALD, random.nextInt(12) + 16), new ItemStack(Items.COMPASS), itemstack)); } }); JurassiCraft.getLogger().info("Successfully registered maps trade"); } else { JurassiCraft.getLogger().error("Could not find cartographer maps career"); } } }