mirror of
https://github.com/GTNewHorizons/TinkersConstruct.git
synced 2026-11-22 13:09:53 +00:00
[ci skip] spotlessApply with the new settings
This commit is contained in:
1 parent
83698cb73c
commit
84c2239244
561 files changed
+8872
-9300
No files matched your search
@@ -1,11 +1,13 @@
|
||||
package tconstruct.util;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -1,17 +1,16 @@
|
||||
package tconstruct.util;
|
||||
|
||||
import mantle.crash.CallableSuppConfig;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.ICrashCallable;
|
||||
import mantle.crash.CallableSuppConfig;
|
||||
|
||||
public class EnvironmentChecks {
|
||||
|
||||
private EnvironmentChecks() {} // Singleton
|
||||
|
||||
/**
|
||||
* Checks for conflicting stuff in environment; adds callable to any crash
|
||||
* logs if so. Note: This code adds additional data to crashlogs. It does
|
||||
* not trigger any crashes.
|
||||
* Checks for conflicting stuff in environment; adds callable to any crash logs if so. Note: This code adds
|
||||
* additional data to crashlogs. It does not trigger any crashes.
|
||||
*/
|
||||
// private static List<String> incompatibilities = new ArrayList<>();
|
||||
// private static EnvironmentChecks instance = new EnvironmentChecks();
|
||||
|
||||
@@ -1,17 +1,15 @@
|
||||
package tconstruct.util;
|
||||
|
||||
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.FluidStack;
|
||||
|
||||
import tconstruct.TConstruct;
|
||||
import tconstruct.library.TConstructRegistry;
|
||||
import tconstruct.library.client.TConstructClientRegistry;
|
||||
@@ -24,8 +22,13 @@ import tconstruct.library.tools.ToolMaterial;
|
||||
import tconstruct.library.util.IPattern;
|
||||
import tconstruct.smeltery.TinkerSmeltery;
|
||||
import tconstruct.tools.TinkerTools;
|
||||
import cofh.api.energy.IEnergyContainerItem;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.FMLLog;
|
||||
import cpw.mods.fml.common.event.FMLInterModComms;
|
||||
|
||||
public final class IMCHandler {
|
||||
|
||||
private IMCHandler() {}
|
||||
|
||||
public static void processIMC(List<FMLInterModComms.IMCMessage> messages) {
|
||||
@@ -69,9 +72,8 @@ public final class IMCHandler {
|
||||
// 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);
|
||||
if (FMLCommonHandler.instance().getSide().isClient()) TConstructClientRegistry
|
||||
.addMaterialRenderMapping(id, "tinker", mat.name().toLowerCase(), true);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -105,7 +107,12 @@ public final class IMCHandler {
|
||||
|
||||
// register the material
|
||||
PatternBuilder.instance.registerFullMaterial(
|
||||
item, value, TConstructRegistry.getMaterial(matID).materialName, shard, rod, matID);
|
||||
item,
|
||||
value,
|
||||
TConstructRegistry.getMaterial(matID).materialName,
|
||||
shard,
|
||||
rod,
|
||||
matID);
|
||||
|
||||
List<Item> addItems = new LinkedList<>();
|
||||
List<Integer> addMetas = new LinkedList<>();
|
||||
@@ -136,8 +143,9 @@ public final class IMCHandler {
|
||||
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);
|
||||
TConstruct.logger.debug(
|
||||
"PartBuilder IMC: Added Part builder mapping for "
|
||||
+ TConstructRegistry.getMaterial(matID).materialName);
|
||||
break;
|
||||
}
|
||||
case "addPartCastingMaterial": {
|
||||
@@ -169,13 +177,12 @@ public final class IMCHandler {
|
||||
|
||||
// we add the toolpart to all smeltery recipies that use iron and create a toolpart
|
||||
List<CastingRecipe> newRecipies = new LinkedList<>();
|
||||
for (CastingRecipe recipe :
|
||||
TConstructRegistry.getTableCasting().getCastingRecipes()) {
|
||||
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;
|
||||
if (!(recipe.getResult().getItem() instanceof DynamicToolPart)) // has to be dynamic toolpart to
|
||||
// support automatic addition
|
||||
continue;
|
||||
|
||||
newRecipies.add(recipe);
|
||||
}
|
||||
@@ -200,8 +207,8 @@ public final class IMCHandler {
|
||||
Smeltery.addMelting(ft, output, 0, liquid2.amount);
|
||||
}
|
||||
|
||||
TConstruct.logger.debug(
|
||||
"Casting IMC: Added fluid " + tag.getString("FluidName") + " to part casting");
|
||||
TConstruct.logger
|
||||
.debug("Casting IMC: Added fluid " + tag.getString("FluidName") + " to part casting");
|
||||
break;
|
||||
}
|
||||
case "addMaterialItem": {
|
||||
@@ -240,7 +247,12 @@ public final class IMCHandler {
|
||||
|
||||
// register the material
|
||||
PatternBuilder.instance.registerFullMaterial(
|
||||
stack, value, TConstructRegistry.getMaterial(id).materialName, shard, rod, id);
|
||||
stack,
|
||||
value,
|
||||
TConstructRegistry.getMaterial(id).materialName,
|
||||
shard,
|
||||
rod,
|
||||
id);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -267,19 +279,23 @@ public final class IMCHandler {
|
||||
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);
|
||||
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());
|
||||
item,
|
||||
Block.getBlockFromItem(block.getItem()),
|
||||
block.getItemDamage(),
|
||||
temperature,
|
||||
liquid);
|
||||
TConstruct.logger.debug(
|
||||
"Smeltery IMC: Added melting: " + item
|
||||
.getDisplayName() + " to " + liquid.amount + "mb " + liquid.getLocalizedName());
|
||||
break;
|
||||
}
|
||||
case "addSmelteryFuel": {
|
||||
@@ -302,8 +318,9 @@ 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 + ")");
|
||||
break;
|
||||
}
|
||||
case "addFluxBattery":
|
||||
@@ -328,11 +345,10 @@ public final class IMCHandler {
|
||||
|
||||
private static boolean checkRequiredTags(String prefix, NBTTagCompound tag, String... tags) {
|
||||
boolean ok = true;
|
||||
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
|
||||
}
|
||||
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
|
||||
}
|
||||
|
||||
return ok;
|
||||
}
|
||||
@@ -342,8 +358,12 @@ public final class IMCHandler {
|
||||
}
|
||||
|
||||
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));
|
||||
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) {
|
||||
@@ -379,19 +399,18 @@ public final class IMCHandler {
|
||||
|
||||
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);
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package tconstruct.util;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.*;
|
||||
@@ -9,10 +10,13 @@ import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.item.*;
|
||||
import net.minecraft.util.IIcon;
|
||||
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 {
|
||||
Class<?> clazz = Class.forName(classPackage);
|
||||
@@ -46,8 +50,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);
|
||||
|
||||
@@ -3,6 +3,7 @@ package tconstruct.util;
|
||||
import tconstruct.TConstruct;
|
||||
|
||||
public final class Reference {
|
||||
|
||||
private Reference() {}
|
||||
|
||||
public static final String MOD_ID = TConstruct.modID;
|
||||
|
||||
@@ -1,12 +1,15 @@
|
||||
package tconstruct.util.config;
|
||||
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import net.minecraftforge.common.config.Configuration;
|
||||
|
||||
import tconstruct.TConstruct;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
|
||||
public class DimensionBlacklist {
|
||||
|
||||
public static ArrayList<Integer> blacklistedDims = new ArrayList<>();
|
||||
public static ArrayList<Integer> noPoolDims = new ArrayList<>();
|
||||
|
||||
@@ -59,8 +62,7 @@ public class DimensionBlacklist {
|
||||
|
||||
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;
|
||||
}
|
||||
@@ -73,8 +75,7 @@ public class DimensionBlacklist {
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -1,22 +1,24 @@
|
||||
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 com.google.common.collect.Sets;
|
||||
|
||||
public class PHConstruct {
|
||||
|
||||
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
|
||||
* Make sure to read any old configs file if they exist
|
||||
* Second: Create the actual config file
|
||||
/*
|
||||
* Here we will set up the config file for the mod First: Create a folder inside the config folder Make sure to
|
||||
* read any old configs file if they exist Second: Create the actual config file
|
||||
*/
|
||||
File mainFile = new File(location + "/TinkersConstruct.cfg");
|
||||
File legacyFile16 = new File(location + "/TinkersWorkshop.txt");
|
||||
@@ -34,173 +36,124 @@ public class PHConstruct {
|
||||
Configuration config = new Configuration(mainFile);
|
||||
// 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);
|
||||
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);
|
||||
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);
|
||||
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);
|
||||
"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);
|
||||
"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);
|
||||
"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);
|
||||
"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);
|
||||
"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);
|
||||
"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);
|
||||
"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);
|
||||
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);
|
||||
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);
|
||||
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);
|
||||
tinuDensity = config.get("Worldgen", "Tin Underground Density", 2).getInt(2);
|
||||
aluminumuDensity =
|
||||
config.get("Worldgen", "Aluminum Underground Density", 3).getInt(3);
|
||||
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;
|
||||
@@ -249,36 +202,29 @@ public class PHConstruct {
|
||||
|
||||
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();
|
||||
"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);
|
||||
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);
|
||||
"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);
|
||||
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)
|
||||
"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
|
||||
@@ -290,60 +236,59 @@ public class PHConstruct {
|
||||
connectedTexturesMode = conTexMode.getInt(2);
|
||||
|
||||
// dimension blacklist
|
||||
cfgForbiddenDim = config.get(
|
||||
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();
|
||||
"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")
|
||||
"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);
|
||||
"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);
|
||||
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.")
|
||||
"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.")
|
||||
"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());
|
||||
craftingStationBlacklist = Sets.newHashSet(
|
||||
config.get(
|
||||
"CraftingStationBlacklist",
|
||||
"tileEntities",
|
||||
new String[] { "wanion.avaritiaddons.block.chest.infinity.TileEntityInfinityChest" })
|
||||
.getStringList());
|
||||
|
||||
/* Save the configuration file only if it has changed */
|
||||
if (config.hasChanged()) config.save();
|
||||
@@ -353,8 +298,7 @@ public class PHConstruct {
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,14 +1,16 @@
|
||||
package tconstruct.util.network;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
import mantle.common.network.AbstractPacket;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import tconstruct.TConstruct;
|
||||
import tconstruct.armor.ArmorProxyCommon;
|
||||
import tconstruct.armor.TinkerArmor;
|
||||
import tconstruct.armor.player.TPlayerStats;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
|
||||
public class AccessoryInventoryPacket extends AbstractPacket {
|
||||
|
||||
|
||||
@@ -1,13 +1,15 @@
|
||||
package tconstruct.util.network;
|
||||
|
||||
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;
|
||||
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.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.
|
||||
@@ -15,11 +17,14 @@ import tconstruct.armor.player.TPlayerStats;
|
||||
* @author covers1624
|
||||
*/
|
||||
public class ArmourGuiSyncPacket extends AbstractPacket {
|
||||
|
||||
NBTTagCompound playerStats = new NBTTagCompound();
|
||||
|
||||
public ArmourGuiSyncPacket() {}
|
||||
|
||||
/**
|
||||
* For sending the players TPlayerStats to the client.
|
||||
*
|
||||
* @param tag, The players TPlayerStats written to NBT.
|
||||
*/
|
||||
public ArmourGuiSyncPacket(NBTTagCompound tag) {
|
||||
|
||||
@@ -1,13 +1,16 @@
|
||||
package tconstruct.util.network;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
import mantle.common.network.AbstractPacket;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
import tconstruct.armor.PlayerAbilityHelper;
|
||||
import tconstruct.armor.player.TPlayerStats;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
|
||||
public class BeltPacket extends AbstractPacket {
|
||||
|
||||
public BeltPacket() {}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
package tconstruct.util.network;
|
||||
|
||||
import mantle.common.network.AbstractPacket;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
import mantle.common.network.AbstractPacket;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
public class DoubleJumpPacket extends AbstractPacket {
|
||||
|
||||
|
||||
@@ -1,12 +1,15 @@
|
||||
package tconstruct.util.network;
|
||||
|
||||
import mantle.common.network.AbstractPacket;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
import tconstruct.armor.PlayerAbilityHelper;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
import mantle.common.network.AbstractPacket;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import tconstruct.armor.PlayerAbilityHelper;
|
||||
|
||||
public class GogglePacket extends AbstractPacket {
|
||||
|
||||
boolean active;
|
||||
|
||||
public GogglePacket() {}
|
||||
@@ -31,7 +34,8 @@ public class GogglePacket extends AbstractPacket {
|
||||
@Override
|
||||
public void handleServerSide(EntityPlayer player) {
|
||||
PlayerAbilityHelper.toggleGoggles(player, active);
|
||||
/*TPlayerStats stats = TPlayerStats.get(player);
|
||||
stats.activeGoggles = active;*/
|
||||
/*
|
||||
* TPlayerStats stats = TPlayerStats.get(player); stats.activeGoggles = active;
|
||||
*/
|
||||
}
|
||||
}
|
||||
@@ -1,13 +1,16 @@
|
||||
package tconstruct.util.network;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
import mantle.common.network.AbstractPacket;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
import tconstruct.armor.ArmorProxyClient;
|
||||
import tconstruct.armor.player.TPlayerStats;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
|
||||
public class HealthUpdatePacket extends AbstractPacket {
|
||||
|
||||
private float health;
|
||||
|
||||
public HealthUpdatePacket() {}
|
||||
|
||||
@@ -1,12 +1,15 @@
|
||||
package tconstruct.util.network;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
import mantle.common.network.AbstractPacket;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
|
||||
public class MovementUpdatePacket extends AbstractPacket {
|
||||
|
||||
public int entityID;
|
||||
public double x;
|
||||
public double y;
|
||||
|
||||
@@ -1,5 +1,13 @@
|
||||
package tconstruct.util.network;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import mantle.common.network.*;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.player.*;
|
||||
import net.minecraft.network.*;
|
||||
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.network.*;
|
||||
import cpw.mods.fml.common.network.internal.FMLProxyPacket;
|
||||
@@ -7,15 +15,9 @@ import cpw.mods.fml.relauncher.*;
|
||||
import io.netty.buffer.*;
|
||||
import io.netty.channel.*;
|
||||
import io.netty.handler.codec.MessageToMessageCodec;
|
||||
import java.util.*;
|
||||
import mantle.common.network.*;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.player.*;
|
||||
import net.minecraft.network.*;
|
||||
|
||||
/**
|
||||
* Packet pipeline class. Directs all registered packet data to be handled by
|
||||
* the packets themselves.
|
||||
* Packet pipeline class. Directs all registered packet data to be handled by the packets themselves.
|
||||
*
|
||||
* @author sirgingalot some code from: cpw
|
||||
*/
|
||||
@@ -27,15 +29,12 @@ public class PacketPipeline extends MessageToMessageCodec<FMLProxyPacket, Abstra
|
||||
private boolean isPostInitialised = false;
|
||||
|
||||
/**
|
||||
* Register your packet with the pipeline. Discriminators are automatically
|
||||
* set.
|
||||
* Register your packet with the pipeline. Discriminators are automatically set.
|
||||
*
|
||||
* @param clazz
|
||||
* the class to register
|
||||
* @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
|
||||
* @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) {
|
||||
@@ -63,15 +62,15 @@ public class PacketPipeline extends MessageToMessageCodec<FMLProxyPacket, Abstra
|
||||
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());
|
||||
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());
|
||||
buffer.copy(),
|
||||
ctx.channel().attr(NetworkRegistry.FML_CHANNEL).get());
|
||||
out.add(proxyPacket);
|
||||
}
|
||||
|
||||
@@ -96,8 +95,7 @@ public class PacketPipeline extends MessageToMessageCodec<FMLProxyPacket, Abstra
|
||||
break;
|
||||
|
||||
case SERVER:
|
||||
INetHandler netHandler =
|
||||
ctx.channel().attr(NetworkRegistry.NET_HANDLER).get();
|
||||
INetHandler netHandler = ctx.channel().attr(NetworkRegistry.NET_HANDLER).get();
|
||||
player = ((NetHandlerPlayServer) netHandler).playerEntity;
|
||||
pkt.handleServerSide(player);
|
||||
break;
|
||||
@@ -155,16 +153,12 @@ public class PacketPipeline extends MessageToMessageCodec<FMLProxyPacket, Abstra
|
||||
/**
|
||||
* Send this message to everyone.
|
||||
* <p/>
|
||||
* Adapted from CPW's code in
|
||||
* cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper
|
||||
* Adapted from CPW's code in cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper
|
||||
*
|
||||
* @param message
|
||||
* The message to send
|
||||
* @param message The message to send
|
||||
*/
|
||||
public void sendToAll(AbstractPacket message) {
|
||||
this.channels
|
||||
.get(Side.SERVER)
|
||||
.attr(FMLOutboundHandler.FML_MESSAGETARGET)
|
||||
this.channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGET)
|
||||
.set(FMLOutboundHandler.OutboundTarget.ALL);
|
||||
this.channels.get(Side.SERVER).writeAndFlush(message);
|
||||
}
|
||||
@@ -172,87 +166,57 @@ public class PacketPipeline extends MessageToMessageCodec<FMLProxyPacket, Abstra
|
||||
/**
|
||||
* Send this message to the specified player.
|
||||
* <p/>
|
||||
* Adapted from CPW's code in
|
||||
* cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper
|
||||
* 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
|
||||
* @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)
|
||||
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).attr(FMLOutboundHandler.FML_MESSAGETARGETARGS).set(player);
|
||||
this.channels.get(Side.SERVER).writeAndFlush(message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send this message to everyone within a certain range of a point.
|
||||
* <p/>
|
||||
* Adapted from CPW's code in
|
||||
* cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper
|
||||
* Adapted from CPW's code in cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper
|
||||
*
|
||||
* @param message
|
||||
* The message to send
|
||||
* @param point
|
||||
* The
|
||||
* {@link cpw.mods.fml.common.network.NetworkRegistry.TargetPoint}
|
||||
* around which to send
|
||||
* @param message The message to send
|
||||
* @param point The {@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)
|
||||
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).attr(FMLOutboundHandler.FML_MESSAGETARGETARGS).set(point);
|
||||
this.channels.get(Side.SERVER).writeAndFlush(message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send this message to everyone within the supplied dimension.
|
||||
* <p/>
|
||||
* Adapted from CPW's code in
|
||||
* cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper
|
||||
* 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
|
||||
* @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)
|
||||
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).attr(FMLOutboundHandler.FML_MESSAGETARGETARGS).set(dimensionId);
|
||||
this.channels.get(Side.SERVER).writeAndFlush(message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send this message to the server.
|
||||
* <p/>
|
||||
* Adapted from CPW's code in
|
||||
* cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper
|
||||
* Adapted from CPW's code in cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper
|
||||
*
|
||||
* @param message
|
||||
* The message to send
|
||||
* @param message The message to send
|
||||
*/
|
||||
public void sendToServer(AbstractPacket message) {
|
||||
this.channels
|
||||
.get(Side.CLIENT)
|
||||
.attr(FMLOutboundHandler.FML_MESSAGETARGET)
|
||||
this.channels.get(Side.CLIENT).attr(FMLOutboundHandler.FML_MESSAGETARGET)
|
||||
.set(FMLOutboundHandler.OutboundTarget.TOSERVER);
|
||||
this.channels.get(Side.CLIENT).writeAndFlush(message);
|
||||
}
|
||||
|
||||
@@ -1,15 +1,17 @@
|
||||
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.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import tconstruct.TConstruct;
|
||||
import tconstruct.library.crafting.StencilBuilder;
|
||||
import tconstruct.tools.inventory.PatternShaperContainer;
|
||||
import tconstruct.tools.logic.StencilTableLogic;
|
||||
import cpw.mods.fml.common.network.ByteBufUtils;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
|
||||
public class PatternTablePacket extends AbstractPacket {
|
||||
|
||||
@@ -62,9 +64,9 @@ public class PatternTablePacket extends AbstractPacket {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (warning)
|
||||
TConstruct.logger.warn("Possible packet-cheating with PatternTable for player "
|
||||
+ player.getCommandSenderName());
|
||||
if (warning) TConstruct.logger.warn(
|
||||
"Possible packet-cheating with PatternTable for player "
|
||||
+ player.getCommandSenderName());
|
||||
else logic.setSelectedPattern(this.contents);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,15 +1,18 @@
|
||||
package tconstruct.util.network;
|
||||
|
||||
import mantle.common.network.AbstractPacket;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
import tconstruct.TConstruct;
|
||||
import tconstruct.tools.logic.BattlesignLogic;
|
||||
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.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import tconstruct.TConstruct;
|
||||
import tconstruct.tools.logic.BattlesignLogic;
|
||||
|
||||
public class SignDataPacket extends AbstractPacket {
|
||||
|
||||
private int dimension, x, y, z, length;
|
||||
private String[] text;
|
||||
|
||||
|
||||
@@ -1,15 +1,17 @@
|
||||
package tconstruct.util.network;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
import mantle.common.network.AbstractPacket;
|
||||
import mantle.common.network.PacketUpdateTE;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import tconstruct.TConstruct;
|
||||
import tconstruct.smeltery.inventory.SmelteryContainer;
|
||||
import tconstruct.smeltery.logic.SmelteryLogic;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
|
||||
public class SmelteryPacket extends AbstractPacket {
|
||||
|
||||
@@ -55,8 +57,7 @@ public class SmelteryPacket extends AbstractPacket {
|
||||
if (player.openContainer instanceof SmelteryContainer) {
|
||||
SmelteryContainer container = (SmelteryContainer) player.openContainer;
|
||||
SmelteryLogic logic = container.logic;
|
||||
if (logic != null
|
||||
&& logic.hasWorldObj()
|
||||
if (logic != null && logic.hasWorldObj()
|
||||
&& logic.getWorldObj().provider.dimensionId == this.dimension
|
||||
&& logic.xCoord == this.x
|
||||
&& logic.yCoord == this.y
|
||||
@@ -75,8 +76,8 @@ public class SmelteryPacket extends AbstractPacket {
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
package tconstruct.util.network;
|
||||
|
||||
import mantle.common.network.AbstractPacket;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
import tconstruct.tools.inventory.ToolStationContainer;
|
||||
import tconstruct.tools.logic.ToolStationLogic;
|
||||
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.entity.player.EntityPlayer;
|
||||
import tconstruct.tools.inventory.ToolStationContainer;
|
||||
import tconstruct.tools.logic.ToolStationLogic;
|
||||
|
||||
public class ToolStationPacket extends AbstractPacket {
|
||||
|
||||
|
||||
Reference in new issue
Block a user