Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
reobf committed Aug 28, 2024
1 parent 7c468da commit 95261c5
Show file tree
Hide file tree
Showing 23 changed files with 525 additions and 55 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.18p14'
String versionOverride = '0.0.18p15'
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
5 changes: 5 additions & 0 deletions dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ api("com.github.GTNewHorizons:NotEnoughEnergistics:1.5.1:dev")
api("com.github.GTNewHorizons:NotEnoughItems:2.5.27-GTNH:dev")
api("com.github.GTNewHorizons:GTNHLib:0.2.11:dev")
api("com.github.GTNewHorizons:ModularUI:1.1.42:dev")
api("com.github.GTNewHorizons:ModularUI2:2.1.2-1.7.10:dev")
api("com.github.GTNewHorizons:waila:1.7.3:dev")
api("com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-356-GTNH:dev")
api("com.github.GTNewHorizons:AE2FluidCraft-Rework:1.2.29-gtnh:dev")
Expand Down Expand Up @@ -77,4 +78,8 @@ api("com.github.GTNewHorizons:NotEnoughEnergistics:1.5.1:dev")
api("com.github.GTNewHorizons:ae2stuff:0.8.2-GTNH:dev")
api("com.github.GTNewHorizons:CraftTweaker:3.3.1:dev") { transitive = false }
api('com.github.GTNewHorizons:GigaGramFab:0.3.19:dev')

api("com.github.GTNewHorizons:ProjectRed:4.9.3-GTNH:dev")
api("com.github.GTNewHorizons:MrTJPCore:1.1.6:dev")

}
Original file line number Diff line number Diff line change
Expand Up @@ -173,5 +173,18 @@ public boolean rotateBlock(World worldObj, int x, int y, int z, ForgeDirection a
return true;

}

