Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
reobf committed Jun 20, 2024
1 parent c867180 commit fda5a47
Show file tree
Hide file tree
Showing 73 changed files with 8,863 additions and 7,494 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.15p8'
String versionOverride = '0.0.16'
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
2 changes: 1 addition & 1 deletion dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ api("com.github.GTNewHorizons:NotEnoughEnergistics:1.5.1:dev")
api("thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev") { transitive = false }
api('com.github.GTNewHorizons:Botania:1.10.12-GTNH:dev') { transitive = false }
api('com.github.GTNewHorizons:HoloInventory:2.4.7-GTNH:dev') { transitive = false }

api('com.github.GTNewHorizons:BlockRenderer6343:1.1.6:dev')
api("com.google.auto.value:auto-value-annotations:1.10.1") { transitive = false }
annotationProcessor("com.google.auto.value:auto-value:1.10.1")

Expand Down
12 changes: 7 additions & 5 deletions src/main/java/reobf/proghatches/block/TileIOHub.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@
import net.minecraftforge.fluids.IFluidTank;
import reobf.proghatches.gt.metatileentity.util.MappingItemHandler;
import reobf.proghatches.main.MyMod;
import reobf.proghatches.main.asm.repack.objectwebasm.ClassReader;
import reobf.proghatches.main.asm.repack.objectwebasm.ClassWriter;
import reobf.proghatches.main.asm.repack.objectwebasm.tree.ClassNode;
import li.cil.oc.api.machine.Arguments;
import li.cil.oc.api.machine.Context;

Expand All @@ -50,9 +53,7 @@
import java.util.function.BiFunction;
import java.util.function.Supplier;
import java.util.stream.IntStream;
import org.objectweb.asm.ClassReader;
import org.objectweb.asm.ClassWriter;
import org.objectweb.asm.tree.ClassNode;


import com.gtnewhorizons.modularui.api.ModularUITextures;
import com.gtnewhorizons.modularui.api.drawable.IDrawable;
Expand Down Expand Up @@ -348,7 +349,7 @@ public int newUTF8(String value) {

};
ClassNode cn = new ClassNode();
cr.accept(cn, 0);
cr.accept(cn,0);

