Begin skill creation
This commit is contained in:
parent
8a3dac472d
commit
5f73c2152e
@ -172,6 +172,7 @@
|
||||
<entry key="item.tconstruct.canister.empty.name">Empty Canister</entry>
|
||||
<entry key="item.tconstruct.canister.miniheart.red.name">Miniature Red Heart</entry>
|
||||
<entry key="item.tconstruct.canister.heart.name">Heart Canister</entry>
|
||||
<entry key="item.tconstruct.glove.name">Dirtmover Gloves</entry>
|
||||
|
||||
<entry key="SearedBlock.Table.name">Casting Table</entry>
|
||||
<entry key="SearedBlock.Faucet.name">Seared Faucet</entry>
|
||||
|
@ -2,20 +2,21 @@ package mods.tinker.tconstruct;
|
||||
|
||||
import mods.tinker.tconstruct.common.TContent;
|
||||
import mods.tinker.tconstruct.common.TProxyCommon;
|
||||
import mods.tinker.tconstruct.library.SkillRegistry;
|
||||
import mods.tinker.tconstruct.library.TConstructRegistry;
|
||||
import mods.tinker.tconstruct.library.crafting.Detailing;
|
||||
import mods.tinker.tconstruct.library.crafting.LiquidCasting;
|
||||
import mods.tinker.tconstruct.library.util.TabTools;
|
||||
import mods.tinker.tconstruct.skill.Jump;
|
||||
import mods.tinker.tconstruct.skill.WallBuilding;
|
||||
import mods.tinker.tconstruct.util.PHConstruct;
|
||||
import mods.tinker.tconstruct.util.TCraftingHandler;
|
||||
import mods.tinker.tconstruct.util.TEventHandler;
|
||||
import mods.tinker.tconstruct.util.player.TPlayerHandler;
|
||||
import mods.tinker.tconstruct.worldgen.OverworldProvider;
|
||||
import mods.tinker.tconstruct.worldgen.TBaseWorldGenerator;
|
||||
import mods.tinker.tconstruct.worldgen.village.TVillageTrades;
|
||||
import mods.tinker.tconstruct.worldgen.village.VillageSmelteryHandler;
|
||||
import mods.tinker.tconstruct.worldgen.village.VillageToolStationHandler;
|
||||
import net.minecraftforge.common.DimensionManager;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import cpw.mods.fml.common.Mod;
|
||||
import cpw.mods.fml.common.Mod.Init;
|
||||
@ -37,7 +38,7 @@ import cpw.mods.fml.common.registry.VillagerRegistry;
|
||||
* @dependencies: IC2 API, MFR API
|
||||
*/
|
||||
|
||||
@Mod(modid = "TConstruct", name = "TConstruct", version = "1.5.1_1.3.dev49", dependencies = "required-after:Forge@[7.7.1.675,)")
|
||||
@Mod(modid = "TConstruct", name = "TConstruct", version = "1.5.1_1.3.4", dependencies = "required-after:Forge@[7.7.1.675,)")
|
||||
@NetworkMod(serverSideRequired = false, clientSideRequired = true, channels = { "TConstruct" }, packetHandler = mods.tinker.tconstruct.util.network.TPacketHandler.class)
|
||||
public class TConstruct
|
||||
{
|
||||
@ -106,6 +107,8 @@ public class TConstruct
|
||||
|
||||
content.modIntegration();
|
||||
content.createEntities();
|
||||
SkillRegistry.registerSkill("Wall Building", new WallBuilding());
|
||||
SkillRegistry.registerSkill("Jump", new Jump());
|
||||
}
|
||||
|
||||
public static LiquidCasting getTableCasting()
|
||||
@ -122,11 +125,12 @@ public class TConstruct
|
||||
{
|
||||
return chiselDetailing;
|
||||
}
|
||||
|
||||
|
||||
public static TEventHandler events;
|
||||
public static TPlayerHandler playerTracker;
|
||||
public static TContent content;
|
||||
public static LiquidCasting tableCasting;
|
||||
public static LiquidCasting basinCasting;
|
||||
public static Detailing chiselDetailing;
|
||||
public static SkillRegistry skillRegistry;
|
||||
}
|
||||
|
@ -116,7 +116,7 @@ public class OreberryBush extends BlockLeavesBase implements IPlantable
|
||||
}
|
||||
else
|
||||
{
|
||||
return AxisAlignedBB.getBoundingBox(x, y, z, (double) x + 1.0D, (double) y + 1.0D, (double) z + 1.0D);
|
||||
return AxisAlignedBB.getBoundingBox(x+0.0625, y, z+0.0625, (double) x + 0.9375D, (double) y + 0.9375D, (double) z + 0.9375D);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -612,7 +612,8 @@ public class SmelteryLogic extends InventoryLogic implements IActiveLogic, IFaci
|
||||
{
|
||||
for (int zPos = z - 1; zPos <= z + 1; zPos++)
|
||||
{
|
||||
if (worldObj.getBlockId(xPos, y, zPos) != 0)
|
||||
Block block = Block.blocksList[worldObj.getBlockId(xPos, y, zPos)];
|
||||
if (block != null && block.isAirBlock(worldObj, xPos, y, zPos))
|
||||
return count;
|
||||
}
|
||||
}
|
||||
@ -646,7 +647,8 @@ public class SmelteryLogic extends InventoryLogic implements IActiveLogic, IFaci
|
||||
for (int zPos = z - 1; zPos <= z + 1; zPos++)
|
||||
{
|
||||
int blockID = worldObj.getBlockId(xPos, y, zPos);
|
||||
if (blockID != 0)
|
||||
Block block = Block.blocksList[blockID];
|
||||
if (block != null && !block.isAirBlock(worldObj, xPos, y, zPos))
|
||||
{
|
||||
if (blockID == TContent.smeltery.blockID)
|
||||
return validateBottom(x, y, z, count);
|
||||
|
@ -1,8 +1,12 @@
|
||||
package mods.tinker.tconstruct.client;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import mods.tinker.tconstruct.TConstruct;
|
||||
import mods.tinker.tconstruct.client.armor.WingModel;
|
||||
import mods.tinker.tconstruct.common.TContent;
|
||||
import mods.tinker.tconstruct.skill.Skill;
|
||||
import mods.tinker.tconstruct.util.player.TPlayerStats;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.ScaledResolution;
|
||||
import net.minecraft.client.model.ModelBiped;
|
||||
@ -13,7 +17,12 @@ import net.minecraftforge.client.event.RenderGameOverlayEvent;
|
||||
import net.minecraftforge.client.event.TextureStitchEvent;
|
||||
import net.minecraftforge.client.event.sound.SoundLoadEvent;
|
||||
import net.minecraftforge.event.ForgeSubscribe;
|
||||
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
|
||||
import net.minecraftforge.event.entity.player.PlayerInteractEvent.Action;
|
||||
import net.minecraftforge.liquids.LiquidStack;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@ -22,6 +31,22 @@ public class TClientEvents
|
||||
{
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
EntityPlayer player;
|
||||
|
||||
/*@ForgeSubscribe
|
||||
public void interact (PlayerInteractEvent event)
|
||||
{
|
||||
if (event.action == Action.RIGHT_CLICK_BLOCK && event.entityPlayer.worldObj.isRemote)
|
||||
{
|
||||
System.out.println("Fired");
|
||||
List<Skill> skills = TProxyClient.skillList;
|
||||
if (skills.size() > 0)
|
||||
{
|
||||
Skill walls = TConstruct.playerTracker.getPlayerStats(event.entityPlayer.username).skillList.get(0);
|
||||
walls.rightClickActivate(event.entityPlayer, event.entityPlayer.worldObj);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
/* Sounds */
|
||||
@ForgeSubscribe
|
||||
public void onSound (SoundLoadEvent event)
|
||||
@ -51,20 +76,22 @@ public class TClientEvents
|
||||
}
|
||||
}
|
||||
|
||||
/* Health */
|
||||
/* HUD */
|
||||
@ForgeSubscribe
|
||||
public void renderHealthbar (RenderGameOverlayEvent.Post event)
|
||||
{
|
||||
if (player == null)
|
||||
player = mc.thePlayer;
|
||||
|
||||
ScaledResolution scaledresolution = new ScaledResolution(this.mc.gameSettings, this.mc.displayWidth, this.mc.displayHeight);
|
||||
int scaledWidth = scaledresolution.getScaledWidth();
|
||||
int scaledHeight = scaledresolution.getScaledHeight();
|
||||
int xBasePos = scaledWidth / 2 - 91;
|
||||
int yBasePos = scaledHeight - 39;
|
||||
TPlayerStats stats = TConstruct.playerTracker.getPlayerStats(player.username);
|
||||
|
||||
if (event.type == RenderGameOverlayEvent.ElementType.HEALTH)
|
||||
{
|
||||
if (player == null)
|
||||
player = mc.thePlayer;
|
||||
|
||||
ScaledResolution scaledresolution = new ScaledResolution(this.mc.gameSettings, this.mc.displayWidth, this.mc.displayHeight);
|
||||
int scaledWidth = scaledresolution.getScaledWidth();
|
||||
int scaledHeight = scaledresolution.getScaledHeight();
|
||||
int xBasePos = scaledWidth / 2 - 91;
|
||||
int yBasePos = scaledHeight - 39;
|
||||
{
|
||||
this.mc.renderEngine.bindTexture("/mods/tinker/textures/gui/newhearts.png");
|
||||
|
||||
int hp = player.getHealth();
|
||||
@ -85,9 +112,22 @@ public class TClientEvents
|
||||
|
||||
this.mc.renderEngine.bindTexture("/gui/icons.png");
|
||||
}
|
||||
|
||||
if (event.type == RenderGameOverlayEvent.ElementType.HOTBAR)
|
||||
{
|
||||
int amount = 0;
|
||||
GL11.glScalef(1/16f, 1/16f, 1/16f);
|
||||
for (Skill skill : stats.skillList)
|
||||
{
|
||||
if (!skill.getActive())
|
||||
GL11.glColor4f(0.5f, 0.5f, 0.5f, 1.0F);
|
||||
this.mc.renderEngine.bindTexture(skill.getTextureFile(scaledresolution.getScaleFactor()));
|
||||
this.drawTexturedModalRect((2+amount*18)*16, 32, 0, 0, 256, 256);
|
||||
amount++;
|
||||
}
|
||||
GL11.glScalef(16f, 16f, 16f);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void drawTexturedModalRect(int par1, int par2, int par3, int par4, int par5, int par6)
|
||||
{
|
||||
|
@ -4,13 +4,13 @@ import java.io.ByteArrayOutputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.util.EnumSet;
|
||||
|
||||
import mods.tinker.tconstruct.client.gui.InventoryTab;
|
||||
import net.minecraft.block.Block;
|
||||
import mods.tinker.tconstruct.TConstruct;
|
||||
import mods.tinker.tconstruct.skill.Skill;
|
||||
import mods.tinker.tconstruct.util.player.TPlayerStats;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.inventory.GuiInventory;
|
||||
import net.minecraft.client.settings.KeyBinding;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.network.packet.Packet250CustomPayload;
|
||||
import cpw.mods.fml.common.TickType;
|
||||
import cpw.mods.fml.common.network.PacketDispatcher;
|
||||
@ -19,22 +19,29 @@ public class TControls extends TKeyHandler
|
||||
{
|
||||
//static KeyBinding grabKey = new KeyBinding("key.grab", 29);
|
||||
//static KeyBinding stiltsKey = new KeyBinding("key.stilts", 46);
|
||||
public static KeyBinding armorKey = new KeyBinding("key.tarmor", 24);
|
||||
public static KeyBinding armorKey = new KeyBinding("key.tarmor", 24);
|
||||
public static KeyBinding skillOne = new KeyBinding("key.skill.one", 44);
|
||||
public static KeyBinding skillTwo = new KeyBinding("key.skill.two", 45);
|
||||
public static KeyBinding skillThree = new KeyBinding("key.skill.three", 46);
|
||||
public static KeyBinding skillFour = new KeyBinding("key.skill.four", 47);
|
||||
public static KeyBinding skillFive = new KeyBinding("key.skill.five", 48);
|
||||
static KeyBinding jumpKey;
|
||||
static KeyBinding invKey;
|
||||
static Minecraft mc;
|
||||
|
||||
boolean jumping;
|
||||
boolean doubleJump = true;
|
||||
boolean climbing = false;
|
||||
boolean onGround = false;
|
||||
boolean onStilts = false;
|
||||
|
||||
|
||||
//boolean onStilts = false;
|
||||
|
||||
public TControls()
|
||||
{
|
||||
super(new KeyBinding[] { armorKey }, new boolean[] { false }, getVanillaKeyBindings(), new boolean[] { false, false });
|
||||
//System.out.println("Controls registered");
|
||||
super(new KeyBinding[] { armorKey, skillOne, skillTwo, skillThree, skillFour, skillFive }, new boolean[] { false, false, false, false, false, false }, getVanillaKeyBindings(), new boolean[] {
|
||||
false, false });
|
||||
//System.out.println("Controls registered");Natura
|
||||
}
|
||||
|
||||
private static KeyBinding[] getVanillaKeyBindings ()
|
||||
@ -56,15 +63,34 @@ public class TControls extends TKeyHandler
|
||||
{
|
||||
if (tickEnd && mc.theWorld != null)
|
||||
{
|
||||
if (kb == armorKey && mc.currentScreen == null) //Extended Armor
|
||||
{
|
||||
openArmorGui(mc.thePlayer.username);
|
||||
}
|
||||
if (kb == invKey && mc.currentScreen != null && mc.currentScreen.getClass() == GuiInventory.class)// && !mc.playerController.isInCreativeMode())
|
||||
{
|
||||
TProxyClient.addTabsToInventory();
|
||||
|
||||
}
|
||||
if (kb == armorKey && mc.currentScreen == null) //Extended Armor
|
||||
{
|
||||
openArmorGui();//mc.thePlayer.username);
|
||||
}
|
||||
if (kb == invKey && mc.currentScreen != null && mc.currentScreen.getClass() == GuiInventory.class)// && !mc.playerController.isInCreativeMode())
|
||||
{
|
||||
TProxyClient.addTabsToInventory();
|
||||
}
|
||||
if (kb == skillOne)
|
||||
{
|
||||
sendSkillkey(mc.thePlayer, (byte) 0);//, mc.thePlayer.dimension, mc.thePlayer.entityId);
|
||||
}
|
||||
if (kb == skillTwo)
|
||||
{
|
||||
sendSkillkey(mc.thePlayer, (byte) 1);//, mc.thePlayer.dimension, mc.thePlayer.entityId);
|
||||
}
|
||||
if (kb == skillThree)
|
||||
{
|
||||
sendSkillkey(mc.thePlayer, (byte) 2);//, mc.thePlayer.dimension, mc.thePlayer.entityId);
|
||||
}
|
||||
if (kb == skillFour)
|
||||
{
|
||||
sendSkillkey(mc.thePlayer, (byte) 3);//, mc.thePlayer.dimension, mc.thePlayer.entityId);
|
||||
}
|
||||
if (kb == skillFive)
|
||||
{
|
||||
sendSkillkey(mc.thePlayer, (byte) 4);//, mc.thePlayer.dimension, mc.thePlayer.entityId);
|
||||
}
|
||||
/*if (kb == jumpKey) //Double jump
|
||||
{
|
||||
if (jumping && !doubleJump)
|
||||
@ -124,8 +150,8 @@ public class TControls extends TKeyHandler
|
||||
doubleJump = false;
|
||||
jumping = false;
|
||||
}
|
||||
|
||||
public void resetControls()
|
||||
|
||||
public void resetControls ()
|
||||
{
|
||||
doubleJump = false;
|
||||
jumping = false;
|
||||
@ -150,7 +176,7 @@ public class TControls extends TKeyHandler
|
||||
|
||||
updateServer(bos);
|
||||
}
|
||||
|
||||
|
||||
void updateSize (String name, float size)
|
||||
{
|
||||
ByteArrayOutputStream bos = new ByteArrayOutputStream(8);
|
||||
@ -168,25 +194,57 @@ public class TControls extends TKeyHandler
|
||||
|
||||
updateServer(bos);
|
||||
}
|
||||
|
||||
public static void openArmorGui(String username)
|
||||
{
|
||||
ByteArrayOutputStream bos = new ByteArrayOutputStream(8);
|
||||
DataOutputStream outputStream = new DataOutputStream(bos);
|
||||
try
|
||||
{
|
||||
outputStream.writeByte(3);
|
||||
outputStream.writeUTF(username);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ex.printStackTrace();
|
||||
}
|
||||
|
||||
updateServer(bos);
|
||||
public static void openArmorGui ()//String username)
|
||||
{
|
||||
ByteArrayOutputStream bos = new ByteArrayOutputStream(8);
|
||||
DataOutputStream outputStream = new DataOutputStream(bos);
|
||||
try
|
||||
{
|
||||
outputStream.writeByte(3);
|
||||
//outputStream.writeUTF(username);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ex.printStackTrace();
|
||||
}
|
||||
|
||||
updateServer(bos);
|
||||
}
|
||||
|
||||
static void updateServer(ByteArrayOutputStream bos)
|
||||
/*public void activateSkill (EntityPlayer player, int slot)
|
||||
{
|
||||
if (TProxyClient.skillList.size() > slot)
|
||||
{
|
||||
Skill skill = TProxyClient.skillList.get(slot);
|
||||
if (skill != null)
|
||||
{
|
||||
skill.activate(player, player.worldObj);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
public void sendSkillkey (EntityPlayer player, byte key)//, int dim, int id)
|
||||
{
|
||||
TConstruct.playerTracker.activateSkill(player, key);
|
||||
ByteArrayOutputStream bos = new ByteArrayOutputStream(8);
|
||||
DataOutputStream outputStream = new DataOutputStream(bos);
|
||||
try
|
||||
{
|
||||
outputStream.writeByte(4);
|
||||
//outputStream.writeInt(dim);
|
||||
//outputStream.writeInt(id);
|
||||
outputStream.writeByte(key);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ex.printStackTrace();
|
||||
}
|
||||
|
||||
updateServer(bos);
|
||||
}
|
||||
|
||||
static void updateServer (ByteArrayOutputStream bos)
|
||||
{
|
||||
Packet250CustomPayload packet = new Packet250CustomPayload();
|
||||
packet.channel = "TConstruct";
|
||||
|
@ -9,7 +9,6 @@ import java.util.List;
|
||||
import javax.xml.parsers.DocumentBuilder;
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
|
||||
import mods.natura.entity.NitroCreeper;
|
||||
import mods.tinker.tconstruct.TConstruct;
|
||||
import mods.tinker.tconstruct.blocks.logic.CastingBasinLogic;
|
||||
import mods.tinker.tconstruct.blocks.logic.CastingTableLogic;
|
||||
@ -67,7 +66,9 @@ import mods.tinker.tconstruct.library.client.TConstructClientRegistry;
|
||||
import mods.tinker.tconstruct.library.client.ToolGuiElement;
|
||||
import mods.tinker.tconstruct.library.crafting.ToolBuilder;
|
||||
import mods.tinker.tconstruct.library.tools.ToolCore;
|
||||
import mods.tinker.tconstruct.skill.Skill;
|
||||
import mods.tinker.tconstruct.util.player.ArmorExtended;
|
||||
import mods.tinker.tconstruct.util.player.ArmorExtendedClient;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.Minecraft;
|
||||
@ -99,7 +100,6 @@ import net.minecraft.client.particle.EntitySplashFX;
|
||||
import net.minecraft.client.particle.EntitySuspendFX;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.entity.RenderCreeper;
|
||||
import net.minecraft.client.renderer.entity.RenderItem;
|
||||
import net.minecraft.client.settings.GameSettings;
|
||||
import net.minecraft.client.settings.KeyBinding;
|
||||
@ -125,8 +125,9 @@ public class TProxyClient extends TProxyCommon
|
||||
public static SmallFontRenderer smallFontRenderer;
|
||||
public static Icon metalBall;
|
||||
public static Minecraft mc;
|
||||
public static ArmorExtended armorExtended = new ArmorExtended();
|
||||
public static RenderItem itemRenderer = new RenderItem();
|
||||
|
||||
public static ArmorExtended armorExtended = new ArmorExtended();
|
||||
|
||||
@Override
|
||||
public Object getClientGuiElement (int ID, EntityPlayer player, World world, int x, int y, int z)
|
||||
|
@ -65,7 +65,7 @@ public class InventoryTab extends GuiButton
|
||||
if (this.id == 2)
|
||||
TProxyClient.openInventoryGui();
|
||||
if (this.id == 3)
|
||||
TControls.openArmorGui(mc.thePlayer.username);
|
||||
TControls.openArmorGui();//mc.thePlayer.username);
|
||||
}
|
||||
return inWindow;
|
||||
}
|
||||
|
@ -47,6 +47,7 @@ import mods.tinker.tconstruct.items.StrangeFood;
|
||||
import mods.tinker.tconstruct.items.TitleIcon;
|
||||
import mods.tinker.tconstruct.items.ToolPart;
|
||||
import mods.tinker.tconstruct.items.ToolShard;
|
||||
import mods.tinker.tconstruct.items.armor.Glove;
|
||||
import mods.tinker.tconstruct.items.armor.TArmorBase;
|
||||
import mods.tinker.tconstruct.items.blocks.CraftedSoilItemBlock;
|
||||
import mods.tinker.tconstruct.items.blocks.GravelOreItem;
|
||||
@ -233,11 +234,12 @@ public class TContent implements IFuelHandler
|
||||
public static Item notebook;
|
||||
public static Item note;
|
||||
|
||||
//Wearaables
|
||||
//Wearables
|
||||
public static Item heavyHelmet;
|
||||
public static Item heavyChestplate;
|
||||
public static Item heavyPants;
|
||||
public static Item heavyBoots;
|
||||
public static Item glove;
|
||||
|
||||
public static Item heartCanister;
|
||||
|
||||
@ -484,6 +486,7 @@ public class TContent implements IFuelHandler
|
||||
//heavyHelmet = new TArmorBase(PHConstruct.heavyHelmet, 0).setUnlocalizedName("tconstruct.HeavyHelmet");
|
||||
heartCanister = new HeartCanister(PHConstruct.heartCanister).setUnlocalizedName("tconstruct.canister");
|
||||
heavyBoots = new TArmorBase(PHConstruct.heavyBoots, 3).setUnlocalizedName("tconstruct.HeavyBoots");
|
||||
glove = new Glove(PHConstruct.glove).setUnlocalizedName("tconstruct.Glove");
|
||||
/*public static Item heavyHelmet;
|
||||
public static Item heavyChestplate;
|
||||
public static Item heavyPants;
|
||||
|
@ -40,7 +40,7 @@ public class HeartCanister extends CraftingItem
|
||||
slotStack.stackSize++;
|
||||
stack.stackSize--;
|
||||
}
|
||||
armor.recalculateHealth();
|
||||
armor.recalculateHealth(player, stats);
|
||||
}
|
||||
}
|
||||
return stack;
|
||||
|
@ -2,7 +2,6 @@ package mods.tinker.tconstruct.items;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import mods.natura.entity.NitroCreeper;
|
||||
import mods.tinker.tconstruct.client.TProxyClient;
|
||||
import mods.tinker.tconstruct.entity.BlueSlime;
|
||||
import mods.tinker.tconstruct.library.tools.ToolCore;
|
||||
@ -10,7 +9,6 @@ import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.texture.IconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityList;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
@ -106,9 +104,6 @@ public class TitleIcon extends Item
|
||||
case 1:
|
||||
spawnBossSlime(posX, posY, posZ, new BlueSlime(world), world, player);
|
||||
break;
|
||||
case 2:
|
||||
spawnEntity(posX, posY, posZ, new NitroCreeper(world), world, player);
|
||||
break;
|
||||
}
|
||||
if (!player.capabilities.isCreativeMode)
|
||||
{
|
||||
|
20
mods/tinker/tconstruct/items/armor/Glove.java
Normal file
20
mods/tinker/tconstruct/items/armor/Glove.java
Normal file
@ -0,0 +1,20 @@
|
||||
package mods.tinker.tconstruct.items.armor;
|
||||
|
||||
import mods.tinker.tconstruct.library.TConstructRegistry;
|
||||
import net.minecraft.client.renderer.texture.IconRegister;
|
||||
import net.minecraft.item.Item;
|
||||
|
||||
public class Glove extends Item
|
||||
{
|
||||
public Glove(int par1)
|
||||
{
|
||||
super(par1);
|
||||
this.setCreativeTab(TConstructRegistry.materialTab);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerIcons (IconRegister iconRegister)
|
||||
{
|
||||
itemIcon = iconRegister.registerIcon("tinker:armor/dirthand");
|
||||
}
|
||||
}
|
24
mods/tinker/tconstruct/library/SkillRegistry.java
Normal file
24
mods/tinker/tconstruct/library/SkillRegistry.java
Normal file
@ -0,0 +1,24 @@
|
||||
package mods.tinker.tconstruct.library;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import mods.tinker.tconstruct.skill.Skill;
|
||||
|
||||
public class SkillRegistry
|
||||
{
|
||||
public static HashMap<String, Skill> skills = new HashMap<String, Skill>();
|
||||
|
||||
static int skillID = 0;
|
||||
public static HashMap<Integer, String> skillMapping = new HashMap<Integer, String>(); //Simplifies network transmission
|
||||
|
||||
public static void registerSkill(String name, Skill skill)
|
||||
{
|
||||
skills.put(name, skill);
|
||||
skillMapping.put(getNextID(), name);
|
||||
}
|
||||
|
||||
static Integer getNextID ()
|
||||
{
|
||||
return skillID++;
|
||||
}
|
||||
}
|
@ -20,6 +20,7 @@ import net.minecraft.entity.monster.EntityCreeper;
|
||||
import net.minecraft.entity.monster.EntityGhast;
|
||||
import net.minecraft.entity.passive.EntityWolf;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.potion.Potion;
|
||||
@ -28,6 +29,8 @@ import net.minecraft.stats.StatList;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.FakePlayer;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
@ -610,4 +613,28 @@ public class AbilityHelper
|
||||
world.spawnEntityInWorld(entityitem);
|
||||
return entityitem;
|
||||
}
|
||||
|
||||
public static MovingObjectPosition raytraceFromEntity (World world, Entity player, boolean par3, double range)
|
||||
{
|
||||
float f = 1.0F;
|
||||
float f1 = player.prevRotationPitch + (player.rotationPitch - player.prevRotationPitch) * f;
|
||||
float f2 = player.prevRotationYaw + (player.rotationYaw - player.prevRotationYaw) * f;
|
||||
double d0 = player.prevPosX + (player.posX - player.prevPosX) * (double) f;
|
||||
double d1 = player.prevPosY + (player.posY - player.prevPosY) * (double) f + 1.62D - (double) player.yOffset;
|
||||
double d2 = player.prevPosZ + (player.posZ - player.prevPosZ) * (double) f;
|
||||
Vec3 vec3 = world.getWorldVec3Pool().getVecFromPool(d0, d1, d2);
|
||||
float f3 = MathHelper.cos(-f2 * 0.017453292F - (float) Math.PI);
|
||||
float f4 = MathHelper.sin(-f2 * 0.017453292F - (float) Math.PI);
|
||||
float f5 = -MathHelper.cos(-f1 * 0.017453292F);
|
||||
float f6 = MathHelper.sin(-f1 * 0.017453292F);
|
||||
float f7 = f4 * f5;
|
||||
float f8 = f3 * f5;
|
||||
double d3 = range;
|
||||
if (player instanceof EntityPlayerMP)
|
||||
{
|
||||
d3 = ((EntityPlayerMP) player).theItemInWorldManager.getBlockReachDistance();
|
||||
}
|
||||
Vec3 vec31 = vec3.addVector((double) f7 * d3, (double) f6 * d3, (double) f8 * d3);
|
||||
return world.rayTraceBlocks_do_do(vec3, vec31, par3, !par3);
|
||||
}
|
||||
}
|
||||
|
@ -14,11 +14,13 @@ import net.minecraft.enchantment.EnchantmentHelper;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.item.EntityXPOrb;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.FurnaceRecipes;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class TActiveOmniMod extends ActiveToolMod
|
||||
@ -50,7 +52,7 @@ public class TActiveOmniMod extends ActiveToolMod
|
||||
{
|
||||
if (player.capabilities.isCreativeMode)
|
||||
return false;
|
||||
|
||||
|
||||
if (tool instanceof HarvestTool)
|
||||
TContent.modL.midStreamModify(stack);
|
||||
|
||||
@ -89,6 +91,33 @@ public class TActiveOmniMod extends ActiveToolMod
|
||||
entityitem.delayBeforeCanPickup = 10;
|
||||
world.spawnEntityInWorld(entityitem);
|
||||
world.playAuxSFX(2001, x, y, z, bID + (meta << 12));
|
||||
|
||||
int i = spawnme.stackSize;
|
||||
float f = FurnaceRecipes.smelting().getExperience(spawnme);
|
||||
int j;
|
||||
|
||||
if (f == 0.0F)
|
||||
{
|
||||
i = 0;
|
||||
}
|
||||
else if (f < 1.0F)
|
||||
{
|
||||
j = MathHelper.floor_float((float) i * f);
|
||||
|
||||
if (j < MathHelper.ceiling_float_int((float) i * f) && (float) Math.random() < (float) i * f - (float) j)
|
||||
{
|
||||
++j;
|
||||
}
|
||||
|
||||
i = j;
|
||||
}
|
||||
|
||||
while (i > 0)
|
||||
{
|
||||
j = EntityXPOrb.getXPSplit(i);
|
||||
i -= j;
|
||||
player.worldObj.spawnEntityInWorld(new EntityXPOrb(world, x, y + 0.5, z, j));
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < 6; i++)
|
||||
{
|
||||
|
@ -1,16 +1,11 @@
|
||||
package mods.tinker.tconstruct.plugins.minefactoryreloaded;
|
||||
|
||||
import mods.natura.entity.NitroCreeper;
|
||||
import mods.tinker.tconstruct.common.TContent;
|
||||
import mods.tinker.tconstruct.entity.BlueSlime;
|
||||
import mods.tinker.tconstruct.entity.Crystal;
|
||||
import mods.tinker.tconstruct.entity.MetalSlime;
|
||||
import mods.tinker.tconstruct.entity.Skyla;
|
||||
import mods.tinker.tconstruct.plugins.minefactoryreloaded.grindables.GrindableStandard;
|
||||
import mods.tinker.tconstruct.plugins.minefactoryreloaded.harvestables.HarvestableOreBerry;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import powercrystals.minefactoryreloaded.api.FarmingRegistry;
|
||||
import cpw.mods.fml.common.FMLLog;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.Mod;
|
||||
@ -18,8 +13,6 @@ import cpw.mods.fml.common.Mod.Init;
|
||||
import cpw.mods.fml.common.event.FMLInitializationEvent;
|
||||
import cpw.mods.fml.common.network.NetworkMod;
|
||||
|
||||
import powercrystals.minefactoryreloaded.api.FarmingRegistry;
|
||||
|
||||
|
||||
@Mod(modid = "TConstruct|CompatMineFactoryReloaded", name = "TConstruct Compat: MFR", version = "0.1", dependencies = "after:MineFactoryReloaded;after:TConstruct")
|
||||
@NetworkMod(clientSideRequired = false, serverSideRequired = false)
|
||||
@ -42,10 +35,10 @@ public class MineFactoryReloaded
|
||||
|
||||
// A note: in 1.6, this method of registering grindables will no longer exist, once MFR moves to a more universal way of gathering drops.
|
||||
FarmingRegistry.registerGrindable(new GrindableStandard(BlueSlime.class, new ItemStack(TContent.strangeFood)));
|
||||
FarmingRegistry.registerGrindable(new GrindableStandard(Crystal.class, new ItemStack(Item.gunpowder)));
|
||||
FarmingRegistry.registerGrindable(new GrindableStandard(MetalSlime.class, new ItemStack(TContent.strangeFood)));
|
||||
FarmingRegistry.registerGrindable(new GrindableStandard(NitroCreeper.class, new ItemStack(Item.gunpowder)));
|
||||
FarmingRegistry.registerGrindable(new GrindableStandard(Skyla.class, new ItemStack(Item.gunpowder)));
|
||||
//FarmingRegistry.registerGrindable(new GrindableStandard(Crystal.class, new ItemStack(Item.gunpowder)));
|
||||
//FarmingRegistry.registerGrindable(new GrindableStandard(MetalSlime.class, new ItemStack(TContent.strangeFood)));
|
||||
//FarmingRegistry.registerGrindable(new GrindableStandard(NitroCreeper.class, new ItemStack(Item.gunpowder)));
|
||||
//FarmingRegistry.registerGrindable(new GrindableStandard(Skyla.class, new ItemStack(Item.gunpowder)));
|
||||
|
||||
/*
|
||||
* Perhaps TC ores should be registered as drops from the MFR Laser Drill here, but I don't know which things would be suitable for that.
|
||||
|
35
mods/tinker/tconstruct/skill/Jump.java
Normal file
35
mods/tinker/tconstruct/skill/Jump.java
Normal file
@ -0,0 +1,35 @@
|
||||
package mods.tinker.tconstruct.skill;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class Jump extends Skill
|
||||
{
|
||||
|
||||
@Override
|
||||
public String getTextureFile (int guiscale)
|
||||
{
|
||||
/*if (guiscale == 2)
|
||||
return "/mods/tinker/textures/skill/Jump32x.png";
|
||||
if (guiscale == 3)
|
||||
return "/mods/tinker/textures/skill/Jump48x.png";
|
||||
|
||||
return "/mods/tinker/textures/skill/Jump16x.png";*/
|
||||
return "/mods/tinker/textures/skill/Jump48x.png";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSkillName ()
|
||||
{
|
||||
return "Jump";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void activate (Entity entity, World world)
|
||||
{
|
||||
if (entity.onGround)
|
||||
entity.motionY = 0.8f;
|
||||
}
|
||||
|
||||
}
|
57
mods/tinker/tconstruct/skill/Skill.java
Normal file
57
mods/tinker/tconstruct/skill/Skill.java
Normal file
@ -0,0 +1,57 @@
|
||||
package mods.tinker.tconstruct.skill;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
/* Base skill
|
||||
*
|
||||
*/
|
||||
|
||||
public abstract class Skill
|
||||
{
|
||||
boolean active = true;
|
||||
public abstract String getTextureFile(int guiscale);
|
||||
public abstract String getSkillName();
|
||||
public abstract void activate(Entity entity, World world);
|
||||
public void rightClickActivate(Entity entity, World world) {};
|
||||
|
||||
public int chargeTime() //Ticks
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
public boolean canEntityUseSkill(Entity entity)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public int getSkillCost()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
public boolean getActive()
|
||||
{
|
||||
return active;
|
||||
}
|
||||
|
||||
public Skill copy() throws InstantiationException, IllegalAccessException
|
||||
{
|
||||
return this.getClass().newInstance();
|
||||
}
|
||||
|
||||
/* Save/Load */
|
||||
public void saveToNBT (NBTTagCompound tag)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void readFromNBT (NBTTagCompound tag)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
@ -1,34 +0,0 @@
|
||||
package mods.tinker.tconstruct.skill;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
/* Base skill
|
||||
*
|
||||
*/
|
||||
|
||||
public abstract class SkillBase
|
||||
{
|
||||
public abstract String getTextureFile();
|
||||
public abstract String getSkillName();
|
||||
|
||||
public int chargeTime() //Ticks
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
public boolean canPlayerUseSkill()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public void activateSkill(EntityPlayer player, World world)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public int getSkillCost()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
135
mods/tinker/tconstruct/skill/WallBuilding.java
Normal file
135
mods/tinker/tconstruct/skill/WallBuilding.java
Normal file
@ -0,0 +1,135 @@
|
||||
package mods.tinker.tconstruct.skill;
|
||||
|
||||
import mods.tinker.tconstruct.library.tools.AbilityHelper;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
|
||||
public class WallBuilding extends Skill
|
||||
{
|
||||
|
||||
@Override
|
||||
public String getTextureFile (int guiscale)
|
||||
{
|
||||
if (guiscale == 2)
|
||||
return "/mods/tinker/textures/skill/Wall32x.png";
|
||||
if (guiscale == 3)
|
||||
return "/mods/tinker/textures/skill/Wall48x.png";
|
||||
|
||||
return "/mods/tinker/textures/skill/Wall16x.png";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSkillName ()
|
||||
{
|
||||
return "Wall Building";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void activate (Entity entity, World world)
|
||||
{
|
||||
if (!world.isRemote)
|
||||
this.active = !active;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void rightClickActivate (Entity entity, World world)
|
||||
{
|
||||
if (!world.isRemote && active)
|
||||
{
|
||||
if (entity instanceof EntityPlayer)
|
||||
{
|
||||
EntityPlayer player = (EntityPlayer) entity;
|
||||
ItemStack stack = player.getCurrentEquippedItem();
|
||||
if (stack != null && stack.getItem() instanceof ItemBlock)
|
||||
{
|
||||
MovingObjectPosition mop = AbilityHelper.raytraceFromEntity(world, entity, true, 6);
|
||||
|
||||
if (mop != null)
|
||||
{
|
||||
int xPos = mop.blockX;
|
||||
int yPos = mop.blockY;
|
||||
int zPos = mop.blockZ;
|
||||
/*ForgeDirection sideHit = ForgeDirection.getOrientation(mop.sideHit);
|
||||
switch (sideHit)
|
||||
{
|
||||
case UP:
|
||||
yPos += 1;
|
||||
break;
|
||||
case DOWN:
|
||||
yPos -= 1;
|
||||
break;
|
||||
case NORTH:
|
||||
zPos -= 1;
|
||||
break;
|
||||
case SOUTH:
|
||||
zPos += 1;
|
||||
break;
|
||||
case EAST:
|
||||
xPos += 1;
|
||||
break;
|
||||
case WEST:
|
||||
xPos -= 1;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}*/
|
||||
|
||||
int facing = MathHelper.floor_double((double) (entity.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
|
||||
int xMin = 0;
|
||||
int xMax = 0;
|
||||
int zMin = 0;
|
||||
int zMax = 0;
|
||||
if (facing % 2 == 0)
|
||||
{
|
||||
xMin = -1;
|
||||
xMax = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
zMin = -1;
|
||||
zMax = 1;
|
||||
}
|
||||
|
||||
for (int y = -1; y <= 1; y++)
|
||||
{
|
||||
for (int x = xMin; x <= xMax; x++)
|
||||
{
|
||||
for (int z = zMin; z <= zMax; z++)
|
||||
{
|
||||
stack.getItem().onItemUse(stack, player, world, xPos + x, yPos + y, zPos + z, mop.sideHit, 0, 0, 0);
|
||||
if (stack.stackSize < 1)
|
||||
{
|
||||
player.inventory.setInventorySlotContents(player.inventory.currentItem, null);
|
||||
break;
|
||||
}
|
||||
//world.setBlock(xPos + x, yPos + y, zPos + z, Block.whiteStone.blockID);
|
||||
}
|
||||
}
|
||||
}
|
||||
//entity.worldObj.setBlock(xPos, yPos, zPos, Block.stone.blockID, 0, 3);
|
||||
world.playAuxSFX(2001, xPos, yPos, zPos, Block.stone.blockID + (0 << 12));
|
||||
}
|
||||
}
|
||||
}
|
||||
/*for (int x = -2; x <= 2; x++)
|
||||
{
|
||||
for (int y = -1; y <= 1; y++)
|
||||
{
|
||||
//for (int z = -2; z <= 2; z++)
|
||||
{
|
||||
world.setBlock((int) Math.floor(entity.posX) + x, (int) Math.floor(entity.posY) + y, (int) Math.floor(entity.posZ) + 2, Block.whiteStone.blockID);
|
||||
}
|
||||
}
|
||||
}
|
||||
world.playAuxSFX(2001, (int) entity.posX, (int) entity.posY, (int) entity.posZ, Block.stone.blockID + (0 << 12));*/
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -148,6 +148,7 @@ public class PHConstruct
|
||||
heavyChestplate = config.getItem("Equipables", "Heavy Chestplate", 14108).getInt(14108);
|
||||
heavyPants = config.getItem("Equipables", "Heavy Pants", 14109).getInt(14109);
|
||||
heavyBoots = config.getItem("Equipables", "Heavy Boots", 14110).getInt(14110);
|
||||
glove = config.getItem("Equipables", "Gloves", 14111).getInt(14111);
|
||||
|
||||
boolean ic2 = true;
|
||||
boolean xycraft = true;
|
||||
@ -334,6 +335,7 @@ public class PHConstruct
|
||||
public static int heavyChestplate;
|
||||
public static int heavyPants;
|
||||
public static int heavyBoots;
|
||||
public static int glove;
|
||||
|
||||
public static int heartCanister;
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -6,9 +6,10 @@ import java.io.IOException;
|
||||
|
||||
import mods.tinker.tconstruct.TConstruct;
|
||||
import mods.tinker.tconstruct.blocks.logic.ToolStationLogic;
|
||||
import mods.tinker.tconstruct.inventory.SmelteryContainer;
|
||||
import mods.tinker.tconstruct.library.blocks.InventoryLogic;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.network.INetworkManager;
|
||||
import net.minecraft.network.packet.Packet250CustomPayload;
|
||||
@ -31,7 +32,7 @@ public class TPacketHandler implements IPacketHandler
|
||||
if (packet.channel.equals("TConstruct"))
|
||||
{
|
||||
if (side == Side.SERVER)
|
||||
handleServerPacket(packet);
|
||||
handleServerPacket(packet, (EntityPlayerMP) player);
|
||||
else
|
||||
handleClientPacket(packet);
|
||||
}
|
||||
@ -60,7 +61,7 @@ public class TPacketHandler implements IPacketHandler
|
||||
}
|
||||
}
|
||||
|
||||
void handleServerPacket (Packet250CustomPayload packet)
|
||||
void handleServerPacket (Packet250CustomPayload packet, EntityPlayerMP player)
|
||||
{
|
||||
DataInputStream inputStream = new DataInputStream(new ByteArrayInputStream(packet.data));
|
||||
|
||||
@ -104,23 +105,23 @@ public class TPacketHandler implements IPacketHandler
|
||||
|
||||
else if (packetID == 3) //Armor
|
||||
{
|
||||
String user = inputStream.readUTF();
|
||||
EntityPlayer player = TConstruct.playerTracker.getEntityPlayer(user);
|
||||
//String user = inputStream.readUTF();
|
||||
//EntityPlayer player = TConstruct.playerTracker.getEntityPlayer(user);
|
||||
player.openGui(TConstruct.instance, TConstruct.proxy.armorGuiID, player.worldObj, (int)player.posX, (int)player.posY, (int)player.posZ);
|
||||
}
|
||||
|
||||
else if (packetID == 4) //Active Skills
|
||||
{
|
||||
Byte id = inputStream.readByte();
|
||||
TConstruct.playerTracker.activateSkill(player, id);
|
||||
}
|
||||
|
||||
else if (packetID == 10) //Double jump
|
||||
{
|
||||
String user = inputStream.readUTF();
|
||||
EntityPlayer player = TConstruct.playerTracker.getEntityPlayer(user);
|
||||
//String user = inputStream.readUTF();
|
||||
//EntityPlayer player = TConstruct.playerTracker.getEntityPlayer(user);
|
||||
player.fallDistance = 0;
|
||||
}
|
||||
/*else if (packetID == 11)
|
||||
{
|
||||
String user = inputStream.readUTF();
|
||||
float size = inputStream.readFloat();
|
||||
TConstruct.playerTracker.updateSize(user, size);
|
||||
}*/
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
@ -129,4 +130,14 @@ public class TPacketHandler implements IPacketHandler
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Entity getEntity (World world, int id)
|
||||
{
|
||||
for (Object o : world.loadedEntityList)
|
||||
{
|
||||
if (((Entity)o).entityId == id)
|
||||
return (Entity) o;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ import java.lang.ref.WeakReference;
|
||||
|
||||
import mods.tinker.tconstruct.TConstruct;
|
||||
import mods.tinker.tconstruct.common.TContent;
|
||||
import mods.tinker.tconstruct.library.SkillRegistry;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@ -55,7 +56,9 @@ public class ArmorExtended implements IInventory
|
||||
{
|
||||
inventory[slot] = null;
|
||||
}
|
||||
recalculateHealth();
|
||||
EntityPlayer player = parent.get();
|
||||
TPlayerStats stats = TConstruct.playerTracker.getPlayerStats(player.username);
|
||||
recalculateHealth(player, stats);
|
||||
return split;
|
||||
}
|
||||
else
|
||||
@ -79,7 +82,10 @@ public class ArmorExtended implements IInventory
|
||||
{
|
||||
itemstack.stackSize = getInventoryStackLimit();
|
||||
}
|
||||
recalculateHealth();
|
||||
|
||||
EntityPlayer player = parent.get();
|
||||
TPlayerStats stats = TConstruct.playerTracker.getPlayerStats(player.username);
|
||||
recalculateHealth(player, stats);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -103,10 +109,38 @@ public class ArmorExtended implements IInventory
|
||||
@Override
|
||||
public void onInventoryChanged ()
|
||||
{
|
||||
recalculateHealth();
|
||||
EntityPlayer player = parent.get();
|
||||
TPlayerStats stats = TConstruct.playerTracker.getPlayerStats(player.username);
|
||||
recalculateSkills(player, stats);
|
||||
recalculateHealth(player, stats);
|
||||
}
|
||||
|
||||
public void recalculateHealth()
|
||||
public void recalculateSkills(EntityPlayer player, TPlayerStats stats)
|
||||
{
|
||||
if (inventory[1] != null && inventory[1].getItem() == TContent.glove)
|
||||
{
|
||||
if (stats.skillList.size() < 1)
|
||||
{
|
||||
try
|
||||
{
|
||||
stats.skillList.add(SkillRegistry.skills.get("Wall Building").copy());
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (stats.skillList.size() > 0)
|
||||
{
|
||||
stats.skillList.remove(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void recalculateHealth(EntityPlayer player, TPlayerStats stats)
|
||||
{
|
||||
if (inventory[6] != null && inventory[6].getItem() == TContent.heartCanister)
|
||||
{
|
||||
@ -114,8 +148,6 @@ public class ArmorExtended implements IInventory
|
||||
int meta = stack.getItemDamage();
|
||||
if (meta == 2)
|
||||
{
|
||||
EntityPlayer player = parent.get();
|
||||
TPlayerStats stats = TConstruct.playerTracker.getPlayerStats(player.username);
|
||||
int bonusHP = stack.stackSize * 2;
|
||||
stats.bonusHealth = bonusHP;
|
||||
player.maxHealth = 20 + bonusHP;
|
||||
@ -147,7 +179,7 @@ public class ArmorExtended implements IInventory
|
||||
return false;
|
||||
}
|
||||
|
||||
//Save/Load
|
||||
/* Save/Load */
|
||||
public void saveToNBT (EntityPlayer entityplayer)
|
||||
{
|
||||
NBTTagCompound tags = entityplayer.getEntityData();
|
||||
@ -168,7 +200,7 @@ public class ArmorExtended implements IInventory
|
||||
tags.setTag("TConstruct.Inventory", tagList);
|
||||
}
|
||||
|
||||
public void loadFromNBT (EntityPlayer entityplayer)
|
||||
public void readFromNBT (EntityPlayer entityplayer)
|
||||
{
|
||||
NBTTagCompound tags = entityplayer.getEntityData();
|
||||
NBTTagList tagList = tags.getTagList("TConstruct.Inventory");
|
||||
|
35
mods/tinker/tconstruct/util/player/ArmorExtendedClient.java
Normal file
35
mods/tinker/tconstruct/util/player/ArmorExtendedClient.java
Normal file
@ -0,0 +1,35 @@
|
||||
package mods.tinker.tconstruct.util.player;
|
||||
|
||||
import mods.tinker.tconstruct.client.TProxyClient;
|
||||
import mods.tinker.tconstruct.common.TContent;
|
||||
import mods.tinker.tconstruct.library.SkillRegistry;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
public class ArmorExtendedClient extends ArmorExtended
|
||||
{
|
||||
/*public void recalculateSkills(EntityPlayer player, TPlayerStats stats)
|
||||
{
|
||||
System.out.println("Client skills");
|
||||
if (inventory[1] != null && inventory[1].getItem() == TContent.glove)
|
||||
{
|
||||
if (TProxyClient.skillList.size() < 1)
|
||||
{
|
||||
try
|
||||
{
|
||||
TProxyClient.skillList.add(SkillRegistry.skills.get("Wall Building").copy());
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (TProxyClient.skillList.size() > 0)
|
||||
{
|
||||
TProxyClient.skillList.remove(0);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
@ -1,11 +1,15 @@
|
||||
package mods.tinker.tconstruct.util.player;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Random;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import mods.tinker.tconstruct.common.TContent;
|
||||
import mods.tinker.tconstruct.library.SkillRegistry;
|
||||
import mods.tinker.tconstruct.library.tools.AbilityHelper;
|
||||
import mods.tinker.tconstruct.skill.Skill;
|
||||
import mods.tinker.tconstruct.skill.WallBuilding;
|
||||
import mods.tinker.tconstruct.util.PHConstruct;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EnumEntitySize;
|
||||
@ -28,6 +32,7 @@ public class TPlayerHandler implements IPlayerTracker
|
||||
@Override
|
||||
public void onPlayerLogin (EntityPlayer entityplayer)
|
||||
{
|
||||
System.out.println("Player: "+entityplayer);
|
||||
//Lookup player
|
||||
TFoodStats food = new TFoodStats();
|
||||
food.readStats(entityplayer.foodStats);
|
||||
@ -41,7 +46,7 @@ public class TPlayerHandler implements IPlayerTracker
|
||||
stats.player = new WeakReference<EntityPlayer>(entityplayer);
|
||||
stats.armor = new ArmorExtended();
|
||||
stats.armor.init(entityplayer);
|
||||
stats.armor.loadFromNBT(entityplayer);
|
||||
stats.armor.readFromNBT(entityplayer);
|
||||
|
||||
stats.level = entityplayer.experienceLevel;
|
||||
stats.hunger = entityplayer.getFoodStats().getFoodLevel();
|
||||
@ -59,9 +64,38 @@ public class TPlayerHandler implements IPlayerTracker
|
||||
}
|
||||
}
|
||||
|
||||
stats.skillList = new ArrayList<Skill>();
|
||||
stats.armor.recalculateSkills(entityplayer, stats);
|
||||
/*try
|
||||
{
|
||||
stats.skillList.add(SkillRegistry.skills.get("Wall Building").copy());
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}/*
|
||||
//stats.skillList.add(new ActiveSkill(new Jump()));
|
||||
/*for (Map.Entry<String, SkillBase> entry : SkillRegistry.skills.entrySet())
|
||||
{
|
||||
SkillBase skill = entry.getValue();
|
||||
}*/
|
||||
|
||||
playerStats.put(entityplayer.username, stats);
|
||||
}
|
||||
|
||||
public void activateSkill (EntityPlayer player, int slot)
|
||||
{
|
||||
TPlayerStats stats = getPlayerStats(player.username);
|
||||
if (stats.skillList.size() > slot)
|
||||
{
|
||||
Skill skill = stats.skillList.get(slot);
|
||||
if (skill != null)
|
||||
{
|
||||
skill.activate(player, player.worldObj);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlayerLogout (EntityPlayer entityplayer)
|
||||
{
|
||||
@ -85,9 +119,10 @@ public class TPlayerHandler implements IPlayerTracker
|
||||
if (clean)
|
||||
playerStats.remove(player.username);
|
||||
}
|
||||
else //Revalidate all players
|
||||
else
|
||||
//Revalidate all players
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -98,7 +133,7 @@ public class TPlayerHandler implements IPlayerTracker
|
||||
//Boom!
|
||||
TPlayerStats stats = getPlayerStats(entityplayer.username);
|
||||
stats.player = new WeakReference<EntityPlayer>(entityplayer);
|
||||
stats.armor.recalculateHealth();
|
||||
stats.armor.recalculateHealth(entityplayer, stats);
|
||||
|
||||
TFoodStats food = new TFoodStats();
|
||||
entityplayer.foodStats = food;
|
||||
|
@ -1,11 +1,10 @@
|
||||
package mods.tinker.tconstruct.util.player;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.List;
|
||||
|
||||
import mods.tinker.tconstruct.skill.Skill;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
|
||||
public class TPlayerStats
|
||||
{
|
||||
@ -18,4 +17,5 @@ public class TPlayerStats
|
||||
public boolean materialManual;
|
||||
public boolean smelteryManual;
|
||||
public ArmorExtended armor;
|
||||
public List<Skill> skillList;
|
||||
}
|
||||
|
BIN
mods/tinker/textures/items/armor/dirthand.png
Normal file
BIN
mods/tinker/textures/items/armor/dirthand.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 338 B |
BIN
mods/tinker/textures/skill/Float48x.png
Normal file
BIN
mods/tinker/textures/skill/Float48x.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.2 KiB |
BIN
mods/tinker/textures/skill/Jump48x.png
Normal file
BIN
mods/tinker/textures/skill/Jump48x.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.3 KiB |
BIN
mods/tinker/textures/skill/Wall16x.png
Normal file
BIN
mods/tinker/textures/skill/Wall16x.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 708 B |
BIN
mods/tinker/textures/skill/Wall32x.png
Normal file
BIN
mods/tinker/textures/skill/Wall32x.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.4 KiB |
BIN
mods/tinker/textures/skill/Wall48x.png
Normal file
BIN
mods/tinker/textures/skill/Wall48x.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.9 KiB |
Loading…
x
Reference in New Issue
Block a user