mirror of
https://github.com/GTNewHorizons/TinkersConstruct.git
synced 2026-11-24 22:14:31 +00:00
1.6.2 test - Finished liquids, added connected textures on glass
This commit is contained in:
1 parent
40c6f445a2
commit
a80fcbce86
704 files changed
+60909
No files matched your search
@@ -0,0 +1,619 @@
|
||||
package tconstruct.util;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
import net.minecraftforge.common.Configuration;
|
||||
|
||||
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
|
||||
* Second: Create the actual config file
|
||||
* Note: Configs are a pain, but absolutely necessary for every mod.
|
||||
*/
|
||||
//File file = new File(TConstruct.proxy.getLocation() + "/config");
|
||||
//file.mkdir();
|
||||
//File newFile = new File(TConstruct.proxy.getLocation() + "/config/TinkersWorkshop.txt");
|
||||
File newFile = new File(location + "/TinkersWorkshop.txt");
|
||||
|
||||
/* Some basic debugging will go a long way */
|
||||
try
|
||||
{
|
||||
newFile.createNewFile();
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
System.out.println("Could not create configuration file for TConstruct. Reason:");
|
||||
System.out.println(e);
|
||||
}
|
||||
|
||||
/* [Forge] Configuration class, used as config method */
|
||||
Configuration config = new Configuration(newFile);
|
||||
|
||||
/* Load the configuration file */
|
||||
config.load();
|
||||
|
||||
/* Define the mod's IDs.
|
||||
* Avoid values below 4096 for items and in the 250-450 range for blocks
|
||||
*/
|
||||
|
||||
//removeToolRecipes = config.get("Diffuclty Changes", "Remove vanilla tool recipes", 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);
|
||||
|
||||
superfunWorld = config.get("Superfun", "All the world is Superfun", false).getBoolean(false);
|
||||
|
||||
/*disableWoodTools = config.get("Difficulty Changes", "Disable vanilla wooden tools", false).getBoolean(false);
|
||||
disableStoneTools = config.get("Difficulty Changes", "Disable vanilla stone tools", true).getBoolean(true);
|
||||
disableIronTools = config.get("Difficulty Changes", "Disable vanilla iron tools", true).getBoolean(true);
|
||||
disableDiamondTools = config.get("Difficulty Changes", "Disable vanilla diamond tools", true).getBoolean(true);
|
||||
disableGoldTools = config.get("Difficulty Changes", "Disable vanilla gold 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);
|
||||
removeVanillaToolRecipes = config.get("Difficulty Changes", "Remove Vanilla Tool Recipes", false).getBoolean(false);
|
||||
deGreg = config.get("Difficulty Changes", "Remove Vanilla GregTech Nerfs", true).getBoolean(true);
|
||||
harderBronze = config.get("Difficulty Changes", "Lower bronze output to 2 ingots", false).getBoolean(false);
|
||||
stencilTableCrafting = config.get("Difficulty Changes", "Craft Stencil Tables", true).getBoolean(true);
|
||||
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);
|
||||
|
||||
blueSlime = config.get("Mob Spawning", "Activate Blue Slime Spawns", true).getBoolean(true);
|
||||
blueSlimeWeight = config.get("Mob Spawning", "Spawn Weight for Blue Slime", 6).getInt(6);
|
||||
|
||||
woodCrafter = config.getBlock("Wood Tool Station", 1471).getInt(1471);
|
||||
heldItemBlock = config.getBlock("Held Item Block", 1472).getInt(1472);
|
||||
lavaTank = config.getBlock("Lava Tank", 1473).getInt(1473);
|
||||
smeltery = config.getBlock("Smeltery", 1474).getInt(1474);
|
||||
oreSlag = config.getBlock("Ores Slag", 1475).getInt(1475);
|
||||
craftedSoil = config.getBlock("Special Soil", 1476).getInt(1476);
|
||||
searedTable = config.getBlock("Seared Table", 1477).getInt(1477);
|
||||
metalBlock = config.getBlock("Metal Storage", 1478).getInt(1478);
|
||||
/*metalFlowing = config.getBlock("Liquid Metal Flowing", 1479).getInt(1479);
|
||||
metalStill = config.getBlock("Liquid Metal Still", 1480).getInt(1480);*/
|
||||
|
||||
multiBrick = config.getBlock("Multi Brick", 1481).getInt(1481);
|
||||
|
||||
stoneTorch = config.getBlock("Stone Torch", 1484).getInt(1484);
|
||||
oreBerry = config.getBlock("Ore Berry One", 1485).getInt(1485);
|
||||
oreBerrySecond = config.getBlock("Ore Berry Two", 1486).getInt(1486);
|
||||
|
||||
oreGravel = config.getBlock("Ores Gravel", 1488).getInt(1488);
|
||||
speedBlock = config.getBlock("Speed Block", 1489).getInt(1489);
|
||||
|
||||
landmine = config.getBlock("Landmine", 1470).getInt(1470);
|
||||
barricade = config.getBlock("Barricade", 1469).getInt(1469);
|
||||
toolForge = config.getBlock("Tool Forge", 1468).getInt(1468);
|
||||
multiBrickFancy = config.getBlock("Multi Brick Fancy", 1467).getInt(1467);
|
||||
|
||||
/*public static int moltenSilver; //Thermal Expansion
|
||||
public static int moltenLead;
|
||||
public static int moltenNickel;
|
||||
public static int moltenPlatinum;
|
||||
public static int moltenInvar;
|
||||
public static int moltenElectrum;*/
|
||||
|
||||
moltenSilver = config.getBlock("Molten Silver", 3195).getInt(3195);
|
||||
moltenLead = config.getBlock("Molten Lead", 3196).getInt(3196);
|
||||
moltenNickel = config.getBlock("Molten Nickel", 3197).getInt(3197);
|
||||
moltenShiny = config.getBlock("Molten Platinum", 3198).getInt(3198);
|
||||
moltenInvar = config.getBlock("Molten Invar", 3199).getInt(3199);
|
||||
moltenElectrum = config.getBlock("Molten Electrum", 3200).getInt(3200);
|
||||
moltenIron = config.getBlock("Molten Iron", 3201).getInt(3201);
|
||||
moltenGold = config.getBlock("Molten Gold", 3202).getInt(3202);
|
||||
moltenCopper = config.getBlock("Molten Copper", 3203).getInt(3203);
|
||||
moltenTin = config.getBlock("Molten Tin", 3204).getInt(3204);
|
||||
moltenAluminum = config.getBlock("Molten Aluminum", 3205).getInt(3205);
|
||||
moltenCobalt = config.getBlock("Molten Cobalt", 3206).getInt(3206);
|
||||
moltenArdite = config.getBlock("Molten Ardite", 3207).getInt(3207);
|
||||
moltenBronze = config.getBlock("Molten Bronze", 3208).getInt(3208);
|
||||
moltenAlubrass = config.getBlock("Molten Aluminum Brass", 3209).getInt(3209);
|
||||
moltenManyullyn = config.getBlock("Molten Manyullyn", 3210).getInt(3210);
|
||||
moltenAlumite = config.getBlock("Molten Alumite", 3211).getInt(3211);
|
||||
moltenObsidian = config.getBlock("Molten Obsidian", 3212).getInt(3212);
|
||||
moltenSteel = config.getBlock("Molten Steel", 3213).getInt(3213);
|
||||
moltenGlass = config.getBlock("Molten Glass", 3214).getInt(3214);
|
||||
moltenStone = config.getBlock("Molten Stone", 3215).getInt(3215);
|
||||
moltenEmerald = config.getBlock("Molten Emerald", 3216).getInt(3216);
|
||||
blood = config.getBlock("Liquid Cow", 3217).getInt(3217);
|
||||
moltenSilver = config.getBlock("Molten Silver", 3218).getInt(3218);
|
||||
moltenLead = config.getBlock("Molten Lead", 3219).getInt(3219);
|
||||
|
||||
aggregator = config.getBlock("Aggregator", 3221).getInt(3221);
|
||||
lightCrystalBase = config.getBlock("Light Crystal", 3222).getInt(3222);
|
||||
glass = config.getBlock("Clear Glass", 3223).getInt(3223);
|
||||
stainedGlass = config.getBlock("Stained Glass", 3224).getInt(3224);
|
||||
stainedGlassClear = config.getBlock("Clear Stained Glass", 3225).getInt(3225);
|
||||
redstoneMachine = config.getBlock("Redstone Machines", 3226).getInt(3226);
|
||||
dryingRack = config.getBlock("Drying Rack", 3227).getInt(3227);
|
||||
glassPane = config.getBlock("Glass Pane", 3228).getInt(3228);
|
||||
stainedGlassClearPane = config.getBlock("Clear Stained Glass Pane", 3229).getInt(3229);
|
||||
|
||||
searedSlab = config.getBlock("Seared Slab", 3230).getInt(3230);
|
||||
speedSlab = config.getBlock("Speed Slab", 3231).getInt(3231);
|
||||
//grassSlab = config.getBlock("Grass Slab", 3230).getInt(3230);
|
||||
|
||||
/*golemCore = config.getBlock("Golem Core", 1481).getInt(1481);
|
||||
golemHead = config.getBlock("Golem Head", 1482).getInt(1482);*/
|
||||
//golemPedestal = config.getBlock("Golem Pedestal", 1483).getInt(1483);
|
||||
//redstoneBallRepeater = config.getBlock("Redstone Ball Repeater", 1483).getInt(1483);
|
||||
//netherOreBerry = config.getBlock("Ore Berry Nether", 1487).getInt(1487);
|
||||
|
||||
manual = config.getItem("Patterns and Misc", "Tinker's Manual", 14018).getInt(14018);
|
||||
blankPattern = config.getItem("Patterns and Misc", "Blank Patterns", 14019).getInt(14019);
|
||||
materials = config.getItem("Patterns and Misc", "Materials", 14020).getInt(14020);
|
||||
toolRod = config.getItem("Patterns and Misc", "Tool Rod", 14021).getInt(14021);
|
||||
toolShard = config.getItem("Patterns and Misc", "Tool Shard", 14022).getInt(14022);
|
||||
woodPattern = config.getItem("Patterns and Misc", "Wood Pattern", 14023).getInt(14023);
|
||||
metalPattern = config.getItem("Patterns and Misc", "Metal Pattern", 14024).getInt(14024);
|
||||
|
||||
pickaxeHead = config.getItem("Tool Parts", "Pickaxe Head", 14026).getInt(14026);
|
||||
shovelHead = config.getItem("Tool Parts", "Shovel Head", 14027).getInt(14027);
|
||||
axeHead = config.getItem("Tool Parts", "Axe Head", 14028).getInt(14028);
|
||||
hoeHead = config.getItem("Tool Parts", "Hoe Head", 14029).getInt(14029);
|
||||
|
||||
swordBlade = config.getItem("Tool Parts", "Sword Blade", 14030).getInt(14030);
|
||||
largeGuard = config.getItem("Tool Parts", "Large Guard", 14031).getInt(14031);
|
||||
medGuard = config.getItem("Tool Parts", "Medium Guard", 14032).getInt(14032);
|
||||
crossbar = config.getItem("Tool Parts", "Crossbar", 14033).getInt(14033);
|
||||
binding = config.getItem("Tool Parts", "Tool Binding", 14034).getInt(14034);
|
||||
|
||||
frypanHead = config.getItem("Tool Parts", "Frypan Head", 14035).getInt(14035);
|
||||
signHead = config.getItem("Tool Parts", "Sign Head", 14036).getInt(14036);
|
||||
|
||||
lumberHead = config.getItem("Tool Parts", "Lumber Axe Head", 14037).getInt(14037);
|
||||
knifeBlade = config.getItem("Tool Parts", "Knife Blade", 14038).getInt(14038);
|
||||
chiselHead = config.getItem("Tool Parts", "Chisel Head", 14039).getInt(14039);
|
||||
scytheBlade = config.getItem("Tool Parts", "Scythe Head", 14040).getInt(14040);
|
||||
toughBinding = config.getItem("Tool Parts", "Tough Binding", 14041).getInt(14041);
|
||||
toughRod = config.getItem("Tool Parts", "Tough Rod", 14042).getInt(14042);
|
||||
largeSwordBlade = config.getItem("Tool Parts", "Large Sword Blade", 14043).getInt(14043);
|
||||
largePlate = config.getItem("Tool Parts", "Large Plate", 14044).getInt(14044);
|
||||
excavatorHead = config.getItem("Tool Parts", "Excavator Head", 14045).getInt(14045);
|
||||
hammerHead = config.getItem("Tool Parts", "Hammer Head", 14046).getInt(14046);
|
||||
fullGuard = config.getItem("Tool Parts", "Full Guard", 14047).getInt(14047);
|
||||
bowstring = config.getItem("Tool Parts", "Bowstring", 14048).getInt(14048);
|
||||
arrowhead = config.getItem("Tool Parts", "Arrowhead", 14049).getInt(14049);
|
||||
fletching = config.getItem("Tool Parts", "Fletching", 14050).getInt(14050);
|
||||
|
||||
pickaxe = config.getItem("Tools", "Pickaxe", 14051).getInt(14051);
|
||||
shovel = config.getItem("Tools", "Shovel", 14052).getInt(14052);
|
||||
axe = config.getItem("Tools", "Axe", 14053).getInt(14053);
|
||||
hoe = config.getItem("Tools", "Hoe", 14054).getInt(14054);
|
||||
|
||||
broadsword = config.getItem("Tools", "Broadsword", 14055).getInt(14055);
|
||||
rapier = config.getItem("Tools", "Rapier", 14057).getInt(14057);
|
||||
longsword = config.getItem("Tools", "Longsword", 14056).getInt(14056);
|
||||
dagger = config.getItem("Tools", "Dagger", 14065).getInt(14065);
|
||||
|
||||
frypan = config.getItem("Tools", "Frying Pan", 14058).getInt(14058);
|
||||
battlesign = config.getItem("Tools", "Battlesign", 14059).getInt(14059);
|
||||
mattock = config.getItem("Tools", "Mattock", 14060).getInt(14060);
|
||||
lumberaxe = config.getItem("Tools", "Lumber Axe", 14061).getInt(14061);
|
||||
longbow = config.getItem("Tools", "Longbow", 14062).getInt(14062);
|
||||
shortbow = config.getItem("Tools", "Shortbow", 14063).getInt(14063);
|
||||
potionLauncher = config.getItem("Tools", "Potion Launcher", 14064).getInt(14064);
|
||||
|
||||
chisel = config.getItem("Tools", "Chisel", 14066).getInt(14066);
|
||||
scythe = config.getItem("Tools", "Scythe", 14067).getInt(14067);
|
||||
cleaver = config.getItem("Tools", "Cleaver", 14068).getInt(14068);
|
||||
excavator = config.getItem("Tools", "Excavator", 14069).getInt(14069);
|
||||
hammer = config.getItem("Tools", "Hammer", 14070).getInt(14070);
|
||||
battleaxe = config.getItem("Tools", "Battleaxe", 14071).getInt(14071);
|
||||
|
||||
cutlass = config.getItem("Tools", "Cutlass", 14072).getInt(14072);
|
||||
arrow = config.getItem("Tools", "Arrow", 14073).getInt(14073);
|
||||
|
||||
buckets = config.getItem("Patterns and Misc", "Buckets", 14101).getInt(14101);
|
||||
uselessItem = config.getItem("Patterns and Misc", "Title Icon", 14102).getInt(14102);
|
||||
slimefood = config.getItem("Patterns and Misc", "Strange Food", 14103).getInt(14103);
|
||||
oreChunks = config.getItem("Patterns and Misc", "Ore Chunks", 14104).getInt(14104);
|
||||
|
||||
heartCanister = config.getItem("Equipables", "Heart Canister", 14105).getInt(14105);
|
||||
heavyHelmet = config.getItem("Equipables", "Heavy Helmet", 14106).getInt(14106);
|
||||
diamondApple = config.getItem("Patterns and Misc", "Jeweled Apple", 14107).getInt(14107);
|
||||
heavyChestplate = config.getItem("Equipables", "Heavy Chestplate", 14108).getInt(14108);
|
||||
heavyPants = config.getItem("Equipables", "Heavy Pants", 14109).getInt(14109);
|
||||
heavyBoots = config.getItem("Equipables", "Heavy Boots", 14110).getInt(14110);
|
||||
glove = config.getItem("Equipables", "Gloves", 14111).getInt(14111);
|
||||
knapsack = config.getItem("Equipables", "Knapsack", 14112).getInt(14112);
|
||||
goldHead = config.getItem("Patterns and Misc", "Golden Head", 14113).getInt(14113);
|
||||
|
||||
boolean ic2 = true;
|
||||
boolean xycraft = true;
|
||||
try
|
||||
{
|
||||
Class c = Class.forName("ic2.core.IC2");
|
||||
ic2 = false;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
}
|
||||
try
|
||||
{
|
||||
Class c = Class.forName("soaryn.xycraft.core.XyCraft");
|
||||
xycraft = false;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
}
|
||||
|
||||
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);
|
||||
generateNetherOres = config.get("Worldgen Disabler", "Generate Cobalt and 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);
|
||||
|
||||
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);
|
||||
|
||||
copperuDensity = config.get("Worldgen", "Copper Underground Density", 2).getInt(2);
|
||||
tinuDensity = config.get("Worldgen", "Tin Underground Density", 2).getInt(2);
|
||||
aluminumuDensity = config.get("Worldgen", "Aluminum Underground Density", 3).getInt(3);
|
||||
netherDensity = config.get("Worldgen", "Nether Ores Density", 8).getInt(8);
|
||||
|
||||
copperuMinY = config.get("Worldgen", "Copper Underground Min Y", 20).getInt(20);
|
||||
copperuMaxY = config.get("Worldgen", "Copper Underground Max Y", 60).getInt(60);
|
||||
tinuMinY = config.get("Worldgen", "Tin Underground Min Y", 0).getInt(0);
|
||||
tinuMaxY = config.get("Worldgen", "Tin Underground Max Y", 40).getInt(40);
|
||||
aluminumuMinY = config.get("Worldgen", "Aluminum Underground Min Y", 0).getInt(0);
|
||||
aluminumuMaxY = config.get("Worldgen", "Aluminum Underground Max Y", 64).getInt(64);
|
||||
|
||||
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).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);
|
||||
|
||||
ironBushDensity = config.get("Worldgen", "Iron Bush Density", 1).getInt(1);
|
||||
goldBushDensity = config.get("Worldgen", "Gold Bush Density", 1).getInt(1);
|
||||
copperBushDensity = config.get("Worldgen", "Copper Bush Density", 2).getInt(2);
|
||||
tinBushDensity = config.get("Worldgen", "Tin Bush Density", 2).getInt(2);
|
||||
aluminumBushDensity = config.get("Worldgen", "Aluminum Bush Density", 2).getInt(2);
|
||||
silverBushDensity = config.get("Worldgen", "Silver Bush Density", 1).getInt(1);
|
||||
|
||||
ironBushRarity = config.get("Worldgen", "Iron Bush Rarity", 5).getInt(5);
|
||||
goldBushRarity = config.get("Worldgen", "Gold Bush Rarity", 8).getInt(8);
|
||||
copperBushRarity = config.get("Worldgen", "Copper Bush Rarity", 3).getInt(3);
|
||||
tinBushRarity = config.get("Worldgen", "Tin Bush Rarity", 3).getInt(3);
|
||||
aluminumBushRarity = config.get("Worldgen", "Aluminum Bush Rarity", 2).getInt(2);
|
||||
essenceBushRarity = config.get("Worldgen", "Essence Bush Rarity", 6).getInt(6);
|
||||
|
||||
copperBushMinY = config.get("Worldgen", "Copper Bush Min Y", 20).getInt(20);
|
||||
copperBushMaxY = config.get("Worldgen", "Copper Bush Max Y", 60).getInt(60);
|
||||
tinBushMinY = config.get("Worldgen", "Tin Bush Min Y", 0).getInt(0);
|
||||
tinBushMaxY = config.get("Worldgen", "Tin Bush Max Y", 40).getInt(40);
|
||||
aluminumBushMinY = config.get("Worldgen", "Aluminum Bush Min Y", 0).getInt(0);
|
||||
aluminumBushMaxY = config.get("Worldgen", "Aluminum Bush Max Y", 60).getInt(60);
|
||||
|
||||
seaLevel = config.get("general", "Sea level", 64).getInt(64);
|
||||
|
||||
enableHealthRegen = config.get("Ultra Hardcore Changes", "Passive Health Regen", true).getBoolean(true); //Check
|
||||
goldAppleRecipe = config.get("Ultra Hardcore Changes", "Change Crafting Recipes", false).getBoolean(false); //Check
|
||||
dropPlayerHeads = config.get("Ultra Hardcore Changes", "Players drop heads on death", false).getBoolean(false); //Check
|
||||
uhcGhastDrops = config.get("Ultra Hardcore Changes", "Change Ghast drops to Gold Ingots", false).getBoolean(false); //Check
|
||||
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).getBoolean(false); //Check
|
||||
|
||||
/* Save the configuration file */
|
||||
config.save();
|
||||
|
||||
File gt = new File(location + "/GregTech");
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
//Blocks
|
||||
public static int woodCrafter;
|
||||
public static int toolForge;
|
||||
public static int heldItemBlock;
|
||||
public static int ores;
|
||||
public static int lavaTank;
|
||||
public static int smeltery;
|
||||
public static int searedTable;
|
||||
public static int craftedSoil;
|
||||
public static int oreSlag;
|
||||
public static int oreGravel;
|
||||
public static int metalBlock;
|
||||
|
||||
public static int redstoneMachine;
|
||||
public static int dryingRack;
|
||||
|
||||
/*public static int golemCore;
|
||||
public static int golemHead;
|
||||
public static int golemPedestal;*/
|
||||
|
||||
//Crops
|
||||
public static int oreBerry;
|
||||
public static int oreBerrySecond;
|
||||
public static int netherOreBerry;
|
||||
|
||||
//Traps
|
||||
public static int landmine;
|
||||
public static int barricade;
|
||||
|
||||
//InfiBlocks
|
||||
public static int speedBlock;
|
||||
public static int glass;
|
||||
public static int glassPane;
|
||||
public static int stainedGlass;
|
||||
public static int stainedGlassClear;
|
||||
public static int stainedGlassClearPane;
|
||||
|
||||
//Crystalline
|
||||
public static int aggregator;
|
||||
public static int lightCrystalBase;
|
||||
|
||||
//Liquids
|
||||
public static int metalFlowing;
|
||||
public static int metalStill;
|
||||
|
||||
public static int moltenIron;
|
||||
public static int moltenGold;
|
||||
public static int moltenCopper;
|
||||
public static int moltenTin;
|
||||
public static int moltenAluminum;
|
||||
public static int moltenCobalt;
|
||||
public static int moltenArdite;
|
||||
public static int moltenBronze;
|
||||
public static int moltenAlubrass;
|
||||
public static int moltenManyullyn;
|
||||
public static int moltenAlumite;
|
||||
public static int moltenObsidian;
|
||||
public static int moltenSteel;
|
||||
public static int moltenGlass;
|
||||
public static int moltenStone;
|
||||
public static int moltenEmerald;
|
||||
public static int blood;
|
||||
public static int moltenSilver; //Thermal Expansion
|
||||
public static int moltenLead;
|
||||
public static int moltenNickel;
|
||||
public static int moltenShiny;
|
||||
public static int moltenInvar;
|
||||
public static int moltenElectrum;
|
||||
|
||||
//Decoration
|
||||
public static int stoneTorch;
|
||||
public static int multiBrick;
|
||||
public static int multiBrickFancy;
|
||||
public static int redstoneBallRepeater;
|
||||
public static int searedSlab;
|
||||
public static int speedSlab;
|
||||
|
||||
//Patterns and misc
|
||||
public static int blankPattern;
|
||||
public static int materials;
|
||||
public static int toolRod;
|
||||
public static int toolShard;
|
||||
public static int woodPattern;
|
||||
public static int metalPattern;
|
||||
|
||||
public static int manual;
|
||||
public static int buckets;
|
||||
public static int uselessItem;
|
||||
public static int oreChunks;
|
||||
|
||||
//Food
|
||||
public static int diamondApple;
|
||||
public static int slimefood;
|
||||
|
||||
//Tools
|
||||
public static int pickaxe;
|
||||
public static int shovel;
|
||||
public static int axe;
|
||||
public static int hoe;
|
||||
|
||||
public static int broadsword;
|
||||
public static int longsword;
|
||||
public static int rapier;
|
||||
public static int dagger;
|
||||
public static int cutlass;
|
||||
|
||||
public static int frypan;
|
||||
public static int battlesign;
|
||||
public static int longbow;
|
||||
public static int shortbow;
|
||||
public static int potionLauncher;
|
||||
public static int mattock;
|
||||
|
||||
public static int lumberaxe;
|
||||
public static int scythe;
|
||||
public static int cleaver;
|
||||
public static int excavator;
|
||||
public static int hammer;
|
||||
public static int battleaxe;
|
||||
|
||||
public static int chisel;
|
||||
public static int arrow;
|
||||
|
||||
//Tool parts
|
||||
public static int swordBlade;
|
||||
public static int largeGuard;
|
||||
public static int medGuard;
|
||||
public static int crossbar;
|
||||
public static int knifeBlade;
|
||||
public static int fullGuard;
|
||||
|
||||
public static int pickaxeHead;
|
||||
public static int axeHead;
|
||||
public static int shovelHead;
|
||||
public static int hoeHead;
|
||||
|
||||
public static int frypanHead;
|
||||
public static int signHead;
|
||||
public static int chiselHead;
|
||||
|
||||
public static int scytheBlade;
|
||||
public static int lumberHead;
|
||||
public static int largeSwordBlade;
|
||||
public static int excavatorHead;
|
||||
public static int hammerHead;
|
||||
|
||||
public static int binding;
|
||||
public static int toughBinding;
|
||||
public static int toughRod;
|
||||
public static int largePlate;
|
||||
|
||||
public static int bowstring;
|
||||
public static int arrowhead;
|
||||
public static int fletching;
|
||||
|
||||
//Wearables
|
||||
public static int heavyHelmet;
|
||||
public static int heavyChestplate;
|
||||
public static int heavyPants;
|
||||
public static int heavyBoots;
|
||||
public static int glove;
|
||||
public static int knapsack;
|
||||
|
||||
public static int heartCanister;
|
||||
|
||||
//Ore values
|
||||
public static boolean generateCopper;
|
||||
public static boolean generateTin;
|
||||
public static boolean generateAluminum;
|
||||
public static boolean generateNetherOres;
|
||||
|
||||
public static boolean generateIronSurface;
|
||||
public static boolean generateGoldSurface;
|
||||
public static boolean generateCopperSurface;
|
||||
public static boolean generateTinSurface;
|
||||
public static boolean generateAluminumSurface;
|
||||
public static boolean generateCobaltSurface;
|
||||
|
||||
public static boolean generateIronBush;
|
||||
public static boolean generateGoldBush;
|
||||
public static boolean generateCopperBush;
|
||||
public static boolean generateTinBush;
|
||||
public static boolean generateAluminumBush;
|
||||
public static boolean generateEssenceBush;
|
||||
|
||||
public static boolean addToVillages;
|
||||
|
||||
public static int copperuDensity;
|
||||
public static int tinuDensity;
|
||||
public static int aluminumuDensity;
|
||||
public static int netherDensity;
|
||||
|
||||
public static int ironsRarity;
|
||||
public static int goldsRarity;
|
||||
public static int coppersRarity;
|
||||
public static int tinsRarity;
|
||||
public static int aluminumsRarity;
|
||||
public static int cobaltsRarity;
|
||||
|
||||
public static int ironBushDensity;
|
||||
public static int goldBushDensity;
|
||||
public static int copperBushDensity;
|
||||
public static int tinBushDensity;
|
||||
public static int aluminumBushDensity;
|
||||
public static int silverBushDensity;
|
||||
|
||||
public static int ironBushRarity;
|
||||
public static int goldBushRarity;
|
||||
public static int copperBushRarity;
|
||||
public static int tinBushRarity;
|
||||
public static int aluminumBushRarity;
|
||||
public static int essenceBushRarity;
|
||||
|
||||
public static int copperuMinY;
|
||||
public static int copperuMaxY;
|
||||
public static int tinuMinY;
|
||||
public static int tinuMaxY;
|
||||
public static int aluminumuMinY;
|
||||
public static int aluminumuMaxY;
|
||||
|
||||
public static int copperBushMinY;
|
||||
public static int copperBushMaxY;
|
||||
public static int tinBushMinY;
|
||||
public static int tinBushMaxY;
|
||||
public static int aluminumBushMinY;
|
||||
public static int aluminumBushMaxY;
|
||||
|
||||
public static int seaLevel;
|
||||
|
||||
//Mobs
|
||||
public static boolean blueSlime;
|
||||
public static int blueSlimeWeight;
|
||||
|
||||
//Difficulty modifiers
|
||||
public static boolean keepHunger;
|
||||
public static boolean keepLevels;
|
||||
public static boolean clearWater;
|
||||
public static boolean voidFog;
|
||||
|
||||
public static boolean disableWoodTools;
|
||||
public static boolean disableStoneTools;
|
||||
public static boolean disableIronTools;
|
||||
public static boolean disableDiamondTools;
|
||||
public static boolean disableGoldTools;
|
||||
|
||||
public static boolean enableTWood;
|
||||
public static boolean enableTStone;
|
||||
public static boolean enableTCactus;
|
||||
public static boolean enableTBone;
|
||||
public static boolean enableTFlint;
|
||||
public static boolean enableTNetherrack;
|
||||
public static boolean enableTSlime;
|
||||
public static boolean enableTPaper;
|
||||
public static boolean enableTBlueSlime;
|
||||
|
||||
public static boolean craftMetalTools;
|
||||
public static boolean vanillaMetalBlocks;
|
||||
public static boolean removeVanillaToolRecipes;
|
||||
public static boolean harderBronze;
|
||||
public static boolean stencilTableCrafting;
|
||||
public static boolean miningLevelIncrease;
|
||||
public static boolean denyMattock;
|
||||
|
||||
//Ultra Hardcore modifiers
|
||||
public static boolean enableHealthRegen;
|
||||
public static boolean goldAppleRecipe;
|
||||
public static boolean dropPlayerHeads;
|
||||
public static boolean uhcGhastDrops;
|
||||
public static boolean worldBorder;
|
||||
public static int worldBorderSize;
|
||||
public static boolean freePatterns;
|
||||
public static int goldHead;
|
||||
|
||||
//Superfun
|
||||
public static boolean superfunWorld;
|
||||
public static boolean beginnerBook;
|
||||
|
||||
public static boolean gregtech;
|
||||
public static boolean lavaFortuneInteraction;
|
||||
public static boolean deGreg;
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
package tconstruct.util;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.CraftingManager;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.item.crafting.ShapedRecipes;
|
||||
import net.minecraft.item.crafting.ShapelessRecipes;
|
||||
|
||||
public class RecipeRemover
|
||||
{
|
||||
public static void removeShapedRecipes (List<ItemStack> removelist)
|
||||
{
|
||||
for (ItemStack stack : removelist)
|
||||
removeShapedRecipe(stack);
|
||||
}
|
||||
|
||||
public static void removeShapedRecipe (ItemStack resultItem)
|
||||
{
|
||||
List<IRecipe> recipes = CraftingManager.getInstance().getRecipeList();
|
||||
for (int i = 0; i < recipes.size(); i++)
|
||||
{
|
||||
IRecipe tmpRecipe = recipes.get(i);
|
||||
if (tmpRecipe instanceof ShapedRecipes)
|
||||
{
|
||||
ShapedRecipes recipe = (ShapedRecipes) tmpRecipe;
|
||||
ItemStack recipeResult = recipe.getRecipeOutput();
|
||||
|
||||
if (ItemStack.areItemStacksEqual(resultItem, recipeResult))
|
||||
{
|
||||
recipes.remove(i--);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void removeShapelessRecipe (ItemStack resultItem)
|
||||
{
|
||||
List<IRecipe> recipes = CraftingManager.getInstance().getRecipeList();
|
||||
for (int i = 0; i < recipes.size(); i++)
|
||||
{
|
||||
IRecipe tmpRecipe = recipes.get(i);
|
||||
if (tmpRecipe instanceof ShapelessRecipes)
|
||||
{
|
||||
ShapelessRecipes recipe = (ShapelessRecipes) tmpRecipe;
|
||||
ItemStack recipeResult = recipe.getRecipeOutput();
|
||||
|
||||
if (ItemStack.areItemStacksEqual(resultItem, recipeResult))
|
||||
{
|
||||
recipes.remove(i--);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package tconstruct.util;
|
||||
|
||||
import tconstruct.library.tools.AbilityHelper;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
public class SmelteryDamageSource extends DamageSource
|
||||
{
|
||||
public SmelteryDamageSource()
|
||||
{
|
||||
super("smeltery");
|
||||
}
|
||||
|
||||
public String getDeathMessage (EntityLiving par1EntityLiving)
|
||||
{
|
||||
String type = "";
|
||||
switch (AbilityHelper.random.nextInt(4))
|
||||
{
|
||||
case 0:
|
||||
type = "one.";
|
||||
break;
|
||||
case 1:
|
||||
type = "two.";
|
||||
break;
|
||||
case 2:
|
||||
type = "three.";
|
||||
break;
|
||||
case 3:
|
||||
type = "four.";
|
||||
break;
|
||||
}
|
||||
EntityLivingBase entityliving1 = par1EntityLiving.func_94060_bK();
|
||||
String s = "death." + type + this.damageType;
|
||||
String s1 = s + ".player";
|
||||
return entityliving1 != null && StatCollector.func_94522_b(s1) ? StatCollector.translateToLocalFormatted(s1,
|
||||
new Object[] { par1EntityLiving.getTranslatedEntityName(), entityliving1.getTranslatedEntityName() }) : StatCollector.translateToLocalFormatted(s,
|
||||
new Object[] { par1EntityLiving.getTranslatedEntityName() });
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package tconstruct.util;
|
||||
|
||||
import tconstruct.TConstruct;
|
||||
import tconstruct.common.TContent;
|
||||
import tconstruct.library.tools.AbilityHelper;
|
||||
import tconstruct.util.player.TPlayerStats;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import cpw.mods.fml.common.ICraftingHandler;
|
||||
|
||||
public class TCraftingHandler implements ICraftingHandler
|
||||
{
|
||||
|
||||
@Override
|
||||
public void onCrafting (EntityPlayer player, ItemStack item, IInventory craftMatrix)
|
||||
{
|
||||
if (!player.worldObj.isRemote)
|
||||
{
|
||||
int itemID = item.getItem().itemID;
|
||||
if (itemID == TContent.toolStationWood.blockID)
|
||||
{
|
||||
TPlayerStats stats = TConstruct.playerTracker.getPlayerStats(player.username);
|
||||
NBTTagCompound tags = player.getEntityData().getCompoundTag("TConstruct");
|
||||
if (!tags.getBoolean("materialManual") || !stats.materialManual)
|
||||
{
|
||||
stats.materialManual = true;
|
||||
tags.setBoolean("materialManual", true);
|
||||
AbilityHelper.spawnItemAtPlayer(player, new ItemStack(TContent.manualBook, 1, 1));
|
||||
}
|
||||
}
|
||||
if (itemID == TContent.smeltery.blockID || itemID == TContent.lavaTank.blockID)
|
||||
{
|
||||
TPlayerStats stats = TConstruct.playerTracker.getPlayerStats(player.username);
|
||||
NBTTagCompound tags = player.getEntityData().getCompoundTag("TConstruct");
|
||||
if (!tags.getBoolean("smelteryManual") || !stats.smelteryManual)
|
||||
{
|
||||
stats.smelteryManual = true;
|
||||
tags.setBoolean("smelteryManual", true);
|
||||
AbilityHelper.spawnItemAtPlayer(player, new ItemStack(TContent.manualBook, 1, 2));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSmelting (EntityPlayer player, ItemStack item)
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package tconstruct.util;
|
||||
|
||||
import tconstruct.items.TitleIcon;
|
||||
import net.minecraft.block.BlockDispenser;
|
||||
import net.minecraft.dispenser.BehaviorDefaultDispenseItem;
|
||||
import net.minecraft.dispenser.IBlockSource;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
|
||||
public class TDispenserBehaviorSpawnEgg extends BehaviorDefaultDispenseItem
|
||||
{
|
||||
/**
|
||||
* Dispense the specified stack, play the dispense sound and spawn particles.
|
||||
*/
|
||||
public ItemStack dispenseStack (IBlockSource par1IBlockSource, ItemStack par2ItemStack)
|
||||
{
|
||||
EnumFacing enumfacing = BlockDispenser.getFacing(par1IBlockSource.getBlockMetadata());
|
||||
double d0 = par1IBlockSource.getX() + (double) enumfacing.getFrontOffsetX();
|
||||
double d1 = (double) ((float) par1IBlockSource.getYInt() + 0.2F);
|
||||
double d2 = par1IBlockSource.getZ() + (double) enumfacing.getFrontOffsetZ();
|
||||
EntityLiving entity = TitleIcon.activateSpawnEgg(par2ItemStack, par1IBlockSource.getWorld(), d0, d1, d2, 0);
|
||||
|
||||
if (par2ItemStack.hasDisplayName())
|
||||
{
|
||||
((EntityLiving) entity).setCustomNameTag(par2ItemStack.getDisplayName());
|
||||
}
|
||||
|
||||
par2ItemStack.splitStack(1);
|
||||
return par2ItemStack;
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,171 @@
|
||||
package tconstruct.util.network;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.DataInputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import tconstruct.TConstruct;
|
||||
import tconstruct.blocks.logic.ToolForgeLogic;
|
||||
import tconstruct.blocks.logic.ToolStationLogic;
|
||||
import tconstruct.library.blocks.InventoryLogic;
|
||||
import tconstruct.skill.Skill;
|
||||
import tconstruct.skill.SkillRegistry;
|
||||
import tconstruct.util.player.TPlayerStats;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.network.INetworkManager;
|
||||
import net.minecraft.network.packet.Packet250CustomPayload;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.DimensionManager;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.network.IPacketHandler;
|
||||
import cpw.mods.fml.common.network.Player;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
|
||||
public class TPacketHandler implements IPacketHandler
|
||||
{
|
||||
|
||||
@Override
|
||||
public void onPacketData (INetworkManager manager, Packet250CustomPayload packet, Player player)
|
||||
{
|
||||
Side side = FMLCommonHandler.instance().getEffectiveSide();
|
||||
|
||||
if (packet.channel.equals("TConstruct"))
|
||||
{
|
||||
if (side == Side.SERVER)
|
||||
handleServerPacket(packet, (EntityPlayerMP) player);
|
||||
else
|
||||
handleClientPacket(packet, (EntityPlayer) player);
|
||||
}
|
||||
}
|
||||
|
||||
void handleClientPacket (Packet250CustomPayload packet, EntityPlayer player)
|
||||
{
|
||||
DataInputStream inputStream = new DataInputStream(new ByteArrayInputStream(packet.data));
|
||||
|
||||
byte packetID;
|
||||
|
||||
try
|
||||
{
|
||||
packetID = inputStream.readByte();
|
||||
if (packetID == 1)
|
||||
{
|
||||
TPlayerStats stats = TConstruct.playerTracker.getPlayerStats(player.username);
|
||||
stats.skillList = new ArrayList<Skill>();
|
||||
int size = inputStream.readInt();
|
||||
for (int i = 0; i < size; i++)
|
||||
{
|
||||
Skill skill = SkillRegistry.skillMapping.get(inputStream.readInt()).copy();
|
||||
skill.setActive(inputStream.readBoolean());
|
||||
stats.skillList.add(skill);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
System.out.println("Failed at reading client packet for TConstruct.");
|
||||
e.printStackTrace();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void handleServerPacket (Packet250CustomPayload packet, EntityPlayerMP player)
|
||||
{
|
||||
DataInputStream inputStream = new DataInputStream(new ByteArrayInputStream(packet.data));
|
||||
|
||||
byte packetID;
|
||||
|
||||
try
|
||||
{
|
||||
packetID = inputStream.readByte();
|
||||
|
||||
if (packetID == 1) //Tool Station
|
||||
{
|
||||
int dimension = inputStream.readInt();
|
||||
World world = DimensionManager.getWorld(dimension);
|
||||
int x = inputStream.readInt();
|
||||
int y = inputStream.readInt();
|
||||
int z = inputStream.readInt();
|
||||
TileEntity te = world.getBlockTileEntity(x, y, z);
|
||||
|
||||
String toolName = inputStream.readUTF();
|
||||
if (te instanceof ToolStationLogic)
|
||||
{
|
||||
((ToolStationLogic) te).setToolname(toolName);
|
||||
}
|
||||
if (te instanceof ToolForgeLogic)
|
||||
{
|
||||
((ToolForgeLogic) te).setToolname(toolName);
|
||||
}
|
||||
}
|
||||
else if (packetID == 2) //Stencil Table
|
||||
{
|
||||
int dimension = inputStream.readInt();
|
||||
World world = DimensionManager.getWorld(dimension);
|
||||
int x = inputStream.readInt();
|
||||
int y = inputStream.readInt();
|
||||
int z = inputStream.readInt();
|
||||
TileEntity te = world.getBlockTileEntity(x, y, z);
|
||||
|
||||
Short itemID = inputStream.readShort();
|
||||
Short itemDamage = inputStream.readShort();
|
||||
if (te instanceof InventoryLogic)
|
||||
{
|
||||
((InventoryLogic) te).setInventorySlotContents(1, new ItemStack(itemID, 1, itemDamage));
|
||||
}
|
||||
}
|
||||
|
||||
else if (packetID == 3) //Armor
|
||||
{
|
||||
//String user = inputStream.readUTF();
|
||||
//EntityPlayer player = TConstruct.playerTracker.getEntityPlayer(user);
|
||||
switch (inputStream.readByte())
|
||||
{
|
||||
case 0:
|
||||
player.openGui(TConstruct.instance, TConstruct.proxy.inventoryGui, player.worldObj, (int) player.posX, (int) player.posY, (int) player.posZ);
|
||||
break;
|
||||
case 1:
|
||||
player.openGui(TConstruct.instance, TConstruct.proxy.armorGuiID, player.worldObj, (int) player.posX, (int) player.posY, (int) player.posZ);
|
||||
break;
|
||||
case 2:
|
||||
player.openGui(TConstruct.instance, TConstruct.proxy.knapsackGuiID, player.worldObj, (int) player.posX, (int) player.posY, (int) player.posZ);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
else if (packetID == 4) //Active Skills
|
||||
{
|
||||
Byte id = inputStream.readByte();
|
||||
TConstruct.playerTracker.activateSkill(player, id);
|
||||
}
|
||||
|
||||
else if (packetID == 10) //Double jump
|
||||
{
|
||||
//String user = inputStream.readUTF();
|
||||
//EntityPlayer player = TConstruct.playerTracker.getEntityPlayer(user);
|
||||
player.fallDistance = 0;
|
||||
}
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
System.out.println("Failed at reading server packet for TConstruct.");
|
||||
e.printStackTrace();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Entity getEntity (World world, int id)
|
||||
{
|
||||
for (Object o : world.loadedEntityList)
|
||||
{
|
||||
if (((Entity) o).entityId == id)
|
||||
return (Entity) o;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,236 @@
|
||||
package tconstruct.util.player;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
|
||||
import tconstruct.TConstruct;
|
||||
import tconstruct.common.TContent;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
|
||||
public class ArmorExtended implements IInventory
|
||||
{
|
||||
public ItemStack[] inventory = new ItemStack[7];
|
||||
public WeakReference<EntityPlayer> parent;
|
||||
|
||||
public void init (EntityPlayer player)
|
||||
{
|
||||
parent = new WeakReference<EntityPlayer>(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSizeInventory ()
|
||||
{
|
||||
return inventory.length;
|
||||
}
|
||||
|
||||
public boolean isStackInSlot (int slot)
|
||||
{
|
||||
return inventory[slot] != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlot (int slot)
|
||||
{
|
||||
return inventory[slot];
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack decrStackSize (int slot, int quantity)
|
||||
{
|
||||
if (inventory[slot] != null)
|
||||
{
|
||||
//System.out.println("Took something from slot " + slot);
|
||||
if (inventory[slot].stackSize <= quantity)
|
||||
{
|
||||
ItemStack stack = inventory[slot];
|
||||
inventory[slot] = null;
|
||||
return stack;
|
||||
}
|
||||
ItemStack split = inventory[slot].splitStack(quantity);
|
||||
if (inventory[slot].stackSize == 0)
|
||||
{
|
||||
inventory[slot] = null;
|
||||
}
|
||||
EntityPlayer player = parent.get();
|
||||
TPlayerStats stats = TConstruct.playerTracker.getPlayerStats(player.username);
|
||||
recalculateHealth(player, stats);
|
||||
return split;
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlotOnClosing (int slot)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInventorySlotContents (int slot, ItemStack itemstack)
|
||||
{
|
||||
inventory[slot] = itemstack;
|
||||
//System.out.println("Changed slot " + slot + " on side " + FMLCommonHandler.instance().getEffectiveSide());
|
||||
if (itemstack != null && itemstack.stackSize > getInventoryStackLimit())
|
||||
{
|
||||
itemstack.stackSize = getInventoryStackLimit();
|
||||
}
|
||||
|
||||
EntityPlayer player = parent.get();
|
||||
TPlayerStats stats = TConstruct.playerTracker.getPlayerStats(player.username);
|
||||
recalculateHealth(player, stats);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInvName ()
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInvNameLocalized ()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInventoryStackLimit ()
|
||||
{
|
||||
return 64;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInventoryChanged ()
|
||||
{
|
||||
EntityPlayer player = parent.get();
|
||||
TPlayerStats stats = TConstruct.playerTracker.getPlayerStats(player.username);
|
||||
//recalculateSkills(player, stats);
|
||||
recalculateHealth(player, stats);
|
||||
|
||||
/*if (inventory[2] == null && stats.knapsack != null)
|
||||
{
|
||||
stats.knapsack.unequipItems();
|
||||
}*/
|
||||
}
|
||||
|
||||
/*public void recalculateSkills(EntityPlayer player, TPlayerStats stats)
|
||||
{
|
||||
if (inventory[1] != null && inventory[1].getItem() == TContent.glove)
|
||||
{
|
||||
if (stats.skillList.size() < 1)
|
||||
{
|
||||
try
|
||||
{
|
||||
stats.skillList.add(SkillRegistry.skills.get("Wall Building").copy());
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (stats.skillList.size() > 0)
|
||||
{
|
||||
stats.skillList.remove(0);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
public void recalculateHealth (EntityPlayer player, TPlayerStats stats)
|
||||
{
|
||||
if (inventory[6] != null && inventory[6].getItem() == TContent.heartCanister)
|
||||
{
|
||||
ItemStack stack = inventory[6];
|
||||
int meta = stack.getItemDamage();
|
||||
if (meta == 2)
|
||||
{
|
||||
int bonusHP = stack.stackSize * 2;
|
||||
stats.bonusHealth = bonusHP;
|
||||
//player.maxHealth = 20 + bonusHP;
|
||||
}
|
||||
}
|
||||
else if (parent != null && parent.get() != null)
|
||||
{
|
||||
//parent.get().maxHealth = 20;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUseableByPlayer (EntityPlayer entityplayer)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public void openChest ()
|
||||
{
|
||||
}
|
||||
|
||||
public void closeChest ()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot (int slot, ItemStack itemstack)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Save/Load */
|
||||
public void saveToNBT (EntityPlayer entityplayer)
|
||||
{
|
||||
NBTTagCompound tags = entityplayer.getEntityData();
|
||||
NBTTagList tagList = new NBTTagList();
|
||||
NBTTagCompound invSlot;
|
||||
|
||||
for (int i = 0; i < this.inventory.length; ++i)
|
||||
{
|
||||
if (this.inventory[i] != null)
|
||||
{
|
||||
invSlot = new NBTTagCompound();
|
||||
invSlot.setByte("Slot", (byte) i);
|
||||
this.inventory[i].writeToNBT(invSlot);
|
||||
tagList.appendTag(invSlot);
|
||||
}
|
||||
}
|
||||
|
||||
tags.setTag("TConstruct.Inventory", tagList);
|
||||
}
|
||||
|
||||
public void readFromNBT (EntityPlayer entityplayer)
|
||||
{
|
||||
NBTTagCompound tags = entityplayer.getEntityData();
|
||||
NBTTagList tagList = tags.getTagList("TConstruct.Inventory");
|
||||
for (int i = 0; i < tagList.tagCount(); ++i)
|
||||
{
|
||||
NBTTagCompound nbttagcompound = (NBTTagCompound) tagList.tagAt(i);
|
||||
int j = nbttagcompound.getByte("Slot") & 255;
|
||||
ItemStack itemstack = ItemStack.loadItemStackFromNBT(nbttagcompound);
|
||||
|
||||
if (itemstack != null)
|
||||
{
|
||||
this.inventory[j] = itemstack;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void dropItems ()
|
||||
{
|
||||
EntityPlayer player = parent.get();
|
||||
for (int i = 0; i < 4; ++i)
|
||||
{
|
||||
if (this.inventory[i] != null)
|
||||
{
|
||||
player.dropPlayerItemWithRandomChoice(this.inventory[i], true);
|
||||
this.inventory[i] = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package tconstruct.util.player;
|
||||
|
||||
|
||||
public class ArmorExtendedClient extends ArmorExtended
|
||||
{
|
||||
/*public void recalculateSkills(EntityPlayer player, TPlayerStats stats)
|
||||
{
|
||||
System.out.println("Client skills");
|
||||
if (inventory[1] != null && inventory[1].getItem() == TContent.glove)
|
||||
{
|
||||
if (TProxyClient.skillList.size() < 1)
|
||||
{
|
||||
try
|
||||
{
|
||||
TProxyClient.skillList.add(SkillRegistry.skills.get("Wall Building").copy());
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (TProxyClient.skillList.size() > 0)
|
||||
{
|
||||
TProxyClient.skillList.remove(0);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
@@ -0,0 +1,197 @@
|
||||
package tconstruct.util.player;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
|
||||
public class KnapsackInventory implements IInventory
|
||||
{
|
||||
public ItemStack[] inventory = new ItemStack[27];
|
||||
public WeakReference<EntityPlayer> parent;
|
||||
|
||||
public void init (EntityPlayer player)
|
||||
{
|
||||
parent = new WeakReference<EntityPlayer>(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlot (int slot)
|
||||
{
|
||||
return inventory[slot];
|
||||
}
|
||||
|
||||
public boolean isStackInSlot (int slot)
|
||||
{
|
||||
return inventory[slot] != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSizeInventory ()
|
||||
{
|
||||
return inventory.length;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInventoryStackLimit ()
|
||||
{
|
||||
return 64;
|
||||
}
|
||||
|
||||
public boolean canDropInventorySlot (int slot)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInventorySlotContents (int slot, ItemStack itemstack)
|
||||
{
|
||||
inventory[slot] = itemstack;
|
||||
if (itemstack != null && itemstack.stackSize > getInventoryStackLimit())
|
||||
{
|
||||
itemstack.stackSize = getInventoryStackLimit();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack decrStackSize (int slot, int quantity)
|
||||
{
|
||||
if (inventory[slot] != null)
|
||||
{
|
||||
if (inventory[slot].stackSize <= quantity)
|
||||
{
|
||||
ItemStack stack = inventory[slot];
|
||||
inventory[slot] = null;
|
||||
return stack;
|
||||
}
|
||||
ItemStack split = inventory[slot].splitStack(quantity);
|
||||
if (inventory[slot].stackSize == 0)
|
||||
{
|
||||
inventory[slot] = null;
|
||||
}
|
||||
return split;
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInvName ()
|
||||
{
|
||||
return "tconstruct.knapsack";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInvNameLocalized ()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInventoryChanged ()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public ItemStack getStackInSlotOnClosing (int slot)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public void openChest ()
|
||||
{
|
||||
}
|
||||
|
||||
public void closeChest ()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot (int i, ItemStack itemstack)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUseableByPlayer (EntityPlayer entityplayer)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Save/Load */
|
||||
public void saveToNBT (EntityPlayer entityplayer)
|
||||
{
|
||||
NBTTagCompound tags = entityplayer.getEntityData();
|
||||
NBTTagList tagList = new NBTTagList();
|
||||
NBTTagCompound invSlot;
|
||||
|
||||
for (int i = 0; i < this.inventory.length; ++i)
|
||||
{
|
||||
if (this.inventory[i] != null)
|
||||
{
|
||||
invSlot = new NBTTagCompound();
|
||||
invSlot.setByte("Slot", (byte) i);
|
||||
this.inventory[i].writeToNBT(invSlot);
|
||||
tagList.appendTag(invSlot);
|
||||
}
|
||||
}
|
||||
|
||||
tags.setTag("TConstruct.Knapsack", tagList);
|
||||
}
|
||||
|
||||
public void readFromNBT (EntityPlayer entityplayer)
|
||||
{
|
||||
NBTTagCompound tags = entityplayer.getEntityData();
|
||||
NBTTagList tagList = tags.getTagList("TConstruct.Knapsack");
|
||||
for (int i = 0; i < tagList.tagCount(); ++i)
|
||||
{
|
||||
NBTTagCompound nbttagcompound = (NBTTagCompound) tagList.tagAt(i);
|
||||
int j = nbttagcompound.getByte("Slot") & 255;
|
||||
ItemStack itemstack = ItemStack.loadItemStackFromNBT(nbttagcompound);
|
||||
|
||||
if (itemstack != null)
|
||||
{
|
||||
this.inventory[j] = itemstack;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void dropItems ()
|
||||
{
|
||||
EntityPlayer player = parent.get();
|
||||
for (int i = 0; i < inventory.length; ++i)
|
||||
{
|
||||
if (this.inventory[i] != null)
|
||||
{
|
||||
player.dropPlayerItemWithRandomChoice(this.inventory[i], true);
|
||||
this.inventory[i] = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void unequipItems ()
|
||||
{
|
||||
EntityPlayer player = parent.get();
|
||||
for (int i = 0; i < inventory.length; ++i)
|
||||
{
|
||||
if (this.inventory[i] != null)
|
||||
{
|
||||
dropItemEntity(player, inventory[i]);
|
||||
this.inventory[i] = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void dropItemEntity (Entity dropper, ItemStack dropStack)
|
||||
{
|
||||
EntityItem entityitem = new EntityItem(dropper.worldObj, dropper.posX, dropper.posY, dropper.posZ, dropStack);
|
||||
dropper.worldObj.spawnEntityInWorld(entityitem);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,349 @@
|
||||
package tconstruct.util.player;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import tconstruct.common.TContent;
|
||||
import tconstruct.library.tools.AbilityHelper;
|
||||
import tconstruct.skill.Skill;
|
||||
import tconstruct.util.PHConstruct;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EnumEntitySize;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.packet.Packet250CustomPayload;
|
||||
import net.minecraftforge.event.ForgeSubscribe;
|
||||
import net.minecraftforge.event.entity.living.LivingFallEvent;
|
||||
import net.minecraftforge.event.entity.player.PlayerDropsEvent;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.IPlayerTracker;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.network.PacketDispatcher;
|
||||
import cpw.mods.fml.common.network.Player;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
|
||||
public class TPlayerHandler implements IPlayerTracker
|
||||
{
|
||||
/* Player */
|
||||
//public int hunger;
|
||||
public ConcurrentHashMap<String, TPlayerStats> playerStats = new ConcurrentHashMap<String, TPlayerStats>();
|
||||
|
||||
@Override
|
||||
public void onPlayerLogin (EntityPlayer entityplayer)
|
||||
{
|
||||
//System.out.println("Player: "+entityplayer);
|
||||
//Lookup player
|
||||
/*TFoodStats food = new TFoodStats();
|
||||
food.readStats(entityplayer.foodStats);
|
||||
entityplayer.foodStats = food*/;
|
||||
NBTTagCompound tags = entityplayer.getEntityData();
|
||||
if (!tags.hasKey("TConstruct"))
|
||||
{
|
||||
tags.setCompoundTag("TConstruct", new NBTTagCompound());
|
||||
}
|
||||
TPlayerStats stats = new TPlayerStats();
|
||||
stats.player = new WeakReference<EntityPlayer>(entityplayer);
|
||||
stats.armor = new ArmorExtended();
|
||||
stats.armor.init(entityplayer);
|
||||
stats.armor.readFromNBT(entityplayer);
|
||||
|
||||
stats.knapsack = new KnapsackInventory();
|
||||
stats.knapsack.init(entityplayer);
|
||||
stats.knapsack.readFromNBT(entityplayer);
|
||||
|
||||
stats.level = entityplayer.experienceLevel;
|
||||
stats.hunger = entityplayer.getFoodStats().getFoodLevel();
|
||||
stats.beginnerManual = tags.getCompoundTag("TConstruct").getBoolean("beginnerManual");
|
||||
stats.materialManual = tags.getCompoundTag("TConstruct").getBoolean("materialManual");
|
||||
stats.smelteryManual = tags.getCompoundTag("TConstruct").getBoolean("smelteryManual");
|
||||
if (!stats.beginnerManual)
|
||||
{
|
||||
stats.beginnerManual = true;
|
||||
tags.getCompoundTag("TConstruct").setBoolean("beginnerManual", true);
|
||||
if (PHConstruct.beginnerBook)
|
||||
{
|
||||
ItemStack diary = new ItemStack(TContent.manualBook);
|
||||
if (!entityplayer.inventory.addItemStackToInventory(diary))
|
||||
{
|
||||
AbilityHelper.spawnItemAtPlayer(entityplayer, diary);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stats.skillList = new ArrayList<Skill>();
|
||||
//stats.armor.recalculateSkills(entityplayer, stats);
|
||||
|
||||
playerStats.put(entityplayer.username, stats);
|
||||
|
||||
if (PHConstruct.gregtech)
|
||||
{
|
||||
PHConstruct.gregtech = false;
|
||||
if (PHConstruct.lavaFortuneInteraction)
|
||||
{
|
||||
entityplayer.addChatMessage("Warning: Cross-mod Exploit Present!");
|
||||
entityplayer.addChatMessage("Solution 1: Disable Reverse Smelting recipes from GregTech.");
|
||||
entityplayer.addChatMessage("Solution 2: Disable Auto-Smelt/Fortune interaction from TConstruct.");
|
||||
}
|
||||
}
|
||||
|
||||
if (Loader.isModLoaded("GregTech_Addon") || Loader.isModLoaded("GregTech-Addon"))
|
||||
{
|
||||
if (entityplayer.username.equals("GregoriousT") || entityplayer.username.equals("gregorioust"))
|
||||
entityplayer.addChatMessage("Quit being a dick.");
|
||||
else
|
||||
{
|
||||
entityplayer.addChatMessage("\u00A74!!!WARNING!!! \u00A7fGREGTECH PRESENT!! VANILLA MINECRAFT MAY BE IRREPARABLY DAMAGED");
|
||||
entityplayer.addChatMessage("\u00A74!!!WARNING!!! \u00A7fGREGTECH PRESENT!! MODS MAY NOT FUNCTION PROPERLY");
|
||||
}
|
||||
}
|
||||
|
||||
updatePlayerInventory(entityplayer, stats);
|
||||
//sendSkills(entityplayer, stats);
|
||||
}
|
||||
|
||||
void updatePlayerInventory (EntityPlayer entityplayer, TPlayerStats stats)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void sendSkills (EntityPlayer entityplayer, TPlayerStats stats)
|
||||
{
|
||||
ByteArrayOutputStream bos = new ByteArrayOutputStream(8);
|
||||
DataOutputStream outputStream = new DataOutputStream(bos);
|
||||
List<Skill> skills = stats.skillList;
|
||||
|
||||
try
|
||||
{
|
||||
outputStream.writeByte(1);
|
||||
outputStream.writeInt(skills.size());
|
||||
|
||||
for (Skill skill : stats.skillList)
|
||||
{
|
||||
outputStream.writeInt(skill.getSkillID());
|
||||
outputStream.writeBoolean(skill.getActive());
|
||||
}
|
||||
//outputStream.writeByte(key);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ex.printStackTrace();
|
||||
}
|
||||
|
||||
updateClientPlayer(bos, entityplayer);
|
||||
}
|
||||
|
||||
void updateClientPlayer (ByteArrayOutputStream bos, EntityPlayer player)
|
||||
{
|
||||
Packet250CustomPayload packet = new Packet250CustomPayload();
|
||||
packet.channel = "TConstruct";
|
||||
packet.data = bos.toByteArray();
|
||||
packet.length = bos.size();
|
||||
|
||||
PacketDispatcher.sendPacketToPlayer(packet, (Player) player);
|
||||
}
|
||||
|
||||
public void activateSkill (EntityPlayer player, int slot)
|
||||
{
|
||||
TPlayerStats stats = getPlayerStats(player.username);
|
||||
if (stats.skillList.size() > slot)
|
||||
{
|
||||
Skill skill = stats.skillList.get(slot);
|
||||
if (skill != null)
|
||||
{
|
||||
skill.activate(player, player.worldObj);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlayerLogout (EntityPlayer entityplayer)
|
||||
{
|
||||
savePlayerStats(entityplayer, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlayerChangedDimension (EntityPlayer entityplayer)
|
||||
{
|
||||
savePlayerStats(entityplayer, false);
|
||||
}
|
||||
|
||||
void savePlayerStats (EntityPlayer player, boolean clean)
|
||||
{
|
||||
if (player != null)
|
||||
{
|
||||
TPlayerStats stats = getPlayerStats(player.username);
|
||||
if (stats != null && stats.armor != null)
|
||||
{
|
||||
stats.armor.saveToNBT(player);
|
||||
stats.knapsack.saveToNBT(player);
|
||||
if (clean)
|
||||
playerStats.remove(player.username);
|
||||
}
|
||||
else
|
||||
//Revalidate all players
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlayerRespawn (EntityPlayer entityplayer)
|
||||
{
|
||||
//Boom!
|
||||
TPlayerStats stats = getPlayerStats(entityplayer.username);
|
||||
stats.player = new WeakReference<EntityPlayer>(entityplayer);
|
||||
stats.armor.recalculateHealth(entityplayer, stats);
|
||||
|
||||
/*TFoodStats food = new TFoodStats();
|
||||
entityplayer.foodStats = food;*/
|
||||
|
||||
if (PHConstruct.keepLevels)
|
||||
entityplayer.experienceLevel = stats.level;
|
||||
if (PHConstruct.keepHunger)
|
||||
entityplayer.getFoodStats().addStats(-1 * (20 - stats.hunger), 0);
|
||||
NBTTagCompound tags = entityplayer.getEntityData();
|
||||
NBTTagCompound tTag = new NBTTagCompound();
|
||||
tTag.setBoolean("beginnerManual", stats.beginnerManual);
|
||||
tTag.setBoolean("materialManual", stats.materialManual);
|
||||
tTag.setBoolean("smelteryManual", stats.smelteryManual);
|
||||
tags.setCompoundTag("TConstruct", tTag);
|
||||
|
||||
Side side = FMLCommonHandler.instance().getEffectiveSide();
|
||||
if (side == Side.CLIENT)
|
||||
{
|
||||
//TProxyClient.controlInstance.resetControls();
|
||||
if (PHConstruct.keepHunger)
|
||||
entityplayer.getFoodStats().setFoodLevel(stats.hunger);
|
||||
}
|
||||
}
|
||||
|
||||
@ForgeSubscribe
|
||||
public void livingFall (LivingFallEvent evt) //Only for negating fall damage
|
||||
{
|
||||
if (evt.entityLiving instanceof EntityPlayer)
|
||||
{
|
||||
evt.distance -= 1;
|
||||
}
|
||||
}
|
||||
|
||||
/*@ForgeSubscribe
|
||||
public void livingUpdate (LivingUpdateEvent evt)
|
||||
{
|
||||
Side side = FMLCommonHandler.instance().getEffectiveSide();
|
||||
if (side == Side.CLIENT && evt.entityLiving instanceof EntityPlayer)
|
||||
{
|
||||
EntityPlayer player = (EntityPlayer) evt.entityLiving;
|
||||
TPlayerStats stats = playerStats.get(player.username);
|
||||
if (player.onGround != stats.prevOnGround)
|
||||
{
|
||||
if (player.onGround)// && -stats.prevMotionY > 0.1)
|
||||
//player.motionY = 0.5;
|
||||
player.motionY = -stats.prevMotionY * 0.8;
|
||||
//player.motionY *= -1.2;
|
||||
stats.prevOnGround = player.onGround;
|
||||
//if ()
|
||||
|
||||
//System.out.println("Fall: "+player.fallDistance);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
@ForgeSubscribe
|
||||
public void playerDrops (PlayerDropsEvent evt)
|
||||
{
|
||||
TPlayerStats stats = getPlayerStats(evt.entityPlayer.username);
|
||||
stats.level = evt.entityPlayer.experienceLevel / 2;
|
||||
//stats.health = 20;
|
||||
int hunger = evt.entityPlayer.getFoodStats().getFoodLevel();
|
||||
if (hunger < 6)
|
||||
stats.hunger = 6;
|
||||
else
|
||||
stats.hunger = evt.entityPlayer.getFoodStats().getFoodLevel();
|
||||
}
|
||||
|
||||
/* Find the right player */
|
||||
public TPlayerStats getPlayerStats (String username)
|
||||
{
|
||||
TPlayerStats stats = playerStats.get(username);
|
||||
//System.out.println("Stats: "+stats);
|
||||
if (stats == null)
|
||||
{
|
||||
stats = new TPlayerStats();
|
||||
playerStats.put(username, stats);
|
||||
}
|
||||
return stats;
|
||||
}
|
||||
|
||||
public EntityPlayer getEntityPlayer (String username)
|
||||
{
|
||||
TPlayerStats stats = playerStats.get(username);
|
||||
if (stats == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
else
|
||||
{
|
||||
return stats.player.get();
|
||||
}
|
||||
}
|
||||
|
||||
/* Modify Player */
|
||||
public void updateSize (String user, float offset)
|
||||
{
|
||||
/*EntityPlayer player = getEntityPlayer(user);
|
||||
setEntitySize(0.6F, offset, player);
|
||||
player.yOffset = offset - 0.18f;*/
|
||||
}
|
||||
|
||||
public static void setEntitySize (float width, float height, Entity entity)
|
||||
{
|
||||
//System.out.println("Size: " + height);
|
||||
if (width != entity.width || height != entity.height)
|
||||
{
|
||||
entity.width = width;
|
||||
entity.height = height;
|
||||
entity.boundingBox.maxX = entity.boundingBox.minX + (double) entity.width;
|
||||
entity.boundingBox.maxZ = entity.boundingBox.minZ + (double) entity.width;
|
||||
entity.boundingBox.maxY = entity.boundingBox.minY + (double) entity.height;
|
||||
}
|
||||
|
||||
float que = width % 2.0F;
|
||||
|
||||
if ((double) que < 0.375D)
|
||||
{
|
||||
entity.myEntitySize = EnumEntitySize.SIZE_1;
|
||||
}
|
||||
else if ((double) que < 0.75D)
|
||||
{
|
||||
entity.myEntitySize = EnumEntitySize.SIZE_2;
|
||||
}
|
||||
else if ((double) que < 1.0D)
|
||||
{
|
||||
entity.myEntitySize = EnumEntitySize.SIZE_3;
|
||||
}
|
||||
else if ((double) que < 1.375D)
|
||||
{
|
||||
entity.myEntitySize = EnumEntitySize.SIZE_4;
|
||||
}
|
||||
else if ((double) que < 1.75D)
|
||||
{
|
||||
entity.myEntitySize = EnumEntitySize.SIZE_5;
|
||||
}
|
||||
else
|
||||
{
|
||||
entity.myEntitySize = EnumEntitySize.SIZE_6;
|
||||
}
|
||||
//entity.yOffset = height;
|
||||
}
|
||||
|
||||
Random rand = new Random();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package tconstruct.util.player;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.List;
|
||||
|
||||
import tconstruct.skill.Skill;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
public class TPlayerStats
|
||||
{
|
||||
public WeakReference<EntityPlayer> player;
|
||||
public int level;
|
||||
public int levelHealth;
|
||||
public int bonusHealth;
|
||||
public int hunger;
|
||||
public boolean beginnerManual;
|
||||
public boolean materialManual;
|
||||
public boolean smelteryManual;
|
||||
public ArmorExtended armor;
|
||||
public KnapsackInventory knapsack;
|
||||
public List<Skill> skillList;
|
||||
}
|
||||
Reference in new issue
Block a user