1.19.2 and code cleanup

This commit is contained in:
Ell 2022-09-03 12:16:57 +02:00
parent e6f5b3b1c6
commit da479145f4
5 changed files with 14 additions and 19 deletions

View file

@ -105,11 +105,11 @@ configurations {
}
dependencies {
minecraft 'net.minecraftforge:forge:1.19-41.1.0'
minecraft 'net.minecraftforge:forge:1.19.2-43.1.1'
embed 'org.jgrapht:jgrapht-core:1.5.1'
compileOnly fg.deobf("mezz.jei:jei-1.19-common-api:11.1.1.239")
runtimeOnly fg.deobf("mezz.jei:jei-1.19-forge:11.1.1.239")
compileOnly fg.deobf("mezz.jei:jei-1.19.2-common-api:11.3.0.260")
runtimeOnly fg.deobf("mezz.jei:jei-1.19.2-forge:11.3.0.260")
// to test the rf requiring and crafting stuff
/* runtimeOnly fg.deobf("curse.maven:powah-352656:3057732")

View file

@ -7,15 +7,10 @@ public enum ModuleTier {
HIGH;
public final <T> T forTier(T low, T medium, T high) {
switch (this) {
case LOW:
return low;
case MEDIUM:
return medium;
case HIGH:
return high;
default:
throw new RuntimeException();
}
return switch (this) {
case LOW -> low;
case MEDIUM -> medium;
case HIGH -> high;
};
}
}

View file

@ -34,7 +34,7 @@ import net.minecraft.world.phys.shapes.BooleanOp;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.Shapes;
import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraftforge.items.CapabilityItemHandler;
import net.minecraftforge.common.capabilities.ForgeCapabilities;
import net.minecraftforge.items.ItemHandlerHelper;
import net.minecraftforge.network.NetworkHooks;
import org.apache.commons.lang3.mutable.MutableObject;
@ -207,7 +207,7 @@ public class PipeBlock extends BaseEntityBlock {
var connectable = tile.getCapability(Registry.pipeConnectableCapability, opposite).orElse(null);
if (connectable != null)
return connectable.getConnectionType(pos, direction);
var handler = tile.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, opposite).orElse(null);
var handler = tile.getCapability(ForgeCapabilities.ITEM_HANDLER, opposite).orElse(null);
if (handler != null)
return ConnectionType.CONNECTED;
}

View file

@ -35,9 +35,9 @@ import net.minecraft.world.phys.AABB;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.common.capabilities.ForgeCapabilities;
import net.minecraftforge.common.util.Lazy;
import net.minecraftforge.common.util.LazyOptional;
import net.minecraftforge.items.CapabilityItemHandler;
import net.minecraftforge.items.IItemHandler;
import net.minecraftforge.items.ItemHandlerHelper;
import net.minecraftforge.items.ItemStackHandler;
@ -291,7 +291,7 @@ public class PipeBlockEntity extends BlockEntity implements MenuProvider, IPipeC
}
public IItemHandler getItemHandler(Direction dir) {
var handler = this.getNeighborCap(dir, CapabilityItemHandler.ITEM_HANDLER_CAPABILITY);
var handler = this.getNeighborCap(dir, ForgeCapabilities.ITEM_HANDLER);
if (handler != null)
return handler;
return Utility.getBlockItemHandler(this.level, this.worldPosition.relative(dir), dir.getOpposite());

View file

@ -21,8 +21,8 @@ import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.common.capabilities.ForgeCapabilities;
import net.minecraftforge.common.util.LazyOptional;
import net.minecraftforge.energy.CapabilityEnergy;
import net.minecraftforge.energy.EnergyStorage;
import net.minecraftforge.energy.IEnergyStorage;
@ -96,7 +96,7 @@ public class PressurizerBlockEntity extends BlockEntity implements MenuProvider,
@Override
public <T> LazyOptional<T> getCapability(Capability<T> cap, Direction side) {
if (cap == CapabilityEnergy.ENERGY) {
if (cap == ForgeCapabilities.ENERGY) {
return this.lazyStorage.cast();
} else if (cap == Registry.pipeConnectableCapability) {
return this.lazyThis.cast();