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);
}
}
}
}
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);
}
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;
}
}
}
}
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);
}
}
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;
}
Aggregations