mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
container fix for custom fluids, arc welder stuff
This commit is contained in:
parent
a40dbd882a
commit
81b6df6962
@ -62,18 +62,19 @@ public class FluidContainerRegistry {
|
|||||||
for(int i = 1; i < fluids.length; i++) {
|
for(int i = 1; i < fluids.length; i++) {
|
||||||
|
|
||||||
FluidType type = fluids[i];
|
FluidType type = fluids[i];
|
||||||
|
int id = type.getID();
|
||||||
|
|
||||||
if(type.getContainer(CD_Canister.class) != null) FluidContainerRegistry.registerContainer(new FluidContainer(new ItemStack(ModItems.canister_full, 1, i), new ItemStack(ModItems.canister_empty), Fluids.fromID(i), 1000));
|
if(type.getContainer(CD_Canister.class) != null) FluidContainerRegistry.registerContainer(new FluidContainer(new ItemStack(ModItems.canister_full, 1, id), new ItemStack(ModItems.canister_empty), type, 1000));
|
||||||
if(type.getContainer(CD_Gastank.class) != null) FluidContainerRegistry.registerContainer(new FluidContainer(new ItemStack(ModItems.gas_full, 1, i), new ItemStack(ModItems.gas_empty), Fluids.fromID(i), 1000));
|
if(type.getContainer(CD_Gastank.class) != null) FluidContainerRegistry.registerContainer(new FluidContainer(new ItemStack(ModItems.gas_full, 1, id), new ItemStack(ModItems.gas_empty), type, 1000));
|
||||||
|
|
||||||
if(type.hasNoContainer()) continue;
|
if(type.hasNoContainer()) continue;
|
||||||
|
|
||||||
FluidContainerRegistry.registerContainer(new FluidContainer(new ItemStack(ModItems.fluid_tank_lead_full, 1, i), new ItemStack(ModItems.fluid_tank_lead_empty), Fluids.fromID(i), 1000));
|
FluidContainerRegistry.registerContainer(new FluidContainer(new ItemStack(ModItems.fluid_tank_lead_full, 1, id), new ItemStack(ModItems.fluid_tank_lead_empty), type, 1000));
|
||||||
|
|
||||||
if(type.needsLeadContainer()) continue;
|
if(type.needsLeadContainer()) continue;
|
||||||
|
|
||||||
FluidContainerRegistry.registerContainer(new FluidContainer(new ItemStack(ModItems.fluid_tank_full, 1, i), new ItemStack(ModItems.fluid_tank_empty), Fluids.fromID(i), 1000));
|
FluidContainerRegistry.registerContainer(new FluidContainer(new ItemStack(ModItems.fluid_tank_full, 1, id), new ItemStack(ModItems.fluid_tank_empty), type, 1000));
|
||||||
FluidContainerRegistry.registerContainer(new FluidContainer(new ItemStack(ModItems.fluid_barrel_full, 1, i), new ItemStack(ModItems.fluid_barrel_empty), Fluids.fromID(i), 16000));
|
FluidContainerRegistry.registerContainer(new FluidContainer(new ItemStack(ModItems.fluid_barrel_full, 1, id), new ItemStack(ModItems.fluid_barrel_empty), type, 16000));
|
||||||
}
|
}
|
||||||
|
|
||||||
Compat.registerCompatFluidContainers();
|
Compat.registerCompatFluidContainers();
|
||||||
|
|||||||
17
src/main/java/com/hbm/tileentity/IConditionalInvAccess.java
Normal file
17
src/main/java/com/hbm/tileentity/IConditionalInvAccess.java
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
package com.hbm.tileentity;
|
||||||
|
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Masks operation such as isItemValidForSlot and getAccessibleSlotsFromSide found in ISidedInveotry
|
||||||
|
* Intended to be used to return a different result depending on the port, assuming the port detects IConditionalInvAccess
|
||||||
|
*
|
||||||
|
* @author hbm
|
||||||
|
*/
|
||||||
|
public interface IConditionalInvAccess {
|
||||||
|
|
||||||
|
public boolean isItemValidForSlot(int x, int y, int z, int slot, ItemStack stack);
|
||||||
|
public boolean canInsertItem(int x, int y, int z, int slot, ItemStack stack, int side);
|
||||||
|
public boolean canExtractItem(int x, int y, int z, int slot, ItemStack stack, int side);
|
||||||
|
public int[] getAccessibleSlotsFromSide(int x, int y, int z, int side);
|
||||||
|
}
|
||||||
@ -361,6 +361,9 @@ public class TileEntityProxyCombo extends TileEntityProxyBase implements IEnergy
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
if(getTile() instanceof ISidedInventory) {
|
if(getTile() instanceof ISidedInventory) {
|
||||||
|
|
||||||
|
if(getTile() instanceof IConditionalInvAccess) return ((IConditionalInvAccess) getTile()).isItemValidForSlot(xCoord, yCoord, zCoord, slot, stack);
|
||||||
|
|
||||||
return ((ISidedInventory)getTile()).isItemValidForSlot(slot, stack);
|
return ((ISidedInventory)getTile()).isItemValidForSlot(slot, stack);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -374,6 +377,9 @@ public class TileEntityProxyCombo extends TileEntityProxyBase implements IEnergy
|
|||||||
return new int[0];
|
return new int[0];
|
||||||
|
|
||||||
if(getTile() instanceof ISidedInventory) {
|
if(getTile() instanceof ISidedInventory) {
|
||||||
|
|
||||||
|
if(getTile() instanceof IConditionalInvAccess) return ((IConditionalInvAccess) getTile()).getAccessibleSlotsFromSide(xCoord, yCoord, zCoord, side);
|
||||||
|
|
||||||
return ((ISidedInventory)getTile()).getAccessibleSlotsFromSide(side);
|
return ((ISidedInventory)getTile()).getAccessibleSlotsFromSide(side);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -387,6 +393,9 @@ public class TileEntityProxyCombo extends TileEntityProxyBase implements IEnergy
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
if(getTile() instanceof ISidedInventory) {
|
if(getTile() instanceof ISidedInventory) {
|
||||||
|
|
||||||
|
if(getTile() instanceof IConditionalInvAccess) return ((IConditionalInvAccess) getTile()).canInsertItem(xCoord, yCoord, zCoord, i, stack, j);
|
||||||
|
|
||||||
return ((ISidedInventory)getTile()).canInsertItem(i, stack, j);
|
return ((ISidedInventory)getTile()).canInsertItem(i, stack, j);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -400,6 +409,9 @@ public class TileEntityProxyCombo extends TileEntityProxyBase implements IEnergy
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
if(getTile() instanceof ISidedInventory) {
|
if(getTile() instanceof ISidedInventory) {
|
||||||
|
|
||||||
|
if(getTile() instanceof IConditionalInvAccess) return ((IConditionalInvAccess) getTile()).canExtractItem(xCoord, yCoord, zCoord, i, stack, j);
|
||||||
|
|
||||||
return ((ISidedInventory)getTile()).canExtractItem(i, stack, j);
|
return ((ISidedInventory)getTile()).canExtractItem(i, stack, j);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -5,6 +5,7 @@ import net.minecraft.inventory.ISidedInventory;
|
|||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
public class TileEntityProxyInventory extends TileEntityProxyBase implements ISidedInventory {
|
public class TileEntityProxyInventory extends TileEntityProxyBase implements ISidedInventory {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -105,7 +105,15 @@ public class HashedSet<T> implements Set<T> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean remove(Object o) {
|
public boolean remove(Object o) {
|
||||||
return false;
|
T obj = this.map.get(o.hashCode());
|
||||||
|
boolean rem = false;
|
||||||
|
|
||||||
|
if(obj != null) {
|
||||||
|
rem = true;
|
||||||
|
this.map.remove(o.hashCode());
|
||||||
|
}
|
||||||
|
|
||||||
|
return rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.9 KiB |
Loading…
x
Reference in New Issue
Block a user