diff options
author | GlodBlock <1356392126@qq.com> | 2021-07-25 22:20:51 +0800 |
---|---|---|
committer | GlodBlock <1356392126@qq.com> | 2021-07-25 22:20:51 +0800 |
commit | e1bc1013d5fa8a579d509da6e97901b6410959e0 (patch) | |
tree | f29057473b790057cef2cea7734cecd0b4000440 | |
parent | 5ae6979d18f6a729a5267563cc03c66e6f227286 (diff) | |
download | GT5-Unofficial-e1bc1013d5fa8a579d509da6e97901b6410959e0.tar.gz GT5-Unofficial-e1bc1013d5fa8a579d509da6e97901b6410959e0.tar.bz2 GT5-Unofficial-e1bc1013d5fa8a579d509da6e97901b6410959e0.zip |
add blocks for LargeEssentiaGenerator
-rw-r--r-- | src/main/java/GoodGenerator/Blocks/RegularBlock/Casing.java | 17 | ||||
-rw-r--r-- | src/main/java/GoodGenerator/Blocks/TEs/LargeEssentiaGenerator.java | 111 | ||||
-rw-r--r-- | src/main/java/GoodGenerator/Blocks/TEs/MultiNqGenerator.java | 2 | ||||
-rw-r--r-- | src/main/java/GoodGenerator/Loader/Loaders.java | 12 | ||||
-rw-r--r-- | src/main/resources/assets/goodgenerator/lang/en_US.lang | 6 | ||||
-rw-r--r-- | src/main/resources/assets/goodgenerator/textures/blocks/MagicCasing.png | bin | 0 -> 2004 bytes | |||
-rw-r--r-- | src/main/resources/assets/goodgenerator/textures/blocks/essentiaCell/1.png | bin | 0 -> 2902 bytes | |||
-rw-r--r-- | src/main/resources/assets/goodgenerator/textures/blocks/essentiaCell/2.png | bin | 0 -> 3130 bytes | |||
-rw-r--r-- | src/main/resources/assets/goodgenerator/textures/blocks/essentiaCell/3.png | bin | 0 -> 3103 bytes |
9 files changed, 146 insertions, 2 deletions
diff --git a/src/main/java/GoodGenerator/Blocks/RegularBlock/Casing.java b/src/main/java/GoodGenerator/Blocks/RegularBlock/Casing.java index 1f856da921..271079a590 100644 --- a/src/main/java/GoodGenerator/Blocks/RegularBlock/Casing.java +++ b/src/main/java/GoodGenerator/Blocks/RegularBlock/Casing.java @@ -1,5 +1,6 @@ package GoodGenerator.Blocks.RegularBlock; +import GoodGenerator.Main.GoodGenerator; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.GregTech_API; @@ -9,10 +10,14 @@ import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.Entity; import net.minecraft.entity.EnumCreatureType; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; +import java.util.List; + public class Casing extends Block { @SideOnly(Side.CLIENT) @@ -27,6 +32,7 @@ public class Casing extends Block { this.name = name; this.textureNames = texture; this.setHarvestLevel("wrench",2); + this.setCreativeTab(GoodGenerator.GG); GregTech_API.registerMachineBlock(this, -1); } @@ -37,6 +43,7 @@ public class Casing extends Block { this.name = name; this.textureNames = texture; this.setHarvestLevel("wrench",2); + this.setCreativeTab(GoodGenerator.GG); GregTech_API.registerMachineBlock(this, -1); } @@ -47,6 +54,7 @@ public class Casing extends Block { this.name = name; this.textureNames = texture; this.setHarvestLevel("wrench",2); + this.setCreativeTab(GoodGenerator.GG); GregTech_API.registerMachineBlock(this, -1); } @@ -71,6 +79,15 @@ public class Casing extends Block { } @Override + @SideOnly(Side.CLIENT) + @SuppressWarnings("unchecked") + public void getSubBlocks(Item item, CreativeTabs tab, List list) { + for (int i = 0; i < this.textureNames.length; i++) { + list.add(new ItemStack(item, 1, i)); + } + } + + @Override public void onBlockAdded(World aWorld, int aX, int aY, int aZ) { if (GregTech_API.isMachineBlock(this, aWorld.getBlockMetadata(aX, aY, aZ))) { GregTech_API.causeMachineUpdate(aWorld, aX, aY, aZ); diff --git a/src/main/java/GoodGenerator/Blocks/TEs/LargeEssentiaGenerator.java b/src/main/java/GoodGenerator/Blocks/TEs/LargeEssentiaGenerator.java new file mode 100644 index 0000000000..5c2a76170e --- /dev/null +++ b/src/main/java/GoodGenerator/Blocks/TEs/LargeEssentiaGenerator.java @@ -0,0 +1,111 @@ +package GoodGenerator.Blocks.TEs; + +import com.github.bartimaeusnek.crossmod.tectech.TecTechEnabledMulti; +import com.github.technus.tectech.mechanics.constructable.IConstructable; +import com.github.technus.tectech.mechanics.structure.IStructureDefinition; +import com.github.technus.tectech.mechanics.structure.StructureDefinition; +import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_EnergyMulti; +import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_EnergyTunnel; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Energy; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; +import net.minecraftforge.common.util.ForgeDirection; +import thaumcraft.api.aspects.Aspect; +import thaumcraft.api.aspects.AspectSourceHelper; + +import java.util.ArrayList; +import java.util.List; + +import static com.github.technus.tectech.mechanics.structure.StructureUtility.transpose; + +public class LargeEssentiaGenerator extends GT_MetaTileEntity_MultiblockBase_EM implements TecTechEnabledMulti, IConstructable { + + private IStructureDefinition<LargeEssentiaGenerator> multiDefinition = null; + protected List<Aspect> mAvailableAspects; + protected final int MAX_RANGE = 20; + protected final int ENERGY_PER_ESSENTIA = 512; + + public LargeEssentiaGenerator(String name){ + super(name); + } + + public LargeEssentiaGenerator(int id, String name, String nameRegional){ + super(id,name,nameRegional); + } + + @Override + public List<GT_MetaTileEntity_Hatch_Energy> getVanillaEnergyHatches() { + return this.mEnergyHatches; + } + + @Override + public List<GT_MetaTileEntity_Hatch_EnergyTunnel> getTecTechEnergyTunnels() { + return new ArrayList<>(); + } + + @Override + public List<GT_MetaTileEntity_Hatch_EnergyMulti> getTecTechEnergyMultis() { + return new ArrayList<>(); + } + + @Override + public void construct(ItemStack itemStack, boolean b) { + + } + + @Override + public IStructureDefinition<LargeEssentiaGenerator> getStructure_EM() { + if(multiDefinition == null) { + multiDefinition = StructureDefinition + .<LargeEssentiaGenerator>builder() + .addShape(mName, + transpose(new String[][]{ + {}, + {}, + {}, + {}, + {}, + {}, + {} + }) + ) + .build(); + } + return multiDefinition; + } + + List<Aspect> getAvailableAspects() { + return mAvailableAspects; + } + + private long absorbFromEssentiaContainers() { + long tEU = 0; + + long tEUtoGen = getBaseMetaTileEntity().getEUCapacity() - getBaseMetaTileEntity().getUniversalEnergyStored(); + List<Aspect> mAvailableEssentiaAspects = getAvailableAspects(); + + for (int i = mAvailableEssentiaAspects.size() - 1; i >= 0 && tEUtoGen > 0; i--) { + Aspect aspect = mAvailableEssentiaAspects.get(i); + long tAspectEU = (ENERGY_PER_ESSENTIA * mEfficiency) / 100; + if (tAspectEU <= tEUtoGen + && AspectSourceHelper.drainEssentia((TileEntity) getBaseMetaTileEntity(), aspect, ForgeDirection.UNKNOWN, MAX_RANGE)) { + tEUtoGen -= tAspectEU; + tEU += tAspectEU; + } + } + return tEU; + } + + @Override + public String[] getStructureDescription(ItemStack itemStack) { + return new String[0]; + } + + @Override + public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + return new LargeEssentiaGenerator(this.mName); + } +} diff --git a/src/main/java/GoodGenerator/Blocks/TEs/MultiNqGenerator.java b/src/main/java/GoodGenerator/Blocks/TEs/MultiNqGenerator.java index f5aa0af2e0..f2f9279b37 100644 --- a/src/main/java/GoodGenerator/Blocks/TEs/MultiNqGenerator.java +++ b/src/main/java/GoodGenerator/Blocks/TEs/MultiNqGenerator.java @@ -275,7 +275,7 @@ public class MultiNqGenerator extends GT_MetaTileEntity_MultiblockBase_EM implem else this.mOutputFluids = null; if (tFluids.contains(Materials.LiquidAir.getFluid(120)) && tFluids.get(tFluids.indexOf(Materials.LiquidAir.getFluid(120))).amount >= 120){ depleteInput(Materials.LiquidAir.getFluid(120)); - addAutoEnergy((long)(outputEU*times*booster)); + addAutoEnergy((long)(((long)outputEU)*(times*booster))); this.mEUt = (int)(outputEU*times*booster); } else{ diff --git a/src/main/java/GoodGenerator/Loader/Loaders.java b/src/main/java/GoodGenerator/Loader/Loaders.java index 44d845a706..32af1052d6 100644 --- a/src/main/java/GoodGenerator/Loader/Loaders.java +++ b/src/main/java/GoodGenerator/Loader/Loaders.java @@ -3,11 +3,13 @@ package GoodGenerator.Loader; import GoodGenerator.Blocks.RegularBlock.Casing; import GoodGenerator.Blocks.RegularBlock.Frame; import GoodGenerator.Blocks.TEs.FuelRefineFactory; +import GoodGenerator.Blocks.TEs.LargeEssentiaGenerator; import GoodGenerator.Blocks.TEs.MultiNqGenerator; import GoodGenerator.Blocks.TEs.UniversalChemicalFuelEngine; import GoodGenerator.Items.MyItemBlocks; import GoodGenerator.Items.MyItems; import GoodGenerator.Main.GoodGenerator; +import cpw.mods.fml.common.Loader; import cpw.mods.fml.common.registry.GameRegistry; import net.minecraft.block.Block; import net.minecraft.item.Item; @@ -43,10 +45,15 @@ public class Loaders { public static final Block fieldRestrictingGlass = new Frame("fieldRestrictingGlass", new String[]{GoodGenerator.MOD_ID+":fieldRestrictingGlass"}); public static final Block rawCylinder = new Casing("rawCylinder", new String[]{GoodGenerator.MOD_ID+":rawCylinder"}); public static final Block titaniumPlatedCylinder = new Casing("titaniumPlatedCylinder", new String[]{GoodGenerator.MOD_ID+":titaniumPlatedCylinder"}); + public static final Block magicCasing = new Casing("magicCasing", new String[]{GoodGenerator.MOD_ID+":MagicCasing"}); + public static final Block essentiaCell = new Casing("essentiaCell", new String[]{GoodGenerator.MOD_ID+":essentiaCell/1",GoodGenerator.MOD_ID+":essentiaCell/2",GoodGenerator.MOD_ID+":essentiaCell/3"}); + + public static final Block[] essentiaCells = new Block[]{essentiaCell}; public static ItemStack MAR; public static ItemStack FRF; public static ItemStack UCFE; + public static ItemStack LEG; public static void Register(){ GameRegistry.registerBlock(MAR_Casing, MyItemBlocks.class, "MAR_Casing"); @@ -76,6 +83,11 @@ public class Loaders { Loaders.MAR = new MultiNqGenerator(12732, "NaG", "Large Naquadah Reactor").getStackForm(1L); Loaders.FRF = new FuelRefineFactory(16999, "FRF", "Naquadah Fuel Refinery").getStackForm(1L); Loaders.UCFE = new UniversalChemicalFuelEngine(IDOffset, "UniversalChemicalFuelEngine", "Universal Chemical Fuel Engine").getStackForm(1L); + /*if (Loader.isModLoaded("Thaumcraft")){ + GameRegistry.registerBlock(magicCasing, MyItemBlocks.class, "magicCasing"); + GameRegistry.registerBlock(essentiaCells[0], MyItemBlocks.class, "essentiaCell"); + Loaders.LEG = new LargeEssentiaGenerator(IDOffset + 1, "LargeEssentiaGenerator", "Large Essentia Generator").getStackForm(1L); + }*/ } public static void addOreDic(){ diff --git a/src/main/resources/assets/goodgenerator/lang/en_US.lang b/src/main/resources/assets/goodgenerator/lang/en_US.lang index 7a92103a65..1c96653306 100644 --- a/src/main/resources/assets/goodgenerator/lang/en_US.lang +++ b/src/main/resources/assets/goodgenerator/lang/en_US.lang @@ -8,6 +8,10 @@ FRF_Coil_3.0.name=Ultimate Field Restriction Coil FRF_Casing.0.name=Naquadah Fuel Refine Factory Casing rawCylinder.0.name=Raw Cylinder titaniumPlatedCylinder.0.name=Titanium Plated Cylinder +magicCasing.0.name=Magic Casing +essentiaCell.0.name=Novice Essentia Diffusion Cell +essentiaCell.1.name=Adept Essentia Diffusion Cell +essentiaCell.2.name=Master Essentia Diffusion Cell item.radiationProtectionPlate.name=Radiation Proof Plate item.wrappedUraniumIngot.name=Wrapped Uranium Ingot @@ -76,7 +80,7 @@ MultiNqGenerator.hint.0=6x TungstenSteel Pipe Casing MultiNqGenerator.hint.1=48x Field Restriction Casing MultiNqGenerator.hint.2=36x Radiation Proof Steel Frame Box MultiNqGenerator.hint.3=At least 77x Radiation Proof Machine Casing -MultiNqGenerator.hint.4=1~3x Input Hatch +MultiNqGenerator.hint.4=1~4x Input Hatch MultiNqGenerator.hint.5=0~1x Output Hatch MultiNqGenerator.hint.6=1x Maintenance Hatch MultiNqGenerator.hint.7=1x Dynamo Hatch diff --git a/src/main/resources/assets/goodgenerator/textures/blocks/MagicCasing.png b/src/main/resources/assets/goodgenerator/textures/blocks/MagicCasing.png Binary files differnew file mode 100644 index 0000000000..7506fe8cc9 --- /dev/null +++ b/src/main/resources/assets/goodgenerator/textures/blocks/MagicCasing.png diff --git a/src/main/resources/assets/goodgenerator/textures/blocks/essentiaCell/1.png b/src/main/resources/assets/goodgenerator/textures/blocks/essentiaCell/1.png Binary files differnew file mode 100644 index 0000000000..21bc344c9c --- /dev/null +++ b/src/main/resources/assets/goodgenerator/textures/blocks/essentiaCell/1.png diff --git a/src/main/resources/assets/goodgenerator/textures/blocks/essentiaCell/2.png b/src/main/resources/assets/goodgenerator/textures/blocks/essentiaCell/2.png Binary files differnew file mode 100644 index 0000000000..fd6f9d0d4b --- /dev/null +++ b/src/main/resources/assets/goodgenerator/textures/blocks/essentiaCell/2.png diff --git a/src/main/resources/assets/goodgenerator/textures/blocks/essentiaCell/3.png b/src/main/resources/assets/goodgenerator/textures/blocks/essentiaCell/3.png Binary files differnew file mode 100644 index 0000000000..c3a976cc13 --- /dev/null +++ b/src/main/resources/assets/goodgenerator/textures/blocks/essentiaCell/3.png |