Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
reobf committed Sep 4, 2024
1 parent effa808 commit a8ccf92
Show file tree
Hide file tree
Showing 24 changed files with 766 additions and 40 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ catch (Exception ignored) {

// Pulls version first from the VERSION env and then git tag
String identifiedVersion = null
String versionOverride = '0.0.18p17'
String versionOverride = '0.0.18p18'
try {
// Produce a version based on the tag, or for branches something like 0.2.2-configurable-maven-and-extras.38+43090270b6-dirty
if (versionOverride == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ public void updateEntity() {
if(job.canBeDone(getProxy(), source)){
last=getProxy().getCrafting().submitJob(job, this, null, true, source);

}submitfail=last!=null;
}submitfail=last==null;
}else{

if(abortingMode){
Expand Down
17 changes: 13 additions & 4 deletions src/main/java/reobf/proghatches/block/TileIOHub.java
Original file line number Diff line number Diff line change
Expand Up @@ -378,9 +378,18 @@ public int newUTF8(String value) {
);
}

/*public static class test{
@Callback(doc = "function()")
public Object[] test(final Context context, final Arguments args) {
return new Object[] { };
}
}
*/

//
// begin of oc
public class OCApi implements li.cil.oc.api.network.Environment, WorldInventoryAnalytics, WorldTankAnalytics,
public class OCApi/* extends test*/ implements li.cil.oc.api.network.Environment, WorldInventoryAnalytics, WorldTankAnalytics,
WorldFluidContainerAnalytics, TankInventoryControl, InventoryAnalytics, MultiTank, InventoryTransfer,
FluidContainerTransfer, InventoryControl, TankControl, ItemInventoryControl, InventoryWorldControlMk2,
TankWorldControl,NetworkControl<TileIOHub> {
Expand Down Expand Up @@ -1462,7 +1471,7 @@ public void readFromNBT(NBTTagCompound compound) {
getProxy().readFromNBT(compound);

NBTTagCompound nd = (NBTTagCompound) compound.getTag("mainNode");
if (nd != null && node != null)
if (nd .hasNoTags()!=false && node != null)
node.load(nd);
for (Entry<String, li.cil.oc.api.network.Environment> ent : subapi.entrySet()) {
nd = (NBTTagCompound) compound.getTag(ent.getKey());
Expand Down Expand Up @@ -1688,13 +1697,13 @@ public IGridNode getActionableNode() {
@Override
public Node sidedNode(ForgeDirection side) {

return null;
return node();
}

@Override
public boolean canConnect(ForgeDirection side) {

return false;
return true;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -847,49 +847,49 @@ public void setInventorySlotContents(int aIndex, ItemStack aStack) {
markDirty();
dirty = true;
}

final int offset=0;
public void add1by1Slot(ModularWindow.Builder builder, int index, IDrawable... background) {
final IItemHandlerModifiable inventoryHandler = new MappingItemHandler(inv0.get(index).mStoredItemInternal,
1000, 1);
offset, 1).id(1);
if (background.length == 0) {
background = new IDrawable[] { getGUITextureSet().getItemSlot() };
}
builder.widget(SlotGroup.ofItemHandler(inventoryHandler, 1).startFromSlot(1000)
builder.widget(SlotGroup.ofItemHandler(inventoryHandler, 1).startFromSlot(offset)
.slotCreator(BaseSlotPatched.newInst(inventoryHandler))
.endAtSlot(1000).background(background).build().setPos(3, 3));
.endAtSlot(offset).background(background).build().setPos(3, 3));
}

public void add2by2Slots(ModularWindow.Builder builder, int index, IDrawable... background) {
final IItemHandlerModifiable inventoryHandler = new MappingItemHandler(inv0.get(index).mStoredItemInternal,
1000, 4);
offset, 4).id(1);
if (background.length == 0) {
background = new IDrawable[] { getGUITextureSet().getItemSlot() };
}
builder.widget(SlotGroup.ofItemHandler(inventoryHandler, 2).startFromSlot(1000)
builder.widget(SlotGroup.ofItemHandler(inventoryHandler, 2).startFromSlot(offset)
.slotCreator(BaseSlotPatched.newInst(inventoryHandler))
.endAtSlot(1003).background(background).build().setPos(3, 3));
.endAtSlot(offset+3).background(background).build().setPos(3, 3));
}

public void add3by3Slots(ModularWindow.Builder builder, int index, IDrawable... background) {
final IItemHandlerModifiable inventoryHandler = new MappingItemHandler(inv0.get(index).mStoredItemInternal,
1000, 9);
offset, 9).id(1);
if (background.length == 0) {
background = new IDrawable[] { getGUITextureSet().getItemSlot() };
}
builder.widget(SlotGroup.ofItemHandler(inventoryHandler, 3).startFromSlot(1000)
builder.widget(SlotGroup.ofItemHandler(inventoryHandler, 3).startFromSlot(offset)
.slotCreator(BaseSlotPatched.newInst(inventoryHandler))
.endAtSlot(1008).background(background).build().setPos(3, 3));
.endAtSlot(offset+8).background(background).build().setPos(3, 3));
}

public void add4by4Slots(ModularWindow.Builder builder, int index, IDrawable... background) {
final IItemHandlerModifiable inventoryHandler = new MappingItemHandler(inv0.get(index).mStoredItemInternal,
1000, 16);
offset, 16).id(1);
if (background.length == 0) {
background = new IDrawable[] { getGUITextureSet().getItemSlot() };
}
builder.widget(SlotGroup.ofItemHandler(inventoryHandler, 4).startFromSlot(1000)
builder.widget(SlotGroup.ofItemHandler(inventoryHandler, 4).startFromSlot(offset)
.slotCreator(BaseSlotPatched.newInst(inventoryHandler))
.endAtSlot(1015).background(background).build().setPos(3, 3)
.endAtSlot(offset+15).background(background).build().setPos(3, 3)

);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ public com.gtnewhorizons.modularui.api.widget.Interactable.ClickResult onClick(i
@Override
public ItemStackHandler getInventoryHandler() {
if (bridge == null)
bridge = new InventoryItemHandler(mInventory, this);
bridge = new InventoryItemHandler(mInventory, this).id(1);
return bridge;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ public void addUIWidgets(ModularWindow.Builder builder, UIBuildContext buildCont
}
protected ModularWindow createStackSizeConfigurationWindow(final EntityPlayer player) {
final int WIDTH = 78;
final int HEIGHT = 80+18;
final int HEIGHT = 80+18+18;
final int PARENT_WIDTH = getGUIWidth();
final int PARENT_HEIGHT = getGUIHeight();
ModularWindow.Builder builder = ModularWindow.builder(WIDTH, HEIGHT);
Expand All @@ -238,7 +238,7 @@ protected ModularWindow createStackSizeConfigurationWindow(final EntityPlayer pl
builder.widget(
TextWidget.localised("proghatches.restricted.bound.down")
.setPos(3, 2)
.setSize(74, 14))
.setSize(74, 14+18))
.widget(
new NumericWidget().setSetter(val -> restrict_lowbound = (int) val)
.setGetter(() -> restrict_lowbound)
Expand All @@ -247,11 +247,11 @@ protected ModularWindow createStackSizeConfigurationWindow(final EntityPlayer pl
.setTextAlignment(Alignment.Center)
.setTextColor(Color.WHITE.normal)
.setSize(70, 18)
.setPos(3, 18)
.setPos(3, 18+18)
.setBackground(GT_UITextures.BACKGROUND_TEXT_FIELD));
builder.widget(
TextWidget.localised("proghatches.restricted.bound.up")
.setPos(3, 42)
.setPos(3, 42+18)
.setSize(74, 14))
.widget(
new NumericWidget().setSetter(val -> restrict = (int) val)
Expand All @@ -261,7 +261,7 @@ protected ModularWindow createStackSizeConfigurationWindow(final EntityPlayer pl
.setTextAlignment(Alignment.Center)
.setTextColor(Color.WHITE.normal)
.setSize(70, 18)
.setPos(3, 58)
.setPos(3, 58+18)
.setBackground(GT_UITextures.BACKGROUND_TEXT_FIELD));

builder.widget(createMultiplesModeButton(builder,HEIGHT));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ ButtonWidget createMultiplesModeButton(IWidgetBuilder<?> builder,int HEIGHT) {
}
protected ModularWindow createStackSizeConfigurationWindow(final EntityPlayer player) {
final int WIDTH = 78;
final int HEIGHT = 80+18;
final int HEIGHT = 80+18+18;
final int PARENT_WIDTH = getGUIWidth();
final int PARENT_HEIGHT = getGUIHeight();
ModularWindow.Builder builder = ModularWindow.builder(WIDTH, HEIGHT);
Expand All @@ -243,7 +243,7 @@ protected ModularWindow createStackSizeConfigurationWindow(final EntityPlayer pl
builder.widget(
TextWidget.localised("proghatches.restricted.bound.down")
.setPos(3, 2)
.setSize(74, 14))
.setSize(74, 14+18))
.widget(
new NumericWidget().setSetter(val -> restrict_lowbound = (int) val)
.setGetter(() -> restrict_lowbound)
Expand All @@ -252,11 +252,11 @@ protected ModularWindow createStackSizeConfigurationWindow(final EntityPlayer pl
.setTextAlignment(Alignment.Center)
.setTextColor(Color.WHITE.normal)
.setSize(70, 18)
.setPos(3, 18)
.setPos(3, 18+18)
.setBackground(GT_UITextures.BACKGROUND_TEXT_FIELD));
builder.widget(
TextWidget.localised("proghatches.restricted.bound.up")
.setPos(3, 42)
.setPos(3, 42+18)
.setSize(74, 14))
.widget(
new NumericWidget().setSetter(val -> restrict = (int) val)
Expand All @@ -266,7 +266,7 @@ protected ModularWindow createStackSizeConfigurationWindow(final EntityPlayer pl
.setTextAlignment(Alignment.Center)
.setTextColor(Color.WHITE.normal)
.setSize(70, 18)
.setPos(3, 58)
.setPos(3, 58+18)
.setBackground(GT_UITextures.BACKGROUND_TEXT_FIELD));
builder.widget(createMultiplesModeButton(builder,HEIGHT));
return builder.build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import com.gtnewhorizons.modularui.api.forge.IItemHandlerModifiable;
import com.gtnewhorizons.modularui.common.internal.wrapper.BaseSlot;

import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;

public class BaseSlotPatched extends BaseSlot {
Expand All @@ -16,16 +17,25 @@ public BaseSlotPatched(IItemHandlerModifiable inventory, int index) {

}

public BaseSlotPatched(IItemHandlerModifiable inventory, int index, boolean phantom) {
/*public BaseSlotPatched(IItemHandlerModifiable inventory, int index, boolean phantom) {
super(inventory, index, phantom);
}
}*/
@Override
public boolean canTakeStack(EntityPlayer playerIn) {
//skip simulate take test, this is always true
return true;
}

public static Function<Integer,BaseSlot> newInst(IItemHandlerModifiable inventory){

return s->new BaseSlotPatched(inventory,s);

}




@Override
public boolean isItemValid(@NotNull ItemStack stack) {
boolean b = super.isItemValid(stack);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package reobf.proghatches.gt.metatileentity.util;

public interface IInterhandlerGroup {
public long handlerID();
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@
import com.gtnewhorizons.modularui.api.forge.ItemHandlerHelper;
import com.gtnewhorizons.modularui.api.forge.ItemStackHandler;

import gregtech.api.util.GT_Utility;

//spotless:off
/**
* original ItemStackHandler directly sets the mInventory's content.
* call {@link IInventory#setInventorySlotContents(int, ItemStack)} instead, to notify the classifying process
*/
//spotless:on
public class InventoryItemHandler extends ItemStackHandler {
public class InventoryItemHandler extends ItemStackHandler implements IInterhandlerGroup {

public InventoryItemHandler(ItemStack[] mInventory, IInventory dualInputHatch) {
super(mInventory);
Expand Down Expand Up @@ -67,10 +69,12 @@ public ItemStack insertItem(int slot, ItemStack stack, boolean simulate) {
}
}



public InventoryItemHandler id(long i){id=i;return this;}
long id;
@Override
public void setStackInSlot(int slot, ItemStack stack) {

inv.setInventorySlotContents(slot, stack);
public long handlerID() {
return id;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import gregtech.api.util.GT_Utility;

public class MappingItemHandler implements com.gtnewhorizons.modularui.api.forge.IItemHandlerModifiable

,IInterhandlerGroup
{

public MappingItemHandler(ItemStack[] is, int index, int num) {
Expand Down Expand Up @@ -123,5 +123,12 @@ public void setStackInSlot(int var1, ItemStack var2) {
is[var1 - index] = var2;

}


public MappingItemHandler id(long i){id=i;return this;}
long id;
@Override
public long handlerID() {
return id;
}

}
8 changes: 7 additions & 1 deletion src/main/java/reobf/proghatches/main/CommonProxy.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,15 @@
import reobf.proghatches.main.registration.PHRecipes;
import reobf.proghatches.main.registration.ProgHatchCreativeTab;
import reobf.proghatches.main.registration.Registration;
import reobf.proghatches.oc.BlockCardReader;
import reobf.proghatches.oc.ItemAPICard;
import reobf.proghatches.oc.ItemCPU;
import reobf.proghatches.oc.ItemGTRedstoneCard;
import reobf.proghatches.oc.ItemWirelessPeripheralCard;
import reobf.proghatches.oc.TileCardReader;
import reobf.proghatches.oc.TileCoprocessor;
import reobf.proghatches.oc.TileWirelessPeripheralStation;
import thaumcraft.client.renderers.block.BlockCandleRenderer;

public class CommonProxy {

Expand All @@ -65,6 +68,7 @@ public void preInit(FMLPreInitializationEvent event) {

GameRegistry.registerTileEntity(TileFluidInterface_EU.class, "proghatches.euinterface");
GameRegistry.registerTileEntity(TileCyclicPatternSubmitter.class, "proghatches.submitter");
GameRegistry.registerTileEntity(TileCardReader.class, "proghatches.card_reader");
ItemMEPlunger a=new ItemMEPlunger(100000);


Expand Down Expand Up @@ -125,7 +129,9 @@ public void preInit(FMLPreInitializationEvent event) {

MyMod.pstation = GameRegistry.registerBlock(new TileWirelessPeripheralStation.Block(),
TileWirelessPeripheralStation.ItemBlock.class, "proghatches.peripheral_station");


MyMod.reader = GameRegistry.registerBlock(new BlockCardReader(Material.rock),
"proghatches.card_reader");
li.cil.oc.server.driver.Registry.add((li.cil.oc.api.driver.Item) MyMod.oc_redstone);
li.cil.oc.server.driver.Registry.add((li.cil.oc.api.driver.Item) MyMod.oc_api);
li.cil.oc.server.driver.Registry.add((li.cil.oc.api.driver.Item) MyMod.pitem);
Expand Down
1 change: 1 addition & 0 deletions src/main/java/reobf/proghatches/main/MyMod.java
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ class test extends Item{@Override public int getItemStackLimit() {return 0;}}
public static Item amountmaintainer;
public static Block submitter;
public static Item cpu;
public static Block reader;

@Mod.EventHandler
// preInit "Run before anything else. Read your config, create blocks,
Expand Down
1 change: 1 addition & 0 deletions src/main/java/reobf/proghatches/main/asm/FMLPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public String[] getASMTransformerClass() {
return new String[] {
EUInterfaceTransformer.class.getName() ,
AEItemTransformer.class.getName() ,
MUITransformer.class.getName()
};
}

Expand Down
Loading

0 comments on commit a8ccf92

Please sign in to comment.