Skip to content

Commit

Permalink
A few minor changes
Browse files Browse the repository at this point in the history
>Implemented canister filling system
>Yes I have a C drive
  • Loading branch information
skiprocks999 committed Jun 30, 2021
1 parent 56609a7 commit 8be607a
Show file tree
Hide file tree
Showing 13 changed files with 174 additions and 155 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ minecraft {

dependencies {
minecraft 'net.minecraftforge:forge:1.16.5-36.0.42'
compile fileTree("E:/Games/Minecraft/Mod Code/Mods/JARS")
compile fileTree("C:/AmpzLibz")
/*
Compiles against source code as well as JAR at runtime. Recommend to keep it
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import electrodynamics.prefab.tile.components.type.ComponentFluidHandler;
import electrodynamics.prefab.tile.components.type.ComponentProcessor;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.fluid.Fluids;
import net.minecraft.fluid.Fluid;
import net.minecraft.inventory.container.Slot;
import net.minecraft.item.ItemStack;
import net.minecraft.util.text.ITextComponent;
Expand All @@ -30,6 +30,7 @@
import net.minecraft.util.text.TranslationTextComponent;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.fluids.capability.templates.FluidTank;
import nuclearscience.common.inventory.container.ContainerChemicalExtractor;
import nuclearscience.common.tile.TileChemicalExtractor;

Expand Down Expand Up @@ -61,8 +62,13 @@ public ScreenChemicalExtractor(ContainerChemicalExtractor container, PlayerInven
components.add(new ScreenComponentFluid(() -> {
TileChemicalExtractor boiler = container.getHostFromIntArray();
if (boiler != null) {
ComponentFluidHandler handler = boiler.getComponent(ComponentType.FluidHandler);
return handler.getTankFromFluid(Fluids.WATER);
ComponentFluidHandler handler = boiler.getComponent(ComponentType.FluidHandler);
for(Fluid fluid : handler.getInputFluids()) {
FluidTank tank = handler.getTankFromFluid(fluid);
if(tank.getFluidAmount() > 0) {
return handler.getTankFromFluid(tank.getFluid().getFluid());
}
}
}
return null;
}, this, 21, 18));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import electrodynamics.prefab.tile.components.type.ComponentFluidHandler;
import electrodynamics.prefab.tile.components.type.ComponentProcessor;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.fluid.Fluids;
import net.minecraft.fluid.Fluid;
import net.minecraft.inventory.container.Slot;
import net.minecraft.item.ItemStack;
import net.minecraft.util.text.ITextComponent;
Expand All @@ -30,7 +30,7 @@
import net.minecraft.util.text.TranslationTextComponent;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import nuclearscience.DeferredRegisters;
import net.minecraftforge.fluids.capability.templates.FluidTank;
import nuclearscience.common.inventory.container.ContainerNuclearBoiler;
import nuclearscience.common.tile.TileNuclearBoiler;

Expand Down Expand Up @@ -62,16 +62,26 @@ public ScreenNuclearBoiler(ContainerNuclearBoiler container, PlayerInventory pla
components.add(new ScreenComponentFluid(() -> {
TileNuclearBoiler boiler = container.getHostFromIntArray();
if (boiler != null) {
ComponentFluidHandler handler = boiler.getComponent(ComponentType.FluidHandler);
return handler.getTankFromFluid(Fluids.WATER);
ComponentFluidHandler handler = boiler.getComponent(ComponentType.FluidHandler);
for(Fluid fluid : handler.getInputFluids()) {
FluidTank tank = handler.getTankFromFluid(fluid);
if(tank.getFluidAmount() > 0) {
return handler.getTankFromFluid(tank.getFluid().getFluid());
}
}
}
return null;
}, this, 21, 18));
components.add(new ScreenComponentFluid(() -> {
TileNuclearBoiler boiler = container.getHostFromIntArray();
if (boiler != null) {
ComponentFluidHandler handler = boiler.getComponent(ComponentType.FluidHandler);
return handler.getTankFromFluid(DeferredRegisters.fluidUraniumHexafluoride);
ComponentFluidHandler handler = boiler.getComponent(ComponentType.FluidHandler);
for(Fluid fluid : handler.getOutputFluids()) {
FluidTank tank = handler.getTankFromFluid(fluid);
if(tank.getFluidAmount() > 0) {
return handler.getTankFromFluid(tank.getFluid().getFluid());
}
}
}
return null;
}, this, 127, 18));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public class FluidUraniumHexafluoride extends Fluid {

@Override
public Item getFilledBucket() {
return Items.AIR;
return null;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
public class ContainerNuclearBoiler extends GenericContainer<TileNuclearBoiler> {

public ContainerNuclearBoiler(int id, PlayerInventory playerinv) {
this(id, playerinv, new Inventory(5), new IntArray(3));
this(id, playerinv, new Inventory(6), new IntArray(3));
}

public ContainerNuclearBoiler(int id, PlayerInventory playerinv, IInventory inventory, IIntArray inventorydata) {
Expand All @@ -31,7 +31,8 @@ public ContainerNuclearBoiler(ContainerType<?> type, int id, PlayerInventory pla
@Override
public void addInventorySlots(IInventory inv, PlayerInventory playerinv) {
addSlot(new GenericSlot(inv, nextIndex(), 74, 31));
addSlot(new SlotRestricted(inv, nextIndex(), 74, 51, Items.WATER_BUCKET));
addSlot(new SlotRestricted(inv, nextIndex(), 74, 51, TileNuclearBoiler.SUPPORTED_INPUT_FLUIDS));
addSlot(new SlotRestricted(inv, nextIndex(), 108, 51, SlotRestricted.VALID_EMPTY_BUCKETS[2]));
addSlot(new SlotRestricted(inv, nextIndex(), 150, 14,
electrodynamics.DeferredRegisters.SUBTYPEITEM_MAPPINGS.get(SubtypeProcessorUpgrade.basicspeed),
electrodynamics.DeferredRegisters.SUBTYPEITEM_MAPPINGS.get(SubtypeProcessorUpgrade.advancedspeed)));
Expand Down
40 changes: 21 additions & 19 deletions src/main/java/nuclearscience/common/tile/TileNuclearBoiler.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ public TileNuclearBoiler() {
addComponent(
new ComponentFluidHandler(this).relativeInput(Direction.EAST).addMultipleFluidTanks(SUPPORTED_INPUT_FLUIDS, MAX_TANK_CAPACITY, true)
.addMultipleFluidTanks(SUPPORTED_OUTPUT_FLUIDS, MAX_TANK_CAPACITY, false));
addComponent(new ComponentInventory(this).size(5).relativeSlotFaces(0, Direction.EAST, Direction.UP).relativeSlotFaces(1, Direction.DOWN)
.valid((slot, stack) -> slot < 2 || stack.getItem() instanceof ItemProcessorUpgrade));
addComponent(new ComponentProcessor(this).upgradeSlots(2, 3, 4).canProcess(component -> canProcessNuclBoil(component))
addComponent(new ComponentInventory(this).size(6).relativeSlotFaces(0, Direction.EAST, Direction.UP).relativeSlotFaces(1, Direction.DOWN)
.valid((slot, stack) -> slot < 3 || stack.getItem() instanceof ItemProcessorUpgrade));
addComponent(new ComponentProcessor(this).upgradeSlots(3, 4, 5).canProcess(component -> canProcessNuclBoil(component))
.process(component -> component.processFluidItem2FluidRecipe(component, FluidItem2FluidRecipe.class))
.usage(Constants.CHEMICALBOILER_USAGE_PER_TICK).type(ComponentProcessorType.ObjectToObject)
.requiredTicks(Constants.CHEMICALBOILER_REQUIRED_TICKS));
Expand All @@ -85,23 +85,25 @@ protected void tickClient(ComponentTickable tickable) {
}

protected boolean canProcessNuclBoil(ComponentProcessor processor) {
ComponentDirection direction = getComponent(ComponentType.Direction);
ComponentFluidHandler tank = getComponent(ComponentType.FluidHandler);
BlockPos face = getPos().offset(direction.getDirection().getOpposite().rotateY());
TileEntity faceTile = world.getTileEntity(face);
if (faceTile != null) {
LazyOptional<IFluidHandler> cap = faceTile.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY,
direction.getDirection().getOpposite().rotateY().getOpposite());
if (cap.isPresent()) {
IFluidHandler handler = cap.resolve().get();
if (handler.isFluidValid(0, tank.getStackFromFluid(DeferredRegisters.fluidUraniumHexafluoride))) {
tank.getStackFromFluid(DeferredRegisters.fluidUraniumHexafluoride)
.shrink(handler.fill(tank.getStackFromFluid(DeferredRegisters.fluidUraniumHexafluoride), FluidAction.EXECUTE));
ComponentDirection direction = getComponent(ComponentType.Direction);
ComponentFluidHandler tank = getComponent(ComponentType.FluidHandler);
BlockPos face = getPos().offset(direction.getDirection().getOpposite().rotateY());
TileEntity faceTile = world.getTileEntity(face);
if (faceTile != null) {
LazyOptional<IFluidHandler> cap = faceTile.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY,
direction.getDirection().getOpposite().rotateY().getOpposite());
if (cap.isPresent()) {
IFluidHandler handler = cap.resolve().get();
for(Fluid fluid: SUPPORTED_OUTPUT_FLUIDS) {
if(tank.getTankFromFluid(fluid).getFluidAmount() > 0) {
tank.getStackFromFluid(fluid).shrink(handler.fill(tank.getStackFromFluid(fluid), FluidAction.EXECUTE));
break;
}
}
}
}
}
}
processor.consumeBucket(MAX_TANK_CAPACITY, SUPPORTED_INPUT_FLUIDS, 1);
return processor.canProcessFluidItem2FluidRecipe(processor, FluidItem2FluidRecipe.class, NuclearScienceRecipeInit.NUCLEAR_BOILER_TYPE);
processor.consumeBucket(MAX_TANK_CAPACITY, SUPPORTED_INPUT_FLUIDS, 1).dispenseBucket(MAX_TANK_CAPACITY, 2);
return processor.canProcessFluidItem2FluidRecipe(processor, FluidItem2FluidRecipe.class, NuclearScienceRecipeInit.NUCLEAR_BOILER_TYPE);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,27 @@
import net.minecraft.item.crafting.IRecipeType;
import net.minecraftforge.fluids.FluidStack;

public class PsuedoGasCentrifugeRecipe extends O2ORecipe{
public class PsuedoGasCentrifugeRecipe extends O2ORecipe {

public FluidStack INPUT_FLUID_STACK;
public ItemStack OUTPUT_1_ITEM;
public ItemStack OUTPUT_2_ITEM;

public PsuedoGasCentrifugeRecipe(FluidStack inputFluid, ItemStack output1, ItemStack output2) {
super(null,null,null);
INPUT_FLUID_STACK = inputFluid;
OUTPUT_1_ITEM = output1;
OUTPUT_2_ITEM = output2;
super(null, null, null);
INPUT_FLUID_STACK = inputFluid;
OUTPUT_1_ITEM = output1;
OUTPUT_2_ITEM = output2;
}

@Override
public IRecipeSerializer<?> getSerializer() {
return null;
}
@Override
public IRecipeSerializer<?> getSerializer() {
return null;
}

@Override
public IRecipeType<?> getType() {
return null;
}
@Override
public IRecipeType<?> getType() {
return null;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -26,30 +26,30 @@ public class ChemicalExtractorRecipeCategory extends FluidItem2ItemRecipeCategor

private static int[] MAJOR_PROCESSING_ARROW_OFFSET = { 32, 17 };
private static int[] MINOR_PROCESSING_ARROW_OFFSET = { 32, 37 };

private static int SMELT_TIME = 50;
private static int TEXT_Y_HEIGHT = 48;

private static String MOD_ID = References.ID;
private static String RECIPE_GROUP = "chemical_extractor";
private static String GUI_TEXTURE = "textures/gui/jei/sol_and_liq_to_sol_recipe_gui.png";

private static ItemStack INPUT_MACHINE = new ItemStack(DeferredRegisters.blockChemicalExtractor);

private static StartDirection MAJOR_ARROW_START_DIRECTION = IDrawableAnimated.StartDirection.LEFT;
private static StartDirection MINOR_ARROW_START_DIRECTION = IDrawableAnimated.StartDirection.RIGHT;

public static ResourceLocation UID = new ResourceLocation(MOD_ID, RECIPE_GROUP);

private static ArrayList<int[]> INPUT_COORDINATES = new ArrayList<>(
Arrays.asList(GUI_BACKGROUND, MAJOR_PROCESSING_ARROW_LOCATION, MINOR_PROCESSING_ARROW_LOCATION, INPUT_ITEM_OFFSET, INPUT_FLUID_BUCKET_OFFSET,
INPUT_FLUID_TANK, OUTPUT_FLUID_TANK, MAJOR_PROCESSING_ARROW_OFFSET, MINOR_PROCESSING_ARROW_OFFSET));
Arrays.asList(GUI_BACKGROUND, MAJOR_PROCESSING_ARROW_LOCATION, MINOR_PROCESSING_ARROW_LOCATION, INPUT_ITEM_OFFSET,
INPUT_FLUID_BUCKET_OFFSET, INPUT_FLUID_TANK, OUTPUT_FLUID_TANK, MAJOR_PROCESSING_ARROW_OFFSET, MINOR_PROCESSING_ARROW_OFFSET));

public ChemicalExtractorRecipeCategory(IGuiHelper guiHelper) {
super(guiHelper, MOD_ID, RECIPE_GROUP, GUI_TEXTURE, INPUT_MACHINE, INPUT_COORDINATES, SMELT_TIME, MAJOR_ARROW_START_DIRECTION,
MINOR_ARROW_START_DIRECTION, TEXT_Y_HEIGHT);
}

@Override
public ResourceLocation getUid() {
return UID;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,37 +23,37 @@ public class FissionReactorRecipeCategory extends O2ORecipeCategory {

private static final int INPUT_SLOT = 0;
private static final int OUTPUT_SLOT = 1;
// JEI Window Parameters

// JEI Window Parameters
private static int[] GUI_BACKGROUND = { 0, 0, 132, 132 };
private static int[] PROCESSING_ARROW_LOCATION = { 132, 0, 48, 42 };

private static int[] INPUT_ITEM_OFFSET = { 57, 25 };
private static int[] OUTPUT_ITEM_OFFSET = { 57, 89 };
private static int[] PROCESSING_ARROW_OFFSET = { 42, 45 };

private static int[] FUEL_ROD_SLOTS = { 2, 3, 4, 5 };

private static int SMELT_TIME = 50;
private static int TEXT_Y_HEIGHT = 122;

private static String MOD_ID = References.ID;
private static String RECIPE_GROUP = "fission_reactor";
private static String GUI_TEXTURE = "textures/gui/jei/fission_reactor_gui.png";

private static ItemStack INPUT_MACHINE = new ItemStack(nuclearscience.DeferredRegisters.blockReactorCore);

private static StartDirection ARROW_START_DIRECTION = IDrawableAnimated.StartDirection.TOP;

public static ResourceLocation UID = new ResourceLocation(MOD_ID, RECIPE_GROUP);

private static ArrayList<int[]> INPUT_COORDINATES = new ArrayList<>(
Arrays.asList(GUI_BACKGROUND, PROCESSING_ARROW_LOCATION, INPUT_ITEM_OFFSET, OUTPUT_ITEM_OFFSET, PROCESSING_ARROW_OFFSET));

public FissionReactorRecipeCategory(IGuiHelper guiHelper) {
super(guiHelper, MOD_ID, RECIPE_GROUP, GUI_TEXTURE, INPUT_MACHINE, INPUT_COORDINATES, SMELT_TIME,
TEXT_Y_HEIGHT, ARROW_START_DIRECTION);
super(guiHelper, MOD_ID, RECIPE_GROUP, GUI_TEXTURE, INPUT_MACHINE, INPUT_COORDINATES, SMELT_TIME, TEXT_Y_HEIGHT, ARROW_START_DIRECTION);
}

@Override
public ResourceLocation getUid() {
return UID;
Expand Down
Loading

0 comments on commit 8be607a

Please sign in to comment.