本文整理匯總了Java中net.minecraft.block.BlockColored.func_150032_b方法的典型用法代碼示例。如果您正苦於以下問題:Java BlockColored.func_150032_b方法的具體用法?Java BlockColored.func_150032_b怎麽用?Java BlockColored.func_150032_b使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類net.minecraft.block.BlockColored
的用法示例。
在下文中一共展示了BlockColored.func_150032_b方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: itemInteractionForEntity
import net.minecraft.block.BlockColored; //導入方法依賴的package包/類
/**
* Returns true if the item can be used on the given entity, e.g. shears on sheep.
*/
public boolean itemInteractionForEntity(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, EntityLivingBase par3EntityLivingBase)
{
if (par3EntityLivingBase instanceof EntitySheep)
{
EntitySheep var4 = (EntitySheep)par3EntityLivingBase;
int var5 = BlockColored.func_150032_b(par1ItemStack.getItemDamage());
if (!var4.getSheared() && var4.getFleeceColor() != var5)
{
var4.setFleeceColor(var5);
--par1ItemStack.stackSize;
}
return true;
}
else
{
return false;
}
}
示例2: interact
import net.minecraft.block.BlockColored; //導入方法依賴的package包/類
@Override
public boolean interact(EntityPlayer player) {
ItemStack stack = player.inventory.getCurrentItem();
if (stack != null) {
if (InventoryHelper.isDye(stack)) {
int i = BlockColored.func_150032_b(InventoryHelper.getDyeMetaFromOreDict(stack));
if (!this.getSheared() && this.getFleeceColor() != i) {
this.setFleeceColor(i);
--stack.stackSize;
return true;
} else {
return super.interact(player);
}
} else {
return super.interact(player);
}
} else {
return super.interact(player);
}
}
示例3: addInformation
import net.minecraft.block.BlockColored; //導入方法依賴的package包/類
@SideOnly(Side.CLIENT)
@Override
public void addInformation (ItemStack itemStack, EntityPlayer player, List list, boolean par4) {
if (ModBlocks.lantern.isGlass(itemStack)) {
String glassName = Blocks.stained_glass.getUnlocalizedName() + "." + ItemDye.field_150923_a[BlockColored.func_150032_b(itemStack.getItemDamage())];
list.add(StatCollector.translateToLocal(glassName + ".name"));
}
String contents = StatCollector.translateToLocal(ModBlocks.makeName("lanternSource")) + ": " + EnumChatFormatting.YELLOW;
String source = ModBlocks.lantern.getLightSource(itemStack);
ILanternSource lanternSource = (source != null) ? Api.instance.registries().lanternSources().getLanternSource(source) : null;
if (lanternSource != null)
contents += StatCollector.translateToLocal(lanternSource.getLanguageKey(itemStack.getItemDamage()));
else
contents += StatCollector.translateToLocal(ModBlocks.makeName("lanternSource.none"));
list.add(contents);
}
示例4: itemInteractionForEntity
import net.minecraft.block.BlockColored; //導入方法依賴的package包/類
public boolean itemInteractionForEntity(ItemStack p_111207_1_, EntityPlayer p_111207_2_, EntityLivingBase p_111207_3_)
{
if (p_111207_3_ instanceof EntitySheep)
{
EntitySheep entitysheep = (EntitySheep)p_111207_3_;
int i = BlockColored.func_150032_b(p_111207_1_.getItemDamage());
if (!entitysheep.getSheared() && entitysheep.getFleeceColor() != i)
{
entitysheep.setFleeceColor(i);
--p_111207_1_.stackSize;
}
return true;
}
else
{
return false;
}
}
示例5: onBlockActivated
import net.minecraft.block.BlockColored; //導入方法依賴的package包/類
@Override
public boolean onBlockActivated(EntityPlayer player, ItemStack stack, TileEntity tileEntity)
{
if(stack != null && stack.getItem() == Items.dye && tileEntity instanceof TileEntityProducer)
{
TileEntityProducer producer = (TileEntityProducer)tileEntity;
int[] modi = producer.getModifiers();
if(modi[2] != BlockColored.func_150032_b(stack.getItemDamage()))
{
modi[2] = BlockColored.func_150032_b(stack.getItemDamage());
if(!player.capabilities.isCreativeMode)
{
stack.stackSize--;
if(stack.stackSize == 0)
stack = null;
}
producer.getWorldObj().markBlockForUpdate(producer.xCoord, producer.yCoord, producer.zCoord);
producer.setModifiers(modi);;
return true;
}
}
return false;
}
示例6: itemInteractionForEntity
import net.minecraft.block.BlockColored; //導入方法依賴的package包/類
public boolean itemInteractionForEntity(ItemStack p_111207_1_, EntityPlayer p_111207_2_, EntityLivingBase p_111207_3_)
{
if (p_111207_3_ instanceof EntitySheep)
{
EntitySheep entitysheep = (EntitySheep)p_111207_3_;
int i = BlockColored.func_150032_b(p_111207_1_.getItemDamage());
if (!entitysheep.getSheared() && entitysheep.getFleeceColor() != i)
{
// CraftBukkit start
byte bColor = (byte) i;
SheepDyeWoolEvent event = new SheepDyeWoolEvent((org.bukkit.entity.Sheep) entitysheep.getBukkitEntity(), org.bukkit.DyeColor.getByData(bColor));
entitysheep.worldObj.getServer().getPluginManager().callEvent(event);
if (event.isCancelled())
{
return false;
}
i = (byte) event.getColor().getWoolData();
// CraftBukkit end
entitysheep.setFleeceColor(i);
--p_111207_1_.stackSize;
}
return true;
}
else
{
return false;
}
}
示例7: getCraftingResult
import net.minecraft.block.BlockColored; //導入方法依賴的package包/類
@Override
public ItemStack getCraftingResult(InventoryCrafting crafting) {
ItemStack itemstack = null;
int[] aint = new int[3];
int i = 0;
int j = 0;
ItemForcePack forcePack = null;
int k;
int l;
float f;
float f1;
int l1;
for (k = 0; k < crafting.getSizeInventory(); ++k) {
ItemStack itemstack1 = crafting.getStackInSlot(k);
if (itemstack1 != null) {
if (itemstack1.getItem() instanceof ItemForcePack) {
forcePack = (ItemForcePack) itemstack1.getItem();
if (itemstack != null) {
return null;
}
itemstack = itemstack1.copy();
itemstack.stackSize = 1;
if (forcePack.hasColor(itemstack1)) {
l = forcePack.getColor(itemstack);
f = (float) (l >> 16 & 255) / 255.0F;
f1 = (float) (l >> 8 & 255) / 255.0F;
float f2 = (float) (l & 255) / 255.0F;
i = (int) ((float) i + Math.max(f, Math.max(f1, f2)) * 255.0F);
aint[0] = (int) ((float) aint[0] + f * 255.0F);
aint[1] = (int) ((float) aint[1] + f1 * 255.0F);
aint[2] = (int) ((float) aint[2] + f2 * 255.0F);
++j;
}
} else {
if (itemstack1.getItem() != Items.dye) {
return null;
}
float[] afloat = EntitySheep.fleeceColorTable[BlockColored.func_150032_b(itemstack1.getItemDamage())];
int j1 = (int) (afloat[0] * 255.0F);
int k1 = (int) (afloat[1] * 255.0F);
l1 = (int) (afloat[2] * 255.0F);
i += Math.max(j1, Math.max(k1, l1));
aint[0] += j1;
aint[1] += k1;
aint[2] += l1;
++j;
}
}
}
if (forcePack == null) {
return null;
} else {
k = aint[0] / j;
int i1 = aint[1] / j;
l = aint[2] / j;
f = (float) i / (float) j;
f1 = (float) Math.max(k, Math.max(i1, l));
k = (int) ((float) k * f / f1);
i1 = (int) ((float) i1 * f / f1);
l = (int) ((float) l * f / f1);
l1 = (k << 8) + i1;
l1 = (l1 << 8) + l;
forcePack.setNBTTagColor(itemstack, l1);
return itemstack;
}
}
示例8: interact
import net.minecraft.block.BlockColored; //導入方法依賴的package包/類
public boolean interact(EntityPlayer player)
{
ItemStack itemstack = player.inventory.getCurrentItem();
if(this.isSitting()){
this.aiSit.setSitting(!this.isSitting());
}
if (this.isTamed())
{
if (itemstack != null)
{
if (!player.capabilities.isCreativeMode)
{
--itemstack.stackSize;
}
if (itemstack.getItem() instanceof ItemFood)
{
ItemFood itemfood = (ItemFood)itemstack.getItem();
if ( this.dataWatcher.getWatchableObjectFloat(18) < 20.0F)
{
if(isCarnivore){
this.destroyItemIfPossible(player);
this.heal((float)itemfood.func_150905_g(itemstack));
return true;
}
}
}
else if (itemstack.getItem() == Items.dye)
{
int i = BlockColored.func_150032_b(itemstack.getItemDamage());
if (i != this.getCollarColor())
{
this.setCollarColor(i);
this.destroyItemIfPossible(player);
return true;
}
}
}
if (this.func_152114_e(player) && !this.worldObj.isRemote && !this.isBreedingItem(itemstack))
{
this.aiSit.setSitting(!this.isSitting());
this.isJumping = false;
this.setPathToEntity((PathEntity)null);
this.setTarget((Entity)null);
this.setAttackTarget((EntityLivingBase)null);
}
}
else if (itemstack != null && itemstack.getItem() instanceof ItemFood && !this.isAngry()||itemstack != null && itemstack.getItem() == this.getTamingItem() && !this.isAngry())
{
this.destroyItemIfPossible(player);
if (!this.worldObj.isRemote)
{
if (this.rand.nextInt(3) == 0)
{
this.setTamed(true);
this.setPathToEntity((PathEntity)null);
this.setAttackTarget((EntityLivingBase)null);
this.aiSit.setSitting(true);
this.setHealth(20.0F);
this.func_152115_b(player.getUniqueID().toString());
this.playTameEffect(true);
this.worldObj.setEntityState(this, (byte)7);
}
else
{
this.playTameEffect(false);
this.worldObj.setEntityState(this, (byte)6);
}
}
return true;
}
return super.interact(player);
}
示例9: getUnlocalizedName
import net.minecraft.block.BlockColored; //導入方法依賴的package包/類
/**
* Returns the unlocalized name of this item. This version accepts an ItemStack so different stacks can have
* different names based on their damage or NBT.
*/
public String getUnlocalizedName(ItemStack par1ItemStack)
{
return super.getUnlocalizedName() + "." + ItemDye.field_150923_a[BlockColored.func_150032_b(par1ItemStack.getItemDamage())];
}
示例10: getUnlocalizedName
import net.minecraft.block.BlockColored; //導入方法依賴的package包/類
@Override
public String getUnlocalizedName(ItemStack itemstack) {
return this.field_150939_a.getUnlocalizedName() + "." + ItemDye.field_150921_b[BlockColored.func_150032_b(itemstack.getItemDamage())];
}
示例11: getCraftingResult
import net.minecraft.block.BlockColored; //導入方法依賴的package包/類
public ItemStack getCraftingResult(InventoryCrafting p_77572_1_) {
ItemStack itemstack = null;
int[] aint = new int[3];
int i = 0;
int j = 0;
ItemVividOrb orb = null;
int k;
int l;
float f;
float f1;
int l1;
for (k = 0; k < p_77572_1_.getSizeInventory(); ++k) {
ItemStack itemstack1 = p_77572_1_.getStackInSlot(k);
if (itemstack1 != null) {
if (itemstack1.getItem() == FarragoMod.VIVID_ORB) {
orb = (ItemVividOrb)itemstack1.getItem();
itemstack = itemstack1.copy();
itemstack.stackSize = 1;
if (orb.hasColor(itemstack1)) {
l = orb.getColorFromItemStack(itemstack, 0);
f = (float)(l >> 16 & 255) / 255.0F;
f1 = (float)(l >> 8 & 255) / 255.0F;
float f2 = (float)(l & 255) / 255.0F;
i = (int)((float)i + Math.max(f, Math.max(f1, f2)) * 255.0F);
aint[0] = (int)((float)aint[0] + f * 255.0F);
aint[1] = (int)((float)aint[1] + f1 * 255.0F);
aint[2] = (int)((float)aint[2] + f2 * 255.0F);
++j;
}
} else {
int color = -1;
int[] ids = OreDictionary.getOreIDs(itemstack1);
for (int x = 0; x < ids.length; x++) {
String nm = OreDictionary.getOreName(ids[x]);
if (nm.startsWith("dye") && dyes.containsKey(nm.substring(3))) {
color = dyes.get(nm.substring(3));
break;
}
}
if (color == -1) return null;
float[] afloat = EntitySheep.fleeceColorTable[BlockColored.func_150032_b(color)];
int j1 = (int)(afloat[0] * 255.0F);
int k1 = (int)(afloat[1] * 255.0F);
l1 = (int)(afloat[2] * 255.0F);
i += Math.max(j1, Math.max(k1, l1));
aint[0] += j1;
aint[1] += k1;
aint[2] += l1;
++j;
}
}
}
if (orb == null) {
return null;
} else {
k = aint[0] / j;
int i1 = aint[1] / j;
l = aint[2] / j;
f = (float)i / (float)j;
f1 = (float)Math.max(k, Math.max(i1, l));
k = (int)((float)k * f / f1);
i1 = (int)((float)i1 * f / f1);
l = (int)((float)l * f / f1);
l1 = (k << 8) + i1;
l1 = (l1 << 8) + l;
orb.setColor(itemstack, l1);
return itemstack;
}
}
示例12: interact
import net.minecraft.block.BlockColored; //導入方法依賴的package包/類
/**
* Called when a player interacts with a mob. e.g. gets milk from a cow, gets into the saddle on a pig.
*/
@Override
public boolean interact(EntityPlayer player) {
ItemStack itemstack = player.inventory.getCurrentItem();
if (this.isTamed()) {
if (itemstack != null) {
// if (itemstack.getItem() instanceof ItemFood) {
// ItemFood itemfood = (ItemFood) itemstack.getItem();
//
// if (itemfood.isWolfsFavoriteMeat() && this.dataWatcher.getWatchableObjectFloat(18) < 20.0F) {
// if (!entity.capabilities.isCreativeMode) {
// --itemstack.stackSize;
// }
//
// this.heal((float) itemfood.func_150905_g(itemstack));
//
// if (itemstack.stackSize <= 0) {
// entity.inventory.setInventorySlotContents(entity.inventory.currentItem, (ItemStack) null);
// }
//
// return true;
// }
// }
if (itemstack.getItem() == Items.dye) {
int i = BlockColored.func_150032_b(itemstack.getItemDamage());
if (i != this.getCollarColor()) {
this.setCollarColor(i);
if (!player.capabilities.isCreativeMode && --itemstack.stackSize <= 0) {
player.inventory.setInventorySlotContents(player.inventory.currentItem,
(ItemStack) null);
}
return true;
}
}
}
}
return super.interact(player);
}
示例13: getUnlocalizedName
import net.minecraft.block.BlockColored; //導入方法依賴的package包/類
public String getUnlocalizedName(ItemStack p_77667_1_)
{
return super.getUnlocalizedName() + "." + ItemDye.field_150923_a[BlockColored.func_150032_b(p_77667_1_.getItemDamage())];
}
示例14: getCraftingResult
import net.minecraft.block.BlockColored; //導入方法依賴的package包/類
public ItemStack getCraftingResult(InventoryCrafting p_77572_1_) {
ItemStack itemstack = null;
int[] aint = new int[3];
int i = 0;
int j = 0;
ItemCollar collar = null;
int k;
int l;
float f;
float f1;
int l1;
for (k = 0; k < p_77572_1_.getSizeInventory(); ++k) {
ItemStack itemstack1 = p_77572_1_.getStackInSlot(k);
if (itemstack1 != null) {
if (itemstack1.getItem() == PowerWolvesMod.COLLAR) {
collar = (ItemCollar)itemstack1.getItem();
itemstack = itemstack1.copy();
itemstack.stackSize = 1;
if (collar.hasColor(itemstack1)) {
l = collar.getColorFromItemStack(itemstack, 0);
f = (float)(l >> 16 & 255) / 255.0F;
f1 = (float)(l >> 8 & 255) / 255.0F;
float f2 = (float)(l & 255) / 255.0F;
i = (int)((float)i + Math.max(f, Math.max(f1, f2)) * 255.0F);
aint[0] = (int)((float)aint[0] + f * 255.0F);
aint[1] = (int)((float)aint[1] + f1 * 255.0F);
aint[2] = (int)((float)aint[2] + f2 * 255.0F);
++j;
}
} else {
if (itemstack1.getItem() != Items.dye) {
return null;
}
float[] afloat = EntitySheep.fleeceColorTable[BlockColored.func_150032_b(itemstack1.getItemDamage())];
int j1 = (int)(afloat[0] * 255.0F);
int k1 = (int)(afloat[1] * 255.0F);
l1 = (int)(afloat[2] * 255.0F);
i += Math.max(j1, Math.max(k1, l1));
aint[0] += j1;
aint[1] += k1;
aint[2] += l1;
++j;
}
}
}
if (collar == null) {
return null;
} else {
k = aint[0] / j;
int i1 = aint[1] / j;
l = aint[2] / j;
f = (float)i / (float)j;
f1 = (float)Math.max(k, Math.max(i1, l));
k = (int)((float)k * f / f1);
i1 = (int)((float)i1 * f / f1);
l = (int)((float)l * f / f1);
l1 = (k << 8) + i1;
l1 = (l1 << 8) + l;
collar.setColor(itemstack, l1);
return itemstack;
}
}
示例15: getTexture
import net.minecraft.block.BlockColored; //導入方法依賴的package包/類
public ResourceLocation getTexture(int meta) {
return new ResourceLocation("pandoraschest", "textures/blocks/clay_drawer_" + ItemDye.field_150921_b[BlockColored.func_150032_b(meta)] + ".png");
}