Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
reobf committed Nov 15, 2024
1 parent 7729a10 commit 20a6366
Show file tree
Hide file tree
Showing 33 changed files with 2,702 additions and 33 deletions.
95 changes: 95 additions & 0 deletions src/main/java/reobf/proghatches/ae/ItemPartMAP2P.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
package reobf.proghatches.ae;

import java.util.List;

import javax.annotation.Nullable;

import appeng.api.AEApi;
import appeng.api.parts.IPart;
import appeng.api.parts.IPartItem;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import gregtech.api.enums.GT_Values;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import reobf.proghatches.eucrafting.PartLazerP2P;

public class ItemPartMAP2P extends Item implements IPartItem {
@SideOnly(Side.CLIENT)
private IIcon icon;


public ItemPartMAP2P() {
this.setMaxStackSize(64);

AEApi.instance().partHelper().setItemBusRenderer(this);
setHasSubtypes(true);
}

@Nullable
@Override
public IPart createPartFromItemStack(ItemStack is) {
return new PartMAP2P(is);
}
@Override
public String getItemStackDisplayName(ItemStack stack) {
/*int damage=stack.getItemDamage();
if(damage>=1&&damage<=15){
return StatCollector.translateToLocalFormatted("item.proghatches.part.eu.source.superconduct.name",GT_Values.VN[damage-1]);
}
if(damage>=16&&damage<=30){
return StatCollector.translateToLocalFormatted("item.proghatches.part.eu.source.normal.name",GT_Values.VN[damage-16]);
} */
return super.getItemStackDisplayName(stack);
}

@Override
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side,
float xOffset, float yOffset, float zOffset) {
return AEApi.instance().partHelper().placeBus(player.getHeldItem(), x, y, z, side, player, world);
}

/*
* public ItemPartEUSource register() { //if (!Config.fluidIOBus) return
* null; GameRegistry.registerItem(this, NameConst.ITEM_PART_FLUID_EXPORT,
* FluidCraft.MODID); //setCreativeTab(FluidCraftingTabs.INSTANCE); return
* this; }
*/
@SideOnly(Side.CLIENT)
@Override
public void registerIcons(IIconRegister register) {

this.icon = register.registerIcon("appliedenergistics2:ItemPart.P2PTunnel");
}
@SideOnly(Side.CLIENT)
@Override
public IIcon getIconFromDamage(int dmg) {
return icon;
}
/*
@Override
public IIcon getIconIndex(ItemStack p_77650_1_) {
return PartEUSource.a;
}*/
@Override
@SideOnly(Side.CLIENT)
public int getSpriteNumber() {
return 0;
}
@SideOnly(value=Side.CLIENT)
@Override
public void addInformation(ItemStack p_77624_1_, EntityPlayer p_77624_2_, List p_77624_3_, boolean p_77624_4_) {
p_77624_3_.add(StatCollector.translateToLocal("item.proghatches.part.ma.p2p.tooltips.0"));
p_77624_3_.add(StatCollector.translateToLocal("item.proghatches.part.ma.p2p.tooltips.1"));
p_77624_3_.add(StatCollector.translateToLocal("item.proghatches.part.ma.p2p.tooltips.2"));
//
super.addInformation(p_77624_1_, p_77624_2_, p_77624_3_, p_77624_4_);
}

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



import java.util.List;

import javax.annotation.Nullable;

import appeng.api.AEApi;
import appeng.api.parts.IPart;
import appeng.api.parts.IPartItem;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import reobf.proghatches.eucrafting.PartEUP2PInterface;

public class ItemPartStockingExportBus extends Item implements IPartItem {

public ItemPartStockingExportBus() {
this.setMaxStackSize(64);

AEApi.instance().partHelper().setItemBusRenderer(this);
}
@Override
public void getSubItems(Item itemIn, CreativeTabs p_150895_2_, List list) {

list.add(new ItemStack(itemIn, 1, 0));
list.add(new ItemStack(itemIn, 1, 1));
//list.add(new ItemStack(itemIn, 1, 1));
// list.add(new ItemStack(itemIn, 1, 2));
}

@Override
public boolean getHasSubtypes() {

return true;
}
@Override
public String getUnlocalizedName(ItemStack stack) {

return super.getUnlocalizedName(stack)+"."+stack.getItemDamage();
}
@Nullable
@Override
public IPart createPartFromItemStack(ItemStack is) {
if(is.getItemDamage()==1) return new PartStockingFluidExportBus(is);

return new PartStockingExportBus(is);
}
@SideOnly(value=Side.CLIENT)
@Override
public void addInformation(ItemStack p_77624_1_, EntityPlayer p_77624_2_, List p_77624_3_, boolean p_77624_4_) {
p_77624_3_.add(StatCollector.translateToLocal("item.stockingexport.name.tooltip.0."+p_77624_1_.getItemDamage()));
p_77624_3_.add(StatCollector.translateToLocal("item.stockingexport.name.tooltip.1."+p_77624_1_.getItemDamage()));

//p_77624_3_.add(StatCollector.translateToLocal("item.amountmaintainer.name.tooltip.1"));
//p_77624_3_.add(StatCollector.translateToLocal("item.amountmaintainer.name.tooltip.2"));

super.addInformation(p_77624_1_, p_77624_2_, p_77624_3_, p_77624_4_);
}
@Override
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side,
float xOffset, float yOffset, float zOffset) {
return AEApi.instance().partHelper().placeBus(player.getHeldItem(), x, y, z, side, player, world);
}

