Java 类net.minecraft.item.ItemDye 实例源码
项目:pnc-repressurized
文件:EntityDrone.java
@Override
public boolean processInteract(EntityPlayer player, EnumHand hand) {
ItemStack equippedItem = player.getHeldItemMainhand();
if (!world.isRemote && !equippedItem.isEmpty()) {
if (equippedItem.getItem() == Itemss.GPS_TOOL) {
BlockPos gpsLoc = ItemGPSTool.getGPSLocation(equippedItem);
if (gpsLoc != null) {
getNavigator().tryMoveToXYZ(gpsLoc.getX(), gpsLoc.getY(), gpsLoc.getZ(), 0.1D);
}
} else {
int dyeIndex = TileEntityPlasticMixer.getDyeIndex(equippedItem);
if (dyeIndex >= 0) {
setDroneColor(ItemDye.DYE_COLORS[dyeIndex]);
equippedItem.shrink(1);
if (equippedItem.getCount() <= 0) {
player.setHeldItem(EnumHand.MAIN_HAND, ItemStack.EMPTY);
}
}
}
}
return false;
}
项目:pnc-repressurized
文件:DateEventHandler.java
private static ItemStack getFireworkCharge() {
ItemStack charge = new ItemStack(Items.FIREWORK_CHARGE);
NBTTagCompound nbttagcompound = new NBTTagCompound();
NBTTagCompound nbttagcompound1 = new NBTTagCompound();
ArrayList<Integer> arraylist = new ArrayList<>();
arraylist.add(ItemDye.DYE_COLORS[rand.nextInt(16)]);
if (rand.nextBoolean()) nbttagcompound1.setBoolean("Flicker", true);
if (rand.nextBoolean()) nbttagcompound1.setBoolean("Trail", true);
byte b0 = (byte) rand.nextInt(5);
int[] aint = new int[arraylist.size()];
for (int j2 = 0; j2 < aint.length; ++j2) {
aint[j2] = arraylist.get(j2);
}
nbttagcompound1.setIntArray("Colors", aint);
nbttagcompound1.setByte("Type", b0);
nbttagcompound.setTag("Explosion", nbttagcompound1);
charge.setTagCompound(nbttagcompound);
return charge;
}
项目:pnc-repressurized
文件:ModuleLogistics.java
@Override
public void addInfo(List<String> curInfo) {
super.addInfo(curInfo);
String status;
if (ticksSinceAction >= 0) {
status = "waila.logisticsModule.transporting";
} else if (ticksSinceNotEnoughAir >= 0) {
status = "waila.logisticsModule.notEnoughAir";
} else if (hasPower()) {
status = "waila.logisticsModule.powered";
} else {
status = "waila.logisticsModule.noPower";
}
curInfo.add(I18n.format("hud.msg.state") + ": " + I18n.format(status));
curInfo.add(I18n.format("waila.logisticsModule.channel") + " " + TextFormatting.YELLOW + I18n.format("item.fireworksCharge." + ItemDye.DYE_COLORS[colorChannel]));
}
项目:Industrial-Foregoing
文件:CropEnrichMaterialInjectorTile.java
@Override
public float work() {
if (WorkUtils.isDisabled(this.getBlockType())) return 0;
List<BlockPos> blockPos = BlockUtils.getBlockPosInAABB(getWorkingArea());
boolean needsToIncrease = true;
if (pointer >= blockPos.size()) pointer = 0;
if (pointer < blockPos.size()) {
BlockPos pos = blockPos.get(pointer);
if (!this.world.isAirBlock(pos)) {
ItemStack stack = getFirstItem();
if (!stack.isEmpty()) {
FakePlayer player = IndustrialForegoing.getFakePlayer(this.world);
if (ItemDye.applyBonemeal(stack, this.world, pos, player, EnumHand.MAIN_HAND))
needsToIncrease = false;
}
}
} else {
pointer = 0;
}
if (needsToIncrease) ++pointer;
return 1;
}
项目:CharcoalPit
文件:ItemFertilizer.java
@Override
public EnumActionResult onItemUse(EntityPlayer player, World worldIn, BlockPos pos, EnumHand hand,
EnumFacing facing, float hitX, float hitY, float hitZ) {
ItemStack stack = player.getHeldItem(hand);
if (!player.canPlayerEdit(pos.offset(facing), facing, stack))
{
return EnumActionResult.FAIL;
}else{
if (ItemDye.applyBonemeal(stack, worldIn, pos, player, hand))
{
if (!worldIn.isRemote)
{
worldIn.playEvent(2005, pos, 0);
}
return EnumActionResult.SUCCESS;
}else{
return EnumActionResult.PASS;
}
}
}
项目:How-Bout-That-Furniture
文件:BlockSofa.java
@Override
public boolean clOnBlockActivated(World worldIn, BlockPos pos,
IBlockState state, EntityPlayer playerIn, EnumHand hand,
EnumFacing side, float hitX, float hitY, float hitZ) {
TileEntitySofa sofa = (TileEntitySofa) worldIn.getTileEntity(pos);
if (playerIn.getHeldItem(hand) != ItemStackTools.getEmptyStack()) {
ItemStack heldItem = playerIn.getHeldItem(hand);
if (heldItem.getItem() instanceof ItemDye && sofa.getColor() != 15 - heldItem.getItemDamage()) {
sofa.setColor(heldItem.getItemDamage());
if (!playerIn.capabilities.isCreativeMode) {
ItemStackTools.incStackSize(playerIn.getHeldItem(hand), -1);
}
if (worldIn.isRemote) {
worldIn.setBlockState(pos, state.withProperty(COLOR, sofa.getColor()));
}
return true;
}
}
return SittableUtil.sitOnBlock(worldIn, pos.getX(), pos.getY(), pos.getZ(), playerIn, 0.351);
}
项目:How-Bout-That-Furniture
文件:BlockStool.java
@Override
public boolean clOnBlockActivated(World worldIn, BlockPos pos,
IBlockState state, EntityPlayer playerIn, EnumHand hand,
EnumFacing side, float hitX, float hitY, float hitZ) {
if (playerIn.getHeldItem(hand) != ItemStackTools.getEmptyStack()) {
ItemStack heldItem = playerIn.getHeldItem(hand);
if (heldItem.getItem() instanceof ItemDye && state.getValue(COLOR) != 15 - heldItem.getItemDamage()) {
if (!playerIn.capabilities.isCreativeMode) {
ItemStackTools.incStackSize(playerIn.getHeldItem(hand), -1);
}
worldIn.setBlockState(pos, state.withProperty(COLOR, 15 - heldItem.getItemDamage()), 2);
return true;
}
}
return SittableUtil.sitOnBlock(worldIn, pos.getX(), pos.getY(), pos.getZ(), playerIn, 0.351);
}
项目:How-Bout-That-Furniture
文件:BlockChair.java
@Override
public boolean clOnBlockActivated(World worldIn, BlockPos pos,
IBlockState state, EntityPlayer playerIn, EnumHand hand,
EnumFacing side, float hitX, float hitY, float hitZ) {
TileEntityChair chair = (TileEntityChair) worldIn.getTileEntity(pos);
if (playerIn.getHeldItem(hand) != ItemStackTools.getEmptyStack()) {
ItemStack heldItem = playerIn.getHeldItem(hand);
if (heldItem.getItem() instanceof ItemDye && chair.getColor() != 15 - heldItem.getItemDamage()) {
System.out.println(chair.getColor());
chair.setColor(heldItem.getItemDamage());
if (!playerIn.capabilities.isCreativeMode) {
ItemStackTools.incStackSize(playerIn.getHeldItem(hand), -1);
}
if (worldIn.isRemote) {
worldIn.setBlockState(pos, state.withProperty(COLOR, chair.getColor()), 2);
}
return true;
}
}
return SittableUtil.sitOnBlock(worldIn, pos.getX(), pos.getY(), pos.getZ(), playerIn, 0.351);
}
项目:MrCrayfishSkateboardingMod
文件:TileEntityTextureable.java
public boolean setTexture(ItemStack stack)
{
if(stack != null && stack.getItem() instanceof ItemDye)
{
EnumDyeColor colour = EnumDyeColor.byDyeDamage(stack.getMetadata());
texture = new ResourceLocation("textures/blocks/hardened_clay_stained_" + colour.getName() + ".png");
return true;
}
if(stack != null && stack.getItem() instanceof ItemBlock)
{
System.out.println("called");
Block block = ((ItemBlock) stack.getItem()).block;
if(block.isNormalCube(block.getDefaultState()) || block instanceof BlockGlass)
{
IBakedModel model = Minecraft.getMinecraft().getBlockRendererDispatcher().getModelForState(block.getStateFromMeta(stack.getMetadata()));
texture = new ResourceLocation(model.getParticleTexture().getIconName());
return true;
}
}
return false;
}
项目:EnderCore
文件:ColorButton.java
@Override
public void drawButton(Minecraft mc, int mouseX, int mouseY) {
super.drawButton(mc, mouseX, mouseY);
if (visible) {
Tessellator tes = Tessellator.instance;
tes.startDrawingQuads();
int x = xPosition + 2;
int y = yPosition + 2;
GL11.glDisable(GL11.GL_TEXTURE_2D);
int col = ItemDye.field_150922_c[colorIndex];
tes.setColorOpaque_I(col);
tes.addVertex(x, y + height - 4, zLevel);
tes.addVertex(x + width - 4, y + height - 4, zLevel);
tes.addVertex(x + width - 4, y + 0, zLevel);
tes.addVertex(x, y + 0, zLevel);
tes.draw();
GL11.glEnable(GL11.GL_TEXTURE_2D);
}
}
项目:MrCrayfishSkateboardingMod
文件:TileEntityTextureable.java
public boolean setTexture(ItemStack stack)
{
if(stack != null && stack.getItem() instanceof ItemDye)
{
EnumDyeColor colour = EnumDyeColor.byDyeDamage(stack.getMetadata());
texture = new ResourceLocation("textures/blocks/hardened_clay_stained_" + colour.getName() + ".png");
return true;
}
if(stack != null && stack.getItem() instanceof ItemBlock)
{
System.out.println("called");
Block block = ((ItemBlock) stack.getItem()).block;
if(block.isNormalCube(block.getDefaultState()) || block instanceof BlockGlass)
{
IBakedModel model = Minecraft.getMinecraft().getBlockRendererDispatcher().getModelForState(block.getStateFromMeta(stack.getMetadata()));
texture = new ResourceLocation(model.getParticleTexture().getIconName());
return true;
}
}
return false;
}
项目:BluePower
文件:TileSortron.java
public static byte parseColorFromObject(Object argument) throws Exception {
if (argument instanceof Double) {
byte color = ((Double) argument).byteValue();
if (color >= -1 && color < 16) {
return color;
}
throw new IllegalArgumentException("Color values should be greater than or equal to -1 and smaller than 16");
} else if (argument instanceof String) {
String input = (String) argument;
if (input.isEmpty()) {
return -1;
}
for (byte color = 0; color < ItemDye.field_150923_a.length; color++) {
String colorName = ItemDye.field_150923_a[color];
if (colorName.equals(input)) {
return color;
}
}
throw new IllegalArgumentException("Given String is not a color");
}
throw new IllegalArgumentException("No expected argument was given");
}
项目:Minecraft_Mineralogy
文件:MineralFertilizer.java
@Override public EnumActionResult onItemUse(ItemStack srcItemStack, EntityPlayer playerEntity, World world, BlockPos target, EnumHand hand, EnumFacing face, float par8, float par9, float par10){
boolean canUse = ItemDye.applyBonemeal(srcItemStack,world,target,playerEntity);
if(canUse){
phantomBonemeal.stackSize = 27;
for(int dx = -2; dx <= 2; dx++){
for(int dy = -2; dy <= 2; dy++){
for(int dz = -1; dz <= 1; dz++){
if((dx | dy | dz) == 0) continue;
BlockPos t = target.add(dx, dy, dz);
ItemDye.applyBonemeal(phantomBonemeal,world,t,playerEntity);
}
}
}
return EnumActionResult.SUCCESS;
}
return EnumActionResult.PASS;
}
项目:rpginventory
文件:TEMold.java
public static boolean isMineral(ItemStack stack) {
if (stack.getItem() != null) {
if (stack.getItem().equals(Items.emerald)) {
return true;
}
if (stack.getItem().equals(Items.diamond)) {
return true;
}
if (stack.getItem().equals((Items.gold_ingot))) {
return true;
}
if ((stack.getItem() instanceof ItemDye)
&& (stack.getItemDamage() == 4)) {
return true;
}
}
return false;
}
项目:minepainter
文件:Crafting.java
@Override
public boolean matches(InventoryCrafting ic, World w) {
ItemStack bucket = null;
ItemStack dye = null;
int size = ic.getSizeInventory();
for(int i = 0 ; i < size; i ++){
ItemStack is = ic.getStackInSlot(i);
if(is == null)continue;
if(is.getItem() instanceof PaintTool.Bucket || is.getItem() == Items.water_bucket){
if(bucket != null)return false;
bucket = is;
continue;
}
if(is.getItem() instanceof ItemDye || is.getItem() == Items.slime_ball){
if(dye != null)return false;
dye = is;
continue;
}
return false;
}
return bucket != null && dye != null;
}
项目:minepainter
文件:Crafting.java
@Override
public ItemStack getCraftingResult(InventoryCrafting ic) {
ItemStack bucket = null;
ItemStack dye = null;
int size = ic.getSizeInventory();
for(int i = 0 ; i < size; i ++){
ItemStack is = ic.getStackInSlot(i);
if(is == null)continue;
if(is.getItem() instanceof PaintTool.Bucket || is.getItem() == Items.water_bucket){
if(bucket != null)return null;
bucket = is;
continue;
}
if(is.getItem() instanceof ItemDye || is.getItem() == Items.slime_ball){
if(dye != null)return null;
dye = is;
continue;
}
}
ItemStack newbucket = new ItemStack(ModMinePainter.bucket.item);
newbucket.setItemDamage(dye.getItem() == Items.slime_ball ? 16 : dye.getItemDamage());
return newbucket;
}
项目:GardenCollection
文件:ItemCompost.java
public boolean applyEnrichment (ItemStack itemStack, World world, int x, int y, int z, EntityPlayer player) {
ConfigManager config = GardenCore.config;
Block block = world.getBlock(x, y, z);
EnrichedSoilEvent event = new EnrichedSoilEvent(player, world, block, x, y, z);
if (MinecraftForge.EVENT_BUS.post(event))
return false;
if (!config.enableCompostBonemeal)
return false;
if (event.getResult() == Event.Result.ALLOW) {
if (!world.isRemote)
itemStack.stackSize--;
return true;
}
int prob = (config.compostBonemealStrength == 0) ? 0 : (int)(1 / config.compostBonemealStrength);
if (world.rand.nextInt(prob) == 0)
return ItemDye.applyBonemeal(itemStack, world, x, y, z, player);
else
--itemStack.stackSize;
return true;
}
项目:GardenCollection
文件:ItemLantern.java
@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);
}
项目:RuneCraftery
文件:DispenserBehaviorDye.java
protected ItemStack func_82487_b(IBlockSource p_82487_1_, ItemStack p_82487_2_) {
if(p_82487_2_.func_77960_j() == 15) {
EnumFacing var3 = BlockDispenser.func_100009_j_(p_82487_1_.func_82620_h());
World var4 = p_82487_1_.func_82618_k();
int var5 = p_82487_1_.func_82623_d() + var3.func_82601_c();
int var6 = p_82487_1_.func_82622_e() + var3.func_96559_d();
int var7 = p_82487_1_.func_82621_f() + var3.func_82599_e();
if(ItemDye.func_96604_a(p_82487_2_, var4, var5, var6, var7)) {
if(!var4.field_72995_K) {
var4.func_72926_e(2005, var5, var6, var7, 0);
}
} else {
this.field_96461_b = false;
}
return p_82487_2_;
} else {
return super.func_82487_b(p_82487_1_, p_82487_2_);
}
}
项目:OpenBlocks
文件:TileEntitySprinkler.java
private void attemptFertilize() {
if (!(world instanceof WorldServer)) return;
final int fertilizerChance = hasBonemeal? Config.sprinklerBonemealFertizizeChance : Config.sprinklerFertilizeChance;
if (RANDOM.nextDouble() < 1.0 / fertilizerChance) {
FakePlayerPool.instance.executeOnPlayer((WorldServer)world, (PlayerUser)fakePlayer -> {
final int x = selectFromRange(Config.sprinklerEffectiveRange);
final int z = selectFromRange(Config.sprinklerEffectiveRange);
for (int y = -1; y <= 1; y++) {
BlockPos target = pos.add(x, y, z);
if (ItemDye.applyBonemeal(BONEMEAL.copy(), world, target, fakePlayer, EnumHand.MAIN_HAND))
break;
}
});
}
}
项目:PneumaticCraft
文件:EntityDrone.java
@Override
public boolean interact(EntityPlayer player){
ItemStack equippedItem = player.getCurrentEquippedItem();
if(!worldObj.isRemote && equippedItem != null) {
if(equippedItem.getItem() == Itemss.GPSTool) {
ChunkPosition gpsLoc = ItemGPSTool.getGPSLocation(equippedItem);
if(gpsLoc != null) {
getNavigator().tryMoveToXYZ(gpsLoc.chunkPosX, gpsLoc.chunkPosY, gpsLoc.chunkPosZ, 0.1D);
}
} else {
int dyeIndex = TileEntityPlasticMixer.getDyeIndex(equippedItem);
if(dyeIndex >= 0) {
setDroneColor(ItemDye.field_150922_c[dyeIndex]);
equippedItem.stackSize--;
if(equippedItem.stackSize <= 0) {
player.setCurrentItemOrArmor(0, null);
}
}
}
}
return false;
}
项目:PneumaticCraft
文件:FluidPlastic.java
public static int getPlasticMeta(FluidStack plastic){
int[] dyeColors = ItemDye.field_150922_c;
int[] plasticColor = getColor3(plastic);
int bestMatching = -1;
double closestGap = Double.MAX_VALUE;
List<ItemStack> plasticTypes = new ArrayList<ItemStack>();
((ItemPlasticPlants)Itemss.plasticPlant).addSubItems(plasticTypes);
for(ItemStack s : plasticTypes) {
int i = s.getItemDamage();
double gap = Math.pow(plasticColor[0] - (dyeColors[i] >> 16), 2) + Math.pow(plasticColor[1] - (dyeColors[i] >> 8 & 255), 2) + Math.pow(plasticColor[2] - (dyeColors[i] & 255), 2);
if(gap < closestGap) {
closestGap = gap;
bestMatching = i;
}
}
return bestMatching;
}
项目:PneumaticCraft
文件:RecipeColorDrone.java
@Override
public ItemStack getCraftingResult(InventoryCrafting inventoryCrafting){
ItemStack drone = null;
int dyeIndex = -1;
for(int i = 0; i < inventoryCrafting.getSizeInventory(); i++) {
ItemStack stack = inventoryCrafting.getStackInSlot(i);
if(stack != null) {
if(stack.getItem() == Itemss.drone) {
drone = stack.copy();
} else if(dyeIndex == -1) {
dyeIndex = TileEntityPlasticMixer.getDyeIndex(stack);
}
}
}
NBTTagCompound droneTag = drone.getTagCompound();
if(droneTag == null) {
droneTag = new NBTTagCompound();
drone.setTagCompound(droneTag);
}
droneTag.setInteger("color", ItemDye.field_150922_c[dyeIndex]);
return drone;
}
项目:PneumaticCraft
文件:ModuleLogistics.java
@Override
public void addInfo(List<String> curInfo){
super.addInfo(curInfo);
String status;
if(ticksSinceAction >= 0) {
status = "waila.logisticsModule.transporting";
} else if(ticksSinceNotEnoughAir >= 0) {
status = "waila.logisticsModule.notEnoughAir";
} else if(hasPower()) {
status = "waila.logisticsModule.powered";
} else {
status = "waila.logisticsModule.noPower";
}
curInfo.add(StatCollector.translateToLocal("hud.msg.state") + ": " + StatCollector.translateToLocal(status));
curInfo.add(StatCollector.translateToLocal("waila.logisticsModule.channel") + " " + EnumChatFormatting.YELLOW + StatCollector.translateToLocal("item.fireworksCharge." + ItemDye.field_150923_a[colorChannel]));
}
项目:EnergyFromMatter
文件:TileCropRipener.java
private void doWork(TileEmcCapacitor emcCap)
{
for (int x = -4; x <= 4; x++)
{
for (int z = -4; z <= 4; z++)
{
if (!(Block.blocksList[worldObj.getBlockId(xCoord + x, yCoord,
zCoord + z)] == Block.grass))
{
if (ItemDye.applyBonemeal(new ItemStack(Item.dyePowder),
worldObj, xCoord + x, yCoord, zCoord + z,
FakePlayerFactory.getMinecraft(worldObj)))
{
emcCap.useEmc(new EmcValue(1.0F, EmcType.ESSENTIA),
xCoord, yCoord, zCoord);
}
}
}
}
}
项目:AltEnergy
文件:BlockEnergyBusway.java
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7,
float par8, float par9) {
TileEnergyBusway tileEntity = (TileEnergyBusway) world.getBlockTileEntity(x, y, z);
if (!world.isRemote) {
if (player.inventory.getCurrentItem() != null) {
if (player.inventory.getCurrentItem().getItem() instanceof ItemDye) {
player.inventory.getCurrentItem().stackSize = player.inventory.getCurrentItem().stackSize - 1;
PacketManager.sendPacketToClients(PacketManager.getPacket(Reference.CHANNEL_NAME, tileEntity,
(byte) 0));
((IConductor) tileEntity).updateAdjacentConnections();
updateConductorSwitch(world, x, y, z);
return true;
}
}
}
return false;
}
项目:AltEnergy
文件:BlockEnergyCable.java
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7,
float par8, float par9) {
TileEnergyBusway tileEntity = (TileEnergyBusway) world.getBlockTileEntity(x, y, z);
if (!world.isRemote) {
if (player.inventory.getCurrentItem() != null) {
if (player.inventory.getCurrentItem().getItem() instanceof ItemDye) {
player.inventory.getCurrentItem().stackSize = player.inventory.getCurrentItem().stackSize - 1;
PacketManager.sendPacketToClients(PacketManager.getPacket(Reference.CHANNEL_NAME, tileEntity,
(byte) 0));
((IConductor) tileEntity).updateAdjacentConnections();
updateConductorSwitch(world, x, y, z);
return true;
}
}
}
return false;
}
项目:pnc-repressurized
文件:ModelLogistics.java
private void renderChannelColorFrame(float size) {
RenderUtils.glColorHex(0xFF000000 | ItemDye.DYE_COLORS[module.getColorChannel()]);
shape1.render(size);
shape2.render(size);
shape3.render(size);
shape4.render(size);
GlStateManager.color(1, 1, 1, 1);
}
项目:pnc-repressurized
文件:FluidPlastic.java
public static void addDye(FluidStack plastic, int dyeMetadata) {
if (!Fluids.areFluidsEqual(plastic.getFluid(), Fluids.PLASTIC))
throw new IllegalArgumentException("Given fluid stack isn't mixable! " + plastic);
int dyeColor = ItemDye.DYE_COLORS[dyeMetadata];
int[] dyeColors = new int[]{dyeColor >> 16, dyeColor >> 8 & 255, dyeColor & 255};
int[] plasticColor = getColor3(plastic);
double ratio = PneumaticValues.PLASTIC_MIX_RATIO / (PneumaticValues.PLASTIC_MIX_RATIO * (plastic.amount / 1000D));
for (int i = 0; i < 3; i++) {
plasticColor[i] = (int) (ratio * dyeColors[i] + (1 - ratio) * plasticColor[i]);
}
if (plastic.tag == null) plastic.tag = new NBTTagCompound();
plastic.tag.setInteger("color", (plasticColor[0] << 16) + (plasticColor[1] << 8) + plasticColor[2]);
}
项目:Mods
文件:EntityTeleporter.java
@Override
public boolean processInteract(EntityPlayer player, EnumHand hand) {
if (player == this.getOwner() && player.getHeldItem(hand).getItem() instanceof ItemDye) {
if(!world.isRemote) {
this.setColor(player.getHeldItem(hand).getMetadata());
}
return true;
}
if (this.world.isRemote && player == this.getOwner() && hand == EnumHand.MAIN_HAND) {
ClientProxy.showGuiTeleporter(this);
return true;
}
return false;
}
项目:BetterWithAddons
文件:ArmorDecorateRecipe.java
/**
* Used to check if a recipe matches current crafting inventory
*/
/*public boolean matches(InventoryCrafting inv, World worldIn)
{
int washiCount = 0;
int goldCount = 0;
int armorCount = 0;
List<ItemStack> list = Lists.<ItemStack>newArrayList();
for (int i = 0; i < inv.getSizeInventory(); ++i)
{
ItemStack itemstack = inv.getStackInSlot(i);
if (itemstack != null)
{
if (matchItem(itemstack,"nuggetGold"))
{
goldCount++;
}
else if (matchItem(itemstack, ModItems.materialJapan.getMaterial("washi")))
{
washiCount++;
}
else if (matchItem(itemstack,inputItem))
{
armorCount++;
}
else if(isDye(itemstack))
{
list.add(itemstack);
}
}
}
return list.size() == 2 && washiCount == 3 && goldCount == 3 && armorCount == 1;
}*/
private boolean isDye(ItemStack in)
{
return in.getItem() instanceof ItemDye;
}
项目:Thelta
文件:TileEntityTube.java
@Override
public boolean onBlockActivated(IBlockState state, EntityPlayer playerIn, EnumHand hand, EnumFacing facing,
float side, float hitX, float hitY) {
if (world.isRemote)
return false;
boolean shouldDye = (playerIn.getHeldItemMainhand().getItem() instanceof ItemDye);
if (shouldDye) {
setColour(TubeColour.Red);
return true;
}
return false;
}
项目:4Space-5
文件:BlockOxygenPipe.java
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister par1IconRegister)
{
this.pipeIcons = new IIcon[16];
for (int count = 0; count < ItemDye.field_150923_a.length; count++)
{
this.pipeIcons[count] = par1IconRegister.registerIcon(GalacticraftCore.TEXTURE_PREFIX + "pipe_oxygen_" + ItemDye.field_150923_a[count]);
}
this.blockIcon = this.pipeIcons[15];
}
项目:Wizardry
文件:ModuleEffectThrive.java
@Override
public boolean run(@Nonnull SpellData spell) {
World world = spell.world;
BlockPos targetPos = spell.getData(BLOCK_HIT);
Entity targetEntity = spell.getData(ENTITY_HIT);
Entity caster = spell.getData(CASTER);
Vec3d pos = spell.getData(TARGET_HIT);
if (pos != null)
spell.world.playSound(null, new BlockPos(pos), ModSounds.HEAL, SoundCategory.NEUTRAL, 1, 1);
if (targetEntity instanceof EntityLivingBase) {
double strength = getModifier(spell, Attributes.POTENCY, 3, 20) / 10.0;
if (!tax(this, spell)) return false;
((EntityLivingBase) targetEntity).heal((float) strength);
}
if (targetPos != null) {
if (world.getBlockState(targetPos).getBlock() instanceof IGrowable) {
if (!tax(this, spell)) return false;
if (caster == null || (caster instanceof EntityPlayer && BlockUtils.hasEditPermission(targetPos, (EntityPlayerMP) caster)))
ItemDye.applyBonemeal(new ItemStack(Items.DYE), world, targetPos);
} else if (world.getBlockState(targetPos).getBlock() instanceof IPlantable) {
IBlockState state = world.getBlockState(targetPos);
Block block = state.getBlock();
if (!tax(this, spell)) return false;
if (caster == null || (caster instanceof EntityPlayer && BlockUtils.hasEditPermission(targetPos, (EntityPlayerMP) caster))) {
while (world.getBlockState(targetPos.up()).getBlock() == block) {
targetPos = targetPos.up();
state = world.getBlockState(targetPos);
block = state.getBlock();
}
world.immediateBlockTick(targetPos, state, RandUtil.random);
}
}
}
return true;
}
项目:Aether-Legacy
文件:EntityWhirlwind.java
@Override
protected void entityInit()
{
super.entityInit();
this.dataManager.register(IS_EVIL, false);
this.dataManager.register(COLOR_DATA, ItemDye.DYE_COLORS[15]);
}
项目:Aether-Legacy
文件:EntityWhirlwind.java
@Override
public boolean processInteract(EntityPlayer player, EnumHand hand, ItemStack stack)
{
ItemStack heldItem = player.getHeldItem(hand);
if (heldItem != null && heldItem.getItem() == Items.DYE && AetherRankings.isRankedPlayer(player.getUniqueID()))
{
this.setColorData(Integer.valueOf(ItemDye.DYE_COLORS[heldItem.getItemDamage()]));
return true;
}
return super.processInteract(player, hand, stack);
}
项目:UncraftingTable
文件:NBTSensitiveRecipeHandlers.java
private List<ItemStack> getFireworkStarItems()
{
List<ItemStack> recipeItems = new ArrayList<ItemStack>();
// add the gunpowder
recipeItems.add(new ItemStack(Items.GUNPOWDER, 1));
if (inputStack.hasTagCompound())
{
// read the nbt tag from the input item
NBTTagCompound tag = inputStack.getTagCompound().getCompoundTag("Explosion");
// add a dye item of the appropriate color for each value in the colors array
for ( int color : tag.getIntArray("Colors"))
{
int index = ArrayUtils.indexOf(ItemDye.DYE_COLORS, color);
if (index >= 0) recipeItems.add(new ItemStack(Items.DYE, 1, index));
}
// add the item which corresponds to the exlosion type
switch (tag.getInteger("Type"))
{
case 0: break;
case 1: recipeItems.add(new ItemStack(Items.FIRE_CHARGE, 1)); break;
case 2: recipeItems.add(new ItemStack(Items.GOLD_NUGGET, 1)); break;
case 3: recipeItems.add(new ItemStack(Items.SKULL, 1, 4)); break;
case 4: recipeItems.add(new ItemStack(Items.FEATHER, 1)); break;
}
// if the explosion has a trail, add a diamond
if (tag.hasKey("Trail") && tag.getByte("Trail") == 1) recipeItems.add(new ItemStack(Items.DIAMOND, 1));
// if the explosion has a flicker, add a glowstone dust
if (tag.hasKey("Flicker") && tag.getByte("Flicker") == 1) recipeItems.add(new ItemStack(Items.GLOWSTONE_DUST, 1));
}
return recipeItems;
}
项目:FairyFactions
文件:FairyJob.java
private boolean onBonemealUse( final ItemStack stack, int x, final int y, int z, final World world ) {
for ( int a = 0; a < 3; a++ ) {
final Block i = world.getBlock( x, y + 1, z );
final int j = world.getBlockMetadata( x, y + 1, z );
if ( i == Blocks.wheat && j < 7 ) {
final Block block = Blocks.wheat;
world.playSoundEffect( x + 0.5F, y + 0.5F, z + 0.5F, block.stepSound.getBreakSound(),
(block.stepSound.getVolume() + 1.0F) / 2.0F, block.stepSound.getPitch() * 0.8F );
ItemDye.applyBonemeal(stack, world, x, y, z, null);
fairy.armSwing( !fairy.didSwing );
fairy.setTempItem( stack.getItem() );
fairy.attackTime = 30;
if ( fairy.flymode() && fairy.getFlyTime() > 0 ) {
fairy.setFlyTime( 0 );
}
return true;
}
x += fairy.getRNG().nextInt( 3 ) - 1;
z += fairy.getRNG().nextInt( 3 ) - 1;
}
return false;
}
项目:EnderCore
文件:ColorButton.java
private void nextColor() {
colorIndex++;
if (colorIndex >= ItemDye.field_150923_a.length) {
colorIndex = 0;
}
setColorIndex(colorIndex);
}
项目:EnderCore
文件:ColorButton.java
private void prevColor() {
colorIndex--;
if (colorIndex < 0) {
colorIndex = ItemDye.field_150923_a.length - 1;
}
setColorIndex(colorIndex);
}