Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
reobf committed Aug 9, 2024
1 parent b9a4768 commit fa9c24c
Show file tree
Hide file tree
Showing 6 changed files with 87 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1429,6 +1429,8 @@ public void startRecipeProcessing() {

@Override
public void updateSlots() {


if (this.getBaseMetaTileEntity().isServerSide()) {
for (int i = 0; i < getMaxType(); i++) {
if (mStoredFluid[i].getFluid() != null && mStoredFluid[i].getFluidAmount() <= 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,18 @@

import com.google.common.collect.ImmutableMap;

import appeng.api.networking.crafting.ICraftingMedium;
import appeng.api.networking.crafting.ICraftingProvider;
import appeng.api.util.IInterfaceViewable;
import appeng.helpers.ICustomNameObject;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.ChatComponentTranslation;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;

Expand All @@ -28,15 +33,20 @@
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.metatileentity.MetaTileEntity;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_InputBus;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase;
import gregtech.api.recipe.check.CheckRecipeResult;
import gregtech.api.recipe.check.CheckRecipeResultRegistry;
import gregtech.api.render.TextureFactory;
import gregtech.common.tileentities.machines.GT_MetaTileEntity_Hatch_CraftingInput_ME;
import gregtech.common.tileentities.machines.IDualInputHatch;
import gregtech.common.tileentities.machines.IDualInputInventory;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import reobf.proghatches.gt.metatileentity.util.IRecipeProcessingAwareDualHatch;
import reobf.proghatches.main.registration.Registration;

public class DualInputHatchSlave<T extends MetaTileEntity & IDualInputHatch> extends GT_MetaTileEntity_Hatch_InputBus
implements IDualInputHatch {
implements IDualInputHatch , IRecipeProcessingAwareDualHatch {

private T master; // use getMaster() to access
private int masterX, masterY, masterZ;
Expand Down Expand Up @@ -239,15 +249,34 @@ public void getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDat
+ tag.getInteger("masterZ"));
}

/*
* if (tag.hasKey("masterName")) {
* currenttip.add(EnumChatFormatting.GOLD + tag.getString("masterName")
* + EnumChatFormatting.RESET); }
*/

if (tag.hasKey("masterName")) {
currenttip.add(EnumChatFormatting.GOLD + tag.getString("masterName")
+ EnumChatFormatting.RESET); }


super.getWailaBody(itemStack, currenttip, accessor, config);
}


public String getNameOf(T tg) {

if(tg instanceof ICustomNameObject){
ICustomNameObject iv=(ICustomNameObject) tg;
if(iv.hasCustomName())
return iv.getCustomName();

}

StringBuilder name = new StringBuilder();
if (tg instanceof ICraftingMedium &&((ICraftingMedium)tg).getCrafterIcon() != null) {
name.append(((ICraftingMedium)tg).getCrafterIcon().getDisplayName());
} else {
name.append(tg.getLocalName());
}


return name.toString();
}
@Override
public void getWailaNBTData(EntityPlayerMP player, TileEntity tile, NBTTagCompound tag, World world, int x, int y,
int z) {
Expand All @@ -257,12 +286,34 @@ public void getWailaNBTData(EntityPlayerMP player, TileEntity tile, NBTTagCompou
tag.setInteger("masterX", masterX);
tag.setInteger("masterY", masterY);
tag.setInteger("masterZ", masterZ);
}
}
if (getMaster() != null) tag.setString("masterName", getNameOf(getMaster()));
/*
* if (getMaster() != null) tag.setString("masterName",
* getMaster().getnam);
*/

super.getWailaNBTData(player, tile, tag, world, x, y, z);
}

@Override
public void startRecipeProcessing() {

if(getMaster() != null)
if(getMaster() instanceof IRecipeProcessingAwareDualHatch)
((IRecipeProcessingAwareDualHatch)getMaster()).startRecipeProcessing();

}

@Override
public CheckRecipeResult endRecipeProcessing(GT_MetaTileEntity_MultiBlockBase controller) {
if(getMaster() != null)
if(getMaster() instanceof IRecipeProcessingAwareDualHatch)
((IRecipeProcessingAwareDualHatch)getMaster()).endRecipeProcessing(controller);
return CheckRecipeResultRegistry.SUCCESSFUL;
}
@Override
public List<ItemStack> getItemsForHoloGlasses() {
return getMaster() != null ? getMaster().getItemsForHoloGlasses() : null;
}
}
3 changes: 2 additions & 1 deletion src/main/java/reobf/proghatches/main/MyMod.java
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@
import reobf.proghatches.oc.WirelessPeripheralManager;
import reobf.proghatches.util.ProghatchesUtil;
import tconstruct.armor.player.TPlayerStats;
import thaumcraft.common.entities.golems.ItemGolemCore;

@Mod(modid = Tags.MODID, version = Tags.VERSION, name = Tags.MODNAME, acceptedMinecraftVersions = "[1.7.10]",
dependencies = "required-after:appliedenergistics2;required-after:gregtech;"
Expand All @@ -132,7 +133,7 @@
)
public class MyMod {
public static MyMod instance;
{CraftFromPatternTask.class.getDeclaredFields();
{ItemGolemCore.class.getDeclaredFields();
// BaseMetaPipeEntity.class.getDeclaredFields();
instance = this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ public List<String> getMixins() {
if(ff)retLate.add("MixinNoFuzzyForProgrammingCircuit");
if(ff)retLate.add("MixinHandleProgrammingOnRecipeStart");
retLate.add("MixinCraftFromPatternTaskPatch");
retLate.add("MixinGloemCore");
retLate.add("MixinGolemCore");


if (FMLLaunchHandler.side().isClient()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ private boolean shouldPatch(){
}
return shouldPatch();
}
@Shadow
@Shadow (remap=false)
protected IAEItemStack[] patternInputs;
@Inject(method="<init>",at = { @At("RETURN") })
@Inject(method="<init>",at = { @At("RETURN") },remap=false)
public void calculateOneStep(CraftingRequest<IAEItemStack> request, ICraftingPatternDetails pattern,
int priority, boolean allowSimulation, boolean isComplex,CallbackInfo xx){
if(shouldPatch())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;

import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
Expand All @@ -21,18 +22,18 @@
import thaumcraft.common.entities.golems.ItemGolemCore;

@Mixin(value=ItemGolemCore.class,remap=false)
public class MixinGloemCore {
@Shadow
public IIcon[] icon;

public class MixinGolemCore extends Item{

public IIcon iconEx;
private static int damage=200;



@Inject(method = "registerIcons", at = @At("HEAD"),remap=false)
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister ir,CallbackInfo c) {
icon=new IIcon[icon.length+1];
this.icon[12] = ir.registerIcon("thaumcraft:golem_core_fish");
iconEx = ir.registerIcon("thaumcraft:golem_core_fish");

}

Expand All @@ -41,9 +42,22 @@ public void registerIcons(IIconRegister ir,CallbackInfo c) {
@SideOnly(Side.CLIENT)
public void getSubItems(Item par1, CreativeTabs par2CreativeTabs, List par3List,CallbackInfo c) {


par3List.add(new ItemStack(this, 1, damage));
}

@Inject(method = "getIconFromDamage", at = @At("HEAD"),remap=false,cancellable=true)
@SideOnly(Side.CLIENT)
public void getIconFromDamage(int d,CallbackInfoReturnable c) {
if(d==damage)c.setReturnValue((Object)iconEx);
}











Expand Down

0 comments on commit fa9c24c

Please sign in to comment.