feat: fixes, features

...and me being too lazy to write a proper commit message
This commit is contained in:
LordMZTE 2022-10-23 22:29:34 +02:00
parent a1ecb870e3
commit 2f77e5c471
Signed by: LordMZTE
GPG key ID: B64802DC33A64FF6
21 changed files with 842 additions and 544 deletions

View file

@ -27,13 +27,14 @@ import atomicscience.fenlie.TFissionReactor;
import atomicscience.fenlie.TNuclearBoiler;
import atomicscience.fenlie.TReactorTap;
import atomicscience.hecheng.BElectromagnet;
import atomicscience.hecheng.BElectromagnetBoiler;
import atomicscience.hecheng.BElectromagnetGlass;
import atomicscience.hecheng.BFusionReactor;
import atomicscience.hecheng.BPlasma;
import atomicscience.hecheng.IBAccelerator;
import atomicscience.hecheng.IBPlasma;
import atomicscience.hecheng.IBSiren;
import atomicscience.hecheng.TElectromagnet;
import atomicscience.hecheng.TElectromagnetBoiler;
import atomicscience.hecheng.TFusionReactor;
import atomicscience.jiqi.BChemicalExtractor;
import atomicscience.jiqi.BFunnel;
@ -130,6 +131,7 @@ public class AtomicScience {
public static Block bFusionReactor;
public static BPlasma bPlasma;
public static Block bElectromagnet;
public static Block bElectromagnetBoiler;
public static Block bChemicalExtractor;
public static Block bSiren;
public static Block bElectromagnetGlass;
@ -219,7 +221,8 @@ public class AtomicScience {
bThermometer = new BThermometer();
bFusionReactor = new BFusionReactor();
bPlasma = new BPlasma();
bElectromagnet = new BElectromagnet();
bElectromagnet= new BElectromagnet();
bElectromagnetBoiler = new BElectromagnetBoiler();
bChemicalExtractor = new BChemicalExtractor();
bSiren = new BSiren();
bElectromagnetGlass = new BElectromagnetGlass();
@ -297,6 +300,7 @@ public class AtomicScience {
GameRegistry.registerBlock(bFusionReactor, "bFusionReactor");
GameRegistry.registerBlock(bPlasma, IBPlasma.class, "bPlasma");
GameRegistry.registerBlock(bElectromagnet, "bElectromagnet");
GameRegistry.registerBlock(bElectromagnetBoiler, "bElectromagnetBoiler");
GameRegistry.registerBlock(bChemicalExtractor, "bChemicalExtractor");
GameRegistry.registerBlock(bSiren, IBSiren.class, "bSiren");
GameRegistry.registerBlock(bElectromagnetGlass, "bElectromagnetGlass");
@ -328,8 +332,7 @@ public class AtomicScience {
AtomicScience.CONFIGURATION.save();
MinecraftForge.EVENT_BUS.register(itCellAntimatter);
MinecraftForge.EVENT_BUS.register(FulminationEventHandler.INSTANCE);
OreDictionary.registerOre("ingotUranium", itUranium);
OreDictionary.registerOre("breederUranium", new ItemStack(itUranium, 1, 1));
OreDictionary.registerOre("breederUranium", itUranium);
OreDictionary.registerOre("blockRadioactive", blockRadioactive);
OreDictionary.registerOre("cellEmpty", itCell);
OreDictionary.registerOre("cellUranium", itCellUranium);
@ -357,7 +360,7 @@ public class AtomicScience {
GameRegistry.registerTileEntity(TTurbine.class, "ASTurbine");
GameRegistry.registerTileEntity(TNuclearBoiler.class, "ASNuclearBoiler");
GameRegistry.registerTileEntity(TThermometer.class, "ASThermometer");
GameRegistry.registerTileEntity(TElectromagnet.class, "ASElectromagnet");
GameRegistry.registerTileEntity(TElectromagnetBoiler.class, "ASElectromagnetBoiler");
GameRegistry.registerTileEntity(TChemicalExtractor.class,
"ASChemicalExtractor");
GameRegistry.registerTileEntity(TFunnel.class, "ASFunnel");
@ -399,140 +402,8 @@ public class AtomicScience {
@EventHandler
public void postInit(FMLPostInitializationEvent event) {
UniversalRecipes.init();
if (Loader.isModLoaded("IC2")) {
OreDictionary.registerOre("cellEmpty", itCell);
GameRegistry.addRecipe(new ShapelessOreRecipe(
itYellowcake, GameRegistry.findItem("IC2", "reactorUraniumSimple")));
Item ic2FluidCell = GameRegistry.findItem("IC2", "itemFluidCell");
GameRegistry.addRecipe(new ShapelessOreRecipe(ic2FluidCell, itCell));
GameRegistry.addRecipe(new ShapelessOreRecipe(itCell, "cellEmpty"));
}
Recipes.addRecipes();
GameRegistry.addRecipe(new ShapelessOreRecipe(
new ItemStack(itCellAntimatter, 1, 1), itCellAntimatter,
itCellAntimatter, itCellAntimatter, itCellAntimatter, itCellAntimatter,
itCellAntimatter, itCellAntimatter, itCellAntimatter));
GameRegistry.addRecipe(new ShapelessOreRecipe(
new ItemStack(itCellAntimatter, 8, 0),
new Object[] {new ItemStack(itCellAntimatter, 1, 1)}));
GameRegistry.addRecipe(new ShapedOreRecipe(
new ItemStack(bFunnel, 2), " B ", "B B", "B B", 'B', "ingotBronze"));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(bFunnel, 2), " B ",
"B B", "B B", 'B', "ingotIron"));
GameRegistry.addRecipe(new ShapedOreRecipe(
bAtomicAssembler, "CCC", "SXS", "SSS", 'X', bCentrifuge, 'C',
"calclavia:CIRCUIT_T3", 'S', "plateSteel"));
GameRegistry.addRecipe(new ShapedOreRecipe(
bFulminationGenerator, "OSO", "SCS", "OSO", 'O', Blocks.obsidian, 'C',
"calclavia:CIRCUIT_T2", 'S', "plateSteel"));
GameRegistry.addRecipe(new ShapedOreRecipe(
bAccelerator, "SCS", "CMC", "SCS", 'M', "calclavia:MOTOR", 'C',
"calclavia:CIRCUIT_T3", 'S', "plateSteel"));
GameRegistry.addRecipe(new ShapelessOreRecipe(
bElectromagnetGlass, new Object[] {bElectromagnet, Blocks.glass}));
GameRegistry.addRecipe(new ShapedOreRecipe(
bCentrifuge,
new Object[] {"BSB", "MCM", "BSB", Character.valueOf('C'),
"calclavia:CIRCUIT_T2", Character.valueOf('S'),
"plateSteel", Character.valueOf('B'), "ingotBronze",
Character.valueOf('M'), "calclavia:MOTOR"}));
GameRegistry.addRecipe(new ShapedOreRecipe(
bNuclearBoiler,
new Object[] {"S S", "FBF", "SMS", Character.valueOf('F'),
Blocks.furnace, Character.valueOf('S'), "plateSteel",
Character.valueOf('B'), Items.bucket,
Character.valueOf('M'), "calclavia:MOTOR"}));
GameRegistry.addRecipe(new ShapedOreRecipe(
bChemicalExtractor,
new Object[] {"BSB", "MCM", "BSB", Character.valueOf('C'),
"calclavia:CIRCUIT_T3", Character.valueOf('S'),
"plateSteel", Character.valueOf('B'), "ingotBronze",
Character.valueOf('M'), "calclavia:MOTOR"}));
GameRegistry.addRecipe(new ShapedOreRecipe(
new ItemStack(bSiren, 2),
new Object[] {"NPN", Character.valueOf('N'), Blocks.noteblock,
Character.valueOf('P'), "plateBronze"}));
GameRegistry.addRecipe(new ShapedOreRecipe(
bFissionReactor,
new Object[] {"SCS", "MEM", "SCS", Character.valueOf('E'), "cellEmpty",
Character.valueOf('C'), "calclavia:CIRCUIT_T2",
Character.valueOf('S'), "plateSteel",
Character.valueOf('M'), "calclavia:MOTOR"}));
GameRegistry.addRecipe(new ShapedOreRecipe(
bFusionReactor,
new Object[] {"CPC", "PFP", "CPC", Character.valueOf('P'), "plateSteel",
Character.valueOf('F'), bFissionReactor,
Character.valueOf('C'), "calclavia:CIRCUIT_T3"}));
GameRegistry.addRecipe(new ShapedOreRecipe(
bTurbine, new Object[] {" B ", "BMB", " B ", Character.valueOf('B'),
"plateBronze", Character.valueOf('M'),
"calclavia:MOTOR"}));
GameRegistry.addRecipe(new ShapedOreRecipe(
bReactorTap,
new Object[] {"SBS", "TMT", "SBS", Character.valueOf('S'),
"plateBronze", Character.valueOf('T'), "ingotBronze",
Character.valueOf('M'), "calclavia:MOTOR",
Character.valueOf('B'), Items.bucket}));
GameRegistry.addRecipe(new ShapedOreRecipe(
new ItemStack(itCell, 16),
new Object[] {" T ", "TGT", " T ", Character.valueOf('T'), "ingotTin",
Character.valueOf('G'), Blocks.glass}));
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(itCellWater),
itCell, Items.water_bucket));
GameRegistry.addRecipe(new ShapedOreRecipe(
ElectricItemHelper.getUncharged(new ItemStack(itThermometer)),
new Object[] {"SSS", "GCG", "GSG", Character.valueOf('S'), "ingotSteel",
Character.valueOf('G'), Blocks.glass,
Character.valueOf('C'), "calclavia:CIRCUIT_T1"}));
GameRegistry.addRecipe(new ShapedOreRecipe(
bThermometer, new Object[] {"SSS", "SWS", "SSS", Character.valueOf('S'),
"ingotSteel", Character.valueOf('W'),
ElectricItemHelper.getUncharged(
new ItemStack(itThermometer))}));
GameRegistry.addRecipe(new ShapedOreRecipe(
bControlRod, new Object[] {"I", "I", "I", Character.valueOf('I'),
Items.iron_ingot}));
GameRegistry.addRecipe(new ShapedOreRecipe(
itCellUranium,
new Object[] {"CUC", "CUC", "CUC", Character.valueOf('U'),
"ingotUranium", Character.valueOf('C'), "cellEmpty"}));
GameRegistry.addRecipe(new ShapedOreRecipe(
itCellBreederFuel,
new Object[] {"CUC", "CUC", "CUC", Character.valueOf('U'),
"breederUranium", Character.valueOf('C'), "cellEmpty"}));
GameRegistry.addRecipe(new ShapedOreRecipe(
new ItemStack(bElectromagnet, 2),
new Object[] {"BBB", "BMB", "BBB", Character.valueOf('B'),
"ingotBronze", Character.valueOf('M'),
"calclavia:MOTOR"}));
GameRegistry.addRecipe(new ShapedOreRecipe(
new ItemStack(bElectromagnet, 2),
new Object[] {"BBB", "BMB", "BBB", Character.valueOf('B'), "ingotIron",
Character.valueOf('M'), "calclavia:MOTOR"}));
GameRegistry.addRecipe(new ShapedOreRecipe(
itHazmatHelmet,
new Object[] {"SSS", "BAB", "SCS", Character.valueOf('A'),
Items.leather_helmet, Character.valueOf('C'),
"calclavia:CIRCUIT_T1", Character.valueOf('S'),
Blocks.wool}));
GameRegistry.addRecipe(new ShapedOreRecipe(
itHazmatChestplate,
new Object[] {"SSS", "BAB", "SCS", Character.valueOf('A'),
Items.leather, Character.valueOf('C'),
"calclavia:CIRCUIT_T1", Character.valueOf('S'),
Blocks.wool}));
GameRegistry.addRecipe(new ShapedOreRecipe(
itHazmanLeggings,
new Object[] {"SSS", "BAB", "SCS", Character.valueOf('A'),
Items.leather_leggings, Character.valueOf('C'),
"calclavia:CIRCUIT_T1", Character.valueOf('S'),
Blocks.wool}));
GameRegistry.addRecipe(new ShapedOreRecipe(
itHazmatBoots,
new Object[] {"SSS", "BAB", "SCS", Character.valueOf('A'),
Items.leather_boots, Character.valueOf('C'),
"calclavia:CIRCUIT_T1", Character.valueOf('S'),
Blocks.wool}));
EntityRegistry.registerGlobalEntityID(
EMatter.class, "ASParticle", EntityRegistry.findGlobalUniqueEntityId());
EntityRegistry.registerModEntity(EMatter.class, "ASParticle", 49, this, 80,
@ -645,20 +516,6 @@ public class AtomicScience {
}
}
@SubscribeEvent
@SideOnly(Side.CLIENT)
public void textureHook(Post event) {
// TODO: WTF
// if (event.map == Minecraft.getMinecraft().renderEngine.field_94155_m) {
FLUID_URANIUM_HEXAFLOURIDE.setIcons(
event.map.registerIcon("atomicscience:uraniumHexafluoride"));
// TODO: might override railcraft icon?
FLUID_STEAM.setIcons(event.map.registerIcon("atomicscience:steam"));
FLUID_TOXIC_WASTE.setIcons(
event.map.registerIcon("atomicscience:toxicWaste"));
}
// TODO: WTF
// @EventHandler public void serverStarting(FMLServerStartingEvent event) {
// FlagRegistry.registerModFlag(

View file

@ -14,55 +14,62 @@ import net.minecraftforge.fluids.BlockFluidClassic;
import universalelectricity.core.vector.Vector3;
public class BToxicWaste extends BlockFluidClassic {
public BToxicWaste(String name) {
super(AtomicScience.FLUID_TOXIC_WASTE, Material.water);
this.setBlockName("atomicscience:" + name);
this.setCreativeTab(TabAS.INSTANCE);
this.setHardness(100.0F);
this.setLightOpacity(3);
}
@Override
public int tickRate(World par1World) {
return 20;
}
@Override
public void randomDisplayTick(World par1World, int x, int y, int z,
Random par5Random) {
super.randomDisplayTick(par1World, x, y, z, par5Random);
if (par5Random.nextInt(100) == 0) {
double d5 = (double)((float)x + par5Random.nextFloat());
double d7 = (double)y + this.maxY;
double d6 = (double)((float)z + par5Random.nextFloat());
par1World.spawnParticle("suspended", d5, d7, d6, 0.0D, 0.0D, 0.0D);
par1World.playSound(d5, d7, d6, "liquid.lavapop",
0.2F + par5Random.nextFloat() * 0.2F,
0.9F + par5Random.nextFloat() * 0.15F, false);
public BToxicWaste(String name) {
super(AtomicScience.FLUID_TOXIC_WASTE, Material.water);
this.setBlockName("atomicscience:" + name);
this.setCreativeTab(TabAS.INSTANCE);
this.setHardness(100.0F);
this.setLightOpacity(3);
}
if (par5Random.nextInt(200) == 0) {
par1World.playSound((double)x, (double)y, (double)z, "liquid.lava",
0.2F + par5Random.nextFloat() * 0.2F,
0.9F + par5Random.nextFloat() * 0.15F, false);
@Override
public int tickRate(World par1World) {
return 20;
}
}
@Override
public void onEntityCollidedWithBlock(World par1World, int x, int y, int z,
Entity entity) {
if (entity instanceof EntityLiving) {
entity.attackEntityFrom(DamageSource.wither, 3);
PoisonRadiation.INSTANCE.poisonEntity(
new Vector3((double)x, (double)y, (double)z), (EntityLiving)entity,
4);
@Override
public void randomDisplayTick(World par1World, int x, int y, int z,
Random par5Random) {
super.randomDisplayTick(par1World, x, y, z, par5Random);
if (par5Random.nextInt(100) == 0) {
double d5 = (double) ((float) x + par5Random.nextFloat());
double d7 = (double) y + this.maxY;
double d6 = (double) ((float) z + par5Random.nextFloat());
par1World.spawnParticle("suspended", d5, d7, d6, 0.0D, 0.0D, 0.0D);
par1World.playSound(d5, d7, d6, "liquid.lavapop",
0.2F + par5Random.nextFloat() * 0.2F,
0.9F + par5Random.nextFloat() * 0.15F, false);
}
if (par5Random.nextInt(200) == 0) {
par1World.playSound((double) x, (double) y, (double) z, "liquid.lava",
0.2F + par5Random.nextFloat() * 0.2F,
0.9F + par5Random.nextFloat() * 0.15F, false);
}
}
}
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister iconRegister) {
this.blockIcon = iconRegister.registerIcon("atomicscience:toxicWaste");
AtomicScience.FLUID_TOXIC_WASTE.setIcons(this.blockIcon);
}
@Override
public void onEntityCollidedWithBlock(World par1World, int x, int y, int z,
Entity entity) {
if (entity instanceof EntityLiving) {
entity.attackEntityFrom(DamageSource.wither, 3);
PoisonRadiation.INSTANCE.poisonEntity(
new Vector3((double) x, (double) y, (double) z), (EntityLiving) entity,
4);
}
}
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister iconRegister) {
this.blockIcon = iconRegister.registerIcon("atomicscience:toxicWaste");
AtomicScience.FLUID_TOXIC_WASTE.setIcons(this.blockIcon);
// TODO: WTF
AtomicScience.FLUID_URANIUM_HEXAFLOURIDE.setIcons(
iconRegister.registerIcon("atomicscience:uraniumHexafluoride"));
// TODO: might override railcraft icon?
AtomicScience.FLUID_STEAM.setIcons(
iconRegister.registerIcon("atomicscience:steam"));
}
}

View file

@ -0,0 +1,239 @@
package atomicscience;
import atomicscience.recipe.RecipeBuilder;
import atomicscience.recipe.ShapedOreRecipeAdapter;
import atomicscience.recipe.ShapelessOreRecipeAdapter;
import basiccomponents.common.BasicComponents;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.registry.GameRegistry;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.ItemArmor;
import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.OreDictionary;
import universalelectricity.core.item.ElectricItemHelper;
public class Recipes {
/**
* Registers the recipes and OreDictionary entries.
*/
public static void addRecipes() {
OreDictionary.registerOre("cellEmpty", AtomicScience.itCell);
if (Loader.isModLoaded("IC2")) {
new RecipeBuilder(new ShapelessOreRecipeAdapter())
.output(AtomicScience.itYellowcake)
.ingredient(GameRegistry.findItem("IC2", "reactorUraniumSimple"))
.register();
new RecipeBuilder(new ShapelessOreRecipeAdapter())
.output(GameRegistry.findItem("IC2", "itemFluidCell"))
.ingredient(AtomicScience.itCell)
.register();
new RecipeBuilder(new ShapelessOreRecipeAdapter())
.output(AtomicScience.itCell)
.ingredient("cellEmpty")
.register();
}
new RecipeBuilder(new ShapelessOreRecipeAdapter())
.output(new ItemStack(AtomicScience.itCellAntimatter, 1, 1))
.ingredient(AtomicScience.itCellAntimatter)
.ingredient(AtomicScience.itCellAntimatter)
.ingredient(AtomicScience.itCellAntimatter)
.ingredient(AtomicScience.itCellAntimatter)
.ingredient(AtomicScience.itCellAntimatter)
.ingredient(AtomicScience.itCellAntimatter)
.ingredient(AtomicScience.itCellAntimatter)
.ingredient(AtomicScience.itCellAntimatter)
.register();
new RecipeBuilder(new ShapelessOreRecipeAdapter())
.output(AtomicScience.itCellAntimatter, 8)
.ingredient(new ItemStack(AtomicScience.itCellAntimatter, 1, 1))
.register();
new RecipeBuilder(new ShapedOreRecipeAdapter())
.output(AtomicScience.bFunnel, 2)
.pattern(" B ", "B B", "B B")
.ingredient('B', "ingotBronze")
.register();
new RecipeBuilder(new ShapedOreRecipeAdapter())
.output(AtomicScience.bFunnel, 2)
.pattern(" I ", "I I", "I I")
.ingredient('I', "ingotIron")
.register();
new RecipeBuilder(new ShapedOreRecipeAdapter())
.output(AtomicScience.bAtomicAssembler)
.pattern("CCC", "SXS", "SSS")
.ingredient('X', AtomicScience.bCentrifuge)
.ingredient('C', BasicComponents.itemCircuitElite)
.ingredient('S', "plateSteel")
.register();
new RecipeBuilder(new ShapedOreRecipeAdapter())
.output(AtomicScience.bFulminationGenerator)
.pattern("OSO", "SCS", "OSO")
.ingredient('O', Blocks.obsidian)
.ingredient('C', BasicComponents.itemCircuitAdvanced)
.ingredient('S', "plateSteel")
.register();
new RecipeBuilder(new ShapedOreRecipeAdapter())
.output(AtomicScience.bAccelerator)
.pattern("SCS", "CMC", "SCS")
.ingredient('M', BasicComponents.itemMotor)
.ingredient('C', BasicComponents.itemCircuitElite)
.ingredient('S', "plateSteel")
.register();
new RecipeBuilder(new ShapelessOreRecipeAdapter())
.output(AtomicScience.bElectromagnetGlass)
.ingredient(AtomicScience.bElectromagnet)
.ingredient(Blocks.glass)
.register();
new RecipeBuilder(new ShapedOreRecipeAdapter())
.output(AtomicScience.bCentrifuge)
.pattern("BSB", "MCM", "BSB")
.ingredient('C', BasicComponents.itemCircuitAdvanced)
.ingredient('S', "plateSteel")
.ingredient('B', "ingotBronze")
.ingredient('M', BasicComponents.itemMotor)
.register();
new RecipeBuilder(new ShapedOreRecipeAdapter())
.output(AtomicScience.bNuclearBoiler)
.pattern("S S", "FBF", "SMS")
.ingredient('F', Blocks.furnace)
.ingredient('S', "plateSteel")
.ingredient('B', Items.bucket)
.ingredient('M', BasicComponents.itemMotor)
.register();
new RecipeBuilder(new ShapedOreRecipeAdapter())
.output(AtomicScience.bChemicalExtractor)
.pattern("BSB", "MCM", "BSB")
.ingredient('C', BasicComponents.itemCircuitElite)
.ingredient('S', "plateSteel")
.ingredient('B', "ingotBronze")
.ingredient('M', BasicComponents.itemMotor)
.register();
new RecipeBuilder(new ShapedOreRecipeAdapter())
.output(AtomicScience.bSiren, 2)
.pattern("NPN")
.ingredient('N', Blocks.noteblock)
.ingredient('P', "plateBronze")
.register();
new RecipeBuilder(new ShapedOreRecipeAdapter())
.output(AtomicScience.bFissionReactor)
.pattern("SCS", "MEM", "SCS")
.ingredient('E', "cellEmpty")
.ingredient('C', BasicComponents.itemCircuitAdvanced)
.ingredient('S', "plateSteel")
.ingredient('M', BasicComponents.itemMotor)
.register();
new RecipeBuilder(new ShapedOreRecipeAdapter())
.output(AtomicScience.bFusionReactor)
.pattern("CPC", "PFP", "CPC")
.ingredient('P', "plateSteel")
.ingredient('F', AtomicScience.bFissionReactor)
.ingredient('C', BasicComponents.itemCircuitElite)
.register();
new RecipeBuilder(new ShapedOreRecipeAdapter())
.output(AtomicScience.bTurbine)
.pattern(" B ", "BMB", " B ")
.ingredient('B', "plateBronze")
.ingredient('M', BasicComponents.itemMotor)
.register();
new RecipeBuilder(new ShapedOreRecipeAdapter())
.output(AtomicScience.bReactorTap)
.pattern("SBS", "TMT", "SBS")
.ingredient('S', "plateBronze")
.ingredient('M', BasicComponents.itemMotor)
.ingredient('B', Items.bucket)
.register();
new RecipeBuilder(new ShapedOreRecipeAdapter())
.output(AtomicScience.itCell, 16)
.pattern(" T ", "TGT", " T ")
.ingredient('T', "ingotTin")
.ingredient('G', Blocks.glass)
.register();
new RecipeBuilder(new ShapelessOreRecipeAdapter())
.output(AtomicScience.itCellWater)
.ingredient(AtomicScience.itCell)
.ingredient(Items.water_bucket)
.register();
new RecipeBuilder(new ShapedOreRecipeAdapter())
.output(ElectricItemHelper.getUncharged(AtomicScience.itThermometer))
.pattern("SSS", "GCG", "GSG")
.ingredient('S', "ingotSteel")
.ingredient('G', Blocks.glass)
.ingredient('C', BasicComponents.itemCircuitBasic)
.register();
new RecipeBuilder(new ShapedOreRecipeAdapter())
.output(AtomicScience.bThermometer)
.pattern("SSS", "SWS", "SSS")
.ingredient('S', "ingotSteel")
.ingredient(
'W', ElectricItemHelper.getUncharged(AtomicScience.itThermometer))
.register();
new RecipeBuilder(new ShapedOreRecipeAdapter())
.output(AtomicScience.bControlRod)
.pattern("I", "I", "I")
.ingredient('I', Items.iron_ingot)
.register();
new RecipeBuilder(new ShapedOreRecipeAdapter())
.output(AtomicScience.itCellUranium)
.pattern("CUC", "CUC", "CUC")
.ingredient('U', AtomicScience.itUranium)
.ingredient('C', "cellEmpty")
.register();
new RecipeBuilder(new ShapedOreRecipeAdapter())
.output(AtomicScience.itCellBreederFuel)
.pattern("CUC", "CUC", "CUC")
.ingredient('C', "cellEmpty")
.ingredient('U', "breederUranium")
.register();
new RecipeBuilder(new ShapedOreRecipeAdapter())
.output(AtomicScience.bElectromagnet, 2)
.pattern("BBB", "BMB", "BBB")
.ingredient('B', "ingotBronze")
.ingredient('M', BasicComponents.itemMotor)
.register();
new RecipeBuilder(new ShapedOreRecipeAdapter())
.output(AtomicScience.bElectromagnet, 2)
.pattern("III", "IMI", "III")
.ingredient('I', Items.iron_ingot)
.ingredient('M', BasicComponents.itemMotor)
.register();
for (ItemArmor armorPiece :
new ItemArmor[] {Items.leather_helmet, Items.leather_chestplate,
Items.leather_leggings, Items.leather_boots}) {
new RecipeBuilder(new ShapedOreRecipeAdapter())
.output(AtomicScience.itHazmatHelmet)
.pattern("SSS", " A ", "SCS")
.ingredient('A', armorPiece)
.ingredient('C', BasicComponents.itemCircuitBasic)
.ingredient('S', Blocks.wool)
.register();
}
}
}

View file

@ -12,167 +12,174 @@ import universalelectricity.core.electricity.ElectricityPack;
public class TAtomicAssembler extends TInventory {
public final int SMELTING_TICKS = 1200;
public final float DIAN = 10000.0F;
public int smeltingTicks = 0;
public float rotationYaw1;
public float rotationYaw2;
public float rotationYaw3;
public EntityItem entityItem;
public final int SMELTING_TICKS = 1200;
public final float DIAN = 10000.0F;
public int smeltingTicks = 0;
public float rotationYaw1;
public float rotationYaw2;
public float rotationYaw3;
public EntityItem entityItem;
public void updateEntity() {
super.updateEntity();
if (!this.isDisabled()) {
if (!this.worldObj.isRemote) {
@Override
public void updateEntity() {
super.updateEntity();
if (!this.isDisabled()) {
if (!this.worldObj.isRemote) {
if (this.canWork()) {
double var10000 = super.wattsReceived;
this.getClass();
if (var10000 >= 10000.0D) {
if (this.smeltingTicks == 0) {
this.getClass();
this.smeltingTicks = 1200;
}
if (this.smeltingTicks > 0) {
--this.smeltingTicks;
if (this.smeltingTicks < 1) {
this.work();
this.smeltingTicks = 0;
}
} else {
this.smeltingTicks = 0;
}
super.wattsReceived = 0.0D;
}
} else {
this.smeltingTicks = 0;
}
if (super.ticks % 10L == 0L) {
this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord,
this.zCoord);
}
}
if (this.worldObj.isRemote && this.smeltingTicks > 0) {
if (super.ticks % 600L == 0L) {
this.worldObj.playSoundEffect(
(double) this.xCoord, (double) this.yCoord, (double) this.zCoord,
SoundManager.ASSEMBLER, 0.7F, 1.0F);
}
this.rotationYaw1 += 3.0F;
this.rotationYaw2 += 2.0F;
++this.rotationYaw3;
ItemStack var3 = this.getStackInSlot(6);
if (var3 != null) {
var3 = var3.copy();
var3.stackSize = 1;
if (this.entityItem == null) {
this.entityItem = new EntityItem(this.worldObj, 0.0D, 0.0D, 0.0D, var3);
} else if (!var3.isItemEqual(this.entityItem.getEntityItem())) {
this.entityItem = new EntityItem(this.worldObj, 0.0D, 0.0D, 0.0D, var3);
}
++this.entityItem.age;
} else {
this.entityItem = null;
}
}
}
}
@Override
public ElectricityPack getRequest() {
return this.canWork()
? new ElectricityPack(10000.0D / this.getVoltage(), this.getVoltage())
: new ElectricityPack();
}
@Override
public void onDataPacket(NetworkManager arg0,
S35PacketUpdateTileEntity arg1) {
NBTTagCompound nbt = arg1.func_148857_g();
this.smeltingTicks = nbt.getInteger("smeltingTicks");
super.disabledTicks = nbt.getInteger("disabledTicks");
}
@Override
public Packet getDescriptionPacket() {
NBTTagCompound nbt = new NBTTagCompound();
nbt.setInteger("smeltingTicks", this.smeltingTicks);
nbt.setInteger("disabledTicks", super.disabledTicks);
return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord,
this.getBlockMetadata(), nbt);
}
@Override
public void openInventory() {
if (!this.worldObj.isRemote) {
this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord);
}
}
public boolean canWork() {
if (super.containingItems[6] != null) {
for (int i = 0; i < 6; ++i) {
if (super.containingItems[i] == null) {
return false;
}
if (super.containingItems[i].getItem() != AtomicScience.itCellStrangeMatter) {
return false;
}
}
return super.containingItems[6].stackSize < 64;
} else {
return false;
}
}
public void work() {
if (this.canWork()) {
double var10000 = super.wattsReceived;
this.getClass();
if (var10000 >= 10000.0D) {
if (this.smeltingTicks == 0) {
this.getClass();
this.smeltingTicks = 1200;
for (int i = 0; i <= 5; ++i) {
if (super.containingItems[i] != null) {
super.containingItems[i].setItemDamage(
super.containingItems[i].getItemDamage() + 1);
if (super.containingItems[i].getItemDamage() >= 64) {
super.containingItems[i] = null;
}
}
}
if (this.smeltingTicks > 0) {
--this.smeltingTicks;
if (this.smeltingTicks < 1) {
this.work();
this.smeltingTicks = 0;
}
} else {
this.smeltingTicks = 0;
if (super.containingItems[6] != null) {
++super.containingItems[6].stackSize;
}
super.wattsReceived = 0.0D;
}
} else {
this.smeltingTicks = 0;
}
if (super.ticks % 10L == 0L) {
this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord,
this.zCoord);
}
}
if (this.worldObj.isRemote && this.smeltingTicks > 0) {
if (super.ticks % 600L == 0L) {
this.worldObj.playSoundEffect(
(double)this.xCoord, (double)this.yCoord, (double)this.zCoord,
SoundManager.ASSEMBLER, 0.7F, 1.0F);
}
this.rotationYaw1 += 3.0F;
this.rotationYaw2 += 2.0F;
++this.rotationYaw3;
ItemStack var3 = this.getStackInSlot(6);
if (var3 != null) {
var3 = var3.copy();
var3.stackSize = 1;
if (this.entityItem == null) {
this.entityItem =
new EntityItem(this.worldObj, 0.0D, 0.0D, 0.0D, var3);
} else if (!var3.isItemEqual(this.entityItem.getEntityItem())) {
this.entityItem =
new EntityItem(this.worldObj, 0.0D, 0.0D, 0.0D, var3);
}
++this.entityItem.age;
} else {
this.entityItem = null;
}
}
}
}
public ElectricityPack getRequest() {
return this.canWork()
? new ElectricityPack(10000.0D / this.getVoltage(), this.getVoltage())
: new ElectricityPack();
}
@Override
public void onDataPacket(NetworkManager arg0,
S35PacketUpdateTileEntity arg1) {
NBTTagCompound nbt = arg1.func_148857_g();
this.smeltingTicks = nbt.getInteger("smeltingTicks");
super.disabledTicks = nbt.getInteger("disabledTicks");
}
@Override
public Packet getDescriptionPacket() {
NBTTagCompound nbt = new NBTTagCompound();
nbt.setInteger("smeltingTicks", this.smeltingTicks);
nbt.setInteger("disabledTicks", super.disabledTicks);
return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord,
this.getBlockMetadata(), nbt);
}
public void openInventory() {
if (!this.worldObj.isRemote) {
this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord);
@Override
public void readFromNBT(NBTTagCompound nbt) {
super.readFromNBT(nbt);
this.smeltingTicks = nbt.getInteger("smeltingTicks");
}
}
public boolean canWork() {
if (super.containingItems[6] != null) {
for (int i = 0; i < 6; ++i) {
if (super.containingItems[i] == null) {
return false;
}
if (super.containingItems[i].getItem() !=
AtomicScience.itCellStrangeMatter) {
return false;
}
}
return super.containingItems[6].stackSize < 64;
} else {
return false;
@Override
public void writeToNBT(NBTTagCompound nbt) {
super.writeToNBT(nbt);
nbt.setInteger("smeltingTicks", this.smeltingTicks);
}
}
public void work() {
if (this.canWork()) {
for (int i = 0; i <= 5; ++i) {
if (super.containingItems[i] != null) {
super.containingItems[i].setItemDamage(
super.containingItems[i].getItemDamage() + 1);
if (super.containingItems[i].getItemDamage() >= 64) {
super.containingItems[i] = null;
}
}
}
if (super.containingItems[6] != null) {
++super.containingItems[6].stackSize;
}
@Override
public double getVoltage() {
return UniversalElectricity.isVoltageSensitive ? 480.0D : 120.0D;
}
}
public void readFromNBT(NBTTagCompound nbt) {
super.readFromNBT(nbt);
this.smeltingTicks = nbt.getInteger("smeltingTicks");
}
@Override
public int getSizeInventory() {
return 7;
}
public void writeToNBT(NBTTagCompound nbt) {
super.writeToNBT(nbt);
nbt.setInteger("smeltingTicks", this.smeltingTicks);
}
public double getVoltage() {
return UniversalElectricity.isVoltageSensitive ? 480.0D : 120.0D;
}
public int getSizeInventory() { return 7; }
public boolean isItemValidForSlot(int slotID, ItemStack itemStack) {
return slotID == 6
? true
: itemStack.getItem() == AtomicScience.itCellStrangeMatter;
}
@Override
public boolean isItemValidForSlot(int slotID, ItemStack itemStack) {
return slotID == 6
? itemStack.isStackable()
: itemStack.getItem() == AtomicScience.itCellStrangeMatter;
}
}

View file

@ -237,7 +237,7 @@ public class TAutoBuilder
targetPosition =
(new Vector3((double)x, 1.0D, (double)z)).add(diDian);
targetPosition.setBlock(
this.worldObj, AtomicScience.bElectromagnet);
this.worldObj, AtomicScience.bElectromagnetBoiler);
targetPosition =
(new Vector3((double)x, -1.0D, (double)z)).add(diDian);
targetPosition.setBlock(
@ -329,7 +329,6 @@ public class TAutoBuilder
}
public static enum AutoBuilderType {
JIA_SU_QI("Particle Accelerator"),
FEN_LIE("Fission Reactor"),
HE_CHENG("Fusion Reactor"),

View file

@ -0,0 +1,16 @@
package atomicscience;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
public class TileEntityFilteredSlot extends Slot {
public TileEntityFilteredSlot(IInventory arg0, int arg1, int arg2, int arg3) {
super(arg0, arg1, arg2, arg3);
}
@Override
public boolean isItemValid(ItemStack arg0) {
return this.inventory.isItemValidForSlot(this.getSlotIndex(), arg0);
}
}

View file

@ -263,7 +263,7 @@ public class EMatter extends Entity implements IEntityAdditionalSpawnData {
}
super.worldObj.playSoundEffect(
super.posX, super.posY, super.posZ, "atomicscience.antimatter", 1.5F,
super.posX, super.posY, super.posZ, SoundManager.ANTIMATTER, 1.5F,
1.0F - super.worldObj.rand.nextFloat() * 0.3F);
this.setDead();
}
@ -276,13 +276,11 @@ public class EMatter extends Entity implements IEntityAdditionalSpawnData {
public static boolean canExist(World worldObj, Vector3 position,
ForgeDirection facing) {
if (position.getBlock(worldObj) != Blocks.air) {
AtomicScience.LOGGER.info("block not air " + position);
return false;
} else {
for (int i = 0; i <= 1; ++i) {
ForgeDirection dir = ForgeDirection.getOrientation(i);
if (!isElectromagnet(worldObj, position, dir)) {
AtomicScience.LOGGER.info("not alectromagnet " + position);
return false;
}
}

View file

@ -19,124 +19,144 @@ import universalelectricity.core.vector.Vector3;
import universalelectricity.prefab.tile.TileEntityAdvanced;
public class TReactorTap extends TileEntityAdvanced implements IFluidHandler {
private final Set<FluidTank> tanks = new HashSet<>();
private long lastFindTime = -1L;
private final Set<FluidTank> tanks = new HashSet<>();
private long lastFindTime = -1L;
@Override
public void updateEntity() {
super.updateEntity();
public void find() {
this.tanks.clear();
final World world = this.worldObj;
final Vector3 position = new Vector3(this);
Pathfinder finder = (new Pathfinder(new IPathCallBack() {
public Set getConnectedNodes(Pathfinder finder, Vector3 currentNode) {
HashSet<Vector3> neighbors = new HashSet<>();
if (!this.worldObj.isRemote && this.ticks % 20 == 0) {
FluidTank optimalTank = this.getOptimalTank();
if (optimalTank == null)
return;
ForgeDirection rotation =
ForgeDirection.getOrientation(this.worldObj.getBlockMetadata(
this.xCoord, this.yCoord, this.zCoord));
for (int i = 0; i < 6; ++i) {
ForgeDirection direction = ForgeDirection.getOrientation(i);
Vector3 positionx = currentNode.clone().modifyPositionFromSide(direction);
Block connectedBlockID = positionx.getBlock(world);
if (connectedBlockID == Blocks.air ||
connectedBlockID instanceof BlockLiquid ||
connectedBlockID instanceof BFissionReactor) {
neighbors.add(positionx);
}
}
Vector3 neighborPos = new Vector3(this).modifyPositionFromSide(rotation);
if (neighborPos.getTileEntity(this.worldObj) instanceof IFluidHandler) {
IFluidHandler fHandler =
(IFluidHandler)neighborPos.getTileEntity(this.worldObj);
int drained =
fHandler.fill(rotation.getOpposite(), optimalTank.getFluid(), true);
return neighbors;
if (drained != 0)
optimalTank.drain(drained, true);
}
}
}
public void find() {
this.tanks.clear();
final World world = this.worldObj;
final Vector3 position = new Vector3(this);
Pathfinder finder =
(new Pathfinder(new IPathCallBack() {
public Set getConnectedNodes(Pathfinder finder, Vector3 currentNode) {
HashSet<Vector3> neighbors = new HashSet<>();
for (int i = 0; i < 6; ++i) {
ForgeDirection direction = ForgeDirection.getOrientation(i);
Vector3 positionx =
currentNode.clone().modifyPositionFromSide(direction);
Block connectedBlockID = positionx.getBlock(world);
if (connectedBlockID == Blocks.air ||
connectedBlockID instanceof BlockLiquid ||
connectedBlockID instanceof BFissionReactor) {
neighbors.add(positionx);
}
}
public boolean onSearch(Pathfinder finder, Vector3 node) {
if (node.getTileEntity(world) instanceof TFissionReactor) {
finder.results.add(node);
}
return neighbors;
}
return node.distanceTo(position) > 6.0D;
public boolean onSearch(Pathfinder finder, Vector3 node) {
if (node.getTileEntity(world) instanceof TFissionReactor) {
finder.results.add(node);
}
return node.distanceTo(position) > 6.0D;
}
}))
.init((new Vector3(this))
.modifyPositionFromSide(
ForgeDirection.getOrientation(this.getBlockMetadata())
.getOpposite()));
for (Vector3 node : (Set<Vector3>) finder.results) {
TileEntity tileEntity = node.getTileEntity(this.worldObj);
if (tileEntity instanceof TFissionReactor) {
this.tanks.add(((TFissionReactor) tileEntity).wasteTank);
}
}
this.lastFindTime = this.worldObj.getWorldTime();
.init((new Vector3(this))
.modifyPositionFromSide(
ForgeDirection.getOrientation(this.getBlockMetadata())
.getOpposite()));
for (Vector3 node : (Set<Vector3>)finder.results) {
TileEntity tileEntity = node.getTileEntity(this.worldObj);
if (tileEntity instanceof TFissionReactor) {
this.tanks.add(((TFissionReactor)tileEntity).wasteTank);
}
}
public FluidTank getOptimalTank() {
if (this.lastFindTime == -1L ||
this.worldObj.getWorldTime() - this.lastFindTime > 20L) {
this.find();
}
this.lastFindTime = this.worldObj.getWorldTime();
}
if (this.tanks.size() <= 0) {
return null;
}
FluidTank optimalTank = null;
for (FluidTank tank : this.tanks) {
if (this.getLiquidSafe(tank.getFluid()) > this.getLiquidSafe(optimalTank.getFluid())) {
optimalTank = tank;
}
}
return optimalTank;
public FluidTank getOptimalTank() {
if (this.lastFindTime == -1L ||
this.worldObj.getWorldTime() - this.lastFindTime > 20L) {
this.find();
}
public int getLiquidSafe(FluidStack stack) {
return stack != null ? stack.amount : 0;
if (this.tanks.size() <= 0) {
return null;
}
public boolean canUpdate() {
return false;
FluidTank optimalTank = null;
for (FluidTank tank : this.tanks) {
int optimalTankContent =
optimalTank == null ? 0 : optimalTank.getFluidAmount();
if (tank.getFluidAmount() > optimalTankContent) {
optimalTank = tank;
}
}
public int fill(ForgeDirection from, FluidStack resource, boolean doFill) {
return 0;
}
return optimalTank;
}
public int fill(int tankIndex, FluidStack resource, boolean doFill) {
return 0;
}
public int fill(ForgeDirection from, FluidStack resource, boolean doFill) {
return 0;
}
public FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain) {
return this.getOptimalTank() != null
? this.getOptimalTank().drain(maxDrain, doDrain)
: null;
}
public int fill(int tankIndex, FluidStack resource, boolean doFill) {
return 0;
}
@Override
public FluidStack drain(ForgeDirection arg0, FluidStack arg1, boolean arg2) {
return this.getOptimalTank() != null &&
arg1.getFluid() == this.getOptimalTank().getFluid().getFluid()
? this.drain(arg0, arg1.amount, arg2)
: null;
}
public FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain) {
return this.getOptimalTank() != null
? this.getOptimalTank().drain(maxDrain, doDrain)
: null;
}
@Override
public boolean canDrain(ForgeDirection arg0, Fluid arg1) {
return this.getOptimalTank() != null &&
this.getOptimalTank().getFluid().getFluid() == arg1 &&
this.getOptimalTank().getFluidAmount() != 0;
}
@Override
public FluidStack drain(ForgeDirection arg0, FluidStack arg1, boolean arg2) {
return this.getOptimalTank() != null &&
arg1.getFluid() == this.getOptimalTank().getFluid().getFluid()
? this.drain(arg0, arg1.amount, arg2)
: null;
}
@Override
public FluidTankInfo[] getTankInfo(ForgeDirection arg0) {
if (arg0.ordinal() != this.getBlockMetadata())
return null;
@Override
public boolean canDrain(ForgeDirection arg0, Fluid arg1) {
return this.getOptimalTank() != null &&
this.getOptimalTank().getFluid().getFluid() == arg1 &&
this.getOptimalTank().getFluidAmount() != 0;
}
this.find();
return (FluidTankInfo[]) this.tanks.stream()
.map(FluidTankInfo::new)
.toArray();
}
@Override
public FluidTankInfo[] getTankInfo(ForgeDirection arg0) {
if (arg0.ordinal() != this.getBlockMetadata())
return null;
@Override
public boolean canFill(ForgeDirection arg0, Fluid arg1) {
return false;
}
this.find();
return (FluidTankInfo[])this.tanks.stream()
.map(FluidTankInfo::new)
.toArray();
}
@Override
public boolean canFill(ForgeDirection arg0, Fluid arg1) {
return false;
}
}

View file

@ -5,14 +5,15 @@ import atomicscience.jiqi.BBase;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
public class BElectromagnet extends BBase implements IElectromagnet {
private IIcon iconTop;
protected IIcon iconTop;
public BElectromagnet() { super("electromagnet"); }
public BElectromagnet() { this("electromagnet"); }
public BElectromagnet(String id) { super(id); }
@Override
public IIcon getIcon(int side, int metadata) {
@ -23,15 +24,8 @@ public class BElectromagnet extends BBase implements IElectromagnet {
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister iconRegister) {
super.registerBlockIcons(iconRegister);
this.iconTop = iconRegister.registerIcon(
this.getUnlocalizedName().replace("tile.", "") + "_top");
this.blockIcon = iconRegister.registerIcon(
this.getUnlocalizedName().replace("tile.", ""));
}
@Override
public TileEntity createNewTileEntity(World var1, int meta) {
return new TElectromagnet();
this.iconTop = iconRegister.registerIcon("atomicscience:electromagnet_top");
this.blockIcon = iconRegister.registerIcon("atomicscience:electromagnet");
}
@Override

View file

@ -0,0 +1,13 @@
package atomicscience.hecheng;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
public class BElectromagnetBoiler extends BElectromagnet {
public BElectromagnetBoiler() { super("electromagnetBoiler"); }
@Override
public TileEntity createNewTileEntity(World var1, int meta) {
return new TElectromagnetBoiler();
}
}

View file

@ -2,7 +2,7 @@ package atomicscience.hecheng;
import atomicscience.api.IElectromagnet;
import atomicscience.api.Plasma;
import atomicscience.hecheng.TElectromagnet;
import atomicscience.hecheng.TElectromagnetBoiler;
import atomicscience.jiqi.BBase;
import java.util.Random;
import net.minecraft.block.Block;
@ -50,9 +50,9 @@ public class BPlasma extends BBase implements Plasma.IPlasma {
}
} else {
TileEntity var10 = zhaoDiDian.getTileEntity(worldObj);
if (var10 instanceof TElectromagnet) {
((TElectromagnet) var10)
.setTemperature(((TElectromagnet) var10).getTemperature() + 100.0F);
if (var10 instanceof TElectromagnetBoiler) {
((TElectromagnetBoiler) var10)
.setTemperature(((TElectromagnetBoiler) var10).getTemperature() + 100.0F);
}
}
}

View file

@ -9,7 +9,7 @@ import net.minecraftforge.common.util.ForgeDirection;
import universalelectricity.core.vector.Vector3;
import universalelectricity.prefab.tile.TileEntityAdvanced;
public class TElectromagnet extends TileEntityAdvanced implements ITemperature {
public class TElectromagnetBoiler extends TileEntityAdvanced implements ITemperature {
public static final int MAX_TEMP = 5000;
private float temperature = 0.0F;

View file

@ -3,7 +3,6 @@ package atomicscience.hecheng;
import atomicscience.AtomicScience;
import atomicscience.jiqi.TInventory;
import calclavia.lib.render.ITagRender;
import com.google.common.io.ByteArrayDataInput;
import java.util.HashMap;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.ISidedInventory;

View file

@ -2,6 +2,7 @@ package atomicscience.jiqi;
import atomicscience.AtomicScience;
import atomicscience.TAtomicAssembler;
import atomicscience.TileEntityFilteredSlot;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
@ -14,13 +15,13 @@ public class CAssembler extends Container {
public CAssembler(InventoryPlayer par1InventoryPlayer,
TAtomicAssembler tileEntity) {
this.tileEntity = tileEntity;
this.addSlotToContainer(new Slot(tileEntity, 0, 80, 40));
this.addSlotToContainer(new Slot(tileEntity, 1, 53, 56));
this.addSlotToContainer(new Slot(tileEntity, 2, 107, 56));
this.addSlotToContainer(new Slot(tileEntity, 3, 53, 88));
this.addSlotToContainer(new Slot(tileEntity, 4, 107, 88));
this.addSlotToContainer(new Slot(tileEntity, 5, 80, 103));
this.addSlotToContainer(new Slot(tileEntity, 6, 80, 72));
this.addSlotToContainer(new TileEntityFilteredSlot(tileEntity, 0, 80, 40));
this.addSlotToContainer(new TileEntityFilteredSlot(tileEntity, 1, 53, 56));
this.addSlotToContainer(new TileEntityFilteredSlot(tileEntity, 2, 107, 56));
this.addSlotToContainer(new TileEntityFilteredSlot(tileEntity, 3, 53, 88));
this.addSlotToContainer(new TileEntityFilteredSlot(tileEntity, 4, 107, 88));
this.addSlotToContainer(new TileEntityFilteredSlot(tileEntity, 5, 80, 103));
this.addSlotToContainer(new TileEntityFilteredSlot(tileEntity, 6, 80, 72));
int var3;
for (var3 = 0; var3 < 3; ++var3) {
@ -62,6 +63,7 @@ public class CAssembler extends Container {
return null;
}
} else if (!this.getSlot(6).getHasStack() &&
itemStack.isStackable() &&
!this.mergeItemStack(itemStack, 6, 7, false)) {
return null;
}

View file

@ -14,89 +14,99 @@ import universalelectricity.core.block.IConductor;
import universalelectricity.prefab.tile.TileEntityAdvanced;
public class TFunnel
extends TileEntityAdvanced implements ISteamReceptor, IFluidHandler {
extends TileEntityAdvanced implements ISteamReceptor, IFluidHandler {
public IConductor connectedWire = null;
public final FluidTank gasTank;
public IConductor connectedWire = null;
public final FluidTank gasTank;
public TFunnel() {
this.gasTank = new FluidTank(AtomicScience.FLUID_STEAM, 0, 20000);
public TFunnel() {
this.gasTank = new FluidTank(AtomicScience.FLUID_STEAM, 0, 20000);
}
// TODO: WTF
// this.gasTank.setTankPressure(10);
}
@Override
public void updateEntity() {
super.updateEntity();
if (super.ticks % 20L == 0L) {
TileEntity tileEntity = this.worldObj.getTileEntity(
this.xCoord, this.yCoord + 1, this.zCoord);
if (tileEntity != null && tileEntity instanceof ISteamReceptor) {
FluidStack drainStack = this.gasTank.drain(AtomicScience.STEAM_RATIO, true);
if (drainStack != null) {
int nengLiang = drainStack.amount;
((ISteamReceptor) tileEntity)
.onReceiveSteam(nengLiang - nengLiang / 4);
}
}
@Override
public void updateEntity() {
super.updateEntity();
if (!this.worldObj.isRemote && super.ticks % 20L == 0L) {
TileEntity tileEntity = this.worldObj.getTileEntity(
this.xCoord, this.yCoord + 1, this.zCoord);
if (tileEntity instanceof ISteamReceptor) {
FluidStack drainStack =
this.gasTank.drain(AtomicScience.STEAM_RATIO, true);
if (drainStack != null) {
int nengLiang = drainStack.amount;
((ISteamReceptor)tileEntity)
.onReceiveSteam(nengLiang - nengLiang / 4);
}
}
}
@Override
public void readFromNBT(NBTTagCompound nbt) {
super.readFromNBT(nbt);
NBTTagCompound gasCompound = nbt.getCompoundTag("gas");
this.gasTank.setFluid(FluidStack.loadFluidStackFromNBT(gasCompound));
}
if (tileEntity instanceof IFluidHandler) {
IFluidHandler fHandler = ((IFluidHandler)tileEntity);
@Override
public void writeToNBT(NBTTagCompound nbt) {
super.writeToNBT(nbt);
if (this.gasTank.getFluid() != null) {
NBTTagCompound compound = new NBTTagCompound();
this.gasTank.getFluid().writeToNBT(compound);
nbt.setTag("gas", compound);
}
}
int transferred =
fHandler.fill(ForgeDirection.DOWN,
this.gasTank.getFluid(),
true);
@Override
public void onReceiveSteam(int amount) {
this.gasTank.fill(new FluidStack(AtomicScience.FLUID_STEAM,
amount * AtomicScience.STEAM_RATIO),
true);
if (transferred != 0)
this.gasTank.drain(transferred, true);
}
}
}
@Override
public int fill(ForgeDirection from, FluidStack resource, boolean doFill) {
return 0;
}
@Override
public void readFromNBT(NBTTagCompound nbt) {
super.readFromNBT(nbt);
NBTTagCompound gasCompound = nbt.getCompoundTag("gas");
this.gasTank.setFluid(FluidStack.loadFluidStackFromNBT(gasCompound));
}
@Override
public FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain) {
return this.gasTank.drain(maxDrain, doDrain);
@Override
public void writeToNBT(NBTTagCompound nbt) {
super.writeToNBT(nbt);
if (this.gasTank.getFluid() != null) {
NBTTagCompound compound = new NBTTagCompound();
this.gasTank.getFluid().writeToNBT(compound);
nbt.setTag("gas", compound);
}
}
@Override
public boolean canDrain(ForgeDirection arg0, Fluid arg1) {
return arg1 == AtomicScience.FLUID_STEAM &&
this.gasTank.getFluidAmount() > 0;
}
@Override
public void onReceiveSteam(int amount) {
this.gasTank.fill(new FluidStack(AtomicScience.FLUID_STEAM,
amount * AtomicScience.STEAM_RATIO),
true);
}
@Override
public boolean canFill(ForgeDirection arg0, Fluid arg1) {
return false;
}
@Override
public int fill(ForgeDirection from, FluidStack resource, boolean doFill) {
return 0;
}
@Override
public FluidStack drain(ForgeDirection arg0, FluidStack arg1, boolean arg2) {
return arg1.getFluid() == AtomicScience.FLUID_STEAM
? this.gasTank.drain(arg1.amount, arg2)
: null;
}
@Override
public FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain) {
return this.gasTank.drain(maxDrain, doDrain);
}
@Override
public FluidTankInfo[] getTankInfo(ForgeDirection arg0) {
return new FluidTankInfo[] { new FluidTankInfo(this.gasTank) };
}
@Override
public boolean canDrain(ForgeDirection arg0, Fluid arg1) {
return arg1 == AtomicScience.FLUID_STEAM &&
this.gasTank.getFluidAmount() > 0;
}
@Override
public boolean canFill(ForgeDirection arg0, Fluid arg1) {
return false;
}
@Override
public FluidStack drain(ForgeDirection arg0, FluidStack arg1, boolean arg2) {
return arg1.getFluid() == AtomicScience.FLUID_STEAM
? this.gasTank.drain(arg1.amount, arg2)
: null;
}
@Override
public FluidTankInfo[] getTankInfo(ForgeDirection arg0) {
return new FluidTankInfo[] {new FluidTankInfo(this.gasTank)};
}
}

View file

@ -0,0 +1,14 @@
package atomicscience.recipe;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.IRecipe;
public interface IRecipeAdapter {
public void setOutput(ItemStack item);
public void setPattern(String... pattern);
public void addIngredient(Object... ingredients);
public IRecipe create();
}

View file

@ -0,0 +1,49 @@
package atomicscience.recipe;
import cpw.mods.fml.common.registry.GameRegistry;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
public class RecipeBuilder {
IRecipeAdapter adapter;
public RecipeBuilder(IRecipeAdapter adapter) { this.adapter = adapter; }
public RecipeBuilder output(ItemStack stack) {
this.adapter.setOutput(stack);
return this;
}
public RecipeBuilder output(Item item) {
this.adapter.setOutput(new ItemStack(item));
return this;
}
public RecipeBuilder output(Block block) {
this.adapter.setOutput(new ItemStack(block));
return this;
}
public RecipeBuilder output(Block block, int count) {
this.adapter.setOutput(new ItemStack(block, count));
return this;
}
public RecipeBuilder output(Item item, int count) {
this.adapter.setOutput(new ItemStack(item, count));
return this;
}
public RecipeBuilder pattern(String... pat) {
this.adapter.setPattern(pat);
return this;
}
public RecipeBuilder ingredient(Object... i) {
this.adapter.addIngredient(i);
return this;
}
public void register() { GameRegistry.addRecipe(this.adapter.create()); }
}

View file

@ -0,0 +1,41 @@
package atomicscience.recipe;
import java.util.ArrayList;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.IRecipe;
import net.minecraftforge.oredict.ShapedOreRecipe;
public class ShapedOreRecipeAdapter implements IRecipeAdapter {
ItemStack output;
String[] pattern;
ArrayList<Object> ingredients = new ArrayList<>();
@Override
public void setOutput(ItemStack item) {
this.output = item;
}
@Override
public void setPattern(String... pattern) {
this.pattern = pattern;
}
@Override
public void addIngredient(Object... ingredients) {
this.ingredients.add(ingredients[0]);
this.ingredients.add(ingredients[1]);
}
@Override
public IRecipe create() {
ArrayList<Object> args = new ArrayList<>();
for (String pat : this.pattern)
args.add(pat);
for (Object ing : this.ingredients)
args.add(ing);
return new ShapedOreRecipe(this.output, args.toArray());
}
}

View file

@ -0,0 +1,31 @@
package atomicscience.recipe;
import java.util.ArrayList;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.IRecipe;
import net.minecraftforge.oredict.ShapelessOreRecipe;
public class ShapelessOreRecipeAdapter implements IRecipeAdapter {
ItemStack output;
ArrayList<Object> ingredients = new ArrayList<>();
@Override
public void setOutput(ItemStack item) {
this.output = item;
}
@Override
public void setPattern(String... pattern) {
throw new UnsupportedOperationException("Shapeless recipe has no pattern!");
}
@Override
public void addIngredient(Object... ingredients) {
this.ingredients.add(ingredients[0]);
}
@Override
public IRecipe create() {
return new ShapelessOreRecipe(this.output, this.ingredients.toArray());
}
}

View file

@ -52,7 +52,7 @@ public class GFissionReactor extends GuiContainerBase {
@Override
protected void drawGuiContainerBackgroundLayer(float par1, int x, int y) {
//super.drawGuiContainerBackgroundLayer(par1, x, y);
super.drawGuiContainerBackgroundLayer(par1, x, y);
this.drawSlot(78, 20);
if (this.tileEntity.wasteTank.getFluid() != null) {
int toxicity1 = this.tileEntity.wasteTank.getFluidAmount();

View file

@ -24,8 +24,9 @@ item.atomicscience\:uranium.0.name=Uranium-235
item.atomicscience\:uranium.1.name=Uranium-238
item.atomicscience\:rodFissileFuel.name=Fissile Fuel Rod
item.atomicscience\:rodBreederFuel.name=Breeder Fuel Rod
item.atomicscience\:uraniumHexafluoride.name=Uranium Hexafluoride
item.atomicscience\:steam.name=Steam
fluid.uranium_hexafluoride=Uranium Hexafluoride
fluid.steam=Steam
fluid.toxic_waste=Toxic Waste
## Blocks
tile.atomicscience\:reactorTap.name=Reactor Drain
@ -38,6 +39,7 @@ tile.atomicscience\:turbine.name=Reactor Turbine
tile.atomicscience\:radioactive.name=Radioactive Material
tile.atomicscience\:thermometer.name=Thermometer
tile.atomicscience\:electromagnet.name=Electromagnet
tile.atomicscience\:electromagnetBoiler.name=Electromagnet Boiler
tile.atomicscience\:chemicalExtractor.name=Chemical Extractor
tile.atomicscience\:siren.name=Siren
tile.atomicscience\:electromagnetGlass.name=Electromagnet Glass
@ -48,4 +50,4 @@ tile.atomicscience\:accelerator.name=Particle Accelerator
tile.atomicscience\:instantBuilder.name=Instant Builder
tile.atomicscience\:fulmination.name=Fulmination Generator
tile.atomicscience\:atomicAssembler.name=Atomic Assembler
tile.atomicscience\:toxicWaste.name=Toxic Waste
tile.atomicscience\:toxicWaste.name=Toxic Waste