mirror of
https://github.com/GTNewHorizons/TinkersConstruct.git
synced 2026-11-19 19:59:55 +00:00
Fix JABBA-related issues with crafting station slots (#54)
* Fix shift-merging tools voiding items fixes <https://github.com/GTNewHorizons/GT-New-Horizons-Modpack/issues/11392> * Change 0-sized ItemStacks into null stacks in crafting station attached slots Fixes <https://github.com/GTNewHorizons/GT-New-Horizons-Modpack/issues/10425> * Update buildscript * spotlessApply
This commit is contained in:
1 parent
18bfeaff32
commit
39be06c23b
571 files changed
+25959
-28223
No files matched your search
@@ -5,89 +5,69 @@ import net.minecraft.block.Block;
|
||||
import net.minecraft.item.*;
|
||||
import net.minecraft.item.crafting.*;
|
||||
|
||||
public class CraftingRecipeHelper
|
||||
{
|
||||
public static void removeShapedRecipes (List<ItemStack> removelist)
|
||||
{
|
||||
for (ItemStack stack : removelist)
|
||||
removeShapedRecipe(stack);
|
||||
public class CraftingRecipeHelper {
|
||||
public static void removeShapedRecipes(List<ItemStack> removelist) {
|
||||
for (ItemStack stack : removelist) removeShapedRecipe(stack);
|
||||
}
|
||||
|
||||
public static void removeAnyRecipe (ItemStack resultItem)
|
||||
{
|
||||
public static void removeAnyRecipe(ItemStack resultItem) {
|
||||
List<IRecipe> recipes = CraftingManager.getInstance().getRecipeList();
|
||||
for (int i = 0; i < recipes.size(); i++)
|
||||
{
|
||||
for (int i = 0; i < recipes.size(); i++) {
|
||||
IRecipe tmpRecipe = recipes.get(i);
|
||||
ItemStack recipeResult = tmpRecipe.getRecipeOutput();
|
||||
if (ItemStack.areItemStacksEqual(resultItem, recipeResult))
|
||||
{
|
||||
if (ItemStack.areItemStacksEqual(resultItem, recipeResult)) {
|
||||
recipes.remove(i--);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void removeShapedRecipe (ItemStack resultItem)
|
||||
{
|
||||
public static void removeShapedRecipe(ItemStack resultItem) {
|
||||
List<IRecipe> recipes = CraftingManager.getInstance().getRecipeList();
|
||||
for (int i = 0; i < recipes.size(); i++)
|
||||
{
|
||||
for (int i = 0; i < recipes.size(); i++) {
|
||||
IRecipe tmpRecipe = recipes.get(i);
|
||||
if (tmpRecipe instanceof ShapedRecipes)
|
||||
{
|
||||
if (tmpRecipe instanceof ShapedRecipes) {
|
||||
ShapedRecipes recipe = (ShapedRecipes) tmpRecipe;
|
||||
ItemStack recipeResult = recipe.getRecipeOutput();
|
||||
|
||||
if (ItemStack.areItemStacksEqual(resultItem, recipeResult))
|
||||
{
|
||||
if (ItemStack.areItemStacksEqual(resultItem, recipeResult)) {
|
||||
recipes.remove(i--);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void removeShapelessRecipe (ItemStack resultItem)
|
||||
{
|
||||
public static void removeShapelessRecipe(ItemStack resultItem) {
|
||||
List<IRecipe> recipes = CraftingManager.getInstance().getRecipeList();
|
||||
for (int i = 0; i < recipes.size(); i++)
|
||||
{
|
||||
for (int i = 0; i < recipes.size(); i++) {
|
||||
IRecipe tmpRecipe = recipes.get(i);
|
||||
if (tmpRecipe instanceof ShapelessRecipes)
|
||||
{
|
||||
if (tmpRecipe instanceof ShapelessRecipes) {
|
||||
ShapelessRecipes recipe = (ShapelessRecipes) tmpRecipe;
|
||||
ItemStack recipeResult = recipe.getRecipeOutput();
|
||||
|
||||
if (ItemStack.areItemStacksEqual(resultItem, recipeResult))
|
||||
{
|
||||
if (ItemStack.areItemStacksEqual(resultItem, recipeResult)) {
|
||||
recipes.remove(i--);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void addShapedRecipeFirst (List recipeList, ItemStack itemstack, Object... objArray)
|
||||
{
|
||||
public static void addShapedRecipeFirst(List recipeList, ItemStack itemstack, Object... objArray) {
|
||||
String var3 = "";
|
||||
int var4 = 0;
|
||||
int var5 = 0;
|
||||
int var6 = 0;
|
||||
|
||||
if (objArray[var4] instanceof String[])
|
||||
{
|
||||
if (objArray[var4] instanceof String[]) {
|
||||
String[] var7 = ((String[]) objArray[var4++]);
|
||||
|
||||
for (int var8 = 0; var8 < var7.length; ++var8)
|
||||
{
|
||||
for (int var8 = 0; var8 < var7.length; ++var8) {
|
||||
String var9 = var7[var8];
|
||||
++var6;
|
||||
var5 = var9.length();
|
||||
var3 = var3 + var9;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
while (objArray[var4] instanceof String)
|
||||
{
|
||||
} else {
|
||||
while (objArray[var4] instanceof String) {
|
||||
String var11 = (String) objArray[var4++];
|
||||
++var6;
|
||||
var5 = var11.length();
|
||||
@@ -97,21 +77,15 @@ public class CraftingRecipeHelper
|
||||
|
||||
HashMap var12;
|
||||
|
||||
for (var12 = new HashMap(); var4 < objArray.length; var4 += 2)
|
||||
{
|
||||
for (var12 = new HashMap(); var4 < objArray.length; var4 += 2) {
|
||||
Character var13 = (Character) objArray[var4];
|
||||
ItemStack var14 = null;
|
||||
|
||||
if (objArray[var4 + 1] instanceof Item)
|
||||
{
|
||||
if (objArray[var4 + 1] instanceof Item) {
|
||||
var14 = new ItemStack((Item) objArray[var4 + 1]);
|
||||
}
|
||||
else if (objArray[var4 + 1] instanceof Block)
|
||||
{
|
||||
} else if (objArray[var4 + 1] instanceof Block) {
|
||||
var14 = new ItemStack((Block) objArray[var4 + 1], 1, Short.MAX_VALUE);
|
||||
}
|
||||
else if (objArray[var4 + 1] instanceof ItemStack)
|
||||
{
|
||||
} else if (objArray[var4 + 1] instanceof ItemStack) {
|
||||
var14 = (ItemStack) objArray[var4 + 1];
|
||||
}
|
||||
|
||||
@@ -120,16 +94,12 @@ public class CraftingRecipeHelper
|
||||
|
||||
ItemStack[] var15 = new ItemStack[var5 * var6];
|
||||
|
||||
for (int var16 = 0; var16 < var5 * var6; ++var16)
|
||||
{
|
||||
for (int var16 = 0; var16 < var5 * var6; ++var16) {
|
||||
char var10 = var3.charAt(var16);
|
||||
|
||||
if (var12.containsKey(Character.valueOf(var10)))
|
||||
{
|
||||
if (var12.containsKey(Character.valueOf(var10))) {
|
||||
var15[var16] = ((ItemStack) var12.get(Character.valueOf(var10))).copy();
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
var15[var16] = null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,19 +3,15 @@ package tconstruct.util;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.util.*;
|
||||
|
||||
public class DamageSourceFireworkExplode extends DamageSource
|
||||
{
|
||||
public class DamageSourceFireworkExplode extends DamageSource {
|
||||
|
||||
public DamageSourceFireworkExplode(String s)
|
||||
{
|
||||
public DamageSourceFireworkExplode(String s) {
|
||||
super(s);
|
||||
this.setDamageBypassesArmor();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IChatComponent func_151519_b (EntityLivingBase par1EntityLivingBase)
|
||||
{
|
||||
public IChatComponent func_151519_b(EntityLivingBase par1EntityLivingBase) {
|
||||
return new ChatComponentTranslation("death.attack.FireworkExplode", par1EntityLivingBase.func_145748_c_());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -3,18 +3,15 @@ package tconstruct.util;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.util.*;
|
||||
|
||||
public class DamageSourceLandmine extends DamageSource
|
||||
{
|
||||
public class DamageSourceLandmine extends DamageSource {
|
||||
|
||||
public DamageSourceLandmine(String s)
|
||||
{
|
||||
public DamageSourceLandmine(String s) {
|
||||
super(s);
|
||||
this.setDamageBypassesArmor();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IChatComponent func_151519_b (EntityLivingBase par1EntityLivingBase)
|
||||
{
|
||||
public IChatComponent func_151519_b(EntityLivingBase par1EntityLivingBase) {
|
||||
return new ChatComponentTranslation("death.attack.Landmine", par1EntityLivingBase.func_145748_c_());
|
||||
}
|
||||
}
|
||||
@@ -5,14 +5,10 @@ import cpw.mods.fml.relauncher.Side;
|
||||
import java.util.*;
|
||||
import mantle.crash.*;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import tconstruct.TConstruct;
|
||||
|
||||
public class EnvironmentChecks
|
||||
{
|
||||
public class EnvironmentChecks {
|
||||
|
||||
private EnvironmentChecks()
|
||||
{
|
||||
} // Singleton
|
||||
private EnvironmentChecks() {} // Singleton
|
||||
|
||||
/**
|
||||
* Checks for conflicting stuff in environment; adds callable to any crash
|
||||
@@ -20,36 +16,30 @@ public class EnvironmentChecks
|
||||
* not trigger any crashes.
|
||||
*/
|
||||
private static List<String> incompatibilities = new ArrayList<String>();
|
||||
|
||||
private static EnvironmentChecks instance = new EnvironmentChecks();
|
||||
|
||||
public static void verifyEnvironmentSanity ()
|
||||
{
|
||||
public static void verifyEnvironmentSanity() {
|
||||
List<String> modIds = new ArrayList<String>();
|
||||
|
||||
// Bukkit/Magic Launcher/Optifine are caught by Mantle, so we no longer
|
||||
// check for those.
|
||||
|
||||
if (modIds.size() == 0)
|
||||
{
|
||||
if (modIds.size() == 0) {
|
||||
ICrashCallable callable = new CallableSuppConfig("TConstruct");
|
||||
FMLCommonHandler.instance().registerCrashCallable(callable);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
ICrashCallable callable = new CallableUnsuppConfig("TConstruct", modIds);
|
||||
FMLCommonHandler.instance().registerCrashCallable(callable);
|
||||
}
|
||||
|
||||
if (incompatibilities.size() > 0 && FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT)
|
||||
{
|
||||
if (incompatibilities.size() > 0 && FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT) {
|
||||
MinecraftForge.EVENT_BUS.register(instance);
|
||||
}
|
||||
}
|
||||
|
||||
public static String modCompatDetails (String type, boolean consoleFormat)
|
||||
{
|
||||
public static String modCompatDetails(String type, boolean consoleFormat) {
|
||||
String n = consoleFormat ? System.getProperty("line.separator") : "\n";
|
||||
return "";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -4,14 +4,14 @@ import cofh.api.energy.IEnergyContainerItem;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.FMLLog;
|
||||
import cpw.mods.fml.common.event.FMLInterModComms;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import org.apache.logging.log4j.Level;
|
||||
import tconstruct.TConstruct;
|
||||
import tconstruct.library.TConstructRegistry;
|
||||
import tconstruct.library.client.TConstructClientRegistry;
|
||||
@@ -25,26 +25,17 @@ import tconstruct.library.util.IPattern;
|
||||
import tconstruct.smeltery.TinkerSmeltery;
|
||||
import tconstruct.tools.TinkerTools;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public final class IMCHandler {
|
||||
private IMCHandler() {}
|
||||
|
||||
public static void processIMC(List<FMLInterModComms.IMCMessage> messages)
|
||||
{
|
||||
for(FMLInterModComms.IMCMessage message : messages)
|
||||
{
|
||||
public static void processIMC(List<FMLInterModComms.IMCMessage> messages) {
|
||||
for (FMLInterModComms.IMCMessage message : messages) {
|
||||
String type = message.key;
|
||||
if(type == null || type.isEmpty())
|
||||
continue;
|
||||
if (type == null || type.isEmpty()) continue;
|
||||
|
||||
// process materials added from mods
|
||||
if(type.equals("addMaterial"))
|
||||
{
|
||||
if(!message.isNBTMessage())
|
||||
{
|
||||
if (type.equals("addMaterial")) {
|
||||
if (!message.isNBTMessage()) {
|
||||
logInvalidMessage(message);
|
||||
continue;
|
||||
}
|
||||
@@ -52,14 +43,13 @@ public final class IMCHandler {
|
||||
NBTTagCompound tag = message.getNBTValue();
|
||||
int id = tag.getInteger("Id");
|
||||
ToolMaterial mat = scanMaterial(tag);
|
||||
if(mat != null) {
|
||||
if (mat != null) {
|
||||
TConstructRegistry.addtoolMaterial(id, mat);
|
||||
TConstructRegistry.addDefaultToolPartMaterial(id);
|
||||
TConstruct.logger.debug("IMC: Added material " + mat.materialName);
|
||||
|
||||
// bow stats
|
||||
if(tag.hasKey("Bow_DrawSpeed") && tag.hasKey("Bow_ProjectileSpeed"))
|
||||
{
|
||||
if (tag.hasKey("Bow_DrawSpeed") && tag.hasKey("Bow_ProjectileSpeed")) {
|
||||
int drawspeed = tag.getInteger("Bow_DrawSpeed");
|
||||
float flightspeed = tag.getFloat("Bow_ProjectileSpeed");
|
||||
|
||||
@@ -67,8 +57,7 @@ public final class IMCHandler {
|
||||
TConstruct.logger.debug("IMC: Added Bow stats for material " + mat.materialName);
|
||||
}
|
||||
// arrow stats
|
||||
if(tag.hasKey("Projectile_Mass") && tag.hasKey("Projectile_Fragility"))
|
||||
{
|
||||
if (tag.hasKey("Projectile_Mass") && tag.hasKey("Projectile_Fragility")) {
|
||||
float mass = tag.getFloat("Projectile_Mass");
|
||||
float breakchance = tag.getFloat("Projectile_Fragility");
|
||||
|
||||
@@ -76,28 +65,25 @@ public final class IMCHandler {
|
||||
TConstruct.logger.debug("IMC: Added Projectile stats for material " + mat.materialName);
|
||||
}
|
||||
|
||||
// add additional render mapping so resource packs or the mods themselves can have custom textures for the tools
|
||||
if(FMLCommonHandler.instance().getSide().isClient())
|
||||
TConstructClientRegistry.addMaterialRenderMapping(id, "tinker", mat.name().toLowerCase(), true);
|
||||
// add additional render mapping so resource packs or the mods themselves can have custom textures
|
||||
// for the tools
|
||||
if (FMLCommonHandler.instance().getSide().isClient())
|
||||
TConstructClientRegistry.addMaterialRenderMapping(
|
||||
id, "tinker", mat.name().toLowerCase(), true);
|
||||
}
|
||||
}
|
||||
else if(type.equals("addPartBuilderMaterial"))
|
||||
{
|
||||
if(!message.isNBTMessage())
|
||||
{
|
||||
} else if (type.equals("addPartBuilderMaterial")) {
|
||||
if (!message.isNBTMessage()) {
|
||||
logInvalidMessage(message);
|
||||
continue;
|
||||
}
|
||||
NBTTagCompound tag = message.getNBTValue();
|
||||
|
||||
if(!checkRequiredTags("PartBuilder", tag, "MaterialId", "Item", "Value"))
|
||||
continue;
|
||||
if (!checkRequiredTags("PartBuilder", tag, "MaterialId", "Item", "Value")) continue;
|
||||
|
||||
int matID = tag.getInteger("MaterialId");
|
||||
int value = tag.getInteger("Value");
|
||||
|
||||
if(TConstructRegistry.getMaterial(matID) == null)
|
||||
{
|
||||
if (TConstructRegistry.getMaterial(matID) == null) {
|
||||
FMLLog.bigWarning("PartBuilder IMC: Unknown Material ID " + matID);
|
||||
continue;
|
||||
}
|
||||
@@ -107,30 +93,27 @@ public final class IMCHandler {
|
||||
ItemStack rod = new ItemStack(TinkerTools.toolRod, 1, matID);
|
||||
|
||||
// default shard if none present. Has to exist because old code.
|
||||
if(shard == null)
|
||||
{
|
||||
if (shard == null) {
|
||||
TConstructRegistry.addDefaultShardMaterial(matID);
|
||||
shard = new ItemStack(TinkerTools.toolShard, 1, matID);
|
||||
}
|
||||
|
||||
// register the material
|
||||
PatternBuilder.instance.registerFullMaterial(item, value, TConstructRegistry.getMaterial(matID).materialName, shard, rod, matID);
|
||||
PatternBuilder.instance.registerFullMaterial(
|
||||
item, value, TConstructRegistry.getMaterial(matID).materialName, shard, rod, matID);
|
||||
|
||||
List<Item> addItems = new LinkedList<Item>();
|
||||
List<Integer> addMetas = new LinkedList<Integer>();
|
||||
List<ItemStack> addOUtputs = new LinkedList<ItemStack>();
|
||||
|
||||
// add mappings for everything that has stone tool mappings
|
||||
for(Map.Entry<List, ItemStack> mappingEntry : TConstructRegistry.patternPartMapping.entrySet())
|
||||
{
|
||||
for (Map.Entry<List, ItemStack> mappingEntry : TConstructRegistry.patternPartMapping.entrySet()) {
|
||||
List mapping = mappingEntry.getKey();
|
||||
// only stone mappings
|
||||
if((Integer)mapping.get(2) != TinkerTools.MaterialID.Stone)
|
||||
continue;
|
||||
if ((Integer) mapping.get(2) != TinkerTools.MaterialID.Stone) continue;
|
||||
|
||||
// only if the output is a dynamic part
|
||||
if(!(mappingEntry.getValue().getItem() instanceof DynamicToolPart))
|
||||
continue;
|
||||
if (!(mappingEntry.getValue().getItem() instanceof DynamicToolPart)) continue;
|
||||
|
||||
Item woodPattern = (Item) mapping.get(0);
|
||||
Integer meta = (Integer) mapping.get(1);
|
||||
@@ -145,138 +128,124 @@ public final class IMCHandler {
|
||||
}
|
||||
|
||||
// add a part mapping for it
|
||||
for(int i = 0; i < addItems.size(); i++)
|
||||
for (int i = 0; i < addItems.size(); i++)
|
||||
TConstructRegistry.addPartMapping(addItems.get(i), addMetas.get(i), matID, addOUtputs.get(i));
|
||||
|
||||
|
||||
TConstruct.logger.debug("PartBuilder IMC: Added Part builder mapping for " + TConstructRegistry.getMaterial(matID).materialName);
|
||||
}
|
||||
else if(type.equals("addPartCastingMaterial"))
|
||||
{
|
||||
if(!message.isNBTMessage())
|
||||
{
|
||||
TConstruct.logger.debug("PartBuilder IMC: Added Part builder mapping for "
|
||||
+ TConstructRegistry.getMaterial(matID).materialName);
|
||||
} else if (type.equals("addPartCastingMaterial")) {
|
||||
if (!message.isNBTMessage()) {
|
||||
logInvalidMessage(message);
|
||||
continue;
|
||||
}
|
||||
|
||||
NBTTagCompound tag = message.getNBTValue();
|
||||
|
||||
if(!checkRequiredTags("Casting", tag, "MaterialId", "FluidName"))
|
||||
continue;
|
||||
if (!checkRequiredTags("Casting", tag, "MaterialId", "FluidName")) continue;
|
||||
|
||||
if(!tag.hasKey("MaterialId"))
|
||||
{
|
||||
if (!tag.hasKey("MaterialId")) {
|
||||
FMLLog.bigWarning("Casting IMC: Not material ID for the result present");
|
||||
continue;
|
||||
}
|
||||
|
||||
int matID = tag.getInteger("MaterialId");
|
||||
FluidStack liquid = FluidStack.loadFluidStackFromNBT(tag);
|
||||
if(liquid == null) {
|
||||
if (liquid == null) {
|
||||
FMLLog.bigWarning("Casting IMC: No fluid found");
|
||||
continue;
|
||||
}
|
||||
|
||||
if(TConstructRegistry.getMaterial(matID) == null)
|
||||
{
|
||||
if (TConstructRegistry.getMaterial(matID) == null) {
|
||||
FMLLog.bigWarning("Casting IMC: Unknown Material ID " + matID);
|
||||
continue;
|
||||
}
|
||||
|
||||
// we add the toolpart to all smeltery recipies that use iron and create a toolpart
|
||||
List<CastingRecipe> newRecipies = new LinkedList<CastingRecipe>();
|
||||
for(CastingRecipe recipe : TConstructRegistry.getTableCasting().getCastingRecipes())
|
||||
{
|
||||
if(recipe.castingMetal.getFluid() != TinkerSmeltery.moltenIronFluid)
|
||||
continue;
|
||||
if(recipe.cast == null || !(recipe.cast.getItem() instanceof IPattern))
|
||||
continue;
|
||||
if(!(recipe.getResult().getItem() instanceof DynamicToolPart)) // has to be dynamic toolpart to support automatic addition
|
||||
continue;
|
||||
for (CastingRecipe recipe : TConstructRegistry.getTableCasting().getCastingRecipes()) {
|
||||
if (recipe.castingMetal.getFluid() != TinkerSmeltery.moltenIronFluid) continue;
|
||||
if (recipe.cast == null || !(recipe.cast.getItem() instanceof IPattern)) continue;
|
||||
if (!(recipe.getResult().getItem()
|
||||
instanceof DynamicToolPart)) // has to be dynamic toolpart to support automatic addition
|
||||
continue;
|
||||
|
||||
newRecipies.add(recipe);
|
||||
}
|
||||
|
||||
FluidType ft = FluidType.getFluidType(liquid.getFluid());
|
||||
if(ft == null) {
|
||||
if (ft == null) {
|
||||
ft = new FluidType(TinkerSmeltery.glueBlock, 0, 500, liquid.getFluid(), true);
|
||||
FluidType.registerFluidType(liquid.getFluid().getName(), ft);
|
||||
}
|
||||
|
||||
// has to be done separately so we have all checks and no concurrent modification exception
|
||||
for(CastingRecipe recipe : newRecipies)
|
||||
{
|
||||
for (CastingRecipe recipe : newRecipies) {
|
||||
ItemStack output = recipe.getResult().copy();
|
||||
output.setItemDamage(matID);
|
||||
|
||||
FluidStack liquid2 = new FluidStack(liquid, recipe.castingMetal.amount);
|
||||
|
||||
// ok, this recipe creates a toolpart and uses iron for it. add a new one for the IMC stuff!
|
||||
TConstructRegistry.getTableCasting().addCastingRecipe(output, liquid2, recipe.cast, recipe.consumeCast, recipe.coolTime);
|
||||
TConstructRegistry.getTableCasting()
|
||||
.addCastingRecipe(output, liquid2, recipe.cast, recipe.consumeCast, recipe.coolTime);
|
||||
// and make it melt!
|
||||
Smeltery.addMelting(ft, output, 0, liquid2.amount);
|
||||
}
|
||||
|
||||
TConstruct.logger.debug("Casting IMC: Added fluid " + tag.getString("FluidName") + " to part casting");
|
||||
}
|
||||
else if(type.equals("addMaterialItem")) {
|
||||
if(!message.isNBTMessage()) {
|
||||
} else if (type.equals("addMaterialItem")) {
|
||||
if (!message.isNBTMessage()) {
|
||||
logInvalidMessage(message);
|
||||
continue;
|
||||
}
|
||||
|
||||
NBTTagCompound tag = message.getNBTValue();
|
||||
|
||||
if (!checkRequiredTags("Material Item", tag, "MaterialId", "Value", "Item"))
|
||||
continue;
|
||||
if (!checkRequiredTags("Material Item", tag, "MaterialId", "Value", "Item")) continue;
|
||||
|
||||
int id = tag.getInteger("MaterialId");
|
||||
int value = tag.getInteger("Value");
|
||||
ItemStack stack = ItemStack.loadItemStackFromNBT(tag.getCompoundTag("Item"));
|
||||
|
||||
if(stack == null) {
|
||||
if (stack == null) {
|
||||
FMLLog.bigWarning("Material Item IMC: Item for Material %d is null", id);
|
||||
continue;
|
||||
}
|
||||
|
||||
if(TConstructRegistry.getMaterial(id) == null) {
|
||||
if (TConstructRegistry.getMaterial(id) == null) {
|
||||
FMLLog.bigWarning("Material Item IMC: Material with ID %d does not exist", id);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
ToolMaterial mat = TConstructRegistry.getMaterial(id);
|
||||
|
||||
// we already have the material registered in there
|
||||
if(PatternBuilder.instance.materialSets.containsKey(mat.materialName))
|
||||
{
|
||||
if (PatternBuilder.instance.materialSets.containsKey(mat.materialName)) {
|
||||
PatternBuilder.instance.registerMaterial(stack, value, mat.materialName);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
TConstructRegistry.addDefaultShardMaterial(id);
|
||||
ItemStack shard = new ItemStack(TinkerTools.toolShard, 1, id);
|
||||
ItemStack rod = new ItemStack(TinkerTools.toolRod, 1, id);
|
||||
|
||||
// register the material
|
||||
PatternBuilder.instance.registerFullMaterial(stack, value, TConstructRegistry.getMaterial(id).materialName, shard, rod, id);
|
||||
PatternBuilder.instance.registerFullMaterial(
|
||||
stack, value, TConstructRegistry.getMaterial(id).materialName, shard, rod, id);
|
||||
}
|
||||
}
|
||||
else if(type.equals("addSmelteryMelting")) {
|
||||
} else if (type.equals("addSmelteryMelting")) {
|
||||
if (!message.isNBTMessage()) {
|
||||
logInvalidMessage(message);
|
||||
continue;
|
||||
}
|
||||
NBTTagCompound tag = message.getNBTValue();
|
||||
|
||||
if (!checkRequiredTags("Smeltery", tag, "FluidName", "Temperature", "Item", "Block"))
|
||||
continue;
|
||||
if (!checkRequiredTags("Smeltery", tag, "FluidName", "Temperature", "Item", "Block")) continue;
|
||||
|
||||
FluidStack liquid = FluidStack.loadFluidStackFromNBT(tag);
|
||||
if(liquid == null) {
|
||||
if (liquid == null) {
|
||||
FMLLog.bigWarning("Smeltery IMC: No fluid found");
|
||||
continue;
|
||||
}
|
||||
if(liquid.amount <= 0) {
|
||||
if (liquid.amount <= 0) {
|
||||
FMLLog.bigWarning("Smeltery IMC: Liquid has to have an amount greater than zero");
|
||||
continue;
|
||||
}
|
||||
@@ -284,25 +253,31 @@ public final class IMCHandler {
|
||||
ItemStack item = ItemStack.loadItemStackFromNBT(tag.getCompoundTag("Item"));
|
||||
ItemStack block = ItemStack.loadItemStackFromNBT(tag.getCompoundTag("Block"));
|
||||
int temperature = tag.getInteger("Temperature");
|
||||
|
||||
if(FluidType.getFluidType(liquid.getFluid()) == null)
|
||||
FluidType.registerFluidType(liquid.getFluid().getName(), Block.getBlockFromItem(block.getItem()), block.getItemDamage(), temperature, liquid.getFluid(), false);
|
||||
|
||||
Smeltery.addMelting(item, Block.getBlockFromItem(block.getItem()), block.getItemDamage(), temperature, liquid);
|
||||
TConstruct.logger.debug("Smeltery IMC: Added melting: " + item.getDisplayName() + " to " + liquid.amount + "mb " + liquid.getLocalizedName());
|
||||
}
|
||||
else if(type.equals("addSmelteryFuel")) {
|
||||
if (FluidType.getFluidType(liquid.getFluid()) == null)
|
||||
FluidType.registerFluidType(
|
||||
liquid.getFluid().getName(),
|
||||
Block.getBlockFromItem(block.getItem()),
|
||||
block.getItemDamage(),
|
||||
temperature,
|
||||
liquid.getFluid(),
|
||||
false);
|
||||
|
||||
Smeltery.addMelting(
|
||||
item, Block.getBlockFromItem(block.getItem()), block.getItemDamage(), temperature, liquid);
|
||||
TConstruct.logger.debug("Smeltery IMC: Added melting: " + item.getDisplayName() + " to " + liquid.amount
|
||||
+ "mb " + liquid.getLocalizedName());
|
||||
} else if (type.equals("addSmelteryFuel")) {
|
||||
if (!message.isNBTMessage()) {
|
||||
logInvalidMessage(message);
|
||||
continue;
|
||||
}
|
||||
NBTTagCompound tag = message.getNBTValue();
|
||||
|
||||
if (!checkRequiredTags("Smeltery", tag, "FluidName", "Temperature", "Duration"))
|
||||
continue;
|
||||
if (!checkRequiredTags("Smeltery", tag, "FluidName", "Temperature", "Duration")) continue;
|
||||
|
||||
FluidStack liquid = FluidStack.loadFluidStackFromNBT(tag);
|
||||
if(liquid == null) {
|
||||
if (liquid == null) {
|
||||
FMLLog.bigWarning("Smeltery IMC: No fluid found");
|
||||
continue;
|
||||
}
|
||||
@@ -312,7 +287,8 @@ public final class IMCHandler {
|
||||
|
||||
Smeltery.addSmelteryFuel(liquid.getFluid(), temperature, duration);
|
||||
|
||||
TConstruct.logger.debug("Smeltery IMC: Added fuel: " + liquid.getLocalizedName() + " (" + temperature + ", " + duration + ")");
|
||||
TConstruct.logger.debug("Smeltery IMC: Added fuel: " + liquid.getLocalizedName() + " (" + temperature
|
||||
+ ", " + duration + ")");
|
||||
} else if (type.equals("addFluxBattery")) {
|
||||
if (!message.isItemStackMessage()) {
|
||||
logInvalidMessage(message, "ItemStack");
|
||||
@@ -321,7 +297,7 @@ public final class IMCHandler {
|
||||
ItemStack battery = message.getItemStackValue();
|
||||
battery.stackSize = 1; // avoid getting a stack size of 0 or larger than 1
|
||||
|
||||
if(!(battery.getItem() instanceof IEnergyContainerItem)) {
|
||||
if (!(battery.getItem() instanceof IEnergyContainerItem)) {
|
||||
FMLLog.bigWarning("Flux Battery IMC: ItemStack is no instance of IEnergyContainerItem");
|
||||
}
|
||||
|
||||
@@ -332,12 +308,10 @@ public final class IMCHandler {
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean checkRequiredTags(String prefix, NBTTagCompound tag, String... tags)
|
||||
{
|
||||
private static boolean checkRequiredTags(String prefix, NBTTagCompound tag, String... tags) {
|
||||
boolean ok = true;
|
||||
for(String t : tags)
|
||||
if(!tag.hasKey(t))
|
||||
{
|
||||
for (String t : tags)
|
||||
if (!tag.hasKey(t)) {
|
||||
FMLLog.bigWarning(String.format("%s IMC: Missing required NBT Tag %s", prefix, t));
|
||||
ok = false; // don't abort, report all missing tags
|
||||
}
|
||||
@@ -345,37 +319,32 @@ public final class IMCHandler {
|
||||
return ok;
|
||||
}
|
||||
|
||||
private static void logInvalidMessage(FMLInterModComms.IMCMessage message)
|
||||
{
|
||||
private static void logInvalidMessage(FMLInterModComms.IMCMessage message) {
|
||||
logInvalidMessage(message, "NBT");
|
||||
}
|
||||
|
||||
private static void logInvalidMessage(FMLInterModComms.IMCMessage message, String type)
|
||||
{
|
||||
FMLLog.bigWarning(String.format("Received invalid IMC '%s' from %s. Not a %s Message.", message.key, message.getSender(), type));
|
||||
private static void logInvalidMessage(FMLInterModComms.IMCMessage message, String type) {
|
||||
FMLLog.bigWarning(String.format(
|
||||
"Received invalid IMC '%s' from %s. Not a %s Message.", message.key, message.getSender(), type));
|
||||
}
|
||||
|
||||
private static ToolMaterial scanMaterial(NBTTagCompound tag)
|
||||
{
|
||||
if(!tag.hasKey("Name")) {
|
||||
private static ToolMaterial scanMaterial(NBTTagCompound tag) {
|
||||
if (!tag.hasKey("Name")) {
|
||||
FMLLog.bigWarning("Material IMC: Material has no name");
|
||||
return null;
|
||||
}
|
||||
String name = tag.getString("Name");
|
||||
|
||||
if(!tag.hasKey("Id")) {
|
||||
if (!tag.hasKey("Id")) {
|
||||
FMLLog.bigWarning("Material IMC: Materials need a unique id. " + name);
|
||||
return null;
|
||||
}
|
||||
else if(!tag.hasKey("Durability")) {
|
||||
} else if (!tag.hasKey("Durability")) {
|
||||
FMLLog.bigWarning("Material IMC: Materials need a durability. " + name);
|
||||
return null;
|
||||
}
|
||||
else if(!tag.hasKey("MiningSpeed")) {
|
||||
} else if (!tag.hasKey("MiningSpeed")) {
|
||||
FMLLog.bigWarning("Material IMC: Materials need a mining speed. " + name);
|
||||
return null;
|
||||
}
|
||||
else if(tag.hasKey("Stonebound") && tag.hasKey("Jagged")) {
|
||||
} else if (tag.hasKey("Stonebound") && tag.hasKey("Jagged")) {
|
||||
FMLLog.bigWarning("Material IMC: Materials can only be Stonebound or Jagged. " + name);
|
||||
return null;
|
||||
}
|
||||
@@ -390,23 +359,30 @@ public final class IMCHandler {
|
||||
String style = tag.getString("Style");
|
||||
int color = tag.getInteger("Color");
|
||||
|
||||
if(tag.hasKey("Jagged"))
|
||||
shoddy = -tag.getFloat("Jagged");
|
||||
if (tag.hasKey("Jagged")) shoddy = -tag.getFloat("Jagged");
|
||||
|
||||
if(tag.hasKey("localizationString"))
|
||||
return new ToolMaterial(name, tag.getString("localizationString"), hlvl, durability, speed, attack, handle, reinforced, shoddy, style, color);
|
||||
else
|
||||
return new ToolMaterial(name, hlvl, durability, speed, attack, handle, reinforced, shoddy, style, color);
|
||||
if (tag.hasKey("localizationString"))
|
||||
return new ToolMaterial(
|
||||
name,
|
||||
tag.getString("localizationString"),
|
||||
hlvl,
|
||||
durability,
|
||||
speed,
|
||||
attack,
|
||||
handle,
|
||||
reinforced,
|
||||
shoddy,
|
||||
style,
|
||||
color);
|
||||
else return new ToolMaterial(name, hlvl, durability, speed, attack, handle, reinforced, shoddy, style, color);
|
||||
}
|
||||
|
||||
// basically FMLLog.bigWarning
|
||||
public static void bigWarning(String format, Object... data)
|
||||
{
|
||||
public static void bigWarning(String format, Object... data) {
|
||||
StackTraceElement[] trace = Thread.currentThread().getStackTrace();
|
||||
TConstruct.logger.error("**********************************************************************");
|
||||
TConstruct.logger.error(String.format("* " + format, data));
|
||||
for (int i = 2; i < 8 && i < trace.length; i++)
|
||||
{
|
||||
for (int i = 2; i < 8 && i < trace.length; i++) {
|
||||
TConstruct.logger.error(String.format("* at %s%s", trace[i].toString(), i == 7 ? "..." : ""));
|
||||
}
|
||||
TConstruct.logger.error("**********************************************************************");
|
||||
|
||||
@@ -12,35 +12,32 @@ import net.minecraftforge.event.entity.living.LivingDropsEvent;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import tconstruct.TConstruct;
|
||||
|
||||
public class ItemHelper
|
||||
{
|
||||
public static Object getStaticItem (String name, String classPackage)
|
||||
{
|
||||
try
|
||||
{
|
||||
public class ItemHelper {
|
||||
public static Object getStaticItem(String name, String classPackage) {
|
||||
try {
|
||||
Class clazz = Class.forName(classPackage);
|
||||
Field field = clazz.getDeclaredField(name);
|
||||
Object ret = field.get(null);
|
||||
if (ret != null && (ret instanceof ItemStack || ret instanceof Item))
|
||||
return ret;
|
||||
if (ret != null && (ret instanceof ItemStack || ret instanceof Item)) return ret;
|
||||
return null;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
} catch (Exception e) {
|
||||
TConstruct.logger.warn("Could not find " + name + "from " + classPackage);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static void addDrops (LivingDropsEvent event, ItemStack dropStack)
|
||||
{
|
||||
EntityItem entityitem = new EntityItem(event.entityLiving.worldObj, event.entityLiving.posX, event.entityLiving.posY, event.entityLiving.posZ, dropStack);
|
||||
public static void addDrops(LivingDropsEvent event, ItemStack dropStack) {
|
||||
EntityItem entityitem = new EntityItem(
|
||||
event.entityLiving.worldObj,
|
||||
event.entityLiving.posX,
|
||||
event.entityLiving.posY,
|
||||
event.entityLiving.posZ,
|
||||
dropStack);
|
||||
entityitem.delayBeforeCanPickup = 10;
|
||||
event.drops.add(entityitem);
|
||||
}
|
||||
|
||||
public static void renderStandardInvBlock (RenderBlocks renderblocks, Block block, int meta)
|
||||
{
|
||||
public static void renderStandardInvBlock(RenderBlocks renderblocks, Block block, int meta) {
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
|
||||
tessellator.startDrawingQuads();
|
||||
@@ -49,7 +46,8 @@ public class ItemHelper
|
||||
tessellator.draw();
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(0.0F, 1.0F, 0.0F);
|
||||
renderblocks.renderFaceYPos(block, 0.0D, 0.0D, 0.0D, ItemHelper.getIconSafe(block.getIcon(1, meta)));// block.getIcon(1, meta));
|
||||
renderblocks.renderFaceYPos(
|
||||
block, 0.0D, 0.0D, 0.0D, ItemHelper.getIconSafe(block.getIcon(1, meta))); // block.getIcon(1, meta));
|
||||
tessellator.draw();
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(0.0F, 0.0F, -1F);
|
||||
@@ -70,8 +68,7 @@ public class ItemHelper
|
||||
GL11.glTranslatef(0.5F, 0.5F, 0.5F);
|
||||
}
|
||||
|
||||
public static void renderInvBlockFace (RenderBlocks renderblocks, Block block, int meta)
|
||||
{
|
||||
public static void renderInvBlockFace(RenderBlocks renderblocks, Block block, int meta) {
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
GL11.glScalef(2f, 2f, 2f);
|
||||
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
|
||||
@@ -104,10 +101,9 @@ public class ItemHelper
|
||||
GL11.glTranslatef(0.5F, 0.5F, 0.5F);
|
||||
}
|
||||
|
||||
public static IIcon getIconSafe (IIcon icon)
|
||||
{
|
||||
if (icon != null)
|
||||
return icon;
|
||||
return ((TextureMap) Minecraft.getMinecraft().getTextureManager().getTexture(TextureMap.locationBlocksTexture)).getAtlasSprite("missingno");
|
||||
public static IIcon getIconSafe(IIcon icon) {
|
||||
if (icon != null) return icon;
|
||||
return ((TextureMap) Minecraft.getMinecraft().getTextureManager().getTexture(TextureMap.locationBlocksTexture))
|
||||
.getAtlasSprite("missingno");
|
||||
}
|
||||
}
|
||||
@@ -10,9 +10,11 @@ public final class Reference {
|
||||
|
||||
public static final String RESOURCE = "tinker";
|
||||
|
||||
public static String resource(String res)
|
||||
{
|
||||
public static String resource(String res) {
|
||||
return String.format("%s:%s", RESOURCE, res);
|
||||
}
|
||||
public static String prefix(String name) { return String.format("tconstruct.%s", name);}
|
||||
|
||||
public static String prefix(String name) {
|
||||
return String.format("tconstruct.%s", name);
|
||||
}
|
||||
}
|
||||
@@ -6,98 +6,76 @@ import java.util.ArrayList;
|
||||
import net.minecraftforge.common.config.Configuration;
|
||||
import tconstruct.TConstruct;
|
||||
|
||||
public class DimensionBlacklist
|
||||
{
|
||||
public class DimensionBlacklist {
|
||||
public static ArrayList<Integer> blacklistedDims = new ArrayList<Integer>();
|
||||
public static ArrayList<Integer> noPoolDims = new ArrayList<Integer>();
|
||||
|
||||
public static int promisedLandDimensionID = -100;
|
||||
public static int twilightForestDimensionID = -100;
|
||||
|
||||
public static void getBadBimensions ()
|
||||
{
|
||||
public static void getBadBimensions() {
|
||||
updateModDimIDs();
|
||||
|
||||
blacklistedDims.add(1);
|
||||
if (twilightForestDimensionID != -100)
|
||||
{
|
||||
if (twilightForestDimensionID != -100) {
|
||||
blacklistedDims.add(twilightForestDimensionID);
|
||||
}
|
||||
if (PHConstruct.cfgDimBlackList.length > 0)
|
||||
{
|
||||
for (int numdim = 0; numdim < PHConstruct.cfgDimBlackList.length; numdim++)
|
||||
{
|
||||
if (PHConstruct.cfgDimBlackList.length > 0) {
|
||||
for (int numdim = 0; numdim < PHConstruct.cfgDimBlackList.length; numdim++) {
|
||||
blacklistedDims.add(PHConstruct.cfgDimBlackList[numdim]);
|
||||
}
|
||||
}
|
||||
if (promisedLandDimensionID != -100)
|
||||
{
|
||||
if (promisedLandDimensionID != -100) {
|
||||
noPoolDims.add(promisedLandDimensionID);
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isDimInBlacklist (int dim)
|
||||
{
|
||||
if (dim < 0)
|
||||
return false;
|
||||
if (dim == 0)
|
||||
return PHConstruct.slimeIslGenDim0;
|
||||
if (PHConstruct.slimeIslGenDim0Only)
|
||||
{
|
||||
public static boolean isDimInBlacklist(int dim) {
|
||||
if (dim < 0) return false;
|
||||
if (dim == 0) return PHConstruct.slimeIslGenDim0;
|
||||
if (PHConstruct.slimeIslGenDim0Only) {
|
||||
return false;
|
||||
}
|
||||
for (int len = 0; len < blacklistedDims.size(); len++)
|
||||
{
|
||||
if (blacklistedDims.get(len) == dim)
|
||||
return false;
|
||||
for (int len = 0; len < blacklistedDims.size(); len++) {
|
||||
if (blacklistedDims.get(len) == dim) return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
public static boolean isDimNoPool (int dim)
|
||||
{
|
||||
public static boolean isDimNoPool(int dim) {
|
||||
return noPoolDims.contains(dim);
|
||||
}
|
||||
|
||||
private static void updateModDimIDs ()
|
||||
{
|
||||
private static void updateModDimIDs() {
|
||||
updateTwiForestID();
|
||||
updateBoPID();
|
||||
}
|
||||
|
||||
private static void updateTwiForestID ()
|
||||
{
|
||||
private static void updateTwiForestID() {
|
||||
String location = Loader.instance().getConfigDir().getPath();
|
||||
File newFile = new File(location + File.separator + "TwilightForest.cfg");
|
||||
if (newFile.exists())
|
||||
{
|
||||
if (newFile.exists()) {
|
||||
Configuration config = new Configuration(newFile);
|
||||
|
||||
config.load();
|
||||
|
||||
twilightForestDimensionID = config.get("dimension", "dimensionID", -100).getInt();
|
||||
twilightForestDimensionID =
|
||||
config.get("dimension", "dimensionID", -100).getInt();
|
||||
TConstruct.logger.trace("Twilight Forest Dim ID: " + twilightForestDimensionID);
|
||||
}
|
||||
else
|
||||
twilightForestDimensionID = -100;
|
||||
} else twilightForestDimensionID = -100;
|
||||
}
|
||||
|
||||
private static void updateBoPID ()
|
||||
{
|
||||
private static void updateBoPID() {
|
||||
String location = Loader.instance().getConfigDir().getPath();
|
||||
File newFile = new File(location + File.separator + "biomesoplenty" + File.separator + "ids.cfg");
|
||||
if (newFile.exists())
|
||||
{
|
||||
if (newFile.exists()) {
|
||||
Configuration config = new Configuration(newFile);
|
||||
|
||||
config.load();
|
||||
|
||||
promisedLandDimensionID = config.get("dimension settings", "Promised Land Dimension ID", -200).getInt();
|
||||
promisedLandDimensionID = config.get("dimension settings", "Promised Land Dimension ID", -200)
|
||||
.getInt();
|
||||
TConstruct.logger.trace("Promised Lands Dim ID: " + promisedLandDimensionID);
|
||||
}
|
||||
else
|
||||
promisedLandDimensionID = -100;
|
||||
} else promisedLandDimensionID = -100;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,21 +1,17 @@
|
||||
package tconstruct.util.config;
|
||||
|
||||
import com.google.common.collect.Sets;
|
||||
import java.io.File;
|
||||
import java.util.Set;
|
||||
import net.minecraftforge.common.config.ConfigCategory;
|
||||
import net.minecraftforge.common.config.Configuration;
|
||||
import net.minecraftforge.common.config.Property;
|
||||
import tconstruct.TConstruct;
|
||||
import tconstruct.library.tools.AbilityHelper;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Set;
|
||||
public class PHConstruct {
|
||||
|
||||
public class PHConstruct
|
||||
{
|
||||
|
||||
|
||||
public static void initProps (File location)
|
||||
{
|
||||
public static void initProps(File location) {
|
||||
|
||||
/* Here we will set up the config file for the mod
|
||||
* First: Create a folder inside the config folder
|
||||
@@ -25,120 +21,192 @@ public class PHConstruct
|
||||
File mainFile = new File(location + "/TinkersConstruct.cfg");
|
||||
File legacyFile16 = new File(location + "/TinkersWorkshop.txt");
|
||||
File legacyFile17 = new File(location + "/TConstruct.cfg");
|
||||
try
|
||||
{
|
||||
if (!mainFile.exists())
|
||||
{
|
||||
if (legacyFile16.exists())
|
||||
legacyFile16.renameTo(mainFile);
|
||||
if (legacyFile17.exists())
|
||||
legacyFile17.renameTo(mainFile);
|
||||
try {
|
||||
if (!mainFile.exists()) {
|
||||
if (legacyFile16.exists()) legacyFile16.renameTo(mainFile);
|
||||
if (legacyFile17.exists()) legacyFile17.renameTo(mainFile);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
} catch (Exception e) {
|
||||
TConstruct.logger.warn("Could not update legacy configuration file for TConstruct. Reason:");
|
||||
TConstruct.logger.warn(e.getLocalizedMessage());
|
||||
}
|
||||
|
||||
Configuration config = new Configuration(mainFile);
|
||||
//config.load(); /* Load happens in the constructor */
|
||||
// config.load(); /* Load happens in the constructor */
|
||||
|
||||
superfunWorld = config.get("Superfun", "All the world is Superfun", false).getBoolean(false);
|
||||
superfunWorld =
|
||||
config.get("Superfun", "All the world is Superfun", false).getBoolean(false);
|
||||
|
||||
keepHunger = config.get("Difficulty Changes", "Keep hunger on death", true).getBoolean(true);
|
||||
keepLevels = config.get("Difficulty Changes", "Keep levels on death", true).getBoolean(true);
|
||||
beginnerBook = config.get("Difficulty Changes", "Spawn beginner book", true).getBoolean(true);
|
||||
deathPenality = config.get("Difficulty Changes", "Tools lose 10% durability on death", true).getBoolean(true);
|
||||
balancedFluxModifier = config.get("Difficulty Changes", "Balanced Flux Modifier", true).getBoolean(true);
|
||||
keepHunger =
|
||||
config.get("Difficulty Changes", "Keep hunger on death", true).getBoolean(true);
|
||||
keepLevels =
|
||||
config.get("Difficulty Changes", "Keep levels on death", true).getBoolean(true);
|
||||
beginnerBook =
|
||||
config.get("Difficulty Changes", "Spawn beginner book", true).getBoolean(true);
|
||||
deathPenality = config.get("Difficulty Changes", "Tools lose 10% durability on death", true)
|
||||
.getBoolean(true);
|
||||
balancedFluxModifier =
|
||||
config.get("Difficulty Changes", "Balanced Flux Modifier", true).getBoolean(true);
|
||||
|
||||
enableTWood = config.get("Difficulty Changes", "Enable mod wooden tools", true).getBoolean(true);
|
||||
enableTStone = config.get("Difficulty Changes", "Enable mod stone tools", true).getBoolean(true);
|
||||
enableTCactus = config.get("Difficulty Changes", "Enable mod cactus tools", true).getBoolean(true);
|
||||
enableTBone = config.get("Difficulty Changes", "Enable mod bone tools", true).getBoolean(true);
|
||||
enableTFlint = config.get("Difficulty Changes", "Enable mod flint tools", true).getBoolean(true);
|
||||
enableTNetherrack = config.get("Difficulty Changes", "Enable mod netherrack tools", true).getBoolean(true);
|
||||
enableTSlime = config.get("Difficulty Changes", "Enable mod slime tools", true).getBoolean(true);
|
||||
enableTPaper = config.get("Difficulty Changes", "Enable mod paper tools", true).getBoolean(true);
|
||||
enableTBlueSlime = config.get("Difficulty Changes", "Enable mod blue slime tools", true).getBoolean(true);
|
||||
enableTWood = config.get("Difficulty Changes", "Enable mod wooden tools", true)
|
||||
.getBoolean(true);
|
||||
enableTStone =
|
||||
config.get("Difficulty Changes", "Enable mod stone tools", true).getBoolean(true);
|
||||
enableTCactus = config.get("Difficulty Changes", "Enable mod cactus tools", true)
|
||||
.getBoolean(true);
|
||||
enableTBone =
|
||||
config.get("Difficulty Changes", "Enable mod bone tools", true).getBoolean(true);
|
||||
enableTFlint =
|
||||
config.get("Difficulty Changes", "Enable mod flint tools", true).getBoolean(true);
|
||||
enableTNetherrack = config.get("Difficulty Changes", "Enable mod netherrack tools", true)
|
||||
.getBoolean(true);
|
||||
enableTSlime =
|
||||
config.get("Difficulty Changes", "Enable mod slime tools", true).getBoolean(true);
|
||||
enableTPaper =
|
||||
config.get("Difficulty Changes", "Enable mod paper tools", true).getBoolean(true);
|
||||
enableTBlueSlime = config.get("Difficulty Changes", "Enable mod blue slime tools", true)
|
||||
.getBoolean(true);
|
||||
|
||||
craftMetalTools = config.get("Difficulty Changes", "Craft metals with Wood Patterns", false).getBoolean(false);
|
||||
vanillaMetalBlocks = config.get("Difficulty Changes", "Craft vanilla metal blocks", true).getBoolean(true);
|
||||
lavaFortuneInteraction = config.get("Difficulty Changes", "Enable Auto-Smelt and Fortune interaction", true).getBoolean(true);
|
||||
removeGoldCastRecipes = config.get("Difficulty Changes", "Remove Gold Cast Recipes", true).getBoolean(true);
|
||||
removeVanillaToolRecipes = config.get("Difficulty Changes", "Remove Vanilla Tool Recipes", false).getBoolean(false);
|
||||
labotimizeVanillaTools = config.get("Difficulty Changes", "Remove Vanilla Tool Effectiveness", false).getBoolean(false);
|
||||
miningLevelIncrease = config.get("Difficulty Changes", "Modifiers increase Mining Level", true).getBoolean(true);
|
||||
denyMattock = config.get("Difficulty Changes", "Deny creation of non-metal mattocks", false).getBoolean(false);
|
||||
craftEndstone = config.get("Difficulty Changes", "Allow creation of endstone", true).getBoolean(true);
|
||||
alternativeBoltRecipe = config.get("Difficulty Changes", "Add alternative recipe for bolt parts: arrowhead + toolrod in a crafting grid", false).getBoolean(false);
|
||||
craftMetalTools = config.get("Difficulty Changes", "Craft metals with Wood Patterns", false)
|
||||
.getBoolean(false);
|
||||
vanillaMetalBlocks = config.get("Difficulty Changes", "Craft vanilla metal blocks", true)
|
||||
.getBoolean(true);
|
||||
lavaFortuneInteraction = config.get("Difficulty Changes", "Enable Auto-Smelt and Fortune interaction", true)
|
||||
.getBoolean(true);
|
||||
removeGoldCastRecipes = config.get("Difficulty Changes", "Remove Gold Cast Recipes", true)
|
||||
.getBoolean(true);
|
||||
removeVanillaToolRecipes = config.get("Difficulty Changes", "Remove Vanilla Tool Recipes", false)
|
||||
.getBoolean(false);
|
||||
labotimizeVanillaTools = config.get("Difficulty Changes", "Remove Vanilla Tool Effectiveness", false)
|
||||
.getBoolean(false);
|
||||
miningLevelIncrease = config.get("Difficulty Changes", "Modifiers increase Mining Level", true)
|
||||
.getBoolean(true);
|
||||
denyMattock = config.get("Difficulty Changes", "Deny creation of non-metal mattocks", false)
|
||||
.getBoolean(false);
|
||||
craftEndstone = config.get("Difficulty Changes", "Allow creation of endstone", true)
|
||||
.getBoolean(true);
|
||||
alternativeBoltRecipe = config.get(
|
||||
"Difficulty Changes",
|
||||
"Add alternative recipe for bolt parts: arrowhead + toolrod in a crafting grid",
|
||||
false)
|
||||
.getBoolean(false);
|
||||
|
||||
naturalSlimeSpawn = config.get("Mobs", "Blue Slime spawn chance", 1, "Set to 0 to disable").getInt(1);
|
||||
naturalSlimeSpawn = config.get("Mobs", "Blue Slime spawn chance", 1, "Set to 0 to disable")
|
||||
.getInt(1);
|
||||
|
||||
ingotsPerOre = config.get("Smeltery Output Modification", "Ingots per ore", 2, "Number of ingots returned from smelting ores in the smeltery").getDouble(2);
|
||||
ingotsBronzeAlloy = config.get("Smeltery Output Modification", "Bronze ingot return", 4, "Number of ingots returned from smelting Bronze in the smeltery").getDouble(4);
|
||||
ingotsAluminumBrassAlloy = config.get("Smeltery Output Modification", "Aluminum Brass ingot return", 4, "Number of ingots returned from smelting Aluminum Brass in the smeltery").getDouble(4);
|
||||
ingotsAlumiteAlloy = config.get("Smeltery Output Modification", "Alumite ingot return", 3, "Number of ingots returned from smelting Alumite in the smeltery").getDouble(3);
|
||||
ingotsManyullynAlloy = config.get("Smeltery Output Modification", "Manyullyn ingot return", 1, "Number of ingots returned from smelting Manyullyn in the smeltery").getDouble(1);
|
||||
ingotsPigironAlloy = config.get("Smeltery Output Modification", "Pig Iron ingot return", 1, "Number of ingots returned from smelting Pig Iron in the smeltery").getDouble(1);
|
||||
ingotsPerOre = config.get(
|
||||
"Smeltery Output Modification",
|
||||
"Ingots per ore",
|
||||
2,
|
||||
"Number of ingots returned from smelting ores in the smeltery")
|
||||
.getDouble(2);
|
||||
ingotsBronzeAlloy = config.get(
|
||||
"Smeltery Output Modification",
|
||||
"Bronze ingot return",
|
||||
4,
|
||||
"Number of ingots returned from smelting Bronze in the smeltery")
|
||||
.getDouble(4);
|
||||
ingotsAluminumBrassAlloy = config.get(
|
||||
"Smeltery Output Modification",
|
||||
"Aluminum Brass ingot return",
|
||||
4,
|
||||
"Number of ingots returned from smelting Aluminum Brass in the smeltery")
|
||||
.getDouble(4);
|
||||
ingotsAlumiteAlloy = config.get(
|
||||
"Smeltery Output Modification",
|
||||
"Alumite ingot return",
|
||||
3,
|
||||
"Number of ingots returned from smelting Alumite in the smeltery")
|
||||
.getDouble(3);
|
||||
ingotsManyullynAlloy = config.get(
|
||||
"Smeltery Output Modification",
|
||||
"Manyullyn ingot return",
|
||||
1,
|
||||
"Number of ingots returned from smelting Manyullyn in the smeltery")
|
||||
.getDouble(1);
|
||||
ingotsPigironAlloy = config.get(
|
||||
"Smeltery Output Modification",
|
||||
"Pig Iron ingot return",
|
||||
1,
|
||||
"Number of ingots returned from smelting Pig Iron in the smeltery")
|
||||
.getDouble(1);
|
||||
|
||||
capesEnabled = config.get("Superfun", "Enable-TCon-Capes", true).getBoolean(true);
|
||||
|
||||
achievementsEnabled = config.get("Achievements", "Enable Achievements", true).getBoolean(true);
|
||||
achievementsEnabled =
|
||||
config.get("Achievements", "Enable Achievements", true).getBoolean(true);
|
||||
|
||||
boolean ic2 = true;
|
||||
boolean xycraft = true;
|
||||
try {
|
||||
Class c = Class.forName("ic2.core.IC2");
|
||||
ic2 = false;
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
catch (Exception ignored) {}
|
||||
|
||||
|
||||
try {
|
||||
Class c = Class.forName("soaryn.xycraft.core.XyCraft");
|
||||
xycraft = false;
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
catch (Exception ignored) {}
|
||||
|
||||
generateCopper = config.get("Worldgen Disabler", "Generate Copper", ic2).getBoolean(ic2);
|
||||
generateTin = config.get("Worldgen Disabler", "Generate Tin", ic2).getBoolean(ic2);
|
||||
generateAluminum = config.get("Worldgen Disabler", "Generate Aluminum", xycraft).getBoolean(xycraft);
|
||||
if(config.hasKey("worldgen disabler", "Generate Cobalt and Ardite")) {
|
||||
generateNetherOres = config.get("Worldgen Disabler", "Generate Cobalt and Ardite", true).getBoolean(true);
|
||||
generateAluminum =
|
||||
config.get("Worldgen Disabler", "Generate Aluminum", xycraft).getBoolean(xycraft);
|
||||
if (config.hasKey("worldgen disabler", "Generate Cobalt and Ardite")) {
|
||||
generateNetherOres = config.get("Worldgen Disabler", "Generate Cobalt and Ardite", true)
|
||||
.getBoolean(true);
|
||||
generateCobalt = generateArdite = generateNetherOres;
|
||||
ConfigCategory cat = config.getCategory("worldgen disabler");
|
||||
cat.remove("Generate Cobalt and Ardite");
|
||||
}
|
||||
else {
|
||||
generateCobalt = config.get("Worldgen Disabler", "Generate Cobalt", true).getBoolean(true);
|
||||
generateArdite = config.get("Worldgen Disabler", "Generate Ardite", true).getBoolean(true);
|
||||
} else {
|
||||
generateCobalt =
|
||||
config.get("Worldgen Disabler", "Generate Cobalt", true).getBoolean(true);
|
||||
generateArdite =
|
||||
config.get("Worldgen Disabler", "Generate Ardite", true).getBoolean(true);
|
||||
}
|
||||
|
||||
generateIronSurface = config.get("Worldgen Disabler", "Generate Surface Iron", true).getBoolean(true);
|
||||
generateGoldSurface = config.get("Worldgen Disabler", "Generate Surface Gold", true).getBoolean(true);
|
||||
generateCopperSurface = config.get("Worldgen Disabler", "Generate Surface Copper", true).getBoolean(true);
|
||||
generateTinSurface = config.get("Worldgen Disabler", "Generate Surface Tin", true).getBoolean(true);
|
||||
generateAluminumSurface = config.get("Worldgen Disabler", "Generate Surface Aluminum", true).getBoolean(true);
|
||||
generateIronSurface =
|
||||
config.get("Worldgen Disabler", "Generate Surface Iron", true).getBoolean(true);
|
||||
generateGoldSurface =
|
||||
config.get("Worldgen Disabler", "Generate Surface Gold", true).getBoolean(true);
|
||||
generateCopperSurface =
|
||||
config.get("Worldgen Disabler", "Generate Surface Copper", true).getBoolean(true);
|
||||
generateTinSurface =
|
||||
config.get("Worldgen Disabler", "Generate Surface Tin", true).getBoolean(true);
|
||||
generateAluminumSurface = config.get("Worldgen Disabler", "Generate Surface Aluminum", true)
|
||||
.getBoolean(true);
|
||||
|
||||
generateIronBush = config.get("Worldgen Disabler", "Generate Iron Bushes", true).getBoolean(true);
|
||||
generateGoldBush = config.get("Worldgen Disabler", "Generate Gold Bushes", true).getBoolean(true);
|
||||
generateCopperBush = config.get("Worldgen Disabler", "Generate Copper Bushes", true).getBoolean(true);
|
||||
generateTinBush = config.get("Worldgen Disabler", "Generate Tin Bushes", true).getBoolean(true);
|
||||
generateAluminumBush = config.get("Worldgen Disabler", "Generate Aluminum Bushes", true).getBoolean(true);
|
||||
generateEssenceBush = config.get("Worldgen Disabler", "Generate Essence Bushes", true).getBoolean(true);
|
||||
addToVillages = config.get("Worldgen Disabler", "Add Village Generation", true).getBoolean(true);
|
||||
allowVillagerTrading = config.get("Worldgen Disabler", "Enable the Tinkers Villager to trade for oreberries", true).getBoolean(true);
|
||||
generateIronBush =
|
||||
config.get("Worldgen Disabler", "Generate Iron Bushes", true).getBoolean(true);
|
||||
generateGoldBush =
|
||||
config.get("Worldgen Disabler", "Generate Gold Bushes", true).getBoolean(true);
|
||||
generateCopperBush =
|
||||
config.get("Worldgen Disabler", "Generate Copper Bushes", true).getBoolean(true);
|
||||
generateTinBush =
|
||||
config.get("Worldgen Disabler", "Generate Tin Bushes", true).getBoolean(true);
|
||||
generateAluminumBush = config.get("Worldgen Disabler", "Generate Aluminum Bushes", true)
|
||||
.getBoolean(true);
|
||||
generateEssenceBush =
|
||||
config.get("Worldgen Disabler", "Generate Essence Bushes", true).getBoolean(true);
|
||||
addToVillages =
|
||||
config.get("Worldgen Disabler", "Add Village Generation", true).getBoolean(true);
|
||||
allowVillagerTrading = config.get(
|
||||
"Worldgen Disabler", "Enable the Tinkers Villager to trade for oreberries", true)
|
||||
.getBoolean(true);
|
||||
|
||||
copperuDensity = config.get("Worldgen", "Copper Underground Density", 2, "Density: Chances per chunk").getInt(2);
|
||||
copperuDensity = config.get("Worldgen", "Copper Underground Density", 2, "Density: Chances per chunk")
|
||||
.getInt(2);
|
||||
tinuDensity = config.get("Worldgen", "Tin Underground Density", 2).getInt(2);
|
||||
aluminumuDensity = config.get("Worldgen", "Aluminum Underground Density", 3).getInt(3);
|
||||
if(config.hasKey("worldgen", "Nether Ores Density")) {
|
||||
aluminumuDensity =
|
||||
config.get("Worldgen", "Aluminum Underground Density", 3).getInt(3);
|
||||
if (config.hasKey("worldgen", "Nether Ores Density")) {
|
||||
netherDensity = config.get("Worldgen", "Nether Ores Density", 8).getInt(8);
|
||||
cobaltDensity = arditeDensity = netherDensity;
|
||||
ConfigCategory cat = config.getCategory("worldgen");
|
||||
cat.remove("Nether Ores Density");
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
cobaltDensity = config.get("worldgen", "Cobalt Ore Density", 8).getInt(8);
|
||||
arditeDensity = config.get("worldgen", "Ardite Ore Density", 8).getInt(8);
|
||||
}
|
||||
@@ -152,7 +220,8 @@ public class PHConstruct
|
||||
|
||||
ironsRarity = config.get("Worldgen", "Iron Surface Rarity", 400).getInt(400);
|
||||
goldsRarity = config.get("Worldgen", "Gold Surface Rarity", 900).getInt(900);
|
||||
coppersRarity = config.get("Worldgen", "Copper Surface Rarity", 100, "Rarity: 1/num to generate in chunk").getInt(100);
|
||||
coppersRarity = config.get("Worldgen", "Copper Surface Rarity", 100, "Rarity: 1/num to generate in chunk")
|
||||
.getInt(100);
|
||||
tinsRarity = config.get("Worldgen", "Tin Surface Rarity", 100).getInt(100);
|
||||
aluminumsRarity = config.get("Worldgen", "Aluminum Surface Rarity", 50).getInt(50);
|
||||
cobaltsRarity = config.get("Worldgen", "Cobalt Surface Rarity", 2000).getInt(2000);
|
||||
@@ -179,16 +248,38 @@ public class PHConstruct
|
||||
aluminumBushMaxY = config.get("Worldgen", "Aluminum Bush Max Y", 60).getInt(60);
|
||||
|
||||
seaLevel = config.get("general", "Sea level", 64).getInt(64);
|
||||
tconComesFirst = config.get("general", "Always cast TConstruct ingots", true, "You will always get a TConstruct item from casting an ingot or block.").getBoolean();
|
||||
tconComesFirst = config.get(
|
||||
"general",
|
||||
"Always cast TConstruct ingots",
|
||||
true,
|
||||
"You will always get a TConstruct item from casting an ingot or block.")
|
||||
.getBoolean();
|
||||
|
||||
enableHealthRegen = config.get("Ultra Hardcore Changes", "Passive Health Regen", true).getBoolean(true);
|
||||
goldAppleRecipe = config.get("Ultra Hardcore Changes", "Change Crafting Recipes", false, "Makes recipes for gold apples, carrots, and melon potions more expensive").getBoolean(false);
|
||||
dropPlayerHeads = config.get("Ultra Hardcore Changes", "Players drop heads on death", false).getBoolean(false);
|
||||
uhcGhastDrops = config.get("Ultra Hardcore Changes", "Change Ghast drops to Gold Ingots", false).getBoolean(false);
|
||||
worldBorder = config.get("Ultra Hardcore Changes", "Add World Border", false).getBoolean(false);
|
||||
worldBorderSize = config.get("Ultra Hardcore Changes", "World Border Radius", 1000).getInt(1000);
|
||||
freePatterns = config.get("Ultra Hardcore Changes", "Add Patterns to Pattern Chests", false, "Gives all tier 1 patterns when pattern chest is placed").getBoolean(false);
|
||||
AbilityHelper.necroticUHS = config.get("Ultra Hardcore Changes", "Necrotic modifier only heals on hostile mob kills", false).getBoolean(false);
|
||||
enableHealthRegen = config.get("Ultra Hardcore Changes", "Passive Health Regen", true)
|
||||
.getBoolean(true);
|
||||
goldAppleRecipe = config.get(
|
||||
"Ultra Hardcore Changes",
|
||||
"Change Crafting Recipes",
|
||||
false,
|
||||
"Makes recipes for gold apples, carrots, and melon potions more expensive")
|
||||
.getBoolean(false);
|
||||
dropPlayerHeads = config.get("Ultra Hardcore Changes", "Players drop heads on death", false)
|
||||
.getBoolean(false);
|
||||
uhcGhastDrops = config.get("Ultra Hardcore Changes", "Change Ghast drops to Gold Ingots", false)
|
||||
.getBoolean(false);
|
||||
worldBorder =
|
||||
config.get("Ultra Hardcore Changes", "Add World Border", false).getBoolean(false);
|
||||
worldBorderSize = config.get("Ultra Hardcore Changes", "World Border Radius", 1000)
|
||||
.getInt(1000);
|
||||
freePatterns = config.get(
|
||||
"Ultra Hardcore Changes",
|
||||
"Add Patterns to Pattern Chests",
|
||||
false,
|
||||
"Gives all tier 1 patterns when pattern chest is placed")
|
||||
.getBoolean(false);
|
||||
AbilityHelper.necroticUHS = config.get(
|
||||
"Ultra Hardcore Changes", "Necrotic modifier only heals on hostile mob kills", false)
|
||||
.getBoolean(false);
|
||||
|
||||
// Slime pools
|
||||
islandRarity = config.get("Worldgen", "Slime Island Rarity", 1450).getInt(1450);
|
||||
@@ -199,40 +290,75 @@ public class PHConstruct
|
||||
connectedTexturesMode = conTexMode.getInt(2);
|
||||
|
||||
// dimension blacklist
|
||||
cfgForbiddenDim = config.get("DimBlackList", "ForbiddenDim", new int[] {}, "Disallow Traveller's Belt ability to swap inventories for certain dimension ID's").getIntList();
|
||||
cfgDimBlackList = config.get("DimBlackList", "SlimeIslandDimBlacklist", new int[] {}, "Add dimension ID's to prevent slime islands from generating in them").getIntList();
|
||||
slimeIslGenDim0Only = config.get("DimBlackList", "GenerateSlimeIslandInDim0Only", false, "True: slime islands wont generate in any ages other than overworld(if enabled); False: will generate in all non-blackisted ages").getBoolean(false);
|
||||
slimeIslGenDim0 = config.get("DimBlackList", "slimeIslGenDim0", true, "True: slime islands generate in overworld; False they do not generate").getBoolean(true);
|
||||
genIslandsFlat = config.get("DimBlacklist", "genIslandsFlat", false, "Generate slime islands in flat worlds").getBoolean(false);
|
||||
genOresFlat = config.get("DimBlacklist", "genOresFlat", false, "Generate ores in flat worlds").getBoolean(false);
|
||||
cfgForbiddenDim = config.get(
|
||||
"DimBlackList",
|
||||
"ForbiddenDim",
|
||||
new int[] {},
|
||||
"Disallow Traveller's Belt ability to swap inventories for certain dimension ID's")
|
||||
.getIntList();
|
||||
cfgDimBlackList = config.get(
|
||||
"DimBlackList",
|
||||
"SlimeIslandDimBlacklist",
|
||||
new int[] {},
|
||||
"Add dimension ID's to prevent slime islands from generating in them")
|
||||
.getIntList();
|
||||
slimeIslGenDim0Only = config.get(
|
||||
"DimBlackList",
|
||||
"GenerateSlimeIslandInDim0Only",
|
||||
false,
|
||||
"True: slime islands wont generate in any ages other than overworld(if enabled); False: will generate in all non-blackisted ages")
|
||||
.getBoolean(false);
|
||||
slimeIslGenDim0 = config.get(
|
||||
"DimBlackList",
|
||||
"slimeIslGenDim0",
|
||||
true,
|
||||
"True: slime islands generate in overworld; False they do not generate")
|
||||
.getBoolean(true);
|
||||
genIslandsFlat = config.get("DimBlacklist", "genIslandsFlat", false, "Generate slime islands in flat worlds")
|
||||
.getBoolean(false);
|
||||
genOresFlat = config.get("DimBlacklist", "genOresFlat", false, "Generate ores in flat worlds")
|
||||
.getBoolean(false);
|
||||
|
||||
// Experimental functionality
|
||||
throwableSmeltery = config.get("Experimental", "Items can be thrown into smelteries", true).getBoolean(true);
|
||||
meltableHorses = config.get("Experimental", "Allow horses to be melted down for glue", true).getBoolean(true);
|
||||
meltableVillagers = config.get("Experimental", "Allow villagers to be melted down for emeralds", true).getBoolean(true);
|
||||
throwableSmeltery = config.get("Experimental", "Items can be thrown into smelteries", true)
|
||||
.getBoolean(true);
|
||||
meltableHorses = config.get("Experimental", "Allow horses to be melted down for glue", true)
|
||||
.getBoolean(true);
|
||||
meltableVillagers = config.get("Experimental", "Allow villagers to be melted down for emeralds", true)
|
||||
.getBoolean(true);
|
||||
minimalTextures = config.get("Experimental", "Minimal Textures", false).getBoolean(false);
|
||||
extraBlockUpdates = config.get("Experimental", "Send additional block updates when using AOE tools", true,"This fixes very fast tools sometimes resulting in ghost blocks, but causes a bit more network traffic. Should be fine in theory.").getBoolean(true);
|
||||
heartDropBlacklist = config.get("Experimental", "YellowHeartDropBlacklist", new String[] {"entitynpc", "entitycustomnpc"}, "Entity classes listed here will not drop yellow hearts. The values are the actual class names in lowercase.").getStringList();
|
||||
extraBlockUpdates = config.get(
|
||||
"Experimental",
|
||||
"Send additional block updates when using AOE tools",
|
||||
true,
|
||||
"This fixes very fast tools sometimes resulting in ghost blocks, but causes a bit more network traffic. Should be fine in theory.")
|
||||
.getBoolean(true);
|
||||
heartDropBlacklist = config.get(
|
||||
"Experimental",
|
||||
"YellowHeartDropBlacklist",
|
||||
new String[] {"entitynpc", "entitycustomnpc"},
|
||||
"Entity classes listed here will not drop yellow hearts. The values are the actual class names in lowercase.")
|
||||
.getStringList();
|
||||
|
||||
craftingStationBlacklist = Sets.newHashSet(config.get("CraftingStationBlacklist", "tileEntities", new String[] {
|
||||
"wanion.avaritiaddons.block.chest.infinity.TileEntityInfinityChest"
|
||||
}).getStringList());
|
||||
|
||||
"wanion.avaritiaddons.block.chest.infinity.TileEntityInfinityChest"
|
||||
})
|
||||
.getStringList());
|
||||
|
||||
/* Save the configuration file only if it has changed */
|
||||
if (config.hasChanged())
|
||||
config.save();
|
||||
if (config.hasChanged()) config.save();
|
||||
|
||||
File gt = new File(location + "/GregTech");
|
||||
if (gt.exists())
|
||||
{
|
||||
if (gt.exists()) {
|
||||
File gtDyn = new File(location + "/GregTech/DynamicConfig.cfg");
|
||||
Configuration gtConfig = new Configuration(gtDyn);
|
||||
gtConfig.load();
|
||||
gregtech = gtConfig.get("smelting", "tile.anvil.slightlyDamaged", false).getBoolean(false);
|
||||
gregtech = gtConfig.get("smelting", "tile.anvil.slightlyDamaged", false)
|
||||
.getBoolean(false);
|
||||
}
|
||||
}
|
||||
|
||||
//Modules
|
||||
// Modules
|
||||
public static boolean worldModule;
|
||||
public static boolean toolModule;
|
||||
public static boolean smelteryModule;
|
||||
@@ -250,8 +376,10 @@ public class PHConstruct
|
||||
public static boolean generateCopper;
|
||||
public static boolean generateTin;
|
||||
public static boolean generateAluminum;
|
||||
|
||||
@Deprecated
|
||||
public static boolean generateNetherOres;
|
||||
|
||||
public static boolean generateArdite;
|
||||
public static boolean generateCobalt;
|
||||
|
||||
@@ -275,8 +403,10 @@ public class PHConstruct
|
||||
public static int copperuDensity;
|
||||
public static int tinuDensity;
|
||||
public static int aluminumuDensity;
|
||||
|
||||
@Deprecated
|
||||
public static int netherDensity;
|
||||
|
||||
public static int cobaltDensity;
|
||||
public static int arditeDensity;
|
||||
|
||||
|
||||
@@ -10,58 +10,63 @@ import tconstruct.armor.ArmorProxyCommon;
|
||||
import tconstruct.armor.TinkerArmor;
|
||||
import tconstruct.armor.player.TPlayerStats;
|
||||
|
||||
public class AccessoryInventoryPacket extends AbstractPacket
|
||||
{
|
||||
public class AccessoryInventoryPacket extends AbstractPacket {
|
||||
|
||||
int type;
|
||||
|
||||
public AccessoryInventoryPacket()
|
||||
{
|
||||
public AccessoryInventoryPacket() {}
|
||||
|
||||
}
|
||||
|
||||
public AccessoryInventoryPacket(int type)
|
||||
{
|
||||
public AccessoryInventoryPacket(int type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void encodeInto (ChannelHandlerContext ctx, ByteBuf buffer)
|
||||
{
|
||||
public void encodeInto(ChannelHandlerContext ctx, ByteBuf buffer) {
|
||||
buffer.writeInt(type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void decodeInto (ChannelHandlerContext ctx, ByteBuf buffer)
|
||||
{
|
||||
public void decodeInto(ChannelHandlerContext ctx, ByteBuf buffer) {
|
||||
type = buffer.readInt();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleClientSide (EntityPlayer player)
|
||||
{
|
||||
|
||||
}
|
||||
public void handleClientSide(EntityPlayer player) {}
|
||||
|
||||
@Override
|
||||
public void handleServerSide (EntityPlayer player)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case ArmorProxyCommon.inventoryGui:
|
||||
player.openGui(TConstruct.instance, ArmorProxyCommon.inventoryGui, player.worldObj, (int) player.posX, (int) player.posY, (int) player.posZ);
|
||||
break;
|
||||
case ArmorProxyCommon.armorGuiID:
|
||||
player.openGui(TConstruct.instance, ArmorProxyCommon.armorGuiID, player.worldObj, (int) player.posX, (int) player.posY, (int) player.posZ);
|
||||
break;
|
||||
case ArmorProxyCommon.knapsackGuiID:
|
||||
TPlayerStats stats = TPlayerStats.get(player);
|
||||
ItemStack itemStack = stats.armor.getStackInSlot(2);
|
||||
if (itemStack != null && itemStack.getItem() == TinkerArmor.knapsack && itemStack.stackSize > 0)
|
||||
{
|
||||
player.openGui(TConstruct.instance, ArmorProxyCommon.knapsackGuiID, player.worldObj, (int) player.posX, (int) player.posY, (int) player.posZ);
|
||||
}
|
||||
break;
|
||||
public void handleServerSide(EntityPlayer player) {
|
||||
switch (type) {
|
||||
case ArmorProxyCommon.inventoryGui:
|
||||
player.openGui(
|
||||
TConstruct.instance,
|
||||
ArmorProxyCommon.inventoryGui,
|
||||
player.worldObj,
|
||||
(int) player.posX,
|
||||
(int) player.posY,
|
||||
(int) player.posZ);
|
||||
break;
|
||||
case ArmorProxyCommon.armorGuiID:
|
||||
player.openGui(
|
||||
TConstruct.instance,
|
||||
ArmorProxyCommon.armorGuiID,
|
||||
player.worldObj,
|
||||
(int) player.posX,
|
||||
(int) player.posY,
|
||||
(int) player.posZ);
|
||||
break;
|
||||
case ArmorProxyCommon.knapsackGuiID:
|
||||
TPlayerStats stats = TPlayerStats.get(player);
|
||||
ItemStack itemStack = stats.armor.getStackInSlot(2);
|
||||
if (itemStack != null && itemStack.getItem() == TinkerArmor.knapsack && itemStack.stackSize > 0) {
|
||||
player.openGui(
|
||||
TConstruct.instance,
|
||||
ArmorProxyCommon.knapsackGuiID,
|
||||
player.worldObj,
|
||||
(int) player.posX,
|
||||
(int) player.posY,
|
||||
(int) player.posZ);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,61 +1,50 @@
|
||||
package tconstruct.util.network;
|
||||
|
||||
import tconstruct.TConstruct;
|
||||
import tconstruct.armor.TinkerArmor;
|
||||
import tconstruct.armor.player.TPlayerStats;
|
||||
import cpw.mods.fml.common.network.ByteBufUtils;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
import mantle.common.network.AbstractPacket;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import tconstruct.armor.TinkerArmor;
|
||||
import tconstruct.armor.player.TPlayerStats;
|
||||
|
||||
/**
|
||||
* This Packet is for sending the players TPlayerStats from the server to the client.
|
||||
*
|
||||
*
|
||||
* @author covers1624
|
||||
*/
|
||||
|
||||
public class ArmourGuiSyncPacket extends AbstractPacket
|
||||
{
|
||||
public class ArmourGuiSyncPacket extends AbstractPacket {
|
||||
NBTTagCompound playerStats = new NBTTagCompound();
|
||||
|
||||
public ArmourGuiSyncPacket()
|
||||
{
|
||||
}
|
||||
|
||||
public ArmourGuiSyncPacket() {}
|
||||
/**
|
||||
* For sending the players TPlayerStats to the client.
|
||||
* @param tag, The players TPlayerStats written to NBT.
|
||||
*/
|
||||
public ArmourGuiSyncPacket(NBTTagCompound tag)
|
||||
{
|
||||
public ArmourGuiSyncPacket(NBTTagCompound tag) {
|
||||
playerStats = tag;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void encodeInto (ChannelHandlerContext ctx, ByteBuf buffer)
|
||||
{
|
||||
public void encodeInto(ChannelHandlerContext ctx, ByteBuf buffer) {
|
||||
ByteBufUtils.writeTag(buffer, playerStats);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void decodeInto (ChannelHandlerContext ctx, ByteBuf buffer)
|
||||
{
|
||||
public void decodeInto(ChannelHandlerContext ctx, ByteBuf buffer) {
|
||||
playerStats = ByteBufUtils.readTag(buffer);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void handleClientSide (EntityPlayer player)
|
||||
{
|
||||
public void handleClientSide(EntityPlayer player) {
|
||||
TPlayerStats stats = new TPlayerStats(player);
|
||||
stats.loadNBTData(playerStats);
|
||||
TinkerArmor.proxy.updatePlayerStats(stats);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void handleServerSide (EntityPlayer player)
|
||||
{
|
||||
//NO-OP. this is a Server -> client packet.
|
||||
public void handleServerSide(EntityPlayer player) {
|
||||
// NO-OP. this is a Server -> client packet.
|
||||
}
|
||||
|
||||
}
|
||||
@@ -7,32 +7,20 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||
import tconstruct.armor.PlayerAbilityHelper;
|
||||
import tconstruct.armor.player.TPlayerStats;
|
||||
|
||||
public class BeltPacket extends AbstractPacket
|
||||
{
|
||||
public BeltPacket()
|
||||
{
|
||||
}
|
||||
public class BeltPacket extends AbstractPacket {
|
||||
public BeltPacket() {}
|
||||
|
||||
@Override
|
||||
public void encodeInto (ChannelHandlerContext ctx, ByteBuf buffer)
|
||||
{
|
||||
}
|
||||
public void encodeInto(ChannelHandlerContext ctx, ByteBuf buffer) {}
|
||||
|
||||
@Override
|
||||
public void decodeInto (ChannelHandlerContext ctx, ByteBuf buffer)
|
||||
{
|
||||
}
|
||||
public void decodeInto(ChannelHandlerContext ctx, ByteBuf buffer) {}
|
||||
|
||||
@Override
|
||||
public void handleClientSide (EntityPlayer player)
|
||||
{
|
||||
|
||||
}
|
||||
public void handleClientSide(EntityPlayer player) {}
|
||||
|
||||
@Override
|
||||
public void handleServerSide (EntityPlayer player)
|
||||
{
|
||||
public void handleServerSide(EntityPlayer player) {
|
||||
PlayerAbilityHelper.swapBelt(player, TPlayerStats.get(player).armor);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -5,33 +5,21 @@ import io.netty.channel.ChannelHandlerContext;
|
||||
import mantle.common.network.AbstractPacket;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
public class DoubleJumpPacket extends AbstractPacket
|
||||
{
|
||||
public class DoubleJumpPacket extends AbstractPacket {
|
||||
|
||||
@Override
|
||||
public void encodeInto (ChannelHandlerContext ctx, ByteBuf buffer)
|
||||
{
|
||||
|
||||
}
|
||||
public void encodeInto(ChannelHandlerContext ctx, ByteBuf buffer) {}
|
||||
|
||||
@Override
|
||||
public void decodeInto (ChannelHandlerContext ctx, ByteBuf buffer)
|
||||
{
|
||||
|
||||
}
|
||||
public void decodeInto(ChannelHandlerContext ctx, ByteBuf buffer) {}
|
||||
|
||||
@Override
|
||||
public void handleClientSide (EntityPlayer player)
|
||||
{
|
||||
|
||||
}
|
||||
public void handleClientSide(EntityPlayer player) {}
|
||||
|
||||
@Override
|
||||
public void handleServerSide (EntityPlayer player)
|
||||
{
|
||||
public void handleServerSide(EntityPlayer player) {
|
||||
// String user = inputStream.readUTF();
|
||||
// EntityPlayer player = TConstruct.playerTracker.getEntityPlayer(user);
|
||||
player.fallDistance = 0;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -6,43 +6,32 @@ import mantle.common.network.AbstractPacket;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import tconstruct.armor.PlayerAbilityHelper;
|
||||
|
||||
public class GogglePacket extends AbstractPacket
|
||||
{
|
||||
public class GogglePacket extends AbstractPacket {
|
||||
boolean active;
|
||||
|
||||
public GogglePacket()
|
||||
{
|
||||
}
|
||||
public GogglePacket() {}
|
||||
|
||||
public GogglePacket(boolean active)
|
||||
{
|
||||
public GogglePacket(boolean active) {
|
||||
this.active = active;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void encodeInto (ChannelHandlerContext ctx, ByteBuf buffer)
|
||||
{
|
||||
public void encodeInto(ChannelHandlerContext ctx, ByteBuf buffer) {
|
||||
buffer.writeBoolean(active);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void decodeInto (ChannelHandlerContext ctx, ByteBuf buffer)
|
||||
{
|
||||
public void decodeInto(ChannelHandlerContext ctx, ByteBuf buffer) {
|
||||
active = buffer.readBoolean();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleClientSide (EntityPlayer player)
|
||||
{
|
||||
|
||||
}
|
||||
public void handleClientSide(EntityPlayer player) {}
|
||||
|
||||
@Override
|
||||
public void handleServerSide (EntityPlayer player)
|
||||
{
|
||||
public void handleServerSide(EntityPlayer player) {
|
||||
PlayerAbilityHelper.toggleGoggles(player, active);
|
||||
/*TPlayerStats stats = TPlayerStats.get(player);
|
||||
stats.activeGoggles = active;*/
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,20 +1,16 @@
|
||||
package tconstruct.util.network;
|
||||
|
||||
import cpw.mods.fml.common.network.ByteBufUtils;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
import mantle.common.network.AbstractPacket;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import tconstruct.armor.ArmorProxyClient;
|
||||
import tconstruct.armor.player.TPlayerStats;
|
||||
|
||||
public class HealthUpdatePacket extends AbstractPacket {
|
||||
private float health;
|
||||
|
||||
public HealthUpdatePacket() {
|
||||
}
|
||||
public HealthUpdatePacket() {}
|
||||
|
||||
public HealthUpdatePacket(float health) {
|
||||
this.health = health;
|
||||
@@ -38,7 +34,5 @@ public class HealthUpdatePacket extends AbstractPacket {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleServerSide(EntityPlayer player) {
|
||||
|
||||
}
|
||||
public void handleServerSide(EntityPlayer player) {}
|
||||
}
|
||||
@@ -4,7 +4,6 @@ import io.netty.buffer.ByteBuf;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
import mantle.common.network.AbstractPacket;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityList;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
public class MovementUpdatePacket extends AbstractPacket {
|
||||
@@ -15,8 +14,7 @@ public class MovementUpdatePacket extends AbstractPacket {
|
||||
public float yaw;
|
||||
public float pitch;
|
||||
|
||||
public MovementUpdatePacket() {
|
||||
}
|
||||
public MovementUpdatePacket() {}
|
||||
|
||||
public MovementUpdatePacket(Entity entity) {
|
||||
this.entityID = entity.getEntityId();
|
||||
@@ -50,7 +48,7 @@ public class MovementUpdatePacket extends AbstractPacket {
|
||||
@Override
|
||||
public void handleClientSide(EntityPlayer player) {
|
||||
Entity entity = player.worldObj.getEntityByID(entityID);
|
||||
if(entity != null) {
|
||||
if (entity != null) {
|
||||
entity.motionX = x;
|
||||
entity.motionY = y;
|
||||
entity.motionZ = z;
|
||||
|
||||
@@ -16,12 +16,11 @@ import net.minecraft.network.*;
|
||||
/**
|
||||
* Packet pipeline class. Directs all registered packet data to be handled by
|
||||
* the packets themselves.
|
||||
*
|
||||
*
|
||||
* @author sirgingalot some code from: cpw
|
||||
*/
|
||||
@ChannelHandler.Sharable
|
||||
public class PacketPipeline extends MessageToMessageCodec<FMLProxyPacket, AbstractPacket>
|
||||
{
|
||||
public class PacketPipeline extends MessageToMessageCodec<FMLProxyPacket, AbstractPacket> {
|
||||
|
||||
private EnumMap<Side, FMLEmbeddedChannel> channels;
|
||||
private LinkedList<Class<? extends AbstractPacket>> packets = new LinkedList<Class<? extends AbstractPacket>>();
|
||||
@@ -30,30 +29,26 @@ public class PacketPipeline extends MessageToMessageCodec<FMLProxyPacket, Abstra
|
||||
/**
|
||||
* Register your packet with the pipeline. Discriminators are automatically
|
||||
* set.
|
||||
*
|
||||
*
|
||||
* @param clazz
|
||||
* the class to register
|
||||
*
|
||||
*
|
||||
* @return whether registration was successful. Failure may occur if 256
|
||||
* packets have been registered or if the registry already contains
|
||||
* this packet
|
||||
*/
|
||||
public boolean registerPacket (Class<? extends AbstractPacket> clazz)
|
||||
{
|
||||
if (this.packets.size() > 256)
|
||||
{
|
||||
public boolean registerPacket(Class<? extends AbstractPacket> clazz) {
|
||||
if (this.packets.size() > 256) {
|
||||
// You should log here!!
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.packets.contains(clazz))
|
||||
{
|
||||
if (this.packets.contains(clazz)) {
|
||||
// You should log here!!
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.isPostInitialised)
|
||||
{
|
||||
if (this.isPostInitialised) {
|
||||
// You should log here!!
|
||||
return false;
|
||||
}
|
||||
@@ -64,31 +59,29 @@ public class PacketPipeline extends MessageToMessageCodec<FMLProxyPacket, Abstra
|
||||
|
||||
// In line encoding of the packet, including discriminator setting
|
||||
@Override
|
||||
protected void encode (ChannelHandlerContext ctx, AbstractPacket msg, List<Object> out) throws Exception
|
||||
{
|
||||
protected void encode(ChannelHandlerContext ctx, AbstractPacket msg, List<Object> out) throws Exception {
|
||||
ByteBuf buffer = Unpooled.buffer();
|
||||
Class<? extends AbstractPacket> clazz = msg.getClass();
|
||||
if (!this.packets.contains(msg.getClass()))
|
||||
{
|
||||
throw new NullPointerException("No Packet Registered for: " + msg.getClass().getCanonicalName());
|
||||
if (!this.packets.contains(msg.getClass())) {
|
||||
throw new NullPointerException(
|
||||
"No Packet Registered for: " + msg.getClass().getCanonicalName());
|
||||
}
|
||||
|
||||
byte discriminator = (byte) this.packets.indexOf(clazz);
|
||||
buffer.writeByte(discriminator);
|
||||
msg.encodeInto(ctx, buffer);
|
||||
FMLProxyPacket proxyPacket = new FMLProxyPacket(buffer.copy(), ctx.channel().attr(NetworkRegistry.FML_CHANNEL).get());
|
||||
FMLProxyPacket proxyPacket = new FMLProxyPacket(
|
||||
buffer.copy(), ctx.channel().attr(NetworkRegistry.FML_CHANNEL).get());
|
||||
out.add(proxyPacket);
|
||||
}
|
||||
|
||||
// In line decoding and handling of the packet
|
||||
@Override
|
||||
protected void decode (ChannelHandlerContext ctx, FMLProxyPacket msg, List<Object> out) throws Exception
|
||||
{
|
||||
protected void decode(ChannelHandlerContext ctx, FMLProxyPacket msg, List<Object> out) throws Exception {
|
||||
ByteBuf payload = msg.payload();
|
||||
byte discriminator = payload.readByte();
|
||||
Class<? extends AbstractPacket> clazz = this.packets.get(discriminator);
|
||||
if (clazz == null)
|
||||
{
|
||||
if (clazz == null) {
|
||||
throw new NullPointerException("No packet registered for discriminator: " + discriminator);
|
||||
}
|
||||
|
||||
@@ -96,32 +89,30 @@ public class PacketPipeline extends MessageToMessageCodec<FMLProxyPacket, Abstra
|
||||
pkt.decodeInto(ctx, payload.slice());
|
||||
|
||||
EntityPlayer player;
|
||||
switch (FMLCommonHandler.instance().getEffectiveSide())
|
||||
{
|
||||
case CLIENT:
|
||||
player = this.getClientPlayer();
|
||||
pkt.handleClientSide(player);
|
||||
break;
|
||||
switch (FMLCommonHandler.instance().getEffectiveSide()) {
|
||||
case CLIENT:
|
||||
player = this.getClientPlayer();
|
||||
pkt.handleClientSide(player);
|
||||
break;
|
||||
|
||||
case SERVER:
|
||||
INetHandler netHandler = ctx.channel().attr(NetworkRegistry.NET_HANDLER).get();
|
||||
player = ((NetHandlerPlayServer) netHandler).playerEntity;
|
||||
pkt.handleServerSide(player);
|
||||
break;
|
||||
case SERVER:
|
||||
INetHandler netHandler =
|
||||
ctx.channel().attr(NetworkRegistry.NET_HANDLER).get();
|
||||
player = ((NetHandlerPlayServer) netHandler).playerEntity;
|
||||
pkt.handleServerSide(player);
|
||||
break;
|
||||
|
||||
default:
|
||||
default:
|
||||
}
|
||||
}
|
||||
|
||||
// Method to call from FMLInitializationEvent
|
||||
public void initalise ()
|
||||
{
|
||||
public void initalise() {
|
||||
this.channels = NetworkRegistry.INSTANCE.newChannel("TConstruct", this);
|
||||
registerPackets();
|
||||
}
|
||||
|
||||
public void registerPackets ()
|
||||
{
|
||||
public void registerPackets() {
|
||||
registerPacket(HealthUpdatePacket.class);
|
||||
registerPacket(DoubleJumpPacket.class);
|
||||
registerPacket(AccessoryInventoryPacket.class);
|
||||
@@ -135,30 +126,25 @@ public class PacketPipeline extends MessageToMessageCodec<FMLProxyPacket, Abstra
|
||||
registerPacket(GogglePacket.class);
|
||||
|
||||
registerPacket(MovementUpdatePacket.class);
|
||||
|
||||
|
||||
registerPacket(ArmourGuiSyncPacket.class);
|
||||
}
|
||||
|
||||
// Method to call from FMLPostInitializationEvent
|
||||
// Ensures that packet discriminators are common between server and client
|
||||
// by using logical sorting
|
||||
public void postInitialise ()
|
||||
{
|
||||
if (this.isPostInitialised)
|
||||
{
|
||||
public void postInitialise() {
|
||||
if (this.isPostInitialised) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.isPostInitialised = true;
|
||||
Collections.sort(this.packets, new Comparator<Class<? extends AbstractPacket>>()
|
||||
{
|
||||
Collections.sort(this.packets, new Comparator<Class<? extends AbstractPacket>>() {
|
||||
|
||||
@Override
|
||||
public int compare (Class<? extends AbstractPacket> clazz1, Class<? extends AbstractPacket> clazz2)
|
||||
{
|
||||
public int compare(Class<? extends AbstractPacket> clazz1, Class<? extends AbstractPacket> clazz2) {
|
||||
int com = String.CASE_INSENSITIVE_ORDER.compare(clazz1.getCanonicalName(), clazz2.getCanonicalName());
|
||||
if (com == 0)
|
||||
{
|
||||
if (com == 0) {
|
||||
com = clazz1.getCanonicalName().compareTo(clazz2.getCanonicalName());
|
||||
}
|
||||
|
||||
@@ -168,8 +154,7 @@ public class PacketPipeline extends MessageToMessageCodec<FMLProxyPacket, Abstra
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private EntityPlayer getClientPlayer ()
|
||||
{
|
||||
private EntityPlayer getClientPlayer() {
|
||||
return Minecraft.getMinecraft().thePlayer;
|
||||
}
|
||||
|
||||
@@ -178,13 +163,15 @@ public class PacketPipeline extends MessageToMessageCodec<FMLProxyPacket, Abstra
|
||||
* <p/>
|
||||
* Adapted from CPW's code in
|
||||
* cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper
|
||||
*
|
||||
*
|
||||
* @param message
|
||||
* The message to send
|
||||
*/
|
||||
public void sendToAll (AbstractPacket message)
|
||||
{
|
||||
this.channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.ALL);
|
||||
public void sendToAll(AbstractPacket message) {
|
||||
this.channels
|
||||
.get(Side.SERVER)
|
||||
.attr(FMLOutboundHandler.FML_MESSAGETARGET)
|
||||
.set(FMLOutboundHandler.OutboundTarget.ALL);
|
||||
this.channels.get(Side.SERVER).writeAndFlush(message);
|
||||
}
|
||||
|
||||
@@ -193,16 +180,21 @@ public class PacketPipeline extends MessageToMessageCodec<FMLProxyPacket, Abstra
|
||||
* <p/>
|
||||
* Adapted from CPW's code in
|
||||
* cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper
|
||||
*
|
||||
*
|
||||
* @param message
|
||||
* The message to send
|
||||
* @param player
|
||||
* The player to send it to
|
||||
*/
|
||||
public void sendTo (AbstractPacket message, EntityPlayerMP player)
|
||||
{
|
||||
this.channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.PLAYER);
|
||||
this.channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGETARGS).set(player);
|
||||
public void sendTo(AbstractPacket message, EntityPlayerMP player) {
|
||||
this.channels
|
||||
.get(Side.SERVER)
|
||||
.attr(FMLOutboundHandler.FML_MESSAGETARGET)
|
||||
.set(FMLOutboundHandler.OutboundTarget.PLAYER);
|
||||
this.channels
|
||||
.get(Side.SERVER)
|
||||
.attr(FMLOutboundHandler.FML_MESSAGETARGETARGS)
|
||||
.set(player);
|
||||
this.channels.get(Side.SERVER).writeAndFlush(message);
|
||||
}
|
||||
|
||||
@@ -211,7 +203,7 @@ public class PacketPipeline extends MessageToMessageCodec<FMLProxyPacket, Abstra
|
||||
* <p/>
|
||||
* Adapted from CPW's code in
|
||||
* cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper
|
||||
*
|
||||
*
|
||||
* @param message
|
||||
* The message to send
|
||||
* @param point
|
||||
@@ -219,10 +211,15 @@ public class PacketPipeline extends MessageToMessageCodec<FMLProxyPacket, Abstra
|
||||
* {@link cpw.mods.fml.common.network.NetworkRegistry.TargetPoint}
|
||||
* around which to send
|
||||
*/
|
||||
public void sendToAllAround (AbstractPacket message, NetworkRegistry.TargetPoint point)
|
||||
{
|
||||
this.channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.ALLAROUNDPOINT);
|
||||
this.channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGETARGS).set(point);
|
||||
public void sendToAllAround(AbstractPacket message, NetworkRegistry.TargetPoint point) {
|
||||
this.channels
|
||||
.get(Side.SERVER)
|
||||
.attr(FMLOutboundHandler.FML_MESSAGETARGET)
|
||||
.set(FMLOutboundHandler.OutboundTarget.ALLAROUNDPOINT);
|
||||
this.channels
|
||||
.get(Side.SERVER)
|
||||
.attr(FMLOutboundHandler.FML_MESSAGETARGETARGS)
|
||||
.set(point);
|
||||
this.channels.get(Side.SERVER).writeAndFlush(message);
|
||||
}
|
||||
|
||||
@@ -231,16 +228,21 @@ public class PacketPipeline extends MessageToMessageCodec<FMLProxyPacket, Abstra
|
||||
* <p/>
|
||||
* Adapted from CPW's code in
|
||||
* cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper
|
||||
*
|
||||
*
|
||||
* @param message
|
||||
* The message to send
|
||||
* @param dimensionId
|
||||
* The dimension id to target
|
||||
*/
|
||||
public void sendToDimension (AbstractPacket message, int dimensionId)
|
||||
{
|
||||
this.channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.DIMENSION);
|
||||
this.channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGETARGS).set(dimensionId);
|
||||
public void sendToDimension(AbstractPacket message, int dimensionId) {
|
||||
this.channels
|
||||
.get(Side.SERVER)
|
||||
.attr(FMLOutboundHandler.FML_MESSAGETARGET)
|
||||
.set(FMLOutboundHandler.OutboundTarget.DIMENSION);
|
||||
this.channels
|
||||
.get(Side.SERVER)
|
||||
.attr(FMLOutboundHandler.FML_MESSAGETARGETARGS)
|
||||
.set(dimensionId);
|
||||
this.channels.get(Side.SERVER).writeAndFlush(message);
|
||||
}
|
||||
|
||||
@@ -249,13 +251,15 @@ public class PacketPipeline extends MessageToMessageCodec<FMLProxyPacket, Abstra
|
||||
* <p/>
|
||||
* Adapted from CPW's code in
|
||||
* cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper
|
||||
*
|
||||
*
|
||||
* @param message
|
||||
* The message to send
|
||||
*/
|
||||
public void sendToServer (AbstractPacket message)
|
||||
{
|
||||
this.channels.get(Side.CLIENT).attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.TOSERVER);
|
||||
public void sendToServer(AbstractPacket message) {
|
||||
this.channels
|
||||
.get(Side.CLIENT)
|
||||
.attr(FMLOutboundHandler.FML_MESSAGETARGET)
|
||||
.set(FMLOutboundHandler.OutboundTarget.TOSERVER);
|
||||
this.channels.get(Side.CLIENT).writeAndFlush(message);
|
||||
}
|
||||
}
|
||||
@@ -11,19 +11,14 @@ import tconstruct.library.crafting.StencilBuilder;
|
||||
import tconstruct.tools.inventory.PatternShaperContainer;
|
||||
import tconstruct.tools.logic.StencilTableLogic;
|
||||
|
||||
public class PatternTablePacket extends AbstractPacket
|
||||
{
|
||||
public class PatternTablePacket extends AbstractPacket {
|
||||
|
||||
int x, y, z;
|
||||
ItemStack contents;
|
||||
|
||||
public PatternTablePacket()
|
||||
{
|
||||
public PatternTablePacket() {}
|
||||
|
||||
}
|
||||
|
||||
public PatternTablePacket(int x, int y, int z, ItemStack contents)
|
||||
{
|
||||
public PatternTablePacket(int x, int y, int z, ItemStack contents) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
@@ -31,8 +26,7 @@ public class PatternTablePacket extends AbstractPacket
|
||||
}
|
||||
|
||||
@Override
|
||||
public void encodeInto (ChannelHandlerContext ctx, ByteBuf buffer)
|
||||
{
|
||||
public void encodeInto(ChannelHandlerContext ctx, ByteBuf buffer) {
|
||||
buffer.writeInt(x);
|
||||
buffer.writeInt(y);
|
||||
buffer.writeInt(z);
|
||||
@@ -40,8 +34,7 @@ public class PatternTablePacket extends AbstractPacket
|
||||
}
|
||||
|
||||
@Override
|
||||
public void decodeInto (ChannelHandlerContext ctx, ByteBuf buffer)
|
||||
{
|
||||
public void decodeInto(ChannelHandlerContext ctx, ByteBuf buffer) {
|
||||
x = buffer.readInt();
|
||||
y = buffer.readInt();
|
||||
z = buffer.readInt();
|
||||
@@ -49,40 +42,30 @@ public class PatternTablePacket extends AbstractPacket
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleClientSide (EntityPlayer player)
|
||||
{
|
||||
|
||||
}
|
||||
public void handleClientSide(EntityPlayer player) {}
|
||||
|
||||
@Override
|
||||
public void handleServerSide (EntityPlayer player)
|
||||
{
|
||||
if (player.openContainer instanceof PatternShaperContainer)
|
||||
{
|
||||
public void handleServerSide(EntityPlayer player) {
|
||||
if (player.openContainer instanceof PatternShaperContainer) {
|
||||
PatternShaperContainer container = (PatternShaperContainer) player.openContainer;
|
||||
StencilTableLogic logic = container.logic;
|
||||
if (logic != null && logic.xCoord == this.x && logic.yCoord == this.y && logic.zCoord == this.z)
|
||||
if (this.contents == null)
|
||||
logic.setSelectedPattern(null);
|
||||
else
|
||||
{
|
||||
if (this.contents == null) logic.setSelectedPattern(null);
|
||||
else {
|
||||
ItemStack stackBlank = logic.getStackInSlot(0);
|
||||
if (stackBlank != null && stackBlank.stackSize > 0 && StencilBuilder.isBlank(stackBlank))
|
||||
{
|
||||
if (stackBlank != null && stackBlank.stackSize > 0 && StencilBuilder.isBlank(stackBlank)) {
|
||||
boolean warning = true;
|
||||
for (ItemStack stack : StencilBuilder.instance.stencils.values())
|
||||
{
|
||||
if (stack != null && this.contents.isItemEqual(stack))
|
||||
{
|
||||
for (ItemStack stack : StencilBuilder.instance.stencils.values()) {
|
||||
if (stack != null && this.contents.isItemEqual(stack)) {
|
||||
this.contents = stack.copy();
|
||||
warning = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (warning)
|
||||
TConstruct.logger.warn("Possible packet-cheating with PatternTable for player " + player.getCommandSenderName());
|
||||
else
|
||||
logic.setSelectedPattern(this.contents);
|
||||
TConstruct.logger.warn("Possible packet-cheating with PatternTable for player "
|
||||
+ player.getCommandSenderName());
|
||||
else logic.setSelectedPattern(this.contents);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,17 +9,13 @@ import net.minecraft.tileentity.TileEntity;
|
||||
import tconstruct.TConstruct;
|
||||
import tconstruct.tools.logic.BattlesignLogic;
|
||||
|
||||
public class SignDataPacket extends AbstractPacket
|
||||
{
|
||||
public class SignDataPacket extends AbstractPacket {
|
||||
private int dimension, x, y, z, length;
|
||||
private String[] text;
|
||||
|
||||
public SignDataPacket()
|
||||
{
|
||||
}
|
||||
public SignDataPacket() {}
|
||||
|
||||
public SignDataPacket(int dimension, int x, int y, int z, String[] text)
|
||||
{
|
||||
public SignDataPacket(int dimension, int x, int y, int z, String[] text) {
|
||||
this.text = text;
|
||||
this.dimension = dimension;
|
||||
this.x = x;
|
||||
@@ -29,41 +25,35 @@ public class SignDataPacket extends AbstractPacket
|
||||
}
|
||||
|
||||
@Override
|
||||
public void encodeInto (ChannelHandlerContext ctx, ByteBuf buffer)
|
||||
{
|
||||
public void encodeInto(ChannelHandlerContext ctx, ByteBuf buffer) {
|
||||
buffer.writeInt(dimension);
|
||||
buffer.writeInt(x);
|
||||
buffer.writeInt(y);
|
||||
buffer.writeInt(z);
|
||||
buffer.writeInt(length);
|
||||
for (int i = 0; i < length; i++)
|
||||
{
|
||||
for (int i = 0; i < length; i++) {
|
||||
ByteBufUtils.writeUTF8String(buffer, text[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void decodeInto (ChannelHandlerContext ctx, ByteBuf buffer)
|
||||
{
|
||||
public void decodeInto(ChannelHandlerContext ctx, ByteBuf buffer) {
|
||||
dimension = buffer.readInt();
|
||||
x = buffer.readInt();
|
||||
y = buffer.readInt();
|
||||
z = buffer.readInt();
|
||||
length = buffer.readInt();
|
||||
text = new String[length];
|
||||
for (int i = 0; i < length; i++)
|
||||
{
|
||||
for (int i = 0; i < length; i++) {
|
||||
text[i] = ByteBufUtils.readUTF8String(buffer);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleClientSide (EntityPlayer player)
|
||||
{
|
||||
public void handleClientSide(EntityPlayer player) {
|
||||
TileEntity te = player.worldObj.getTileEntity(x, y, z);
|
||||
|
||||
if (te instanceof BattlesignLogic)
|
||||
{
|
||||
if (te instanceof BattlesignLogic) {
|
||||
BattlesignLogic logic = (BattlesignLogic) te;
|
||||
|
||||
logic.setText(text);
|
||||
@@ -71,17 +61,14 @@ public class SignDataPacket extends AbstractPacket
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleServerSide (EntityPlayer player)
|
||||
{
|
||||
if (player.worldObj.blockExists(x, y, z))
|
||||
{
|
||||
public void handleServerSide(EntityPlayer player) {
|
||||
if (player.worldObj.blockExists(x, y, z)) {
|
||||
return;
|
||||
}
|
||||
|
||||
TileEntity te = player.worldObj.getTileEntity(x, y, z);
|
||||
|
||||
if (te instanceof BattlesignLogic)
|
||||
{
|
||||
if (te instanceof BattlesignLogic) {
|
||||
BattlesignLogic logic = (BattlesignLogic) te;
|
||||
|
||||
logic.setText(text);
|
||||
|
||||
@@ -11,19 +11,14 @@ import tconstruct.TConstruct;
|
||||
import tconstruct.smeltery.inventory.SmelteryContainer;
|
||||
import tconstruct.smeltery.logic.SmelteryLogic;
|
||||
|
||||
public class SmelteryPacket extends AbstractPacket
|
||||
{
|
||||
public class SmelteryPacket extends AbstractPacket {
|
||||
|
||||
int dimension, x, y, z, fluidID;
|
||||
boolean isShiftPressed;
|
||||
|
||||
public SmelteryPacket()
|
||||
{
|
||||
public SmelteryPacket() {}
|
||||
|
||||
}
|
||||
|
||||
public SmelteryPacket(int dimension, int x, int y, int z, boolean isShiftPressed, int fluidID)
|
||||
{
|
||||
public SmelteryPacket(int dimension, int x, int y, int z, boolean isShiftPressed, int fluidID) {
|
||||
this.dimension = dimension;
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
@@ -33,20 +28,17 @@ public class SmelteryPacket extends AbstractPacket
|
||||
}
|
||||
|
||||
@Override
|
||||
public void encodeInto (ChannelHandlerContext ctx, ByteBuf buffer)
|
||||
{
|
||||
public void encodeInto(ChannelHandlerContext ctx, ByteBuf buffer) {
|
||||
buffer.writeInt(dimension);
|
||||
buffer.writeInt(x);
|
||||
buffer.writeInt(y);
|
||||
buffer.writeInt(z);
|
||||
buffer.writeBoolean(isShiftPressed);
|
||||
buffer.writeInt(fluidID);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void decodeInto (ChannelHandlerContext ctx, ByteBuf buffer)
|
||||
{
|
||||
public void decodeInto(ChannelHandlerContext ctx, ByteBuf buffer) {
|
||||
dimension = buffer.readInt();
|
||||
x = buffer.readInt();
|
||||
y = buffer.readInt();
|
||||
@@ -56,41 +48,36 @@ public class SmelteryPacket extends AbstractPacket
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleClientSide (EntityPlayer player)
|
||||
{
|
||||
|
||||
}
|
||||
public void handleClientSide(EntityPlayer player) {}
|
||||
|
||||
@Override
|
||||
public void handleServerSide (EntityPlayer player)
|
||||
{
|
||||
if (player.openContainer instanceof SmelteryContainer)
|
||||
{
|
||||
public void handleServerSide(EntityPlayer player) {
|
||||
if (player.openContainer instanceof SmelteryContainer) {
|
||||
SmelteryContainer container = (SmelteryContainer) player.openContainer;
|
||||
SmelteryLogic logic = container.logic;
|
||||
if (logic != null && logic.hasWorldObj() && logic.getWorldObj().provider.dimensionId == this.dimension && logic.xCoord == this.x && logic.yCoord == this.y && logic.zCoord == this.z)
|
||||
{
|
||||
if (logic != null
|
||||
&& logic.hasWorldObj()
|
||||
&& logic.getWorldObj().provider.dimensionId == this.dimension
|
||||
&& logic.xCoord == this.x
|
||||
&& logic.yCoord == this.y
|
||||
&& logic.zCoord == this.z) {
|
||||
FluidStack temp = null;
|
||||
|
||||
for (FluidStack liquid : logic.moltenMetal)
|
||||
{
|
||||
if (liquid.getFluidID() == this.fluidID)
|
||||
temp = liquid;
|
||||
for (FluidStack liquid : logic.moltenMetal) {
|
||||
if (liquid.getFluidID() == this.fluidID) temp = liquid;
|
||||
}
|
||||
|
||||
if (temp != null)
|
||||
{
|
||||
if (temp != null) {
|
||||
logic.moltenMetal.remove(temp);
|
||||
if (this.isShiftPressed)
|
||||
logic.moltenMetal.add(temp);
|
||||
else
|
||||
logic.moltenMetal.add(0, temp);
|
||||
if (this.isShiftPressed) logic.moltenMetal.add(temp);
|
||||
else logic.moltenMetal.add(0, temp);
|
||||
}
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
logic.writeToNBT(data);
|
||||
TConstruct.packetPipeline.sendToDimension(new PacketUpdateTE(this.x, this.y, this.z, data), this.dimension);
|
||||
TConstruct.packetPipeline.sendToDimension(
|
||||
new PacketUpdateTE(this.x, this.y, this.z, data), this.dimension);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,18 +8,14 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||
import tconstruct.tools.inventory.ToolStationContainer;
|
||||
import tconstruct.tools.logic.ToolStationLogic;
|
||||
|
||||
public class ToolStationPacket extends AbstractPacket
|
||||
{
|
||||
public class ToolStationPacket extends AbstractPacket {
|
||||
|
||||
private int x, y, z;
|
||||
private String toolName;
|
||||
|
||||
public ToolStationPacket()
|
||||
{
|
||||
}
|
||||
public ToolStationPacket() {}
|
||||
|
||||
public ToolStationPacket(int x, int y, int z, String toolName)
|
||||
{
|
||||
public ToolStationPacket(int x, int y, int z, String toolName) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
@@ -27,8 +23,7 @@ public class ToolStationPacket extends AbstractPacket
|
||||
}
|
||||
|
||||
@Override
|
||||
public void encodeInto (ChannelHandlerContext ctx, ByteBuf buffer)
|
||||
{
|
||||
public void encodeInto(ChannelHandlerContext ctx, ByteBuf buffer) {
|
||||
buffer.writeInt(x);
|
||||
buffer.writeInt(y);
|
||||
buffer.writeInt(z);
|
||||
@@ -36,8 +31,7 @@ public class ToolStationPacket extends AbstractPacket
|
||||
}
|
||||
|
||||
@Override
|
||||
public void decodeInto (ChannelHandlerContext ctx, ByteBuf buffer)
|
||||
{
|
||||
public void decodeInto(ChannelHandlerContext ctx, ByteBuf buffer) {
|
||||
x = buffer.readInt();
|
||||
y = buffer.readInt();
|
||||
z = buffer.readInt();
|
||||
@@ -45,22 +39,16 @@ public class ToolStationPacket extends AbstractPacket
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleClientSide (EntityPlayer player)
|
||||
{
|
||||
}
|
||||
public void handleClientSide(EntityPlayer player) {}
|
||||
|
||||
@Override
|
||||
public void handleServerSide (EntityPlayer player)
|
||||
{
|
||||
if (player.openContainer instanceof ToolStationContainer)
|
||||
{
|
||||
public void handleServerSide(EntityPlayer player) {
|
||||
if (player.openContainer instanceof ToolStationContainer) {
|
||||
ToolStationContainer container = (ToolStationContainer) player.openContainer;
|
||||
ToolStationLogic logic = container.logic;
|
||||
if (logic != null && logic.xCoord == x && logic.yCoord == y && logic.zCoord == z)
|
||||
{
|
||||
if (logic != null && logic.xCoord == x && logic.yCoord == y && logic.zCoord == z) {
|
||||
logic.setToolname(toolName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user