mirror of
https://github.com/GTNewHorizons/TinkersConstruct.git
synced 2026-10-26 14:33:50 +00:00
Fix blue slimes, heart canisters
This commit is contained in:
1 parent
1b982c3826
commit
d512d67679
15 files changed
+108
-36
No files matched your search
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -41,7 +41,7 @@ import cpw.mods.fml.common.registry.VillagerRegistry;
|
||||
* @dependencies: IC2 API, MFR API
|
||||
*/
|
||||
|
||||
@Mod(modid = "TConstruct", name = "TConstruct", version = "1.6.2_1.4.3", dependencies = "required-after:Forge@[7.7.1.687,)")
|
||||
@Mod(modid = "TConstruct", name = "TConstruct", version = "1.6.2_1.4.dev.24", dependencies = "required-after:Forge@[7.7.1.687,)")
|
||||
@NetworkMod(serverSideRequired = false, clientSideRequired = true, channels = { "TConstruct" }, packetHandler = tconstruct.util.network.TPacketHandler.class)
|
||||
public class TConstruct
|
||||
{
|
||||
@@ -102,7 +102,6 @@ public class TConstruct
|
||||
GameRegistry.registerCraftingHandler(new TCraftingHandler());
|
||||
NetworkRegistry.instance().registerGuiHandler(instance, proxy);
|
||||
|
||||
VillagerRegistry.instance().registerVillagerSkin(78943, new ResourceLocation("/mods/tinker/textures/mob/villagertools.png"));
|
||||
VillagerRegistry.instance().registerVillageTradeHandler(78943, new TVillageTrades());
|
||||
if (PHConstruct.addToVillages)
|
||||
{
|
||||
|
||||
@@ -2,6 +2,7 @@ package tconstruct.client;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.audio.SoundPool;
|
||||
import net.minecraft.client.gui.ScaledResolution;
|
||||
import net.minecraft.client.model.ModelBiped;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
@@ -44,19 +45,27 @@ public class TClientEvents
|
||||
}*/
|
||||
|
||||
/* Sounds */
|
||||
/*@ForgeSubscribe
|
||||
|
||||
/*boolean initSounds;
|
||||
|
||||
@ForgeSubscribe
|
||||
public void onSound (SoundLoadEvent event)
|
||||
{
|
||||
try
|
||||
if (!initSounds)
|
||||
{
|
||||
event.manager.soundPoolSounds.addSound("sounds/frypan_hit.ogg", TConstruct.class.getResource("/sounds/frypan_hit.ogg"));
|
||||
event.manager.soundPoolSounds.addSound("sounds/little_saw.ogg", TConstruct.class.getResource("/sounds/little_saw.ogg"));
|
||||
event.manager.soundPoolSounds.addSound("sounds/launcher_clank.ogg", TConstruct.class.getResource("/sounds/launcher_clank.ogg"));
|
||||
System.out.println("[TConstruct] Successfully loaded sounds.");
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
System.err.println("[TConstruct] Failed to register one or more sounds");
|
||||
initSounds = true;
|
||||
try
|
||||
{
|
||||
SoundPool soundpool = event.manager.soundPoolSounds;
|
||||
soundpool.addSound("tinker:frypan_hit.ogg");
|
||||
soundpool.addSound("tinker:little_saw.ogg");
|
||||
soundpool.addSound("tinker:launcher_clank.ogg");
|
||||
System.out.println("[TConstruct] Successfully loaded sounds.");
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
System.err.println("[TConstruct] Failed to register one or more sounds");
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
@@ -77,7 +86,9 @@ public class TClientEvents
|
||||
lava.setIcons(Block.waterStill.getIcon(0, 0), Block.waterStill.getIcon(2, 0));
|
||||
}
|
||||
}
|
||||
private static final ResourceLocation background = new ResourceLocation("tinker", "textures/gui/newhearts.png");
|
||||
|
||||
private static final ResourceLocation hearts = new ResourceLocation("tinker", "textures/gui/newhearts.png");
|
||||
private static final ResourceLocation icons = new ResourceLocation("textures/gui/icons.png");
|
||||
|
||||
/* HUD */
|
||||
@ForgeSubscribe
|
||||
@@ -99,9 +110,9 @@ public class TClientEvents
|
||||
|
||||
/*if (event.type == RenderGameOverlayEvent.ElementType.HEALTH)
|
||||
{
|
||||
this.mc.func_110434_K().func_110577_a(background);
|
||||
this.mc.func_110434_K().func_110577_a(hearts);
|
||||
|
||||
int hp = mc.thePlayer.getHealth();
|
||||
int hp = MathHelper.ceiling_float_int(this.mc.thePlayer.func_110143_aJ());
|
||||
for (int iter = 0; iter < hp / 20; iter++)
|
||||
{
|
||||
int renderHearts = (hp - 20 * (iter + 1)) / 2;
|
||||
@@ -117,7 +128,7 @@ public class TClientEvents
|
||||
}
|
||||
}
|
||||
|
||||
this.mc.renderEngine.bindTexture("/gui/icons.png");
|
||||
this.mc.func_110434_K().func_110577_a(icons);
|
||||
}*/
|
||||
|
||||
/*if (event.type == RenderGameOverlayEvent.ElementType.HOTBAR)
|
||||
|
||||
@@ -2,12 +2,15 @@ package tconstruct.client;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import tconstruct.common.TContent;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.ScaledResolution;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.entity.SharedMonsterAttributes;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import tconstruct.common.TContent;
|
||||
import cpw.mods.fml.common.ITickHandler;
|
||||
import cpw.mods.fml.common.TickType;
|
||||
|
||||
@@ -18,6 +21,8 @@ public class TClientTickHandler implements ITickHandler
|
||||
int zLevel = 0;
|
||||
int ticks = 0;
|
||||
|
||||
private static final ResourceLocation hearts = new ResourceLocation("tinker", "textures/gui/newhearts.png");
|
||||
|
||||
@Override
|
||||
public void tickEnd (EnumSet<TickType> type, Object... tickData)
|
||||
{
|
||||
@@ -33,9 +38,11 @@ public class TClientTickHandler implements ITickHandler
|
||||
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();
|
||||
this.mc.func_110434_K().func_110577_a(hearts);
|
||||
//this.mc.renderEngine.bindTexture("/mods/tinker/textures/gui/newhearts.png");
|
||||
|
||||
int hp = MathHelper.ceiling_float_int(this.mc.thePlayer.func_110143_aJ());//(int) player.func_110148_a(SharedMonsterAttributes.field_111267_a).func_111125_b();//player.getHealth();
|
||||
//System.out.println("hp: "+hp);
|
||||
for (int iter = 0; iter < hp / 20; iter++)
|
||||
{
|
||||
int renderHearts = (hp - 20*(iter+1)) / 2;
|
||||
|
||||
@@ -150,12 +150,14 @@ import tconstruct.library.crafting.ToolBuilder;
|
||||
import tconstruct.library.tools.ToolCore;
|
||||
import tconstruct.util.player.ArmorExtended;
|
||||
import tconstruct.util.player.KnapsackInventory;
|
||||
import tconstruct.util.player.TPlayerStats;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import cpw.mods.fml.client.registry.ClientRegistry;
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
import cpw.mods.fml.common.registry.TickRegistry;
|
||||
import cpw.mods.fml.common.registry.VillagerRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
|
||||
public class TProxyClient extends TProxyCommon
|
||||
@@ -167,6 +169,7 @@ public class TProxyClient extends TProxyCommon
|
||||
|
||||
public static ArmorExtended armorExtended = new ArmorExtended();
|
||||
public static KnapsackInventory knapsack = new KnapsackInventory();
|
||||
public static TPlayerStats stats = new TPlayerStats();
|
||||
|
||||
@Override
|
||||
public Object getClientGuiElement (int ID, EntityPlayer player, World world, int x, int y, int z)
|
||||
@@ -406,6 +409,7 @@ public class TProxyClient extends TProxyCommon
|
||||
//RenderingRegistry.registerEntityRenderingHandler(net.minecraft.entity.player.EntityPlayer.class, new PlayerArmorRender()); // <-- Works, woo!
|
||||
|
||||
MinecraftForgeClient.registerItemRenderer(TContent.shortbow.itemID, new CustomBowRenderer());
|
||||
VillagerRegistry.instance().registerVillagerSkin(78943, new ResourceLocation("/mods/tinker/textures/mob/villagertools.png"));
|
||||
|
||||
addRenderMappings();
|
||||
addToolButtons();
|
||||
|
||||
@@ -4,19 +4,20 @@ import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.renderer.entity.RenderLiving;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.boss.BossStatus;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import tconstruct.entity.BlueSlime;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class SlimeRender extends RenderLiving
|
||||
{
|
||||
static final ResourceLocation texture = new ResourceLocation("tinker", "textures/mob/slimeedible.png");
|
||||
private ModelBase scaleAmount;
|
||||
|
||||
public SlimeRender(ModelBase par1ModelBase, ModelBase par2ModelBase, float par3)
|
||||
@@ -25,6 +26,7 @@ public class SlimeRender extends RenderLiving
|
||||
this.scaleAmount = par2ModelBase;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doRenderLiving (EntityLiving par1EntityLiving, double par2, double par4, double par6, float par8, float par9)
|
||||
{
|
||||
super.doRenderLiving(par1EntityLiving, par2, par4, par6, par8, par9);
|
||||
@@ -81,7 +83,8 @@ public class SlimeRender 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)
|
||||
@Override
|
||||
protected void preRenderCallback (EntityLivingBase par1EntityLiving, float par2)
|
||||
{
|
||||
this.scaleSlime((BlueSlime) par1EntityLiving, par2);
|
||||
}
|
||||
@@ -89,7 +92,8 @@ public class SlimeRender extends RenderLiving
|
||||
/**
|
||||
* Queries whether should render the specified pass or not.
|
||||
*/
|
||||
protected int shouldRenderPass (EntityLiving par1EntityLiving, int par2, float par3)
|
||||
@Override
|
||||
protected int shouldRenderPass (EntityLivingBase par1EntityLiving, int par2, float par3)
|
||||
{
|
||||
return this.shouldSlimeRenderPass((BlueSlime) par1EntityLiving, par2, par3);
|
||||
}
|
||||
@@ -99,6 +103,4 @@ public class SlimeRender extends RenderLiving
|
||||
{
|
||||
return texture;
|
||||
}
|
||||
|
||||
static final ResourceLocation texture = new ResourceLocation("tinker", "textures/mob/slimeedible.png");
|
||||
}
|
||||
@@ -64,7 +64,7 @@ public class SlotTool extends Slot
|
||||
int amount = inventory.getStackInSlot(1).getItem() instanceof ToolCore ? stack.stackSize : 1;
|
||||
inventory.decrStackSize(1, amount);
|
||||
if (!player.worldObj.isRemote && full)
|
||||
player.worldObj.playSoundEffect(player.posX, player.posY, player.posZ, "sounds.little_saw", 1.0F, (random.nextFloat() - random.nextFloat()) * 0.2F + 1.0F);
|
||||
player.worldObj.playSoundEffect(player.posX, player.posY, player.posZ, "tinker:little_saw", 1.0F, (random.nextFloat() - random.nextFloat()) * 0.2F + 1.0F);
|
||||
//player.worldObj.playAuxSFX(1021, (int)player.posX, (int)player.posY, (int)player.posZ, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -138,7 +138,7 @@ public class ToolStationContainer extends ActiveContainer
|
||||
int amount = logic.getStackInSlot(1).getItem() instanceof ToolCore ? stack.stackSize : 1;
|
||||
logic.decrStackSize(1, amount);
|
||||
|
||||
logic.worldObj.playSoundEffect(logic.xCoord, logic.yCoord, logic.zCoord, "sounds.little_saw", 1.0F, (random.nextFloat() - random.nextFloat()) * 0.2F + 1.0F);
|
||||
logic.worldObj.playSoundEffect(logic.xCoord, logic.yCoord, logic.zCoord, "tinker:little_saw", 1.0F, (random.nextFloat() - random.nextFloat()) * 0.2F + 1.0F);
|
||||
/*if (!player.worldObj.isRemote)
|
||||
player.worldObj.playAuxSFX(1021, (int)player.posX, (int)player.posY, (int)player.posZ, 0);*/
|
||||
}
|
||||
|
||||
@@ -32,6 +32,11 @@ public class DiamondApple extends ItemFood
|
||||
int duration = 0;
|
||||
PotionEffect potion;
|
||||
|
||||
potion = player.getActivePotionEffect(Potion.resistance);
|
||||
if (potion != null)
|
||||
duration = potion.duration;
|
||||
player.addPotionEffect(new PotionEffect(Potion.field_76444_x.id, duration + 60 * 40, 4));
|
||||
|
||||
potion = player.getActivePotionEffect(Potion.resistance);
|
||||
if (potion != null)
|
||||
duration = potion.duration;
|
||||
|
||||
@@ -49,7 +49,7 @@ public class FryingPan extends Weapon
|
||||
@Override
|
||||
public void onEntityDamaged (World world, EntityLivingBase player, Entity entity)
|
||||
{
|
||||
world.playSoundEffect(entity.posX, entity.posY, entity.posZ, "sounds.frypan_hit", 1.0F, (random.nextFloat() - random.nextFloat()) * 0.2F + 1.0F);
|
||||
world.playSoundEffect(entity.posX, entity.posY, entity.posZ, "tinker:frypan_hit", 1.0F, (random.nextFloat() - random.nextFloat()) * 0.2F + 1.0F);
|
||||
}
|
||||
|
||||
public String getToolName ()
|
||||
@@ -128,7 +128,7 @@ public class FryingPan extends Weapon
|
||||
else
|
||||
{
|
||||
world.setBlock(x, y, z, TContent.heldItemBlock.blockID, 0, 3);
|
||||
world.playSoundEffect(x, y, z, "sounds.frypan_hit", 1.0F, (random.nextFloat() - random.nextFloat()) * 0.2F + 0.65F);
|
||||
world.playSoundEffect(x, y, z, "tinker:frypan_hit", 1.0F, (random.nextFloat() - random.nextFloat()) * 0.2F + 0.65F);
|
||||
|
||||
EquipLogic logic = (EquipLogic) world.getBlockTileEntity(x, y, z);
|
||||
logic.setEquipmentItem(stack);
|
||||
|
||||
@@ -53,7 +53,7 @@ public class PotionLauncher extends Item
|
||||
player.inventory.setInventorySlotContents(slotID, null);
|
||||
}
|
||||
|
||||
world.playSoundEffect(player.posX, player.posY, player.posZ, "sounds.launcher_clank", 1.0F, (world.rand.nextFloat() - world.rand.nextFloat()) * 0.15F + 1.0F);
|
||||
world.playSoundEffect(player.posX, player.posY, player.posZ, "tinker:launcher_clank", 1.0F, (world.rand.nextFloat() - world.rand.nextFloat()) * 0.15F + 1.0F);
|
||||
}
|
||||
return stack;
|
||||
}
|
||||
|
||||
@@ -2,14 +2,17 @@ package tconstruct.util.player;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
|
||||
import tconstruct.TConstruct;
|
||||
import tconstruct.common.TContent;
|
||||
|
||||
import net.minecraft.entity.SharedMonsterAttributes;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import tconstruct.TConstruct;
|
||||
import tconstruct.common.TContent;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
|
||||
public class ArmorExtended implements IInventory
|
||||
{
|
||||
@@ -146,19 +149,60 @@ public class ArmorExtended implements IInventory
|
||||
|
||||
public void recalculateHealth (EntityPlayer player, TPlayerStats stats)
|
||||
{
|
||||
Side side = FMLCommonHandler.instance().getEffectiveSide();
|
||||
|
||||
if (inventory[6] != null && inventory[6].getItem() == TContent.heartCanister)
|
||||
{
|
||||
//System.out.println("Calculating HP on side " + FMLCommonHandler.instance().getEffectiveSide());
|
||||
ItemStack stack = inventory[6];
|
||||
int meta = stack.getItemDamage();
|
||||
//System.out.println("Calculating HP on side " + FMLCommonHandler.instance().getEffectiveSide());
|
||||
if (meta == 2)
|
||||
{
|
||||
int prevHealth = stats.bonusHealth;
|
||||
if (side == Side.CLIENT)
|
||||
prevHealth = stats.bonusHealthClient;
|
||||
int bonusHP = stack.stackSize * 2;
|
||||
stats.bonusHealth = bonusHP;
|
||||
if (side == Side.CLIENT)
|
||||
stats.bonusHealthClient = bonusHP;
|
||||
else
|
||||
stats.bonusHealth = bonusHP;
|
||||
int healthChange = bonusHP - prevHealth;
|
||||
if (healthChange != 0)
|
||||
{
|
||||
double playerHP = player.func_110148_a(SharedMonsterAttributes.field_111267_a).func_111125_b();
|
||||
playerHP += healthChange;
|
||||
player.func_110148_a(SharedMonsterAttributes.field_111267_a).func_111128_a(playerHP);
|
||||
}
|
||||
/*public void setEntityHealth(float par1)
|
||||
{
|
||||
this.dataWatcher.updateObject(6, Float.valueOf(MathHelper.clamp_float(par1, 0.0F, this.func_110138_aP())));
|
||||
}*/
|
||||
//player.func_110148_a(SharedMonsterAttributes.field_111267_a).func_111128_a(40);
|
||||
//System.out.println("Health: "+player.func_110148_a(SharedMonsterAttributes.field_111267_a).func_111125_b());
|
||||
//player.setEntityHealth(40);
|
||||
//player.maxHealth = 20 + bonusHP;
|
||||
}
|
||||
}
|
||||
else if (parent != null && parent.get() != null)
|
||||
{
|
||||
int prevHealth = stats.bonusHealth;
|
||||
if (side == Side.CLIENT)
|
||||
prevHealth = stats.bonusHealthClient;
|
||||
int bonusHP = 0;
|
||||
if (side == Side.CLIENT)
|
||||
stats.bonusHealthClient = bonusHP;
|
||||
else
|
||||
stats.bonusHealth = bonusHP;
|
||||
int healthChange = bonusHP - prevHealth;
|
||||
if (healthChange != 0)
|
||||
{
|
||||
double playerHP = player.func_110148_a(SharedMonsterAttributes.field_111267_a).func_111125_b();
|
||||
playerHP += healthChange;
|
||||
player.func_110148_a(SharedMonsterAttributes.field_111267_a).func_111128_a(playerHP);
|
||||
}
|
||||
//player.func_110148_a(SharedMonsterAttributes.field_111267_a).func_111128_a(20);
|
||||
//player.setEntityHealth(20);
|
||||
//parent.get().maxHealth = 20;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,8 +11,8 @@ public class TPlayerStats
|
||||
{
|
||||
public WeakReference<EntityPlayer> player;
|
||||
public int level;
|
||||
public int levelHealth;
|
||||
public int bonusHealth;
|
||||
public int bonusHealthClient;
|
||||
public int hunger;
|
||||
public boolean beginnerManual;
|
||||
public boolean materialManual;
|
||||
|
||||
Reference in new issue
Block a user