aboutsummaryrefslogtreecommitdiff
path: root/main/java/gregtech/api
diff options
context:
space:
mode:
authorBlood-Asp <Blood@Asp>2015-05-19 23:12:36 +0200
committerBlood-Asp <Blood@Asp>2015-05-19 23:12:36 +0200
commita102e63891d2af3452dc9b25d9fd97bc266582b7 (patch)
tree8dc1eea0d0875fdd17750d199649c3c9ac662746 /main/java/gregtech/api
parent20313127ce97c9fe336ac0fa91ab70fc6eee62eb (diff)
downloadGT5-Unofficial-a102e63891d2af3452dc9b25d9fd97bc266582b7.tar.gz
GT5-Unofficial-a102e63891d2af3452dc9b25d9fd97bc266582b7.tar.bz2
GT5-Unofficial-a102e63891d2af3452dc9b25d9fd97bc266582b7.zip
Update 5.08.16
Monster repellator + large turbine
Diffstat (limited to 'main/java/gregtech/api')
-rw-r--r--main/java/gregtech/api/enums/ItemList.java9
-rw-r--r--main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Dynamo.java2
-rw-r--r--main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java23
-rw-r--r--main/java/gregtech/api/util/GT_ModHandler.java79
-rw-r--r--main/java/gregtech/api/util/GT_SpawnEventHandler.java46
5 files changed, 68 insertions, 91 deletions
diff --git a/main/java/gregtech/api/enums/ItemList.java b/main/java/gregtech/api/enums/ItemList.java
index 4ce75cd72a..1bb7c9ec6a 100644
--- a/main/java/gregtech/api/enums/ItemList.java
+++ b/main/java/gregtech/api/enums/ItemList.java
@@ -645,7 +645,14 @@ public enum ItemList implements IItemContainer {
Energy_LapotronicOrb2,
ZPM2, Quantum_Tank_LV,Quantum_Tank_MV,Quantum_Tank_HV,Quantum_Tank_EV,Quantum_Tank_IV, Quantum_Chest_LV, Quantum_Chest_MV, Quantum_Chest_HV, Quantum_Chest_EV, Quantum_Chest_IV,
- NULL, Cover_RedstoneTransmitterExternal,Cover_RedstoneTransmitterInternal,Cover_RedstoneReceiverExternal,Cover_RedstoneReceiverInternal, LargeTurbine, Ingot_Heavy1,Ingot_Heavy2,Ingot_Heavy3, Pump_LV, Pump_MV, Pump_HV, Pump_EV, Pump_IV, Teleporter, Cover_NeedsMaintainance, Casing_Turbine;
+ NULL, Cover_RedstoneTransmitterExternal,Cover_RedstoneTransmitterInternal,Cover_RedstoneReceiverExternal,Cover_RedstoneReceiverInternal,
+ LargeTurbine,
+ Ingot_Heavy1,Ingot_Heavy2,Ingot_Heavy3,
+ Pump_LV, Pump_MV, Pump_HV, Pump_EV, Pump_IV,
+ Teleporter,
+ Cover_NeedsMaintainance,
+ Casing_Turbine,
+ MobRep_LV,MobRep_MV,MobRep_HV,MobRep_EV,MobRep_IV;
public static final ItemList[]
DYE_ONLY_ITEMS = {Color_00, Color_01, Color_02, Color_03, Color_04, Color_05, Color_06, Color_07, Color_08, Color_09, Color_10, Color_11, Color_12, Color_13, Color_14, Color_15}
diff --git a/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Dynamo.java b/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Dynamo.java
index 39a9cb3bd2..caeec17bb1 100644
--- a/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Dynamo.java
+++ b/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Dynamo.java
@@ -35,7 +35,7 @@ public class GT_MetaTileEntity_Hatch_Dynamo extends GT_MetaTileEntity_Hatch {
@Override public boolean isValidSlot(int aIndex) {return false;}
@Override public long getMinimumStoredEU() {return 512;}
@Override public long maxEUOutput() {return V[mTier];}
- @Override public long maxEUStore() {return 512+V[mTier];}
+ @Override public long maxEUStore() {return 512+V[mTier+1]*2;}
@Override
public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
diff --git a/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java b/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java
index d0722f6643..2bcb4ec154 100644
--- a/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java
+++ b/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java
@@ -8,11 +8,14 @@ import gregtech.api.gui.GT_Container_MultiMachine;
import gregtech.api.gui.GT_GUIContainer_MultiMachine;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.items.GT_MetaGenerated_Tool;
import gregtech.api.metatileentity.MetaTileEntity;
import gregtech.api.objects.GT_ItemStack;
import gregtech.api.util.GT_ModHandler;
import gregtech.api.util.GT_Recipe.GT_Recipe_Map;
import gregtech.api.util.GT_Utility;
+import gregtech.common.items.GT_MetaGenerated_Tool_01;
+import gregtech.common.tools.GT_Tool_Turbine;
import java.util.ArrayList;
@@ -194,10 +197,8 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity {
mEfficiencyIncrease = 0;
if (aBaseMetaTileEntity.isAllowedToWork()) checkRecipe(mInventory[1]);
if(mOutputFluids!=null&&mOutputFluids.length>0){
- System.out.println("fluids"+mOutputFluids.length);
GT_Mod.instance.achievements.issueAchivementHatchFluid(aBaseMetaTileEntity.getWorld().getPlayerEntityByName(aBaseMetaTileEntity.getOwnerName()), mOutputFluids[0]);
if(mOutputFluids.length>1){GT_Mod.instance.achievements.issueAchievement(aBaseMetaTileEntity.getWorld().getPlayerEntityByName(aBaseMetaTileEntity.getOwnerName()), "oilplant");}
-// mOutputFluids = null;
}
}
}
@@ -335,15 +336,17 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity {
}
}
if (mInventory[1] != null && getBaseMetaTileEntity().getRandomNumber(2) == 0 &&!mInventory[1].getUnlocalizedName().startsWith("gt.blockmachines.basicmachine.")) {
- mInventory[1].setItemDamage(mInventory[1].getItemDamage() + getDamageToComponent(mInventory[1]));
- if (mInventory[1].getItemDamage() >= mInventory[1].getMaxDamage()) {
- if (explodesOnComponentBreak(mInventory[1])) {
- explodeMultiblock();
- } else {
- mInventory[1] = null;
- }
- return false;
+ if(mInventory[1].getItem() instanceof GT_MetaGenerated_Tool_01){
}
+// mInventory[1].setItemDamage(mInventory[1].getItemDamage() + getDamageToComponent(mInventory[1]));
+// if (mInventory[1].getItemDamage() >= mInventory[1].getMaxDamage()) {
+// if (explodesOnComponentBreak(mInventory[1])) {
+// explodeMultiblock();
+// } else {
+// mInventory[1] = null;
+// }
+// return false;
+// }
}
}
return true;
diff --git a/main/java/gregtech/api/util/GT_ModHandler.java b/main/java/gregtech/api/util/GT_ModHandler.java
index 72ba214bc4..93aba7cfb7 100644
--- a/main/java/gregtech/api/util/GT_ModHandler.java
+++ b/main/java/gregtech/api/util/GT_ModHandler.java
@@ -1011,85 +1011,6 @@ public class GT_ModHandler {
return rReturn;
}
-// public static int replaceRecipe(ItemStack aOldItem, ItemStack aNewItem){
-// int replaced =0;
-// ArrayList<IRecipe> tList = (ArrayList<IRecipe>)CraftingManager.getInstance().getRecipeList();
-// System.out.println("tList.size "+tList.size());
-// for (int i = 0; i < tList.size(); i++){
-// System.out.println(tList.get(i).getClass());
-// if(tList.get(i) instanceof ShapedRecipes){
-// ShapedRecipes tRecipe = (ShapedRecipes)tList.get(i);
-// System.out.println("found recipe!");
-// for( int g =0 ; g < tRecipe.recipeItems.length;g++){
-// if(GT_Utility.areStacksEqual(aOldItem, tRecipe.recipeItems[g], true)){
-// ItemStack[] tItems = tRecipe.recipeItems;
-// for(int f = 0; f < tItems.length;f++){
-// if(GT_Utility.areStacksEqual(aOldItem, tItems[f], true)){
-// tItems[f]=aNewItem;
-// }
-// }
-// ShapedRecipes nRecipe = new ShapedRecipes(tRecipe.recipeWidth,tRecipe.recipeHeight,tItems,tRecipe.getRecipeOutput());
-// tList.set(i, nRecipe);
-// replaced++;
-// }
-// }
-// }
-//
-// if(tList.get(i) instanceof AdvRecipe){
-// AdvRecipe tRecipe = (AdvRecipe)tList.get(i);
-// System.out.println("found recipe!");
-// for( int g =0 ; g < tRecipe.input.length;g++){
-// if(GT_Utility.areStacksEqual(aOldItem, (ItemStack) tRecipe.input[g], true)){
-// ItemStack[] tItems = (ItemStack[]) tRecipe.input;
-// for(int f = 0; f < tItems.length;f++){
-// if(GT_Utility.areStacksEqual(aOldItem, tItems[f], true)){
-// tItems[f]=aNewItem;
-// }
-// }
-// System.out.println("converted Recipe");
-// AdvRecipe nRecipe = new AdvRecipe(tRecipe.getRecipeOutput(),tItems);
-// tList.set(i, nRecipe);
-// replaced++;
-// }
-// }
-// }
-//// if(tList.get(i) instanceof GT_Shaped_Recipe){
-//// GT_Shaped_Recipe tRecipe = (GT_Shaped_Recipe)tList.get(i);
-//// System.out.println("found recipe!");
-//// for( int g =0 ; g < tRecipe.getInput().length;g++){
-//// if(GT_Utility.areStacksEqual(aOldItem, (ItemStack)tRecipe.getInput()[g], true)){
-//// ItemStack[] tItems = (ItemStack[]) tRecipe.getInput();
-//// for(int f = 0; f < tItems.length;f++){
-//// if(GT_Utility.areStacksEqual(aOldItem, tItems[f], true)){
-//// tItems[f]=aNewItem;
-//// }
-//// }
-//// GT_Shaped_Recipe nRecipe = new GT_Shaped_Recipe(tItems,tRecipe.getRecipeOutput());
-//// tList.set(i, nRecipe);
-//// replaced++;
-//// }
-//// }
-//// }
-// if(tList.get(i) instanceof ShapelessRecipes){
-// ShapelessRecipes tRecipe = (ShapelessRecipes)tList.get(i);
-// System.out.println("found recipe!");
-// for( int g =0 ; g < tRecipe.recipeItems.size();g++){
-// if(GT_Utility.areStacksEqual(aOldItem, (ItemStack) tRecipe.recipeItems.get(g), true)){
-// List tItems = tRecipe.recipeItems;
-// for(int f = 0; f < tItems.size();f++){
-// if(GT_Utility.areStacksEqual(aOldItem, (ItemStack) tItems.get(f), true)){
-// tItems.set(f,aNewItem);
-// }
-// }
-// ShapelessRecipes nRecipe = new ShapelessRecipes(tRecipe.getRecipeOutput(),tItems);
-// tList.set(i, nRecipe);
-// replaced++;
-// }
-// }
-// }
-// }return replaced;
-// }
-
public static boolean removeRecipeByOutput(ItemStack aOutput) {
return removeRecipeByOutput(aOutput, T, F, F);
}
diff --git a/main/java/gregtech/api/util/GT_SpawnEventHandler.java b/main/java/gregtech/api/util/GT_SpawnEventHandler.java
new file mode 100644
index 0000000000..d4d4c65d6c
--- /dev/null
+++ b/main/java/gregtech/api/util/GT_SpawnEventHandler.java
@@ -0,0 +1,46 @@
+package gregtech.api.util;
+
+import gregtech.api.metatileentity.BaseMetaTileEntity;
+import gregtech.common.tileentities.machines.basic.GT_MetaTileEntity_MonsterRepellent;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import cpw.mods.fml.common.eventhandler.Event;
+import cpw.mods.fml.common.eventhandler.SubscribeEvent;
+import net.minecraft.entity.EnumCreatureType;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraftforge.common.MinecraftForge;
+import net.minecraftforge.event.entity.living.LivingSpawnEvent.CheckSpawn;
+
+public class GT_SpawnEventHandler {
+
+ public static volatile List <int[]> mobReps = new ArrayList();
+
+ public GT_SpawnEventHandler(){
+ MinecraftForge.EVENT_BUS.register(this);
+ }
+
+ @SubscribeEvent
+ public void denyMobSpawn(CheckSpawn event)
+ {
+ if (event.getResult() == Event.Result.ALLOW) {return;}
+ if (event.entityLiving.isCreatureType(EnumCreatureType.monster, false))
+ {
+ for(int[] rep : mobReps){
+ if(rep[3] == event.entity.worldObj.provider.dimensionId){
+ TileEntity tTile = event.entity.worldObj.getTileEntity(rep[0], rep[1], rep[2]);
+ if(tTile instanceof BaseMetaTileEntity && ((BaseMetaTileEntity)tTile).getMetaTileEntity() instanceof GT_MetaTileEntity_MonsterRepellent){
+ int r = ((GT_MetaTileEntity_MonsterRepellent)((BaseMetaTileEntity)tTile).getMetaTileEntity()).mRange;
+ double dx = rep[0] + 0.5F - event.entity.posX;
+ double dy = rep[1] + 0.5F - event.entity.posY;
+ double dz = rep[2] + 0.5F - event.entity.posZ;
+ if ((dx * dx + dz * dz + dy * dy) <= Math.pow(r, 2)) {
+ event.setResult(Event.Result.DENY);
+ }
+ }
+ }
+ }
+ }
+ }
+}