Search in sources :

Example 81 with SideOnly

use of net.minecraftforge.fml.relauncher.SideOnly in project RFToolsDimensions by McJty.

the class MaterialAbsorberBlock method getWailaBody.

@SideOnly(Side.CLIENT)
@Override
@Optional.Method(modid = "waila")
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
    super.getWailaBody(itemStack, currenttip, accessor, config);
    MaterialAbsorberTileEntity tileEntity = (MaterialAbsorberTileEntity) accessor.getTileEntity();
    if (tileEntity != null && tileEntity.getBlockState() != null) {
        Block block = tileEntity.getBlockState().getBlock();
        int meta = block.getMetaFromState(tileEntity.getBlockState());
        int absorbing = tileEntity.getAbsorbing();
        int pct = ((DimletConstructionConfiguration.maxBlockAbsorbtion - absorbing) * 100) / DimletConstructionConfiguration.maxBlockAbsorbtion;
        currenttip.add(TextFormatting.GREEN + "Block: " + new ItemStack(block, 1, meta).getDisplayName() + " (" + pct + "%)");
    }
    return currenttip;
}
Also used : Block(net.minecraft.block.Block) GenericRFToolsBlock(mcjty.rftoolsdim.blocks.GenericRFToolsBlock) ItemStack(net.minecraft.item.ItemStack) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 82 with SideOnly

use of net.minecraftforge.fml.relauncher.SideOnly in project RFToolsDimensions by McJty.

the class MaterialAbsorberBlock method addInformation.

@SideOnly(Side.CLIENT)
@Override
public void addInformation(ItemStack itemStack, World player, List<String> list, ITooltipFlag whatIsThis) {
    super.addInformation(itemStack, player, list, whatIsThis);
    NBTTagCompound tagCompound = itemStack.getTagCompound();
    if (tagCompound != null && tagCompound.hasKey("block")) {
        Block block = Block.REGISTRY.getObject(new ResourceLocation(tagCompound.getString("block")));
        if (block != null) {
            int meta = tagCompound.getInteger("meta");
            if (Item.getItemFromBlock(block) == null) {
                list.add(TextFormatting.RED + "Block: ERROR");
            } else {
                list.add(TextFormatting.GREEN + "Block: " + new ItemStack(block, 1, meta).getDisplayName());
            }
            int absorbing = tagCompound.getInteger("absorbing");
            int pct = ((DimletConstructionConfiguration.maxBlockAbsorbtion - absorbing) * 100) / DimletConstructionConfiguration.maxBlockAbsorbtion;
            list.add(TextFormatting.GREEN + "Absorbed: " + pct + "%");
        }
    }
    if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT)) {
        list.add(TextFormatting.WHITE + "Place this block on top of another block and it will");
        list.add(TextFormatting.WHITE + "gradually absorb all identical blocks in the area.");
        list.add(TextFormatting.WHITE + "You can use the end result in the Dimlet Workbench.");
    } else {
        list.add(TextFormatting.WHITE + RFToolsDim.SHIFT_MESSAGE);
    }
}
Also used : ResourceLocation(net.minecraft.util.ResourceLocation) NBTTagCompound(net.minecraft.nbt.NBTTagCompound) Block(net.minecraft.block.Block) GenericRFToolsBlock(mcjty.rftoolsdim.blocks.GenericRFToolsBlock) ItemStack(net.minecraft.item.ItemStack) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 83 with SideOnly

use of net.minecraftforge.fml.relauncher.SideOnly in project RFToolsDimensions by McJty.

the class TerrainAbsorberBlock method addInformation.

@SideOnly(Side.CLIENT)
@Override
public void addInformation(ItemStack itemStack, World player, List<String> list, ITooltipFlag whatIsThis) {
    super.addInformation(itemStack, player, list, whatIsThis);
    NBTTagCompound tagCompound = itemStack.getTagCompound();
    if (tagCompound != null && tagCompound.hasKey("terrain")) {
        String terrainName = tagCompound.getString("terrain");
        list.add(TextFormatting.GREEN + "Terrain: " + terrainName);
        int absorbing = tagCompound.getInteger("absorbing");
        int pct = ((DimletConstructionConfiguration.maxTerrainAbsorbtion - absorbing) * 100) / DimletConstructionConfiguration.maxTerrainAbsorbtion;
        list.add(TextFormatting.GREEN + "Absorbed: " + pct + "%");
    }
    if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT)) {
        list.add(TextFormatting.WHITE + "Place this block in an area and it will");
        list.add(TextFormatting.WHITE + "gradually absorb the essence of the terrain it is in.");
        list.add(TextFormatting.WHITE + "You can use the end result in the Dimlet Workbench.");
    } else {
        list.add(TextFormatting.WHITE + RFToolsDim.SHIFT_MESSAGE);
    }
}
Also used : NBTTagCompound(net.minecraft.nbt.NBTTagCompound) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 84 with SideOnly