@Override
public boolean hasComparatorInputOverride() {

return true;
}
@Override
public int getComparatorInputOverride(World worldIn, int x, int y, int z, int side) {
TileEntity te = worldIn.getTileEntity(x, y, z);
TileCyclicPatternSubmitter ts=(TileCyclicPatternSubmitter) te;



return (ts.index*16)/ts.inv.length;
}
}
103 changes: 98 additions & 5 deletions src/main/java/reobf/proghatches/ae/PartAmountMaintainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import java.lang.reflect.Field;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.glodblock.github.common.item.ItemFluidPacket;
Expand All @@ -12,7 +13,9 @@
import com.google.common.collect.ImmutableMap;
import com.gtnewhorizons.modularui.api.ModularUITextures;
import com.gtnewhorizons.modularui.api.drawable.IDrawable;
import com.gtnewhorizons.modularui.api.drawable.ItemDrawable;
import com.gtnewhorizons.modularui.api.drawable.Text;
import com.gtnewhorizons.modularui.api.drawable.shapes.Rectangle;
import com.gtnewhorizons.modularui.api.forge.ItemStackHandler;
import com.gtnewhorizons.modularui.api.math.Alignment;
import com.gtnewhorizons.modularui.api.math.Color;
Expand Down Expand Up @@ -94,7 +97,7 @@
public class PartAmountMaintainer extends PartBasicState implements IGuiProvidingPart,IGridTickable,IPowerChannelState{

private int mode;

private int rsmode;

//bit0 ->when offline,clear or maintain
//bit1 ->when online,invert redstone
Expand All @@ -119,9 +122,32 @@ public TickingRequest getTickingRequest(IGridNode node) {
StorageChannel.ITEMS,AEItemStack.create(new ItemStack(Items.apple,0))
);

boolean lastredstone;

public boolean shouldProceed(boolean red, boolean lastredstone){
switch (rsmode) {
case 0:return true;
case 1:return false;
case 2:return red;
case 3:return !red;
case 4:return red&&(!lastredstone);
case 5:return (!red)&&lastredstone;

}


return true;}



@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
public TickRateModulation tickingRequest(IGridNode node, int TicksSinceLastCall) {
if(upgrade[0]==null)rsmode=0;
boolean red=this.getHost().hasRedstone(this.getSide());
boolean should=shouldProceed(red,lastredstone);
lastredstone=red;
if(!should){return TickRateModulation.SAME;}
if(getProxy().isActive()==false)return TickRateModulation.SAME;
for(StorageChannel ch:new StorageChannel[]{StorageChannel.FLUIDS,StorageChannel.ITEMS})
{
Expand Down Expand Up @@ -316,9 +342,12 @@ public boolean onPartActivate(EntityPlayer player, Vec3 pos) {
return true;
}


@Override
public ModularWindow createWindow(UIBuildContext buildContext) {
ModularWindow.Builder builder = ModularWindow.builder(176, 107+20);


builder.setBackground(ModularUITextures.VANILLA_BACKGROUND);
builder.bindPlayerInventory(buildContext.getPlayer());

Expand All @@ -331,6 +360,13 @@ public ModularWindow createWindow(UIBuildContext buildContext) {
stack.setStackDisplayName("freq:"+freqTooltip);
is.setStackInSlot(0, stack);
}







builder.widget( TextWidget.dynamicString(()->{
try{
PartP2PTunnel p2p = getProxy().getP2P().getInput(freq);
Expand Down Expand Up @@ -379,7 +415,7 @@ protected void phantomClick(ClickData clickData, ItemStack cursorStack) {
}


}.setPos(3+4, 3)
}.disableShiftInsert().setPos(3+4, 3)
.addTooltip( StatCollector.translateToLocal("proghatches.amountmaintainer.memorycard"))
);

Expand Down Expand Up @@ -479,6 +515,54 @@ protected void phantomClick(ClickData clickData, ItemStack cursorStack) {
;
builder.widget(new FakeSyncWidget.BooleanSyncer(()->on, s->on=s));


ItemStackHandler iss0=new ItemStackHandler(upgrade){

public boolean isItemValid(int slot, ItemStack stack) {
return Api.INSTANCE.definitions().materials().cardRedstone().isSameAs(stack);

};
public int getSlotLimit(int slot) {
return 1;};
};

builder.widget( new SlotWidget(new BaseSlot(iss0, 0)){


}
.setPos(60, 3+20).addTooltip(StatCollector.translateToLocal("proghatches.amountmaintainer.rscard")));

builder.widget(new CycleButtonWidget().setGetter(()->rsmode)
.setSetter(s->rsmode=s).setLength(6)
.setTextureGetter(s->{
if(s==0)return new ItemDrawable(new ItemStack(Items.redstone));
if(s==1)return new ItemDrawable(new ItemStack(Items.gunpowder));
if(s==2)return GT_UITextures.OVERLAY_BUTTON_REDSTONE_ON;
if(s==3)return GT_UITextures.OVERLAY_BUTTON_REDSTONE_OFF;
if(s==4)return GT_UITextures.OVERLAY_BUTTON_ARROW_GREEN_UP;
return GT_UITextures.OVERLAY_BUTTON_ARROW_GREEN_DOWN;
})
.addTooltip(0, StatCollector.translateToLocal("proghatches.amountmaintainer.rscard.mode.0"))
.addTooltip(1, StatCollector.translateToLocal("proghatches.amountmaintainer.rscard.mode.1"))
.addTooltip(2, StatCollector.translateToLocal("proghatches.amountmaintainer.rscard.mode.2"))
.addTooltip(3, StatCollector.translateToLocal("proghatches.amountmaintainer.rscard.mode.3"))
.addTooltip(4, StatCollector.translateToLocal("proghatches.amountmaintainer.rscard.mode.4"))
.addTooltip(5, StatCollector.translateToLocal("proghatches.amountmaintainer.rscard.mode.5"))



.setBackground(() -> {
{
return new IDrawable[] { GT_UITextures.BUTTON_STANDARD,
};
}
})
.setEnabled((a)->(upgrade[0]!=null))
.setSize(18, 18)
.setPos(60+20, 3+20));



return builder.build();
}
private boolean on;
Expand Down Expand Up @@ -518,25 +602,30 @@ public Boolean getSignal(){
}
long freq;
private BaseActionSource source=new MachineSource(this);

ItemStack[] upgrade=new ItemStack[1];

@Override
public void readFromNBT(NBTTagCompound data) {
freq=data.getLong("freq");
mode=data.getInteger("mode");
rsmode=data.getInteger("rsmode");
redstone=data.getInteger("redstone");
amount=data.getLong("amount");
lastredstone=data.getBoolean("lastredstone" );
mark[0]=ItemStack.loadItemStackFromNBT(data.getCompoundTag("mark"));
upgrade[0]=ItemStack.loadItemStackFromNBT(data.getCompoundTag("upgrade"));
super.readFromNBT(data);
}
@Override
public void writeToNBT(NBTTagCompound data) {
data.setLong("freq", freq);
data.setInteger("mode", mode);
data.setInteger("rsmode", rsmode);
data.setInteger("redstone", redstone);
data.setLong("amount", amount);
data.setBoolean("lastredstone", lastredstone);
if(mark[0]!=null)data.setTag("mark", mark[0].writeToNBT(new NBTTagCompound()));

if(upgrade[0]!=null)data.setTag("upgrade", upgrade[0].writeToNBT(new NBTTagCompound()));
super.writeToNBT(data);
}
long amount=64;
Expand Down Expand Up @@ -622,5 +711,9 @@ private IMEMonitor getStorage(IStorageGrid g,StorageChannel c){

}


@Override
public void getDrops(final List<ItemStack> drops, final boolean wrenched) {
if(upgrade[0]!=null)
drops.add(upgrade[0]);
}
}
Loading

0 comments on commit 95261c5

Please sign in to comment.