/*
* public ItemPartEUSource register() { //if (!Config.fluidIOBus) return
* null; GameRegistry.registerItem(this, NameConst.ITEM_PART_FLUID_EXPORT,
* FluidCraft.MODID); //setCreativeTab(FluidCraftingTabs.INSTANCE); return
* this; }
*/
@SideOnly(Side.CLIENT)
@Override
public void registerIcons(IIconRegister _iconRegister) {

itemIcon=_iconRegister.registerIcon("proghatches:proxy_item_part");
alt=_iconRegister.registerIcon("proghatches:proxy_fluid_part");
alt2=_iconRegister.registerIcon("proghatches:proxy_item_adv_part");
}
IIcon alt;
IIcon alt2;
@Override
public IIcon getIconIndex(ItemStack p_77650_1_) {
if(p_77650_1_.getItemDamage()==1)return alt;
if(p_77650_1_.getItemDamage()==0)return alt2;
return super.getIconIndex(p_77650_1_);
}
@Override
@SideOnly(Side.CLIENT)
public int getSpriteNumber() {
return 0;
}

}

95 changes: 95 additions & 0 deletions src/main/java/reobf/proghatches/ae/PartAmountMaintainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.concurrent.Future;

import com.glodblock.github.common.item.ItemFluidDrop;
Expand Down Expand Up @@ -67,6 +68,7 @@
import appeng.api.storage.data.IAEItemStack;
import appeng.api.storage.data.IAEStack;
import appeng.api.storage.data.IItemList;
import appeng.api.util.IConfigManager;
import appeng.client.texture.CableBusTextures;
import appeng.core.Api;
import appeng.core.api.definitions.ApiItems;
Expand Down Expand Up @@ -107,6 +109,75 @@

public class PartAmountMaintainer extends PartBasicState implements IGuiProvidingPart,IGridTickable,IPowerChannelState, ICraftingRequester{

@Override
public IConfigManager getConfigManager() {

return new IConfigManager() {

@Override
public void writeToNBT(NBTTagCompound data) {
data.setLong("freq", freq);
data.setInteger("mode", mode);
data.setInteger("rsmode", rsmode);
data.setInteger("redstone", redstone);
data.setLong("amount", amount);
//data.setBoolean("lastredstone", lastredstone);
if(mark[0]!=null)data.setTag("mark", mark[0].writeToNBT(new NBTTagCompound()));
//if(upgrade[0]!=null)data.setTag("upgrade", upgrade[0].writeToNBT(new NBTTagCompound()));
//if(upgrade[1]!=null)data.setTag("upgrade1", upgrade[1].writeToNBT(new NBTTagCompound()));



}

@Override
public void registerSetting(Settings settingName, Enum<?> defaultValue) {


}

@Override
public void readFromNBT(NBTTagCompound data) {
freq=data.getLong("freq");
mode=data.getInteger("mode");
rsmode=data.getInteger("rsmode");
redstone=data.getInteger("redstone");
amount=data.getLong("amount");
//lastredstone=data.getBoolean("lastredstone" );
if(data.getCompoundTag("mark").hasNoTags()==false)
mark[0]=ItemStack.loadItemStackFromNBT(data.getCompoundTag("mark"));
//upgrade[0]=ItemStack.loadItemStackFromNBT(data.getCompoundTag("upgrade"));
//upgrade[1]=ItemStack.loadItemStackFromNBT(data.getCompoundTag("upgrade1"));





}

@Override
public Enum<?> putSetting(Settings settingName, Enum<?> newValue) {

return null;
}

@Override
public Set<Settings> getSettings() {

return null;
}

@Override
public Enum<?> getSetting(Settings settingName) {

return null;
}
};
}




private int mode;
private int rsmode;

Expand Down Expand Up @@ -862,4 +933,28 @@ public void validateLink(){


}
/*
@Override
public Set<Settings> getSettings() {
return null;
}
@Override
public void registerSetting(Settings settingName, Enum<?> defaultValue) {
}
@Override
public Enum<?> getSetting(Settings settingName) {
return null;
}
@Override
public Enum<?> putSetting(Settings settingName, Enum<?> newValue) {
return null;
}*/
}
Loading

0 comments on commit 20a6366

Please sign in to comment.