本文整理汇总了Java中net.minecraft.item.ItemDye类的典型用法代码示例。如果您正苦于以下问题:Java ItemDye类的具体用法?Java ItemDye怎么用?Java ItemDye使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ItemDye类属于net.minecraft.item包,在下文中一共展示了ItemDye类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: work
import net.minecraft.item.ItemDye; //导入依赖的package包/类
@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;
}
示例2: onItemUse
import net.minecraft.item.ItemDye; //导入依赖的package包/类
@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;
}
}
}
示例3: onItemUse
import net.minecraft.item.ItemDye; //导入依赖的package包/类
@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;
}
示例4: applyEnrichment
import net.minecraft.item.ItemDye; //导入依赖的package包/类
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;
}
示例5: doWork
import net.minecraft.item.ItemDye; //导入依赖的package包/类
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);
}
}
}
}
}
示例6: processInteract
import net.minecraft.item.ItemDye; //导入依赖的package包/类
@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;
}
示例7: getFireworkCharge
import net.minecraft.item.ItemDye; //导入依赖的package包/类
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;
}
示例8: addInfo
import net.minecraft.item.ItemDye; //导入依赖的package包/类
@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]));
}
示例9: run
import net.minecraft.item.ItemDye; //导入依赖的package包/类
@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;
}
示例10: onBonemealUse
import net.minecraft.item.ItemDye; //导入依赖的package包/类
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;
}
示例11: clOnBlockActivated
import net.minecraft.item.ItemDye; //导入依赖的package包/类
@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);
}
示例12: clOnBlockActivated
import net.minecraft.item.ItemDye; //导入依赖的package包/类
@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);
}
示例13: clOnBlockActivated
import net.minecraft.item.ItemDye; //导入依赖的package包/类
@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);
}
示例14: setTexture
import net.minecraft.item.ItemDye; //导入依赖的package包/类
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;
}
示例15: drawButton
import net.minecraft.item.ItemDye; //导入依赖的package包/类
@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);
}
}