本文整理汇总了Java中net.minecraft.item.EnumDyeColor类的典型用法代码示例。如果您正苦于以下问题:Java EnumDyeColor类的具体用法?Java EnumDyeColor怎么用?Java EnumDyeColor使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
EnumDyeColor类属于net.minecraft.item包,在下文中一共展示了EnumDyeColor类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: generate
import net.minecraft.item.EnumDyeColor; //导入依赖的package包/类
@Override
public boolean generate(World worldIn, Random rand, BlockPos position) {
BlockPos cur = NeoHellGenerators.findSurface(worldIn, position);
if (cur==null) return false;
IBlockState norfairite = TWBlocks.NORFAIRITE_CLEAR.getDefaultState().withProperty(BlockColored.COLOR, EnumDyeColor.GREEN);
ArrayList<BlockPos> bushArea = new ArrayList<BlockPos>();
NeoHellGenerators.sphereAround(cur.up(), 1.5f + rand.nextFloat(), bushArea);
for(BlockPos leaf : bushArea) {
IBlockState state = worldIn.getBlockState(leaf);
if (state.getBlock().canBeReplacedByLeaves(state, worldIn, leaf)) {
worldIn.setBlockState(leaf, norfairite);
}
}
return true;
}
示例2: applyColour
import net.minecraft.item.EnumDyeColor; //导入依赖的package包/类
/** Recolour the Minecraft block
* @param state The block to be recoloured
* @param colour The new colour
* @return A new blockstate which is a recoloured version of the original
*/
static IBlockState applyColour(IBlockState state, Colour colour)
{
for (IProperty prop : (java.util.Set<IProperty>)state.getProperties().keySet())
{
if (prop.getName().equals("color") && prop.getValueClass() == net.minecraft.item.EnumDyeColor.class)
{
net.minecraft.item.EnumDyeColor current = (net.minecraft.item.EnumDyeColor)state.getValue(prop);
if (!current.getName().equalsIgnoreCase(colour.name()))
{
return state.withProperty(prop, EnumDyeColor.valueOf(colour.name()));
}
}
}
return state;
}
示例3: initializeInventories
import net.minecraft.item.EnumDyeColor; //导入依赖的package包/类
@Override
protected void initializeInventories() {
super.initializeInventories();
modeList = new LinkedHashMap<>();
EnumDyeColor[] colors = new EnumDyeColor[]{EnumDyeColor.YELLOW, EnumDyeColor.BLUE, EnumDyeColor.GREEN, EnumDyeColor.ORANGE, EnumDyeColor.PURPLE};
for (int i = 0; i < 5; ++i) {
ItemStackHandler item = new ItemStackHandler(2);
this.addInventory(new CustomColoredItemHandler(item, colors[i], "Material process", 50 + 24 * i, 25, 1, 2) {
@Override
public boolean canInsertItem(int slot, ItemStack stack) {
return false;
}
});
this.addInventoryToStorage(item, "item" + i);
modeList.put(item, Mode.NONE);
}
}
示例4: preInit
import net.minecraft.item.EnumDyeColor; //导入依赖的package包/类
@Override
public void preInit() {
super.preInit();
ClientRegistry.bindTileEntitySpecialRenderer(TileTube.class, new TubeItemRenderer());
// Register textures
TextureRegistry.registerTexture(ModelTube.TUBE_TEX);
TextureRegistry.registerTexture(ModelTube.TUBE_TEX_COL);
// Register block models
ModelRegistry.registerBlockModel(blockTube, new ModelTube());
// Register item models
ModelRegistry.registerItemResourceLoc(blockDisplacer, new ResourceLocation("simpletubes:block_displacer"), 0);
ModelRegistry.registerItemModel(blockTube, new ModelTube.TubeItemModel());
ModelRegistry.registerItemResourceLoc(itemPaintbrush, new ResourceLocation("simpletubes:item_paintbrush"), 0);
for (int i = 0; i < 16; i++)
ModelRegistry.registerItemResourceLoc(itemPaintbrush, new ResourceLocation("simpletubes:item_paintbrush_" + EnumDyeColor.byMetadata(i).getUnlocalizedName()), i + 1);
ModelRegistry.registerItemResourceLoc(itemUpgrade, new ResourceLocation("simpletubes:item_upgrade_filter"), 0);
MinecraftForge.EVENT_BUS.register(new TextureRegistry());
MinecraftForge.EVENT_BUS.register(new ModelRegistry());
}
示例5: addComponentParts
import net.minecraft.item.EnumDyeColor; //导入依赖的package包/类
public boolean addComponentParts(World worldIn, Random randomIn, StructureBoundingBox structureBoundingBoxIn)
{
if (this.field_143015_k < 0)
{
this.field_143015_k = this.getAverageGroundLevel(worldIn, structureBoundingBoxIn);
if (this.field_143015_k < 0)
{
return true;
}
this.boundingBox.offset(0, this.field_143015_k - this.boundingBox.maxY + 4 - 1, 0);
}
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 0, 0, 2, 3, 1, Blocks.air.getDefaultState(), Blocks.air.getDefaultState(), false);
this.setBlockState(worldIn, Blocks.oak_fence.getDefaultState(), 1, 0, 0, structureBoundingBoxIn);
this.setBlockState(worldIn, Blocks.oak_fence.getDefaultState(), 1, 1, 0, structureBoundingBoxIn);
this.setBlockState(worldIn, Blocks.oak_fence.getDefaultState(), 1, 2, 0, structureBoundingBoxIn);
this.setBlockState(worldIn, Blocks.wool.getStateFromMeta(EnumDyeColor.WHITE.getDyeDamage()), 1, 3, 0, structureBoundingBoxIn);
boolean flag = this.coordBaseMode == EnumFacing.EAST || this.coordBaseMode == EnumFacing.NORTH;
this.setBlockState(worldIn, Blocks.torch.getDefaultState().withProperty(BlockTorch.FACING, this.coordBaseMode.rotateY()), flag ? 2 : 0, 3, 0, structureBoundingBoxIn);
this.setBlockState(worldIn, Blocks.torch.getDefaultState().withProperty(BlockTorch.FACING, this.coordBaseMode), 1, 3, 1, structureBoundingBoxIn);
this.setBlockState(worldIn, Blocks.torch.getDefaultState().withProperty(BlockTorch.FACING, this.coordBaseMode.rotateYCCW()), flag ? 0 : 2, 3, 0, structureBoundingBoxIn);
this.setBlockState(worldIn, Blocks.torch.getDefaultState().withProperty(BlockTorch.FACING, this.coordBaseMode.getOpposite()), 1, 3, -1, structureBoundingBoxIn);
return true;
}
示例6: getDyeColorMixFromParents
import net.minecraft.item.EnumDyeColor; //导入依赖的package包/类
/**
* Attempts to mix both parent sheep to come up with a mixed dye color.
*/
private EnumDyeColor getDyeColorMixFromParents(EntityAnimal father, EntityAnimal mother)
{
int i = ((EntitySheep)father).getFleeceColor().getDyeDamage();
int j = ((EntitySheep)mother).getFleeceColor().getDyeDamage();
this.inventoryCrafting.getStackInSlot(0).setItemDamage(i);
this.inventoryCrafting.getStackInSlot(1).setItemDamage(j);
ItemStack itemstack = CraftingManager.getInstance().findMatchingRecipe(this.inventoryCrafting, ((EntitySheep)father).worldObj);
int k;
if (itemstack != null && itemstack.getItem() == Items.dye)
{
k = itemstack.getMetadata();
}
else
{
k = this.worldObj.rand.nextBoolean() ? i : j;
}
return EnumDyeColor.byDyeDamage(k);
}
示例7: getDyeColorMixFromParents
import net.minecraft.item.EnumDyeColor; //导入依赖的package包/类
/**
* Attempts to mix both parent sheep to come up with a mixed dye color.
*/
private EnumDyeColor getDyeColorMixFromParents(EntityAnimal father, EntityAnimal mother)
{
int i = ((EntitySheep)father).getFleeceColor().getDyeDamage();
int j = ((EntitySheep)mother).getFleeceColor().getDyeDamage();
this.inventoryCrafting.getStackInSlot(0).setItemDamage(i);
this.inventoryCrafting.getStackInSlot(1).setItemDamage(j);
ItemStack itemstack = CraftingManager.getInstance().findMatchingRecipe(this.inventoryCrafting, ((EntitySheep)father).world);
int k;
if (itemstack.getItem() == Items.DYE)
{
k = itemstack.getMetadata();
}
else
{
k = this.world.rand.nextBoolean() ? i : j;
}
return EnumDyeColor.byDyeDamage(k);
}
示例8: dropBlockAsItemWithChance
import net.minecraft.item.EnumDyeColor; //导入依赖的package包/类
/**
* Spawns this Block's drops into the World as EntityItems.
*/
public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune)
{
int i = ((Integer)state.getValue(AGE)).intValue();
int j = 1;
if (i >= 2)
{
j = 3;
}
for (int k = 0; k < j; ++k)
{
spawnAsEntity(worldIn, pos, new ItemStack(Items.DYE, 1, EnumDyeColor.BROWN.getDyeDamage()));
}
}
示例9: addRecipes
import net.minecraft.item.EnumDyeColor; //导入依赖的package包/类
/**
* Adds the food recipes to the CraftingManager.
*/
public void addRecipes(CraftingManager manager)
{
manager.addShapelessRecipe(new ItemStack(Items.MUSHROOM_STEW), new Object[] {Blocks.BROWN_MUSHROOM, Blocks.RED_MUSHROOM, Items.BOWL});
manager.addRecipe(new ItemStack(Items.COOKIE, 8), new Object[] {"#X#", 'X', new ItemStack(Items.DYE, 1, EnumDyeColor.BROWN.getDyeDamage()), '#', Items.WHEAT});
manager.addRecipe(new ItemStack(Items.RABBIT_STEW), new Object[] {" R ", "CPM", " B ", 'R', new ItemStack(Items.COOKED_RABBIT), 'C', Items.CARROT, 'P', Items.BAKED_POTATO, 'M', Blocks.BROWN_MUSHROOM, 'B', Items.BOWL});
manager.addRecipe(new ItemStack(Items.RABBIT_STEW), new Object[] {" R ", "CPD", " B ", 'R', new ItemStack(Items.COOKED_RABBIT), 'C', Items.CARROT, 'P', Items.BAKED_POTATO, 'D', Blocks.RED_MUSHROOM, 'B', Items.BOWL});
manager.addRecipe(new ItemStack(Blocks.MELON_BLOCK), new Object[] {"MMM", "MMM", "MMM", 'M', Items.MELON});
manager.addRecipe(new ItemStack(Items.BEETROOT_SOUP), new Object[] {"OOO", "OOO", " B ", 'O', Items.BEETROOT, 'B', Items.BOWL});
manager.addRecipe(new ItemStack(Items.MELON_SEEDS), new Object[] {"M", 'M', Items.MELON});
manager.addRecipe(new ItemStack(Items.PUMPKIN_SEEDS, 4), new Object[] {"M", 'M', Blocks.PUMPKIN});
manager.addShapelessRecipe(new ItemStack(Items.PUMPKIN_PIE), new Object[] {Blocks.PUMPKIN, Items.SUGAR, Items.EGG});
manager.addShapelessRecipe(new ItemStack(Items.FERMENTED_SPIDER_EYE), new Object[] {Items.SPIDER_EYE, Blocks.BROWN_MUSHROOM, Items.SUGAR});
manager.addShapelessRecipe(new ItemStack(Items.BLAZE_POWDER, 2), new Object[] {Items.BLAZE_ROD});
manager.addShapelessRecipe(new ItemStack(Items.MAGMA_CREAM), new Object[] {Items.BLAZE_POWDER, Items.SLIME_BALL});
}
示例10: doRenderLayer
import net.minecraft.item.EnumDyeColor; //导入依赖的package包/类
public void doRenderLayer(EntityWolf entitylivingbaseIn, float p_177141_2_, float p_177141_3_, float partialTicks, float p_177141_5_, float p_177141_6_, float p_177141_7_, float scale)
{
if (entitylivingbaseIn.isTamed() && !entitylivingbaseIn.isInvisible())
{
this.wolfRenderer.bindTexture(WOLF_COLLAR);
EnumDyeColor enumdyecolor = EnumDyeColor.byMetadata(entitylivingbaseIn.getCollarColor().getMetadata());
float[] afloat = EntitySheep.func_175513_a(enumdyecolor);
GlStateManager.color(afloat[0], afloat[1], afloat[2]);
this.wolfRenderer.getMainModel().render(entitylivingbaseIn, p_177141_2_, p_177141_3_, p_177141_5_, p_177141_6_, p_177141_7_, scale);
}
}
示例11: getResourceLocation
import net.minecraft.item.EnumDyeColor; //导入依赖的package包/类
@Nullable
public ResourceLocation getResourceLocation(String id, List<BannerPattern> patternList, List<EnumDyeColor> colorList)
{
if (id.isEmpty())
{
return null;
}
else
{
id = this.cacheId + id;
BannerTextures.CacheEntry bannertextures$cacheentry = (BannerTextures.CacheEntry)this.cacheMap.get(id);
if (bannertextures$cacheentry == null)
{
if (this.cacheMap.size() >= 256 && !this.freeCacheSlot())
{
return BannerTextures.BANNER_BASE_TEXTURE;
}
List<String> list = Lists.<String>newArrayList();
for (BannerPattern bannerpattern : patternList)
{
list.add(this.cacheResourceBase + bannerpattern.func_190997_a() + ".png");
}
bannertextures$cacheentry = new BannerTextures.CacheEntry();
bannertextures$cacheentry.textureLocation = new ResourceLocation(id);
Minecraft.getMinecraft().getTextureManager().loadTexture(bannertextures$cacheentry.textureLocation, new LayeredColorMaskTexture(this.cacheResourceLocation, list, colorList));
this.cacheMap.put(id, bannertextures$cacheentry);
}
bannertextures$cacheentry.lastUseMillis = System.currentTimeMillis();
return bannertextures$cacheentry.textureLocation;
}
}
示例12: TextElementFormat
import net.minecraft.item.EnumDyeColor; //导入依赖的package包/类
public TextElementFormat(String fmt) {
if (!fmt.isEmpty()) {
String[] split = StringUtils.split(fmt, ',');
for (String s : split) {
if (s.length() == 1 && Character.isDigit(s.charAt(0))) {
scale = 0.5f + ((fmt.charAt(0) - '0')) * .4f;
} else if ("left".equals(s) || "l".equals(s)) {
align = -1;
} else if ("center".equals(s) || "c".equals(s)) {
align = 0;
} else if ("right".equals(s) || "r".equals(s)) {
align = 1;
} else if ("top".equals(s) || "t".equals(s)) {
valign = -1;
} else if ("vcenter".equals(s) || "vc".equals(s)) {
valign = 0;
} else if ("bottom".equals(s) || "b".equals(s)) {
valign = 1;
} else if ("bold".equals(s)) {
bold = true;
} else if ("italic".equals(s)) {
italic = true;
} else {
try {
color = EnumDyeColor.valueOf(s.toUpperCase());
} catch (IllegalArgumentException e) {
Lector.logger.log(Level.WARN, "Bad format for text: '" + fmt + "'!");
}
}
}
}
}
示例13: registerRecipe
import net.minecraft.item.EnumDyeColor; //导入依赖的package包/类
private static void registerRecipe()
{
GameRegistry.addRecipe(new ItemStack(ItemLoader.itemCamera), new Object[]{
"[email protected]#", "$%@", "@@@", '@', Blocks.OBSIDIAN, '!', Blocks.GLOWSTONE , '#',Blocks.STONE_BUTTON,'$',Items.ENDER_EYE,'%',Blocks.REDSTONE_BLOCK
});
GameRegistry.addShapelessRecipe(new ItemStack(ItemLoader.itemCamera),ItemLoader.itemTripod);
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(BlockLoader.pictureFrame), new Object[]{
"!!", "@@", '!', "plankWood", '@', Blocks.WOOL
}));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(BlockLoader.pictureFrameMultiple), new Object[]{
"!!!", "@@@","@@@", '!', "plankWood", '@', Blocks.WOOL
}));
GameRegistry.addRecipe(new ItemStack(ItemLoader.itemBattery), new Object[]{
"!#!", "[email protected]!","[email protected]!", '!', Blocks.REDSTONE_BLOCK, '@', Blocks.OBSIDIAN,'#',Blocks.STONE_BUTTON
});
GameRegistry.addRecipe(new ItemStack(ItemLoader.itemFilm), new Object[]{
"!!!", "@@@","!!!", '!', Items.ENDER_PEARL, '@', Blocks.GLASS_PANE
});
GameRegistry.addRecipe(new ItemStack(BlockLoader.photoprocessor), new Object[]{
"[email protected]!", "!#!","!$!", '!', Blocks.IRON_BLOCK, '@', Items.DIAMOND,'#',Items.ENDER_PEARL,'$',Blocks.REDSTONE_BLOCK
});
GameRegistry.addShapelessRecipe(new ItemStack(ItemLoader.itemPhotoPaper), Items.MILK_BUCKET,Items.PAPER,Items.IRON_INGOT,Items.GOLD_INGOT);
GameRegistry.addRecipe(new ItemStack(ItemLoader.itemCntsTempLiquid), new Object[]{
"!!!", "@[email protected]","@#@", '!', Items.BLAZE_ROD, '@', Blocks.GLASS_PANE,'#',Items.WATER_BUCKET
});
GameRegistry.addRecipe(new ItemStack(ItemLoader.itemDevelopingAgent), new Object[]{
"[email protected]#", "$%$","^&^", '!', new ItemStack(Items.DYE, 1, EnumDyeColor.RED.getDyeDamage()), '@', new ItemStack(Items.DYE, 1, EnumDyeColor.YELLOW.getDyeDamage()),'#', new ItemStack(Items.DYE, 1, EnumDyeColor.BLUE.getDyeDamage()),'$',Items.GOLD_INGOT,'%',Items.ENDER_PEARL,'^',Blocks.GLASS_PANE,'&',Items.WATER_BUCKET
});
GameRegistry.addRecipe(new ItemStack(ItemLoader.itemTripod), new Object[]{
" ! ", " @ ","@#@", '!', ItemLoader.itemCamera, '@', Blocks.IRON_BLOCK,'#',Items.ENDER_EYE
});
GameRegistry.addRecipe(new ItemStack(ItemLoader.itemGlassesHelmet), new Object[]{
"!$!", "@#@","! !", '!', Items.STICK, '@', Blocks.GLASS_PANE,'#',Blocks.OBSIDIAN,'$',Items.ENDER_EYE
});
GameRegistry.addRecipe(new ItemStack(ItemLoader.itemPictureBook), new Object[]{
"!!!", "[email protected]#","!##", '!', Items.PAPER, '@', Items.SLIME_BALL,'#',Items.LEATHER
});
}
示例14: addRecipes
import net.minecraft.item.EnumDyeColor; //导入依赖的package包/类
/**
* Adds the food recipes to the CraftingManager.
*/
public void addRecipes(CraftingManager p_77608_1_)
{
p_77608_1_.addShapelessRecipe(new ItemStack(Items.mushroom_stew), new Object[] {Blocks.brown_mushroom, Blocks.red_mushroom, Items.bowl});
p_77608_1_.addRecipe(new ItemStack(Items.cookie, 8), new Object[] {"#X#", 'X', new ItemStack(Items.dye, 1, EnumDyeColor.BROWN.getDyeDamage()), '#', Items.wheat});
p_77608_1_.addRecipe(new ItemStack(Items.rabbit_stew), new Object[] {" R ", "CPM", " B ", 'R', new ItemStack(Items.cooked_rabbit), 'C', Items.carrot, 'P', Items.baked_potato, 'M', Blocks.brown_mushroom, 'B', Items.bowl});
p_77608_1_.addRecipe(new ItemStack(Items.rabbit_stew), new Object[] {" R ", "CPD", " B ", 'R', new ItemStack(Items.cooked_rabbit), 'C', Items.carrot, 'P', Items.baked_potato, 'D', Blocks.red_mushroom, 'B', Items.bowl});
p_77608_1_.addRecipe(new ItemStack(Blocks.melon_block), new Object[] {"MMM", "MMM", "MMM", 'M', Items.melon});
p_77608_1_.addRecipe(new ItemStack(Items.melon_seeds), new Object[] {"M", 'M', Items.melon});
p_77608_1_.addRecipe(new ItemStack(Items.pumpkin_seeds, 4), new Object[] {"M", 'M', Blocks.pumpkin});
p_77608_1_.addShapelessRecipe(new ItemStack(Items.pumpkin_pie), new Object[] {Blocks.pumpkin, Items.sugar, Items.egg});
p_77608_1_.addShapelessRecipe(new ItemStack(Items.fermented_spider_eye), new Object[] {Items.spider_eye, Blocks.brown_mushroom, Items.sugar});
p_77608_1_.addShapelessRecipe(new ItemStack(Items.blaze_powder, 2), new Object[] {Items.blaze_rod});
p_77608_1_.addShapelessRecipe(new ItemStack(Items.magma_cream), new Object[] {Items.blaze_powder, Items.slime_ball});
}
示例15: func_190702_g
import net.minecraft.item.EnumDyeColor; //导入依赖的package包/类
private void func_190702_g(ItemStack p_190702_1_)
{
if (this.func_190682_f(p_190702_1_))
{
this.func_190711_a(EnumDyeColor.byMetadata(p_190702_1_.getMetadata()));
}
else
{
this.func_190711_a((EnumDyeColor)null);
}
}