mirror of
https://github.com/GTNewHorizons/EnderIO.git
synced 2026-11-15 09:34:50 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a8197e0026 | ||
|
|
9549d9385c | ||
|
|
d44c6bb7c7 | ||
|
|
a4a40ee726 | ||
|
|
caec163702 |
No files matched your search
+8
-8
@@ -1,14 +1,14 @@
|
||||
// Add your dependencies here
|
||||
|
||||
dependencies {
|
||||
api('com.github.GTNewHorizons:EnderCore:0.5.14:dev') {transitive = false}
|
||||
api('com.github.GTNewHorizons:EnderCore:0.5.15:dev') {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:ForestryMC:4.11.37:dev')
|
||||
compileOnly('com.github.GTNewHorizons:NotEnoughItems:2.8.129-GTNH:dev')
|
||||
api("com.github.GTNewHorizons:GTNHLib:0.11.44:dev")
|
||||
compileOnly('com.github.GTNewHorizons:NotEnoughItems:2.8.130-GTNH:dev')
|
||||
api("com.github.GTNewHorizons:GTNHLib:0.11.45:dev")
|
||||
compileOnly('com.github.GTNewHorizons:BuildCraft:7.1.63:dev')
|
||||
api('curse.maven:cofh-lib-220333:2388748') // https://www.curseforge.com/minecraft/mc-mods/cofh-lib/files/2388748
|
||||
shadowImplementation('cglib:cglib-nodep:3.3.0')
|
||||
api("com.github.GTNewHorizons:TinkersConstruct:1.14.106-GTNH:dev")
|
||||
api("com.github.GTNewHorizons:TinkersConstruct:1.14.107-GTNH:dev")
|
||||
|
||||
devOnlyNonPublishable('com.github.GTNewHorizons:waila:1.19.34:dev') {transitive = false}
|
||||
compileOnly('ganymedes01.etfuturum:Et-Futurum-Requiem:2.6.48-GTNH:dev') {transitive = false}
|
||||
@@ -16,12 +16,12 @@ dependencies {
|
||||
compileOnly("com.github.GTNewHorizons:Backhand:1.8.14:dev") { transitive = false }
|
||||
compileOnly('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-999-GTNH:api') {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:Baubles-Expanded:2.2.22-GTNH:dev') {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:GT5-Unofficial:5.09.54.122:dev') {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:GT5-Unofficial:5.09.54.129:dev') {transitive = false}
|
||||
compileOnly("com.github.GTNewHorizons:ModularUI2:2.3.88-1.7.10:dev") {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:Railcraft:9.17.31:dev') {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:StorageDrawers:2.2.29-GTNH:api') {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:Chisel:2.17.32-GTNH:dev') {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:OpenComputers:1.12.59-GTNH:api') {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:OpenComputers:1.12.61-GTNH:api') {transitive = false}
|
||||
compileOnly('curse.maven:minefactory-reloaded-66672:2366150') // https://www.curseforge.com/minecraft/mc-mods/minefactory-reloaded/files/2366150
|
||||
compileOnly('thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev')
|
||||
compileOnly('curse.maven:ee3-65509:2305023') // https://www.curseforge.com/minecraft/mc-mods/ee3/files/2305023
|
||||
@@ -29,7 +29,7 @@ dependencies {
|
||||
compileOnly(rfg.deobf('curse.maven:mekanism-268560:2475797')) // https://www.curseforge.com/minecraft/mc-mods/mekanism/files/2475797
|
||||
compileOnly(rfg.deobf('maven.modrinth:immibis-microblocks:59.1.2')) // https://modrinth.com/mod/immibis-microblocks/version/59.1.2
|
||||
|
||||
compileOnlyApi('com.github.GTNewHorizons:Angelica:2.2.8:api') {transitive = false}
|
||||
compileOnly("com.github.GTNewHorizons:Hodgepodge:2.7.194:dev")
|
||||
compileOnlyApi('com.github.GTNewHorizons:Angelica:2.2.10:api') {transitive = false}
|
||||
compileOnly("com.github.GTNewHorizons:Hodgepodge:2.7.196:dev")
|
||||
compileOnly('curse.maven:automagy-222153:2285272')
|
||||
}
|
||||
@@ -337,32 +337,18 @@ public class KeyTracker {
|
||||
}
|
||||
|
||||
private void handleNightVision() {
|
||||
if (nightVisionKey.isPressed()) {
|
||||
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
|
||||
if (!DarkSteelController.instance.isNightVisionUpgradeOrEnchEquipped(player)) {
|
||||
return;
|
||||
}
|
||||
boolean isActive = !DarkSteelController.instance.isNightVisionActive();
|
||||
if (isActive) {
|
||||
player.worldObj.playSound(
|
||||
player.posX,
|
||||
player.posY,
|
||||
player.posZ,
|
||||
EnderIO.DOMAIN + ":ds.nightvision.on",
|
||||
0.1f,
|
||||
player.worldObj.rand.nextFloat() * 0.4f - 0.2f + 1.0f,
|
||||
false);
|
||||
} else {
|
||||
player.worldObj.playSound(
|
||||
player.posX,
|
||||
player.posY,
|
||||
player.posZ,
|
||||
EnderIO.DOMAIN + ":ds.nightvision.off",
|
||||
0.1f,
|
||||
1.0f,
|
||||
false);
|
||||
}
|
||||
DarkSteelController.instance.setNightVisionActive(isActive);
|
||||
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
|
||||
if (nightVisionKey.isPressed() && DarkSteelController.instance.isNightVisionUpgradeOrEnchEquipped(player)) {
|
||||
boolean turningOn = !DarkSteelController.instance.isActive(player, Type.NIGHT_VISION);
|
||||
player.worldObj.playSound(
|
||||
player.posX,
|
||||
player.posY,
|
||||
player.posZ,
|
||||
EnderIO.DOMAIN + (turningOn ? ":ds.nightvision.on" : ":ds.nightvision.off"),
|
||||
0.1f,
|
||||
turningOn ? player.worldObj.rand.nextFloat() * 0.4f - 0.2f + 1.0f : 1.0f,
|
||||
false);
|
||||
toggleDarkSteelController(Type.NIGHT_VISION, "darksteel.upgrade.nightVision");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -107,9 +107,6 @@ public class DarkSteelController {
|
||||
|
||||
private final Map<UUID, EnumSet<Type>> allActive = new HashMap<>();
|
||||
|
||||
private boolean nightVisionActive = false;
|
||||
private boolean removeNightvision = false;
|
||||
|
||||
private DarkSteelController() {
|
||||
PacketHandler.INSTANCE.registerMessage(
|
||||
PacketDarkSteelPowerPacket.class,
|
||||
@@ -196,6 +193,8 @@ public class DarkSteelController {
|
||||
updateSwim(player);
|
||||
|
||||
updateSolar(player);
|
||||
|
||||
updateNightvision(player);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -447,7 +446,6 @@ public class DarkSteelController {
|
||||
if (player == null) {
|
||||
return;
|
||||
}
|
||||
updateNightvision(player);
|
||||
if (player.capabilities.isFlying) {
|
||||
return;
|
||||
}
|
||||
@@ -569,18 +567,20 @@ public class DarkSteelController {
|
||||
}
|
||||
|
||||
private void updateNightvision(EntityPlayer player) {
|
||||
if (isNightVisionUpgradeOrEnchEquipped(player) && nightVisionActive) {
|
||||
player.addPotionEffect(new PotionEffect(Potion.nightVision.getId(), 210, 0, true));
|
||||
} else if (!isNightVisionUpgradeOrEnchEquipped(player)
|
||||
&& player.getActivePotionEffect(Potion.nightVision) != null) {
|
||||
// Remove the effect when upgrade is not equipped (e.g. helmet removed), but do NOT
|
||||
// reset nightVisionActive — during dimension transitions the inventory is temporarily
|
||||
// empty, and resetting the flag would permanently disable night vision after portals.
|
||||
player.removePotionEffect(Potion.nightVision.getId());
|
||||
}
|
||||
if (removeNightvision) {
|
||||
if (player.worldObj.isRemote) {
|
||||
return;
|
||||
}
|
||||
PotionEffect effect = player.getActivePotionEffect(Potion.nightVision);
|
||||
boolean hasNVUpgrade = isNightVisionUpgradeOrEnchEquipped(player);
|
||||
boolean isNVUpgradeEnabled = isActive(player, Type.NIGHT_VISION);
|
||||
if (hasNVUpgrade && isNVUpgradeEnabled) {
|
||||
// only (re)apply effect if ours is missing or about to expire
|
||||
if (effect == null || (effect.getIsAmbient() && effect.getDuration() < 220)) {
|
||||
player.addPotionEffect(new PotionEffect(Potion.nightVision.getId(), 400, 0, true));
|
||||
}
|
||||
} else if (effect != null && effect.getIsAmbient() && (hasNVUpgrade || isNVUpgradeEnabled)) {
|
||||
// if our effect exists and the player removed the upgrade item or toggled it off (both can't be true here)
|
||||
player.removePotionEffect(Potion.nightVision.getId());
|
||||
removeNightvision = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -615,21 +615,9 @@ public class DarkSteelController {
|
||||
return false;
|
||||
}
|
||||
|
||||
// ---
|
||||
|
||||
public boolean isNightVisionUpgradeOrEnchEquipped(EntityPlayer player) {
|
||||
ItemStack helmet = player.getEquipmentInSlot(4);
|
||||
return (NightVisionUpgrade.loadFromItem(helmet) != null || isNightVisionEnch(helmet));
|
||||
}
|
||||
|
||||
public void setNightVisionActive(boolean isNightVisionActive) {
|
||||
if (nightVisionActive && !isNightVisionActive) {
|
||||
removeNightvision = true;
|
||||
}
|
||||
this.nightVisionActive = isNightVisionActive;
|
||||
}
|
||||
|
||||
public boolean isNightVisionActive() {
|
||||
return nightVisionActive;
|
||||
}
|
||||
}
|
||||
@@ -15,7 +15,8 @@ public class PacketUpgradeState implements IMessage, IMessageHandler<PacketUpgra
|
||||
GLIDE,
|
||||
SPEED,
|
||||
STEP_ASSIST,
|
||||
JUMP
|
||||
JUMP,
|
||||
NIGHT_VISION
|
||||
}
|
||||
|
||||
public PacketUpgradeState() {}
|
||||
|
||||
@@ -52,7 +52,7 @@ public abstract class AbstractPoweredTaskEntity extends AbstractPowerConsumerEnt
|
||||
|
||||
@Override
|
||||
public boolean isActive() {
|
||||
return currentTask == null ? false : currentTask.getProgress() >= 0 && hasPower() && redstoneCheckPassed;
|
||||
return currentTask != null && currentTask.getProgress() >= 0 && hasPower() && redstoneCheckPassed;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -224,7 +224,7 @@ public abstract class AbstractPoweredTaskEntity extends AbstractPowerConsumerEnt
|
||||
ItemStack copy = item.copy();
|
||||
// try to add it to existing stacks first
|
||||
for (ItemStack outStack : outputStacks) {
|
||||
if (outStack != null && copy != null) {
|
||||
if (outStack != null) {
|
||||
int num = getNumCanMerge(outStack, copy);
|
||||
outStack.stackSize += num;
|
||||
copy.stackSize -= num;
|
||||
@@ -322,7 +322,7 @@ public abstract class AbstractPoweredTaskEntity extends AbstractPowerConsumerEnt
|
||||
}
|
||||
|
||||
protected int getNumCanMerge(ItemStack itemStack, ItemStack result) {
|
||||
if (!itemStack.isItemEqual(result)) {
|
||||
if (!itemStack.isItemEqual(result) || !ItemStack.areItemStackTagsEqual(itemStack, result)) {
|
||||
return 0;
|
||||
}
|
||||
return Math.min(itemStack.getMaxStackSize() - itemStack.stackSize, result.stackSize);
|
||||
|
||||
@@ -152,8 +152,9 @@ public class CrusherRecipeManager {
|
||||
if (input == null) {
|
||||
return null;
|
||||
}
|
||||
MachineRecipeInput[] machineInputs = { new MachineRecipeInput(0, input) };
|
||||
for (Recipe recipe : recipes) {
|
||||
if (recipe.isInputForRecipe(new MachineRecipeInput(0, input))) {
|
||||
if (recipe.isInputForRecipe(machineInputs)) {
|
||||
return recipe;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,7 +15,9 @@ import crazypants.enderio.machine.SlotDefinition;
|
||||
|
||||
public class TileEntityPainter extends AbstractPoweredTaskEntity implements ISidedInventory {
|
||||
|
||||
// private static final short MAX_POWER_USE_PER_TICK = 6;
|
||||
private static final int SLOT_INPUT = 0;
|
||||
private static final int SLOT_PAINT_SOURCE = 1;
|
||||
private static final int SLOT_OUTPUT = 2;
|
||||
|
||||
public TileEntityPainter() {
|
||||
// 0 = input slot, 1 = paint source, 2 = output slot
|
||||
@@ -24,7 +26,8 @@ public class TileEntityPainter extends AbstractPoweredTaskEntity implements ISid
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int i, ItemStack itemstack, int j) {
|
||||
return super.canExtractItem(i, itemstack, j) && PainterUtil.isMetadataEquivelent(itemstack, inventory[2]);
|
||||
return super.canExtractItem(i, itemstack, j)
|
||||
&& PainterUtil.isMetadataEquivelent(itemstack, inventory[SLOT_OUTPUT]);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -32,49 +35,44 @@ public class TileEntityPainter extends AbstractPoweredTaskEntity implements ISid
|
||||
return "Auto Painter";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCustomInventoryName() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isMachineItemValidForSlot(int i, ItemStack itemStack) {
|
||||
if (i > 1) {
|
||||
return false;
|
||||
}
|
||||
if (i == 0) {
|
||||
if (i == SLOT_INPUT) {
|
||||
List<IMachineRecipe> recipes = MachineRecipeRegistry.instance
|
||||
.getRecipesForInput(getMachineName(), MachineRecipeInput.create(i, itemStack));
|
||||
if (inventory[1] == null) {
|
||||
if (inventory[SLOT_PAINT_SOURCE] == null) {
|
||||
return !recipes.isEmpty();
|
||||
} else {
|
||||
for (IMachineRecipe rec : recipes) {
|
||||
if (rec instanceof BasicPainterTemplate) {
|
||||
BasicPainterTemplate temp = (BasicPainterTemplate) rec;
|
||||
if (temp.isValidPaintSource(inventory[1])) {
|
||||
if (rec instanceof BasicPainterTemplate temp) {
|
||||
if (temp.isValidPaintSource(inventory[SLOT_PAINT_SOURCE])) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if (inventory[0] == null) {
|
||||
Map<String, IMachineRecipe> recipes = MachineRecipeRegistry.instance.getRecipesForMachine(getMachineName());
|
||||
for (IMachineRecipe rec : recipes.values()) {
|
||||
if (rec instanceof BasicPainterTemplate) {
|
||||
BasicPainterTemplate temp = (BasicPainterTemplate) rec;
|
||||
if (temp.isValidPaintSource(itemStack)) {
|
||||
return true;
|
||||
} else if (i == SLOT_PAINT_SOURCE) {
|
||||
if (inventory[SLOT_INPUT] == null) {
|
||||
Map<String, IMachineRecipe> recipes = MachineRecipeRegistry.instance
|
||||
.getRecipesForMachine(getMachineName());
|
||||
for (IMachineRecipe rec : recipes.values()) {
|
||||
if (rec instanceof BasicPainterTemplate temp) {
|
||||
if (temp.isValidPaintSource(itemStack)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return PaintSourceValidator.instance.isValidSourceDefault(itemStack);
|
||||
} else {
|
||||
return MachineRecipeRegistry.instance.getRecipeForInputs(
|
||||
getMachineName(),
|
||||
targetInput(),
|
||||
MachineRecipeInput.create(SLOT_PAINT_SOURCE, itemStack)) != null;
|
||||
}
|
||||
return PaintSourceValidator.instance.isValidSourceDefault(itemStack);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
return MachineRecipeRegistry.instance.getRecipeForInputs(
|
||||
getMachineName(),
|
||||
i == 0 ? MachineRecipeInput.create(0, itemStack) : targetInput(),
|
||||
i == 1 ? MachineRecipeInput.create(1, itemStack) : paintSource()) != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -83,27 +81,10 @@ public class TileEntityPainter extends AbstractPoweredTaskEntity implements ISid
|
||||
}
|
||||
|
||||
private MachineRecipeInput targetInput() {
|
||||
return MachineRecipeInput.create(0, inventory[0]);
|
||||
return MachineRecipeInput.create(SLOT_INPUT, inventory[SLOT_INPUT]);
|
||||
}
|
||||
|
||||
private MachineRecipeInput paintSource() {
|
||||
return MachineRecipeInput.create(1, inventory[1]);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getNumCanMerge(ItemStack itemStack, ItemStack result) {
|
||||
if (result == null || !result.isItemEqual(inventory[2])) {
|
||||
// next result is a different item type
|
||||
return 0;
|
||||
} else if (result.hasTagCompound() && inventory[2].hasTagCompound()) {
|
||||
if (inventory[2].getTagCompound().hasKey("Items")) return 0; // presence of internal items
|
||||
String cookedId = result.getTagCompound().getString(BlockPainter.KEY_SOURCE_BLOCK_ID);
|
||||
String invId = inventory[2].getTagCompound().getString(BlockPainter.KEY_SOURCE_BLOCK_ID);
|
||||
if (!cookedId.equals(invId)) {
|
||||
// next result has a different source item than the current one
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return Math.min(itemStack.getMaxStackSize() - itemStack.stackSize, result.stackSize);
|
||||
return MachineRecipeInput.create(SLOT_PAINT_SOURCE, inventory[SLOT_PAINT_SOURCE]);
|
||||
}
|
||||
}
|
||||
@@ -38,38 +38,46 @@ public class Recipe implements IRecipe {
|
||||
return false;
|
||||
}
|
||||
|
||||
List<RecipeInput> requiredInputs = new ArrayList<>();
|
||||
for (RecipeInput input : inputs) {
|
||||
if (input.getFluidInput() != null || input.getInput() != null) {
|
||||
requiredInputs.add(input.copy());
|
||||
int[] remaining = new int[inputs.length];
|
||||
for (int i = 0; i < inputs.length; i++) {
|
||||
RecipeInput input = inputs[i];
|
||||
if (input.isFluid()) {
|
||||
remaining[i] = input.getFluidInput().amount;
|
||||
} else if (input.getInput() != null) {
|
||||
remaining[i] = input.getInput().stackSize;
|
||||
}
|
||||
}
|
||||
|
||||
for (MachineRecipeInput input : machineInputs) {
|
||||
if (input != null && (input.fluid != null || input.item != null)) {
|
||||
RecipeInput required = null;
|
||||
for (int i = 0; i < requiredInputs.size() && required == null; i++) {
|
||||
RecipeInput tst = requiredInputs.get(i);
|
||||
if ((tst.isInput(input.item) && tst.getInput().stackSize > 0) || tst.isInput(input.fluid)) {
|
||||
required = tst;
|
||||
}
|
||||
for (MachineRecipeInput machineInput : machineInputs) {
|
||||
if (machineInput == null || (machineInput.item == null && machineInput.fluid == null)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
int matchedInput = -1;
|
||||
for (int i = 0; i < inputs.length; i++) {
|
||||
if (remaining[i] <= 0) {
|
||||
continue;
|
||||
}
|
||||
if (required == null) {
|
||||
return false;
|
||||
}
|
||||
// reduce the required input quantity by the available amount
|
||||
if (input.isFluid()) {
|
||||
required.getFluidInput().amount -= input.fluid.amount;
|
||||
} else {
|
||||
required.getInput().stackSize -= input.item.stackSize;
|
||||
|
||||
RecipeInput required = inputs[i];
|
||||
boolean matches = machineInput.isFluid() ? required.isInput(machineInput.fluid)
|
||||
: required.isInput(machineInput.item);
|
||||
|
||||
if (matches) {
|
||||
matchedInput = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (RecipeInput required : requiredInputs) {
|
||||
if (required.isFluid() && required.getFluidInput().amount > 0) {
|
||||
if (matchedInput < 0) {
|
||||
return false;
|
||||
} else if (!required.isFluid() && required.getInput().stackSize > 0) {
|
||||
}
|
||||
|
||||
remaining[matchedInput] -= machineInput.isFluid() ? machineInput.fluid.amount : machineInput.item.stackSize;
|
||||
}
|
||||
|
||||
for (int amount : remaining) {
|
||||
if (amount > 0) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user