cn.methods.removeIf(s -> {
if (s.visibleAnnotations != null) {
Expand All @@ -366,7 +367,8 @@ public int newUTF8(String value) {
return false;
});

cn.accept(cw);
cr.accept
(cn, 0);

return load(cw.toByteArray(), "reobf/proghatches/block/TileIOHub$OCApi" + filter + ".class",
"reobf.proghatches.block.TileIOHub$OCApi" + filter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,10 @@ public void update(ICoverable aTileEntity) {
ArrayList<ItemStack> in = multi.getStoredInputs();
in.removeIf(s -> s.stackSize <= 0);
if (in.isEmpty()) {
on = false;
if(multi.mDualInputHatches.stream().map(s->s.getFirstNonEmptyInventory().orElse(null))
.count()==0)
inputon = false;

}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,11 @@ public int doCoverThings(ForgeDirection side, byte aInputRedstone, int aCoverID,
if(multi.getStoredFluids().isEmpty()){
ArrayList<ItemStack> in = multi.getStoredInputs();
in.removeIf(s->s.stackSize<=0);
if(in.isEmpty()){on=false;}
if(in.isEmpty()){
if(multi.mDualInputHatches.stream().map(s->s.getFirstNonEmptyInventory().orElse(null))
.count()==0)
on = false;
}
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ private FluidTank[] initFluidTack(FluidTank[] t) {
public boolean isAccessibleForMulti() {

return !isEmpty()&&
tickFirstClassify+5<currentTick();
tickFirstClassify+2<currentTick();
//wait for possible future input, to take better adventage of parallels
}
public long currentTick(){
Expand Down Expand Up @@ -1207,13 +1207,13 @@ public int compareTo(PiorityBuffer o) {



return (Optional) inv0.stream().filter(DualInvBuffer::isAccessibleForMulti)
return (Optional) inv0.stream().filter(not(DualInvBuffer::isEmpty))
.map(s->new PiorityBuffer(s))
.sorted().map(s->{return s.buff;})
.findFirst();
}else{

return (Optional) inv0.stream().filter(DualInvBuffer::isAccessibleForMulti)
return (Optional) inv0.stream().filter(not(DualInvBuffer::isEmpty))
.findFirst();


Expand All @@ -1232,14 +1232,17 @@ public Iterator<? extends IDualInputInventory> inventories() {
dirty=true;

if(Config.experimentalOptimize){

return inv0.stream().filter(DualInvBuffer::isAccessibleForMulti)
.map(s->new PiorityBuffer(s))
.sorted().map(s->{return s.buff;}).iterator();
// return inv0.stream().filter(DualInvBuffer::isAccessibleForMulti).iterator();
}
return inv0.stream().filter(DualInvBuffer::isAccessibleForMulti).iterator();

}




@Override
public void getWailaNBTData(EntityPlayerMP player, TileEntity tile, NBTTagCompound tag, World world, int x, int y,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import javax.annotation.Nullable;

import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.ISidedInventory;
import net.minecraft.item.ItemStack;
Expand Down Expand Up @@ -241,7 +242,8 @@ public List<ItemStack> filterTakable(TileEntity e) {
ForgeDirection dir = this.getBaseMetaTileEntity().getFrontFacing();
// for(ForgeDirection dir:ForgeDirection.VALID_DIRECTIONS){
for (int i : side.getAccessibleSlotsFromSide(dir.ordinal())) {
if (side.canExtractItem(i, side.getStackInSlot(i), dir.ordinal()))
if (side.getStackInSlot(i)!=null&&
side.canExtractItem(i, side.getStackInSlot(i), dir.ordinal()))
slots.add(i);
}
;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -555,6 +555,7 @@ private Widget createButton(Supplier<Boolean> getter, Consumer<Boolean> setter,
}
@Override
public void loadNBTData(NBTTagCompound aNBT) {

getProxy().readFromNBT(aNBT);
super.loadNBTData(aNBT);
piority=aNBT.getInteger("piority");
Expand All @@ -576,9 +577,13 @@ public void saveNBTData(NBTTagCompound aNBT) {
}
aNBT.setInteger("piority", piority);
aNBT.setBoolean("sticky", sticky);
}@Override
public void onFacingChange() {
updateValidGridProxySides();
}
@Override
public void setItemNBT(NBTTagCompound aNBT) {

final NBTTagList tItemList = new NBTTagList();
for (int i = 0; i < getRealInventory().length; i++) {
final ItemStack tStack = getRealInventory()[i];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -486,6 +486,10 @@ public void addUIWidgets(Builder builder, UIBuildContext buildContext) {



}
@Override
public void onFacingChange() {
updateValidGridProxySides();
}
private Widget createButton(Supplier<Boolean> getter, Consumer<Boolean> setter, IDrawable picture,
List<String> tooltip, int offset) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
import com.google.common.collect.ImmutableList;
import com.gtnewhorizon.structurelib.alignment.constructable.ISurvivalConstructable;
import com.gtnewhorizon.structurelib.structure.IStructureDefinition;
import com.gtnewhorizon.structurelib.structure.IStructureElement;
import com.gtnewhorizon.structurelib.structure.IStructureElementChain;
import com.gtnewhorizon.structurelib.structure.ISurvivalBuildEnvironment;
import com.gtnewhorizon.structurelib.structure.StructureDefinition;
import com.gtnewhorizon.structurelib.structure.StructureUtility;
import com.gtnewhorizons.modularui.api.drawable.IDrawable;
Expand Down Expand Up @@ -130,26 +133,52 @@ public boolean addOutputHatchToMachineList(IGregTechTileEntity aTileEntity, int

return ok; };

@SuppressWarnings("unchecked")
IStructureDefinition<IngredientDistributor> STRUCTURE_DEFINITION = StructureDefinition.<IngredientDistributor> builder()
.addShape("first", StructureUtility.transpose (new String[][] { { "m","f","c"}, { "m","f","c"}, { "m","f","c"}} ))
.addShape("second", StructureUtility.transpose (new String[][] { { "m","f","c"}, { "~","c","c"}, { "m","c","c"} } ))
.addShape("third", StructureUtility.transpose (new String[][] { { "m","f","c"}, { "m","c","c"}, { "◎","c","c"} }))
.addShape("piece", StructureUtility.transpose (new String[][] { { " "," "," "}, { " ","f"," "}, { "h","h","h"} }))
.addShape("piece_survival", StructureUtility.transpose (new String[][] { { " "," "," "}, { " ","f"," "}, { "h","※","h"} }))

.addShape("last", StructureUtility.transpose (new String[][] { { " "," "," "}, { " ","f"," "}, { " ","f"," "} }))

.addElement('c', ofBlock(GregTech_API.sBlockCasings4, 12))
.addElement('f', GT_StructureUtility.ofFrame(Materials.Terbium))
.addElement('h', buildHatchAdder(IngredientDistributor.class)
.atLeast(GT_HatchElement.OutputBus,GT_HatchElement.OutputHatch)
.addElement('h',
buildHatchAdder(IngredientDistributor.class)
.atLeast(GT_HatchElement.OutputBus.withAdder(IngredientDistributor::addBus)
.withCount(s->s.hasBusThisLayer?1:0)
,GT_HatchElement.OutputHatch.withAdder(IngredientDistributor::addHatch)
.withCount(s->s.hasHatchThisLayer?1:0)
)
//.shouldSkip((a,b)->a.hasBusThisLayer)
.casingIndex(CASING_INDEX).dot(1)
.buildAndChain(GregTech_API.sBlockCasings4, 12))
.buildAndChain(GregTech_API.sBlockCasings4, 0)
)
.addElement('※',
buildHatchAdder(IngredientDistributor.class)
.atLeast(GT_HatchElement.OutputBus.withAdder(IngredientDistributor::addBus)
.withCount(s->s.hasBusThisLayer?1:0)
,GT_HatchElement.OutputHatch.withAdder(IngredientDistributor::addHatch)
.withCount(s->s.hasHatchThisLayer?1:0)
).allowOnly(ForgeDirection.DOWN)
//.shouldSkip((a,b)->a.hasBusThisLayer)
.casingIndex(CASING_INDEX).dot(1)
.buildAndChain(GregTech_API.sBlockCasings4, 0)
)



.addElement('m', buildHatchAdder(IngredientDistributor.class)
.atLeast(GT_HatchElement.Maintenance,GT_HatchElement.Energy)
.casingIndex(CASING_INDEX).dot(3)
.buildAndChain(GregTech_API.sBlockCasings4, 12))

.addElement('◎', buildHatchAdder(IngredientDistributor.class)
.atLeast(new IHatchElement<IngredientDistributor>(){
.atLeast(

new IHatchElement<IngredientDistributor>(){

@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
Expand All @@ -173,8 +202,9 @@ public long count(IngredientDistributor t) {
return t.mDualInputHatches.size();
}}

,GT_HatchElement.InputBus,GT_HatchElement.InputHatch

,GT_HatchElement.InputBus
,GT_HatchElement.InputHatch

).casingIndex(CASING_INDEX).dot(2).build()

Expand All @@ -198,7 +228,7 @@ public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {

return new IngredientDistributor(mName);
}
protected static final int CASING_INDEX = 49+11;
protected static final int CASING_INDEX = 49+11-12;
@Override
public ITexture[] getTexture(IGregTechTileEntity baseMetaTileEntity, ForgeDirection side, ForgeDirection facing,
int colorIndex, boolean active, boolean redstoneLevel) {
Expand Down Expand Up @@ -247,13 +277,41 @@ protected GT_Multiblock_Tooltip_Builder createTooltip() {
public boolean isCorrectMachinePart(ItemStack aStack) {

return true;
}

@Override
public int survivalConstruct(ItemStack stackSize, int elementBudget, ISurvivalBuildEnvironment env){

if (mMachine)
return -1;
int b= survivialBuildPiece("first", stackSize, 1, 1, 0,elementBudget, env, false,true);
if(b>0)return b;
b=survivialBuildPiece("second", stackSize, 0, 1, 0,elementBudget, env, false,true);
if(b>0)return b;
b=survivialBuildPiece("third", stackSize, -1, 1, 0,elementBudget, env, false,true);
if(b>0)return b;


int size=stackSize.stackSize+1;
int index=-2;

while(true){
b=survivialBuildPiece("piece_survival", stackSize,index, 1, 0,elementBudget, env, false,true);
if(b>0)return b;
index--;if(--size==0)break;

};
return survivialBuildPiece("last", stackSize, index, 1, 0,elementBudget, env, false,true);



}
@Override
public void construct(ItemStack stackSize, boolean hintsOnly) {
buildPiece("first", stackSize, hintsOnly, 1, 1, 0);
buildPiece("second", stackSize, hintsOnly, 0, 1, 0);
buildPiece("third", stackSize, hintsOnly, -1, 1, 0);
int size=stackSize.stackSize;
int size=stackSize.stackSize+1;
int index=-2;
while(buildPiece("piece", stackSize, hintsOnly, index, 1, 0)){

Expand All @@ -277,7 +335,7 @@ public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack a
};


return checkPiece("last", index, 1, 0);
return checkPiece("last", index, 1, 0)&&this.mEnergyHatches.size()>0;



Expand Down Expand Up @@ -765,4 +823,13 @@ ButtonWidget createBlockingModeButton(IWidgetBuilder<?> builder) {

return (ButtonWidget) button;
}
public static boolean addHatch(IngredientDistributor thiz, IGregTechTileEntity aTileEntity,short s){
if(thiz.hasHatchThisLayer){return false;}
return thiz.addOutputHatchToMachineList(aTileEntity, s);
}
public static boolean addBus(IngredientDistributor thiz, IGregTechTileEntity aTileEntity,short s){
if(thiz.hasBusThisLayer){return false;}
return thiz.addOutputBusToMachineList(aTileEntity, s);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
import reobf.proghatches.gt.metatileentity.ProgrammingCircuitProvider;
import reobf.proghatches.gt.metatileentity.ProviderChainer;
import reobf.proghatches.gt.metatileentity.ProgrammingCircuitProvider.CircuitProviderPatternDetial;
import reobf.proghatches.gt.metatileentity.ProgrammingCircuitProviderPrefabricated;
import reobf.proghatches.gt.metatileentity.util.ICircuitProvider;
import reobf.proghatches.item.ItemProgrammingCircuit;
import reobf.proghatches.main.Config;
Expand Down Expand Up @@ -135,7 +136,7 @@ public void onFirstTick(IGregTechTileEntity aBaseMetaTileEntity) {
Function<IGT_HatchAdder<? super LargeProgrammingCircuitProvider>, IHatchElement<LargeProgrammingCircuitProvider>> provider = s -> new IHatchElement<LargeProgrammingCircuitProvider>() {
@Override
public List<? extends Class<? extends IMetaTileEntity>> mteClasses() {
return ImmutableList.of(ProgrammingCircuitProvider.class, ProviderChainer.class);
return ImmutableList.of(ProgrammingCircuitProvider.class, ProviderChainer.class,ProgrammingCircuitProviderPrefabricated.class);
}

@Override
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/reobf/proghatches/main/FakeHost.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import net.minecraftforge.common.util.ForgeDirection;

public class FakeHost extends TileEntity implements IInterfaceHost, IUpgradeableHost, IPriorityHost, ICustomNameObject {

public FakeHost(TileEntity coverHost, IInterfaceHost realCover) {
super();
if (coverHost != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ public class Label {
* Field used to associate user information to a label. Warning: this field
* is used by the ASM tree package. In order to use it with the ASM tree
* package you must override the
* {@link org.objectweb.asm.tree.MethodNode#getLabelNode} method.
* {@link reobf.proghatches.main.asm.repack.objectwebasm.tree.MethodNode#getLabelNode} method.
*/
public Object info;

Expand Down
Loading

0 comments on commit fda5a47

Please sign in to comment.