Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
reobf committed Nov 4, 2024
1 parent 0508af0 commit c31dccd
Show file tree
Hide file tree
Showing 26 changed files with 804 additions and 70 deletions.
87 changes: 87 additions & 0 deletions src/main/java/reobf/proghatches/ae/BlockCraftingCondenser.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
package reobf.proghatches.ae;

import java.util.List;

import appeng.block.crafting.BlockCraftingUnit;
import appeng.block.crafting.ItemCraftingStorage;
import appeng.client.texture.ExtraBlockTextures;
import appeng.tile.crafting.TileCraftingStorageTile;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;

public class BlockCraftingCondenser extends BlockCraftingUnit {

public BlockCraftingCondenser(int tier) {
this.setTileEntity(TileCraftingCondenser.class);
setBlockName("proghatches.craftingdumper."+tier);
setBlockTextureName("?");setHardness(1);
this.tier=tier;
}

@Override
public Class<ItemCraftingStorage> getItemBlockClass() {
return ItemCraftingStorage.class;
}

ExtraBlockTextures[] nfit=
{
ExtraBlockTextures. BlockCraftingStorage1k,
ExtraBlockTextures. BlockCraftingStorage4k,
ExtraBlockTextures. BlockCraftingStorage16k,
ExtraBlockTextures. BlockCraftingStorage64k,
ExtraBlockTextures. BlockCraftingStorage256k,
ExtraBlockTextures. BlockCraftingStorage1024k,
ExtraBlockTextures. BlockCraftingStorage4096k,
ExtraBlockTextures. BlockCraftingStorage16384k,
ExtraBlockTextures. BlockCraftingStorageSingularity };
ExtraBlockTextures[] fit=
{
ExtraBlockTextures. BlockCraftingStorage1kFit,
ExtraBlockTextures. BlockCraftingStorage4kFit,
ExtraBlockTextures. BlockCraftingStorage16kFit,
ExtraBlockTextures. BlockCraftingStorage64kFit,
ExtraBlockTextures. BlockCraftingStorage256kFit,
ExtraBlockTextures. BlockCraftingStorage1024kFit,
ExtraBlockTextures. BlockCraftingStorage4096kFit,
ExtraBlockTextures. BlockCraftingStorage16384kFit,
ExtraBlockTextures. BlockCraftingStorageSingularityFit
};
int[] num={1,4,16,64,256,1024,4096,16384,Integer.MAX_VALUE};


@Override
public IIcon getIcon(final int direction, final int metadata) {
if((metadata &8)>0){


return fit[tier].getIcon();

}

return nfit[tier].getIcon();
}

@Override
@SideOnly(Side.CLIENT)
public void getCheckedSubBlocks(final Item item, final CreativeTabs tabs, final List<ItemStack> itemStacks) {
itemStacks.add(new ItemStack(this, 1, 0));
}
int tier;
public int getSkips() {
return num[tier];
}

public void addTips(List<String> toolTip) {
toolTip.add(StatCollector.translateToLocalFormatted("proghatches.craftingdumper.tooltip.0",num[tier]));

}


}
6 changes: 6 additions & 0 deletions src/main/java/reobf/proghatches/ae/ICondenser.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package reobf.proghatches.ae;

