Search in sources :

Example 1 with DimletKey

use of mcjty.rftools.items.dimlets.DimletKey in project RFTools by McJty.

the class GuiDimletWorkbench method extractDimlet.

private void extractDimlet() {
    Slot slot = inventorySlots.getSlot(DimletWorkbenchContainer.SLOT_INPUT);
    if (slot.getStack() != null) {
        ItemStack itemStack = slot.getStack();
        if (DimletSetup.knownDimlet.equals(itemStack.getItem())) {
            DimletKey key = KnownDimletConfiguration.getDimletKey(itemStack, Minecraft.getMinecraft().theWorld);
            if (!KnownDimletConfiguration.craftableDimlets.contains(key)) {
                Achievements.trigger(Minecraft.getMinecraft().thePlayer, Achievements.smallBits);
                sendServerCommand(RFToolsMessages.INSTANCE, DimletWorkbenchTileEntity.CMD_STARTEXTRACT);
            }
        }
    }
}
Also used : Slot(net.minecraft.inventory.Slot) ItemStack(net.minecraft.item.ItemStack) DimletKey(mcjty.rftools.items.dimlets.DimletKey)

Example 2 with DimletKey

use of mcjty.rftools.items.dimlets.DimletKey in project RFTools by McJty.

the class GuiDimletWorkbench method enableButtons.

private void enableButtons() {
    boolean enabled = false;
    Slot slot = inventorySlots.getSlot(DimletWorkbenchContainer.SLOT_INPUT);
    if (slot.getStack() != null) {
        ItemStack itemStack = slot.getStack();
        if (DimletSetup.knownDimlet.equals(itemStack.getItem())) {
            DimletKey key = KnownDimletConfiguration.getDimletKey(itemStack, Minecraft.getMinecraft().theWorld);
            if (!KnownDimletConfiguration.craftableDimlets.contains(key)) {
                enabled = true;
            }
        }
    }
    extractButton.setEnabled(enabled);
}
Also used : Slot(net.minecraft.inventory.Slot) ItemStack(net.minecraft.item.ItemStack) DimletKey(mcjty.rftools.items.dimlets.DimletKey)

Example 3 with DimletKey

use of mcjty.rftools.items.dimlets.DimletKey in project RFTools by McJty.

the class TimeAbsorberTileEntity method registerTime.

private void registerTime() {
    if (worldObj.canBlockSeeTheSky(xCoord, yCoord, zCoord)) {
        float a = worldObj.getCelestialAngle(1.0f);
        DimletKey bestDimlet = findBestTimeDimlet(a);
        float besta = DimletObjectMapping.idToCelestialAngle.get(bestDimlet);
        if (angle < -0.001f) {
            angle = besta;
            absorbing = DimletConstructionConfiguration.maxTimeAbsorbtion - 1;
        } else if (Math.abs(besta - angle) < 0.1f) {
            absorbing--;
            if (absorbing < 0) {
                absorbing = 0;
            }
            registerTimeout = 3000;
        } else {
            absorbing++;
            if (absorbing >= DimletConstructionConfiguration.maxTimeAbsorbtion) {
                absorbing = DimletConstructionConfiguration.maxTimeAbsorbtion - 1;
            }
        }
    }
}
Also used : DimletKey(mcjty.rftools.items.dimlets.DimletKey)

Example 4 with DimletKey

use of mcjty.rftools.items.dimlets.DimletKey in project RFTools by McJty.

the class TimeAbsorberBlock method addInformation.

@SideOnly(Side.CLIENT)
@Override
public void addInformation(ItemStack itemStack, EntityPlayer player, List list, boolean 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.idToDisplayName.get(key);
            if (name == null) {
                name = "<unknown>";
            }
            list.add(EnumChatFormatting.GREEN + "Dimlet: " + name + " (" + angle + ")");
            int absorbing = tagCompound.getInteger("absorbing");
            int pct = ((DimletConstructionConfiguration.maxTimeAbsorbtion - absorbing) * 100) / DimletConstructionConfiguration.maxTimeAbsorbtion;
            list.add(EnumChatFormatting.GREEN + "Absorbed: " + pct + "%");
            int timeout = tagCompound.getInteger("registerTimeout");
            list.add(EnumChatFormatting.GREEN + "Timeout: " + timeout);
        }
    }
    if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT)) {
        list.add(EnumChatFormatting.WHITE + "Place this block outside and give it a redstone");
        list.add(EnumChatFormatting.WHITE + "signal around the time that you want to absorb.");
        list.add(EnumChatFormatting.WHITE + "You can use the end result in the Dimlet Workbench.");
    } else {
        list.add(EnumChatFormatting.WHITE + RFTools.SHIFT_MESSAGE);
    }
}
Also used : NBTTagCompound(net.minecraft.nbt.NBTTagCompound) DimletKey(mcjty.rftools.items.dimlets.DimletKey) SideOnly(cpw.mods.fml.relauncher.SideOnly)

Example 5 with DimletKey

use of mcjty.rftools.items.dimlets.DimletKey in project RFTools by McJty.

the class TimeAbsorberBlock method getWailaBody.

@SideOnly(Side.CLIENT)
@Override
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
    super.getWailaBody(itemStack, currenttip, accessor, config);
    TileEntity te = accessor.getTileEntity();
    if (te instanceof TimeAbsorberTileEntity) {
        TimeAbsorberTileEntity timeAbsorberTileEntity = (TimeAbsorberTileEntity) te;
        float angle = timeAbsorberTileEntity.getAngle();
        if (angle >= -0.01f) {
            DimletKey key = TimeAbsorberTileEntity.findBestTimeDimlet(angle);
            String name = KnownDimletConfiguration.idToDisplayName.get(key);
            if (name == null) {
                name = "<unknown>";
            }
            int absorbing = timeAbsorberTileEntity.getAbsorbing();
            int pct = ((DimletConstructionConfiguration.maxTimeAbsorbtion - absorbing) * 100) / DimletConstructionConfiguration.maxTimeAbsorbtion;
            currenttip.add(EnumChatFormatting.GREEN + "Dimlet: " + name + " (" + angle + ", " + pct + "%)");
        } else {
            currenttip.add(EnumChatFormatting.GREEN + "Give this block a redstone signal");
            currenttip.add(EnumChatFormatting.GREEN + "at the right time you want to absorb");
        }
    }
    return currenttip;
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) DimletKey(mcjty.rftools.items.dimlets.DimletKey) SideOnly(cpw.mods.fml.relauncher.SideOnly)

Aggregations

DimletKey (mcjty.rftools.items.dimlets.DimletKey)37 ItemStack (net.minecraft.item.ItemStack)9 List (java.util.List)7 ArrayList (java.util.ArrayList)6 DimletEntry (mcjty.rftools.items.dimlets.DimletEntry)5 Block (net.minecraft.block.Block)4 BlockMeta (mcjty.lib.varia.BlockMeta)3 TerrainType (mcjty.rftools.dimension.world.types.TerrainType)3 Slot (net.minecraft.inventory.Slot)3 SideOnly (cpw.mods.fml.relauncher.SideOnly)2 Map (java.util.Map)2 MobDescriptor (mcjty.rftools.dimension.description.MobDescriptor)2 ControllerType (mcjty.rftools.dimension.world.types.ControllerType)2 FeatureType (mcjty.rftools.dimension.world.types.FeatureType)2 DimletType (mcjty.rftools.items.dimlets.DimletType)2 MerchantRecipe (net.minecraft.village.MerchantRecipe)2 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 Counter (mcjty.lib.varia.Counter)1