Last commit for 1.4.7
BIN
resources/tinkertextures/blocks/castingtable_bottom.png
Normal file
After Width: | Height: | Size: 273 B |
BIN
resources/tinkertextures/blocks/castingtable_side.png
Normal file
After Width: | Height: | Size: 373 B |
BIN
resources/tinkertextures/blocks/castingtable_top.png
Normal file
After Width: | Height: | Size: 255 B |
BIN
resources/tinkertextures/blocks/compressed_alubrass.png
Normal file
After Width: | Height: | Size: 232 B |
BIN
resources/tinkertextures/blocks/compressed_aluminum.png
Normal file
After Width: | Height: | Size: 445 B |
BIN
resources/tinkertextures/blocks/compressed_alumite.png
Normal file
After Width: | Height: | Size: 423 B |
BIN
resources/tinkertextures/blocks/compressed_ardite.png
Normal file
After Width: | Height: | Size: 362 B |
BIN
resources/tinkertextures/blocks/compressed_bronze.png
Normal file
After Width: | Height: | Size: 380 B |
BIN
resources/tinkertextures/blocks/compressed_cobalt.png
Normal file
After Width: | Height: | Size: 460 B |
BIN
resources/tinkertextures/blocks/compressed_copper.png
Normal file
After Width: | Height: | Size: 449 B |
BIN
resources/tinkertextures/blocks/compressed_manyullyn.png
Normal file
After Width: | Height: | Size: 443 B |
BIN
resources/tinkertextures/blocks/compressed_steel.png
Normal file
After Width: | Height: | Size: 481 B |
BIN
resources/tinkertextures/blocks/compressed_tin.png
Normal file
After Width: | Height: | Size: 473 B |
BIN
resources/tinkertextures/blocks/drain_basin.png
Normal file
After Width: | Height: | Size: 381 B |
BIN
resources/tinkertextures/blocks/drain_out.png
Normal file
After Width: | Height: | Size: 336 B |
BIN
resources/tinkertextures/blocks/drain_side.png
Normal file
After Width: | Height: | Size: 406 B |
BIN
resources/tinkertextures/blocks/faucet.png
Normal file
After Width: | Height: | Size: 293 B |
BIN
resources/tinkertextures/blocks/grout.png
Normal file
After Width: | Height: | Size: 547 B |
BIN
resources/tinkertextures/blocks/lavatank_side.png
Normal file
After Width: | Height: | Size: 379 B |
BIN
resources/tinkertextures/blocks/lavatank_top.png
Normal file
After Width: | Height: | Size: 417 B |
BIN
resources/tinkertextures/blocks/nether_ardite.png
Normal file
After Width: | Height: | Size: 719 B |
BIN
resources/tinkertextures/blocks/nether_cobalt.png
Normal file
After Width: | Height: | Size: 628 B |
BIN
resources/tinkertextures/blocks/nether_slag.png
Normal file
After Width: | Height: | Size: 624 B |
BIN
resources/tinkertextures/blocks/ore_aluminum.png
Normal file
After Width: | Height: | Size: 334 B |
BIN
resources/tinkertextures/blocks/ore_copper.png
Normal file
After Width: | Height: | Size: 267 B |
BIN
resources/tinkertextures/blocks/ore_slag.png
Normal file
After Width: | Height: | Size: 930 B |
BIN
resources/tinkertextures/blocks/ore_tin.png
Normal file
After Width: | Height: | Size: 272 B |
BIN
resources/tinkertextures/blocks/partbuilder_birch_bottom.png
Normal file
After Width: | Height: | Size: 742 B |
BIN
resources/tinkertextures/blocks/partbuilder_birch_side.png
Normal file
After Width: | Height: | Size: 675 B |
BIN
resources/tinkertextures/blocks/partbuilder_birch_top.png
Normal file
After Width: | Height: | Size: 319 B |
BIN
resources/tinkertextures/blocks/partbuilder_jungle_bottom.png
Normal file
After Width: | Height: | Size: 609 B |
BIN
resources/tinkertextures/blocks/partbuilder_jungle_side.png
Normal file
After Width: | Height: | Size: 569 B |
BIN
resources/tinkertextures/blocks/partbuilder_jungle_top.png
Normal file
After Width: | Height: | Size: 319 B |
BIN
resources/tinkertextures/blocks/partbuilder_oak_bottom.png
Normal file
After Width: | Height: | Size: 528 B |
BIN
resources/tinkertextures/blocks/partbuilder_oak_side.png
Normal file
After Width: | Height: | Size: 510 B |
BIN
resources/tinkertextures/blocks/partbuilder_oak_top.png
Normal file
After Width: | Height: | Size: 319 B |
BIN
resources/tinkertextures/blocks/partbuilder_spruce_bottom.png
Normal file
After Width: | Height: | Size: 451 B |
BIN
resources/tinkertextures/blocks/partbuilder_spruce_side.png
Normal file
After Width: | Height: | Size: 461 B |
BIN
resources/tinkertextures/blocks/partbuilder_spruce_top.png
Normal file
After Width: | Height: | Size: 319 B |
BIN
resources/tinkertextures/blocks/patternchest_bottom.png
Normal file
After Width: | Height: | Size: 410 B |
BIN
resources/tinkertextures/blocks/patternchest_side.png
Normal file
After Width: | Height: | Size: 391 B |
BIN
resources/tinkertextures/blocks/patternchest_top.png
Normal file
After Width: | Height: | Size: 410 B |
BIN
resources/tinkertextures/blocks/searedbrick.png
Normal file
After Width: | Height: | Size: 404 B |
BIN
resources/tinkertextures/blocks/searedgague_bottom.png
Normal file
After Width: | Height: | Size: 236 B |
BIN
resources/tinkertextures/blocks/searedgague_side.png
Normal file
After Width: | Height: | Size: 264 B |
BIN
resources/tinkertextures/blocks/searedgague_top.png
Normal file
After Width: | Height: | Size: 258 B |
BIN
resources/tinkertextures/blocks/searedwindow_bottom.png
Normal file
After Width: | Height: | Size: 231 B |
BIN
resources/tinkertextures/blocks/searedwindow_side.png
Normal file
After Width: | Height: | Size: 304 B |
BIN
resources/tinkertextures/blocks/searedwindow_top.png
Normal file
After Width: | Height: | Size: 218 B |
BIN
resources/tinkertextures/blocks/slimesand.png
Normal file
After Width: | Height: | Size: 771 B |
BIN
resources/tinkertextures/blocks/smeltery_active.png
Normal file
After Width: | Height: | Size: 433 B |
BIN
resources/tinkertextures/blocks/smeltery_inactive.png
Normal file
After Width: | Height: | Size: 411 B |
BIN
resources/tinkertextures/blocks/smeltery_side.png
Normal file
After Width: | Height: | Size: 404 B |
BIN
resources/tinkertextures/blocks/stenciltable_birch_bottom.png
Normal file
After Width: | Height: | Size: 265 B |
BIN
resources/tinkertextures/blocks/stenciltable_birch_side.png
Normal file
After Width: | Height: | Size: 314 B |
BIN
resources/tinkertextures/blocks/stenciltable_jungle_bottom.png
Normal file
After Width: | Height: | Size: 263 B |
BIN
resources/tinkertextures/blocks/stenciltable_jungle_side.png
Normal file
After Width: | Height: | Size: 302 B |
BIN
resources/tinkertextures/blocks/stenciltable_jungle_top.png
Normal file
After Width: | Height: | Size: 321 B |
BIN
resources/tinkertextures/blocks/stenciltable_oak_bottom.png
Normal file
After Width: | Height: | Size: 247 B |
BIN
resources/tinkertextures/blocks/stenciltable_oak_side.png
Normal file
After Width: | Height: | Size: 257 B |
BIN
resources/tinkertextures/blocks/stenciltable_oak_top.png
Normal file
After Width: | Height: | Size: 321 B |
BIN
resources/tinkertextures/blocks/stenciltable_spruce_bottom.png
Normal file
After Width: | Height: | Size: 254 B |
BIN
resources/tinkertextures/blocks/stenciltable_spruce_side.png
Normal file
After Width: | Height: | Size: 298 B |
BIN
resources/tinkertextures/blocks/stenciltable_spruce_top.png
Normal file
After Width: | Height: | Size: 321 B |
BIN
resources/tinkertextures/blocks/toolstation_bottom.png
Normal file
After Width: | Height: | Size: 247 B |
BIN
resources/tinkertextures/blocks/toolstation_side.png
Normal file
After Width: | Height: | Size: 273 B |
BIN
resources/tinkertextures/blocks/toolstation_top.png
Normal file
After Width: | Height: | Size: 304 B |
BIN
resources/tinkertextures/mob/crystalwater.png
Normal file
After Width: | Height: | Size: 1.6 KiB |
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
@ -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();
|
||||
|
@ -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()
|
||||
|
120
tinker/tconstruct/TControls.java
Normal file
@ -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<TickType> type, Object... tickData)
|
||||
{
|
||||
super.tickStart(type, tickData);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tickEnd(EnumSet<TickType> type, Object... tickData)
|
||||
{
|
||||
super.tickEnd(type, tickData);
|
||||
}*/
|
||||
|
||||
@Override
|
||||
public String getLabel ()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void keyDown (EnumSet<TickType> 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<TickType> types, KeyBinding kb, boolean tickEnd)
|
||||
{
|
||||
//landOnGround();
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumSet<TickType> 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);
|
||||
}
|
||||
}
|
@ -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)
|
||||
{
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -16,6 +16,8 @@ public class TProxyCommon
|
||||
|
||||
public void readManuals() {}
|
||||
|
||||
public void registerKeys() {}
|
||||
|
||||
public File getLocation()
|
||||
{
|
||||
return new File(".");
|
||||
|
126
tinker/tconstruct/client/TKeyHandler.java
Normal file
@ -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<TickType> type, Object... tickData)
|
||||
{
|
||||
keyTick(type, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tickEnd(EnumSet<TickType> type, Object... tickData)
|
||||
{
|
||||
keyTick(type, true);
|
||||
}
|
||||
|
||||
private void keyTick(EnumSet<TickType> 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<TickType> 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<TickType> 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<TickType> ticks();
|
||||
}
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
54
tinker/tconstruct/client/entityrender/CrystalModel.java
Normal file
@ -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);
|
||||
}
|
||||
|
||||
}
|
164
tinker/tconstruct/client/entityrender/CrystalRender.java
Normal file
@ -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);
|
||||
}
|
||||
}
|
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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;
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
21
tinker/tconstruct/entity/Crystal.java
Normal file
@ -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;
|
||||
}
|
||||
|
||||
}
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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];
|
||||
}
|
||||
|
||||
|
162
tinker/tconstruct/player/TPlayerHandler.java
Normal file
@ -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<String, TPlayerStats> playerStats = new HashMap<String, TPlayerStats>();
|
||||
|
||||
@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);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
15
tinker/tconstruct/player/TPlayerStats.java
Normal file
@ -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;
|
||||
}
|