public interface ICondenser {
public int getSkips();
public default boolean isinf(){return false;}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import appeng.api.AEApi;
import appeng.api.parts.IPartItem;
import appeng.core.Api;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.renderer.texture.IIconRegister;
Expand Down Expand Up @@ -81,7 +82,7 @@ public void registerIcons(IIconRegister _iconRegister) {
@Override
public IIcon getIconIndex(ItemStack p_77650_1_) {

return super.getIconIndex(p_77650_1_);
return Api.INSTANCE.blocks().blockFluix.block().getIcon(0, 0);
}
@Override
@SideOnly(Side.CLIENT)
Expand Down
42 changes: 42 additions & 0 deletions src/main/java/reobf/proghatches/ae/TileCraftingCondenser.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@

package reobf.proghatches.ae;

import net.minecraft.block.Block;
import net.minecraft.item.ItemStack;

import appeng.api.AEApi;
import appeng.api.definitions.IBlocks;
import appeng.block.crafting.BlockAdvancedCraftingStorage;
import appeng.block.crafting.BlockSingularityCraftingStorage;
import appeng.tile.crafting.TileCraftingTile;

public class TileCraftingCondenser extends TileCraftingTile implements ICondenser {


public TileCraftingCondenser(){


}

@Override
public boolean isAccelerator() {
return false;
}

@Override
public boolean isStorage() {
return false;
}
@Override
public boolean isinf() {
// TODO Auto-generated method stub
return getSkips()==Integer.MAX_VALUE;
}
@Override
public int getSkips() {

return ((BlockCraftingCondenser)getBlockType()).getSkips();
}


}
9 changes: 7 additions & 2 deletions src/main/java/reobf/proghatches/block/ItemBlockTooltip.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import reobf.proghatches.lang.LangManager;
Expand Down Expand Up @@ -36,8 +38,11 @@ public int getMetadata(int p_77647_1_) {

return (p_77647_1_);
}


@Override
public boolean getHasSubtypes() {

return true;
}
@Override
public String getUnlocalizedName(ItemStack stack) {
if(field_150939_a instanceof INameAndTooltips){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,42 @@ public ItemStack simulateSimilarRemove(int amount, ItemStack filter, FuzzyMode f
IInventoryDestination destination) {
return invItems != null ? invItems.simulateSimilarRemove(amount, filter, fuzzyMode, destination) : null;
}

private int checkItemFluids(IFluidHandler tank, InventoryAdaptor inv, ForgeDirection direction) {
if (tank == null && inv == null)
return 2;

if (tank != null && tank.getTankInfo(direction) != null) {
List<FluidTankInfo[]> tankInfos = (List)new LinkedList<>();

if (false) {} else {
tankInfos.add(tank.getTankInfo(direction));
}
boolean hasTank = false;
for (FluidTankInfo[] tankInfoArray : tankInfos) {
for (FluidTankInfo tankInfo : tankInfoArray) {
hasTank = true;
FluidStack fluid = tankInfo.fluid;
if (fluid != null && fluid.amount > 0)
return 1;
}
}
if (!hasTank && inv == null)
return 2;
}
if (isGTMachine(tank))
return gtMachineCircuitCheck(inv);
return (inv != null && inv.containsItems()) ? 1 : 0;
}
private boolean isGTMachine(Object o) {

if (o instanceof TileEntity) {
TileEntity te = (TileEntity)o;
return te.getBlockType().getUnlocalizedName().equals("gt.blockmachines");
}
return false;
}

private int checkItemFluids0(IFluidHandler tank, InventoryAdaptor inv, ForgeDirection direction) {
if (tank == null && inv == null) {
return 2;
}
Expand Down Expand Up @@ -186,7 +220,11 @@ public ItemStack simulateAdd(ItemStack toBeSimulated) {
return simulateAdd(toBeSimulated, InsertionMode.DEFAULT);
}
@Override
public boolean containsItems() {
public boolean containsItems() {




return checkItemFluids(this.invFluids, this.invItems, this.fd) > 0;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ChatComponentTranslation;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.Fluid;
Expand Down Expand Up @@ -616,15 +617,23 @@ public ItemStack[] getItemInputs() {

ItemStack[] condensed = filterStack.apply(mStoredItemInternal,shared.getItems());


if(!trunOffEnsure){condensed=ensureIntMax(condensed);}




return condensed;


}

@Override
public FluidStack[] getFluidInputs() {

return asFluidStack.apply(mStoredFluidInternal,shared.getFluid());
FluidStack[] condensed = asFluidStack.apply(mStoredFluidInternal,shared.getFluid());
if(!trunOffEnsure){condensed=ensureIntMax(condensed);}

return condensed;
}

public int space() {
Expand Down Expand Up @@ -1118,7 +1127,7 @@ public boolean onKeyPressed(char character, int keyCode) {
});
return wd;
}

static int EX_CONFIG=985211;
private NBTTagCompound cv(String s) {
try {
return (NBTTagCompound) JsonToNBT.func_150315_a(s);
Expand All @@ -1130,7 +1139,11 @@ private NBTTagCompound cv(String s) {
ButtonWidget createPowerSwitchButton(IWidgetBuilder<?> builder) {
IGregTechTileEntity thiz = this.getBaseMetaTileEntity();
Widget button = new ButtonWidget().setOnClick((clickData, widget) -> {

if(clickData.shift==true){
if(widget.getContext().isClient()==false)widget.getContext().openSyncedWindow(EX_CONFIG);
return;

}
if (thiz.isAllowedToWork()) {
thiz.disableWorking();
} else {
Expand Down Expand Up @@ -1169,7 +1182,7 @@ public void addUIWidgets(Builder builder, UIBuildContext buildContext) {
}



buildContext.addSyncedWindow(EX_CONFIG, (s) -> createWindowEx(s));


//.setPos(new Pos2d(getGUIWidth() - 18 - 3, 5)).setSize(16, 16)
Expand Down Expand Up @@ -1900,4 +1913,42 @@ static public boolean fluidEquals(FluidTank a, FluidTank b) {

return true;
}
protected ModularWindow createWindowEx(final EntityPlayer player) {

final int WIDTH = 18 * 6 + 6;
final int HEIGHT = 18 * 4 + 6;
final int PARENT_WIDTH = getGUIWidth();
final int PARENT_HEIGHT = getGUIHeight();
ModularWindow.Builder builder = ModularWindow.builder(WIDTH, HEIGHT);
builder.setBackground(GT_UITextures.BACKGROUND_SINGLEBLOCK_DEFAULT);
builder.setGuiTint(getGUIColorization());
builder.setDraggable(true);


builder.setPos((size, window) -> Alignment.Center.getAlignedPos(size, new Size(PARENT_WIDTH, PARENT_HEIGHT))
.add(Alignment.TopRight.getAlignedPos(new Size(PARENT_WIDTH, PARENT_HEIGHT), new Size(WIDTH, HEIGHT))));

builder.widget(new CycleButtonWidget().setToggle(() -> updateEveryTick, (s) -> {
updateEveryTick = s;

}).setStaticTexture(GT_UITextures.OVERLAY_BUTTON_CHECKMARK)
.setVariableBackground(GT_UITextures.BUTTON_STANDARD_TOGGLE).setTooltipShowUpDelay(TOOLTIP_DELAY)
.setPos(3 + 18 * 0, 3 + 18 * 0).setSize(18, 18)
.setGTTooltip(() -> mTooltipCache.getData("programmable_hatches.gt.forcecheck"))

);
builder.widget(new CycleButtonWidget().setToggle(() ->!trunOffEnsure , (s) -> {
trunOffEnsure =! s;

}).setStaticTexture(GT_UITextures.OVERLAY_BUTTON_CHECKMARK)
.setVariableBackground(GT_UITextures.BUTTON_STANDARD_TOGGLE).setTooltipShowUpDelay(TOOLTIP_DELAY)
.setPos(3 + 18 * 1, 3 + 18 * 0).setSize(18, 18)
.addTooltip(StatCollector.translateToLocal("programmable_hatches.gt.ensureintmax.0"))
.addTooltip(StatCollector.translateToLocal("programmable_hatches.gt.ensureintmax.1"))
.addTooltip(StatCollector.translateToLocal("programmable_hatches.gt.ensureintmax.2"))
.addTooltip(StatCollector.translateToLocal("programmable_hatches.gt.ensureintmax.3"))
);
return builder.build();

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

import org.spongepowered.asm.mixin.Unique;

import com.glodblock.github.common.item.ItemFluidDrop;
import com.google.common.collect.HashMultimap;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.TreeMultimap;
Expand Down Expand Up @@ -158,7 +159,7 @@ public void overridedBehoviour(int minPull) {
.getCellArray(StorageChannel.ITEMS);

for(IMEInventoryHandler l:list){
if(!(l instanceof MEInventoryHandler))continue;
// if(!(l instanceof MEInventoryHandler))continue;
/* if(l instanceof MEInventoryHandler){
MEInventoryHandler hh=(MEInventoryHandler) l;
if((hh.getInternal() instanceof MEPassThrough)) continue;
Expand Down Expand Up @@ -191,7 +192,7 @@ public void add(final IAEItemStack option) {
if (option == null) {
return;
}

if(option.getItem()instanceof ItemFluidDrop){return;}
final IAEItemStack st = this.records.get(option);

if (st != null) {
Expand Down Expand Up @@ -228,7 +229,7 @@ public void addStorage(final IAEItemStack option) {
if (option == null) {
return;
}

if(option.getItem()instanceof ItemFluidDrop){return;}
final IAEItemStack st = this.records.get(option);

if (st != null) {
Expand Down Expand Up @@ -449,7 +450,7 @@ private BaseActionSource getRequestSource() {
@Override
public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) {

/*try {
try {
System.out.println(overridedExtract(
((IStorageGrid) this.getProxy().getNode().getGrid().getCache(IStorageGrid.class)).getItemInventory(),

Expand All @@ -459,7 +460,7 @@ public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlaye
} catch (Exception e) {

e.printStackTrace();
}*/
}

return super.onRightclick(aBaseMetaTileEntity, aPlayer);
}
Expand Down
Loading

0 comments on commit c31dccd

Please sign in to comment.