mirror of
https://github.com/GTNewHorizons/TinkersConstruct.git
synced 2026-11-26 15:03:01 +00:00
Merge branch 'master' into weaponry
This commit is contained in:
commit
964135c481
9 files changed
+276
-67
No files matched your search
@@ -2,14 +2,22 @@ package tconstruct.armor;
|
||||
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.gameevent.PlayerEvent;
|
||||
import cpw.mods.fml.common.gameevent.TickEvent;
|
||||
import java.util.*;
|
||||
|
||||
import net.minecraft.entity.SharedMonsterAttributes;
|
||||
import net.minecraft.entity.ai.attributes.IAttributeInstance;
|
||||
import net.minecraft.entity.ai.attributes.ModifiableAttributeInstance;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import tconstruct.TConstruct;
|
||||
import tconstruct.armor.items.TravelGear;
|
||||
import tconstruct.armor.player.TPlayerStats;
|
||||
import tconstruct.library.modifier.IModifyable;
|
||||
import tconstruct.util.network.HealthUpdatePacket;
|
||||
|
||||
public class ArmorAbilities
|
||||
{
|
||||
@@ -112,4 +120,17 @@ public class ArmorAbilities
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@SubscribeEvent
|
||||
public void dimensionChanged(PlayerEvent.PlayerChangedDimensionEvent event)
|
||||
{
|
||||
if(event.player == null || !(event.player instanceof EntityPlayerMP))
|
||||
return;
|
||||
|
||||
// this callback is only called serverside
|
||||
float oldHealth = event.player.getHealth();
|
||||
// tell the client to update its hp
|
||||
TConstruct.packetPipeline.sendTo(new HealthUpdatePacket(oldHealth), (net.minecraft.entity.player.EntityPlayerMP) event.player);
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package tconstruct.armor;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.gameevent.PlayerEvent;
|
||||
import net.minecraft.entity.boss.*;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.monster.IMob;
|
||||
@@ -10,6 +11,7 @@ import net.minecraftforge.event.entity.living.*;
|
||||
import net.minecraftforge.event.entity.living.LivingEvent.LivingJumpEvent;
|
||||
import tconstruct.TConstruct;
|
||||
import tconstruct.armor.items.TravelWings;
|
||||
import tconstruct.armor.player.ArmorExtended;
|
||||
import tconstruct.armor.player.TPlayerStats;
|
||||
import tconstruct.library.modifier.IModifyable;
|
||||
import tconstruct.world.entity.BlueSlime;
|
||||
|
||||
@@ -19,6 +19,9 @@ import net.minecraftforge.common.ForgeHooks;
|
||||
import tconstruct.tools.TinkerTools;
|
||||
import tconstruct.util.config.PHConstruct;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
/* Base class for tools that should be harvesting blocks */
|
||||
|
||||
public abstract class HarvestTool extends ToolCore
|
||||
@@ -118,6 +121,17 @@ public abstract class HarvestTool extends ToolCore
|
||||
|
||||
protected abstract String getHarvestType ();
|
||||
|
||||
@Override
|
||||
public Set<String> getToolClasses(ItemStack stack) {
|
||||
Set<String> set = new HashSet<String>();
|
||||
|
||||
if(stack != null && stack.getItem() instanceof HarvestTool) {
|
||||
set.add(((HarvestTool) stack.getItem()).getHarvestType());
|
||||
}
|
||||
|
||||
return set;
|
||||
}
|
||||
|
||||
public boolean isEffective (Block block, int meta)
|
||||
{
|
||||
if(this.getHarvestType().equals(block.getHarvestTool(meta)))
|
||||
|
||||
@@ -77,6 +77,9 @@ public class SmelteryRender implements ISimpleBlockRenderingHandler
|
||||
base += height;
|
||||
liquidBase += countSize;
|
||||
|
||||
if(renderHeight < 0.01)
|
||||
renderHeight = 0.01f;
|
||||
|
||||
renderer.setRenderBounds(0, renderBase, 0, 1, renderHeight, 1);
|
||||
Fluid fluid = liquid.getFluid();
|
||||
for (int xi = from.x; xi <= to.x; xi++)
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
package tconstruct.util.network;
|
||||
|
||||
import cpw.mods.fml.common.network.ByteBufUtils;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
import mantle.common.network.AbstractPacket;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import tconstruct.armor.ArmorProxyClient;
|
||||
import tconstruct.armor.player.TPlayerStats;
|
||||
|
||||
public class HealthUpdatePacket extends AbstractPacket {
|
||||
private float health;
|
||||
|
||||
public HealthUpdatePacket() {
|
||||
}
|
||||
|
||||
public HealthUpdatePacket(float health) {
|
||||
this.health = health;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void encodeInto(ChannelHandlerContext ctx, ByteBuf buffer) {
|
||||
buffer.writeFloat(health);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void decodeInto(ChannelHandlerContext ctx, ByteBuf buffer) {
|
||||
health = buffer.readFloat();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleClientSide(EntityPlayer player) {
|
||||
// todo: fix this to use the proper armor extended.. once we sync that stuff...
|
||||
ArmorProxyClient.armorExtended.recalculateHealth(player, TPlayerStats.get(player));
|
||||
player.setHealth(health);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleServerSide(EntityPlayer player) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -122,6 +122,7 @@ public class PacketPipeline extends MessageToMessageCodec<FMLProxyPacket, Abstra
|
||||
|
||||
public void registerPackets ()
|
||||
{
|
||||
registerPacket(HealthUpdatePacket.class);
|
||||
registerPacket(DoubleJumpPacket.class);
|
||||
registerPacket(AccessoryInventoryPacket.class);
|
||||
registerPacket(SmelteryPacket.class);
|
||||
|
||||
Reference in new issue
Block a user