Catch up to 1.5, fix heart rendering

This commit is contained in:
mDiyo committed 2013-08-01 20:54:56 -07:00
1 parent 76d72dfcb1
commit cfe61da4e3
29 files changed
+386 -779

No files matched your search

@@ -0,0 +1,19 @@
{
"animation": {
"frametime": 2,
"frames": [
0,
1,
2,
3,
4,
5,
6,
5,
4,
3,
2,
1
]
}
}
@@ -0,0 +1,19 @@
{
"animation": {
"frametime": 2,
"frames": [
0,
1,
2,
3,
4,
5,
6,
5,
4,
3,
2,
1
]
}
}
@@ -0,0 +1,19 @@
{
"animation": {
"frametime": 2,
"frames": [
0,
1,
2,
3,
4,
5,
6,
5,
4,
3,
2,
1
]
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 408 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 384 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 421 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 412 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 416 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 413 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 383 B

@@ -0,0 +1,19 @@
{
"animation": {
"frametime": 2,
"frames": [
0,
1,
2,
3,
4,
5,
6,
5,
4,
3,
2,
1
]
}
}
+1 -7
View File
@@ -9,9 +9,6 @@ import tconstruct.library.TConstructRegistry;
import tconstruct.library.crafting.Detailing;
import tconstruct.library.crafting.LiquidCasting;
import tconstruct.library.util.TabTools;
import tconstruct.skill.Jump;
import tconstruct.skill.SkillRegistry;
import tconstruct.skill.WallBuilding;
import tconstruct.util.PHConstruct;
import tconstruct.util.TCraftingHandler;
import tconstruct.util.TEventHandler;
@@ -40,7 +37,7 @@ import cpw.mods.fml.common.registry.VillagerRegistry;
* @dependencies: IC2 API, MFR API
*/
@Mod(modid = "TConstruct", name = "TConstruct", version = "1.6.2_1.4.dev.24", dependencies = "required-after:Forge@[7.7.1.687,)")
@Mod(modid = "TConstruct", name = "TConstruct", version = "1.6.2_1.4.dev.5", dependencies = "required-after:Forge@[7.7.1.687,)")
@NetworkMod(serverSideRequired = false, clientSideRequired = true, channels = { "TConstruct" }, packetHandler = tconstruct.util.network.TPacketHandler.class)
public class TConstruct
{
@@ -128,8 +125,6 @@ public class TConstruct
SpecialStackHandler.registerBuiltInStackHandlers();
content.modIntegration();
content.createEntities();
/*SkillRegistry.registerSkill("Wall Building", new WallBuilding());
SkillRegistry.registerSkill("Jump", new Jump());*/
}
public static LiquidCasting getTableCasting ()
@@ -153,5 +148,4 @@ public class TConstruct
public static LiquidCasting tableCasting;
public static LiquidCasting basinCasting;
public static Detailing chiselDetailing;
public static SkillRegistry skillRegistry;
}
+110 -42
View File
@@ -1,6 +1,6 @@
package tconstruct.client;
import java.util.List;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
@@ -8,24 +8,23 @@ import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.model.ModelBiped;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.attributes.AttributeInstance;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.MathHelper;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.GuiIngameForge;
import net.minecraftforge.client.event.RenderGameOverlayEvent;
import net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType;
import net.minecraftforge.client.event.TextureStitchEvent;
import net.minecraftforge.event.ForgeSubscribe;
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
import net.minecraftforge.event.entity.player.PlayerInteractEvent.Action;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidRegistry;
import org.lwjgl.opengl.GL11;
import tconstruct.TConstruct;
import tconstruct.blocks.LiquidMetalFinite;
import tconstruct.client.armor.WingModel;
import tconstruct.common.TContent;
import tconstruct.skill.Skill;
import tconstruct.util.player.TPlayerStats;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@@ -80,27 +79,112 @@ public class TClientEvents
private static final ResourceLocation hearts = new ResourceLocation("tinker", "textures/gui/newhearts.png");
private static final ResourceLocation icons = new ResourceLocation("textures/gui/icons.png");
public static int left_height = 39;
public static int right_height = 39;
Random rand = new Random();
int updateCounter = 0;
/* HUD */
@ForgeSubscribe
public void renderHealthbar (RenderGameOverlayEvent.Post event)
public void renderHealthbar (RenderGameOverlayEvent.Pre event)
{
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(mc.thePlayer.username);
PotionEffect potion = mc.thePlayer.getActivePotionEffect(Potion.wither);
if (potion != null)
return;
potion = mc.thePlayer.getActivePotionEffect(Potion.poison);
if (potion != null)
return;
/*if (event.type == RenderGameOverlayEvent.ElementType.HEALTH)
if (event.type == ElementType.HEALTH)
{
event.setCanceled(true);
updateCounter++;
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(mc.thePlayer.username);
boolean highlight = mc.thePlayer.hurtResistantTime / 3 % 2 == 1;
if (mc.thePlayer.hurtResistantTime < 10)
{
highlight = false;
}
AttributeInstance attrMaxHealth = this.mc.thePlayer.func_110148_a(SharedMonsterAttributes.field_111267_a);
int health = MathHelper.ceiling_float_int(mc.thePlayer.func_110143_aJ());
int healthLast = MathHelper.ceiling_float_int(mc.thePlayer.prevHealth);
float healthMax = (float) attrMaxHealth.func_111126_e();
if (healthMax > 20)
healthMax = 20;
float absorb = this.mc.thePlayer.func_110139_bj();
int healthRows = MathHelper.ceiling_float_int((healthMax + absorb) / 2.0F / 10.0F);
int rowHeight = Math.max(10 - (healthRows - 2), 3);
this.rand.setSeed((long) (updateCounter * 312871));
int left = scaledWidth / 2 - 91;
int top = scaledHeight - left_height;
int regen = -1;
if (mc.thePlayer.isPotionActive(Potion.regeneration))
{
regen = updateCounter % 25;
}
final int TOP = 9 * (mc.theWorld.getWorldInfo().isHardcoreModeEnabled() ? 5 : 0);
final int BACKGROUND = (highlight ? 25 : 16);
int MARGIN = 16;
if (mc.thePlayer.isPotionActive(Potion.poison))
MARGIN += 36;
else if (mc.thePlayer.isPotionActive(Potion.wither))
MARGIN += 72;
float absorbRemaining = absorb;
for (int i = MathHelper.ceiling_float_int((healthMax + absorb) / 2.0F) - 1; i >= 0; --i)
{
int b0 = (highlight ? 1 : 0);
int row = MathHelper.ceiling_float_int((float) (i + 1) / 10.0F) - 1;
int x = left + i % 10 * 8;
int y = top - row * rowHeight;
if (health <= 4)
y += rand.nextInt(2);
if (i == regen)
y -= 2;
drawTexturedModalRect(x, y, BACKGROUND, TOP, 9, 9);
if (highlight)
{
if (i * 2 + 1 < healthLast)
drawTexturedModalRect(x, y, MARGIN + 54, TOP, 9, 9); //6
else if (i * 2 + 1 == healthLast)
drawTexturedModalRect(x, y, MARGIN + 63, TOP, 9, 9); //7
}
if (absorbRemaining > 0.0F)
{
if (absorbRemaining == absorb && absorb % 2.0F == 1.0F)
drawTexturedModalRect(x, y, MARGIN + 153, TOP, 9, 9); //17
else
drawTexturedModalRect(x, y, MARGIN + 144, TOP, 9, 9); //16
absorbRemaining -= 2.0F;
}
else
{
if (i * 2 + 1 < health)
drawTexturedModalRect(x, y, MARGIN + 36, TOP, 9, 9); //4
else if (i * 2 + 1 == health)
drawTexturedModalRect(x, y, MARGIN + 45, TOP, 9, 9); //5
}
}
PotionEffect potion = mc.thePlayer.getActivePotionEffect(Potion.wither);
if (potion != null)
return;
potion = mc.thePlayer.getActivePotionEffect(Potion.poison);
if (potion != null)
return;
//Extra hearts
this.mc.func_110434_K().func_110577_a(hearts);
int hp = MathHelper.ceiling_float_int(this.mc.thePlayer.func_110143_aJ());
@@ -120,25 +204,9 @@ public class TClientEvents
}
this.mc.func_110434_K().func_110577_a(icons);
}*/
if (event.type == RenderGameOverlayEvent.ElementType.HOTBAR)
{
if (stats.skillList == null)
return;
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.func_110434_K().func_110577_a(skill.getResource(scaledresolution.getScaleFactor()));
//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);
GuiIngameForge.left_height += 10;
if (absorb > 0)
GuiIngameForge.left_height += 10;
}
}
+2 -63
View File
@@ -21,11 +21,6 @@ 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 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;
@@ -42,9 +37,9 @@ public class TControls extends TKeyHandler
public TControls()
{
super(new KeyBinding[] { armorKey ,/* skillOne, skillTwo, skillThree, skillFour, skillFive*/}, new boolean[] { false , /*false, false, false, false, false*/}, getVanillaKeyBindings(),
super(new KeyBinding[] { armorKey }, new boolean[] { false}, getVanillaKeyBindings(),
new boolean[] { false, false });
//System.out.println("Controls registered");Natura
//System.out.println("Controls registered");
}
private static KeyBinding[] getVanillaKeyBindings ()
@@ -74,26 +69,6 @@ public class TControls extends TKeyHandler
{
TProxyClient.addTabsToInventory((GuiContainer) mc.currentScreen);
}
/*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)
@@ -249,42 +224,6 @@ public class TControls extends TKeyHandler
updateServer(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)
{
TConstruct.playerTracker.activateSkill(player, key);
//System.out.println(MinecraftServer.getServer());
if (MinecraftServer.getServer().isDedicatedServer())
{
//System.out.println("Send");
ByteArrayOutputStream bos = new ByteArrayOutputStream(8);
DataOutputStream outputStream = new DataOutputStream(bos);
try
{
outputStream.writeByte(4);
outputStream.writeByte(key);
}
catch (Exception ex)
{
ex.printStackTrace();
}
updateServer(bos);
}
}
static void updateServer (ByteArrayOutputStream bos)
{
Packet250CustomPayload packet = new Packet250CustomPayload();
+2 -2
View File
@@ -110,12 +110,12 @@ public class StencilTableGui extends GuiContainer
logic.setInventorySlotContents(1, stack);
updateServer(stack);
}
else if (meta == 1 || meta == 2)
/*else if (meta == 1 || meta == 2)
{
ItemStack stack = new ItemStack(TContent.metalPattern, 1, 0);
logic.setInventorySlotContents(1, stack);
updateServer(stack);
}
}*/
}
}
+2 -2
View File
@@ -106,7 +106,7 @@ public class MaterialPage extends BookPage
String ability = material.ability();
if (!ability.equals(""))
{
manual.fonts.drawString("Material ability: " + material.ability(), localWidth, localHeight + 120 + 10 * offset, 0);
manual.fonts.drawString("Material Trait: " + material.ability(), localWidth, localHeight + 120 + 10 * offset, 0);
offset++;
if (ability.equals("Writable"))
manual.fonts.drawString("+1 Modifiers", localWidth, localHeight + 120 + 10 * offset, 0);
@@ -114,7 +114,7 @@ public class MaterialPage extends BookPage
if (material.reinforced() > 0)
{
manual.fonts.drawString("Material ability: Reinforced", localWidth, localHeight + 120 + 10 * offset, 0);
manual.fonts.drawString("Material Trait: Reinforced", localWidth, localHeight + 120 + 10 * offset, 0);
offset++;
manual.fonts.drawString("Reinforced level: " + material.reinforced(), localWidth, localHeight + 120 + 10 * offset, 0);
offset++;
-20
View File
@@ -70,25 +70,5 @@ public class ToolPage extends BookPage
manual.renderitem.zLevel = 0;
RenderHelper.disableStandardItemLighting();
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
/*manual.fonts.drawString("\u00a7n" + title, localWidth + 70, localHeight + 4, 0);
manual.fonts.drawSplitString(iconText[0], localWidth, localHeight + 16, 178, 0);
int size = iconText[0].length() / 48;
manual.fonts.drawSplitString(iconText[1], localWidth, localHeight + 28 + 10 * size, 118, 0);
manual.fonts.drawString("Crafting Parts: ", localWidth + 124, localHeight + 28 + 10 * size, 0);
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
RenderHelper.enableGUIStandardItemLighting();
manual.renderitem.zLevel = 100;
manual.renderitem.renderItemAndEffectIntoGUI(manual.fonts, manual.getMC().renderEngine, icons[0], localWidth + 50, localHeight + 0);
for (int i = 1; i < icons.length; i++)
{
manual.renderitem.renderItemAndEffectIntoGUI(manual.fonts, manual.getMC().renderEngine, icons[i], localWidth + 120, localHeight + 20 + 10 * size + 18 * i);
int partOffset = iconText[i + 1].length() > 11 ? -3 : 0;
manual.fonts.drawSplitString(iconText[i + 1], localWidth + 140, localHeight + 24 + 10 * size + 18 * i + partOffset, 44, 0);
}
manual.renderitem.zLevel = 0;
RenderHelper.disableStandardItemLighting();
GL11.glDisable(GL12.GL_RESCALE_NORMAL);*/
}
}
+36
View File
@@ -0,0 +1,36 @@
package tconstruct.common;
import net.minecraft.item.Item;
import tconstruct.library.crafting.ToolRecipe;
import tconstruct.library.tools.ToolCore;
public class BowRecipe extends ToolRecipe
{
public BowRecipe(Item head, Item handle, ToolCore tool)
{
super(head, handle, tool);
}
public BowRecipe(Item head, Item handle, Item accessory, ToolCore tool)
{
super(head, handle, accessory, tool);
}
public BowRecipe(Item head, Item handle, Item accessory, Item extra, ToolCore tool)
{
super(head, handle, accessory, extra, tool);
}
public boolean validHead (Item input)
{
for (Item part : headList)
{
if (part == input)
return true;
if (toolRod != null && part == toolRod && (input == Item.stick || input == Item.bone))
return true;
}
return false;
}
}
+116 -208
View File
@@ -1,6 +1,7 @@
package tconstruct.common;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
@@ -34,155 +35,27 @@ import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.oredict.OreDictionary;
import net.minecraftforge.oredict.ShapedOreRecipe;
import net.minecraftforge.oredict.ShapelessOreRecipe;
import tconstruct.TConstruct;
import tconstruct.blocks.Aggregator;
import tconstruct.blocks.DryingRack;
import tconstruct.blocks.EquipBlock;
import tconstruct.blocks.GlassBlockConnected;
import tconstruct.blocks.GlassBlockConnectedMeta;
import tconstruct.blocks.GlassPane;
import tconstruct.blocks.GlassPaneStained;
import tconstruct.blocks.GravelOre;
import tconstruct.blocks.LavaTankBlock;
import tconstruct.blocks.LightCrystalBase;
import tconstruct.blocks.LiquidMetalFinite;
import tconstruct.blocks.MetalOre;
import tconstruct.blocks.MultiBrick;
import tconstruct.blocks.MultiBrickFancy;
import tconstruct.blocks.OreberryBush;
import tconstruct.blocks.OreberryBushEssence;
import tconstruct.blocks.RedstoneMachine;
import tconstruct.blocks.SearedBlock;
import tconstruct.blocks.SearedSlab;
import tconstruct.blocks.SmelteryBlock;
import tconstruct.blocks.SoilBlock;
import tconstruct.blocks.SpeedBlock;
import tconstruct.blocks.SpeedSlab;
import tconstruct.blocks.StoneTorch;
import tconstruct.blocks.TMetalBlock;
import tconstruct.blocks.ToolForgeBlock;
import tconstruct.blocks.ToolStationBlock;
import tconstruct.blocks.logic.CastingBasinLogic;
import tconstruct.blocks.logic.CastingTableLogic;
import tconstruct.blocks.logic.DrawbridgeLogic;
import tconstruct.blocks.logic.DryingRackLogic;
import tconstruct.blocks.logic.FaucetLogic;
import tconstruct.blocks.logic.FirestarterLogic;
import tconstruct.blocks.logic.FrypanLogic;
import tconstruct.blocks.logic.GlowstoneAggregator;
import tconstruct.blocks.logic.LavaTankLogic;
import tconstruct.blocks.logic.MultiServantLogic;
import tconstruct.blocks.logic.PartCrafterLogic;
import tconstruct.blocks.logic.PatternChestLogic;
import tconstruct.blocks.logic.SmelteryDrainLogic;
import tconstruct.blocks.logic.SmelteryLogic;
import tconstruct.blocks.logic.StencilTableLogic;
import tconstruct.blocks.logic.ToolForgeLogic;
import tconstruct.blocks.logic.ToolStationLogic;
import tconstruct.entity.Automaton;
import tconstruct.entity.BlueSlime;
import tconstruct.entity.Crystal;
import tconstruct.entity.FancyEntityItem;
import tconstruct.entity.MiniGardy;
import tconstruct.entity.SlimeClone;
import tconstruct.entity.projectile.ArrowEntity;
import tconstruct.entity.projectile.DaggerEntity;
import tconstruct.entity.projectile.LaunchedPotion;
import tconstruct.items.Bowstring;
import tconstruct.items.CraftingItem;
import tconstruct.items.DiamondApple;
import tconstruct.items.FilledBucket;
import tconstruct.items.Fletching;
import tconstruct.items.GoldenHead;
import tconstruct.items.Manual;
import tconstruct.items.MaterialItem;
import tconstruct.items.MetalPattern;
import tconstruct.items.OreBerries;
import tconstruct.items.Pattern;
import tconstruct.items.StrangeFood;
import tconstruct.items.TitleIcon;
import tconstruct.items.ToolPart;
import tconstruct.items.ToolPartHidden;
import tconstruct.items.ToolShard;
import tconstruct.items.armor.Glove;
import tconstruct.items.armor.HeartCanister;
import tconstruct.items.armor.Knapsack;
import tconstruct.items.armor.TArmorBase;
import tconstruct.items.blocks.CraftedSoilItemBlock;
import tconstruct.items.blocks.GlassBlockItem;
import tconstruct.items.blocks.GlassPaneItem;
import tconstruct.items.blocks.GravelOreItem;
import tconstruct.items.blocks.LavaTankItemBlock;
import tconstruct.items.blocks.LightCrystalItem;
import tconstruct.items.blocks.MetalItemBlock;
import tconstruct.items.blocks.MetalOreItemBlock;
import tconstruct.items.blocks.MultiBrickFancyItem;
import tconstruct.items.blocks.MultiBrickItem;
import tconstruct.items.blocks.OreberryBushItem;
import tconstruct.items.blocks.OreberryBushSecondItem;
import tconstruct.items.blocks.RedstoneMachineItem;
import tconstruct.items.blocks.SearedSlabItem;
import tconstruct.items.blocks.SearedTableItemBlock;
import tconstruct.items.blocks.SmelteryItemBlock;
import tconstruct.items.blocks.SpeedBlockItem;
import tconstruct.items.blocks.SpeedSlabItem;
import tconstruct.items.blocks.StainedGlassClearItem;
import tconstruct.items.blocks.StainedGlassClearPaneItem;
import tconstruct.items.blocks.ToolForgeItemBlock;
import tconstruct.items.blocks.ToolStationItemBlock;
import tconstruct.items.tools.Arrow;
import tconstruct.items.tools.BattleSign;
import tconstruct.items.tools.Battleaxe;
import tconstruct.items.tools.Broadsword;
import tconstruct.items.tools.Chisel;
import tconstruct.items.tools.Cleaver;
import tconstruct.items.tools.Cutlass;
import tconstruct.items.tools.Dagger;
import tconstruct.items.tools.Excavator;
import tconstruct.items.tools.FryingPan;
import tconstruct.items.tools.Hammer;
import tconstruct.items.tools.Hatchet;
import tconstruct.items.tools.Longsword;
import tconstruct.items.tools.LumberAxe;
import tconstruct.items.tools.Mattock;
import tconstruct.items.tools.Pickaxe;
import tconstruct.items.tools.PotionLauncher;
import tconstruct.items.tools.Rapier;
import tconstruct.items.tools.Scythe;
import tconstruct.items.tools.Shortbow;
import tconstruct.items.tools.Shovel;
import tconstruct.landmine.block.BlockLandmine;
import tconstruct.landmine.item.ItemBlockLandmine;
import tconstruct.landmine.tileentity.TileEntityLandmine;
import tconstruct.library.TConstructRegistry;
import tconstruct.library.client.TConstructClientRegistry;
import tconstruct.library.crafting.Detailing;
import tconstruct.library.crafting.DryingRackRecipes;
import tconstruct.library.crafting.LiquidCasting;
import tconstruct.library.crafting.PatternBuilder;
import tconstruct.library.crafting.Smeltery;
import tconstruct.library.crafting.ToolBuilder;
import tconstruct.library.tools.ToolCore;
import tconstruct.library.util.IPattern;
import tconstruct.modifiers.ModAntiSpider;
import tconstruct.modifiers.ModAttack;
import tconstruct.modifiers.ModAutoSmelt;
import tconstruct.modifiers.ModBlaze;
import tconstruct.modifiers.ModButtertouch;
import tconstruct.modifiers.ModDurability;
import tconstruct.modifiers.ModElectric;
import tconstruct.modifiers.ModExtraModifier;
import tconstruct.modifiers.ModInteger;
import tconstruct.modifiers.ModLapis;
import tconstruct.modifiers.ModPiston;
import tconstruct.modifiers.ModRedstone;
import tconstruct.modifiers.ModReinforced;
import tconstruct.modifiers.ModRepair;
import tconstruct.modifiers.ModSmite;
import tconstruct.modifiers.TActiveOmniMod;
import tconstruct.util.PHConstruct;
import tconstruct.util.RecipeRemover;
import tconstruct.util.TDispenserBehaviorSpawnEgg;
import tconstruct.blocks.*;
import tconstruct.blocks.logic.*;
import tconstruct.entity.*;
import tconstruct.entity.projectile.*;
import tconstruct.items.*;
import tconstruct.items.armor.*;
import tconstruct.items.blocks.*;
import tconstruct.items.tools.*;
import tconstruct.landmine.block.*;
import tconstruct.landmine.item.*;
import tconstruct.landmine.tileentity.*;
import tconstruct.library.*;
import tconstruct.library.client.*;
import tconstruct.library.crafting.*;
import tconstruct.library.tools.*;
import tconstruct.library.util.*;
import tconstruct.modifiers.*;
import tconstruct.util.*;
import cpw.mods.fml.common.IFuelHandler;
import cpw.mods.fml.common.event.FMLInterModComms;
import cpw.mods.fml.common.registry.EntityRegistry;
@@ -309,10 +182,6 @@ public class TContent implements IFuelHandler
public static Block lightCrystalBase;
//Liquids
//public static Block liquidMetalFlowing;
//public static Block liquidMetalStill;
/*String[] names = new String[] { "Molten Iron", "Molten Gold", "Molten Copper", "Molten Tin", "Molten Aluminum", "Molten Cobalt", "Molten Ardite", "Molten Bronze", "Molten Aluminum Brass",
"Molten Manyullyn", "Molten Alumite", "Molten Obsidian", "Molten Steel", "Molten Glass", "Seared Stone", "Molten Emerald", "Blood" };*/
public static Material liquidMetal;
public static Fluid moltenIronFluid;
@@ -375,9 +244,6 @@ public class TContent implements IFuelHandler
public static ModLapis modL;
//Golems
/*public static Block glowSapling;
public static Block glowLeaves;
public static Block glowLog;*/
public static Block redstoneBallRepeater;
public static Item redstoneBallRepeaterItem;
@@ -426,7 +292,6 @@ public class TContent implements IFuelHandler
EntityRegistry.registerModEntity(ArrowEntity.class, "Arrow", 4, TConstruct.instance, 32, 5, true);
//EntityRegistry.registerModEntity(CartEntity.class, "Small Wagon", 1, TConstruct.instance, 32, 5, true);
//EntityRegistry.registerModEntity(Skyla.class, "Skyla", 10, TConstruct.instance, 32, 5, true);
EntityRegistry.registerModEntity(SlimeClone.class, "SlimeClone", 10, TConstruct.instance, 32, 3, true);
EntityRegistry.registerModEntity(Automaton.class, "Automaton", 11, TConstruct.instance, 64, 3, true);
EntityRegistry.registerModEntity(BlueSlime.class, "EdibleSlime", 12, TConstruct.instance, 64, 5, true);
@@ -443,20 +308,7 @@ public class TContent implements IFuelHandler
BiomeGenBase[] wasteland = BiomeDictionary.getBiomesForType(BiomeDictionary.Type.WASTELAND);
BiomeGenBase[] nether = BiomeDictionary.getBiomesForType(BiomeDictionary.Type.NETHER);
/*if (PHConstruct.superfunWorld)
{
EntityRegistry.addSpawn(NitroCreeper.class, 1000, 100, 100, EnumCreatureType.monster, plains);
EntityRegistry.addSpawn(NitroCreeper.class, 1000, 100, 100, EnumCreatureType.monster, mountain);
EntityRegistry.addSpawn(NitroCreeper.class, 1000, 100, 100, EnumCreatureType.monster, hills);
EntityRegistry.addSpawn(NitroCreeper.class, 1000, 100, 100, EnumCreatureType.monster, swamp);
EntityRegistry.addSpawn(NitroCreeper.class, 1000, 100, 100, EnumCreatureType.monster, desert);
EntityRegistry.addSpawn(NitroCreeper.class, 1000, 100, 100, EnumCreatureType.monster, frozen);
EntityRegistry.addSpawn(NitroCreeper.class, 1000, 100, 100, EnumCreatureType.monster, jungle);
EntityRegistry.addSpawn(NitroCreeper.class, 1000, 100, 100, EnumCreatureType.monster, wasteland);
DimensionManager.unregisterProviderType(0);
DimensionManager.registerProviderType(0, OverworldProvider.class, true);
}*/
if (PHConstruct.blueSlime)
{
EntityRegistry.addSpawn(BlueSlime.class, PHConstruct.blueSlimeWeight, 4, 4, EnumCreatureType.monster, plains);
@@ -480,7 +332,6 @@ public class TContent implements IFuelHandler
{
}
//EntityRegistry.addSpawn(MetalSlime.class, 1, 4, 4, EnumCreatureType.monster, overworldBiomes);
}
public static Fluid[] fluids = new Fluid[23];
@@ -553,10 +404,6 @@ public class TContent implements IFuelHandler
GameRegistry.registerBlock(dryingRack, "Armor.DryingRack");
GameRegistry.registerTileEntity(DryingRackLogic.class, "Armor.DryingRack");
//Traps
/*landmine = new Landmine(PHConstruct.landmine, 0, EnumMobType.mobs, Material.cactus).setUnlocalizedName("landmine");
GameRegistry.registerBlock(landmine, "landmine");*/
//Liquids
liquidMetal = new MaterialLiquid(MapColor.tntColor);
@@ -822,9 +669,6 @@ public class TContent implements IFuelHandler
stainedGlassClearPane = new GlassPaneStained(PHConstruct.stainedGlassClearPane);
GameRegistry.registerBlock(stainedGlassClearPane, StainedGlassClearPaneItem.class, "GlassPaneClearStained");
/*public static Block stainedGlass;
public static Block stainedGlassClear;*/
aggregator = new Aggregator(PHConstruct.aggregator).setUnlocalizedName("Aggregator");
aggregator.stepSound = Block.soundMetalFootstep;
GameRegistry.registerBlock(aggregator, "Aggregator");
@@ -833,29 +677,6 @@ public class TContent implements IFuelHandler
lightCrystalBase = new LightCrystalBase(PHConstruct.lightCrystalBase).setUnlocalizedName("LightCrystalBase");
lightCrystalBase.stepSound = Block.soundGlassFootstep;
GameRegistry.registerBlock(lightCrystalBase, LightCrystalItem.class, "LightCrystalBase");
/*redstoneBallRepeater = new RedstoneBallRepeater(PHConstruct.redstoneBallRepeater, false).setUnlocalizedName("decoration.redstoneballrepeater");
GameRegistry.registerBlock(redstoneBallRepeater, "decoration.redstoneballrepeater");
Item.itemsList[PHConstruct.redstoneBallRepeater] = null;
redstoneBallRepeaterItem = new RedstoneBallRepeaterItem(PHConstruct.redstoneBallRepeater-256).setUnlocalizedName("decoration.redstoneballrepeater");*/
//Golems
/*golemCore = new GolemCoreBlock(PHConstruct.golemCore).setUnlocalizedName("golemcore");
GameRegistry.registerBlock(golemCore, "Golem Core");
GameRegistry.registerTileEntity(GolemCoreLogic.class, "TConstruct.GolemCore");
golemHead = new GolemHeadBlock(PHConstruct.golemHead).setUnlocalizedName("golemhead");
GameRegistry.registerBlock(golemHead, "Golem Head");*/
/*golemPedestal = new GolemPedestalBlock(PHConstruct.golemPedestal).setUnlocalizedName("golempedestal");
GameRegistry.registerBlock(golemPedestal, "Golem Pedestal");
GameRegistry.registerTileEntity(GolemPedestalLogic.class, "TConstruct.GolemPedestal");*/
//Traps
/*landmine = new Landmine(PHConstruct.landmine, EnumMobType.mobs, Material.wood).setUnlocalizedName("tconstruct.landmine");
GameRegistry.registerBlock(landmine, "Landmine");
barricade = new BarricadeBlock(PHConstruct.barricade).setUnlocalizedName("tconstruct.barricade");
GameRegistry.registerBlock(barricade, "Barricade");*/
}
void registerItems ()
@@ -869,7 +690,6 @@ public class TContent implements IFuelHandler
toolShard = new ToolShard(PHConstruct.toolShard, "_chunk").setUnlocalizedName("tconstruct.ToolShard");
woodPattern = new Pattern(PHConstruct.woodPattern, "WoodPattern", "pattern_", "materials/").setUnlocalizedName("tconstruct.Pattern");
metalPattern = new MetalPattern(PHConstruct.metalPattern, "MetalPattern", "cast_", "materials/").setUnlocalizedName("tconstruct.MetalPattern");
//netherPattern = new Pattern(PHTools.netherPattern, 128, patternTexture).setUnlocalizedName("tconstruct.Pattern");
TConstructRegistry.addItemToDirectory("blankPattern", blankPattern);
TConstructRegistry.addItemToDirectory("woodPattern", woodPattern);
@@ -975,11 +795,6 @@ public class TContent implements IFuelHandler
heavyBoots = new TArmorBase(PHConstruct.heavyBoots, 3).setUnlocalizedName("tconstruct.HeavyBoots");
glove = new Glove(PHConstruct.glove).setUnlocalizedName("tconstruct.Glove");
knapsack = new Knapsack(PHConstruct.knapsack).setUnlocalizedName("tconstruct.storage");
/*public static Item heavyHelmet;
public static Item heavyChestplate;
public static Item heavyPants;
public static Item heavyBoots;*/
goldHead = new GoldenHead(PHConstruct.goldHead, 4, 1.2F, false).setAlwaysEdible().setPotionEffect(Potion.regeneration.id, 10, 0, 1.0F).setUnlocalizedName("goldenhead");
String[] materialStrings = { "paperStack", "greenSlimeCrystal", "searedBrick", "ingotCobalt", "ingotArdite", "ingotManyullyn", "mossBall", "lavaCrystal", "necroticBone", "ingotCopper",
@@ -1192,7 +1007,9 @@ public class TContent implements IFuelHandler
tb.addNormalToolRecipe(hammer, hammerHead, toughRod, heavyPlate, heavyPlate);
tb.addNormalToolRecipe(battleaxe, broadAxeHead, toughRod, broadAxeHead, toughBinding);
tb.addNormalToolRecipe(shortbow, toolRod, bowstring, toolRod);
//tb.addNormalToolRecipe(shortbow, toolRod, bowstring, toolRod);
BowRecipe recipe = new BowRecipe(toolRod, bowstring, toolRod, shortbow);
tb.addCustomToolRecipe(recipe);
tb.addNormalToolRecipe(arrow, arrowhead, toolRod, fletching);
ItemStack diamond = new ItemStack(Item.diamond);
@@ -1328,6 +1145,15 @@ public class TContent implements IFuelHandler
}
}
ItemStack[] ingotShapes = { new ItemStack(Item.ingotIron), new ItemStack(Item.ingotGold), new ItemStack(Item.brick), new ItemStack(Item.netherrackBrick), new ItemStack(materials, 1, 2) };
for (int i = 0; i < ingotShapes.length; i++)
{
TConstruct.tableCasting.addCastingRecipe(new ItemStack(TContent.metalPattern, 1, 0), new FluidStack(moltenAlubrassFluid, TConstruct.ingotLiquidValue), ingotShapes[i],
false, 50);
TConstruct.tableCasting.addCastingRecipe(new ItemStack(TContent.metalPattern, 1, 0), new FluidStack(moltenGoldFluid, TConstruct.ingotLiquidValue * 2),
ingotShapes[i], false, 50);
}
ItemStack fullguardCast = new ItemStack(metalPattern, 1, 22);
tableCasting.addCastingRecipe(fullguardCast, new FluidStack(moltenAlubrassFluid, TConstruct.ingotLiquidValue), new ItemStack(fullGuard, 1, Short.MAX_VALUE), false, 50);
tableCasting.addCastingRecipe(fullguardCast, new FluidStack(moltenGoldFluid, TConstruct.ingotLiquidValue * 2), new ItemStack(fullGuard, 1, Short.MAX_VALUE), false, 50);
@@ -1391,6 +1217,9 @@ public class TContent implements IFuelHandler
Smeltery.addAlloyMixing(new FluidStack(moltenManyullynFluid, 16), new FluidStack(moltenCobaltFluid, 32), new FluidStack(moltenArditeFluid, 32)); //Manyullyn
Smeltery.addAlloyMixing(new FluidStack(moltenAlumiteFluid, 48), new FluidStack(moltenAluminumFluid, 80), new FluidStack(moltenIronFluid, 32), new FluidStack(moltenObsidianFluid, 32)); //Alumite
Smeltery.addAlloyMixing(new FluidStack(moltenInvarFluid, 24), new FluidStack(moltenIronFluid, 16), new FluidStack(moltenNickelFluid, 8)); //Invar
Smeltery.addAlloyMixing(new FluidStack(moltenElectrumFluid, 16), new FluidStack(moltenGoldFluid, 8), new FluidStack(moltenSilverFluid, 8)); //Electrum
//Oreberries
Smeltery.addMelting(new ItemStack(oreBerries, 4, 0), Block.blockIron.blockID, 0, 100, new FluidStack(moltenIronFluid, TConstruct.ingotLiquidValue / 9)); //Iron
Smeltery.addMelting(new ItemStack(oreBerries, 4, 1), Block.blockGold.blockID, 0, 100, new FluidStack(moltenGoldFluid, TConstruct.ingotLiquidValue / 9)); //Gold
@@ -2063,6 +1892,85 @@ public class TContent implements IFuelHandler
{
System.out.println("[TConstruct] Thaumcraft not detected.");
}
ItemStack ingotcast = new ItemStack(metalPattern, 1, 0);
LiquidCasting tableCasting = TConstructRegistry.instance.getTableCasting();
LiquidCasting basinCasting = TConstructRegistry.instance.getBasinCasting();
/* Thermal Expansion */
ArrayList<ItemStack> ores = OreDictionary.getOres("ingotNickel");
if (ores.size() > 0)
{
ItemStack ingot = ores.get(0);
tableCasting.addCastingRecipe(ingot, new FluidStack(moltenNickelFluid, TConstruct.ingotLiquidValue), ingotcast, 80);
}
ores = OreDictionary.getOres("ingotLead");
if (ores.size() > 0)
{
ItemStack ingot = ores.get(0);
tableCasting.addCastingRecipe(ingot, new FluidStack(moltenLeadFluid, TConstruct.ingotLiquidValue), ingotcast, 80);
}
ores = OreDictionary.getOres("ingotSilver");
if (ores.size() > 0)
{
ItemStack ingot = ores.get(0);
tableCasting.addCastingRecipe(ingot, new FluidStack(moltenSilverFluid, TConstruct.ingotLiquidValue), ingotcast, 80);
}
ores = OreDictionary.getOres("ingotPlatinum");
if (ores.size() > 0)
{
ItemStack ingot = ores.get(0);
tableCasting.addCastingRecipe(ingot, new FluidStack(moltenShinyFluid, TConstruct.ingotLiquidValue), ingotcast, 80);
}
ores = OreDictionary.getOres("ingotInvar");
if (ores.size() > 0)
{
ItemStack ingot = ores.get(0);
tableCasting.addCastingRecipe(ingot, new FluidStack(moltenInvarFluid, TConstruct.ingotLiquidValue), ingotcast, 80);
}
ores = OreDictionary.getOres("ingotElectrum");
if (ores.size() > 0)
{
ItemStack ingot = ores.get(0);
tableCasting.addCastingRecipe(ingot, new FluidStack(moltenElectrumFluid, TConstruct.ingotLiquidValue), ingotcast, 80);
}
ores = OreDictionary.getOres("blockNickel");
if (ores.size() > 0)
{
ItemStack ingot = ores.get(0);
basinCasting.addCastingRecipe(ingot, new FluidStack(moltenNickelFluid, TConstruct.ingotLiquidValue * 9), null, 100);
}
ores = OreDictionary.getOres("blockLead");
if (ores.size() > 0)
{
ItemStack ingot = ores.get(0);
basinCasting.addCastingRecipe(ingot, new FluidStack(moltenLeadFluid, TConstruct.ingotLiquidValue * 9), null, 100);
}
ores = OreDictionary.getOres("blockSilver");
if (ores.size() > 0)
{
ItemStack ingot = ores.get(0);
basinCasting.addCastingRecipe(ingot, new FluidStack(moltenSilverFluid, TConstruct.ingotLiquidValue * 9), null, 100);
}
ores = OreDictionary.getOres("blockPlatinum");
if (ores.size() > 0)
{
ItemStack ingot = ores.get(0);
basinCasting.addCastingRecipe(ingot, new FluidStack(moltenShinyFluid, TConstruct.ingotLiquidValue * 9), null, 100);
}
ores = OreDictionary.getOres("blockInvar");
if (ores.size() > 0)
{
ItemStack ingot = ores.get(0);
basinCasting.addCastingRecipe(ingot, new FluidStack(moltenInvarFluid, TConstruct.ingotLiquidValue * 9), null, 100);
}
ores = OreDictionary.getOres("blockElectrum");
if (ores.size() > 0)
{
ItemStack ingot = ores.get(0);
basinCasting.addCastingRecipe(ingot, new FluidStack(moltenElectrumFluid, TConstruct.ingotLiquidValue * 9), null, 100);
}
}
public static Object getStaticItem (String name, String classPackage)
+7 -9
View File
@@ -2,24 +2,22 @@ package tconstruct.library.crafting;
import java.util.LinkedList;
import net.minecraft.item.Item;
import tconstruct.library.TConstructRegistry;
import tconstruct.library.tools.ToolCore;
import net.minecraft.item.Item;
/*
* Small class for checking if a particular tool combination is this one
*/
public class ToolRecipe
{
LinkedList<Item> headList = new LinkedList<Item>();
LinkedList<Item> handleList = new LinkedList<Item>();
LinkedList<Item> accessoryList = new LinkedList<Item>();
LinkedList<Item> extraList = new LinkedList<Item>();
ToolCore result;
Item toolRod = TConstructRegistry.getItem("toolRod");
protected LinkedList<Item> headList = new LinkedList<Item>();
protected LinkedList<Item> handleList = new LinkedList<Item>();
protected LinkedList<Item> accessoryList = new LinkedList<Item>();
protected LinkedList<Item> extraList = new LinkedList<Item>();
protected ToolCore result;
protected Item toolRod = TConstructRegistry.getItem("toolRod");
/*public ToolRecipe(Item head, ToolCore tool)
{
-29
View File
@@ -1,29 +0,0 @@
package tconstruct.skill;
import net.minecraft.entity.Entity;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
public class Jump extends Skill
{
private static final ResourceLocation three = new ResourceLocation("tinker", "textures/skill/Jump48x.png");
@Override
public ResourceLocation getResource (int guiscale)
{
return three;
}
@Override
public String getSkillName ()
{
return "Jump";
}
@Override
public void activate (Entity entity, World world)
{
if (entity.onGround)
entity.motionY = 0.8f;
}
}
-80
View File
@@ -1,80 +0,0 @@
package tconstruct.skill;
import net.minecraft.entity.Entity;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
/* Base skill
*
*/
public abstract class Skill
{
public int skillID;
boolean active = true;
//public abstract String getTextureFile (int guiscale);
public abstract ResourceLocation getResource(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 void setActive (boolean flag)
{
this.active = flag;
}
public boolean getActive ()
{
return active;
}
public Skill copy () throws InstantiationException, IllegalAccessException
{
Skill skill = this.getClass().newInstance();
skill.setSkillID(this.skillID);
return skill;
}
public void setSkillID (int i)
{
skillID = i;
}
public int getSkillID ()
{
return skillID;
}
/* Save/Load */
public void saveToNBT (NBTTagCompound tag)
{
}
public void readFromNBT (NBTTagCompound tag)
{
}
}
-27
View File
@@ -1,27 +0,0 @@
package tconstruct.skill;
import java.util.HashMap;
public class SkillRegistry
{
public static HashMap<String, Skill> skills = new HashMap<String, Skill>();
static int skillID = 0;
public static HashMap<Integer, Skill> skillMapping = new HashMap<Integer, Skill>(); //Simplifies network transmission
public static void registerSkill (String name, Skill skill)
{
skills.put(name, skill);
skillMapping.put(getNextAvailableID(), skill);
}
static Integer getNextAvailableID ()
{
return skillID++;
}
public static Skill getSkill(String name)
{
return skills.get(name);
}
}
-142
View File
@@ -1,142 +0,0 @@
package tconstruct.skill;
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.util.ResourceLocation;
import net.minecraft.world.World;
import tconstruct.library.tools.AbilityHelper;
public class WallBuilding extends Skill
{
private static final ResourceLocation one = new ResourceLocation("tinker", "textures/skill/Wall16x.png");
private static final ResourceLocation two = new ResourceLocation("tinker", "textures/skill/Wall32x.png");
private static final ResourceLocation three = new ResourceLocation("tinker", "textures/skill/Wall48x.png");
@Override
public ResourceLocation getResource (int guiscale)
{
if (guiscale == 2)
return two;
if (guiscale == 3)
return three;
return one;
}
@Override
public String getSkillName ()
{
return "Wall Building";
}
@Override
public void activate (Entity entity, World world)
{
this.active = !active;
System.out.println("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;
}
ItemStack copy = stack.copy();
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 (player.capabilities.isCreativeMode)
{
stack = copy.copy();
}
if (stack.stackSize < 1)
{
player.inventory.setInventorySlotContents(player.inventory.currentItem, null);
break;
}
}
}
}
if (player.capabilities.isCreativeMode)
{
player.inventory.setInventorySlotContents(player.inventory.currentItem, stack);
}
Block block = Block.blocksList[copy.itemID];
if (block != null)
{
world.playSoundEffect((double) ((float) xPos + 0.5F), (double) ((float) yPos + 0.5F), (double) ((float) zPos + 0.5F), block.stepSound.getPlaceSound(),
(block.stepSound.getVolume() + 1.0F) / 2.0F, block.stepSound.getPitch() * 0.8F);
}
//world.playAuxSFX(2001, xPos, yPos, zPos, copy.itemID + (copy.getItemDamage() << 12));
}
}
}
}
}
}
+14 -38
View File
@@ -1,9 +1,9 @@
package tconstruct.util;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.entity.Entity;
import net.minecraft.entity.boss.EntityWither;
import net.minecraft.entity.item.EntityItem;
@@ -28,8 +28,6 @@ import net.minecraftforge.event.entity.living.LivingDeathEvent;
import net.minecraftforge.event.entity.living.LivingDropsEvent;
import net.minecraftforge.event.entity.living.LivingSpawnEvent;
import net.minecraftforge.event.entity.player.FillBucketEvent;
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
import net.minecraftforge.event.entity.player.PlayerInteractEvent.Action;
import net.minecraftforge.event.world.ChunkDataEvent;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.oredict.OreDictionary;
@@ -50,7 +48,6 @@ import tconstruct.library.tools.FletchingMaterial;
import tconstruct.library.tools.ToolCore;
import tconstruct.library.util.ValueCoordTuple;
import tconstruct.modifiers.ModAttack;
import tconstruct.skill.Skill;
import tconstruct.util.player.TPlayerStats;
public class TEventHandler
@@ -197,49 +194,28 @@ public class TEventHandler
public static ItemStack craftFletching (ItemStack stack)
{
if (matchesLeaves(stack))
{
FletchingMaterial leaves = (FletchingMaterial) TConstructRegistry.getCustomMaterial(new ItemStack(Block.leaves), FletchingMaterial.class);
return leaves.craftingItem.copy();
}
FletchingMaterial mat = (FletchingMaterial) TConstructRegistry.getCustomMaterial(stack, FletchingMaterial.class);
if (mat != null)
return mat.craftingItem.copy();
return null;
}
/* Interact */
@ForgeSubscribe
public void interact (PlayerInteractEvent event)
public static boolean matchesLeaves (ItemStack stack)
{
if (event.action == Action.RIGHT_CLICK_BLOCK)
{
List<Skill> skills = TConstruct.playerTracker.getPlayerStats(event.entityPlayer.username).skillList;
if (skills.size() > 0)
{
Skill walls = skills.get(0);
walls.rightClickActivate(event.entityPlayer, event.entityPlayer.worldObj);
}
}
}
/* Damage */
/*@ForgeSubscribe
public void onHurt (LivingHurtEvent event)
{*/
/*if (event.entityLiving instanceof EntityPlayer)
{
EntityPlayer player = (EntityPlayer) event.entityLiving;
ItemStack stack = player.getItemInUse();
if (stack != null && stack.getItem() == TContent.cutlass)
Block block = Block.blocksList[stack.itemID];
if (block != null)
{
player.addPotionEffect(new PotionEffect(Potion.moveSpeed.id, 3*20, 1));
if (block.isLeaves(null, 0, 0, 0))
return true;
}
}*/
/*if (event.source instanceof EntityDamageSource && event.source.damageType.equals("explosion.player") && ((EntityDamageSource) event.source).getEntity() instanceof NitroCreeper)
{
if (event.entityLiving.worldObj.difficultySetting == 3)
event.ammount /= 2.3;
else
event.ammount /= 1.5;
}*/
//}
return false;
}
/* Drops */
@ForgeSubscribe
+4 -27
View File
@@ -3,15 +3,6 @@ package tconstruct.util.network;
import java.io.ByteArrayInputStream;
import java.io.DataInputStream;
import java.io.IOException;
import java.util.ArrayList;
import tconstruct.TConstruct;
import tconstruct.blocks.logic.ToolForgeLogic;
import tconstruct.blocks.logic.ToolStationLogic;
import tconstruct.library.blocks.InventoryLogic;
import tconstruct.skill.Skill;
import tconstruct.skill.SkillRegistry;
import tconstruct.util.player.TPlayerStats;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
@@ -22,6 +13,10 @@ import net.minecraft.network.packet.Packet250CustomPayload;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.common.DimensionManager;
import tconstruct.TConstruct;
import tconstruct.blocks.logic.ToolForgeLogic;
import tconstruct.blocks.logic.ToolStationLogic;
import tconstruct.library.blocks.InventoryLogic;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.network.IPacketHandler;
import cpw.mods.fml.common.network.Player;
@@ -53,18 +48,6 @@ public class TPacketHandler implements IPacketHandler
try
{
packetID = inputStream.readByte();
if (packetID == 1)
{
TPlayerStats stats = TConstruct.playerTracker.getPlayerStats(player.username);
stats.skillList = new ArrayList<Skill>();
int size = inputStream.readInt();
for (int i = 0; i < size; i++)
{
Skill skill = SkillRegistry.skillMapping.get(inputStream.readInt()).copy();
skill.setActive(inputStream.readBoolean());
stats.skillList.add(skill);
}
}
}
catch (Exception e)
{
@@ -138,12 +121,6 @@ public class TPacketHandler implements IPacketHandler
}
}
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();
+16 -18
View File
@@ -21,7 +21,7 @@ public class ArmorExtended implements IInventory
{
public ItemStack[] inventory = new ItemStack[7];
public WeakReference<EntityPlayer> parent;
public UUID = UUID.fromString("B243BE32-DC1B-4C53-8D13-8752D5C69D5B"); //or whatever
public UUID globalID = UUID.fromString("B243BE32-DC1B-4C53-8D13-8752D5C69D5B");
public void init (EntityPlayer player)
{
@@ -157,7 +157,6 @@ public class ArmorExtended implements IInventory
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());
@@ -166,29 +165,28 @@ public class ArmorExtended implements IInventory
int prevHealth = stats.bonusHealth;
if (side == Side.CLIENT)
prevHealth = stats.bonusHealthClient;
int bonusHP = stack.stackSize * 2;
if (side == Side.CLIENT)
stats.bonusHealthClient = bonusHP;
else
stats.bonusHealth = bonusHP;
int healthChange = bonusHP - prevHealth;
//System.out.println("healthChange: "+healthChange+" on side "+FMLCommonHandler.instance().getEffectiveSide());
if (healthChange != 0)
{
AttributeInstance attributeinstance = player.func_110140_aT().func_111151_a(SharedMonsterAttributes.field_111267_a);
try
{
attributeinstance.func_111124_b(attributeinstance.func_111127_a(UUID));
} catch(Exception e) {};
attributeinstance.func_111121_a(new AttributeModifier(UUID, "tconstruct.heartCanister", bonusHP, 0));
attributeinstance.func_111124_b(attributeinstance.func_111127_a(globalID));
}
catch (Exception e)
{
}
attributeinstance.func_111121_a(new AttributeModifier(globalID, "tconstruct.heartCanister", bonusHP, 0));
}
/*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)
@@ -207,12 +205,12 @@ public class ArmorExtended implements IInventory
AttributeInstance attributeinstance = player.func_110140_aT().func_111151_a(SharedMonsterAttributes.field_111267_a);
try
{
attributeinstance.func_111124_b(attributeinstance.func_111127_a(UUID));
} catch(Exception e) {};
attributeinstance.func_111124_b(attributeinstance.func_111127_a(globalID));
}
catch (Exception e)
{
}
}
//player.func_110148_a(SharedMonsterAttributes.field_111267_a).func_111128_a(20);
//player.setEntityHealth(20);
//parent.get().maxHealth = 20;
}
}
@@ -1,10 +1,7 @@
package tconstruct.util.player;
import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import java.util.concurrent.ConcurrentHashMap;
@@ -19,12 +16,9 @@ import net.minecraftforge.event.entity.living.LivingFallEvent;
import net.minecraftforge.event.entity.player.PlayerDropsEvent;
import tconstruct.common.TContent;
import tconstruct.library.tools.AbilityHelper;
import tconstruct.skill.Skill;
import tconstruct.skill.SkillRegistry;
import tconstruct.util.PHConstruct;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.IPlayerTracker;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.network.PacketDispatcher;
import cpw.mods.fml.common.network.Player;
import cpw.mods.fml.relauncher.Side;
@@ -77,10 +71,6 @@ public class TPlayerHandler implements IPlayerTracker
}
}
/*stats.skillList = new ArrayList<Skill>();
stats.skillList.add(SkillRegistry.getSkill("Wall Building"));*/
//stats.armor.recalculateSkills(entityplayer, stats);
playerStats.put(entityplayer.username, stats);
if (PHConstruct.gregtech)
@@ -94,19 +84,7 @@ public class TPlayerHandler implements IPlayerTracker
}
}
if (Loader.isModLoaded("GregTech_Addon") || Loader.isModLoaded("GregTech-Addon"))
{
if (entityplayer.username.equals("GregoriousT") || entityplayer.username.equals("gregorioust"))
entityplayer.addChatMessage("Quit being a dick.");
else
{
entityplayer.addChatMessage("\u00A74!!!WARNING!!! \u00A7fGREGTECH PRESENT!! VANILLA MINECRAFT MAY BE IRREPARABLY DAMAGED");
entityplayer.addChatMessage("\u00A74!!!WARNING!!! \u00A7fGREGTECH PRESENT!! MODS MAY NOT FUNCTION PROPERLY");
}
}
updatePlayerInventory(entityplayer, stats);
sendSkills(entityplayer, stats);
}
void updatePlayerInventory (EntityPlayer entityplayer, TPlayerStats stats)
@@ -114,32 +92,6 @@ public class TPlayerHandler implements IPlayerTracker
}
void sendSkills (EntityPlayer entityplayer, TPlayerStats stats)
{
ByteArrayOutputStream bos = new ByteArrayOutputStream(8);
DataOutputStream outputStream = new DataOutputStream(bos);
List<Skill> skills = stats.skillList;
try
{
outputStream.writeByte(1);
outputStream.writeInt(skills.size());
for (Skill skill : stats.skillList)
{
outputStream.writeInt(skill.getSkillID());
outputStream.writeBoolean(skill.getActive());
}
//outputStream.writeByte(key);
}
catch (Exception ex)
{
ex.printStackTrace();
}
updateClientPlayer(bos, entityplayer);
}
void updateClientPlayer (ByteArrayOutputStream bos, EntityPlayer player)
{
Packet250CustomPayload packet = new Packet250CustomPayload();
@@ -150,19 +102,6 @@ public class TPlayerHandler implements IPlayerTracker
PacketDispatcher.sendPacketToPlayer(packet, (Player) player);
}
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)
{
-4
View File
@@ -1,9 +1,6 @@
package tconstruct.util.player;
import java.lang.ref.WeakReference;
import java.util.List;
import tconstruct.skill.Skill;
import net.minecraft.entity.player.EntityPlayer;
@@ -19,5 +16,4 @@ public class TPlayerStats
public boolean smelteryManual;
public ArmorExtended armor;
public KnapsackInventory knapsack;
public List<Skill> skillList;
}