Search in sources :

Example 96 with SideOnly

use of net.minecraftforge.fml.relauncher.SideOnly in project MorePlanets by SteveKunG.

the class BlockInfectedSponge method randomDisplayTick.

@Override
@SideOnly(Side.CLIENT)
public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random rand) {
    if (state.getValue(WET).booleanValue()) {
        EnumFacing enumfacing = EnumFacing.random(rand);
        if (enumfacing != EnumFacing.UP && !world.getBlockState(pos.offset(enumfacing)).isSideSolid(world, pos.offset(enumfacing), EnumFacing.UP)) {
            double d0 = pos.getX();
            double d1 = pos.getY();
            double d2 = pos.getZ();
            if (enumfacing == EnumFacing.DOWN) {
                d1 -= 0.05D;
                d0 += rand.nextDouble();
                d2 += rand.nextDouble();
            } else {
                d1 += rand.nextDouble() * 0.8D;
                if (enumfacing.getAxis() == EnumFacing.Axis.X) {
                    d2 += rand.nextDouble();
                    if (enumfacing == EnumFacing.EAST) {
                        ++d0;
                    } else {
                        d0 += 0.05D;
                    }
                } else {
                    d0 += rand.nextDouble();
                    if (enumfacing == EnumFacing.SOUTH) {
                        ++d2;
                    } else {
                        d2 += 0.05D;
                    }
                }
            }
            MorePlanetsCore.PROXY.spawnParticle(EnumParticleTypesMP.INFECTED_WATER_DRIP, d0, d1, d2);
        }
    }
}
Also used : EnumFacing(net.minecraft.util.EnumFacing) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 97 with SideOnly

use of net.minecraftforge.fml.relauncher.SideOnly in project MorePlanets by SteveKunG.

the class ItemElectricSwordMP method addInformation.

@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack itemStack, @Nullable World world, List<String> list, ITooltipFlag flag) {
    TextFormatting color = null;
    float joules = this.getElectricityStored(itemStack);
    if (joules <= this.getMaxElectricityStored(itemStack) / 3) {
        color = TextFormatting.DARK_RED;
    } else if (joules > this.getMaxElectricityStored(itemStack) * 2 / 3) {
        color = TextFormatting.DARK_GREEN;
    } else {
        color = TextFormatting.GOLD;
    }
    list.add(color + EnergyDisplayHelper.getEnergyDisplayS(joules) + "/" + EnergyDisplayHelper.getEnergyDisplayS(this.getMaxElectricityStored(itemStack)));
}
Also used : TextFormatting(net.minecraft.util.text.TextFormatting) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 98 with SideOnly

use of net.minecraftforge.fml.relauncher.SideOnly in project MorePlanets by SteveKunG.

the class ItemBlockDarkEnergyGenerator method addInformation.

@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack itemStack, @Nullable World world, List<String> list, ITooltipFlag flag) {
    if (this.getBlock() instanceof IBlockDescription) {
        if (CommonRegisterHelper.isShiftKeyDown()) {
            ((IBlockDescription) this.block).getDescription().addDescription(itemStack, list);
        } else {
            if (this.getBlock() instanceof BlockTileGC) {
                TileEntity te = ((BlockTileGC) this.getBlock()).createTileEntity(null, this.getBlock().getStateFromMeta(itemStack.getItemDamage() & 12));
                if (te instanceof TileBaseElectricBlock) {
                    float powerDrawn = ((TileBaseElectricBlock) te).storage.getMaxExtract();
                    if (powerDrawn > 0) {
                        list.add(TextFormatting.GREEN + GCCoreUtil.translateWithFormat("item_desc.powerdraw.name", EnergyDisplayHelper.getEnergyDisplayS(powerDrawn * 20)));
                    }
                }
                if (te instanceof TileBaseUniversalElectrical) {
                    if (itemStack.hasTagCompound() && itemStack.getTagCompound().hasKey("EnergyStored")) {
                        int power = (int) itemStack.getTagCompound().getFloat("EnergyStored");
                        list.add(TextFormatting.GREEN + GCCoreUtil.translateWithFormat("desc.energy_stored.name", EnergyDisplayHelper.getEnergyDisplayS(power)));
                    }
                }
                if (te instanceof TileEntityDarkEnergyGenerator) {
                    if (itemStack.hasTagCompound() && itemStack.getTagCompound().hasKey("DarkEnergyFuel")) {
                        int power = itemStack.getTagCompound().getInteger("DarkEnergyFuel");
                        power = power * 100 / 1000;
                        list.add(TextFormatting.GREEN + GCCoreUtil.translateWithFormat("desc.dark_energy_fuel.name", power) + "%");
                    }
                }
            } else if (this.getBlock() instanceof BlockAdvancedTile) {
                TileEntity te = ((BlockAdvancedTile) this.getBlock()).createTileEntity(world, this.getBlock().getStateFromMeta(itemStack.getItemDamage() & 12));
                if (te instanceof TileBaseElectricBlock) {
                    float powerDrawn = ((TileBaseElectricBlock) te).storage.getMaxExtract();
                    if (powerDrawn > 0) {
                        list.add(TextFormatting.GREEN + GCCoreUtil.translateWithFormat("item_desc.powerdraw.name", EnergyDisplayHelper.getEnergyDisplayS(powerDrawn * 20)));
                    }
                }
            }
            list.add(GCCoreUtil.translate("desc.shift_info.name"));
        }
    }
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) TileBaseElectricBlock(micdoodle8.mods.galacticraft.core.energy.tile.TileBaseElectricBlock) IBlockDescription(stevekung.mods.moreplanets.util.blocks.IBlockDescription) BlockTileGC(micdoodle8.mods.galacticraft.core.blocks.BlockTileGC) TileEntityDarkEnergyGenerator(stevekung.mods.moreplanets.module.planets.diona.tileentity.TileEntityDarkEnergyGenerator) BlockAdvancedTile(micdoodle8.mods.galacticraft.core.blocks.BlockAdvancedTile) TileBaseUniversalElectrical(micdoodle8.mods.galacticraft.core.energy.tile.TileBaseUniversalElectrical) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 99 with SideOnly

