Search in sources :

Example 1 with TileEntityChopper

use of se.gory_moon.horsepower.tileentity.TileEntityChopper in project HorsePower by GoryMoon.

the class BlockHPChoppingBase method writeDataOntoItemstack.

private void writeDataOntoItemstack(@Nonnull ItemStack item, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, @Nonnull IBlockState state, boolean inventorySave) {
    // get block data from the block
    TileEntity te = world.getTileEntity(pos);
    if (te != null && (te instanceof TileEntityChopper || te instanceof TileEntityManualChopper)) {
        NBTTagCompound tag = item.hasTagCompound() ? item.getTagCompound() : new NBTTagCompound();
        // texture
        NBTTagCompound data = te.getTileData().getCompoundTag("textureBlock");
        if (!data.hasNoTags()) {
            tag.setTag("textureBlock", data);
        }
        if (!tag.hasNoTags()) {
            item.setTagCompound(tag);
        }
    }
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) TileEntityChopper(se.gory_moon.horsepower.tileentity.TileEntityChopper) NBTTagCompound(net.minecraft.nbt.NBTTagCompound) TileEntityManualChopper(se.gory_moon.horsepower.tileentity.TileEntityManualChopper)

Example 2 with TileEntityChopper

use of se.gory_moon.horsepower.tileentity.TileEntityChopper in project HorsePower by GoryMoon.

the class BlockChopper method addProbeInfo.

// The One Probe Integration
@Optional.Method(modid = "theoneprobe")
@Override
public void addProbeInfo(ProbeMode mode, IProbeInfo probeInfo, EntityPlayer player, World world, IBlockState blockState, IProbeHitData data) {
    TileEntityChopper tileEntity = getTileEntity(world, data.getPos());
    if (tileEntity != null) {
        double totalWindup = Configs.general.pointsForWindup > 0 ? Configs.general.pointsForWindup : 1;
        probeInfo.progress((long) ((((double) tileEntity.getField(2)) / totalWindup) * 100L), 100L, new ProgressStyle().prefix(Localization.TOP.WINDUP_PROGRESS.translate() + " ").suffix("%"));
        if (tileEntity.getField(0) > 1)
            probeInfo.progress((long) ((((double) tileEntity.getField(1)) / ((double) tileEntity.getField(0))) * 100L), 100L, new ProgressStyle().prefix(Localization.TOP.CHOPPING_PROGRESS.translate() + " ").suffix("%"));
    }
}
Also used : ProgressStyle(mcjty.theoneprobe.apiimpl.styles.ProgressStyle) TileEntityChopper(se.gory_moon.horsepower.tileentity.TileEntityChopper)

Aggregations

TileEntityChopper (se.gory_moon.horsepower.tileentity.TileEntityChopper)2 ProgressStyle (mcjty.theoneprobe.apiimpl.styles.ProgressStyle)1 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)1 TileEntity (net.minecraft.tileentity.TileEntity)1 TileEntityManualChopper (se.gory_moon.horsepower.tileentity.TileEntityManualChopper)1