Fixed compat with Thaumcraft
This commit is contained in:
parent
34572e8eb7
commit
34df39b5f7
6 changed files with 186 additions and 81 deletions
Binary file not shown.
|
@ -6,7 +6,7 @@ import net.minecraft.entity.player.EntityPlayer;
|
|||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.inventory.ContainerWorkbench;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.network.packet.Packet100OpenWindow;
|
||||
import net.minecraft.network.play.server.S2DPacketOpenWindow;
|
||||
|
||||
public class GT_Cover_Crafting extends GT_CoverBehavior {
|
||||
|
||||
|
@ -17,15 +17,16 @@ public class GT_Cover_Crafting extends GT_CoverBehavior {
|
|||
@Override
|
||||
public boolean onCoverRightclick(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity, EntityPlayer aPlayer, float aX, float aY, float aZ) {
|
||||
if (aPlayer instanceof EntityPlayerMP) {
|
||||
((EntityPlayerMP)aPlayer).incrementWindowID();
|
||||
((EntityPlayerMP)aPlayer).playerNetServerHandler.sendPacketToPlayer(new Packet100OpenWindow(((EntityPlayerMP)aPlayer).currentWindowId, 1, "Crafting", 9, true));
|
||||
((EntityPlayerMP)aPlayer).openContainer = new ContainerWorkbench(((EntityPlayerMP)aPlayer).inventory, ((EntityPlayerMP)aPlayer).worldObj, aTileEntity.getXCoord(), aTileEntity.getYCoord(), aTileEntity.getZCoord()) {
|
||||
EntityPlayerMP tMPPlayer = (EntityPlayerMP) aPlayer;
|
||||
tMPPlayer.getNextWindowId();
|
||||
tMPPlayer.playerNetServerHandler.sendPacket(new S2DPacketOpenWindow(tMPPlayer.currentWindowId, 1, "Crafting", 9, true));
|
||||
tMPPlayer.openContainer = new ContainerWorkbench(tMPPlayer.inventory, tMPPlayer.worldObj, aTileEntity.getXCoord(), aTileEntity.getYCoord(), aTileEntity.getZCoord()) {
|
||||
public boolean canInteractWith(EntityPlayer par1EntityPlayer) {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
((EntityPlayerMP)aPlayer).openContainer.windowId = ((EntityPlayerMP)aPlayer).currentWindowId;
|
||||
((EntityPlayerMP)aPlayer).openContainer.addCraftingToCrafters(((EntityPlayerMP)aPlayer));
|
||||
tMPPlayer.openContainer.windowId = tMPPlayer.currentWindowId;
|
||||
tMPPlayer.openContainer.addCraftingToCrafters(tMPPlayer);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -1,29 +1,40 @@
|
|||
package gregtechmod.common.tileentities;
|
||||
|
||||
import java.lang.ref.SoftReference;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import cpw.mods.fml.common.network.NetworkRegistry;
|
||||
import gregtechmod.api.enums.GT_ConfigCategories;
|
||||
import gregtechmod.api.interfaces.IGregTechTileEntity;
|
||||
import gregtechmod.api.metatileentity.MetaTileEntity;
|
||||
import gregtechmod.api.util.GT_Config;
|
||||
import net.minecraft.block.Block;
|
||||
import gregtechmod.api.util.GT_Log;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import thaumcraft.api.EnumTag;
|
||||
import thaumcraft.api.ObjectTags;
|
||||
import thaumcraft.common.aura.AuraManager;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
import thaumcraft.api.aspects.AspectList;
|
||||
import thaumcraft.common.lib.network.PacketHandler;
|
||||
import thaumcraft.common.lib.network.fx.PacketFXEssentiaSource;
|
||||
import thaumcraft.common.tiles.TileNode;
|
||||
|
||||
public class GT_MetaTileEntity_DragonEggEnergySiphon extends MetaTileEntity {
|
||||
|
||||
public static int sDragonEggEnergyPerTick = 128;
|
||||
public static boolean sAllowMultipleEggs = false, sAllowFlux = true;
|
||||
private SoftReference<TileNode> cachedNode = new SoftReference<>(null);
|
||||
|
||||
public static GT_MetaTileEntity_DragonEggEnergySiphon mActiveSiphon = null;
|
||||
|
||||
public GT_MetaTileEntity_DragonEggEnergySiphon(int aID, String mName) {
|
||||
super(aID, mName);
|
||||
}
|
||||
// TODO thaumcraft kekw
|
||||
|
||||
public GT_MetaTileEntity_DragonEggEnergySiphon() {
|
||||
|
||||
}
|
||||
|
@ -91,22 +102,36 @@ public class GT_MetaTileEntity_DragonEggEnergySiphon extends MetaTileEntity {
|
|||
if (getBaseMetaTileEntity().increaseStoredEnergyUnits(sDragonEggEnergyPerTick, false)) {
|
||||
if (sAllowFlux) {
|
||||
try {
|
||||
ObjectTags tTags = new ObjectTags();
|
||||
switch (getBaseMetaTileEntity().getRandomNumber(1000)) {
|
||||
case 0: tTags.add(EnumTag.MECHANISM, 3); break;
|
||||
case 1: tTags.add(EnumTag.CONTROL, 1); break;
|
||||
case 2: tTags.add(EnumTag.VOID, 1); break;
|
||||
case 3: tTags.add(EnumTag.FLUX, 2); break;
|
||||
case 4: tTags.add(EnumTag.ELDRITCH, 2); break;
|
||||
case 5: tTags.add(EnumTag.EXCHANGE, 1); break;
|
||||
case 6: tTags.add(EnumTag.MAGIC, 1); break;
|
||||
case 7: tTags.add(EnumTag.POWER, 1); break;
|
||||
case 8: tTags.add(EnumTag.MOTION, 3); break;
|
||||
case 9: tTags.add(EnumTag.SPIRIT, 5); break;
|
||||
default: tTags = null; break;
|
||||
if (this.findNode()) {
|
||||
TileNode node = cachedNode.get();
|
||||
AspectList aspects = new AspectList();
|
||||
switch (getBaseMetaTileEntity().getRandomNumber(1000)) {
|
||||
case 0: aspects.add(Aspect.MECHANISM, 3); break;
|
||||
case 1: aspects.add(Aspect.VOID, 1); break;
|
||||
case 2: aspects.add(Aspect.ELDRITCH, 2); break;
|
||||
case 3: aspects.add(Aspect.EXCHANGE, 1); break;
|
||||
case 4: aspects.add(Aspect.MAGIC, 1); break;
|
||||
case 5: aspects.add(Aspect.MOTION, 3); break;
|
||||
case 6: aspects.add(Aspect.AIR, 2); break;
|
||||
case 7: aspects.add(Aspect.EARTH, 2); break;
|
||||
case 8: aspects.add(Aspect.FIRE, 2); break;
|
||||
case 9: aspects.add(Aspect.WATER, 2); break;
|
||||
case 10: aspects.add(Aspect.ORDER, 2); break;
|
||||
case 11: aspects.add(Aspect.ENTROPY, 2); break;
|
||||
}
|
||||
|
||||
if (!aspects.aspects.isEmpty()) {
|
||||
Aspect toAdd = aspects.getAspects()[0];
|
||||
TileEntity tThis = (TileEntity) this.getBaseMetaTileEntity();
|
||||
node.getAspects().add(aspects);
|
||||
node.nodeChange();
|
||||
PacketHandler.INSTANCE.sendToAllAround(new PacketFXEssentiaSource(node.xCoord, node.yCoord, node.zCoord, (byte)(node.xCoord - tThis.xCoord), (byte)(node.yCoord - tThis.yCoord), (byte)(node.zCoord - tThis.zCoord), toAdd.getColor()),
|
||||
new NetworkRegistry.TargetPoint(node.getWorldObj().provider.dimensionId, node.xCoord, node.yCoord, node.zCoord, 32.0));
|
||||
}
|
||||
}
|
||||
if (tTags != null) AuraManager.addFluxToClosest(getBaseMetaTileEntity().getWorld(), getBaseMetaTileEntity().getXCoord(), getBaseMetaTileEntity().getYCoord(), getBaseMetaTileEntity().getZCoord(), tTags);
|
||||
} catch(Throwable e) {}
|
||||
} catch(Throwable e) {
|
||||
GT_Log.log.catching(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (mActiveSiphon != this && !sAllowMultipleEggs)
|
||||
|
@ -122,6 +147,50 @@ public class GT_MetaTileEntity_DragonEggEnergySiphon extends MetaTileEntity {
|
|||
}
|
||||
}
|
||||
|
||||
private boolean findNode() {
|
||||
List<ArrayList<Integer>> nodesCoords = TileNode.locations.entrySet().stream()
|
||||
.map(entry -> entry.getValue())
|
||||
.collect(Collectors.toList());
|
||||
TileEntity tThis = (TileEntity) this.getBaseMetaTileEntity();
|
||||
World tWorld = tThis.getWorldObj();
|
||||
|
||||
List<Integer> coords = null;
|
||||
double dist = Double.MAX_VALUE;
|
||||
for (ArrayList<Integer> nodeEntry : nodesCoords) {
|
||||
if (nodeEntry.get(0) == tWorld.provider.dimensionId) {
|
||||
double deltaX = tThis.xCoord + 0.5 - nodeEntry.get(1);
|
||||
double deltaY = tThis.yCoord + 0.5 - nodeEntry.get(2);
|
||||
double deltaZ = tThis.zCoord + 0.5 - nodeEntry.get(3);
|
||||
double temp = deltaX * deltaX + deltaY * deltaY + deltaZ * deltaZ;
|
||||
if (temp < dist) {
|
||||
dist = temp;
|
||||
coords = nodeEntry;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (coords != null && !coords.isEmpty()) {
|
||||
TileEntity tr = tWorld.getTileEntity(coords.get(1), coords.get(2), coords.get(3));
|
||||
if (tr != null && tr instanceof TileNode) {
|
||||
TileNode node = (TileNode) tr;
|
||||
if (node.isInvalid()) {
|
||||
String key = node.getId();
|
||||
node = null;
|
||||
TileNode.locations.remove(key);
|
||||
System.gc();
|
||||
return false;
|
||||
}
|
||||
|
||||
this.cachedNode = new SoftReference<>(node);
|
||||
return true;
|
||||
} else {
|
||||
TileNode.locations.remove(String.format("%d:%d:%d:%d", coords.get(0), coords.get(1), coords.get(2), coords.get(3)));
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMainInfo() {
|
||||
return getBaseMetaTileEntity().isActive()?"Active":"Inactive";
|
||||
|
|
|
@ -8,29 +8,36 @@ import gregtechmod.api.util.GT_Config;
|
|||
import gregtechmod.api.util.GT_Log;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import net.minecraft.enchantment.Enchantment;
|
||||
import net.minecraft.entity.item.EntityEnderCrystal;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemEnchantedBook;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import thaumcraft.api.EnumTag;
|
||||
import thaumcraft.api.ObjectTags;
|
||||
import thaumcraft.common.aura.AuraManager;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
import thaumcraft.api.aspects.AspectSourceHelper;
|
||||
import thaumcraft.common.blocks.BlockTaintFibres;
|
||||
import thaumcraft.common.entities.monster.EntityWisp;
|
||||
// TODO THAUMCRAFT KEK
|
||||
import thaumcraft.common.lib.events.EssentiaHandler;
|
||||
import thaumcraft.common.lib.utils.Utils;
|
||||
import thaumcraft.common.lib.world.ThaumcraftWorldGenerator;
|
||||
|
||||
public class GT_MetaTileEntity_MagicEnergyAbsorber extends MetaTileEntity {
|
||||
|
||||
public static int sEnergyPerEnderCrystal = 32, sEnergyFromVis = 12800;
|
||||
|
||||
public static final ArrayList<EntityEnderCrystal> sUsedDragonCrystalList = new ArrayList<EntityEnderCrystal>();
|
||||
public static final Aspect[] supportedAspects = new Aspect[] {Aspect.AIR, Aspect.EARTH, Aspect.FIRE, Aspect.WATER, Aspect.ORDER, Aspect.ENTROPY};
|
||||
|
||||
public EntityEnderCrystal mTargetedCrystal;
|
||||
|
||||
private int elementIndex = 0;
|
||||
private Aspect energySource = null;
|
||||
public boolean isActive1 = false, isActive2 = false;
|
||||
|
||||
public GT_MetaTileEntity_MagicEnergyAbsorber(int aID, String mName) {
|
||||
|
@ -85,8 +92,14 @@ public class GT_MetaTileEntity_MagicEnergyAbsorber extends MetaTileEntity {
|
|||
sUsedDragonCrystalList.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public void onPostTick() {
|
||||
if (getBaseMetaTileEntity().isServerSide() && energySource == null && getBaseMetaTileEntity().getWorld().getWorldTime() % 20 == 0) {
|
||||
elementIndex = (elementIndex + 1) < 6 ? elementIndex + 1 : 0;
|
||||
energySource = supportedAspects[elementIndex];
|
||||
}
|
||||
|
||||
if (getBaseMetaTileEntity().isServerSide() && getBaseMetaTileEntity().isAllowedToWork() && getBaseMetaTileEntity().getTimer()%10==0) {
|
||||
if (getBaseMetaTileEntity().getUniversalEnergyStored() < (getBaseMetaTileEntity().getOutputVoltage() * 10 + getMinimumStoredEU())) {
|
||||
try {
|
||||
|
@ -95,8 +108,8 @@ public class GT_MetaTileEntity_MagicEnergyAbsorber extends MetaTileEntity {
|
|||
NBTTagList tEnchantments = mInventory[0].getEnchantmentTagList();
|
||||
if (tEnchantments != null) {
|
||||
for (int i = 0; i < tEnchantments.tagCount(); i++) {
|
||||
short tID = ((NBTTagCompound)tEnchantments.tagAt(i)).getShort("id");
|
||||
short tLevel = ((NBTTagCompound)tEnchantments.tagAt(i)).getShort("lvl");
|
||||
short tID = ((NBTTagCompound)tEnchantments.getCompoundTagAt(i)).getShort("id");
|
||||
short tLevel = ((NBTTagCompound)tEnchantments.getCompoundTagAt(i)).getShort("lvl");
|
||||
if (tID > -1 && tID < Enchantment.enchantmentsList.length) {
|
||||
Enchantment tEnchantment = Enchantment.enchantmentsList[tID];
|
||||
if (tEnchantment != null) {
|
||||
|
@ -110,8 +123,8 @@ public class GT_MetaTileEntity_MagicEnergyAbsorber extends MetaTileEntity {
|
|||
NBTTagList tEnchantments = ((ItemEnchantedBook)mInventory[0].getItem()).func_92110_g(mInventory[0]);
|
||||
if (tEnchantments != null) {
|
||||
for (int i = 0; i < tEnchantments.tagCount(); i++) {
|
||||
short tID = ((NBTTagCompound)tEnchantments.tagAt(i)).getShort("id");
|
||||
short tLevel = ((NBTTagCompound)tEnchantments.tagAt(i)).getShort("lvl");
|
||||
short tID = ((NBTTagCompound)tEnchantments.getCompoundTagAt(i)).getShort("id");
|
||||
short tLevel = ((NBTTagCompound)tEnchantments.getCompoundTagAt(i)).getShort("lvl");
|
||||
if (tID > -1 && tID < Enchantment.enchantmentsList.length) {
|
||||
Enchantment tEnchantment = Enchantment.enchantmentsList[tID];
|
||||
if (tEnchantment != null) {
|
||||
|
@ -119,7 +132,7 @@ public class GT_MetaTileEntity_MagicEnergyAbsorber extends MetaTileEntity {
|
|||
}
|
||||
}
|
||||
}
|
||||
mInventory[0] = new ItemStack(Item.book, 1);
|
||||
mInventory[0] = new ItemStack(Items.book, 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -127,7 +140,7 @@ public class GT_MetaTileEntity_MagicEnergyAbsorber extends MetaTileEntity {
|
|||
mInventory[0] = null;
|
||||
}
|
||||
} catch(Throwable e) {
|
||||
if (GregTech_API.DEBUG_MODE) e.printStackTrace(GT_Log.err);
|
||||
if (GregTech_API.DEBUG_MODE) GT_Log.log.catching(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -155,18 +168,15 @@ public class GT_MetaTileEntity_MagicEnergyAbsorber extends MetaTileEntity {
|
|||
|
||||
if (sEnergyFromVis > 0 && isActive2 && getBaseMetaTileEntity().getUniversalEnergyStored() < sEnergyFromVis) {
|
||||
try {
|
||||
if (AuraManager.decreaseClosestAura(getBaseMetaTileEntity().getWorld(), getBaseMetaTileEntity().getXCoord(), getBaseMetaTileEntity().getYCoord(), getBaseMetaTileEntity().getZCoord(), 1)) {
|
||||
getBaseMetaTileEntity().increaseStoredEnergyUnits(sEnergyFromVis, true);
|
||||
ObjectTags tTags = new ObjectTags();
|
||||
tTags.add(EnumTag.MECHANISM, 1 + getBaseMetaTileEntity().getRandomNumber(3));
|
||||
tTags.add(EnumTag.VOID, 1 + getBaseMetaTileEntity().getRandomNumber(2));
|
||||
tTags.add(EnumTag.FLUX, 1 + getBaseMetaTileEntity().getRandomNumber(2));
|
||||
AuraManager.addFluxToClosest(getBaseMetaTileEntity().getWorld(), getBaseMetaTileEntity().getXCoord(), getBaseMetaTileEntity().getYCoord(), getBaseMetaTileEntity().getZCoord(), tTags);
|
||||
ArrayList<EntityWisp> tList = (ArrayList<EntityWisp>)getBaseMetaTileEntity().getWorld().getEntitiesWithinAABB(EntityWisp.class, AxisAlignedBB.getBoundingBox(getBaseMetaTileEntity().getXCoord()-8, getBaseMetaTileEntity().getYCoord()-8, getBaseMetaTileEntity().getZCoord()-8, getBaseMetaTileEntity().getXCoord()+8, getBaseMetaTileEntity().getYCoord()+8, getBaseMetaTileEntity().getZCoord()+8));
|
||||
if (!tList.isEmpty()) getBaseMetaTileEntity().doExplosion(8192);
|
||||
}
|
||||
if (energySource != null && EssentiaHandler.findEssentia((TileEntity) this.getBaseMetaTileEntity(), energySource, ForgeDirection.UNKNOWN, 20)) {
|
||||
if (AspectSourceHelper.drainEssentia((TileEntity) this.getBaseMetaTileEntity(), energySource, ForgeDirection.UNKNOWN, 20)) {
|
||||
getBaseMetaTileEntity().increaseStoredEnergyUnits(sEnergyFromVis, true);
|
||||
ArrayList<EntityWisp> tList = (ArrayList<EntityWisp>)getBaseMetaTileEntity().getWorld().getEntitiesWithinAABB(EntityWisp.class, AxisAlignedBB.getBoundingBox(getBaseMetaTileEntity().getXCoord()-8, getBaseMetaTileEntity().getYCoord()-8, getBaseMetaTileEntity().getZCoord()-8, getBaseMetaTileEntity().getXCoord()+8, getBaseMetaTileEntity().getYCoord()+8, getBaseMetaTileEntity().getZCoord()+8));
|
||||
if (!tList.isEmpty()) getBaseMetaTileEntity().doExplosion(8192);
|
||||
}
|
||||
} else energySource = null;
|
||||
} catch(Throwable e) {
|
||||
if (GregTech_API.DEBUG_MODE) e.printStackTrace(GT_Log.err);
|
||||
if (GregTech_API.DEBUG_MODE) GT_Log.log.catching(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -178,18 +188,29 @@ public class GT_MetaTileEntity_MagicEnergyAbsorber extends MetaTileEntity {
|
|||
public void onExplosion() {
|
||||
if (sEnergyFromVis > 0 && isActive2) {
|
||||
try {
|
||||
ObjectTags tTags = new ObjectTags();
|
||||
tTags.add(EnumTag.MECHANISM, 50 + getBaseMetaTileEntity().getRandomNumber(50));
|
||||
tTags.add(EnumTag.DESTRUCTION, 50 + getBaseMetaTileEntity().getRandomNumber(50));
|
||||
tTags.add(EnumTag.FLUX, 50 + getBaseMetaTileEntity().getRandomNumber(50));
|
||||
tTags.add(EnumTag.EVIL, 50 + getBaseMetaTileEntity().getRandomNumber(50));
|
||||
tTags.add(EnumTag.FIRE, 50 + getBaseMetaTileEntity().getRandomNumber(50));
|
||||
tTags.add(EnumTag.DARK, 50 + getBaseMetaTileEntity().getRandomNumber(50));
|
||||
tTags.add(EnumTag.POWER, 50 + getBaseMetaTileEntity().getRandomNumber(50));
|
||||
tTags.add(EnumTag.VOID, 50 + getBaseMetaTileEntity().getRandomNumber(50));
|
||||
AuraManager.addFluxToClosest(getBaseMetaTileEntity().getWorld(), getBaseMetaTileEntity().getXCoord(), getBaseMetaTileEntity().getYCoord(), getBaseMetaTileEntity().getZCoord(), tTags);
|
||||
TileEntity te = (TileEntity) this.getBaseMetaTileEntity();
|
||||
World tWorld = this.getBaseMetaTileEntity().getWorld();
|
||||
int iterations = getBaseMetaTileEntity().getRandomNumber(200) + 100;
|
||||
int x = 0;
|
||||
int z = 0;
|
||||
int y = 0;
|
||||
for (int i = 0; i < iterations; i++) {
|
||||
x = te.xCoord + tWorld.rand.nextInt(16) - tWorld.rand.nextInt(16);
|
||||
z = te.zCoord + tWorld.rand.nextInt(16) - tWorld.rand.nextInt(16);
|
||||
final BiomeGenBase bg = tWorld.getBiomeGenForCoords(x, z);
|
||||
if (bg.biomeID != ThaumcraftWorldGenerator.biomeTaint.biomeID) {
|
||||
Utils.setBiomeAt(tWorld, x, z, ThaumcraftWorldGenerator.biomeTaint);
|
||||
}
|
||||
if (tWorld.rand.nextBoolean()) {
|
||||
x = te.xCoord + tWorld.rand.nextInt(10) - tWorld.rand.nextInt(10);
|
||||
z = te.zCoord + tWorld.rand.nextInt(10) - tWorld.rand.nextInt(10);
|
||||
y = te.yCoord + tWorld.rand.nextInt(5) - tWorld.rand.nextInt(5);
|
||||
if (BlockTaintFibres.spreadFibres(tWorld, x, y, z)) {
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch(Throwable e) {
|
||||
if (GregTech_API.DEBUG_MODE) e.printStackTrace(GT_Log.err);
|
||||
if (GregTech_API.DEBUG_MODE) GT_Log.log.catching(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,13 +5,16 @@ import gregtechmod.api.metatileentity.MetaTileEntity;
|
|||
import gregtechmod.api.metatileentity.implementations.GT_MetaTileEntity_BasicTank;
|
||||
import gregtechmod.api.util.GT_Recipe;
|
||||
import gregtechmod.api.util.GT_Utility;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import thaumcraft.api.EnumTag;
|
||||
import thaumcraft.api.ObjectTags;
|
||||
import thaumcraft.common.aura.AuraManager;
|
||||
import thaumcraft.common.blocks.BlockTaintFibres;
|
||||
import thaumcraft.common.lib.utils.Utils;
|
||||
import thaumcraft.common.lib.world.ThaumcraftWorldGenerator;
|
||||
|
||||
public class GT_MetaTileEntity_MagicEnergyConverter extends GT_MetaTileEntity_BasicTank {
|
||||
|
||||
|
@ -54,7 +57,7 @@ public class GT_MetaTileEntity_MagicEnergyConverter extends GT_MetaTileEntity_Ba
|
|||
mInventory[2] = null;
|
||||
else
|
||||
if (mInventory[2] == null)
|
||||
mInventory[2] = new ItemStack(Block.fire, 1);
|
||||
mInventory[2] = new ItemStack(Blocks.fire, 1);
|
||||
} else {
|
||||
if (getFuelValue(mFluid) > 0) while (getBaseMetaTileEntity().getUniversalEnergyStored() < (getBaseMetaTileEntity().getOutputVoltage() * 10 + getMinimumStoredEU()) && mFluid.amount > 0) {
|
||||
if (getBaseMetaTileEntity().increaseStoredEnergyUnits(getFuelValue(mFluid), true)) mFluid.amount--;
|
||||
|
@ -94,16 +97,27 @@ public class GT_MetaTileEntity_MagicEnergyConverter extends GT_MetaTileEntity_Ba
|
|||
@Override
|
||||
public void onExplosion() {
|
||||
try {
|
||||
ObjectTags tTags = new ObjectTags();
|
||||
tTags.add(EnumTag.MECHANISM, 20 + getBaseMetaTileEntity().getRandomNumber(20));
|
||||
tTags.add(EnumTag.DESTRUCTION, 20 + getBaseMetaTileEntity().getRandomNumber(20));
|
||||
tTags.add(EnumTag.FLUX, 20 + getBaseMetaTileEntity().getRandomNumber(20));
|
||||
tTags.add(EnumTag.EVIL, 20 + getBaseMetaTileEntity().getRandomNumber(20));
|
||||
tTags.add(EnumTag.FIRE, 20 + getBaseMetaTileEntity().getRandomNumber(20));
|
||||
tTags.add(EnumTag.DARK, 20 + getBaseMetaTileEntity().getRandomNumber(20));
|
||||
tTags.add(EnumTag.POWER, 20 + getBaseMetaTileEntity().getRandomNumber(20));
|
||||
tTags.add(EnumTag.EXCHANGE, 20 + getBaseMetaTileEntity().getRandomNumber(20));
|
||||
AuraManager.addFluxToClosest(getBaseMetaTileEntity().getWorld(), getBaseMetaTileEntity().getXCoord(), getBaseMetaTileEntity().getYCoord(), getBaseMetaTileEntity().getZCoord(), tTags);
|
||||
TileEntity te = (TileEntity) this.getBaseMetaTileEntity();
|
||||
World tWorld = this.getBaseMetaTileEntity().getWorld();
|
||||
int iterations = getBaseMetaTileEntity().getRandomNumber(200) + 100;
|
||||
int x = 0;
|
||||
int z = 0;
|
||||
int y = 0;
|
||||
for (int i = 0; i < iterations; i++) {
|
||||
x = te.xCoord + tWorld.rand.nextInt(16) - tWorld.rand.nextInt(16);
|
||||
z = te.zCoord + tWorld.rand.nextInt(16) - tWorld.rand.nextInt(16);
|
||||
final BiomeGenBase bg = tWorld.getBiomeGenForCoords(x, z);
|
||||
if (bg.biomeID != ThaumcraftWorldGenerator.biomeTaint.biomeID) {
|
||||
Utils.setBiomeAt(tWorld, x, z, ThaumcraftWorldGenerator.biomeTaint);
|
||||
}
|
||||
if (tWorld.rand.nextBoolean()) {
|
||||
x = te.xCoord + tWorld.rand.nextInt(10) - tWorld.rand.nextInt(10);
|
||||
z = te.zCoord + tWorld.rand.nextInt(10) - tWorld.rand.nextInt(10);
|
||||
y = te.yCoord + tWorld.rand.nextInt(5) - tWorld.rand.nextInt(5);
|
||||
if (BlockTaintFibres.spreadFibres(tWorld, x, y, z)) {
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch(Throwable e) {}
|
||||
}
|
||||
|
||||
|
|
|
@ -37,10 +37,10 @@ public class GT_MetaTileEntityLoader implements Runnable {
|
|||
new GT_MetaTileEntity_PlasmaGenerator ( 37, "GT_PlasmaGenerator");
|
||||
new GT_MetaTileEntity_VacuumFreezer ( 38, "GT_VacuumFreezer");
|
||||
new GT_MetaTileEntity_ElectricRegulatorAdvanced ( 39, "GT_RegulatorAdvanced");
|
||||
// new GT_MetaTileEntity_DragonEggEnergySiphon ( 40, "GT_DragonEggEnergySiphon", "metatileentity.GT_DragonEggEnergySiphon.name");
|
||||
new GT_MetaTileEntity_DragonEggEnergySiphon ( 40, "GT_DragonEggEnergySiphon");
|
||||
new GT_MetaTileEntity_ChemicalReactor ( 41, "GT_ChemicalReactor");
|
||||
// new GT_MetaTileEntity_MagicEnergyConverter ( 42, "GT_MagicConverter" , "metatileentity.GT_MagicConverter.name");
|
||||
// new GT_MetaTileEntity_MagicEnergyAbsorber ( 43, "GT_MagicAbsorber" , "metatileentity.GT_MagicAbsorber.name");
|
||||
new GT_MetaTileEntity_MagicEnergyConverter ( 42, "GT_MagicConverter");
|
||||
new GT_MetaTileEntity_MagicEnergyAbsorber ( 43, "GT_MagicAbsorber");
|
||||
new GT_MetaTileEntity_DistillationTower ( 44, "GT_DistillationTower");
|
||||
new GT_MetaTileEntity_Safe ( 45, "GT_Safe");
|
||||
new GT_MetaTileEntity_ElectricInventoryManager ( 46, "GT_InventoryManager");
|
||||
|
|
Loading…
Reference in a new issue