use of net.minecraftforge.fml.relauncher.SideOnly in project MorePlanets by SteveKunG.

the class ItemTier4Rocket method addDescription.

@Override
@SideOnly(Side.CLIENT)
protected void addDescription(ItemStack itemStack, List<String> list) {
    EntityTier4Rocket rocket = new EntityTier4Rocket(Minecraft.getMinecraft().world, 0, 0, 0, CachedEnumUtil.valuesRocketCached()[itemStack.getItemDamage()]);
    list.add(GCCoreUtil.translate("gui.message.fuel.name") + ": " + itemStack.getTagCompound().getInteger("RocketFuel") + " / " + rocket.fuelTank.getCapacity());
}
Also used : EntityTier4Rocket(stevekung.mods.moreplanets.module.planets.diona.entity.EntityTier4Rocket) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 100 with SideOnly

use of net.minecraftforge.fml.relauncher.SideOnly in project MorePlanets by SteveKunG.

the class ItemBlockSlabMP method canPlaceBlockOnSide.

@Override
@SideOnly(Side.CLIENT)
public boolean canPlaceBlockOnSide(World world, BlockPos pos, EnumFacing side, EntityPlayer player, ItemStack itemStack) {
    if (this.block instanceof ISlabBlock) {
        ISlabBlock singleSlab = (ISlabBlock) this.block;
        BlockPos blockpos1 = pos;
        IProperty<?> iproperty = singleSlab.getHalf().getVariantProperty();
        Comparable object = singleSlab.getHalf().getTypeForItem(itemStack);
        IBlockState state = world.getBlockState(pos);
        if (state.getBlock() == singleSlab.getHalf()) {
            boolean flag = state.getValue(BlockSlab.HALF) == BlockSlab.EnumBlockHalf.TOP;
            if ((side == EnumFacing.UP && !flag || side == EnumFacing.DOWN && flag) && object == state.getValue(iproperty)) {
                return true;
            }
        }
        pos = pos.offset(side);
        IBlockState state1 = world.getBlockState(pos);
        return state1.getBlock() == singleSlab.getHalf() && object == state1.getValue(iproperty) ? true : super.canPlaceBlockOnSide(world, blockpos1, side, player, itemStack);
    }
    return super.canPlaceBlockOnSide(world, pos, side, player, itemStack);
}
Also used : IBlockState(net.minecraft.block.state.IBlockState) ISlabBlock(stevekung.mods.moreplanets.util.blocks.ISlabBlock) BlockPos(net.minecraft.util.math.BlockPos) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Aggregations

SideOnly (net.minecraftforge.fml.relauncher.SideOnly)1328 ItemStack (net.minecraft.item.ItemStack)238 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)149 IBlockState (net.minecraft.block.state.IBlockState)140 ResourceLocation (net.minecraft.util.ResourceLocation)139 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)127 ModelResourceLocation (net.minecraft.client.renderer.block.model.ModelResourceLocation)126 BlockPos (net.minecraft.util.math.BlockPos)85 Block (net.minecraft.block.Block)82 TileEntity (net.minecraft.tileentity.TileEntity)80 EntityPlayer (net.minecraft.entity.player.EntityPlayer)72 Vec3d (net.minecraft.util.math.Vec3d)71 World (net.minecraft.world.World)69 EnumFacing (net.minecraft.util.EnumFacing)64 Minecraft (net.minecraft.client.Minecraft)62 ArrayList (java.util.ArrayList)50 TextureAtlasSprite (net.minecraft.client.renderer.texture.TextureAtlasSprite)42 Nonnull (javax.annotation.Nonnull)41 Entity (net.minecraft.entity.Entity)39 AxisAlignedBB (net.minecraft.util.math.AxisAlignedBB)39