Compare commits

..
4 Commits
Author SHA1 Message Date
danyadev 9549d9385c optimize recipe checking on mc loading (#263) 2026-09-07 16:18:00 +02:00
Martin Robertz d44c6bb7c7 update deps 2026-09-05 10:11:02 +02:00
Eldrinn ElanteyandCaedis a4a40ee726 Fix night vision deactivating after dimension change via portal (#262)
Co-authored-by: Caedis <[email protected]>
2026-09-04 18:41:45 -05:00
Caedis caec163702 Revert #231 (#261) 2026-09-04 14:09:25 +00:00
6 changed files with 71 additions and 87 deletions

No files matched your search

+8 -8
View File
@@ -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() {}
@@ -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;
}
}
@@ -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;
}
}