本文整理了Java中net.minecraft.item.ItemStack.setTranslatableName()
方法的一些代码示例,展示了ItemStack.setTranslatableName()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ItemStack.setTranslatableName()
方法的具体详情如下:
包路径:net.minecraft.item.ItemStack
类名称:ItemStack
方法名:setTranslatableName
暂无
代码示例来源:origin: Vazkii/Quark
@Override
public ItemStack apply(ItemStack stack, Random rand, LootContext context) {
int id = context.getWorld().getUniqueDataId("map");
stack.setItemDamage(id);
stack.setTranslatableName("quarkmisc.buried_chest_map");
NBTTagCompound cmp = ItemNBTHelper.getCompound(stack, "display", false);
cmp.setInteger("MapColor", 0x8C0E0E);
ItemNBTHelper.setCompound(stack, "display", cmp);
ItemNBTHelper.setBoolean(stack, TAG_TREASURE_MAP_DELEGATE, true);
return stack;
}
代码示例来源:origin: Vazkii/Quark
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;
}
代码示例来源:origin: JurassiCraftTeam/JurassiCraft2
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");
}
}
}
内容来源于网络,如有侵权,请联系作者删除!