Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
reobf committed Jun 16, 2024
1 parent e722915 commit 89248de
Show file tree
Hide file tree
Showing 17 changed files with 492 additions and 135 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.15p5'
String versionOverride = '0.0.15p6'
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
20 changes: 14 additions & 6 deletions src/main/java/reobf/proghatches/eucrafting/AECover.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
import net.minecraftforge.common.DimensionManager;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.Fluid;
import reobf.proghatches.main.Config;
import reobf.proghatches.main.MyMod;

public class AECover extends GT_CoverBehaviorBase<AECover.Data> {
Expand Down Expand Up @@ -487,11 +488,17 @@ public void placeCover(ForgeDirection side, ItemStack aCover, ICoverable aTileEn
super.placeCover(side, aCover, aTileEntity);

Data data = ((Data) aTileEntity.getComplexCoverDataAtSide(side));

data.accept(side, aTileEntity);
data.setTag(aCover.getTagCompound());

}

@Override
public void onPlayerAttach(EntityPlayer player, ItemStack aCover, ICoverable aTileEntity, ForgeDirection side) {

Data data = (InterfaceData) aTileEntity.getComplexCoverDataAtSide(side);
data.getProxy().setOwner(player);
}
protected boolean onCoverRightClickImpl(ForgeDirection side, int aCoverID, Data aCoverVariable,
ICoverable aTileEntity, EntityPlayer aPlayer, float aX, float aY, float aZ) {
if (aCoverVariable.nonShiftClick(side, aCoverID, aCoverVariable, aTileEntity, aPlayer)) {
Expand Down Expand Up @@ -650,9 +657,9 @@ protected Data doCoverThingsImpl(ForgeDirection side, byte aInputRedstone, int a
MyMod.LOG.info("Node connect@" + data.getPos());
} catch (FailedConnection e) {

System.out.println(item.a());
System.out.println(item.b());
System.out.println(thenode);
//System.out.println(item.a());
//System.out.println(item.b());
//System.out.println(thenode);
e.printStackTrace();
}

Expand Down Expand Up @@ -759,11 +766,12 @@ public boolean allowsCopyPasteTool() {

@Override
public boolean isCoverPlaceable(ForgeDirection side, ItemStack aStack, ICoverable aTileEntity) {
/*if (aTileEntity instanceof IGridProxyable && ((IGridProxyable) aTileEntity).getProxy() != null) {
if (!Config.MECover&&aTileEntity instanceof IGridProxyable && ((IGridProxyable) aTileEntity).getProxy() != null) {
return false;
} // cannot be placed on ME hatches
*/


return super.isCoverPlaceable(side, aStack, aTileEntity);
}

}
24 changes: 22 additions & 2 deletions src/main/java/reobf/proghatches/eucrafting/InterfaceData.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import java.util.ArrayList;
import java.util.EnumSet;
import com.google.common.collect.ImmutableSet;
import com.gtnewhorizons.modularui.api.screen.ModularWindow.Builder;

import appeng.api.config.Actionable;
import appeng.api.config.Upgrades;
import appeng.api.implementations.IUpgradeableHost;
Expand All @@ -13,6 +15,7 @@
import appeng.api.networking.events.MENetworkChannelsChanged;
import appeng.api.networking.events.MENetworkEventSubscribe;
import appeng.api.networking.events.MENetworkPowerStatusChange;
import appeng.api.networking.security.ISecurityProvider;
import appeng.api.networking.ticking.IGridTickable;
import appeng.api.networking.ticking.TickRateModulation;
import appeng.api.networking.ticking.TickingRequest;
Expand All @@ -31,6 +34,8 @@
import appeng.util.Platform;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.relauncher.Side;
import gregtech.api.gui.modularui.GT_CoverUIBuildContext;
import net.minecraft.init.Items;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.InventoryCrafting;
import net.minecraft.item.ItemStack;
Expand Down Expand Up @@ -378,7 +383,7 @@ public TickRateModulation tickingRequest(IGridNode node, int TicksSinceLastCall)
}

public String getCustomName() {
if (name != null)
if (name != null&&name.length()>=0)
return name;
return nameOverride();
}
Expand All @@ -393,7 +398,16 @@ public boolean hasCustomName() {

public void setCustomName(String name) {
this.name = name;

if(name==null||name.isEmpty()){
NBTTagCompound tg = this.getTag();
tg.removeTag("display");
this.setTag(tg);
return;
}
ItemStack is=new ItemStack(Items.apple);
is.setTagCompound(this.getTag());
is.setStackDisplayName(name);
this.setTag(is.getTagCompound());
}

public int getPriority() {
Expand Down Expand Up @@ -441,5 +455,11 @@ public boolean firstUpdate() {
public TileEntity fakeTile() {
return faketile;
}
@Override
public void addUIWidgets(Builder builder, GT_CoverUIBuildContext gt_CoverUIBuildContext) {

}



}
Original file line number Diff line number Diff line change
@@ -0,0 +1,236 @@
package reobf.proghatches.gt.metatileentity;
import gregtech.api.enums.ItemList;
import gregtech.api.enums.Materials;
import gregtech.api.enums.OrePrefixes;

import static gregtech.api.enums.ItemList.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Table;

import gregtech.api.GregTech_API;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch;
import gregtech.api.render.TextureFactory;
import gregtech.api.util.GT_OreDictUnificator;
import net.minecraft.item.ItemStack;
import net.minecraft.util.StatCollector;
import net.minecraftforge.common.util.ForgeDirection;
import reobf.proghatches.block.BlockIOHub;
import reobf.proghatches.gt.metatileentity.util.ICircuitProvider;
import reobf.proghatches.item.ItemProgrammingCircuit;
import reobf.proghatches.main.MyMod;
import reobf.proghatches.main.registration.Registration;

public class ProgrammingCircuitProviderPrefabricated extends GT_MetaTileEntity_Hatch implements ICircuitProvider{
public ProgrammingCircuitProviderPrefabricated(int aID, String aName, String aNameRegional, int aTier, int aInvSlotCount,int i) {
super(aID, aName, aNameRegional, aTier, aInvSlotCount,
reobf.proghatches.main.Config.get("PCPP", ImmutableMap.of(
"type",
StatCollector.translateToLocal("circuitprovider.prefab."+i+".type.name")


))

);
Registration.items.add(new ItemStack(GregTech_API.sBlockMachines, 1, aID));
this.index=i;
}


@Override
public boolean isFacingValid(ForgeDirection facing) {

return true;
}



public ProgrammingCircuitProviderPrefabricated(String aName, int aTier, int aInvSlotCount, String[] aDescription,
ITexture[][][] aTextures,int i) {
super(aName, aTier, aInvSlotCount, aDescription, aTextures);
this.index=i;
}


@Override
public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {

return new ProgrammingCircuitProviderPrefabricated(mName, mTier, mInventory.length, mDescriptionArray, mTextures,index);

}


@Override
public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, ForgeDirection side, ForgeDirection aFacing,
int colorIndex, boolean aActive, boolean redstoneLevel) {

return super.getTexture(aBaseMetaTileEntity, side, aFacing, colorIndex, aActive, redstoneLevel);

}

@Override
public ITexture[] getTexturesActive(ITexture aBaseTexture) {

return new ITexture[] { aBaseTexture, TextureFactory.builder()
.setFromBlock(MyMod.iohub, BlockIOHub.magicNO_provider_in_active_overlay).glow().build() };
}

@Override
public ITexture[] getTexturesInactive(ITexture aBaseTexture) {

return new ITexture[] { aBaseTexture, TextureFactory.of(MyMod.iohub, BlockIOHub.magicNO_provider_in_overlay) };
}


@Override
public void clearDirty() {


}


@Override
public boolean patternDirty() {

return false;
}

int index;
static public Map<Integer,Collection<ItemStack>> prefab=new HashMap<>();
static{
reg(0,GregTech_API.getConfigurationCircuitList(100));
ItemList[][] all = new ItemList[][]{{
Shape_Mold_Bottle,
Shape_Mold_Plate,
Shape_Mold_Ingot,
Shape_Mold_Casing,
Shape_Mold_Gear,
Shape_Mold_Gear_Small,
Shape_Mold_Credit,
Shape_Mold_Nugget,
Shape_Mold_Block,
Shape_Mold_Ball,
Shape_Mold_Bun,
Shape_Mold_Bread,
Shape_Mold_Baguette,
Shape_Mold_Cylinder,
Shape_Mold_Anvil,
Shape_Mold_Arrow,
Shape_Mold_Name,
Shape_Mold_Rod,
Shape_Mold_Bolt,
Shape_Mold_Round,
Shape_Mold_Screw,
Shape_Mold_Ring,
Shape_Mold_Rod_Long,
Shape_Mold_Rotor,
Shape_Mold_Turbine_Blade,
Shape_Mold_Pipe_Tiny,
Shape_Mold_Pipe_Small,
Shape_Mold_Pipe_Medium,
Shape_Mold_Pipe_Large,
Shape_Mold_Pipe_Huge,
Shape_Mold_ToolHeadDrill,},
{ Shape_Slicer_Flat,
Shape_Slicer_Stripes,},{
Shape_Extruder_Bottle,
Shape_Extruder_Plate,
Shape_Extruder_Cell,
Shape_Extruder_Ring,
Shape_Extruder_Rod,
Shape_Extruder_Bolt,
Shape_Extruder_Ingot,
Shape_Extruder_Wire,
Shape_Extruder_Casing,
Shape_Extruder_Pipe_Tiny,
Shape_Extruder_Pipe_Small,
Shape_Extruder_Pipe_Medium,
Shape_Extruder_Pipe_Large,
Shape_Extruder_Pipe_Huge,
Shape_Extruder_Block,
Shape_Extruder_Sword,
Shape_Extruder_Pickaxe,
Shape_Extruder_Shovel,
Shape_Extruder_Axe,
Shape_Extruder_Hoe,
Shape_Extruder_Hammer,
Shape_Extruder_File,
Shape_Extruder_Saw,
Shape_Extruder_Gear,
Shape_Extruder_Rotor,
Shape_Extruder_Turbine_Blade,
Shape_Extruder_Small_Gear,
Shape_Extruder_ToolHeadDrill,
},{
White_Dwarf_Shape_Extruder_Bottle,
White_Dwarf_Shape_Extruder_Plate,
White_Dwarf_Shape_Extruder_Cell,
White_Dwarf_Shape_Extruder_Ring,
White_Dwarf_Shape_Extruder_Rod,
White_Dwarf_Shape_Extruder_Bolt,
White_Dwarf_Shape_Extruder_Ingot,
White_Dwarf_Shape_Extruder_Wire,
White_Dwarf_Shape_Extruder_Casing,
White_Dwarf_Shape_Extruder_Pipe_Tiny,
White_Dwarf_Shape_Extruder_Pipe_Small,
White_Dwarf_Shape_Extruder_Pipe_Medium,
White_Dwarf_Shape_Extruder_Pipe_Large,
White_Dwarf_Shape_Extruder_Pipe_Huge,
White_Dwarf_Shape_Extruder_Block,
White_Dwarf_Shape_Extruder_Sword,
White_Dwarf_Shape_Extruder_Pickaxe,
White_Dwarf_Shape_Extruder_Shovel,
White_Dwarf_Shape_Extruder_Axe,
White_Dwarf_Shape_Extruder_Hoe,
White_Dwarf_Shape_Extruder_Hammer,
White_Dwarf_Shape_Extruder_File,
White_Dwarf_Shape_Extruder_Saw,
White_Dwarf_Shape_Extruder_Gear,
White_Dwarf_Shape_Extruder_Rotor,
White_Dwarf_Shape_Extruder_Turbine_Blade,
White_Dwarf_Shape_Extruder_Small_Gear,
White_Dwarf_Shape_Extruder_ToolHeadDrill}};

int i=1;
for(ItemList[] t:all){
reg(i++,Arrays.stream(t)
.map(s->s.get(1)).collect(Collectors.toList()))
;


}

ArrayList<ItemStack> is= new ArrayList<>();
for(Materials mat: Materials.values()){


ItemStack opt= GT_OreDictUnificator.get(OrePrefixes.lens.get(mat),null, 1,false,false);
if(opt!=null)is.add(opt);
//System.out.println(is);
reg(5,is);
}


}
static private void reg(int a,Collection<ItemStack> raw){
prefab.put(a,raw.stream().map(ItemProgrammingCircuit::wrap)
.collect(Collectors.toList()));
}

@Override
public Collection<ItemStack> getCircuit() {
return prefab.get(index);
}
}
Loading

0 comments on commit 89248de

Please sign in to comment.