Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
reobf committed Jun 17, 2024
1 parent 89248de commit c867180
Show file tree
Hide file tree
Showing 15 changed files with 342 additions and 88 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.15p6'
String versionOverride = '0.0.15p8'
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
6 changes: 5 additions & 1 deletion src/main/java/reobf/proghatches/block/BlockIOHub.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,12 @@ public void registerBlockIcons(IIconRegister reg) {

@Override
public void onBlockPlacedBy(World worldIn, int x, int y, int z, EntityLivingBase placer, ItemStack itemIn) {
// TODO Auto-generated method stub

super.onBlockPlacedBy(worldIn, x, y, z, placer, itemIn);
try{
((TileIOHub)worldIn.getTileEntity(x, y, z)
).getProxy().setOwner((EntityPlayer) placer);
}catch(Exception e){e.printStackTrace();}
}

@Override
Expand Down
44 changes: 38 additions & 6 deletions src/main/java/reobf/proghatches/eucrafting/AECover.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
import net.minecraft.client.Minecraft;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTBase;
import net.minecraft.nbt.NBTTagCompound;
Expand Down Expand Up @@ -201,6 +202,16 @@ public TileEntity fakeTile() {
}

public static interface Data extends ISerializableObject, IGridProxyable {
default String tagName(){
NBTTagCompound tag = getTag();
if(tag==null)return null;
ItemStack is=new ItemStack(Items.apple);
is.setTagCompound(tag);
if(is.hasDisplayName())return is.getDisplayName();
return null;
}
default String name(){return null;}
default boolean dualityName(){return false;}
// AENetworkProxy gridProxy;
// ForgeDirection side=ForgeDirection.UNKNOWN;
// DimensionalCoord pos=new DimensionalCoord(0, 0, 0, 0);
Expand Down Expand Up @@ -399,7 +410,7 @@ default boolean supportFluid() {
return false;
}

default public void accept(ForgeDirection side, ICoverable aTileEntity) {
default public void accept(ForgeDirection side, ICoverable aTileEntity,boolean onPlace) {
setPos(new DimensionalCoord((TileEntity) aTileEntity));
setSide(side);
Optional.ofNullable(aTileEntity.getCoverItemAtSide(side)).filter(s -> s.hasDisplayName())
Expand Down Expand Up @@ -448,7 +459,28 @@ public Data createDataObject(int aLegacyData) {
@Override
protected ItemStack getDisplayStackImpl(int aCoverID, Data aCoverVariable) {
ItemStack is = super.getDisplayStackImpl(aCoverID, aCoverVariable);
is.setTagCompound(aCoverVariable.getTag());




if(aCoverVariable.dualityName()){
String s=aCoverVariable.name();
if(s==null||s.equals("")){
is.stackTagCompound=null;
}else{
is.setStackDisplayName(s);
}

}
else{
String s=aCoverVariable.tagName();
if(s!=null&&!s.equals("")){
is.setStackDisplayName(s);
}
}



return is;
}

Expand Down Expand Up @@ -488,15 +520,15 @@ 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());
data.accept(side, aTileEntity,false);


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

Data data = (InterfaceData) aTileEntity.getComplexCoverDataAtSide(side);
Data data = (Data) aTileEntity.getComplexCoverDataAtSide(side);
data.getProxy().setOwner(player);
}
protected boolean onCoverRightClickImpl(ForgeDirection side, int aCoverID, Data aCoverVariable,
Expand Down Expand Up @@ -589,7 +621,7 @@ static public boolean canConnect(Object obj, ForgeDirection dir) {
protected Data doCoverThingsImpl(ForgeDirection side, byte aInputRedstone, int aCoverID, Data data,
ICoverable aTileEntity, long aTimer) {
if (data.firstUpdate())
data.accept(side, aTileEntity);
data.accept(side, aTileEntity,false);

if (!data.getProxy().isReady()) {
data.getProxy().onReady();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package reobf.proghatches.eucrafting;

import net.minecraftforge.common.util.ForgeDirection;

public interface IActualSideProvider {
public ForgeDirection getActualSide();
}
32 changes: 25 additions & 7 deletions src/main/java/reobf/proghatches/eucrafting/InterfaceData.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import java.util.ArrayList;
import java.util.EnumSet;
import com.google.common.collect.ImmutableSet;
import com.google.common.io.ByteArrayDataInput;
import com.gtnewhorizons.modularui.api.screen.ModularWindow.Builder;

import appeng.api.config.Actionable;
Expand All @@ -15,11 +16,14 @@
import appeng.api.networking.events.MENetworkChannelsChanged;
import appeng.api.networking.events.MENetworkEventSubscribe;
import appeng.api.networking.events.MENetworkPowerStatusChange;
import appeng.api.networking.security.IActionHost;
import appeng.api.networking.security.ISecurityProvider;
import appeng.api.networking.ticking.IGridTickable;
import appeng.api.networking.ticking.TickRateModulation;
import appeng.api.networking.ticking.TickingRequest;
import appeng.api.parts.IPartHost;
import appeng.api.storage.data.IAEItemStack;
import appeng.api.util.AECableType;
import appeng.api.util.DimensionalCoord;
import appeng.api.util.IConfigManager;
import appeng.api.util.IConfigurableObject;
Expand All @@ -35,6 +39,9 @@
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.relauncher.Side;
import gregtech.api.gui.modularui.GT_CoverUIBuildContext;
import gregtech.api.util.ISerializableObject;
import io.netty.buffer.ByteBuf;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.init.Items;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.InventoryCrafting;
Expand All @@ -47,8 +54,11 @@
import reobf.proghatches.main.FakeHost;

public class InterfaceData implements Data, IInterfaceHost, IGridTickable, IUpgradeableHost, ICustomNameObject,
IConfigurableObject, IPriorityHost {
IConfigurableObject, IPriorityHost,
IActualSideProvider
{
public void setTag(NBTTagCompound tagCompound) {

tag = tagCompound;
}

Expand Down Expand Up @@ -108,12 +118,8 @@ public void onReady() {
};

private TileEntity faketile = new TileEntity();
private final DualityInterface duality = new DI(this.getProxy(), this);;

public interface IActualSideProvider {
public ForgeDirection getActualSide();
private final DI duality = new DI(this.getProxy(), this);;

}

public static class Disabled0 extends AppEngInternalAEInventory implements DisabledInventory {
public Disabled0(IAEAppEngInventory te, int s) {
Expand Down Expand Up @@ -383,8 +389,11 @@ public TickRateModulation tickingRequest(IGridNode node, int TicksSinceLastCall)
}

public String getCustomName() {
if (name != null&&name.length()>=0)
if (name != null&&name.length()>0){
//System.out.println(name.length());

return name;
}
return nameOverride();
}
private String nameOverride(){
Expand All @@ -400,8 +409,10 @@ public void setCustomName(String name) {
this.name = name;
if(name==null||name.isEmpty()){
NBTTagCompound tg = this.getTag();
if(tg!=null){
tg.removeTag("display");
this.setTag(tg);
}
return;
}
ItemStack is=new ItemStack(Items.apple);
Expand Down Expand Up @@ -461,5 +472,12 @@ public void addUIWidgets(Builder builder, GT_CoverUIBuildContext gt_CoverUIBuild
}


@Override
public ForgeDirection getActualSide() {

return duality.getActualSide();
}



}
Loading

0 comments on commit c867180

Please sign in to comment.