mirror of
https://github.com/GTNewHorizons/TinkersConstruct.git
synced 2026-11-20 04:09:40 +00:00
Merge branch 'master' of github.com:SlimeKnights/TinkersConstruct
This commit is contained in:
commit
7d3622beed
8 files changed
+198
-36
No files matched your search
@@ -38,6 +38,7 @@ import tconstruct.armor.model.HiddenPlayerModel;
|
||||
import tconstruct.armor.model.WingModel;
|
||||
import tconstruct.armor.player.ArmorExtended;
|
||||
import tconstruct.armor.player.KnapsackInventory;
|
||||
import tconstruct.armor.player.TPlayerStats;
|
||||
import tconstruct.client.ArmorControls;
|
||||
import tconstruct.client.tabs.InventoryTabArmorExtended;
|
||||
import tconstruct.client.tabs.InventoryTabKnapsack;
|
||||
@@ -58,9 +59,11 @@ public class ArmorProxyClient extends ArmorProxyCommon {
|
||||
public static HiddenPlayerModel glove = new HiddenPlayerModel(0.25F, 4);
|
||||
public static HiddenPlayerModel vest = new HiddenPlayerModel(0.25f, 1);
|
||||
public static BeltModel belt = new BeltModel();
|
||||
|
||||
public static KnapsackInventory knapsack = new KnapsackInventory();
|
||||
public static ArmorExtended armorExtended = new ArmorExtended();
|
||||
|
||||
public static TPlayerStats playerStats = new TPlayerStats();
|
||||
|
||||
public static KnapsackInventory knapsack = playerStats.knapsack;
|
||||
public static ArmorExtended armorExtended = playerStats.armor;
|
||||
|
||||
@Override
|
||||
public void preInit() {
|
||||
@@ -522,5 +525,15 @@ public class ArmorProxyClient extends ArmorProxyCommon {
|
||||
protected float handleRotationFloat(EntityLivingBase par1EntityLivingBase, float par2) {
|
||||
return (float) par1EntityLivingBase.ticksExisted + par2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updatePlayerStats (TPlayerStats stats)
|
||||
{
|
||||
|
||||
playerStats.copyFrom(stats, false);
|
||||
armorExtended = stats.armor;
|
||||
knapsack = stats.knapsack;
|
||||
//dumpTPlayerStats(stats);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,7 +2,9 @@ package tconstruct.armor;
|
||||
|
||||
import cpw.mods.fml.common.network.IGuiHandler;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import tconstruct.TConstruct;
|
||||
import tconstruct.armor.inventory.*;
|
||||
import tconstruct.armor.player.TPlayerStats;
|
||||
import tconstruct.common.TProxyCommon;
|
||||
@@ -65,4 +67,47 @@ public class ArmorProxyCommon implements IGuiHandler
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void updatePlayerStats(TPlayerStats stats)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void dumpTPlayerStats(TPlayerStats stats)
|
||||
{
|
||||
TConstruct.logger.debug("~~~~~~~~~~~~~~~~~ STATS ~~~~~~~~~~~~~~~~~");
|
||||
TConstruct.logger.debug("Player: " + stats.player.get().getCommandSenderName());
|
||||
TConstruct.logger.debug("Level: " + stats.level);
|
||||
TConstruct.logger.debug("BonusHealth: " + stats.bonusHealth);
|
||||
TConstruct.logger.debug("Damage: " + stats.damage);
|
||||
TConstruct.logger.debug("Hunger: " + stats.hunger);
|
||||
TConstruct.logger.debug("Prev Dim: " + stats.previousDimension);
|
||||
TConstruct.logger.debug("Climb Walls: " + stats.climbWalls);
|
||||
TConstruct.logger.debug("Activate Goggles: " + stats.activeGoggles);
|
||||
TConstruct.logger.debug("Beginer Manual: " + stats.beginnerManual);
|
||||
TConstruct.logger.debug("Material Manual: " + stats.materialManual);
|
||||
TConstruct.logger.debug("Smeltery Manual: " + stats.smelteryManual);
|
||||
TConstruct.logger.debug("Weponary Manual: " + stats.weaponryManual);
|
||||
TConstruct.logger.debug("BattleSign Bonus: " + stats.battlesignBonus);
|
||||
TConstruct.logger.debug("Derp Level: " + stats.derpLevel);
|
||||
int i = 0;
|
||||
for (ItemStack stack : stats.armor.inventory)
|
||||
{
|
||||
if (stack != null)
|
||||
{
|
||||
TConstruct.logger.debug("Armor Slot: " + i + " Contains: " + stack.getDisplayName());
|
||||
}
|
||||
i++;
|
||||
}
|
||||
i = 0;
|
||||
for (ItemStack stack : stats.knapsack.inventory)
|
||||
{
|
||||
if (stack != null)
|
||||
{
|
||||
TConstruct.logger.debug("Knapsack Slot: " + i + " Contains: " + stack.getDisplayName());
|
||||
}
|
||||
i++;
|
||||
}
|
||||
TConstruct.logger.debug("~~~~~~~~~~~~~~~~~ STATS ~~~~~~~~~~~~~~~~~");
|
||||
}
|
||||
}
|
||||
@@ -6,8 +6,10 @@ import net.minecraft.entity.boss.*;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.monster.IMob;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.event.entity.EntityJoinWorldEvent;
|
||||
import net.minecraftforge.event.entity.living.*;
|
||||
import net.minecraftforge.event.entity.living.LivingEvent.LivingJumpEvent;
|
||||
import tconstruct.TConstruct;
|
||||
@@ -15,6 +17,7 @@ import tconstruct.armor.items.TravelWings;
|
||||
import tconstruct.armor.player.ArmorExtended;
|
||||
import tconstruct.armor.player.TPlayerStats;
|
||||
import tconstruct.library.modifier.IModifyable;
|
||||
import tconstruct.util.network.ArmourGuiSyncPacket;
|
||||
import tconstruct.world.entity.BlueSlime;
|
||||
|
||||
public class TinkerArmorEvents
|
||||
@@ -122,4 +125,19 @@ public class TinkerArmorEvents
|
||||
if(dodge > TConstruct.random.nextInt(10))
|
||||
event.setCanceled(true);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void joinWorld(EntityJoinWorldEvent event)
|
||||
{
|
||||
if (event.entity instanceof EntityPlayerMP)
|
||||
{
|
||||
EntityPlayerMP player = (EntityPlayerMP)event.entity;
|
||||
TPlayerStats stats = TPlayerStats.get(player);
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
stats.saveNBTData(tag);
|
||||
ArmourGuiSyncPacket syncPacket = new ArmourGuiSyncPacket(tag);
|
||||
TConstruct.packetPipeline.sendTo(syncPacket, player);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -55,11 +55,23 @@ public class DryingRackSpecialRender extends TileEntitySpecialRenderer
|
||||
if (meta == 2)
|
||||
GL11.glTranslatef(0F, 0F, 0.375F);
|
||||
if (meta == 3)
|
||||
GL11.glTranslatef(0F, 0F, -0.375F);
|
||||
{
|
||||
// Rotate, Flip.
|
||||
GL11.glRotatef(180F, 0F, 1F, 0F);
|
||||
GL11.glTranslatef(0F, 0F, 0.2F);
|
||||
//GL11.glTranslatef(0F, 0F, -0.375F);
|
||||
}
|
||||
if (meta == 4)
|
||||
{
|
||||
GL11.glTranslatef(0F, 0F, 0.2875F);
|
||||
}
|
||||
if (meta == 5)
|
||||
GL11.glTranslatef(0F, 0F, -0.5F);
|
||||
{
|
||||
//Rotate, Flip.
|
||||
GL11.glRotatef(180F, 0F, 1F, 0F);
|
||||
GL11.glTranslatef(0F, 0F, 0.3F);
|
||||
//GL11.glTranslatef(0F, 0F, -0.5F);
|
||||
}
|
||||
}
|
||||
GL11.glScalef(2F, 2F, 2F);
|
||||
if (stack.getItem() instanceof ItemBlock)
|
||||
|
||||
@@ -5,6 +5,7 @@ import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.material.MaterialLogic;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.multiplayer.PlayerControllerMP;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@@ -16,6 +17,7 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.NetworkManager;
|
||||
import net.minecraft.network.play.client.C07PacketPlayerDigging;
|
||||
import net.minecraft.network.play.server.S23PacketBlockChange;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.WorldSettings;
|
||||
import net.minecraftforge.common.ForgeHooks;
|
||||
@@ -38,7 +40,7 @@ public abstract class HarvestTool extends ToolCore
|
||||
@Override
|
||||
public boolean onBlockStartBreak (ItemStack stack, int x, int y, int z, EntityPlayer player)
|
||||
{
|
||||
return super.onBlockStartBreak(stack, x,y,z, player);
|
||||
return super.onBlockStartBreak(stack, x, y, z, player);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -167,41 +169,40 @@ public abstract class HarvestTool extends ToolCore
|
||||
int posX = x;
|
||||
int posY = y;
|
||||
int posZ = z;
|
||||
int playerPosX = (int) Math.floor(player.posX);
|
||||
int playerPosY = (int) Math.floor(player.posY);
|
||||
int playerPosZ = (int) Math.floor(player.posZ);
|
||||
if (side == 0)
|
||||
|
||||
switch (side)
|
||||
{
|
||||
--posY;
|
||||
case 0:
|
||||
--posY;
|
||||
break;
|
||||
case 1:
|
||||
++posY;
|
||||
break;
|
||||
case 2:
|
||||
--posZ;
|
||||
break;
|
||||
case 3:
|
||||
++posZ;
|
||||
break;
|
||||
case 4:
|
||||
--posX;
|
||||
break;
|
||||
case 5:
|
||||
++posX;
|
||||
break;
|
||||
}
|
||||
|
||||
if (side == 1)
|
||||
{
|
||||
++posY;
|
||||
}
|
||||
AxisAlignedBB blockBounds = AxisAlignedBB.getBoundingBox(posX, posY, posZ, posX + 1, posY + 1, posZ + 1);
|
||||
AxisAlignedBB playerBounds = player.boundingBox;
|
||||
|
||||
if (side == 2)
|
||||
if(item instanceof ItemBlock)
|
||||
{
|
||||
--posZ;
|
||||
}
|
||||
|
||||
if (side == 3)
|
||||
{
|
||||
++posZ;
|
||||
}
|
||||
|
||||
if (side == 4)
|
||||
{
|
||||
--posX;
|
||||
}
|
||||
|
||||
if (side == 5)
|
||||
{
|
||||
++posX;
|
||||
}
|
||||
if (posX == playerPosX && (posY == playerPosY || posY == playerPosY + 1 || posY == playerPosY - 1) && posZ == playerPosZ)
|
||||
{
|
||||
return false;
|
||||
Block blockToPlace = ((ItemBlock) item).field_150939_a;
|
||||
if(blockToPlace.getMaterial().blocksMovement())
|
||||
{
|
||||
if (playerBounds.intersectsWith(blockBounds))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
int dmg = nearbyStack.getItemDamage();
|
||||
|
||||
@@ -5,8 +5,11 @@ import net.minecraft.client.renderer.entity.*;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.item.*;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import tconstruct.library.ItemBlocklike;
|
||||
import tconstruct.smeltery.TinkerSmeltery;
|
||||
import tconstruct.smeltery.logic.CastingTableLogic;
|
||||
import tconstruct.tools.entity.FancyEntityItem;
|
||||
|
||||
@@ -61,6 +64,13 @@ public class CastingTableSpecialRenderer extends TileEntitySpecialRenderer
|
||||
GL11.glTranslatef(0F, -0.1F, 0.2275F);
|
||||
}
|
||||
|
||||
if (stack.isItemEqual(new ItemStack(TinkerSmeltery.glassPane)))
|
||||
{
|
||||
GL11.glRotatef(90F, 1F, 0F, 0F);
|
||||
GL11.glTranslatef(0F, -0.194F, -0.1F);
|
||||
GL11.glScalef(0.85F, 0.85F, 0.85F);
|
||||
}
|
||||
|
||||
RenderItem.renderInFrame = true;
|
||||
RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
|
||||
RenderItem.renderInFrame = false;
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
package tconstruct.util.network;
|
||||
|
||||
import tconstruct.TConstruct;
|
||||
import tconstruct.armor.TinkerArmor;
|
||||
import tconstruct.armor.player.TPlayerStats;
|
||||
import cpw.mods.fml.common.network.ByteBufUtils;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
import mantle.common.network.AbstractPacket;
|
||||
/**
|
||||
* This Packet is for sending the players TPlayerStats from the server to the client.
|
||||
*
|
||||
* @author covers1624
|
||||
*/
|
||||
|
||||
public class ArmourGuiSyncPacket extends AbstractPacket
|
||||
{
|
||||
NBTTagCompound playerStats = new NBTTagCompound();
|
||||
|
||||
public ArmourGuiSyncPacket()
|
||||
{
|
||||
}
|
||||
/**
|
||||
* For sending the players TPlayerStats to the client.
|
||||
* @param tag, The players TPlayerStats written to NBT.
|
||||
*/
|
||||
public ArmourGuiSyncPacket(NBTTagCompound tag)
|
||||
{
|
||||
playerStats = tag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void encodeInto (ChannelHandlerContext ctx, ByteBuf buffer)
|
||||
{
|
||||
ByteBufUtils.writeTag(buffer, playerStats);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void decodeInto (ChannelHandlerContext ctx, ByteBuf buffer)
|
||||
{
|
||||
playerStats = ByteBufUtils.readTag(buffer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleClientSide (EntityPlayer player)
|
||||
{
|
||||
TPlayerStats stats = new TPlayerStats(player);
|
||||
stats.loadNBTData(playerStats);
|
||||
TinkerArmor.proxy.updatePlayerStats(stats);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleServerSide (EntityPlayer player)
|
||||
{
|
||||
//NO-OP. this is a Server -> client packet.
|
||||
}
|
||||
|
||||
}
|
||||
@@ -135,6 +135,8 @@ public class PacketPipeline extends MessageToMessageCodec<FMLProxyPacket, Abstra
|
||||
registerPacket(GogglePacket.class);
|
||||
|
||||
registerPacket(MovementUpdatePacket.class);
|
||||
|
||||
registerPacket(ArmourGuiSyncPacket.class);
|
||||
}
|
||||
|
||||
// Method to call from FMLPostInitializationEvent
|
||||
|
||||
Reference in new issue
Block a user