Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
reobf committed Sep 30, 2024
1 parent 94d4b0d commit 5f269df
Show file tree
Hide file tree
Showing 17 changed files with 690 additions and 91 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.19p3'
String versionOverride = '0.0.19p4'
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
16 changes: 10 additions & 6 deletions src/main/java/reobf/proghatches/ae/PartAmountMaintainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ public void requestForMissing(IAEStack primitive){



@SuppressWarnings({ "rawtypes", "unchecked" })
@SuppressWarnings({ "rawtypes", "unchecked", "deprecation" })
@Override
public TickRateModulation tickingRequest(IGridNode node, int TicksSinceLastCall) {

Expand All @@ -191,7 +191,10 @@ public TickRateModulation tickingRequest(IGridNode node, int TicksSinceLastCall)
boolean red=this.getHost().hasRedstone(this.getSide());
boolean should=shouldProceed(red,lastredstone);
lastredstone=red;
if(!should){return TickRateModulation.SAME;}
if(!should){
handlerHash.clear();
inv.clear();
return TickRateModulation.SAME;}
if(getProxy().isActive()==false)return TickRateModulation.SAME;
for(StorageChannel ch:new StorageChannel[]{StorageChannel.FLUIDS,StorageChannel.ITEMS})
{
Expand All @@ -200,8 +203,9 @@ public TickRateModulation tickingRequest(IGridNode node, int TicksSinceLastCall)

IItemList list;
if(inv instanceof IMEMonitor){
inv.injectItems(EMPTY.get(ch), Actionable.MODULATE, source);//dirty hack, trigger update
list = ((IMEMonitor) inv).getStorageList();
// inv.injectItems(EMPTY.get(ch), Actionable.MODULATE, source);//dirty hack, trigger update
// cache is invalid! just use the deprecated way to get the inv
list = ((IMEMonitor) inv).getAvailableItems(ch.createList());

}else{
list=inv.getAvailableItems(ch.createList());
Expand Down Expand Up @@ -415,7 +419,7 @@ public ModularWindow createWindow(UIBuildContext buildContext) {

builder.widget( TextWidget.dynamicString(()->{
try{
PartP2PTunnel p2p = getProxy().getP2P().getInput(freq);
PartP2PTunnel p2p =freq==0?null: getProxy().getP2P().getInput(freq);
if(p2p.isActive()&&p2p.isPowered()){
return StatCollector.translateToLocal("proghatches.amountmaintainer.redstone.online");
}}catch(Exception e){}
Expand Down Expand Up @@ -643,7 +647,7 @@ public int getSlotLimit(int slot) {
public Boolean getSignal(){

try {
PartP2PTunnel p2p = getProxy().getP2P().getInput(freq);
PartP2PTunnel p2p =freq==0?null: getProxy().getP2P().getInput(freq);
if(p2p!=null){
if(p2p.isActive()&&p2p.isPowered()){

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@
import com.gtnewhorizons.modularui.common.widget.SlotWidget;
import com.gtnewhorizons.modularui.common.widget.SyncedWidget;
import com.gtnewhorizons.modularui.common.widget.TextWidget;

import appeng.me.storage.DriveWatcher;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
Expand Down Expand Up @@ -129,7 +131,7 @@ public int getInventoryFluidLimit() {
return (int) Math.min(val, Integer.MAX_VALUE); */
//return super.getInventoryFluidLimit();
return (int) ((int) (32000 * Math.pow(2, mTier) / (mMultiFluid ? 4 : 1)));
}
public int fluidLimit() {
Expand Down Expand Up @@ -1224,6 +1226,7 @@ public void loadNBTData(NBTTagCompound aNBT) {
final int ii = i;
inv0.get(i).fromTag((NBTTagCompound) aNBT.getTag("BUFFER_" + ii));
}
merge = aNBT.getBoolean("merge");
justHadNewItems = aNBT.getBoolean("justHadNewItems");
updateEveryTick = aNBT.getBoolean("updateEveryTick");
preventSleep=aNBT.getInteger("preventSleep");
Expand All @@ -1236,7 +1239,8 @@ public void saveNBTData(NBTTagCompound aNBT) {
for (int i = 0; i < bufferNum; i++)

aNBT.setTag("BUFFER_" + i, inv0.get(i).toTag());


aNBT.setBoolean("merge", merge);
aNBT.setBoolean("justHadNewItems", justHadNewItems);
aNBT.setBoolean("updateEveryTick", updateEveryTick);
aNBT.setInteger("preventSleep",preventSleep );
Expand Down Expand Up @@ -1359,12 +1363,20 @@ public int compareTo(PiorityBuffer o) {
private Predicate<DualInvBuffer> not(Predicate<DualInvBuffer> s) {
return s.negate();
}

boolean merge;
@Override
public Iterator<? extends IDualInputInventory> inventories() {
markDirty();
dirty=true;



if(merge){
return mergeSame();

}


if(Config.experimentalOptimize){

return inv0.stream().filter(DualInvBuffer::isAccessibleForMulti)
Expand Down Expand Up @@ -1615,15 +1627,16 @@ public void updateSlots() {
super.updateSlots();
}


@Override
public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) {

mergeSame().forEachRemaining(s->{
/*mergeSame().forEachRemaining(s->{
System.out.println(s);
System.out.println(Arrays.toString(s.getItemInputs()));
});
});*/
BaseMetaTileEntity tile = (BaseMetaTileEntity) this.getBaseMetaTileEntity();
if (tile.isServerSide()) {
if (!tile.privateAccess() || aPlayer.getDisplayName().equalsIgnoreCase(tile.getOwnerName())) {
Expand Down Expand Up @@ -1656,6 +1669,30 @@ public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlaye
}

}
if (tCurrentItem != null) {
boolean suc = false;
for (int id : OreDictionary.getOreIDs(tCurrentItem)) {
if (OreDictionary.getOreName(id).equals(ToolDictNames.craftingToolSaw.toString())) {
suc = true;
break;
}
;
}
if (suc) {
GT_ModHandler.damageOrDechargeItem(tCurrentItem, 1, 1000, aPlayer);
GT_Utility.sendSoundToPlayers(tile.getWorld(), SoundResource.IC2_TOOLS_CHAINSAW_CHAINSAW_USE_TWO, 1.0F, -1,
tile.getXCoord(), tile.getYCoord(), tile.getZCoord());
/*merge = !merge;
GT_Utility.sendChatToPlayer(aPlayer, "merge:" + merge);
aPlayer.addChatMessage(new ChatComponentTranslation("programmable_hatches.gt.merge"));
*/
markDirty();
return true;
}

}
}
}

Expand Down Expand Up @@ -1800,6 +1837,7 @@ public boolean equals(Object obj) {
);
return (Iterator<? extends IDualInputInventory>) a.asMap().values().stream().map(
s->{
if(s.size()==1){return s.iterator().next();}
return new IDualInputInventory(){
void init(){
Iterator<DualInvBuffer> itr = s.iterator();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
package reobf.proghatches.gt.metatileentity;

import gregtech.api.GregTech_API;
import gregtech.api.enums.Textures;
import gregtech.api.interfaces.IIconContainer;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.metatileentity.BaseMetaTileEntity;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch;
import gregtech.api.render.TextureFactory;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.common.util.ForgeDirection;
import reobf.proghatches.main.registration.Registration;

public class CommunicationPortHatch extends GT_MetaTileEntity_Hatch{
public CommunicationPortHatch(int aID, String aName, String aNameRegional, int aTier
) {
super(aID, aName, aNameRegional, aTier, 0, new String[0] );
Registration.items.add(new ItemStack(GregTech_API.sBlockMachines, 1, aID));
}
public CommunicationPortHatch(String aName, int aTier, String[] aDescription,
ITexture[][][] aTextures) {
super(aName, aTier, 0, aDescription, aTextures);

}
@Override
public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {

return new CommunicationPortHatch(mName, mTier, mDescriptionArray, mTextures);
}
private static final IIconContainer textureFont = new Textures.BlockIcons.CustomIcon("icons/NeutronSensorFont");
private static final IIconContainer textureFont_Glow = new Textures.BlockIcons.CustomIcon(
"icons/NeutronSensorFont_GLOW");

@Override
public ITexture[] getTexturesActive(ITexture aBaseTexture) {
return new ITexture[] { aBaseTexture, TextureFactory.of(textureFont), TextureFactory.builder()
.addIcon(textureFont_Glow)
.glow()
.build() };
}

@Override
public ITexture[] getTexturesInactive(ITexture aBaseTexture) {
return new ITexture[] { aBaseTexture, TextureFactory.of(textureFont) };
}

@Override
public boolean isValidSlot(int aIndex) {
return false;
}

@Override
public boolean isSimpleMachine() {
return true;
}

@Override
public boolean isFacingValid(ForgeDirection facing) {
return true;
}
@Override
public boolean allowGeneralRedstoneOutput() {
return true;
}
@Override
public boolean isAccessAllowed(EntityPlayer aPlayer) {
return true;
}
public void setRS(boolean porton) {

for(ForgeDirection s:ForgeDirection.values())
this.getBaseMetaTileEntity().setInternalOutputRedstoneSignal(s, (byte) (porton?15:0));

((BaseMetaTileEntity) this.getBaseMetaTileEntity()). updateNeighbours(0xff,0xff);//set all bits to 1 to update all 6 sides

}
@Override
public void initDefaultModes(NBTTagCompound aNBT) {
for(ForgeDirection s:ForgeDirection.values())
this.getBaseMetaTileEntity().setInternalOutputRedstoneSignal(s, (byte) 0);
}

}
Loading

0 comments on commit 5f269df

Please sign in to comment.