mirror of
https://github.com/GTNewHorizons/EnderIO.git
synced 2026-11-24 22:14:42 +00:00
Merge remote-tracking branch 'origin/master' into endercore
Conflicts: src/main/java/crazypants/enderio/gui/TooltipAddera.java
This commit is contained in:
commit
4f10d69c1c
16 files changed
+73
-39
No files matched your search
@@ -313,6 +313,11 @@ public final class Config {
|
||||
public static String[] magnetBlacklist = new String[] { "appliedenergistics2:item.ItemCrystalSeed", "Botania:livingrock",
|
||||
"Botania:manaTablet" };
|
||||
|
||||
public static boolean magnetAllowInMainInventory = false;
|
||||
public static boolean magnetAllowInBaublesSlot = true;
|
||||
public static boolean magnetAllowDeactivatedInBaublesSlot = false;
|
||||
public static String magnetBaublesType = "AMULET";
|
||||
|
||||
public static boolean useCombustionGenModel = false;
|
||||
|
||||
public static int crafterRfPerCraft = 2500;
|
||||
@@ -1048,6 +1053,17 @@ public final class Config {
|
||||
magnetBlacklist = config.getStringList("magnetBlacklist", sectionMagnet.name, magnetBlacklist,
|
||||
"These items will not be picked up by the magnet.");
|
||||
|
||||
magnetAllowInMainInventory = config.get(sectionMagnet.name, "magnetAllowInMainInventory", magnetAllowInMainInventory,
|
||||
"If true the magnet will also work in the main inventory, not just the hotbar").getBoolean(magnetAllowInMainInventory);
|
||||
|
||||
magnetAllowInBaublesSlot = config.get(sectionMagnet.name, "magnetAllowInBaublesSlot", magnetAllowInBaublesSlot,
|
||||
"If true the magnet can be put into the 'amulet' Baubles slot (requires Baubles to be installed)").getBoolean(magnetAllowInBaublesSlot);
|
||||
magnetAllowDeactivatedInBaublesSlot = config.get(sectionMagnet.name, "magnetAllowDeactivatedInBaublesSlot", magnetAllowDeactivatedInBaublesSlot,
|
||||
"If true the magnet can be put into the 'amulet' Baubles slot even if switched off (requires Baubles to be installed and magnetAllowInBaublesSlot to be on)").getBoolean(magnetAllowDeactivatedInBaublesSlot);
|
||||
|
||||
magnetBaublesType = config.get(sectionMagnet.name, "magnetBaublesType", magnetBaublesType,
|
||||
"The BaulesType the magnet should be, 'AMULET', 'RING' or 'BELT' (requires Baubles to be installed and magnetAllowInBaublesSlot to be on)").getString();
|
||||
|
||||
useCombustionGenModel = config.get(sectionAesthetic.name, "useCombustionGenModel", useCombustionGenModel,
|
||||
"If set to true: WIP Combustion Generator model will be used").getBoolean(useCombustionGenModel);
|
||||
|
||||
|
||||
@@ -175,9 +175,15 @@ public class ItemMagnet extends ItemEnergyContainer implements IResourceTooltipP
|
||||
}
|
||||
|
||||
@Override
|
||||
@Method(modid = "Baubles")
|
||||
@Method(modid = "Baubles|API")
|
||||
public BaubleType getBaubleType(ItemStack itemstack) {
|
||||
return baubles.api.BaubleType.AMULET;
|
||||
BaubleType t = null;
|
||||
try {
|
||||
t = BaubleType.valueOf(Config.magnetBaublesType);
|
||||
} catch (Exception e) {
|
||||
//NOP
|
||||
}
|
||||
return t != null ? t : BaubleType.AMULET;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -208,7 +214,7 @@ public class ItemMagnet extends ItemEnergyContainer implements IResourceTooltipP
|
||||
|
||||
@Override
|
||||
public boolean canEquip(ItemStack itemstack, EntityLivingBase player) {
|
||||
return isActive(itemstack);
|
||||
return Config.magnetAllowInBaublesSlot && (Config.magnetAllowDeactivatedInBaublesSlot || isActive(itemstack));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -113,7 +113,8 @@ public class KeyTracker {
|
||||
for (int i = 0; i < baubles.getSizeInventory(); i++) {
|
||||
ItemStack stack = baubles.getStackInSlot(i);
|
||||
if(stack != null && stack.getItem() != null && stack.getItem() == itemMagnet) {
|
||||
PacketHandler.INSTANCE.sendToServer(new PacketMagnetState(SlotType.BAUBLES, i, false));
|
||||
boolean isActive = !ItemMagnet.isActive(inv[i]);
|
||||
PacketHandler.INSTANCE.sendToServer(new PacketMagnetState(SlotType.BAUBLES, i, isActive));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,7 +47,8 @@ public class MagnetController implements IEntitySelector {
|
||||
|
||||
private ActiveMagnet getActiveMagnet(EntityPlayer player) {
|
||||
ItemStack[] inv = player.inventory.mainInventory;
|
||||
for(int i=0;i<9;i++) {
|
||||
int maxSlot = Config.magnetAllowInMainInventory ? 4 * 9 : 9;
|
||||
for (int i = 0; i < maxSlot;i++) {
|
||||
if(ItemMagnet.isActive(inv[i]) && ItemMagnet.hasPower(inv[i])) {
|
||||
return new ActiveMagnet(inv[i], i);
|
||||
}
|
||||
@@ -150,7 +151,7 @@ public class MagnetController implements IEntitySelector {
|
||||
if (stack == null || stack.getItem() == null || stack.getItem() != itemMagnet || ItemMagnet.isActive(stack) == isActive) {
|
||||
return;
|
||||
}
|
||||
if (type == SlotType.BAUBLES) {
|
||||
if (!Config.magnetAllowDeactivatedInBaublesSlot && type == SlotType.BAUBLES && !isActive) {
|
||||
ItemStack[] inv = player.inventory.mainInventory;
|
||||
for (int i = 0; i < inv.length && dropOff < 0; i++) {
|
||||
if (inv[i] == null) {
|
||||
@@ -170,8 +171,12 @@ public class MagnetController implements IEntitySelector {
|
||||
case ARMOR:
|
||||
return;
|
||||
case BAUBLES:
|
||||
baubles.setInventorySlotContents(slot, null);
|
||||
player.inventory.setInventorySlotContents(dropOff, stack);
|
||||
if (dropOff < 0) {
|
||||
player.inventory.setInventorySlotContents(slot, stack);
|
||||
} else {
|
||||
baubles.setInventorySlotContents(slot, null);
|
||||
player.inventory.setInventorySlotContents(dropOff, stack);
|
||||
}
|
||||
player.inventory.markDirty();
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -160,39 +160,47 @@ public abstract class AbstractMachineContainer extends Container {
|
||||
return new SlotRange(startHotBarSlot, endHotBarSlot, false);
|
||||
}
|
||||
|
||||
protected void addInventorySlotRange(List<SlotRange> res, int start, int end) {
|
||||
for (int i = start; i < end; i++) {
|
||||
int slotNumber = getSlotFromInventory(tileEntity, i).slotNumber;
|
||||
res.add(new SlotRange(slotNumber, slotNumber + 1, false));
|
||||
}
|
||||
}
|
||||
|
||||
protected void addInputSlotRanges(List<SlotRange> res) {
|
||||
SlotDefinition slotDef = tileEntity.getSlotDefinition();
|
||||
if(slotDef.getNumInputSlots() > 0) {
|
||||
res.add(new SlotRange(slotDef.getMinInputSlot(), slotDef.getMaxInputSlot() + 1, false));
|
||||
addInventorySlotRange(res, slotDef.getMinInputSlot(), slotDef.getMaxInputSlot() + 1);
|
||||
}
|
||||
}
|
||||
|
||||
protected void addUpgradeSlotRanges(List<SlotRange> res) {
|
||||
SlotDefinition slotDef = tileEntity.getSlotDefinition();
|
||||
if(slotDef.getNumUpgradeSlots() > 0) {
|
||||
res.add(new SlotRange(slotDef.getMinUpgradeSlot(), slotDef.getMaxUpgradeSlot() + 1, false));
|
||||
addInventorySlotRange(res, slotDef.getMinUpgradeSlot(), slotDef.getMaxUpgradeSlot() + 1);
|
||||
}
|
||||
}
|
||||
|
||||
protected void addPlayerSlotRanges(List<SlotRange> res, int slotIndex) {
|
||||
if(slotIndex <= endPlayerSlot) {
|
||||
if (slotIndex < endPlayerSlot) {
|
||||
res.add(getPlayerHotbarSlotRange());
|
||||
}
|
||||
if(slotIndex >= startHotBarSlot && slotIndex <= endHotBarSlot) {
|
||||
if (slotIndex >= startHotBarSlot && slotIndex < endHotBarSlot) {
|
||||
res.add(getPlayerInventoryWithoutHotbarSlotRange());
|
||||
}
|
||||
}
|
||||
|
||||
protected List<SlotRange> getTargetSlotsForTransfer(int slotIndex, Slot slot) {
|
||||
SlotDefinition slotDef = tileEntity.getSlotDefinition();
|
||||
if(slotDef.isInputSlot(slotIndex) || slotDef.isUpgradeSlot(slotIndex)) {
|
||||
return Collections.singletonList(getPlayerInventorySlotRange(false));
|
||||
}
|
||||
if(slotDef.isOutputSlot(slotIndex)) {
|
||||
return Collections.singletonList(getPlayerInventorySlotRange(true));
|
||||
}
|
||||
if(slotIndex >= startPlayerSlot) {
|
||||
ArrayList<SlotRange> res = new ArrayList<SlotRange>();
|
||||
if (slot.inventory == tileEntity) {
|
||||
SlotDefinition slotDef = tileEntity.getSlotDefinition();
|
||||
if (slotDef.isInputSlot(slot.slotNumber) || slotDef.isUpgradeSlot(slot.slotNumber)) {
|
||||
return Collections.singletonList(getPlayerInventorySlotRange(false));
|
||||
}
|
||||
if (slotDef.isOutputSlot(slot.slotNumber)) {
|
||||
return Collections.singletonList(getPlayerInventorySlotRange(true));
|
||||
}
|
||||
} else if (slotIndex >= startPlayerSlot) {
|
||||
List<SlotRange> res = new ArrayList<SlotRange>();
|
||||
addInputSlotRanges(res);
|
||||
addUpgradeSlotRanges(res);
|
||||
addPlayerSlotRanges(res, slotIndex);
|
||||
@@ -223,10 +231,10 @@ public abstract class AbstractMachineContainer extends Container {
|
||||
slot = (Slot) this.inventorySlots.get(checkIndex);
|
||||
itemstack1 = slot.getStack();
|
||||
|
||||
if(itemstack1 != null && itemstack1.getItem() == par1ItemStack.getItem()
|
||||
if (itemstack1 != null && itemstack1.getItem() == par1ItemStack.getItem()
|
||||
&& (!par1ItemStack.getHasSubtypes() || par1ItemStack.getItemDamage() == itemstack1.getItemDamage())
|
||||
&& ItemStack.areItemStackTagsEqual(par1ItemStack, itemstack1)
|
||||
&& slot.isItemValid(par1ItemStack)) {
|
||||
&& ItemStack.areItemStackTagsEqual(par1ItemStack, itemstack1) && slot.isItemValid(par1ItemStack)
|
||||
&& par1ItemStack != itemstack1) {
|
||||
|
||||
int mergedSize = itemstack1.stackSize + par1ItemStack.stackSize;
|
||||
int maxStackSize = Math.min(par1ItemStack.getMaxStackSize(), slot.getSlotStackLimit());
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package crazypants.enderio.nei;
|
||||
|
||||
import java.awt.Rectangle;
|
||||
import java.text.MessageFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
@@ -126,11 +127,7 @@ public class SagMillRecipeHandler extends TemplateRecipeHandler {
|
||||
float chance = recipe.getChanceForOutput(stack);
|
||||
if(chance > 0 && chance < 1) {
|
||||
int chanceInt = (int) (chance * 100);
|
||||
if(chanceInt == 0) {
|
||||
currenttip.add(EnumChatFormatting.GRAY + "Chance: <1%");
|
||||
} else {
|
||||
currenttip.add(EnumChatFormatting.GRAY + "Chance: " + chanceInt + "%");
|
||||
}
|
||||
currenttip.add(EnumChatFormatting.GRAY + MessageFormat.format(StatCollector.translateToLocal("enderio.nei.sagmill.outputchance"), chanceInt));
|
||||
}
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user