Update walia, add MT and CT support back, Fix #519, update for new RC bucket thing
This commit is contained in:
parent
4fccaa1f5f
commit
b822cee9fb
39 changed files with 383 additions and 2398 deletions
|
@ -4,9 +4,12 @@ import net.minecraftforge.fml.common.FMLCommonHandler;
|
|||
import net.minecraftforge.fml.common.Loader;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import techreborn.client.render.parts.ClientPartLoader;
|
||||
import techreborn.compat.minetweaker.MinetweakerCompat;
|
||||
import techreborn.compat.waila.CompatModuleWaila;
|
||||
import techreborn.config.ConfigTechReborn;
|
||||
import techreborn.parts.StandalonePartCompact;
|
||||
import techreborn.parts.TechRebornParts;
|
||||
import techreborn.parts.walia.WailaMcMultiPartCompact;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
|
@ -36,13 +39,12 @@ public class CompatManager
|
|||
{
|
||||
isGregTechLoaded = true;
|
||||
}
|
||||
// registerCompact(MinetweakerCompat.class, "MineTweaker3");
|
||||
// registerCompact(RecipesBiomesOPlenty.class, "BiomesOPlenty");
|
||||
// registerCompact(RecipesBuildcraft.class, "BuildCraft|Builders");
|
||||
// registerCompact(RecipesThaumcraft.class, "Thaumcraft");
|
||||
registerCompact(MinetweakerCompat.class, "MineTweaker3");
|
||||
registerCompact(TechRebornParts.class, "mcmultipart");
|
||||
registerCompact(ClientPartLoader.class, "mcmultipart", "@client");
|
||||
registerCompact(StandalonePartCompact.class, "!mcmultipart");
|
||||
registerCompact(WailaMcMultiPartCompact.class, "mcmultipart", "Waila", "!IC2");
|
||||
registerCompact(CompatModuleWaila.class, "Waila");
|
||||
}
|
||||
|
||||
public void registerCompact(Class<? extends ICompatModule> moduleClass, Object... objs)
|
||||
|
|
|
@ -0,0 +1,43 @@
|
|||
package techreborn.compat.minetweaker;
|
||||
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.api.item.IIngredient;
|
||||
import minetweaker.api.item.IItemStack;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
import techreborn.api.recipe.machines.AlloySmelterRecipe;
|
||||
import techreborn.api.Reference;
|
||||
|
||||
/**
|
||||
* mods.techreborn.alloySmelter.addRecipe(<minecraft:gold_ingot>, <minecraft:iron_ingot>, <minecraft:diamond>, 20, 100);
|
||||
*/
|
||||
|
||||
@ZenClass("mods.techreborn.alloySmelter")
|
||||
public class MTAlloySmelter extends MTGeneric {
|
||||
|
||||
@ZenMethod
|
||||
public static void addRecipe(IItemStack output, IIngredient input1, IIngredient input2, int ticktime, int euTick) {
|
||||
ItemStack oInput1 = (ItemStack) MinetweakerCompat.toObject(input1);
|
||||
ItemStack oInput2 = (ItemStack) MinetweakerCompat.toObject(input2);
|
||||
|
||||
AlloySmelterRecipe r = new AlloySmelterRecipe(oInput1, oInput2, MinetweakerCompat.toStack(output), ticktime, euTick);
|
||||
|
||||
addRecipe(r);
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void removeInputRecipe(IIngredient iIngredient) {
|
||||
MineTweakerAPI.apply(new RemoveInput(iIngredient, getMachineName()));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void removeRecipe(IItemStack output) {
|
||||
MineTweakerAPI.apply(new Remove(MinetweakerCompat.toStack(output), getMachineName()));
|
||||
}
|
||||
|
||||
|
||||
public static String getMachineName() {
|
||||
return Reference.alloySmelteRecipe;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
package techreborn.compat.minetweaker;
|
||||
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.api.item.IIngredient;
|
||||
import minetweaker.api.item.IItemStack;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
import techreborn.api.recipe.machines.AssemblingMachineRecipe;
|
||||
import techreborn.api.Reference;
|
||||
|
||||
|
||||
@ZenClass("mods.techreborn.assemblingMachine")
|
||||
public class MTAssemblingMachine extends MTGeneric {
|
||||
|
||||
|
||||
@ZenMethod
|
||||
public static void addRecipe(IItemStack output, IIngredient input1, IIngredient input2, int ticktime, int euTick) {
|
||||
ItemStack oInput1 = (ItemStack) MinetweakerCompat.toObject(input1);
|
||||
ItemStack oInput2 = (ItemStack) MinetweakerCompat.toObject(input2);
|
||||
|
||||
AssemblingMachineRecipe r = new AssemblingMachineRecipe(oInput1, oInput2, MinetweakerCompat.toStack(output), ticktime, euTick);
|
||||
|
||||
addRecipe(r);
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void removeInputRecipe(IIngredient iIngredient) {
|
||||
MineTweakerAPI.apply(new RemoveInput(iIngredient, getMachineName()));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void removeRecipe(IItemStack output) {
|
||||
MineTweakerAPI.apply(new Remove(MinetweakerCompat.toStack(output), getMachineName()));
|
||||
}
|
||||
|
||||
public static String getMachineName() {
|
||||
return Reference.assemblingMachineRecipe;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
package techreborn.compat.minetweaker;
|
||||
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.api.item.IIngredient;
|
||||
import minetweaker.api.item.IItemStack;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
import techreborn.api.recipe.machines.BlastFurnaceRecipe;
|
||||
import techreborn.api.Reference;
|
||||
|
||||
@ZenClass("mods.techreborn.blastFurnace")
|
||||
public class MTBlastFurnace extends MTGeneric {
|
||||
|
||||
@ZenMethod
|
||||
public static void addRecipe(IItemStack output1, IItemStack output2, IIngredient input1, IIngredient input2, int ticktime, int euTick, int neededHeat) {
|
||||
ItemStack oInput1 = (ItemStack) MinetweakerCompat.toObject(input1);
|
||||
ItemStack oInput2 = (ItemStack) MinetweakerCompat.toObject(input2);
|
||||
|
||||
BlastFurnaceRecipe r = new BlastFurnaceRecipe(oInput1, oInput2, MinetweakerCompat.toStack(output1), MinetweakerCompat.toStack(output2), ticktime, euTick, neededHeat);
|
||||
|
||||
addRecipe(r);
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void removeInputRecipe(IIngredient iIngredient) {
|
||||
MineTweakerAPI.apply(new RemoveInput(iIngredient, getMachineName()));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void removeRecipe(IItemStack output) {
|
||||
MineTweakerAPI.apply(new Remove(MinetweakerCompat.toStack(output), getMachineName()));
|
||||
}
|
||||
|
||||
public static String getMachineName() {
|
||||
return Reference.blastFurnaceRecipe;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
package techreborn.compat.minetweaker;
|
||||
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.api.item.IIngredient;
|
||||
import minetweaker.api.item.IItemStack;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
import techreborn.api.recipe.machines.CentrifugeRecipe;
|
||||
import techreborn.api.Reference;
|
||||
|
||||
@ZenClass("mods.techreborn.centrifuge")
|
||||
public class MTCentrifuge extends MTGeneric {
|
||||
|
||||
@ZenMethod
|
||||
public static void addRecipe(IItemStack output1, IItemStack output2, IItemStack output3, IItemStack output4, IIngredient input1, IIngredient input2, int ticktime, int euTick) {
|
||||
ItemStack oInput1 = (ItemStack) MinetweakerCompat.toObject(input1);
|
||||
ItemStack oInput2 = (ItemStack) MinetweakerCompat.toObject(input2);
|
||||
|
||||
CentrifugeRecipe r = new CentrifugeRecipe(oInput1, oInput2, MinetweakerCompat.toStack(output1), MinetweakerCompat.toStack(output2), MinetweakerCompat.toStack(output3), MinetweakerCompat.toStack(output4), ticktime, euTick);
|
||||
|
||||
addRecipe(r);
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void removeInputRecipe(IIngredient iIngredient) {
|
||||
MineTweakerAPI.apply(new RemoveInput(iIngredient, getMachineName()));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void removeRecipe(IItemStack output) {
|
||||
MineTweakerAPI.apply(new Remove(MinetweakerCompat.toStack(output), getMachineName()));
|
||||
}
|
||||
|
||||
public static String getMachineName() {
|
||||
return Reference.centrifugeRecipe;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
package techreborn.compat.minetweaker;
|
||||
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.api.item.IIngredient;
|
||||
import minetweaker.api.item.IItemStack;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
import techreborn.api.Reference;
|
||||
import techreborn.api.recipe.machines.ChemicalReactorRecipe;
|
||||
|
||||
@ZenClass("mods.techreborn.chemicalReactorRecipe")
|
||||
public class MTChemicalReactor extends MTGeneric {
|
||||
|
||||
@ZenMethod
|
||||
public static void addRecipe(IItemStack output1, IIngredient input1, IIngredient input2, int ticktime, int euTick) {
|
||||
ItemStack oInput1 = (ItemStack) MinetweakerCompat.toObject(input1);
|
||||
ItemStack oInput2 = (ItemStack) MinetweakerCompat.toObject(input2);
|
||||
|
||||
ChemicalReactorRecipe r = new ChemicalReactorRecipe(oInput1, oInput2, MinetweakerCompat.toStack(output1), ticktime, euTick);
|
||||
|
||||
addRecipe(r);
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void removeInputRecipe(IIngredient iIngredient) {
|
||||
MineTweakerAPI.apply(new RemoveInput(iIngredient, getMachineName()));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void removeRecipe(IItemStack output) {
|
||||
MineTweakerAPI.apply(new Remove(MinetweakerCompat.toStack(output), getMachineName()));
|
||||
}
|
||||
|
||||
public static String getMachineName() {
|
||||
return Reference.chemicalReactorRecipe;
|
||||
}
|
||||
}
|
237
src/main/java/techreborn/compat/minetweaker/MTFusionReactor.java
Normal file
237
src/main/java/techreborn/compat/minetweaker/MTFusionReactor.java
Normal file
|
@ -0,0 +1,237 @@
|
|||
package techreborn.compat.minetweaker;
|
||||
|
||||
import minetweaker.IUndoableAction;
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.api.item.IIngredient;
|
||||
import minetweaker.api.item.IItemStack;
|
||||
import minetweaker.api.minecraft.MineTweakerMC;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import reborncore.common.util.ItemUtils;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
import techreborn.api.reactor.FusionReactorRecipe;
|
||||
import techreborn.api.reactor.FusionReactorRecipeHelper;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@ZenClass("mods.techreborn.fusionReactor")
|
||||
public class MTFusionReactor {
|
||||
|
||||
@ZenMethod
|
||||
public static void addRecipe(IIngredient topInput, IIngredient bottomInput, IItemStack output, int startEU, int euTick, int tickTime) {
|
||||
FusionReactorRecipe reactorRecipe = new FusionReactorRecipe((ItemStack) MinetweakerCompat.toObject(topInput), (ItemStack) MinetweakerCompat.toObject(bottomInput), MinetweakerCompat.toStack(output), startEU, euTick, tickTime);
|
||||
MineTweakerAPI.apply(new Add(reactorRecipe));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void removeTopInputRecipe(IIngredient iIngredient) {
|
||||
MineTweakerAPI.apply(new RemoveTopInput(iIngredient));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void removeBottomInputRecipe(IIngredient iIngredient) {
|
||||
MineTweakerAPI.apply(new RemoveTopInput(iIngredient));
|
||||
}
|
||||
|
||||
private static class Add implements IUndoableAction {
|
||||
private final FusionReactorRecipe recipe;
|
||||
|
||||
public Add(FusionReactorRecipe recipe) {
|
||||
this.recipe = recipe;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply() {
|
||||
FusionReactorRecipeHelper.registerRecipe(recipe);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canUndo() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void undo() {
|
||||
FusionReactorRecipeHelper.reactorRecipes.remove(recipe);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describe() {
|
||||
return "Adding Fusion Reactor recipe for " + recipe.getOutput().getDisplayName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describeUndo() {
|
||||
return "Removing Fusion Reactor recipe for " + recipe.getOutput().getDisplayName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getOverrideKey() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void removeRecipe(IItemStack output) {
|
||||
MineTweakerAPI.apply(new Remove(MinetweakerCompat.toStack(output)));
|
||||
}
|
||||
|
||||
private static class Remove implements IUndoableAction {
|
||||
private final ItemStack output;
|
||||
List<FusionReactorRecipe> removedRecipes = new ArrayList<FusionReactorRecipe>();
|
||||
|
||||
public Remove(ItemStack output) {
|
||||
this.output = output;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply() {
|
||||
for (FusionReactorRecipe recipeType : FusionReactorRecipeHelper.reactorRecipes) {
|
||||
if (ItemUtils.isItemEqual(recipeType.getOutput(), output, true, false)) {
|
||||
removedRecipes.add(recipeType);
|
||||
FusionReactorRecipeHelper.reactorRecipes.remove(recipeType);
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void undo() {
|
||||
if (removedRecipes != null) {
|
||||
for (FusionReactorRecipe recipe : removedRecipes) {
|
||||
if (recipe != null) {
|
||||
FusionReactorRecipeHelper.registerRecipe(recipe);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describe() {
|
||||
return "Removing Fusion Reactor recipe for " + output.getDisplayName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describeUndo() {
|
||||
return "Re-Adding Fusion Reactor recipe for " + output.getDisplayName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getOverrideKey() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canUndo() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static class RemoveTopInput implements IUndoableAction {
|
||||
private final IIngredient output;
|
||||
List<FusionReactorRecipe> removedRecipes = new ArrayList<FusionReactorRecipe>();
|
||||
|
||||
public RemoveTopInput(IIngredient output) {
|
||||
this.output = output;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply() {
|
||||
for (FusionReactorRecipe recipeType : FusionReactorRecipeHelper.reactorRecipes) {
|
||||
if (output.matches(MineTweakerMC.getIItemStack(recipeType.getTopInput()))) {
|
||||
removedRecipes.add(recipeType);
|
||||
FusionReactorRecipeHelper.reactorRecipes.remove(recipeType);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void undo() {
|
||||
if (removedRecipes != null) {
|
||||
for (FusionReactorRecipe recipe : removedRecipes) {
|
||||
if (recipe != null) {
|
||||
FusionReactorRecipeHelper.registerRecipe(recipe);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describe() {
|
||||
return "Removing Fusion Reactor recipe";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describeUndo() {
|
||||
return "Re-Adding Fusion Reactor recipe";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getOverrideKey() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canUndo() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
private static class RemoveBottomInput implements IUndoableAction {
|
||||
private final IIngredient output;
|
||||
List<FusionReactorRecipe> removedRecipes = new ArrayList<FusionReactorRecipe>();
|
||||
|
||||
public RemoveBottomInput(IIngredient output) {
|
||||
this.output = output;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply() {
|
||||
for (FusionReactorRecipe recipeType : FusionReactorRecipeHelper.reactorRecipes) {
|
||||
if (output.matches(MineTweakerMC.getIItemStack(recipeType.getBottomInput()))) {
|
||||
removedRecipes.add(recipeType);
|
||||
FusionReactorRecipeHelper.reactorRecipes.remove(recipeType);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void undo() {
|
||||
if (removedRecipes != null) {
|
||||
for (FusionReactorRecipe recipe : removedRecipes) {
|
||||
if (recipe != null) {
|
||||
FusionReactorRecipeHelper.registerRecipe(recipe);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describe() {
|
||||
return "Removing Fusion Reactor recipe";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describeUndo() {
|
||||
return "Re-Adding Fusion Reactor recipe";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getOverrideKey() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canUndo() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
13
src/main/java/techreborn/compat/minetweaker/MTGenerator.java
Normal file
13
src/main/java/techreborn/compat/minetweaker/MTGenerator.java
Normal file
|
@ -0,0 +1,13 @@
|
|||
package techreborn.compat.minetweaker;
|
||||
|
||||
import minetweaker.api.liquid.ILiquidStack;
|
||||
import reborncore.api.fuel.FluidPowerManager;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
|
||||
@ZenClass("mods.techreborn.generator")
|
||||
public class MTGenerator {
|
||||
public static void addFluidPower(ILiquidStack fluid, double value){
|
||||
FluidPowerManager.fluidPowerValues.put(MinetweakerCompat.toFluidStack(fluid).getFluid(), value);
|
||||
}
|
||||
|
||||
}
|
176
src/main/java/techreborn/compat/minetweaker/MTGeneric.java
Normal file
176
src/main/java/techreborn/compat/minetweaker/MTGeneric.java
Normal file
|
@ -0,0 +1,176 @@
|
|||
package techreborn.compat.minetweaker;
|
||||
|
||||
import minetweaker.IUndoableAction;
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.api.item.IIngredient;
|
||||
import minetweaker.api.minecraft.MineTweakerMC;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import reborncore.api.recipe.IBaseRecipeType;
|
||||
import reborncore.api.recipe.RecipeHandler;
|
||||
import reborncore.common.util.ItemUtils;
|
||||
import techreborn.api.recipe.BaseRecipe;
|
||||
import techreborn.api.Reference;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class MTGeneric {
|
||||
public static String getMachineName() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void addRecipe(BaseRecipe recipe) {
|
||||
MineTweakerAPI.apply(new Add(recipe));
|
||||
}
|
||||
|
||||
private static class Add implements IUndoableAction {
|
||||
private final BaseRecipe recipe;
|
||||
|
||||
public Add(BaseRecipe recipe) {
|
||||
this.recipe = recipe;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply() {
|
||||
RecipeHandler.addRecipe(recipe);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canUndo() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void undo() {
|
||||
RecipeHandler.recipeList.remove(recipe);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describe() {
|
||||
return "Adding " + recipe.getRecipeName() + " recipe for " + recipe.getOutput(0).getDisplayName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describeUndo() {
|
||||
return "Removing " + recipe.getRecipeName() + " recipe for " + recipe.getOutput(0).getDisplayName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getOverrideKey() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static class Remove implements IUndoableAction {
|
||||
private final ItemStack output;
|
||||
List<BaseRecipe> removedRecipes = new ArrayList<BaseRecipe>();
|
||||
private final String name;
|
||||
|
||||
public Remove(ItemStack output, String machineName) {
|
||||
this.output = output;
|
||||
this.name = machineName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply() {
|
||||
for (IBaseRecipeType recipeType : RecipeHandler.getRecipeClassFromName(name)) {
|
||||
for (ItemStack stack : recipeType.getOutputs()) {
|
||||
if (ItemUtils.isItemEqual(stack, output, true, false)) {
|
||||
removedRecipes.add((BaseRecipe) recipeType);
|
||||
RecipeHandler.recipeList.remove(recipeType);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void undo() {
|
||||
if (removedRecipes != null) {
|
||||
for (BaseRecipe recipe : removedRecipes) {
|
||||
if (recipe != null) {
|
||||
RecipeHandler.addRecipe(recipe);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describe() {
|
||||
return "Removing " + name + " recipe for " + output.getDisplayName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describeUndo() {
|
||||
return "Re-Adding " + name + " recipe for " + output.getDisplayName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getOverrideKey() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canUndo() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static class RemoveInput implements IUndoableAction {
|
||||
private final IIngredient output;
|
||||
List<BaseRecipe> removedRecipes = new ArrayList<BaseRecipe>();
|
||||
private final String name;
|
||||
|
||||
public RemoveInput(IIngredient output, String machineName) {
|
||||
this.output = output;
|
||||
this.name = machineName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply() {
|
||||
for (IBaseRecipeType recipeType : RecipeHandler.getRecipeClassFromName(name)) {
|
||||
for (ItemStack stack : recipeType.getInputs()) {
|
||||
if (output.matches(MineTweakerMC.getIItemStack(stack))) {
|
||||
removedRecipes.add((BaseRecipe) recipeType);
|
||||
RecipeHandler.recipeList.remove(recipeType);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void undo() {
|
||||
if (removedRecipes != null) {
|
||||
for (BaseRecipe recipe : removedRecipes) {
|
||||
if (recipe != null) {
|
||||
RecipeHandler.addRecipe(recipe);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describe() {
|
||||
return "Removing " + name + " recipe";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describeUndo() {
|
||||
return "Re-Adding " + name + " recipe";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getOverrideKey() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canUndo() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
package techreborn.compat.minetweaker;
|
||||
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.api.item.IIngredient;
|
||||
import minetweaker.api.item.IItemStack;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
import techreborn.api.recipe.machines.ImplosionCompressorRecipe;
|
||||
import techreborn.api.Reference;
|
||||
|
||||
@ZenClass("mods.techreborn.implosionCompressor")
|
||||
public class MTImplosionCompressor extends MTGeneric {
|
||||
|
||||
@ZenMethod
|
||||
public static void addRecipe(IItemStack output1, IItemStack output2, IIngredient input1, IIngredient input2, int ticktime, int euTick) {
|
||||
ItemStack oInput1 = (ItemStack) MinetweakerCompat.toObject(input1);
|
||||
ItemStack oInput2 = (ItemStack) MinetweakerCompat.toObject(input2);
|
||||
|
||||
|
||||
ImplosionCompressorRecipe r = new ImplosionCompressorRecipe(oInput1, oInput2, MinetweakerCompat.toStack(output1), MinetweakerCompat.toStack(output2), ticktime, euTick);
|
||||
|
||||
addRecipe(r);
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void removeInputRecipe(IIngredient iIngredient) {
|
||||
MineTweakerAPI.apply(new RemoveInput(iIngredient, getMachineName()));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void removeRecipe(IItemStack output) {
|
||||
MineTweakerAPI.apply(new Remove(MinetweakerCompat.toStack(output), getMachineName()));
|
||||
}
|
||||
|
||||
public static String getMachineName() {
|
||||
return Reference.implosionCompressorRecipe;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
package techreborn.compat.minetweaker;
|
||||
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.api.item.IIngredient;
|
||||
import minetweaker.api.item.IItemStack;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
import techreborn.api.recipe.machines.IndustrialElectrolyzerRecipe;
|
||||
import techreborn.api.Reference;
|
||||
|
||||
@ZenClass("mods.techreborn.industrialElectrolyzer")
|
||||
public class MTIndustrialElectrolyzer extends MTGeneric {
|
||||
|
||||
|
||||
@ZenMethod
|
||||
public static void addRecipe(IItemStack output1, IItemStack output2, IItemStack output3, IItemStack output4, IIngredient cells, IIngredient input2, int ticktime, int euTick) {
|
||||
ItemStack oInput1 = (ItemStack) MinetweakerCompat.toObject(cells);
|
||||
ItemStack oInput2 = (ItemStack) MinetweakerCompat.toObject(input2);
|
||||
|
||||
IndustrialElectrolyzerRecipe r = new IndustrialElectrolyzerRecipe(oInput1, oInput2, MinetweakerCompat.toStack(output1), MinetweakerCompat.toStack(output2), MinetweakerCompat.toStack(output3), MinetweakerCompat.toStack(output4), ticktime, euTick);
|
||||
|
||||
addRecipe(r);
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void removeInputRecipe(IIngredient iIngredient) {
|
||||
MineTweakerAPI.apply(new RemoveInput(iIngredient, getMachineName()));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void removeRecipe(IItemStack output) {
|
||||
MineTweakerAPI.apply(new Remove(MinetweakerCompat.toStack(output), getMachineName()));
|
||||
}
|
||||
|
||||
public static String getMachineName() {
|
||||
return Reference.industrialElectrolyzerRecipe;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,52 @@
|
|||
package techreborn.compat.minetweaker;
|
||||
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.api.item.IIngredient;
|
||||
import minetweaker.api.item.IItemStack;
|
||||
import minetweaker.api.liquid.ILiquidStack;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
import techreborn.api.recipe.machines.IndustrialGrinderRecipe;
|
||||
import techreborn.api.Reference;
|
||||
|
||||
@ZenClass("mods.techreborn.grinder")
|
||||
public class MTIndustrialGrinder extends MTGeneric {
|
||||
|
||||
|
||||
@ZenMethod
|
||||
public static void addRecipe(IItemStack output1, IItemStack output2, IItemStack output3, IItemStack output4, IIngredient input1, IIngredient input2, int ticktime, int euTick) {
|
||||
addRecipe(output1, output2, output3, output4, input1, input2, null, ticktime, euTick);
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void addRecipe(IItemStack output1, IItemStack output2, IItemStack output3, IItemStack output4, IIngredient input1, IIngredient input2, ILiquidStack fluid, int ticktime, int euTick) {
|
||||
ItemStack oInput1 = (ItemStack) MinetweakerCompat.toObject(input1);
|
||||
|
||||
ItemStack oInput2 = (ItemStack) MinetweakerCompat.toObject(input2);
|
||||
|
||||
FluidStack fluidStack = null;
|
||||
if (fluid != null) {
|
||||
fluidStack = MinetweakerCompat.toFluidStack(fluid);
|
||||
}
|
||||
|
||||
IndustrialGrinderRecipe r = new IndustrialGrinderRecipe(oInput1, oInput2, fluidStack, MinetweakerCompat.toStack(output1), MinetweakerCompat.toStack(output2), MinetweakerCompat.toStack(output3), MinetweakerCompat.toStack(output4), ticktime, euTick);
|
||||
|
||||
addRecipe(r);
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void removeInputRecipe(IIngredient iIngredient) {
|
||||
MineTweakerAPI.apply(new RemoveInput(iIngredient, getMachineName()));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void removeRecipe(IItemStack output) {
|
||||
MineTweakerAPI.apply(new Remove(MinetweakerCompat.toStack(output), getMachineName()));
|
||||
}
|
||||
|
||||
public static String getMachineName() {
|
||||
return Reference.industrialGrinderRecipe;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,62 @@
|
|||
package techreborn.compat.minetweaker;
|
||||
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.api.item.IIngredient;
|
||||
import minetweaker.api.item.IItemStack;
|
||||
import minetweaker.api.liquid.ILiquidStack;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
import techreborn.api.recipe.machines.IndustrialSawmillRecipe;
|
||||
import techreborn.api.Reference;
|
||||
|
||||
@ZenClass("mods.techreborn.industrialSawmill")
|
||||
public class MTIndustrialSawmill extends MTGeneric {
|
||||
|
||||
|
||||
@ZenMethod
|
||||
public static void addRecipe(IItemStack output1, IItemStack output2, IItemStack output3, IIngredient input1, IIngredient input2, ILiquidStack fluid, int ticktime, int euTick) {
|
||||
addRecipe(output1, output2, output3, input1, input2, fluid, ticktime, euTick, true);
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void addRecipe(IItemStack output1, IItemStack output2, IItemStack output3, IIngredient input1, IIngredient input2, int ticktime, int euTick) {
|
||||
addRecipe(output1, output2, output3, input1, input2, null, ticktime, euTick, true);
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void addRecipe(IItemStack output1, IItemStack output2, IItemStack output3, IIngredient input1, IIngredient input2, int ticktime, int euTick, boolean useOreDic) {
|
||||
addRecipe(output1, output2, output3, input1, input2, null, ticktime, euTick, useOreDic);
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void addRecipe(IItemStack output1, IItemStack output2, IItemStack output3, IIngredient input1, IIngredient input2, ILiquidStack fluid, int ticktime, int euTick, boolean useOreDic) {
|
||||
ItemStack oInput1 = (ItemStack) MinetweakerCompat.toObject(input1);
|
||||
|
||||
ItemStack oInput2 = (ItemStack) MinetweakerCompat.toObject(input2);
|
||||
|
||||
FluidStack fluidStack = null;
|
||||
if (fluid != null) {
|
||||
fluidStack = MinetweakerCompat.toFluidStack(fluid);
|
||||
}
|
||||
|
||||
IndustrialSawmillRecipe r = new IndustrialSawmillRecipe(oInput1, oInput2, fluidStack, MinetweakerCompat.toStack(output1), MinetweakerCompat.toStack(output2), MinetweakerCompat.toStack(output3), ticktime, euTick, useOreDic);
|
||||
|
||||
addRecipe(r);
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void removeInputRecipe(IIngredient iIngredient) {
|
||||
MineTweakerAPI.apply(new RemoveInput(iIngredient, getMachineName()));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void removeRecipe(IItemStack output) {
|
||||
MineTweakerAPI.apply(new Remove(MinetweakerCompat.toStack(output), getMachineName()));
|
||||
}
|
||||
|
||||
public static String getMachineName() {
|
||||
return Reference.industrialSawmillRecipe;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
package techreborn.compat.minetweaker;
|
||||
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.api.item.IIngredient;
|
||||
import minetweaker.api.item.IItemStack;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
import techreborn.api.recipe.machines.PlateCuttingMachineRecipe;
|
||||
import techreborn.api.Reference;
|
||||
|
||||
@ZenClass("mods.techreborn.plateCuttingMachine")
|
||||
public class MTPlateCuttingMachine extends MTGeneric {
|
||||
|
||||
@ZenMethod
|
||||
public static void addRecipe(IItemStack output, IIngredient input1, int ticktime, int euTick) {
|
||||
ItemStack oInput1 = (ItemStack) MinetweakerCompat.toObject(input1);
|
||||
PlateCuttingMachineRecipe r = new PlateCuttingMachineRecipe(oInput1, MinetweakerCompat.toStack(output), ticktime, euTick);
|
||||
|
||||
addRecipe(r);
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void removeInputRecipe(IIngredient iIngredient) {
|
||||
MineTweakerAPI.apply(new RemoveInput(iIngredient, getMachineName()));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void removeRecipe(IItemStack output) {
|
||||
MineTweakerAPI.apply(new Remove(MinetweakerCompat.toStack(output), getMachineName()));
|
||||
}
|
||||
|
||||
public static String getMachineName() {
|
||||
return Reference.plateCuttingMachineRecipe;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,116 @@
|
|||
package techreborn.compat.minetweaker;
|
||||
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.api.item.IIngredient;
|
||||
import minetweaker.api.item.IItemStack;
|
||||
import minetweaker.api.oredict.IOreDictEntry;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import reborncore.common.util.ItemUtils;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
import techreborn.api.RollingMachineRecipe;
|
||||
import techreborn.api.TechRebornAPI;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@ZenClass("mods.techreborn.rollingMachine")
|
||||
public class MTRollingMachine {
|
||||
|
||||
@ZenMethod
|
||||
public static void addShaped(IItemStack output, IIngredient[][] ingredients) {
|
||||
TechRebornAPI.addRollingOreMachinceRecipe(toStack(output), toShapedObjects(ingredients));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void addShapeless(IItemStack output, IIngredient[] ingredients) {
|
||||
TechRebornAPI.addShapelessOreRollingMachinceRecipe(toStack(output), toObjects(ingredients));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void removeRecipe(IItemStack output) {
|
||||
List<IRecipe> toRemove = new ArrayList<>();
|
||||
for(IRecipe recipe : RollingMachineRecipe.instance.getRecipeList()){
|
||||
if(ItemUtils.isItemEqual(recipe.getRecipeOutput(), MinetweakerCompat.toStack(output), true, false)){
|
||||
toRemove.add(recipe);
|
||||
}
|
||||
}
|
||||
RollingMachineRecipe.instance.getRecipeList().removeAll(toRemove);
|
||||
}
|
||||
|
||||
public static ItemStack toStack(IItemStack iStack) {
|
||||
if (iStack == null) return null;
|
||||
else {
|
||||
Object internal = iStack.getInternal();
|
||||
if (internal == null || !(internal instanceof ItemStack)) {
|
||||
MineTweakerAPI.getLogger().logError("Not a valid item stack: " + iStack);
|
||||
}
|
||||
|
||||
return (ItemStack) internal;
|
||||
}
|
||||
}
|
||||
|
||||
public static ItemStack[] toStacks(IItemStack[] iStack) {
|
||||
if (iStack == null) return null;
|
||||
else {
|
||||
ItemStack[] output = new ItemStack[iStack.length];
|
||||
for (int i = 0; i < iStack.length; i++) {
|
||||
output[i] = toStack(iStack[i]);
|
||||
}
|
||||
|
||||
return output;
|
||||
}
|
||||
}
|
||||
|
||||
public static Object toObject(IIngredient iStack) {
|
||||
if (iStack == null) return null;
|
||||
else {
|
||||
if (iStack instanceof IOreDictEntry) {
|
||||
return toString((IOreDictEntry) iStack);
|
||||
} else if (iStack instanceof IItemStack) {
|
||||
return toStack((IItemStack) iStack);
|
||||
} else return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static Object[] toObjects(IIngredient[] ingredient) {
|
||||
if (ingredient == null) return null;
|
||||
else {
|
||||
Object[] output = new Object[ingredient.length];
|
||||
for (int i = 0; i < ingredient.length; i++) {
|
||||
if (ingredient[i] != null) {
|
||||
output[i] = toObject(ingredient[i]);
|
||||
} else output[i] = "";
|
||||
}
|
||||
|
||||
return output;
|
||||
}
|
||||
}
|
||||
|
||||
public static Object[] toShapedObjects(IIngredient[][] ingredients) {
|
||||
if (ingredients == null) return null;
|
||||
else {
|
||||
ArrayList prep = new ArrayList();
|
||||
prep.add("abc");
|
||||
prep.add("def");
|
||||
prep.add("ghi");
|
||||
char[][] map = new char[][] { { 'a', 'b', 'c' }, { 'd', 'e', 'f' }, { 'g', 'h', 'i' } };
|
||||
for (int x = 0; x < ingredients.length; x++) {
|
||||
if (ingredients[x] != null) {
|
||||
for (int y = 0; y < ingredients[x].length; y++) {
|
||||
if (ingredients[x][y] != null && x < map.length && y < map[x].length) {
|
||||
prep.add(map[x][y]);
|
||||
prep.add(toObject(ingredients[x][y]));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return prep.toArray();
|
||||
}
|
||||
}
|
||||
|
||||
public static String toString(IOreDictEntry entry) {
|
||||
return ((IOreDictEntry) entry).getName();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
package techreborn.compat.minetweaker;
|
||||
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.api.item.IIngredient;
|
||||
import minetweaker.api.item.IItemStack;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
import techreborn.api.recipe.machines.VacuumFreezerRecipe;
|
||||
import techreborn.api.Reference;
|
||||
|
||||
@ZenClass("mods.techreborn.vacuumFreezer")
|
||||
public class MTVacuumFreezer extends MTGeneric {
|
||||
|
||||
@ZenMethod
|
||||
public static void addRecipe(IItemStack output, IIngredient input, int ticktime, int euTick) {
|
||||
ItemStack oInput1 = (ItemStack) MinetweakerCompat.toObject(input);
|
||||
|
||||
VacuumFreezerRecipe r = new VacuumFreezerRecipe(oInput1, MinetweakerCompat.toStack(output), ticktime, euTick);
|
||||
addRecipe(r);
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void removeInputRecipe(IIngredient iIngredient) {
|
||||
MineTweakerAPI.apply(new RemoveInput(iIngredient, getMachineName()));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void removeRecipe(IItemStack output) {
|
||||
MineTweakerAPI.apply(new Remove(MinetweakerCompat.toStack(output), getMachineName()));
|
||||
}
|
||||
|
||||
public static String getMachineName() {
|
||||
return Reference.vacuumFreezerRecipe;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,80 @@
|
|||
package techreborn.compat.minetweaker;
|
||||
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.api.item.IIngredient;
|
||||
import minetweaker.api.item.IItemStack;
|
||||
import minetweaker.api.item.IngredientStack;
|
||||
import minetweaker.api.liquid.ILiquidStack;
|
||||
import minetweaker.api.oredict.IOreDictEntry;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLServerStartingEvent;
|
||||
import net.minecraftforge.fml.relauncher.ReflectionHelper;
|
||||
import techreborn.compat.ICompatModule;
|
||||
|
||||
import static minetweaker.api.minecraft.MineTweakerMC.getItemStack;
|
||||
import static minetweaker.api.minecraft.MineTweakerMC.getLiquidStack;
|
||||
|
||||
|
||||
public class MinetweakerCompat implements ICompatModule {
|
||||
@Override
|
||||
public void preInit(FMLPreInitializationEvent event) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(FMLInitializationEvent event) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postInit(FMLPostInitializationEvent event) {
|
||||
MineTweakerAPI.registerClass(MTAlloySmelter.class);
|
||||
MineTweakerAPI.registerClass(MTAssemblingMachine.class);
|
||||
MineTweakerAPI.registerClass(MTBlastFurnace.class);
|
||||
MineTweakerAPI.registerClass(MTCentrifuge.class);
|
||||
MineTweakerAPI.registerClass(MTChemicalReactor.class);
|
||||
MineTweakerAPI.registerClass(MTIndustrialGrinder.class);
|
||||
MineTweakerAPI.registerClass(MTImplosionCompressor.class);
|
||||
MineTweakerAPI.registerClass(MTIndustrialElectrolyzer.class);
|
||||
MineTweakerAPI.registerClass(MTIndustrialSawmill.class);
|
||||
MineTweakerAPI.registerClass(MTPlateCuttingMachine.class);
|
||||
MineTweakerAPI.registerClass(MTFusionReactor.class);
|
||||
MineTweakerAPI.registerClass(MTVacuumFreezer.class);
|
||||
MineTweakerAPI.registerClass(MTGenerator.class);
|
||||
MineTweakerAPI.registerClass(MTRollingMachine.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void serverStarting(FMLServerStartingEvent event) {
|
||||
|
||||
}
|
||||
|
||||
public static ItemStack toStack(IItemStack iStack) {
|
||||
return getItemStack(iStack);
|
||||
}
|
||||
|
||||
public static Object toObject(IIngredient iStack) {
|
||||
if (iStack == null)
|
||||
return null;
|
||||
else {
|
||||
if (iStack instanceof IOreDictEntry)
|
||||
return ((IOreDictEntry) iStack).getName();
|
||||
else if (iStack instanceof IItemStack)
|
||||
return getItemStack((IItemStack) iStack);
|
||||
else if (iStack instanceof IngredientStack) {
|
||||
IIngredient ingr = ReflectionHelper.getPrivateValue(IngredientStack.class, (IngredientStack) iStack, "ingredient");
|
||||
return toObject(ingr);
|
||||
} else
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static FluidStack toFluidStack(ILiquidStack iStack) {
|
||||
return getLiquidStack(iStack);
|
||||
}
|
||||
|
||||
}
|
42
src/main/java/techreborn/compat/waila/CompatModuleWaila.java
Normal file
42
src/main/java/techreborn/compat/waila/CompatModuleWaila.java
Normal file
|
@ -0,0 +1,42 @@
|
|||
package techreborn.compat.waila;
|
||||
|
||||
import mcp.mobius.waila.api.IWailaRegistrar;
|
||||
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLInterModComms;
|
||||
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLServerStartingEvent;
|
||||
import reborncore.common.tile.TileMachineBase;
|
||||
import techreborn.compat.ICompatModule;
|
||||
|
||||
public class CompatModuleWaila implements ICompatModule
|
||||
{
|
||||
|
||||
public static void callbackRegister(IWailaRegistrar registrar)
|
||||
{
|
||||
registrar.registerBodyProvider(new WailaProviderMachines(), TileMachineBase.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preInit(FMLPreInitializationEvent event)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void init(FMLInitializationEvent event)
|
||||
{
|
||||
FMLInterModComms.sendMessage("Waila", "register", getClass().getName() + ".callbackRegister");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postInit(FMLPostInitializationEvent event)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void serverStarting(FMLServerStartingEvent event)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
package techreborn.compat.waila;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import reborncore.api.IListInfoProvider;
|
||||
|
||||
public class WailaProviderMachines implements IWailaDataProvider
|
||||
{
|
||||
|
||||
private List<String> info = new ArrayList<String>();
|
||||
|
||||
@Override
|
||||
public List<String> getWailaBody(ItemStack item, List<String> tip, IWailaDataAccessor accessor,
|
||||
IWailaConfigHandler config)
|
||||
{
|
||||
if (accessor.getTileEntity() instanceof IListInfoProvider)
|
||||
{
|
||||
((IListInfoProvider) accessor.getTileEntity()).addInfo(info, true);
|
||||
}
|
||||
tip.addAll(info);
|
||||
info.clear();
|
||||
|
||||
return tip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaHead(ItemStack item, List<String> tip, IWailaDataAccessor accessor,
|
||||
IWailaConfigHandler config)
|
||||
{
|
||||
return tip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaTail(ItemStack item, List<String> tip, IWailaDataAccessor accessor,
|
||||
IWailaConfigHandler config)
|
||||
{
|
||||
return tip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World w, BlockPos pos)
|
||||
{
|
||||
return tag;
|
||||
}
|
||||
}
|
|
@ -334,7 +334,7 @@ public class ModItems
|
|||
FluidContainerRegistry.registerFluidContainer(
|
||||
FluidRegistry.getFluidStack("fluidberylium", FluidContainerRegistry.BUCKET_VOLUME),
|
||||
new ItemStack(bucketBerylium), new ItemStack(Items.bucket));
|
||||
BucketHandler.INSTANCE.buckets.put(ModFluids.BlockFluidBerylium.getDefaultState(), bucketBerylium);
|
||||
BucketHandler.INSTANCE.buckets.put(ModFluids.BlockFluidBerylium.getFluid(), bucketBerylium);
|
||||
|
||||
bucketcalcium = new ItemFluidbucket(ModFluids.BlockFluidCalcium);
|
||||
bucketcalcium.setUnlocalizedName("bucketcalcium").setContainerItem(Items.bucket);
|
||||
|
@ -342,7 +342,7 @@ public class ModItems
|
|||
FluidContainerRegistry.registerFluidContainer(
|
||||
FluidRegistry.getFluidStack("fluidcalcium", FluidContainerRegistry.BUCKET_VOLUME),
|
||||
new ItemStack(bucketcalcium), new ItemStack(Items.bucket));
|
||||
BucketHandler.INSTANCE.buckets.put(ModFluids.BlockFluidCalcium.getDefaultState(), bucketcalcium);
|
||||
BucketHandler.INSTANCE.buckets.put(ModFluids.BlockFluidCalcium.getFluid(), bucketcalcium);
|
||||
|
||||
bucketcalciumcarbonate = new ItemFluidbucket(ModFluids.BlockFluidCalciumCarbonate);
|
||||
bucketcalciumcarbonate.setUnlocalizedName("bucketcalciumcarbonate").setContainerItem(Items.bucket);
|
||||
|
@ -350,7 +350,7 @@ public class ModItems
|
|||
FluidContainerRegistry.registerFluidContainer(
|
||||
FluidRegistry.getFluidStack("fluidcalciumcarbonate", FluidContainerRegistry.BUCKET_VOLUME),
|
||||
new ItemStack(bucketcalciumcarbonate), new ItemStack(Items.bucket));
|
||||
BucketHandler.INSTANCE.buckets.put(ModFluids.BlockFluidCalciumCarbonate.getDefaultState(),
|
||||
BucketHandler.INSTANCE.buckets.put(ModFluids.BlockFluidCalciumCarbonate.getFluid(),
|
||||
bucketcalciumcarbonate);
|
||||
|
||||
bucketChlorite = new ItemFluidbucket(ModFluids.BlockFluidChlorite);
|
||||
|
@ -359,7 +359,7 @@ public class ModItems
|
|||
FluidContainerRegistry.registerFluidContainer(
|
||||
FluidRegistry.getFluidStack("fluidchlorite", FluidContainerRegistry.BUCKET_VOLUME),
|
||||
new ItemStack(bucketcalciumcarbonate), new ItemStack(Items.bucket));
|
||||
BucketHandler.INSTANCE.buckets.put(ModFluids.BlockFluidChlorite.getDefaultState(), bucketChlorite);
|
||||
BucketHandler.INSTANCE.buckets.put(ModFluids.BlockFluidChlorite.getFluid(), bucketChlorite);
|
||||
|
||||
bucketDeuterium = new ItemFluidbucket(ModFluids.BlockFluidDeuterium);
|
||||
bucketDeuterium.setUnlocalizedName("bucketdeuterium").setContainerItem(Items.bucket);
|
||||
|
@ -367,7 +367,7 @@ public class ModItems
|
|||
FluidContainerRegistry.registerFluidContainer(
|
||||
FluidRegistry.getFluidStack("fluiddeuterium", FluidContainerRegistry.BUCKET_VOLUME),
|
||||
new ItemStack(bucketDeuterium), new ItemStack(Items.bucket));
|
||||
BucketHandler.INSTANCE.buckets.put(ModFluids.BlockFluidDeuterium.getDefaultState(), bucketDeuterium);
|
||||
BucketHandler.INSTANCE.buckets.put(ModFluids.BlockFluidDeuterium.getFluid(), bucketDeuterium);
|
||||
|
||||
bucketGlyceryl = new ItemFluidbucket(ModFluids.BlockFluidGlyceryl);
|
||||
bucketGlyceryl.setUnlocalizedName("bucketglyceryl").setContainerItem(Items.bucket);
|
||||
|
@ -375,7 +375,7 @@ public class ModItems
|
|||
FluidContainerRegistry.registerFluidContainer(
|
||||
FluidRegistry.getFluidStack("fluidglyceryl", FluidContainerRegistry.BUCKET_VOLUME),
|
||||
new ItemStack(bucketGlyceryl), new ItemStack(Items.bucket));
|
||||
BucketHandler.INSTANCE.buckets.put(ModFluids.BlockFluidGlyceryl.getDefaultState(), bucketGlyceryl);
|
||||
BucketHandler.INSTANCE.buckets.put(ModFluids.BlockFluidGlyceryl.getFluid(), bucketGlyceryl);
|
||||
|
||||
bucketHelium = new ItemFluidbucket(ModFluids.BlockFluidHelium);
|
||||
bucketHelium.setUnlocalizedName("buckethelium").setContainerItem(Items.bucket);
|
||||
|
@ -383,7 +383,7 @@ public class ModItems
|
|||
FluidContainerRegistry.registerFluidContainer(
|
||||
FluidRegistry.getFluidStack("fluidhelium", FluidContainerRegistry.BUCKET_VOLUME),
|
||||
new ItemStack(bucketHelium), new ItemStack(Items.bucket));
|
||||
BucketHandler.INSTANCE.buckets.put(ModFluids.BlockFluidHelium.getDefaultState(), bucketHelium);
|
||||
BucketHandler.INSTANCE.buckets.put(ModFluids.BlockFluidHelium.getFluid(), bucketHelium);
|
||||
|
||||
bucketHelium3 = new ItemFluidbucket(ModFluids.BlockFluidHelium3);
|
||||
bucketHelium3.setUnlocalizedName("buckethelium3").setContainerItem(Items.bucket);
|
||||
|
@ -391,7 +391,7 @@ public class ModItems
|
|||
FluidContainerRegistry.registerFluidContainer(
|
||||
FluidRegistry.getFluidStack("fluidhelium3", FluidContainerRegistry.BUCKET_VOLUME),
|
||||
new ItemStack(bucketHelium3), new ItemStack(Items.bucket));
|
||||
BucketHandler.INSTANCE.buckets.put(ModFluids.BlockFluidHelium3.getDefaultState(), bucketHelium3);
|
||||
BucketHandler.INSTANCE.buckets.put(ModFluids.BlockFluidHelium3.getFluid(), bucketHelium3);
|
||||
|
||||
bucketHeliumplasma = new ItemFluidbucket(ModFluids.BlockFluidHeliumplasma);
|
||||
bucketHeliumplasma.setUnlocalizedName("bucketheliumplasma").setContainerItem(Items.bucket);
|
||||
|
@ -399,7 +399,7 @@ public class ModItems
|
|||
FluidContainerRegistry.registerFluidContainer(
|
||||
FluidRegistry.getFluidStack("fluidheliumplasma", FluidContainerRegistry.BUCKET_VOLUME),
|
||||
new ItemStack(bucketHeliumplasma), new ItemStack(Items.bucket));
|
||||
BucketHandler.INSTANCE.buckets.put(ModFluids.BlockFluidHeliumplasma.getDefaultState(), bucketHeliumplasma);
|
||||
BucketHandler.INSTANCE.buckets.put(ModFluids.BlockFluidHeliumplasma.getFluid(), bucketHeliumplasma);
|
||||
|
||||
bucketHydrogen = new ItemFluidbucket(ModFluids.BlockFluidHydrogen);
|
||||
bucketHydrogen.setUnlocalizedName("buckethydrogen").setContainerItem(Items.bucket);
|
||||
|
@ -407,7 +407,7 @@ public class ModItems
|
|||
FluidContainerRegistry.registerFluidContainer(
|
||||
FluidRegistry.getFluidStack("fluidhydrogen", FluidContainerRegistry.BUCKET_VOLUME),
|
||||
new ItemStack(bucketHydrogen), new ItemStack(Items.bucket));
|
||||
BucketHandler.INSTANCE.buckets.put(ModFluids.BlockFluidHydrogen.getDefaultState(), bucketHydrogen);
|
||||
BucketHandler.INSTANCE.buckets.put(ModFluids.BlockFluidHydrogen.getFluid(), bucketHydrogen);
|
||||
|
||||
bucketLithium = new ItemFluidbucket(ModFluids.BlockFluidLithium);
|
||||
bucketLithium.setUnlocalizedName("bucketlithium").setContainerItem(Items.bucket);
|
||||
|
@ -415,7 +415,7 @@ public class ModItems
|
|||
FluidContainerRegistry.registerFluidContainer(
|
||||
FluidRegistry.getFluidStack("fluidlithium", FluidContainerRegistry.BUCKET_VOLUME),
|
||||
new ItemStack(bucketLithium), new ItemStack(Items.bucket));
|
||||
BucketHandler.INSTANCE.buckets.put(ModFluids.BlockFluidLithium.getDefaultState(), bucketLithium);
|
||||
BucketHandler.INSTANCE.buckets.put(ModFluids.BlockFluidLithium.getFluid(), bucketLithium);
|
||||
|
||||
bucketMercury = new ItemFluidbucket(ModFluids.BlockFluidMercury);
|
||||
bucketMercury.setUnlocalizedName("bucketmercury").setContainerItem(Items.bucket);
|
||||
|
@ -423,7 +423,7 @@ public class ModItems
|
|||
FluidContainerRegistry.registerFluidContainer(
|
||||
FluidRegistry.getFluidStack("fluidmercury", FluidContainerRegistry.BUCKET_VOLUME),
|
||||
new ItemStack(bucketMercury), new ItemStack(Items.bucket));
|
||||
BucketHandler.INSTANCE.buckets.put(ModFluids.BlockFluidMercury.getDefaultState(), bucketMercury);
|
||||
BucketHandler.INSTANCE.buckets.put(ModFluids.BlockFluidMercury.getFluid(), bucketMercury);
|
||||
|
||||
bucketMethane = new ItemFluidbucket(ModFluids.BlockFluidMethane);
|
||||
bucketMethane.setUnlocalizedName("bucketmethane").setContainerItem(Items.bucket);
|
||||
|
@ -431,7 +431,7 @@ public class ModItems
|
|||
FluidContainerRegistry.registerFluidContainer(
|
||||
FluidRegistry.getFluidStack("fluidmethane", FluidContainerRegistry.BUCKET_VOLUME),
|
||||
new ItemStack(bucketMethane), new ItemStack(Items.bucket));
|
||||
BucketHandler.INSTANCE.buckets.put(ModFluids.BlockFluidMethane.getDefaultState(), bucketMethane);
|
||||
BucketHandler.INSTANCE.buckets.put(ModFluids.BlockFluidMethane.getFluid(), bucketMethane);
|
||||
|
||||
bucketNitrocoalfuel = new ItemFluidbucket(ModFluids.BlockFluidNitrocoalfuel);
|
||||
bucketNitrocoalfuel.setUnlocalizedName("bucketnitrocoalfuel").setContainerItem(Items.bucket);
|
||||
|
@ -439,7 +439,7 @@ public class ModItems
|
|||
FluidContainerRegistry.registerFluidContainer(
|
||||
FluidRegistry.getFluidStack("fluidnitrocoalfuel", FluidContainerRegistry.BUCKET_VOLUME),
|
||||
new ItemStack(bucketNitrocoalfuel), new ItemStack(Items.bucket));
|
||||
BucketHandler.INSTANCE.buckets.put(ModFluids.BlockFluidNitrocoalfuel.getDefaultState(), bucketNitrocoalfuel);
|
||||
BucketHandler.INSTANCE.buckets.put(ModFluids.BlockFluidNitrocoalfuel.getFluid(), bucketNitrocoalfuel);
|
||||
|
||||
bucketNitrofuel = new ItemFluidbucket(ModFluids.BlockFluidNitrofuel);
|
||||
bucketNitrofuel.setUnlocalizedName("bucketnitrofuel").setContainerItem(Items.bucket);
|
||||
|
@ -447,7 +447,7 @@ public class ModItems
|
|||
FluidContainerRegistry.registerFluidContainer(
|
||||
FluidRegistry.getFluidStack("fluidnitrofuel", FluidContainerRegistry.BUCKET_VOLUME),
|
||||
new ItemStack(bucketNitrofuel), new ItemStack(Items.bucket));
|
||||
BucketHandler.INSTANCE.buckets.put(ModFluids.BlockFluidNitrofuel.getDefaultState(), bucketNitrofuel);
|
||||
BucketHandler.INSTANCE.buckets.put(ModFluids.BlockFluidNitrofuel.getFluid(), bucketNitrofuel);
|
||||
|
||||
bucketNitrogen = new ItemFluidbucket(ModFluids.BlockFluidNitrogen);
|
||||
bucketNitrogen.setUnlocalizedName("bucketnitrogen").setContainerItem(Items.bucket);
|
||||
|
@ -455,7 +455,7 @@ public class ModItems
|
|||
FluidContainerRegistry.registerFluidContainer(
|
||||
FluidRegistry.getFluidStack("fluidnitrogen", FluidContainerRegistry.BUCKET_VOLUME),
|
||||
new ItemStack(bucketNitrogen), new ItemStack(Items.bucket));
|
||||
BucketHandler.INSTANCE.buckets.put(ModFluids.BlockFluidNitrogen.getDefaultState(), bucketNitrogen);
|
||||
BucketHandler.INSTANCE.buckets.put(ModFluids.BlockFluidNitrogen.getFluid(), bucketNitrogen);
|
||||
|
||||
bucketNitrogendioxide = new ItemFluidbucket(ModFluids.BlockFluidNitrogendioxide);
|
||||
bucketNitrogendioxide.setUnlocalizedName("bucketnitrogendioxide").setContainerItem(Items.bucket);
|
||||
|
@ -463,7 +463,7 @@ public class ModItems
|
|||
FluidContainerRegistry.registerFluidContainer(
|
||||
FluidRegistry.getFluidStack("fluidnitrogendioxide", FluidContainerRegistry.BUCKET_VOLUME),
|
||||
new ItemStack(bucketNitrogendioxide), new ItemStack(Items.bucket));
|
||||
BucketHandler.INSTANCE.buckets.put(ModFluids.BlockFluidNitrogendioxide.getDefaultState(),
|
||||
BucketHandler.INSTANCE.buckets.put(ModFluids.BlockFluidNitrogendioxide.getFluid(),
|
||||
bucketNitrogendioxide);
|
||||
|
||||
bucketPotassium = new ItemFluidbucket(ModFluids.BlockFluidPotassium);
|
||||
|
@ -472,7 +472,7 @@ public class ModItems
|
|||
FluidContainerRegistry.registerFluidContainer(
|
||||
FluidRegistry.getFluidStack("fluidpotassium", FluidContainerRegistry.BUCKET_VOLUME),
|
||||
new ItemStack(bucketPotassium), new ItemStack(Items.bucket));
|
||||
BucketHandler.INSTANCE.buckets.put(ModFluids.BlockFluidPotassium.getDefaultState(), bucketPotassium);
|
||||
BucketHandler.INSTANCE.buckets.put(ModFluids.BlockFluidPotassium.getFluid(), bucketPotassium);
|
||||
|
||||
bucketSilicon = new ItemFluidbucket(ModFluids.BlockFluidSilicon);
|
||||
bucketSilicon.setUnlocalizedName("bucketsilicon").setContainerItem(Items.bucket);
|
||||
|
@ -480,7 +480,7 @@ public class ModItems
|
|||
FluidContainerRegistry.registerFluidContainer(
|
||||
FluidRegistry.getFluidStack("fluidsilicon", FluidContainerRegistry.BUCKET_VOLUME),
|
||||
new ItemStack(bucketSilicon), new ItemStack(Items.bucket));
|
||||
BucketHandler.INSTANCE.buckets.put(ModFluids.BlockFluidSilicon.getDefaultState(), bucketSilicon);
|
||||
BucketHandler.INSTANCE.buckets.put(ModFluids.BlockFluidSilicon.getFluid(), bucketSilicon);
|
||||
|
||||
bucketSodium = new ItemFluidbucket(ModFluids.BlockFluidSodium);
|
||||
bucketSodium.setUnlocalizedName("bucketsodium").setContainerItem(Items.bucket);
|
||||
|
@ -488,7 +488,7 @@ public class ModItems
|
|||
FluidContainerRegistry.registerFluidContainer(
|
||||
FluidRegistry.getFluidStack("fluidsodium", FluidContainerRegistry.BUCKET_VOLUME),
|
||||
new ItemStack(bucketSodium), new ItemStack(Items.bucket));
|
||||
BucketHandler.INSTANCE.buckets.put(ModFluids.BlockFluidSodium.getDefaultState(), bucketSodium);
|
||||
BucketHandler.INSTANCE.buckets.put(ModFluids.BlockFluidSodium.getFluid(), bucketSodium);
|
||||
|
||||
bucketSodiumpersulfate = new ItemFluidbucket(ModFluids.BlockFluidSodiumpersulfate);
|
||||
bucketSodiumpersulfate.setUnlocalizedName("bucketsodiumpersulfate").setContainerItem(Items.bucket);
|
||||
|
@ -496,7 +496,7 @@ public class ModItems
|
|||
FluidContainerRegistry.registerFluidContainer(
|
||||
FluidRegistry.getFluidStack("fluidsodiumpersulfate", FluidContainerRegistry.BUCKET_VOLUME),
|
||||
new ItemStack(bucketSodiumpersulfate), new ItemStack(Items.bucket));
|
||||
BucketHandler.INSTANCE.buckets.put(ModFluids.BlockFluidSodiumpersulfate.getDefaultState(),
|
||||
BucketHandler.INSTANCE.buckets.put(ModFluids.BlockFluidSodiumpersulfate.getFluid(),
|
||||
bucketSodiumpersulfate);
|
||||
|
||||
bucketTritium = new ItemFluidbucket(ModFluids.BlockFluidTritium);
|
||||
|
@ -505,7 +505,7 @@ public class ModItems
|
|||
FluidContainerRegistry.registerFluidContainer(
|
||||
FluidRegistry.getFluidStack("fluidtritium", FluidContainerRegistry.BUCKET_VOLUME),
|
||||
new ItemStack(bucketTritium), new ItemStack(Items.bucket));
|
||||
BucketHandler.INSTANCE.buckets.put(ModFluids.BlockFluidTritium.getDefaultState(), bucketTritium);
|
||||
BucketHandler.INSTANCE.buckets.put(ModFluids.BlockFluidTritium.getFluid(), bucketTritium);
|
||||
|
||||
bucketWolframium = new ItemFluidbucket(ModFluids.BlockFluidWolframium);
|
||||
bucketWolframium.setUnlocalizedName("bucketwolframium").setContainerItem(Items.bucket);
|
||||
|
@ -513,7 +513,7 @@ public class ModItems
|
|||
FluidContainerRegistry.registerFluidContainer(
|
||||
FluidRegistry.getFluidStack("fluidwolframium", FluidContainerRegistry.BUCKET_VOLUME),
|
||||
new ItemStack(bucketWolframium), new ItemStack(Items.bucket));
|
||||
BucketHandler.INSTANCE.buckets.put(ModFluids.BlockFluidWolframium.getDefaultState(), bucketWolframium);
|
||||
BucketHandler.INSTANCE.buckets.put(ModFluids.BlockFluidWolframium.getFluid(), bucketWolframium);
|
||||
|
||||
missingRecipe = new ItemMissingRecipe().setUnlocalizedName("missingRecipe");
|
||||
GameRegistry.registerItem(missingRecipe, "mssingRecipe");
|
||||
|
|
|
@ -1,19 +1,8 @@
|
|||
package techreborn.parts;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.EnumSet;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import mcmultipart.MCMultiPartMod;
|
||||
import mcmultipart.microblock.IMicroblock;
|
||||
import mcmultipart.multipart.IMultipartContainer;
|
||||
import mcmultipart.multipart.INormallyOccludingPart;
|
||||
import mcmultipart.multipart.ISlottedPart;
|
||||
import mcmultipart.multipart.Multipart;
|
||||
import mcmultipart.multipart.MultipartHelper;
|
||||
import mcmultipart.multipart.PartSlot;
|
||||
import mcmultipart.multipart.*;
|
||||
import mcmultipart.raytrace.PartMOP;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
|
@ -27,13 +16,10 @@ import net.minecraft.entity.EntityLivingBase;
|
|||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockRenderLayer;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumParticleTypes;
|
||||
import net.minecraft.util.ITickable;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.*;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.property.ExtendedBlockState;
|
||||
import net.minecraftforge.common.property.IExtendedBlockState;
|
||||
|
@ -44,396 +30,392 @@ import reborncore.common.misc.Functions;
|
|||
import reborncore.common.misc.vecmath.Vecs3dCube;
|
||||
import reborncore.common.util.WorldUtils;
|
||||
import techreborn.config.ConfigTechReborn;
|
||||
import techreborn.parts.walia.IPartWaliaProvider;
|
||||
import techreborn.power.TRPowerNet;
|
||||
import techreborn.utils.damageSources.ElectrialShockSource;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* Created by modmuss50 on 02/03/2016.
|
||||
*/
|
||||
public abstract class CableMultipart extends Multipart
|
||||
implements INormallyOccludingPart, ISlottedPart, ITickable, ICableType {
|
||||
implements INormallyOccludingPart, ISlottedPart, ITickable, ICableType, IPartWaliaProvider {
|
||||
|
||||
public static final IUnlistedProperty<Boolean> UP = Properties.toUnlisted(PropertyBool.create("up"));
|
||||
public static final IUnlistedProperty<Boolean> DOWN = Properties.toUnlisted(PropertyBool.create("down"));
|
||||
public static final IUnlistedProperty<Boolean> NORTH = Properties.toUnlisted(PropertyBool.create("north"));
|
||||
public static final IUnlistedProperty<Boolean> EAST = Properties.toUnlisted(PropertyBool.create("east"));
|
||||
public static final IUnlistedProperty<Boolean> SOUTH = Properties.toUnlisted(PropertyBool.create("south"));
|
||||
public static final IUnlistedProperty<Boolean> WEST = Properties.toUnlisted(PropertyBool.create("west"));
|
||||
public static final IProperty<EnumCableType> TYPE = PropertyEnum.create("type", EnumCableType.class);
|
||||
public Vecs3dCube[] boundingBoxes = new Vecs3dCube[14];
|
||||
public float center = 0.6F;
|
||||
public float offset = 0.10F;
|
||||
public Map<EnumFacing, BlockPos> connectedSides;
|
||||
public int ticks = 0;
|
||||
public ItemStack stack;
|
||||
public TRPowerNet mergeWith = null;
|
||||
private TRPowerNet network;
|
||||
public static final IUnlistedProperty<Boolean> UP = Properties.toUnlisted(PropertyBool.create("up"));
|
||||
public static final IUnlistedProperty<Boolean> DOWN = Properties.toUnlisted(PropertyBool.create("down"));
|
||||
public static final IUnlistedProperty<Boolean> NORTH = Properties.toUnlisted(PropertyBool.create("north"));
|
||||
public static final IUnlistedProperty<Boolean> EAST = Properties.toUnlisted(PropertyBool.create("east"));
|
||||
public static final IUnlistedProperty<Boolean> SOUTH = Properties.toUnlisted(PropertyBool.create("south"));
|
||||
public static final IUnlistedProperty<Boolean> WEST = Properties.toUnlisted(PropertyBool.create("west"));
|
||||
public static final IProperty<EnumCableType> TYPE = PropertyEnum.create("type", EnumCableType.class);
|
||||
public Vecs3dCube[] boundingBoxes = new Vecs3dCube[14];
|
||||
public float center = 0.6F;
|
||||
public float offset = 0.10F;
|
||||
public Map<EnumFacing, BlockPos> connectedSides;
|
||||
public int ticks = 0;
|
||||
public ItemStack stack;
|
||||
public TRPowerNet mergeWith = null;
|
||||
private TRPowerNet network;
|
||||
|
||||
public CableMultipart() {
|
||||
connectedSides = new HashMap<>();
|
||||
refreshBounding();
|
||||
}
|
||||
public CableMultipart() {
|
||||
connectedSides = new HashMap<>();
|
||||
refreshBounding();
|
||||
}
|
||||
|
||||
public static CableMultipart getPartFromWorld(World world, BlockPos pos, EnumFacing side) {
|
||||
if (world == null || pos == null) {
|
||||
return null;
|
||||
}
|
||||
IMultipartContainer container = MultipartHelper.getPartContainer(world, pos);
|
||||
if (side != null && container != null) {
|
||||
ISlottedPart slottedPart = container.getPartInSlot(PartSlot.getFaceSlot(side));
|
||||
if (slottedPart instanceof IMicroblock.IFaceMicroblock
|
||||
&& !((IMicroblock.IFaceMicroblock) slottedPart).isFaceHollow()) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
public static CableMultipart getPartFromWorld(World world, BlockPos pos, EnumFacing side) {
|
||||
if (world == null || pos == null) {
|
||||
return null;
|
||||
}
|
||||
IMultipartContainer container = MultipartHelper.getPartContainer(world, pos);
|
||||
if (side != null && container != null) {
|
||||
ISlottedPart slottedPart = container.getPartInSlot(PartSlot.getFaceSlot(side));
|
||||
if (slottedPart instanceof IMicroblock.IFaceMicroblock
|
||||
&& !((IMicroblock.IFaceMicroblock) slottedPart).isFaceHollow()) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
if (container == null) {
|
||||
return null;
|
||||
}
|
||||
ISlottedPart part = container.getPartInSlot(PartSlot.CENTER);
|
||||
if (part instanceof CableMultipart) {
|
||||
return (CableMultipart) part;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
if (container == null) {
|
||||
return null;
|
||||
}
|
||||
ISlottedPart part = container.getPartInSlot(PartSlot.CENTER);
|
||||
if (part instanceof CableMultipart) {
|
||||
return (CableMultipart) part;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void refreshBounding() {
|
||||
float centerFirst = center - offset;
|
||||
double w = (getCableType().cableThickness / 16) - 0.5;
|
||||
boundingBoxes[6] = new Vecs3dCube(centerFirst - w, centerFirst - w, centerFirst - w, centerFirst + w,
|
||||
centerFirst + w, centerFirst + w);
|
||||
public void refreshBounding() {
|
||||
float centerFirst = center - offset;
|
||||
double w = (getCableType().cableThickness / 16) - 0.5;
|
||||
boundingBoxes[6] = new Vecs3dCube(centerFirst - w, centerFirst - w, centerFirst - w, centerFirst + w,
|
||||
centerFirst + w, centerFirst + w);
|
||||
|
||||
int i = 0;
|
||||
for (EnumFacing dir : EnumFacing.VALUES) {
|
||||
double xMin1 = (dir.getFrontOffsetX() < 0 ? 0.0
|
||||
: (dir.getFrontOffsetX() == 0 ? centerFirst - w : centerFirst + w));
|
||||
double xMax1 = (dir.getFrontOffsetX() > 0 ? 1.0
|
||||
: (dir.getFrontOffsetX() == 0 ? centerFirst + w : centerFirst - w));
|
||||
int i = 0;
|
||||
for (EnumFacing dir : EnumFacing.VALUES) {
|
||||
double xMin1 = (dir.getFrontOffsetX() < 0 ? 0.0
|
||||
: (dir.getFrontOffsetX() == 0 ? centerFirst - w : centerFirst + w));
|
||||
double xMax1 = (dir.getFrontOffsetX() > 0 ? 1.0
|
||||
: (dir.getFrontOffsetX() == 0 ? centerFirst + w : centerFirst - w));
|
||||
|
||||
double yMin1 = (dir.getFrontOffsetY() < 0 ? 0.0
|
||||
: (dir.getFrontOffsetY() == 0 ? centerFirst - w : centerFirst + w));
|
||||
double yMax1 = (dir.getFrontOffsetY() > 0 ? 1.0
|
||||
: (dir.getFrontOffsetY() == 0 ? centerFirst + w : centerFirst - w));
|
||||
double yMin1 = (dir.getFrontOffsetY() < 0 ? 0.0
|
||||
: (dir.getFrontOffsetY() == 0 ? centerFirst - w : centerFirst + w));
|
||||
double yMax1 = (dir.getFrontOffsetY() > 0 ? 1.0
|
||||
: (dir.getFrontOffsetY() == 0 ? centerFirst + w : centerFirst - w));
|
||||
|
||||
double zMin1 = (dir.getFrontOffsetZ() < 0 ? 0.0
|
||||
: (dir.getFrontOffsetZ() == 0 ? centerFirst - w : centerFirst + w));
|
||||
double zMax1 = (dir.getFrontOffsetZ() > 0 ? 1.0
|
||||
: (dir.getFrontOffsetZ() == 0 ? centerFirst + w : centerFirst - w));
|
||||
double zMin1 = (dir.getFrontOffsetZ() < 0 ? 0.0
|
||||
: (dir.getFrontOffsetZ() == 0 ? centerFirst - w : centerFirst + w));
|
||||
double zMax1 = (dir.getFrontOffsetZ() > 0 ? 1.0
|
||||
: (dir.getFrontOffsetZ() == 0 ? centerFirst + w : centerFirst - w));
|
||||
|
||||
boundingBoxes[i] = new Vecs3dCube(xMin1, yMin1, zMin1, xMax1, yMax1, zMax1);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
boundingBoxes[i] = new Vecs3dCube(xMin1, yMin1, zMin1, xMax1, yMax1, zMax1);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCollisionBoxes(AxisAlignedBB mask, List<AxisAlignedBB> list, Entity collidingEntity) {
|
||||
@Override
|
||||
public void addCollisionBoxes(AxisAlignedBB mask, List<AxisAlignedBB> list, Entity collidingEntity) {
|
||||
|
||||
for (EnumFacing dir : EnumFacing.VALUES) {
|
||||
if (connectedSides.containsKey(dir)
|
||||
&& mask.intersectsWith(boundingBoxes[Functions.getIntDirFromDirection(dir)].toAABB()))
|
||||
list.add(boundingBoxes[Functions.getIntDirFromDirection(dir)].toAABB());
|
||||
}
|
||||
if (mask.intersectsWith(boundingBoxes[6].toAABB())) {
|
||||
list.add(boundingBoxes[6].toAABB());
|
||||
}
|
||||
super.addCollisionBoxes(mask, list, collidingEntity);
|
||||
}
|
||||
for (EnumFacing dir : EnumFacing.VALUES) {
|
||||
if (connectedSides.containsKey(dir)
|
||||
&& mask.intersectsWith(boundingBoxes[Functions.getIntDirFromDirection(dir)].toAABB()))
|
||||
list.add(boundingBoxes[Functions.getIntDirFromDirection(dir)].toAABB());
|
||||
}
|
||||
if (mask.intersectsWith(boundingBoxes[6].toAABB())) {
|
||||
list.add(boundingBoxes[6].toAABB());
|
||||
}
|
||||
super.addCollisionBoxes(mask, list, collidingEntity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addSelectionBoxes(List<AxisAlignedBB> list) {
|
||||
@Override
|
||||
public void addSelectionBoxes(List<AxisAlignedBB> list) {
|
||||
|
||||
for (EnumFacing dir : EnumFacing.VALUES) {
|
||||
if (connectedSides.containsKey(dir))
|
||||
list.add(boundingBoxes[Functions.getIntDirFromDirection(dir)].toAABB());
|
||||
}
|
||||
list.add(boundingBoxes[6].toAABB());
|
||||
super.addSelectionBoxes(list);
|
||||
}
|
||||
for (EnumFacing dir : EnumFacing.VALUES) {
|
||||
if (connectedSides.containsKey(dir))
|
||||
list.add(boundingBoxes[Functions.getIntDirFromDirection(dir)].toAABB());
|
||||
}
|
||||
list.add(boundingBoxes[6].toAABB());
|
||||
super.addSelectionBoxes(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRemoved() {
|
||||
super.onRemoved();
|
||||
removeFromNetwork();
|
||||
for (EnumFacing dir : EnumFacing.VALUES) {
|
||||
CableMultipart multipart = getPartFromWorld(getWorld(), getPos().offset(dir), dir);
|
||||
if (multipart != null) {
|
||||
multipart.nearByChange();
|
||||
}
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void onRemoved() {
|
||||
super.onRemoved();
|
||||
removeFromNetwork();
|
||||
for (EnumFacing dir : EnumFacing.VALUES) {
|
||||
CableMultipart multipart = getPartFromWorld(getWorld(), getPos().offset(dir), dir);
|
||||
if (multipart != null) {
|
||||
multipart.nearByChange();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUnloaded() {
|
||||
super.onUnloaded();
|
||||
removeFromNetwork();
|
||||
}
|
||||
@Override
|
||||
public void onUnloaded() {
|
||||
super.onUnloaded();
|
||||
removeFromNetwork();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addOcclusionBoxes(List<AxisAlignedBB> list) {
|
||||
for (EnumFacing dir : EnumFacing.VALUES) {
|
||||
if (connectedSides.containsKey(dir))
|
||||
list.add(boundingBoxes[Functions.getIntDirFromDirection(dir)].toAABB());
|
||||
}
|
||||
list.add(boundingBoxes[6].toAABB());
|
||||
}
|
||||
@Override
|
||||
public void addOcclusionBoxes(List<AxisAlignedBB> list) {
|
||||
for (EnumFacing dir : EnumFacing.VALUES) {
|
||||
if (connectedSides.containsKey(dir))
|
||||
list.add(boundingBoxes[Functions.getIntDirFromDirection(dir)].toAABB());
|
||||
}
|
||||
list.add(boundingBoxes[6].toAABB());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNeighborBlockChange(Block block) {
|
||||
super.onNeighborBlockChange(block);
|
||||
nearByChange();
|
||||
@Override
|
||||
public void onNeighborBlockChange(Block block) {
|
||||
super.onNeighborBlockChange(block);
|
||||
nearByChange();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void nearByChange() {
|
||||
if (network == null) {
|
||||
findAndJoinNetwork(getWorld(), getPos());
|
||||
}
|
||||
checkConnectedSides();
|
||||
for (EnumFacing direction : EnumFacing.VALUES) {
|
||||
BlockPos blockPos = getPos().offset(direction);
|
||||
WorldUtils.updateBlock(getWorld(), blockPos);
|
||||
CableMultipart part = getPartFromWorld(getWorld(), blockPos, direction);
|
||||
if (part != null) {
|
||||
part.checkConnectedSides();
|
||||
}
|
||||
}
|
||||
TRPowerNet.buildEndpoint(network);
|
||||
}
|
||||
public void nearByChange() {
|
||||
if (network == null) {
|
||||
findAndJoinNetwork(getWorld(), getPos());
|
||||
}
|
||||
checkConnectedSides();
|
||||
for (EnumFacing direction : EnumFacing.VALUES) {
|
||||
BlockPos blockPos = getPos().offset(direction);
|
||||
WorldUtils.updateBlock(getWorld(), blockPos);
|
||||
CableMultipart part = getPartFromWorld(getWorld(), blockPos, direction);
|
||||
if (part != null) {
|
||||
part.checkConnectedSides();
|
||||
}
|
||||
}
|
||||
TRPowerNet.buildEndpoint(network);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAdded() {
|
||||
nearByChange();
|
||||
}
|
||||
@Override
|
||||
public void onAdded() {
|
||||
nearByChange();
|
||||
}
|
||||
|
||||
public boolean shouldConnectTo(EnumFacing dir) {
|
||||
if (dir != null) {
|
||||
if (internalShouldConnectTo(dir)) {
|
||||
CableMultipart cableMultipart = getPartFromWorld(getWorld(), getPos().offset(dir), dir);
|
||||
if (cableMultipart != null && cableMultipart.internalShouldConnectTo(dir.getOpposite())) {
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
TileEntity tile = getNeighbourTile(dir);
|
||||
public boolean shouldConnectTo(EnumFacing dir) {
|
||||
if (dir != null) {
|
||||
if (internalShouldConnectTo(dir)) {
|
||||
CableMultipart cableMultipart = getPartFromWorld(getWorld(), getPos().offset(dir), dir);
|
||||
if (cableMultipart != null && cableMultipart.internalShouldConnectTo(dir.getOpposite())) {
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
TileEntity tile = getNeighbourTile(dir);
|
||||
|
||||
if (tile instanceof IEnergyInterfaceTile) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if (tile instanceof IEnergyInterfaceTile) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean internalShouldConnectTo(EnumFacing dir) {
|
||||
ISlottedPart part = getContainer().getPartInSlot(PartSlot.getFaceSlot(dir));
|
||||
if (part instanceof IMicroblock.IFaceMicroblock) {
|
||||
if (!((IMicroblock.IFaceMicroblock) part).isFaceHollow()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
public boolean internalShouldConnectTo(EnumFacing dir) {
|
||||
ISlottedPart part = getContainer().getPartInSlot(PartSlot.getFaceSlot(dir));
|
||||
if (part instanceof IMicroblock.IFaceMicroblock) {
|
||||
if (!((IMicroblock.IFaceMicroblock) part).isFaceHollow()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// TODO 1.9 boken
|
||||
// if (!OcclusionHelper.occlusionTest(this,
|
||||
// boundingBoxes[Functions.getIntDirFromDirection(dir)].toAABB())) {
|
||||
// return false;
|
||||
// }
|
||||
if (!OcclusionHelper.occlusionTest(getContainer().getParts(), p -> p == this, boundingBoxes[Functions.getIntDirFromDirection(dir)].toAABB())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
CableMultipart cableMultipart = getPartFromWorld(getWorld(), getPos().offset(dir), dir.getOpposite());
|
||||
CableMultipart cableMultipart = getPartFromWorld(getWorld(), getPos().offset(dir), dir.getOpposite());
|
||||
|
||||
return cableMultipart != null && cableMultipart.getCableType() == getCableType();
|
||||
}
|
||||
return cableMultipart != null && cableMultipart.getCableType() == getCableType();
|
||||
}
|
||||
|
||||
public TileEntity getNeighbourTile(EnumFacing side) {
|
||||
return side != null ? getWorld().getTileEntity(getPos().offset(side)) : null;
|
||||
}
|
||||
public TileEntity getNeighbourTile(EnumFacing side) {
|
||||
return side != null ? getWorld().getTileEntity(getPos().offset(side)) : null;
|
||||
}
|
||||
|
||||
public void checkConnectedSides() {
|
||||
refreshBounding();
|
||||
connectedSides = new HashMap<>();
|
||||
for (EnumFacing dir : EnumFacing.values()) {
|
||||
int d = Functions.getIntDirFromDirection(dir);
|
||||
if (getWorld() == null) {
|
||||
return;
|
||||
}
|
||||
TileEntity te = getNeighbourTile(dir);
|
||||
if (shouldConnectTo(dir)) {
|
||||
connectedSides.put(dir, te.getPos());
|
||||
}
|
||||
}
|
||||
}
|
||||
public void checkConnectedSides() {
|
||||
refreshBounding();
|
||||
connectedSides = new HashMap<>();
|
||||
for (EnumFacing dir : EnumFacing.values()) {
|
||||
int d = Functions.getIntDirFromDirection(dir);
|
||||
if (getWorld() == null) {
|
||||
return;
|
||||
}
|
||||
TileEntity te = getNeighbourTile(dir);
|
||||
if (shouldConnectTo(dir)) {
|
||||
connectedSides.put(dir, te.getPos());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumSet<PartSlot> getSlotMask() {
|
||||
return EnumSet.of(PartSlot.CENTER);
|
||||
}
|
||||
@Override
|
||||
public EnumSet<PartSlot> getSlotMask() {
|
||||
return EnumSet.of(PartSlot.CENTER);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
if (getWorld() != null) {
|
||||
if (getWorld().getTotalWorldTime() % 80 == 0) {
|
||||
checkConnectedSides();
|
||||
}
|
||||
}
|
||||
if (network == null) {
|
||||
this.findAndJoinNetwork(getWorld(), getPos());
|
||||
} else {
|
||||
if (mergeWith != null) {
|
||||
getNetwork().merge(network);
|
||||
mergeWith = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void update() {
|
||||
if (getWorld() != null) {
|
||||
if (getWorld().getTotalWorldTime() % 80 == 0) {
|
||||
checkConnectedSides();
|
||||
}
|
||||
}
|
||||
if (network == null) {
|
||||
this.findAndJoinNetwork(getWorld(), getPos());
|
||||
} else {
|
||||
if (mergeWith != null) {
|
||||
getNetwork().merge(network);
|
||||
mergeWith = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getExtendedState(IBlockState state) {
|
||||
IExtendedBlockState extendedBlockState = (IExtendedBlockState) state;
|
||||
return extendedBlockState.withProperty(DOWN, shouldConnectTo(EnumFacing.DOWN))
|
||||
.withProperty(UP, shouldConnectTo(EnumFacing.UP)).withProperty(NORTH, shouldConnectTo(EnumFacing.NORTH))
|
||||
.withProperty(SOUTH, shouldConnectTo(EnumFacing.SOUTH))
|
||||
.withProperty(WEST, shouldConnectTo(EnumFacing.WEST))
|
||||
.withProperty(EAST, shouldConnectTo(EnumFacing.EAST)).withProperty(TYPE, getCableType());
|
||||
}
|
||||
@Override
|
||||
public IBlockState getExtendedState(IBlockState state) {
|
||||
IExtendedBlockState extendedBlockState = (IExtendedBlockState) state;
|
||||
return extendedBlockState.withProperty(DOWN, shouldConnectTo(EnumFacing.DOWN))
|
||||
.withProperty(UP, shouldConnectTo(EnumFacing.UP)).withProperty(NORTH, shouldConnectTo(EnumFacing.NORTH))
|
||||
.withProperty(SOUTH, shouldConnectTo(EnumFacing.SOUTH))
|
||||
.withProperty(WEST, shouldConnectTo(EnumFacing.WEST))
|
||||
.withProperty(EAST, shouldConnectTo(EnumFacing.EAST)).withProperty(TYPE, getCableType());
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public String getModelPath() {
|
||||
// return "techreborn:cable";
|
||||
// }
|
||||
@Override
|
||||
public BlockStateContainer createBlockState() {
|
||||
return new ExtendedBlockState(MCMultiPartMod.multipart, new IProperty[]{TYPE},
|
||||
new IUnlistedProperty[]{DOWN, UP, NORTH, SOUTH, WEST, EAST});
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockStateContainer createBlockState() {
|
||||
return new ExtendedBlockState(MCMultiPartMod.multipart, new IProperty[] { TYPE },
|
||||
new IUnlistedProperty[] { DOWN, UP, NORTH, SOUTH, WEST, EAST });
|
||||
}
|
||||
@Override
|
||||
public float getHardness(PartMOP hit) {
|
||||
return 0.5F;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getHardness(PartMOP hit) {
|
||||
return 0.5F;
|
||||
}
|
||||
public Material getMaterial() {
|
||||
return Material.cloth;
|
||||
}
|
||||
|
||||
public Material getMaterial() {
|
||||
return Material.cloth;
|
||||
}
|
||||
@Override
|
||||
public List<ItemStack> getDrops() {
|
||||
List<ItemStack> list = new ArrayList<>();
|
||||
list.add(new ItemStack(TechRebornParts.cables, 1, getCableType().ordinal()));
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ItemStack> getDrops() {
|
||||
List<ItemStack> list = new ArrayList<>();
|
||||
list.add(new ItemStack(TechRebornParts.cables, 1, getCableType().ordinal()));
|
||||
return list;
|
||||
}
|
||||
@Override
|
||||
public void onEntityCollided(Entity entity) {
|
||||
if (getCableType().canKill && entity instanceof EntityLivingBase) {
|
||||
if (entity instanceof EntityPlayer && ((EntityPlayer) entity).capabilities.isCreativeMode) {
|
||||
|
||||
@Override
|
||||
public void onEntityCollided(Entity entity) {
|
||||
if (getCableType().canKill && entity instanceof EntityLivingBase) {
|
||||
if (entity instanceof EntityPlayer && ((EntityPlayer) entity).capabilities.isCreativeMode) {
|
||||
|
||||
} else {
|
||||
if (network != null) {
|
||||
if (network.getEnergy() != 0) {
|
||||
if (ConfigTechReborn.UninsulatedElectocutionDamage) {
|
||||
if (getCableType() == EnumCableType.HV) {
|
||||
entity.setFire(1);
|
||||
}
|
||||
network.setEnergy(-1);
|
||||
entity.attackEntityFrom(new ElectrialShockSource(), 1F);
|
||||
}
|
||||
if (ConfigTechReborn.UninsulatedElectocutionSound) {
|
||||
// getWorld().playSound(entity.posX, entity.posY,
|
||||
// entity.posZ, ModSounds.shock,
|
||||
// SoundCategory.BLOCKS, 0.6F, 1F, false);
|
||||
}
|
||||
if (ConfigTechReborn.UninsulatedElectocutionParticle) {
|
||||
getWorld().spawnParticle(EnumParticleTypes.CRIT, entity.posX, entity.posY, entity.posZ, 0,
|
||||
0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (network != null) {
|
||||
if (network.getEnergy() != 0) {
|
||||
if (ConfigTechReborn.UninsulatedElectocutionDamage) {
|
||||
if (getCableType() == EnumCableType.HV) {
|
||||
entity.setFire(1);
|
||||
}
|
||||
network.setEnergy(-1);
|
||||
entity.attackEntityFrom(new ElectrialShockSource(), 1F);
|
||||
}
|
||||
if (ConfigTechReborn.UninsulatedElectocutionSound) {
|
||||
// getWorld().playSound(entity.posX, entity.posY,
|
||||
// entity.posZ, ModSounds.shock,
|
||||
// SoundCategory.BLOCKS, 0.6F, 1F, false);
|
||||
}
|
||||
if (ConfigTechReborn.UninsulatedElectocutionParticle) {
|
||||
getWorld().spawnParticle(EnumParticleTypes.CRIT, entity.posX, entity.posY, entity.posZ, 0,
|
||||
0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEntityStanding(Entity entity) {
|
||||
@Override
|
||||
public void onEntityStanding(Entity entity) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getPickBlock(EntityPlayer player, PartMOP hit) {
|
||||
return new ItemStack(TechRebornParts.cables, 1, getCableType().ordinal());
|
||||
}
|
||||
@Override
|
||||
public ItemStack getPickBlock(EntityPlayer player, PartMOP hit) {
|
||||
return new ItemStack(TechRebornParts.cables, 1, getCableType().ordinal());
|
||||
}
|
||||
|
||||
public final void findAndJoinNetwork(World world, BlockPos pos) {
|
||||
for (EnumFacing dir : EnumFacing.VALUES) {
|
||||
CableMultipart cableMultipart = getPartFromWorld(getWorld(), getPos().offset(dir), dir);
|
||||
if (cableMultipart != null && cableMultipart.getCableType() == getCableType()) {
|
||||
TRPowerNet net = cableMultipart.getNetwork();
|
||||
if (net != null) {
|
||||
network = net;
|
||||
network.addElement(this);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (network == null) {
|
||||
network = new TRPowerNet(getCableType());
|
||||
network.addElement(this);
|
||||
}
|
||||
network.endpoints.clear();
|
||||
for (EnumFacing dir : EnumFacing.VALUES) {
|
||||
TileEntity te = getNeighbourTile(dir);
|
||||
if (te != null && te instanceof IEnergyInterfaceTile) {
|
||||
network.addConnection((IEnergyInterfaceTile) te, dir.getOpposite());
|
||||
}
|
||||
}
|
||||
}
|
||||
public final void findAndJoinNetwork(World world, BlockPos pos) {
|
||||
for (EnumFacing dir : EnumFacing.VALUES) {
|
||||
CableMultipart cableMultipart = getPartFromWorld(getWorld(), getPos().offset(dir), dir);
|
||||
if (cableMultipart != null && cableMultipart.getCableType() == getCableType()) {
|
||||
TRPowerNet net = cableMultipart.getNetwork();
|
||||
if (net != null) {
|
||||
network = net;
|
||||
network.addElement(this);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (network == null) {
|
||||
network = new TRPowerNet(getCableType());
|
||||
network.addElement(this);
|
||||
}
|
||||
network.endpoints.clear();
|
||||
for (EnumFacing dir : EnumFacing.VALUES) {
|
||||
TileEntity te = getNeighbourTile(dir);
|
||||
if (te != null && te instanceof IEnergyInterfaceTile) {
|
||||
network.addConnection((IEnergyInterfaceTile) te, dir.getOpposite());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public final TRPowerNet getNetwork() {
|
||||
return network;
|
||||
}
|
||||
public final TRPowerNet getNetwork() {
|
||||
return network;
|
||||
}
|
||||
|
||||
public final void setNetwork(TRPowerNet n) {
|
||||
if (n == null) {
|
||||
} else {
|
||||
network = n;
|
||||
network.addElement(this);
|
||||
}
|
||||
}
|
||||
public final void setNetwork(TRPowerNet n) {
|
||||
if (n == null) {
|
||||
} else {
|
||||
network = n;
|
||||
network.addElement(this);
|
||||
}
|
||||
}
|
||||
|
||||
public final void removeFromNetwork() {
|
||||
if (network == null) {
|
||||
} else
|
||||
network.removeElement(this);
|
||||
}
|
||||
public final void removeFromNetwork() {
|
||||
if (network == null) {
|
||||
} else
|
||||
network.removeElement(this);
|
||||
}
|
||||
|
||||
public final void rebuildNetwork() {
|
||||
this.removeFromNetwork();
|
||||
this.resetNetwork();
|
||||
this.findAndJoinNetwork(getWorld(), getPos());
|
||||
}
|
||||
public final void rebuildNetwork() {
|
||||
this.removeFromNetwork();
|
||||
this.resetNetwork();
|
||||
this.findAndJoinNetwork(getWorld(), getPos());
|
||||
}
|
||||
|
||||
public final void resetNetwork() {
|
||||
if (network != null) {
|
||||
network.removeElement(this);
|
||||
}
|
||||
public final void resetNetwork() {
|
||||
if (network != null) {
|
||||
network.removeElement(this);
|
||||
}
|
||||
|
||||
network = null;
|
||||
}
|
||||
network = null;
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public void addInfo(List<String> info) {
|
||||
// info.add(EnumChatFormatting.GREEN + "EU Transfer: " +
|
||||
// EnumChatFormatting.LIGHT_PURPLE + getCableType().transferRate);
|
||||
// if (getCableType().canKill) {
|
||||
// info.add(EnumChatFormatting.RED + "Damages entity's!");
|
||||
// }
|
||||
// }
|
||||
@Override
|
||||
public void addInfo(List<String> info) {
|
||||
info.add(TextFormatting.GREEN + "EU Transfer: " +
|
||||
TextFormatting.LIGHT_PURPLE + getCableType().transferRate);
|
||||
if (getCableType().canKill) {
|
||||
info.add(TextFormatting.RED + "Damages entity's!");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getModelPath() {
|
||||
return new ResourceLocation("techreborn:cable");
|
||||
}
|
||||
@Override
|
||||
public ResourceLocation getModelPath() {
|
||||
return new ResourceLocation("techreborn:cable");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canRenderInLayer(BlockRenderLayer layer) {
|
||||
return layer == BlockRenderLayer.CUTOUT;
|
||||
}
|
||||
@Override
|
||||
public boolean canRenderInLayer(BlockRenderLayer layer) {
|
||||
return layer == BlockRenderLayer.CUTOUT;
|
||||
}
|
||||
}
|
||||
|
|
12
src/main/java/techreborn/parts/walia/IPartWaliaProvider.java
Normal file
12
src/main/java/techreborn/parts/walia/IPartWaliaProvider.java
Normal file
|
@ -0,0 +1,12 @@
|
|||
package techreborn.parts.walia;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by modmuss50 on 07/03/2016.
|
||||
*/
|
||||
public interface IPartWaliaProvider
|
||||
{
|
||||
|
||||
void addInfo(List<String> info);
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
package techreborn.parts.walia;
|
||||
|
||||
import mcmultipart.block.TileMultipartContainer;
|
||||
import mcp.mobius.waila.api.IWailaRegistrar;
|
||||
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLInterModComms;
|
||||
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLServerStartingEvent;
|
||||
import techreborn.compat.ICompatModule;
|
||||
|
||||
/**
|
||||
* Created by modmuss50 on 07/03/2016.
|
||||
*/
|
||||
public class WailaMcMultiPartCompact implements ICompatModule
|
||||
{
|
||||
public static void callbackRegister(IWailaRegistrar registrar)
|
||||
{
|
||||
registrar.registerBodyProvider(new WaliaPartProvider(), TileMultipartContainer.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preInit(FMLPreInitializationEvent event)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(FMLInitializationEvent event)
|
||||
{
|
||||
FMLInterModComms.sendMessage("Waila", "register", getClass().getName() + ".callbackRegister");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postInit(FMLPostInitializationEvent event)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void serverStarting(FMLServerStartingEvent event)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
97
src/main/java/techreborn/parts/walia/WaliaPartProvider.java
Normal file
97
src/main/java/techreborn/parts/walia/WaliaPartProvider.java
Normal file
|
@ -0,0 +1,97 @@
|
|||
package techreborn.parts.walia;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import mcmultipart.block.TileMultipartContainer;
|
||||
import mcmultipart.raytrace.PartMOP;
|
||||
import mcmultipart.raytrace.RayTraceUtils;
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
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.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import techreborn.parts.CableMultipart;
|
||||
|
||||
/**
|
||||
* Created by modmuss50 on 07/03/2016.
|
||||
*/
|
||||
public class WaliaPartProvider implements IWailaDataProvider
|
||||
{
|
||||
@Override
|
||||
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config)
|
||||
{
|
||||
PartMOP mop = reTrace(accessor.getWorld(), accessor.getPosition(), accessor.getPlayer());
|
||||
if (mop != null)
|
||||
{
|
||||
if (mop.partHit instanceof CableMultipart)
|
||||
{
|
||||
return mop.partHit.getDrops().get(0);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaHead(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor,
|
||||
IWailaConfigHandler config)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor,
|
||||
IWailaConfigHandler config)
|
||||
{
|
||||
PartMOP mop = reTrace(accessor.getWorld(), accessor.getPosition(), accessor.getPlayer());
|
||||
List<String> data = new ArrayList<>();
|
||||
if (mop != null)
|
||||
{
|
||||
if (mop.partHit instanceof IPartWaliaProvider)
|
||||
{
|
||||
((IPartWaliaProvider) mop.partHit).addInfo(data);
|
||||
}
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor,
|
||||
IWailaConfigHandler config)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world,
|
||||
BlockPos pos)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
// Stolen from
|
||||
// https://github.com/amadornes/MCMultiPart/blob/master/src/main/java/mcmultipart/block/BlockMultipart.java
|
||||
private PartMOP reTrace(World world, BlockPos pos, EntityPlayer player)
|
||||
{
|
||||
Vec3d start = RayTraceUtils.getStart(player);
|
||||
Vec3d end = RayTraceUtils.getEnd(player);
|
||||
RayTraceUtils.AdvancedRayTraceResultPart result = getMultipartTile(world, pos).getPartContainer()
|
||||
.collisionRayTrace(start, end);
|
||||
return result == null ? null : result.hit;
|
||||
}
|
||||
|
||||
// Stolen from
|
||||
// https://github.com/amadornes/MCMultiPart/blob/master/src/main/java/mcmultipart/block/BlockMultipart.java
|
||||
private TileMultipartContainer getMultipartTile(IBlockAccess world, BlockPos pos)
|
||||
{
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
return tile instanceof TileMultipartContainer ? (TileMultipartContainer) tile : null;
|
||||
}
|
||||
}
|
|
@ -172,7 +172,7 @@ public class TileElectricFurnace extends TilePowerAcceptor implements IWrenchabl
|
|||
@Override
|
||||
public ItemStack getWrenchDrop(EntityPlayer entityPlayer)
|
||||
{
|
||||
return new ItemStack(ModBlocks.AlloySmelter, 1);
|
||||
return new ItemStack(ModBlocks.ElectricFurnace, 1);
|
||||
}
|
||||
|
||||
public boolean isComplete()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue