aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com
diff options
context:
space:
mode:
authorBass <basdxz@github.com>2017-08-02 17:07:56 +0100
committerBass <basdxz@github.com>2017-08-02 17:07:56 +0100
commit9e3ded3a2eda24371ae0d996c158f4a48e7fe443 (patch)
treef6faa203b1ba1197d2cc3f82afa06476ba2ac4b9 /src/main/java/com
parent0409d4bccfc32d116612cb8a6a3d0e9e7790c895 (diff)
downloadGT5-Unofficial-9e3ded3a2eda24371ae0d996c158f4a48e7fe443.tar.gz
GT5-Unofficial-9e3ded3a2eda24371ae0d996c158f4a48e7fe443.tar.bz2
GT5-Unofficial-9e3ded3a2eda24371ae0d996c158f4a48e7fe443.zip
Overflow hatch can now be used as a VapE hole
Diffstat (limited to 'src/main/java/com')
-rw-r--r--src/main/java/com/github/technus/tectech/loader/MainLoader.java6
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_MufflerElemental.java30
2 files changed, 35 insertions, 1 deletions
diff --git a/src/main/java/com/github/technus/tectech/loader/MainLoader.java b/src/main/java/com/github/technus/tectech/loader/MainLoader.java
index a370e8a4a4..15e010780a 100644
--- a/src/main/java/com/github/technus/tectech/loader/MainLoader.java
+++ b/src/main/java/com/github/technus/tectech/loader/MainLoader.java
@@ -30,7 +30,7 @@ import static com.github.technus.tectech.magicAddon.EssentiaCompat.essentiaConta
import static com.github.technus.tectech.magicAddon.definitions.AspectDefinitionCompat.aspectDefinitionCompat;
public final class MainLoader {//TODO add checks for - is mod loaded dreamcraft to enable higher tier machinery. (above UV), or implement a check for GT tier values.
- public static DamageSource microwaving;
+ public static DamageSource microwaving, elementalPollution;
public void load() {
ProgressManager.ProgressBar progressBarLoad = ProgressManager.push("TecTech Loader", 6);
@@ -64,6 +64,10 @@ public final class MainLoader {//TODO add checks for - is mod loaded dreamcraft
microwaving=new DamageSource("microwaving");
microwaving.setDamageAllowedInCreativeMode();
microwaving.setDamageBypassesArmor();
+
+ elementalPollution=new DamageSource("elementalPollution");
+ elementalPollution.setDamageAllowedInCreativeMode();
+ elementalPollution.setDamageBypassesArmor();
TecTech.Logger.info("Damage types addition Done");
ProgressManager.pop(progressBarLoad);
diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_MufflerElemental.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_MufflerElemental.java
index 0dcd80d4b5..a297d5bd78 100644
--- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_MufflerElemental.java
+++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_MufflerElemental.java
@@ -10,14 +10,25 @@ import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.metatileentity.MetaTileEntity;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch;
import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_Recipe;
import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.EntityLiving;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.potion.Potion;
+import net.minecraft.potion.PotionEffect;
+import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.world.EnumSkyBlock;
+import net.minecraftforge.common.util.ForgeDirection;
import static com.github.technus.tectech.CommonValues.disperseAt;
+import static com.github.technus.tectech.loader.MainLoader.elementalPollution;
import static gregtech.api.enums.Dyes.MACHINE_METAL;
import static gregtech.api.enums.GT_Values.V;
import static gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity;
@@ -136,6 +147,7 @@ public class GT_MetaTileEntity_Hatch_MufflerElemental extends GT_MetaTileEntity_
aBaseMetaTileEntity.setLightValue((byte) 0);
aBaseMetaTileEntity.getWorld().updateLightByType(EnumSkyBlock.Block, aBaseMetaTileEntity.getXCoord(), aBaseMetaTileEntity.getYCoord(), aBaseMetaTileEntity.getZCoord());
}
+ vapePollution(aBaseMetaTileEntity);
} else {
if (overflowMatter > 0) {
aBaseMetaTileEntity.setActive(true);
@@ -150,6 +162,24 @@ public class GT_MetaTileEntity_Hatch_MufflerElemental extends GT_MetaTileEntity_
//DOES NOT CHECK FOR TOO MUCH, it is done only while putting stuff in (OPTIMIZATION!!!)
}
+ private void vapePollution(IGregTechTileEntity mte){
+ float xPos=mte.getXCoord()+0.5f;
+ float yPos=mte.getYCoord()+0.5f;
+ float zPos=mte.getZCoord()+0.5f;
+
+ int xDirShift = ForgeDirection.getOrientation(mte.getFrontFacing()).offsetX;
+ int yDirShift = ForgeDirection.getOrientation(mte.getFrontFacing()).offsetY;
+ int zDirShift = ForgeDirection.getOrientation(mte.getFrontFacing()).offsetZ;
+
+ AxisAlignedBB aabb=AxisAlignedBB.getBoundingBox(xPos-.5+xDirShift,yPos-.5+yDirShift,zPos-.5+zDirShift,xPos+.5+xDirShift,yPos+1.5+yDirShift,zPos+.5+zDirShift);
+ for (Object entity : mte.getWorld().getEntitiesWithinAABB(EntityLivingBase.class, aabb)) {
+ float damagingFactor = (float)Math.log(overflowDisperse);
+ ((EntityLivingBase) entity).addPotionEffect(new PotionEffect(Potion.confusion.id,1,(int)(damagingFactor*20)));
+ ((EntityLivingBase) entity).addPotionEffect(new PotionEffect(Potion.wither.id,2,(int)(damagingFactor*15)));
+ ((EntityLivingBase) entity).attackEntityFrom(elementalPollution, damagingFactor);
+ }
+ }
+
@Override
public boolean isGivingInformation() {
return true;