本文整理汇总了Java中net.minecraft.tileentity.TileEntityFurnace类的典型用法代码示例。如果您正苦于以下问题:Java TileEntityFurnace类的具体用法?Java TileEntityFurnace怎么用?Java TileEntityFurnace使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
TileEntityFurnace类属于net.minecraft.tileentity包,在下文中一共展示了TileEntityFurnace类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: update
import net.minecraft.tileentity.TileEntityFurnace; //导入依赖的package包/类
@Override
public void update() {
TileEntityFurnace furnace = getTileEntity();
if (getHeatExchanger().getTemperature() > 373) {
int furnaceBurnTime = furnace.getField(0);
int furnaceCookTime = furnace.getField(2);
if (furnaceBurnTime < 190 && !furnace.getStackInSlot(0).isEmpty()) {
if (furnaceBurnTime == 0) BlockFurnace.setState(true, furnace.getWorld(), furnace.getPos());
furnace.setField(1, 200); // currentItemBurnTime
furnace.setField(0, furnaceBurnTime + 10); // furnaceBurnTime
getHeatExchanger().addHeat(-1);
}
if (furnaceCookTime > 0) {
// Easy performance saver, the Furnace won't be ticked unnecessary when there's nothing to
// cook (or when just started cooking).
int progress = Math.max(0, ((int) getHeatExchanger().getTemperature() - 343) / 30);
progress = Math.min(5, progress);
for (int i = 0; i < progress; i++) {
furnace.update();
}
}
}
}
示例2: onBlockActivated
import net.minecraft.tileentity.TileEntityFurnace; //导入依赖的package包/类
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ)
{
if (worldIn.isRemote)
{
return true;
}
else
{
TileEntity tileentity = worldIn.getTileEntity(pos);
if (tileentity instanceof TileEntityFurnace)
{
playerIn.displayGUIChest((TileEntityFurnace)tileentity);
playerIn.triggerAchievement(StatList.field_181741_Y);
}
return true;
}
}
示例3: drawGuiContainerBackgroundLayer
import net.minecraft.tileentity.TileEntityFurnace; //导入依赖的package包/类
/**
* Args : renderPartialTicks, mouseX, mouseY
*/
protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY)
{
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(furnaceGuiTextures);
int i = (this.width - this.xSize) / 2;
int j = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(i, j, 0, 0, this.xSize, this.ySize);
if (TileEntityFurnace.isBurning(this.tileFurnace))
{
int k = this.getBurnLeftScaled(13);
this.drawTexturedModalRect(i + 56, j + 36 + 12 - k, 176, 12 - k, 14, k + 1);
}
int l = this.getCookProgressScaled(24);
this.drawTexturedModalRect(i + 79, j + 34, 176, 14, l + 1, 16);
}
示例4: findMatchingFuel
import net.minecraft.tileentity.TileEntityFurnace; //导入依赖的package包/类
public static MachineFuel findMatchingFuel(ResourceLocation list, NonNullList<ItemStack> input)
{
if (list.toString().equals("minecraft:vanilla"))
{
if (input.size() == 1 && !input.get(0).isEmpty())
{
ItemStack stack = input.get(0);
int burnTime = TileEntityFurnace.getItemBurnTime(stack);
if (burnTime > 0)
return new VanillaFurnaceFuel(stack, burnTime);
}
return MachineFuel.EMPTY;
}
return findMatchingFuel(getInstance(list).fuels, input);
}
示例5: isPartOfFuel
import net.minecraft.tileentity.TileEntityFurnace; //导入依赖的package包/类
public static boolean isPartOfFuel(ResourceLocation list, ItemStack stack)
{
if (stack.isEmpty())
return false;
if (list.toString().equals("minecraft:vanilla"))
{
return TileEntityFurnace.getItemBurnTime(stack) > 0;
}
for (MachineFuel fuel : getInstance(list).fuels)
{
if (fuel.getFuelInput().stream()
.anyMatch(input -> ItemHelper.stackMatchesRecipeInput(stack, input, false)))
return true;
}
return false;
}
示例6: isStackValidForSlot
import net.minecraft.tileentity.TileEntityFurnace; //导入依赖的package包/类
private boolean isStackValidForSlot(int index, @Nonnull ItemStack stack)
{
if (!slotChecksEnabled)
return true;
if (type.isOutputSlot(index))
{
return false;
} else if (type.isInputSlot(index))
{
return true;
} else
{
return TileEntityFurnace.isItemFuel(stack) || SlotFurnaceFuel.isBucket(stack);
}
}
示例7: useOnVanillaFurnace
import net.minecraft.tileentity.TileEntityFurnace; //导入依赖的package包/类
private boolean useOnVanillaFurnace(EntityPlayer playerIn, World world, BlockPos pos, ItemStack stack, Upgrades upgrade)
{
TileEntity te = world.getTileEntity(pos);
if (te != null && te instanceof TileEntityFurnace)
{
TileEntityFurnace furnace = (TileEntityFurnace) te;
boolean upgraded = upgradeVanillaFurnace(world, pos, furnace, upgrade.getUpgradedType());
if (upgraded && !playerIn.capabilities.isCreativeMode)
{
stack.shrink(1);
}
return true;
}
return false;
}
示例8: upgradeVanillaFurnace
import net.minecraft.tileentity.TileEntityFurnace; //导入依赖的package包/类
private boolean upgradeVanillaFurnace(World world, BlockPos pos, TileEntityFurnace furnace, FurnaceType to)
{
byte facing = (byte) world.getBlockState(pos).getValue(BlockFurnace.FACING).ordinal();
TileEntityIronFurnace newFurnace = FurnaceType.makeEntity(to.ordinal());
if (newFurnace != null)
{
int[][] fromSlotIds = new int[][] {new int[] {0}, new int[] {1}, new int[] {2}};
copyInventory(furnace, fromSlotIds, newFurnace);
world.setBlockState(pos, MoreFurnaces.blockFurnaces.getDefaultState().withProperty(BlockMoreFurnaces.VARIANT, to));
world.setTileEntity(pos, newFurnace);
newFurnace.copyStateFrom(furnace, facing);
return true;
} else
{
return false;
}
}
示例9: onBlockActivated
import net.minecraft.tileentity.TileEntityFurnace; //导入依赖的package包/类
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, EnumFacing heldItem, float side, float hitX, float hitY)
{
if (worldIn.isRemote)
{
return true;
}
else
{
TileEntity tileentity = worldIn.getTileEntity(pos);
if (tileentity instanceof TileEntityFurnace)
{
playerIn.displayGUIChest((TileEntityFurnace)tileentity);
playerIn.addStat(StatList.FURNACE_INTERACTION);
}
return true;
}
}
示例10: breakBlock
import net.minecraft.tileentity.TileEntityFurnace; //导入依赖的package包/类
/**
* Called serverside after this block is replaced with another in Chunk, but before the Tile Entity is updated
*/
public void breakBlock(World worldIn, BlockPos pos, IBlockState state)
{
if (!keepInventory)
{
TileEntity tileentity = worldIn.getTileEntity(pos);
if (tileentity instanceof TileEntityFurnace)
{
InventoryHelper.dropInventoryItems(worldIn, pos, (TileEntityFurnace)tileentity);
worldIn.updateComparatorOutputLevel(pos, this);
}
}
super.breakBlock(worldIn, pos, state);
}
示例11: drawGuiContainerBackgroundLayer
import net.minecraft.tileentity.TileEntityFurnace; //导入依赖的package包/类
/**
* Draws the background layer of this container (behind the items).
*/
protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY)
{
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(FURNACE_GUI_TEXTURES);
int i = (this.width - this.xSize) / 2;
int j = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(i, j, 0, 0, this.xSize, this.ySize);
if (TileEntityFurnace.isBurning(this.tileFurnace))
{
int k = this.getBurnLeftScaled(13);
this.drawTexturedModalRect(i + 56, j + 36 + 12 - k, 176, 12 - k, 14, k + 1);
}
int l = this.getCookProgressScaled(24);
this.drawTexturedModalRect(i + 79, j + 34, 176, 14, l + 1, 16);
}
示例12: onBlockActivated
import net.minecraft.tileentity.TileEntityFurnace; //导入依赖的package包/类
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, @Nullable ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ)
{
if (worldIn.isRemote)
{
return true;
}
else
{
TileEntity tileentity = worldIn.getTileEntity(pos);
if (tileentity instanceof TileEntityFurnace)
{
playerIn.displayGUIChest((TileEntityFurnace)tileentity);
playerIn.addStat(StatList.FURNACE_INTERACTION);
}
return true;
}
}
示例13: initialize
import net.minecraft.tileentity.TileEntityFurnace; //导入依赖的package包/类
public static void initialize() {
NonNullList<ItemStack> stacks = NonNullList.create();
for (Item i : ForgeRegistries.ITEMS) {
CreativeTabs tab = i.getCreativeTab();
if(tab != null) {
i.getSubItems(tab, stacks);
}
}
List<ItemStack> out = new LinkedList<>();
for (ItemStack stack : stacks) {
int burn = TileEntityFurnace.getItemBurnTime(stack); //Respects vanilla values.
if(burn > 0) {
out.add(stack);
}
}
knownFuelStacks = ImmutableList.copyOf(out);
}
示例14: handleEntityCollision
import net.minecraft.tileentity.TileEntityFurnace; //导入依赖的package包/类
@Override
public boolean handleEntityCollision(World worldIn, BlockPos pos,
IBlockState state, Entity entityIn) {
if(entity.ticksExisted()%FUEL_EAT_TICKS==0 && !worldIn.isRemote){
if(entityIn instanceof EntityItem){
ItemStack stack = ((EntityItem)entityIn).getItem();
//find the furnace burn time. if not hardcoded in vanilla furnace, it will check Forge's registered fuelHandlers
int burnTime = TileEntityFurnace.getItemBurnTime(stack);
if(burnTime!=0){
this.addFuel(burnTime*stack.getCount());
worldIn.playSound(null,entityIn.posX, entityIn.posY, entityIn.posZ, SoundEvents.BLOCK_FIRE_EXTINGUISH, SoundCategory.BLOCKS, 1, 1);
worldIn.spawnParticle(EnumParticleTypes.SMOKE_LARGE, entityIn.posX, entityIn.posY, entityIn.posZ, 0, 0, 0);
entityIn.setDead();
IBlockState bstate = worldIn.getBlockState(getPos());
worldIn.notifyBlockUpdate(getPos(), bstate, bstate, 3);
}
}
}
return true;
}
示例15: ignite
import net.minecraft.tileentity.TileEntityFurnace; //导入依赖的package包/类
private boolean ignite() {
ItemStack stackInSlot = furnace.getStackInSlot(fuel_slot);
int burnTime = TileEntityFurnace.getItemBurnTime(stackInSlot);
if (burnTime > 0) {
furnace.setField(currentItemBurnTime_field, burnTime);
furnace.setField(furnaceBurnTime_field, burnTime - 1);
stackInSlot.stackSize--;
if (stackInSlot.stackSize <= 0) {
stackInSlot = stackInSlot.getItem().getContainerItem(stackInSlot);
}
furnace.setInventorySlotContents(fuel_slot, stackInSlot);
BlockFurnace.setState(furnace.isBurning(), furnace.getWorld(), furnace.getPos());
furnace.markDirty();
return true;
}
return false;
}