use of net.minecraftforge.fml.relauncher.SideOnly in project RFToolsDimensions by McJty.

the class TimeAbsorberBlock method addInformation.

@SideOnly(Side.CLIENT)
@Override
public void addInformation(ItemStack itemStack, World player, List<String> list, ITooltipFlag whatIsThis) {
    super.addInformation(itemStack, player, list, whatIsThis);
    NBTTagCompound tagCompound = itemStack.getTagCompound();
    if (tagCompound != null) {
        if (tagCompound.hasKey("angle") && tagCompound.getFloat("angle") > -0.001f) {
            float angle = tagCompound.getFloat("angle");
            DimletKey key = TimeAbsorberTileEntity.findBestTimeDimlet(angle);
            String name = KnownDimletConfiguration.getDisplayName(key);
            if (name == null) {
                name = "<unknown>";
            }
            list.add(TextFormatting.GREEN + "Dimlet: " + name + " (" + angle + ")");
            int absorbing = tagCompound.getInteger("absorbing");
            int pct = ((DimletConstructionConfiguration.maxTimeAbsorbtion - absorbing) * 100) / DimletConstructionConfiguration.maxTimeAbsorbtion;
            list.add(TextFormatting.GREEN + "Absorbed: " + pct + "%");
            int timeout = tagCompound.getInteger("registerTimeout");
            list.add(TextFormatting.GREEN + "Timeout: " + timeout);
        }
    }
    if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT)) {
        list.add(TextFormatting.WHITE + "Place this block outside and give it a redstone");
        list.add(TextFormatting.WHITE + "signal around the time that you want to absorb.");
        list.add(TextFormatting.WHITE + "You can use the end result in the Dimlet Workbench.");
    } else {
        list.add(TextFormatting.WHITE + RFToolsDim.SHIFT_MESSAGE);
    }
}
Also used : NBTTagCompound(net.minecraft.nbt.NBTTagCompound) DimletKey(mcjty.rftoolsdim.dimensions.dimlets.DimletKey) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 85 with SideOnly

use of net.minecraftforge.fml.relauncher.SideOnly in project RFToolsDimensions by McJty.

the class RfToolsDimensionManager method syncFromServer.

@SideOnly(Side.CLIENT)
public void syncFromServer(Map<Integer, DimensionDescriptor> dims, Map<Integer, DimensionInformation> dimInfo) {
    for (Map.Entry<Integer, DimensionDescriptor> entry : dims.entrySet()) {
        int id = entry.getKey();
        DimensionDescriptor descriptor = entry.getValue();
        if (dimensions.containsKey(id)) {
            dimensionToID.remove(dimensions.get(id));
        }
        dimensions.put(id, descriptor);
        dimensionToID.put(descriptor, id);
    }
    WorldClient world = Minecraft.getMinecraft().world;
    GenericWorldProvider provider = (world != null && world.provider instanceof GenericWorldProvider) ? (GenericWorldProvider) world.provider : null;
    for (Map.Entry<Integer, DimensionInformation> entry : dimInfo.entrySet()) {
        int id = entry.getKey();
        DimensionInformation info = entry.getValue();
        dimensionInformation.put(id, info);
        if (provider != null && provider.getDimension() == id) {
            provider.setDimensionInformation(info);
        }
    }
}
Also used : DimensionDescriptor(mcjty.rftoolsdim.dimensions.description.DimensionDescriptor) ClassInheritanceMultiMap(net.minecraft.util.ClassInheritanceMultiMap) WorldClient(net.minecraft.client.multiplayer.WorldClient) GenericWorldProvider(mcjty.rftoolsdim.dimensions.world.GenericWorldProvider) 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