diff --git a/resources/tinkertextures/blocks/castingtable_bottom.png b/resources/tinkertextures/blocks/castingtable_bottom.png new file mode 100644 index 00000000..f6f554ad Binary files /dev/null and b/resources/tinkertextures/blocks/castingtable_bottom.png differ diff --git a/resources/tinkertextures/blocks/castingtable_side.png b/resources/tinkertextures/blocks/castingtable_side.png new file mode 100644 index 00000000..c428b648 Binary files /dev/null and b/resources/tinkertextures/blocks/castingtable_side.png differ diff --git a/resources/tinkertextures/blocks/castingtable_top.png b/resources/tinkertextures/blocks/castingtable_top.png new file mode 100644 index 00000000..cd18bc66 Binary files /dev/null and b/resources/tinkertextures/blocks/castingtable_top.png differ diff --git a/resources/tinkertextures/blocks/compressed_alubrass.png b/resources/tinkertextures/blocks/compressed_alubrass.png new file mode 100644 index 00000000..9f76af18 Binary files /dev/null and b/resources/tinkertextures/blocks/compressed_alubrass.png differ diff --git a/resources/tinkertextures/blocks/compressed_aluminum.png b/resources/tinkertextures/blocks/compressed_aluminum.png new file mode 100644 index 00000000..17a4720f Binary files /dev/null and b/resources/tinkertextures/blocks/compressed_aluminum.png differ diff --git a/resources/tinkertextures/blocks/compressed_alumite.png b/resources/tinkertextures/blocks/compressed_alumite.png new file mode 100644 index 00000000..475b8b7d Binary files /dev/null and b/resources/tinkertextures/blocks/compressed_alumite.png differ diff --git a/resources/tinkertextures/blocks/compressed_ardite.png b/resources/tinkertextures/blocks/compressed_ardite.png new file mode 100644 index 00000000..dea37435 Binary files /dev/null and b/resources/tinkertextures/blocks/compressed_ardite.png differ diff --git a/resources/tinkertextures/blocks/compressed_bronze.png b/resources/tinkertextures/blocks/compressed_bronze.png new file mode 100644 index 00000000..4650be51 Binary files /dev/null and b/resources/tinkertextures/blocks/compressed_bronze.png differ diff --git a/resources/tinkertextures/blocks/compressed_cobalt.png b/resources/tinkertextures/blocks/compressed_cobalt.png new file mode 100644 index 00000000..65c4eeee Binary files /dev/null and b/resources/tinkertextures/blocks/compressed_cobalt.png differ diff --git a/resources/tinkertextures/blocks/compressed_copper.png b/resources/tinkertextures/blocks/compressed_copper.png new file mode 100644 index 00000000..64fe9e0e Binary files /dev/null and b/resources/tinkertextures/blocks/compressed_copper.png differ diff --git a/resources/tinkertextures/blocks/compressed_manyullyn.png b/resources/tinkertextures/blocks/compressed_manyullyn.png new file mode 100644 index 00000000..7722c8d9 Binary files /dev/null and b/resources/tinkertextures/blocks/compressed_manyullyn.png differ diff --git a/resources/tinkertextures/blocks/compressed_steel.png b/resources/tinkertextures/blocks/compressed_steel.png new file mode 100644 index 00000000..02197ac7 Binary files /dev/null and b/resources/tinkertextures/blocks/compressed_steel.png differ diff --git a/resources/tinkertextures/blocks/compressed_tin.png b/resources/tinkertextures/blocks/compressed_tin.png new file mode 100644 index 00000000..e63702c8 Binary files /dev/null and b/resources/tinkertextures/blocks/compressed_tin.png differ diff --git a/resources/tinkertextures/blocks/drain_basin.png b/resources/tinkertextures/blocks/drain_basin.png new file mode 100644 index 00000000..3c58c524 Binary files /dev/null and b/resources/tinkertextures/blocks/drain_basin.png differ diff --git a/resources/tinkertextures/blocks/drain_out.png b/resources/tinkertextures/blocks/drain_out.png new file mode 100644 index 00000000..e88291b8 Binary files /dev/null and b/resources/tinkertextures/blocks/drain_out.png differ diff --git a/resources/tinkertextures/blocks/drain_side.png b/resources/tinkertextures/blocks/drain_side.png new file mode 100644 index 00000000..6d4f857f Binary files /dev/null and b/resources/tinkertextures/blocks/drain_side.png differ diff --git a/resources/tinkertextures/blocks/faucet.png b/resources/tinkertextures/blocks/faucet.png new file mode 100644 index 00000000..87be6362 Binary files /dev/null and b/resources/tinkertextures/blocks/faucet.png differ diff --git a/resources/tinkertextures/blocks/grout.png b/resources/tinkertextures/blocks/grout.png new file mode 100644 index 00000000..9020e1fa Binary files /dev/null and b/resources/tinkertextures/blocks/grout.png differ diff --git a/resources/tinkertextures/blocks/lavatank_side.png b/resources/tinkertextures/blocks/lavatank_side.png new file mode 100644 index 00000000..c8851257 Binary files /dev/null and b/resources/tinkertextures/blocks/lavatank_side.png differ diff --git a/resources/tinkertextures/blocks/lavatank_top.png b/resources/tinkertextures/blocks/lavatank_top.png new file mode 100644 index 00000000..886e11af Binary files /dev/null and b/resources/tinkertextures/blocks/lavatank_top.png differ diff --git a/resources/tinkertextures/blocks/nether_ardite.png b/resources/tinkertextures/blocks/nether_ardite.png new file mode 100644 index 00000000..25d34650 Binary files /dev/null and b/resources/tinkertextures/blocks/nether_ardite.png differ diff --git a/resources/tinkertextures/blocks/nether_cobalt.png b/resources/tinkertextures/blocks/nether_cobalt.png new file mode 100644 index 00000000..e8dd44e7 Binary files /dev/null and b/resources/tinkertextures/blocks/nether_cobalt.png differ diff --git a/resources/tinkertextures/blocks/nether_slag.png b/resources/tinkertextures/blocks/nether_slag.png new file mode 100644 index 00000000..e34f430b Binary files /dev/null and b/resources/tinkertextures/blocks/nether_slag.png differ diff --git a/resources/tinkertextures/blocks/ore_aluminum.png b/resources/tinkertextures/blocks/ore_aluminum.png new file mode 100644 index 00000000..332a9dbd Binary files /dev/null and b/resources/tinkertextures/blocks/ore_aluminum.png differ diff --git a/resources/tinkertextures/blocks/ore_copper.png b/resources/tinkertextures/blocks/ore_copper.png new file mode 100644 index 00000000..1bd21a29 Binary files /dev/null and b/resources/tinkertextures/blocks/ore_copper.png differ diff --git a/resources/tinkertextures/blocks/ore_slag.png b/resources/tinkertextures/blocks/ore_slag.png new file mode 100644 index 00000000..cc339648 Binary files /dev/null and b/resources/tinkertextures/blocks/ore_slag.png differ diff --git a/resources/tinkertextures/blocks/ore_tin.png b/resources/tinkertextures/blocks/ore_tin.png new file mode 100644 index 00000000..084019e1 Binary files /dev/null and b/resources/tinkertextures/blocks/ore_tin.png differ diff --git a/resources/tinkertextures/blocks/partbuilder_birch_bottom.png b/resources/tinkertextures/blocks/partbuilder_birch_bottom.png new file mode 100644 index 00000000..bfb209d1 Binary files /dev/null and b/resources/tinkertextures/blocks/partbuilder_birch_bottom.png differ diff --git a/resources/tinkertextures/blocks/partbuilder_birch_side.png b/resources/tinkertextures/blocks/partbuilder_birch_side.png new file mode 100644 index 00000000..a9d1a495 Binary files /dev/null and b/resources/tinkertextures/blocks/partbuilder_birch_side.png differ diff --git a/resources/tinkertextures/blocks/partbuilder_birch_top.png b/resources/tinkertextures/blocks/partbuilder_birch_top.png new file mode 100644 index 00000000..5469402f Binary files /dev/null and b/resources/tinkertextures/blocks/partbuilder_birch_top.png differ diff --git a/resources/tinkertextures/blocks/partbuilder_jungle_bottom.png b/resources/tinkertextures/blocks/partbuilder_jungle_bottom.png new file mode 100644 index 00000000..0b7120ad Binary files /dev/null and b/resources/tinkertextures/blocks/partbuilder_jungle_bottom.png differ diff --git a/resources/tinkertextures/blocks/partbuilder_jungle_side.png b/resources/tinkertextures/blocks/partbuilder_jungle_side.png new file mode 100644 index 00000000..7c581780 Binary files /dev/null and b/resources/tinkertextures/blocks/partbuilder_jungle_side.png differ diff --git a/resources/tinkertextures/blocks/partbuilder_jungle_top.png b/resources/tinkertextures/blocks/partbuilder_jungle_top.png new file mode 100644 index 00000000..5469402f Binary files /dev/null and b/resources/tinkertextures/blocks/partbuilder_jungle_top.png differ diff --git a/resources/tinkertextures/blocks/partbuilder_oak_bottom.png b/resources/tinkertextures/blocks/partbuilder_oak_bottom.png new file mode 100644 index 00000000..914cb5fb Binary files /dev/null and b/resources/tinkertextures/blocks/partbuilder_oak_bottom.png differ diff --git a/resources/tinkertextures/blocks/partbuilder_oak_side.png b/resources/tinkertextures/blocks/partbuilder_oak_side.png new file mode 100644 index 00000000..bc415638 Binary files /dev/null and b/resources/tinkertextures/blocks/partbuilder_oak_side.png differ diff --git a/resources/tinkertextures/blocks/partbuilder_oak_top.png b/resources/tinkertextures/blocks/partbuilder_oak_top.png new file mode 100644 index 00000000..5469402f Binary files /dev/null and b/resources/tinkertextures/blocks/partbuilder_oak_top.png differ diff --git a/resources/tinkertextures/blocks/partbuilder_spruce_bottom.png b/resources/tinkertextures/blocks/partbuilder_spruce_bottom.png new file mode 100644 index 00000000..dc1aa2f0 Binary files /dev/null and b/resources/tinkertextures/blocks/partbuilder_spruce_bottom.png differ diff --git a/resources/tinkertextures/blocks/partbuilder_spruce_side.png b/resources/tinkertextures/blocks/partbuilder_spruce_side.png new file mode 100644 index 00000000..59d867d6 Binary files /dev/null and b/resources/tinkertextures/blocks/partbuilder_spruce_side.png differ diff --git a/resources/tinkertextures/blocks/partbuilder_spruce_top.png b/resources/tinkertextures/blocks/partbuilder_spruce_top.png new file mode 100644 index 00000000..5469402f Binary files /dev/null and b/resources/tinkertextures/blocks/partbuilder_spruce_top.png differ diff --git a/resources/tinkertextures/blocks/patternchest_bottom.png b/resources/tinkertextures/blocks/patternchest_bottom.png new file mode 100644 index 00000000..b40ad65c Binary files /dev/null and b/resources/tinkertextures/blocks/patternchest_bottom.png differ diff --git a/resources/tinkertextures/blocks/patternchest_side.png b/resources/tinkertextures/blocks/patternchest_side.png new file mode 100644 index 00000000..ae5ac716 Binary files /dev/null and b/resources/tinkertextures/blocks/patternchest_side.png differ diff --git a/resources/tinkertextures/blocks/patternchest_top.png b/resources/tinkertextures/blocks/patternchest_top.png new file mode 100644 index 00000000..b40ad65c Binary files /dev/null and b/resources/tinkertextures/blocks/patternchest_top.png differ diff --git a/resources/tinkertextures/blocks/searedbrick.png b/resources/tinkertextures/blocks/searedbrick.png new file mode 100644 index 00000000..e5936177 Binary files /dev/null and b/resources/tinkertextures/blocks/searedbrick.png differ diff --git a/resources/tinkertextures/blocks/searedgague_bottom.png b/resources/tinkertextures/blocks/searedgague_bottom.png new file mode 100644 index 00000000..dc89c155 Binary files /dev/null and b/resources/tinkertextures/blocks/searedgague_bottom.png differ diff --git a/resources/tinkertextures/blocks/searedgague_side.png b/resources/tinkertextures/blocks/searedgague_side.png new file mode 100644 index 00000000..4234a612 Binary files /dev/null and b/resources/tinkertextures/blocks/searedgague_side.png differ diff --git a/resources/tinkertextures/blocks/searedgague_top.png b/resources/tinkertextures/blocks/searedgague_top.png new file mode 100644 index 00000000..22985760 Binary files /dev/null and b/resources/tinkertextures/blocks/searedgague_top.png differ diff --git a/resources/tinkertextures/blocks/searedwindow_bottom.png b/resources/tinkertextures/blocks/searedwindow_bottom.png new file mode 100644 index 00000000..9598a94f Binary files /dev/null and b/resources/tinkertextures/blocks/searedwindow_bottom.png differ diff --git a/resources/tinkertextures/blocks/searedwindow_side.png b/resources/tinkertextures/blocks/searedwindow_side.png new file mode 100644 index 00000000..96877677 Binary files /dev/null and b/resources/tinkertextures/blocks/searedwindow_side.png differ diff --git a/resources/tinkertextures/blocks/searedwindow_top.png b/resources/tinkertextures/blocks/searedwindow_top.png new file mode 100644 index 00000000..b6e051e0 Binary files /dev/null and b/resources/tinkertextures/blocks/searedwindow_top.png differ diff --git a/resources/tinkertextures/blocks/slimesand.png b/resources/tinkertextures/blocks/slimesand.png new file mode 100644 index 00000000..fcd77cbf Binary files /dev/null and b/resources/tinkertextures/blocks/slimesand.png differ diff --git a/resources/tinkertextures/blocks/smeltery_active.png b/resources/tinkertextures/blocks/smeltery_active.png new file mode 100644 index 00000000..dda83627 Binary files /dev/null and b/resources/tinkertextures/blocks/smeltery_active.png differ diff --git a/resources/tinkertextures/blocks/smeltery_inactive.png b/resources/tinkertextures/blocks/smeltery_inactive.png new file mode 100644 index 00000000..8f38e348 Binary files /dev/null and b/resources/tinkertextures/blocks/smeltery_inactive.png differ diff --git a/resources/tinkertextures/blocks/smeltery_side.png b/resources/tinkertextures/blocks/smeltery_side.png new file mode 100644 index 00000000..e5936177 Binary files /dev/null and b/resources/tinkertextures/blocks/smeltery_side.png differ diff --git a/resources/tinkertextures/blocks/stenciltable_birch_bottom.png b/resources/tinkertextures/blocks/stenciltable_birch_bottom.png new file mode 100644 index 00000000..b113e3ae Binary files /dev/null and b/resources/tinkertextures/blocks/stenciltable_birch_bottom.png differ diff --git a/resources/tinkertextures/blocks/stenciltable_birch_side.png b/resources/tinkertextures/blocks/stenciltable_birch_side.png new file mode 100644 index 00000000..bf990d56 Binary files /dev/null and b/resources/tinkertextures/blocks/stenciltable_birch_side.png differ diff --git a/resources/tinkertextures/blocks/stenciltable_jungle_bottom.png b/resources/tinkertextures/blocks/stenciltable_jungle_bottom.png new file mode 100644 index 00000000..e3fe82d1 Binary files /dev/null and b/resources/tinkertextures/blocks/stenciltable_jungle_bottom.png differ diff --git a/resources/tinkertextures/blocks/stenciltable_jungle_side.png b/resources/tinkertextures/blocks/stenciltable_jungle_side.png new file mode 100644 index 00000000..c152884c Binary files /dev/null and b/resources/tinkertextures/blocks/stenciltable_jungle_side.png differ diff --git a/resources/tinkertextures/blocks/stenciltable_jungle_top.png b/resources/tinkertextures/blocks/stenciltable_jungle_top.png new file mode 100644 index 00000000..9003c077 Binary files /dev/null and b/resources/tinkertextures/blocks/stenciltable_jungle_top.png differ diff --git a/resources/tinkertextures/blocks/stenciltable_oak_bottom.png b/resources/tinkertextures/blocks/stenciltable_oak_bottom.png new file mode 100644 index 00000000..346f77dc Binary files /dev/null and b/resources/tinkertextures/blocks/stenciltable_oak_bottom.png differ diff --git a/resources/tinkertextures/blocks/stenciltable_oak_side.png b/resources/tinkertextures/blocks/stenciltable_oak_side.png new file mode 100644 index 00000000..cbeb34a7 Binary files /dev/null and b/resources/tinkertextures/blocks/stenciltable_oak_side.png differ diff --git a/resources/tinkertextures/blocks/stenciltable_oak_top.png b/resources/tinkertextures/blocks/stenciltable_oak_top.png new file mode 100644 index 00000000..9003c077 Binary files /dev/null and b/resources/tinkertextures/blocks/stenciltable_oak_top.png differ diff --git a/resources/tinkertextures/blocks/stenciltable_spruce_bottom.png b/resources/tinkertextures/blocks/stenciltable_spruce_bottom.png new file mode 100644 index 00000000..f45fa94b Binary files /dev/null and b/resources/tinkertextures/blocks/stenciltable_spruce_bottom.png differ diff --git a/resources/tinkertextures/blocks/stenciltable_spruce_side.png b/resources/tinkertextures/blocks/stenciltable_spruce_side.png new file mode 100644 index 00000000..2a1c0d18 Binary files /dev/null and b/resources/tinkertextures/blocks/stenciltable_spruce_side.png differ diff --git a/resources/tinkertextures/blocks/stenciltable_spruce_top.png b/resources/tinkertextures/blocks/stenciltable_spruce_top.png new file mode 100644 index 00000000..9003c077 Binary files /dev/null and b/resources/tinkertextures/blocks/stenciltable_spruce_top.png differ diff --git a/resources/tinkertextures/blocks/toolstation_bottom.png b/resources/tinkertextures/blocks/toolstation_bottom.png new file mode 100644 index 00000000..346f77dc Binary files /dev/null and b/resources/tinkertextures/blocks/toolstation_bottom.png differ diff --git a/resources/tinkertextures/blocks/toolstation_side.png b/resources/tinkertextures/blocks/toolstation_side.png new file mode 100644 index 00000000..542f0e97 Binary files /dev/null and b/resources/tinkertextures/blocks/toolstation_side.png differ diff --git a/resources/tinkertextures/blocks/toolstation_top.png b/resources/tinkertextures/blocks/toolstation_top.png new file mode 100644 index 00000000..5e8222cb Binary files /dev/null and b/resources/tinkertextures/blocks/toolstation_top.png differ diff --git a/resources/tinkertextures/mob/crystalwater.png b/resources/tinkertextures/mob/crystalwater.png new file mode 100644 index 00000000..fe6be356 Binary files /dev/null and b/resources/tinkertextures/mob/crystalwater.png differ diff --git a/tinker/tconstruct/AbilityHelper.java b/tinker/tconstruct/AbilityHelper.java index cb110357..e1b0a1d5 100644 --- a/tinker/tconstruct/AbilityHelper.java +++ b/tinker/tconstruct/AbilityHelper.java @@ -14,6 +14,7 @@ import net.minecraft.enchantment.EnchantmentHelper; import net.minecraft.enchantment.EnchantmentThorns; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLiving; +import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.monster.EntityCreeper; import net.minecraft.entity.monster.EntityGhast; import net.minecraft.entity.passive.EntityWolf; @@ -58,40 +59,6 @@ public class AbilityHelper return true; } - - /*public static void hitEntity (ItemStack stack, EntityLiving mob, EntityLiving player) - { - hitEntity(stack, mob, player, 1f); - } - - public static void hitEntity (ItemStack stack, EntityLiving mob, EntityLiving player, float bonusDamage) - { - NBTTagCompound tags = stack.getTagCompound(); - if (!tags.getCompoundTag("InfiTool").getBoolean("Broken")) - { - int durability = tags.getCompoundTag("InfiTool").getInteger("Damage"); - - float shoddy = tags.getCompoundTag("InfiTool").getFloat("Shoddy"); - float damageModifier = -shoddy * durability / 100f; - - int attack = (int) ((tags.getCompoundTag("InfiTool").getInteger("Attack") + damageModifier) * bonusDamage); - - if (player instanceof EntityPlayer) - if (mob.attackEntityFrom(DamageSource.causePlayerDamage((EntityPlayer) player), attack)) - { - damageTool(stack, 1, tags, player, false); - if (tags.getCompoundTag("InfiTool").getBoolean("Necrotic")) - player.heal(1); - } - else - mob.attackEntityFrom(DamageSource.causeMobDamage(player), attack); - - if (tags.getCompoundTag("InfiTool").hasKey("Fiery")) - { - mob.setFire(tags.getCompoundTag("InfiTool").getInteger("Fiery")/5+1); - } - } - }*/ public static void onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity entity, ToolCore tool) { @@ -298,12 +265,9 @@ public class AbilityHelper else { tags.getCompoundTag("InfiTool").setInteger("Damage", damage + dam); - int toolDamage = damage * 100 / maxDamage + 1; - //System.out.println("Damage: " + damer); + int toolDamage = damage * 100 / maxDamage; int stackDamage = stack.getItemDamage(); - //if (toolDamage >= stackDamage && toolDamage < 100) - //stack.damageItem(toolDamage - stackDamage, entity); - stack.setItemDamage(damage * 100 / maxDamage + 1); + stack.setItemDamage(damage * 100 / maxDamage); } //stack.setItemDamage(1 + (maxDamage - damage) * (stack.getMaxDamage() - 1) / maxDamage); @@ -441,11 +405,8 @@ public class AbilityHelper tags.getCompoundTag("InfiTool").setBoolean("Broken", false); tags.getCompoundTag("InfiTool").setInteger("Damage", 0); } - - /* Entities */ - public static DamageSource causePiercingDamage (EntityLiving mob) { return new PiercingEntityDamage("mob", mob); @@ -521,4 +482,14 @@ public class AbilityHelper } } } + + public static void spawnItemAtPlayer(EntityPlayer player, ItemStack stack) + { + if (!player.worldObj.isRemote) + { + EntityItem entityitem = new EntityItem(player.worldObj, player.posX + 0.5D, player.posY + 0.5D, player.posZ + 0.5D, stack); + entityitem.delayBeforeCanPickup = 10; + player.worldObj.spawnEntityInWorld(entityitem); + } + } } diff --git a/tinker/tconstruct/PHConstruct.java b/tinker/tconstruct/PHConstruct.java index 94ab9cf8..1fc9ebc4 100644 --- a/tinker/tconstruct/PHConstruct.java +++ b/tinker/tconstruct/PHConstruct.java @@ -39,6 +39,10 @@ public class PHConstruct { * 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("Diffuclty Changes", "Keep hunger on death", true).getBoolean(true); + keepLevels = config.get("Diffuclty Changes", "Keep levels on death", true).getBoolean(true); + woodCrafter = config.getBlock("Wood Tool Station", 1471).getInt(1471); heldItemBlock = config.getBlock("Held Item Block", 1472).getInt(1472); @@ -211,4 +215,9 @@ public class PHConstruct { public static int aluminumHeight; public static int aluminumRange; public static int netherDensity; + + //Difficulty modifiers + public static boolean removeToolRecipes; + public static boolean keepHunger; + public static boolean keepLevels; } \ No newline at end of file diff --git a/tinker/tconstruct/TConstruct.java b/tinker/tconstruct/TConstruct.java index 49252645..c0a89b01 100644 --- a/tinker/tconstruct/TConstruct.java +++ b/tinker/tconstruct/TConstruct.java @@ -1,20 +1,9 @@ package tinker.tconstruct; -import java.util.ArrayList; import java.util.Random; -import net.minecraft.block.material.Material; -import net.minecraft.entity.passive.EntityCow; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumMovingObjectType; import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.event.Event.Result; -import net.minecraftforge.event.ForgeSubscribe; -import net.minecraftforge.event.entity.player.FillBucketEvent; -import net.minecraftforge.oredict.OreDictionary; -import net.minecraftforge.oredict.OreDictionary.OreRegisterEvent; -import tinker.tconstruct.crafting.PatternBuilder; +import tinker.tconstruct.player.TPlayerHandler; import tinker.tconstruct.worldgen.TBaseWorldGenerator; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod.Init; @@ -50,7 +39,8 @@ public class TConstruct public TConstruct() { //Take that, any mod that does ore dictionary registration in preinit! - MinecraftForge.EVENT_BUS.register(new TEventHandler()); + events = new TEventHandler(); + MinecraftForge.EVENT_BUS.register(events); } @PreInit @@ -62,25 +52,31 @@ public class TConstruct blockTab = new TabTools("TConstructBlocks"); content = new TContent(); - NetworkRegistry.instance().registerGuiHandler(instance, new TGuiHandler()); } @Init - public void load (FMLInitializationEvent evt) + public void init (FMLInitializationEvent evt) { GameRegistry.registerWorldGenerator(new TBaseWorldGenerator()); - content.oreRegistry(); + playerTracker = new TPlayerHandler(); + MinecraftForge.EVENT_BUS.register(playerTracker); + GameRegistry.registerPlayerTracker(playerTracker); + NetworkRegistry.instance().registerGuiHandler(instance, new TGuiHandler()); + proxy.addNames(); + proxy.registerRenderer(); + proxy.readManuals(); + proxy.registerKeys(); } @PostInit public void postInit (FMLPostInitializationEvent evt) { - proxy.addNames(); - proxy.registerRenderer(); - proxy.readManuals(); content.modIntegration(); + content.oreRegistry(); } + public static TEventHandler events; + public static TPlayerHandler playerTracker; public static TContent content; public static Random tRand = new Random(); diff --git a/tinker/tconstruct/TContent.java b/tinker/tconstruct/TContent.java index 41f5d6ed..44470425 100644 --- a/tinker/tconstruct/TContent.java +++ b/tinker/tconstruct/TContent.java @@ -116,9 +116,11 @@ public class TContent implements IFuelHandler void createEntities () { - EntityRegistry.registerModEntity(CartEntity.class, "Small Wagon", 0, TConstruct.instance, 32, 5, true); - EntityRegistry.registerModEntity(Skyla.class, "Skyla", 1, TConstruct.instance, 32, 5, true); - EntityRegistry.registerModEntity(FancyEntityItem.class, "Fancy Item", 1, TConstruct.instance, 32, 5, true); + EntityRegistry.registerModEntity(FancyEntityItem.class, "Fancy Item", 0, TConstruct.instance, 32, 5, true); + EntityRegistry.registerModEntity(CartEntity.class, "Small Wagon", 1, TConstruct.instance, 32, 5, true); + EntityRegistry.registerModEntity(Crystal.class, "Crystal", 2, TConstruct.instance, 32, 5, true); + + EntityRegistry.registerModEntity(Skyla.class, "Skyla", 10, TConstruct.instance, 32, 5, true); } void registerBlocks() diff --git a/tinker/tconstruct/TControls.java b/tinker/tconstruct/TControls.java new file mode 100644 index 00000000..9f2a4b14 --- /dev/null +++ b/tinker/tconstruct/TControls.java @@ -0,0 +1,120 @@ +package tinker.tconstruct; + +import java.io.ByteArrayOutputStream; +import java.io.DataOutputStream; +import java.util.EnumSet; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.entity.EntityClientPlayerMP; +import net.minecraft.client.settings.KeyBinding; +import net.minecraft.network.packet.Packet250CustomPayload; +import net.minecraft.potion.Potion; +import cpw.mods.fml.client.registry.KeyBindingRegistry.KeyHandler; +import cpw.mods.fml.common.TickType; +import cpw.mods.fml.common.network.PacketDispatcher; + +public class TControls extends KeyHandler +{ + static KeyBinding grabKey = new KeyBinding("key.grab", 29); + static KeyBinding jumpKey; + Minecraft mc; + EntityClientPlayerMP player; + boolean jumping; + boolean doubleJump = true; + boolean climbing = false; + boolean onGround = false; + + public TControls() + { + super(new KeyBinding[] { Minecraft.getMinecraft().gameSettings.keyBindJump, grabKey }, new boolean[] { false, false }); + mc = Minecraft.getMinecraft(); + jumpKey = mc.gameSettings.keyBindJump; + System.out.println("Controls registered"); + } + + //I will be wanting these later + /*@Override + public void tickStart(EnumSet type, Object... tickData) + { + super.tickStart(type, tickData); + } + + @Override + public void tickEnd(EnumSet type, Object... tickData) + { + super.tickEnd(type, tickData); + }*/ + + @Override + public String getLabel () + { + return null; + } + + @Override + public void keyDown (EnumSet types, KeyBinding kb, boolean tickEnd, boolean isRepeat) + { + if (kb == jumpKey && tickEnd) //Double jump + { + if (jumping && !doubleJump) + { + if (player == null) + player = mc.thePlayer; + + player.motionY = 0.42D; + player.fallDistance = 0; + + if (player.isPotionActive(Potion.jump)) + { + player.motionY += (double) ((float) (player.getActivePotionEffect(Potion.jump).getAmplifier() + 1) * 0.1F); + } + + doubleJump = true; + updateServer(mc.thePlayer.username); + } + + if (!jumping) + jumping = mc.thePlayer.isAirBorne; + } + } + + @Override + public void keyUp (EnumSet types, KeyBinding kb, boolean tickEnd) + { + //landOnGround(); + } + + @Override + public EnumSet ticks () + { + return EnumSet.of(TickType.CLIENT); + } + + public void landOnGround () + { + doubleJump = false; + jumping = false; + } + + void updateServer (String name) + { + ByteArrayOutputStream bos = new ByteArrayOutputStream(8); + DataOutputStream outputStream = new DataOutputStream(bos); + try + { + outputStream.writeByte(10); + outputStream.writeUTF(name); + } + catch (Exception ex) + { + ex.printStackTrace(); + } + + Packet250CustomPayload packet = new Packet250CustomPayload(); + packet.channel = "TConstruct"; + packet.data = bos.toByteArray(); + packet.length = bos.size(); + + PacketDispatcher.sendPacketToServer(packet); + } +} diff --git a/tinker/tconstruct/TEventHandler.java b/tinker/tconstruct/TEventHandler.java index d3b1d79b..d95eeddb 100644 --- a/tinker/tconstruct/TEventHandler.java +++ b/tinker/tconstruct/TEventHandler.java @@ -1,19 +1,28 @@ package tinker.tconstruct; +import java.util.HashMap; + +import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumMovingObjectType; import net.minecraftforge.event.Event.Result; import net.minecraftforge.event.ForgeSubscribe; import net.minecraftforge.event.entity.player.FillBucketEvent; +import net.minecraftforge.event.entity.player.PlayerDropsEvent; import net.minecraftforge.liquids.LiquidStack; import net.minecraftforge.oredict.OreDictionary.OreRegisterEvent; import tinker.tconstruct.crafting.PatternBuilder; import tinker.tconstruct.crafting.Smeltery; import tinker.tconstruct.logic.LiquidTextureLogic; +import tinker.tconstruct.player.TPlayerStats; +import cpw.mods.fml.common.IPlayerTracker; public class TEventHandler { + + /* Ore Dictionary */ @ForgeSubscribe public void registerOre (OreRegisterEvent evt) { diff --git a/tinker/tconstruct/TPacketHandler.java b/tinker/tconstruct/TPacketHandler.java index b776ceb5..d8a29ff4 100644 --- a/tinker/tconstruct/TPacketHandler.java +++ b/tinker/tconstruct/TPacketHandler.java @@ -4,6 +4,7 @@ import java.io.ByteArrayInputStream; import java.io.DataInputStream; import java.io.IOException; +import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.network.INetworkManager; import net.minecraft.network.packet.Packet250CustomPayload; @@ -109,9 +110,17 @@ public class TPacketHandler implements IPacketHandler int rowPos = inputStream.readInt(); String user = inputStream.readUTF(); SmelteryContainer container = (SmelteryContainer) TGuiHandler.openContainers.get(user); - System.out.println("Recieved a scroll packet for row "+rowPos); + //System.out.println("Recieved a scroll packet for row "+rowPos); container.updateRows(rowPos); } + + else if (packetID == 10) //Double jump + { + String user = inputStream.readUTF(); + //EntityPlayer player = FMLCommonHandler.instance().getSidedDelegate().getServer().getConfigurationManager().getPlayerForUsername(user); + EntityPlayer player = TConstruct.playerTracker.getEntityPlayer(user); + player.fallDistance = 0; + } } catch (IOException e) { diff --git a/tinker/tconstruct/TProxyCommon.java b/tinker/tconstruct/TProxyCommon.java index 856ce884..81500d21 100644 --- a/tinker/tconstruct/TProxyCommon.java +++ b/tinker/tconstruct/TProxyCommon.java @@ -16,6 +16,8 @@ public class TProxyCommon public void readManuals() {} + public void registerKeys() {} + public File getLocation() { return new File("."); diff --git a/tinker/tconstruct/client/TKeyHandler.java b/tinker/tconstruct/client/TKeyHandler.java new file mode 100644 index 00000000..c85d81b2 --- /dev/null +++ b/tinker/tconstruct/client/TKeyHandler.java @@ -0,0 +1,126 @@ +package tinker.tconstruct.client; + +import java.util.ArrayList; +import java.util.EnumSet; +import java.util.Set; + +import net.minecraft.client.settings.GameSettings; +import net.minecraft.client.settings.KeyBinding; + +import org.lwjgl.input.Keyboard; +import org.lwjgl.input.Mouse; + +import com.google.common.collect.Lists; +import com.google.common.collect.Sets; + +import cpw.mods.fml.client.registry.KeyBindingRegistry; +import cpw.mods.fml.common.ITickHandler; +import cpw.mods.fml.common.TickType; + +public abstract class TKeyHandler implements ITickHandler +{ + protected KeyBinding[] keyBindings; + protected boolean[] keyDown; + protected boolean[] repeatings; + private boolean isDummy; + + /** + * Pass an array of keybindings and a repeat flag for each one + * + * @param keyBindings + * @param repeatings + */ + public TKeyHandler(KeyBinding[] keyBindings, boolean[] repeatings) + { + assert keyBindings.length == repeatings.length : "You need to pass two arrays of identical length"; + this.keyBindings = keyBindings; + this.repeatings = repeatings; + this.keyDown = new boolean[keyBindings.length]; + } + + + /** + * Register the keys into the system. You will do your own keyboard management elsewhere. No events will fire + * if you use this method + * + * @param keyBindings + */ + public TKeyHandler(KeyBinding[] keyBindings) + { + this.keyBindings = keyBindings; + this.isDummy = true; + } + + public KeyBinding[] getKeyBindings() + { + return this.keyBindings; + } + + @Override + public void tickStart(EnumSet type, Object... tickData) + { + keyTick(type, false); + } + + @Override + public void tickEnd(EnumSet type, Object... tickData) + { + keyTick(type, true); + } + + private void keyTick(EnumSet type, boolean tickEnd) + { + for (int i = 0; i < keyBindings.length; i++) + { + KeyBinding keyBinding = keyBindings[i]; + int keyCode = keyBinding.keyCode; + boolean state = (keyCode < 0 ? Mouse.isButtonDown(keyCode + 100) : Keyboard.isKeyDown(keyCode)); + if (state != keyDown[i] || (state && repeatings[i])) + { + if (state) + { + keyDown(type, keyBinding, tickEnd, state!=keyDown[i]); + } + else + { + keyUp(type, keyBinding, tickEnd); + } + if (tickEnd) + { + keyDown[i] = state; + } + } + + } + } + + /** + * Called when the key is first in the down position on any tick from the {@link #ticks()} + * set. Will be called subsequently with isRepeat set to true + * + * @see #keyUp(EnumSet, KeyBinding, boolean) + * + * @param types the type(s) of tick that fired when this key was first down + * @param tickEnd was it an end or start tick which fired the key + * @param isRepeat is it a repeat key event + */ + public abstract void keyDown(EnumSet types, KeyBinding kb, boolean tickEnd, boolean isRepeat); + /** + * Fired once when the key changes state from down to up + * + * @see #keyDown(EnumSet, KeyBinding, boolean, boolean) + * + * @param types the type(s) of tick that fired when this key was first down + * @param tickEnd was it an end or start tick which fired the key + */ + public abstract void keyUp(EnumSet types, KeyBinding kb, boolean tickEnd); + + + /** + * This is the list of ticks for which the key binding should trigger. The only + * valid ticks are client side ticks, obviously. + * + * @see cpw.mods.fml.common.ITickHandler#ticks() + */ + public abstract EnumSet ticks(); +} diff --git a/tinker/tconstruct/client/TProxyClient.java b/tinker/tconstruct/client/TProxyClient.java index 016fe7f0..dd699ec6 100644 --- a/tinker/tconstruct/client/TProxyClient.java +++ b/tinker/tconstruct/client/TProxyClient.java @@ -16,15 +16,57 @@ import org.w3c.dom.Document; import tinker.common.fancyitem.FancyEntityItem; import tinker.common.fancyitem.FancyItemRender; -import tinker.tconstruct.*; -import tinker.tconstruct.client.entityrender.*; +import tinker.tconstruct.TConstruct; +import tinker.tconstruct.TConstructRegistry; +import tinker.tconstruct.TContent; +import tinker.tconstruct.TControls; +import tinker.tconstruct.TProxyCommon; +import tinker.tconstruct.client.entityrender.CartRender; +import tinker.tconstruct.client.entityrender.CrystalRender; +import tinker.tconstruct.client.entityrender.SkylaRender; import tinker.tconstruct.client.gui.ToolGuiElement; -import tinker.tconstruct.client.liquidrender.*; -import tinker.tconstruct.entity.*; -import tinker.tconstruct.logic.*; -import tinker.tconstruct.tools.*; +import tinker.tconstruct.client.liquidrender.LiquidAlBrassFX; +import tinker.tconstruct.client.liquidrender.LiquidAlBrassFlowFX; +import tinker.tconstruct.client.liquidrender.LiquidAluminumFX; +import tinker.tconstruct.client.liquidrender.LiquidAluminumFlowFX; +import tinker.tconstruct.client.liquidrender.LiquidAlumiteFX; +import tinker.tconstruct.client.liquidrender.LiquidAlumiteFlowFX; +import tinker.tconstruct.client.liquidrender.LiquidAngmallenFX; +import tinker.tconstruct.client.liquidrender.LiquidAngmallenFlowFX; +import tinker.tconstruct.client.liquidrender.LiquidArditeFX; +import tinker.tconstruct.client.liquidrender.LiquidArditeFlowFX; +import tinker.tconstruct.client.liquidrender.LiquidBronzeFX; +import tinker.tconstruct.client.liquidrender.LiquidBronzeFlowFX; +import tinker.tconstruct.client.liquidrender.LiquidCobaltFX; +import tinker.tconstruct.client.liquidrender.LiquidCobaltFlowFX; +import tinker.tconstruct.client.liquidrender.LiquidCopperFX; +import tinker.tconstruct.client.liquidrender.LiquidCopperFlowFX; +import tinker.tconstruct.client.liquidrender.LiquidDamascusSteelFX; +import tinker.tconstruct.client.liquidrender.LiquidDamascusSteelFlowFX; +import tinker.tconstruct.client.liquidrender.LiquidGoldFX; +import tinker.tconstruct.client.liquidrender.LiquidGoldFlowFX; +import tinker.tconstruct.client.liquidrender.LiquidHeptazionFX; +import tinker.tconstruct.client.liquidrender.LiquidHeptazionFlowFX; +import tinker.tconstruct.client.liquidrender.LiquidIronFX; +import tinker.tconstruct.client.liquidrender.LiquidIronFlowFX; +import tinker.tconstruct.client.liquidrender.LiquidManganeseFX; +import tinker.tconstruct.client.liquidrender.LiquidManganeseFlowFX; +import tinker.tconstruct.client.liquidrender.LiquidManyullynFX; +import tinker.tconstruct.client.liquidrender.LiquidManyullynFlowFX; +import tinker.tconstruct.client.liquidrender.LiquidObsidianFX; +import tinker.tconstruct.client.liquidrender.LiquidObsidianFlowFX; +import tinker.tconstruct.client.liquidrender.LiquidSteelFX; +import tinker.tconstruct.client.liquidrender.LiquidSteelFlowFX; +import tinker.tconstruct.client.liquidrender.LiquidTinFX; +import tinker.tconstruct.client.liquidrender.LiquidTinFlowFX; +import tinker.tconstruct.entity.CartEntity; +import tinker.tconstruct.entity.Crystal; +import tinker.tconstruct.entity.Skyla; +import tinker.tconstruct.logic.CastingTableLogic; +import tinker.tconstruct.tools.ToolCore; import cpw.mods.fml.client.FMLClientHandler; import cpw.mods.fml.client.registry.ClientRegistry; +import cpw.mods.fml.client.registry.KeyBindingRegistry; import cpw.mods.fml.client.registry.RenderingRegistry; import cpw.mods.fml.common.registry.LanguageRegistry; @@ -98,6 +140,7 @@ public class TProxyClient extends TProxyCommon RenderingRegistry.registerEntityRenderingHandler(CartEntity.class, new CartRender()); RenderingRegistry.registerEntityRenderingHandler(Skyla.class, new SkylaRender()); RenderingRegistry.registerEntityRenderingHandler(FancyEntityItem.class, new FancyItemRender()); + RenderingRegistry.registerEntityRenderingHandler(Crystal.class, new CrystalRender()); //RenderingRegistry.registerEntityRenderingHandler(net.minecraft.entity.player.EntityPlayer.class, new PlayerArmorRender()); // <-- Works, woo! addRenderMappings(); @@ -383,4 +426,13 @@ public class TProxyClient extends TProxyCommon tool.effectTextures.put(materialID, tool.getToolTextureFile() + partialLocation); } } + + /* Keybindings */ + public static TControls controlInstance; + + public void registerKeys() + { + controlInstance = new TControls(); + KeyBindingRegistry.registerKeyBinding(controlInstance); + } } diff --git a/tinker/tconstruct/client/entityrender/CrystalModel.java b/tinker/tconstruct/client/entityrender/CrystalModel.java new file mode 100644 index 00000000..0793ff0a --- /dev/null +++ b/tinker/tconstruct/client/entityrender/CrystalModel.java @@ -0,0 +1,54 @@ +package tinker.tconstruct.client.entityrender; + +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; +import tinker.tconstruct.client.tmt.ModelRendererTurbo; + +public class CrystalModel extends ModelBase +{ + ModelRenderer body; + ModelRendererTurbo top; + ModelRendererTurbo bottom; + + public CrystalModel() + { + textureWidth = 32; + textureHeight = 32; + + body = new ModelRenderer(this, 0, 8); + body.addBox(-2F, 0F, -2F, 4, 6, 4); + body.setRotationPoint(0F, 0F, 0F); + setRotation(body, 0, 0.7853982F, 0); + top = new ModelRendererTurbo(this, 0, 0, 32, 32); + top.addCone(0, 0, 0, 2.8F, 4, 4, 0, ModelRendererTurbo.MR_BOTTOM, 4, 4); + top.setRotationPoint(0F, -4F, 0F); + setRotation(top, 0F, 0F, 0F); + bottom = new ModelRendererTurbo(this, 0, 18, 32, 32); + top.addCone(0, 10, 0, 2.8F, 4, 4, 0, ModelRendererTurbo.MR_TOP, 4, 4); + bottom.setRotationPoint(0F, 6F, 0F); + //setRotation(bottom, 0F, 0F, 0F); + } + + public void render (Entity entity, float f, float f1, float f2, float f3, float f4, float f5) + { + super.render(entity, f, f1, f2, f3, f4, f5); + setRotationAngles(f, f1, f2, f3, f4, f5, entity); + body.render(f5); + top.render(f5); + bottom.render(f5); + } + + private void setRotation (ModelRenderer model, float x, float y, float z) + { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } + + public void setRotationAngles (float f, float f1, float f2, float f3, float f4, float f5, Entity entity) + { + super.setRotationAngles(f, f1, f2, f3, f4, f5, entity); + } + +} diff --git a/tinker/tconstruct/client/entityrender/CrystalRender.java b/tinker/tconstruct/client/entityrender/CrystalRender.java new file mode 100644 index 00000000..2018ba20 --- /dev/null +++ b/tinker/tconstruct/client/entityrender/CrystalRender.java @@ -0,0 +1,164 @@ +package tinker.tconstruct.client.entityrender; + +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.renderer.entity.RenderLiving; +import net.minecraft.entity.EntityLiving; +import net.minecraft.util.MathHelper; + +import org.lwjgl.opengl.GL11; + +import tinker.tconstruct.entity.Crystal; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +@SideOnly(Side.CLIENT) +public class CrystalRender extends RenderLiving +{ + /** The creeper model. */ + private ModelBase creeperModel = new SkylaModel(); + + public CrystalRender() + { + super(new CrystalModel(), 0.5F); + } + + /** + * Updates creeper scale in prerender callback + */ + protected void updateCreeperScale(Crystal par1EntityCreeper, float par2) + { + float var4 = par1EntityCreeper.getCreeperFlashIntensity(par2); + float var5 = 1.0F + MathHelper.sin(var4 * 100.0F) * var4 * 0.01F; + + if (var4 < 0.0F) + { + var4 = 0.0F; + } + + if (var4 > 1.0F) + { + var4 = 1.0F; + } + + var4 *= var4; + var4 *= var4; + float var6 = (1.0F + var4 * 0.4F) * var5; + float var7 = (1.0F + var4 * 0.1F) / var5; + GL11.glScalef(var6, var7, var6); + } + + /** + * Updates color multiplier based on creeper state called by getColorMultiplier + */ + protected int updateCreeperColorMultiplier(Crystal par1EntityCreeper, float par2, float par3) + { + float var5 = par1EntityCreeper.getCreeperFlashIntensity(par3); + + if ((int)(var5 * 10.0F) % 2 == 0) + { + return 0; + } + else + { + int var6 = (int)(var5 * 0.2F * 255.0F); + + if (var6 < 0) + { + var6 = 0; + } + + if (var6 > 255) + { + var6 = 255; + } + + short var7 = 255; + short var8 = 255; + short var9 = 255; + return var6 << 24 | var7 << 16 | var8 << 8 | var9; + } + } + + /** + * A method used to render a creeper's powered form as a pass model. + */ + protected int renderCreeperPassModel(Crystal par1EntityCreeper, int par2, float par3) + { + if (par1EntityCreeper.getPowered()) + { + if (par1EntityCreeper.getHasActivePotion()) + { + GL11.glDepthMask(false); + } + else + { + GL11.glDepthMask(true); + } + + if (par2 == 1) + { + float var4 = (float)par1EntityCreeper.ticksExisted + par3; + this.loadTexture("/armor/power.png"); + GL11.glMatrixMode(GL11.GL_TEXTURE); + GL11.glLoadIdentity(); + float var5 = var4 * 0.01F; + float var6 = var4 * 0.01F; + GL11.glTranslatef(var5, var6, 0.0F); + this.setRenderPassModel(this.creeperModel); + GL11.glMatrixMode(GL11.GL_MODELVIEW); + GL11.glEnable(GL11.GL_BLEND); + float var7 = 0.5F; + GL11.glColor4f(var7, var7, var7, 1.0F); + GL11.glDisable(GL11.GL_LIGHTING); + GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE); + return 1; + } + + if (par2 == 2) + { + GL11.glMatrixMode(GL11.GL_TEXTURE); + GL11.glLoadIdentity(); + GL11.glMatrixMode(GL11.GL_MODELVIEW); + GL11.glEnable(GL11.GL_LIGHTING); + GL11.glDisable(GL11.GL_BLEND); + } + } + + return -1; + } + + protected int func_77061_b(Crystal par1EntityCreeper, int par2, float par3) + { + return -1; + } + + /** + * Allows the render to do any OpenGL state modifications necessary before the model is rendered. Args: + * entityLiving, partialTickTime + */ + protected void preRenderCallback(EntityLiving par1EntityLiving, float par2) + { + this.updateCreeperScale((Crystal)par1EntityLiving, par2); + } + + /** + * Returns an ARGB int color back. Args: entityLiving, lightBrightness, partialTickTime + */ + protected int getColorMultiplier(EntityLiving par1EntityLiving, float par2, float par3) + { + return this.updateCreeperColorMultiplier((Crystal)par1EntityLiving, par2, par3); + } + + /** + * Queries whether should render the specified pass or not. + */ + protected int shouldRenderPass(EntityLiving par1EntityLiving, int par2, float par3) + { + return this.renderCreeperPassModel((Crystal)par1EntityLiving, par2, par3); + } + + protected int inheritRenderPass(EntityLiving par1EntityLiving, int par2, float par3) + { + return this.func_77061_b((Crystal)par1EntityLiving, par2, par3); + } +} diff --git a/tinker/tconstruct/client/entityrender/SkylaRender.java b/tinker/tconstruct/client/entityrender/SkylaRender.java index 0d57b1d1..d556f1de 100644 --- a/tinker/tconstruct/client/entityrender/SkylaRender.java +++ b/tinker/tconstruct/client/entityrender/SkylaRender.java @@ -22,107 +22,11 @@ public class SkylaRender extends RenderLiving super(new SkylaModel(), 0.5F); } - /** - * Updates creeper scale in prerender callback - */ - protected void updateCreeperScale(Skyla par1EntityCreeper, float par2) - { - float var4 = par1EntityCreeper.getCreeperFlashIntensity(par2); - float var5 = 1.0F + MathHelper.sin(var4 * 100.0F) * var4 * 0.01F; - - if (var4 < 0.0F) - { - var4 = 0.0F; - } - - if (var4 > 1.0F) - { - var4 = 1.0F; - } - - var4 *= var4; - var4 *= var4; - float var6 = (1.0F + var4 * 0.4F) * var5; - float var7 = (1.0F + var4 * 0.1F) / var5; - GL11.glScalef(var6, var7, var6); - } - - /** - * Updates color multiplier based on creeper state called by getColorMultiplier - */ - protected int updateCreeperColorMultiplier(Skyla par1EntityCreeper, float par2, float par3) - { - float var5 = par1EntityCreeper.getCreeperFlashIntensity(par3); - - if ((int)(var5 * 10.0F) % 2 == 0) - { - return 0; - } - else - { - int var6 = (int)(var5 * 0.2F * 255.0F); - - if (var6 < 0) - { - var6 = 0; - } - - if (var6 > 255) - { - var6 = 255; - } - - short var7 = 255; - short var8 = 255; - short var9 = 255; - return var6 << 24 | var7 << 16 | var8 << 8 | var9; - } - } - /** * A method used to render a creeper's powered form as a pass model. */ protected int renderCreeperPassModel(Skyla par1EntityCreeper, int par2, float par3) { - if (par1EntityCreeper.getPowered()) - { - if (par1EntityCreeper.getHasActivePotion()) - { - GL11.glDepthMask(false); - } - else - { - GL11.glDepthMask(true); - } - - if (par2 == 1) - { - float var4 = (float)par1EntityCreeper.ticksExisted + par3; - this.loadTexture("/armor/power.png"); - GL11.glMatrixMode(GL11.GL_TEXTURE); - GL11.glLoadIdentity(); - float var5 = var4 * 0.01F; - float var6 = var4 * 0.01F; - GL11.glTranslatef(var5, var6, 0.0F); - this.setRenderPassModel(this.creeperModel); - GL11.glMatrixMode(GL11.GL_MODELVIEW); - GL11.glEnable(GL11.GL_BLEND); - float var7 = 0.5F; - GL11.glColor4f(var7, var7, var7, 1.0F); - GL11.glDisable(GL11.GL_LIGHTING); - GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE); - return 1; - } - - if (par2 == 2) - { - GL11.glMatrixMode(GL11.GL_TEXTURE); - GL11.glLoadIdentity(); - GL11.glMatrixMode(GL11.GL_MODELVIEW); - GL11.glEnable(GL11.GL_LIGHTING); - GL11.glDisable(GL11.GL_BLEND); - } - } return -1; } @@ -136,17 +40,17 @@ public class SkylaRender extends RenderLiving * Allows the render to do any OpenGL state modifications necessary before the model is rendered. Args: * entityLiving, partialTickTime */ - protected void preRenderCallback(EntityLiving par1EntityLiving, float par2) + /*protected void preRenderCallback(EntityLiving par1EntityLiving, float par2) { this.updateCreeperScale((Skyla)par1EntityLiving, par2); - } + }*/ /** * Returns an ARGB int color back. Args: entityLiving, lightBrightness, partialTickTime */ protected int getColorMultiplier(EntityLiving par1EntityLiving, float par2, float par3) { - return this.updateCreeperColorMultiplier((Skyla)par1EntityLiving, par2, par3); + return super.getColorMultiplier(par1EntityLiving, par2, par3); } /** diff --git a/tinker/tconstruct/container/SmelteryContainer.java b/tinker/tconstruct/container/SmelteryContainer.java index 69c3960c..f761e8d5 100644 --- a/tinker/tconstruct/container/SmelteryContainer.java +++ b/tinker/tconstruct/container/SmelteryContainer.java @@ -148,6 +148,7 @@ public class SmelteryContainer extends Container return logic.isUseableByPlayer(entityplayer); } + @Override public ItemStack transferStackInSlot (EntityPlayer player, int slotID) { ItemStack stack = null; @@ -183,14 +184,15 @@ public class SmelteryContainer extends Container return stack; } - /*protected boolean mergeItemStack (ItemStack inputStack, int par2, int par3, boolean flag) + @Override + protected boolean mergeItemStack (ItemStack inputStack, int startSlot, int endSlot, boolean flag) { boolean merged = false; - int slotPos = par2; + int slotPos = startSlot; if (flag) { - slotPos = par3 - 1; + slotPos = endSlot - 1; } Slot slot; @@ -198,7 +200,7 @@ public class SmelteryContainer extends Container if (inputStack.isStackable()) { - while (inputStack.stackSize > 0 && (!flag && slotPos < par3 || flag && slotPos >= par2)) + while (inputStack.stackSize > 0 && (!flag && slotPos < endSlot || flag && slotPos >= startSlot)) { slot = (Slot)this.inventorySlots.get(slotPos); slotStack = slot.getStack(); @@ -242,14 +244,14 @@ public class SmelteryContainer extends Container //System.out.println("Boom"); if (flag) { - slotPos = par3 - 1; + slotPos = endSlot - 1; } else { - slotPos = par2; + slotPos = startSlot; } - while (!flag && slotPos < par3 || flag && slotPos >= par2) + while (!flag && slotPos < endSlot || flag && slotPos >= startSlot) { slot = (Slot)this.inventorySlots.get(slotPos); slotStack = slot.getStack(); @@ -277,5 +279,5 @@ public class SmelteryContainer extends Container } return merged; - }*/ + } } diff --git a/tinker/tconstruct/entity/Crystal.java b/tinker/tconstruct/entity/Crystal.java new file mode 100644 index 00000000..567b32b2 --- /dev/null +++ b/tinker/tconstruct/entity/Crystal.java @@ -0,0 +1,21 @@ +package tinker.tconstruct.entity; + +import net.minecraft.entity.monster.EntityCreeper; +import net.minecraft.world.World; + +public class Crystal extends EntityCreeper +{ + + public Crystal(World par1World) + { + super(par1World); + this.texture = "/tinkertextures/mob/crystalwater.png"; + } + + @Override + public int getMaxHealth () + { + return 100; + } + +} diff --git a/tinker/tconstruct/entity/Skyla.java b/tinker/tconstruct/entity/Skyla.java index 970a3f13..f5aaf281 100644 --- a/tinker/tconstruct/entity/Skyla.java +++ b/tinker/tconstruct/entity/Skyla.java @@ -17,248 +17,35 @@ import net.minecraft.entity.passive.EntityOcelot; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.ChunkCoordinates; import net.minecraft.util.DamageSource; import net.minecraft.world.World; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -public class Skyla extends EntityMob +public class Skyla extends EntityPlayer { - /** - * Time when this creeper was last in an active state (Messed up code here, probably causes creeper animation to go - * weird) - */ - private int lastActiveTime; - /** - * The amount of time since the creeper was close enough to the player to ignite - */ - private int timeSinceIgnited; - private int fuseTime = 30; + public Skyla(World par1World) + { + super(par1World); + username = "Skyla"; + texture = "/tinkertextures/mob/skyla.png"; + } - /** Explosion radius for this creeper. */ - private int explosionRadius = 10; + @Override + public void sendChatToPlayer (String var1) {} - public Skyla(World par1World) - { - super(par1World); - System.out.println("Hello!"); - this.texture = "/tinkertextures/mob/skyla.png"; - this.tasks.addTask(1, new EntityAISwimming(this)); - //this.tasks.addTask(2, new EntityAICreeperSwell(this)); - this.tasks.addTask(3, new EntityAIAvoidEntity(this, EntityOcelot.class, 6.0F, 0.25F, 0.3F)); - this.tasks.addTask(4, new EntityAIAttackOnCollide(this, 0.25F, false)); - this.tasks.addTask(5, new EntityAIWander(this, 0.2F)); - this.tasks.addTask(6, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F)); - this.tasks.addTask(6, new EntityAILookIdle(this)); - this.targetTasks.addTask(1, new EntityAINearestAttackableTarget(this, EntityPlayer.class, 16.0F, 0, true)); - this.targetTasks.addTask(2, new EntityAIHurtByTarget(this, false)); - } + @Override + public boolean canCommandSenderUseCommand (int var1, String var2) + { + return false; + } - /** - * Returns true if the newer Entity AI code should be run - */ - public boolean isAIEnabled() - { - return true; - } - - public int func_82143_as() - { - return this.getAttackTarget() == null ? 3 : 3 + (this.health - 1); - } - - /** - * Called when the mob is falling. Calculates and applies fall damage. - */ - protected void fall(float par1) - { - super.fall(par1); - this.timeSinceIgnited = (int)((float)this.timeSinceIgnited + par1 * 1.5F); - - if (this.timeSinceIgnited > this.fuseTime - 5) - { - this.timeSinceIgnited = this.fuseTime - 5; - } - } - - public int getMaxHealth() - { - return 20; - } - - protected void entityInit() - { - super.entityInit(); - this.dataWatcher.addObject(16, Byte.valueOf((byte) - 1)); - this.dataWatcher.addObject(17, Byte.valueOf((byte)0)); - } - - /** - * (abstract) Protected helper method to write subclass entity data to NBT. - */ - public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound) - { - super.writeEntityToNBT(par1NBTTagCompound); - - if (this.dataWatcher.getWatchableObjectByte(17) == 1) - { - par1NBTTagCompound.setBoolean("powered", true); - } - - par1NBTTagCompound.setShort("Fuse", (short)this.fuseTime); - par1NBTTagCompound.setByte("ExplosionRadius", (byte)this.explosionRadius); - } - - /** - * (abstract) Protected helper method to read subclass entity data from NBT. - */ - public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) - { - super.readEntityFromNBT(par1NBTTagCompound); - this.dataWatcher.updateObject(17, Byte.valueOf((byte)(par1NBTTagCompound.getBoolean("powered") ? 1 : 0))); - - if (par1NBTTagCompound.hasKey("Fuse")) - { - this.fuseTime = par1NBTTagCompound.getShort("Fuse"); - } - - if (par1NBTTagCompound.hasKey("ExplosionRadius")) - { - this.explosionRadius = par1NBTTagCompound.getByte("ExplosionRadius"); - } - } - - /** - * Called to update the entity's position/logic. - */ - public void onUpdate() - { - if (this.isEntityAlive()) - { - this.lastActiveTime = this.timeSinceIgnited; - int var1 = this.getCreeperState(); - - if (var1 > 0 && this.timeSinceIgnited == 0) - { - this.playSound("random.fuse", 1.0F, 0.5F); - } - - this.timeSinceIgnited += var1; - - if (this.timeSinceIgnited < 0) - { - this.timeSinceIgnited = 0; - } - - if (this.timeSinceIgnited >= this.fuseTime) - { - this.timeSinceIgnited = this.fuseTime; - - if (!this.worldObj.isRemote) - { - boolean var2 = this.worldObj.getGameRules().getGameRuleBooleanValue("mobGriefing"); - - if (this.getPowered()) - { - this.worldObj.createExplosion(this, this.posX, this.posY, this.posZ, (float)(this.explosionRadius * 2), var2); - } - else - { - this.worldObj.createExplosion(this, this.posX, this.posY, this.posZ, (float)this.explosionRadius, var2); - } - - this.setDead(); - } - } - } - - super.onUpdate(); - } - - /** - * Returns the sound this mob makes when it is hurt. - */ - protected String getHurtSound() - { - return "mob.creeper.say"; - } - - /** - * Returns the sound this mob makes on death. - */ - protected String getDeathSound() - { - return "mob.creeper.death"; - } - - /** - * Called when the mob's health reaches 0. - */ - public void onDeath(DamageSource par1DamageSource) - { - super.onDeath(par1DamageSource); - - if (par1DamageSource.getEntity() instanceof EntitySkeleton) - { - int var2 = Item.record13.itemID + this.rand.nextInt(Item.recordWait.itemID - Item.record13.itemID + 1); - this.dropItem(var2, 1); - } - } - - public boolean attackEntityAsMob(Entity par1Entity) - { - return true; - } - - /** - * Returns true if the creeper is powered by a lightning bolt. - */ - public boolean getPowered() - { - return this.dataWatcher.getWatchableObjectByte(17) == 1; - } - - @SideOnly(Side.CLIENT) - - /** - * Params: (Float)Render tick. Returns the intensity of the creeper's flash when it is ignited. - */ - public float getCreeperFlashIntensity(float par1) - { - return ((float)this.lastActiveTime + (float)(this.timeSinceIgnited - this.lastActiveTime) * par1) / (float)(this.fuseTime - 2); - } - - /** - * Returns the item ID for the item the mob drops on death. - */ - protected int getDropItemId() - { - return Item.gunpowder.itemID; - } - - /** - * Returns the current state of creeper, -1 is idle, 1 is 'in fuse' - */ - public int getCreeperState() - { - return this.dataWatcher.getWatchableObjectByte(16); - } - - /** - * Sets the state of creeper, -1 to idle and 1 to be 'in fuse' - */ - public void setCreeperState(int par1) - { - this.dataWatcher.updateObject(16, Byte.valueOf((byte)par1)); - } - - /** - * Called when a lightning bolt hits the entity. - */ - public void onStruckByLightning(EntityLightningBolt par1EntityLightningBolt) - { - super.onStruckByLightning(par1EntityLightningBolt); - this.dataWatcher.updateObject(17, Byte.valueOf((byte)1)); - } + @Override + public ChunkCoordinates getPlayerCoordinates () + { + return null; + } + } diff --git a/tinker/tconstruct/items/ToolPart.java b/tinker/tconstruct/items/ToolPart.java index 4f319c66..462b7427 100644 --- a/tinker/tconstruct/items/ToolPart.java +++ b/tinker/tconstruct/items/ToolPart.java @@ -20,7 +20,7 @@ public class ToolPart extends CraftingItem public String getItemNameIS(ItemStack stack) { - int arr = MathHelper.clamp_int(stack.getItemDamage(), 0, 15); + int arr = MathHelper.clamp_int(stack.getItemDamage(), 0, 16); return getItemName() + "." +toolMaterialNames[arr]; } diff --git a/tinker/tconstruct/player/TPlayerHandler.java b/tinker/tconstruct/player/TPlayerHandler.java new file mode 100644 index 00000000..c9137868 --- /dev/null +++ b/tinker/tconstruct/player/TPlayerHandler.java @@ -0,0 +1,162 @@ +package tinker.tconstruct.player; + +import java.util.HashMap; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraftforge.event.ForgeSubscribe; +import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent; +import net.minecraftforge.event.entity.living.LivingFallEvent; +import net.minecraftforge.event.entity.player.PlayerDropsEvent; +import tinker.tconstruct.AbilityHelper; +import tinker.tconstruct.PHConstruct; +import tinker.tconstruct.TContent; +import tinker.tconstruct.client.TProxyClient; +import cpw.mods.fml.common.FMLCommonHandler; +import cpw.mods.fml.common.IPlayerTracker; +import cpw.mods.fml.relauncher.Side; + +public class TPlayerHandler implements IPlayerTracker +{ + /* Player */ + //public int hunger; + public HashMap playerStats = new HashMap(); + + @Override + public void onPlayerLogin (EntityPlayer entityplayer) + { + //Lookup player + NBTTagCompound tags = entityplayer.getEntityData(); + if (!tags.hasKey("TConstruct")) + { + tags.setCompoundTag("TConstruct", new NBTTagCompound()); + } + TPlayerStats stats = new TPlayerStats(); + stats.player = entityplayer; + stats.level = entityplayer.experienceLevel; + stats.health = 20; //More hp in the future + stats.hunger = entityplayer.getFoodStats().getFoodLevel(); + stats.diary = tags.getCompoundTag("TConstruct").getBoolean("diary"); + if (!stats.diary) + { + tags.getCompoundTag("TConstruct").setBoolean("diary", true); + ItemStack diary = new ItemStack(TContent.manualBook); + if (!entityplayer.inventory.addItemStackToInventory(diary)) + { + AbilityHelper.spawnItemAtPlayer(entityplayer, diary); + } + } + playerStats.put(entityplayer.username, stats); + } + + @Override + public void onPlayerLogout (EntityPlayer entityplayer) + { + //Save player? + playerStats.remove(entityplayer.username); + } + + @Override + public void onPlayerChangedDimension (EntityPlayer entityplayer) + { + //Nothing? + + } + + @Override + public void onPlayerRespawn (EntityPlayer entityplayer) + { + //Boom! + TPlayerStats stats = getPlayerStats(entityplayer.username); + stats.player = entityplayer; + if (PHConstruct.keepLevels) + entityplayer.experienceLevel = stats.level; + if (PHConstruct.keepHunger) + entityplayer.getFoodStats().setFoodLevel(stats.hunger); + NBTTagCompound tags = entityplayer.getEntityData().getCompoundTag("TConstruct"); + tags.getCompoundTag("TConstruct").setBoolean("diary", stats.diary); + } + + @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(); + } + + TPlayerStats getPlayerStats (String username) //Not sure if needed + { + TPlayerStats stats = playerStats.get(username); + 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; + } + } + + @ForgeSubscribe + public void livingFall (LivingFallEvent evt) //Only for negating fall damage + { + if (evt.entityLiving instanceof EntityPlayer) + { + Side side = FMLCommonHandler.instance().getEffectiveSide(); + if (side == Side.CLIENT) + { + TProxyClient.controlInstance.landOnGround(); + + //System.out.println("Client side: "+evt.entityLiving.motionY); + } + else + System.out.println("Server side"); + + evt.distance -= 1; + //evt.distance = 0; + //TPlayerStats stats = playerStats.get(((EntityPlayer)evt.entityLiving).username); + //stats.prevMotionY = evt.entityLiving.motionY; + //evt.entityLiving.motionY = 10.2; + } + } + + /*@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); + } + } + }*/ +} diff --git a/tinker/tconstruct/player/TPlayerStats.java b/tinker/tconstruct/player/TPlayerStats.java new file mode 100644 index 00000000..7e2c1120 --- /dev/null +++ b/tinker/tconstruct/player/TPlayerStats.java @@ -0,0 +1,15 @@ +package tinker.tconstruct.player; + +import net.minecraft.entity.player.EntityPlayer; + +public class TPlayerStats +{ + public EntityPlayer player; + public int level; + public int health; + public int hunger; + public boolean diary; + + //public boolean prevOnGround; + //public double prevMotionY; +}