Fix some bugs,and add diyos BattleSigns

This commit is contained in:
Alexander committed 2014-04-02 20:38:48 -04:00
1 parent 1124d54a7b
commit 42a5af5566
27 files changed
+500 -92

No files matched your search

+1
View File
@@ -109,6 +109,7 @@ public class TConstruct
PHConstruct.initProps(event.getSuggestedConfigurationFile());
TConstructRegistry.materialTab = new TabTools("TConstructMaterials");
TConstructRegistry.toolTab = new TabTools("TConstructTools");
TConstructRegistry.partTab = new TabTools("TConstructParts");
TConstructRegistry.blockTab = new TabTools("TConstructBlocks");
tableCasting = new LiquidCasting();
@@ -9,10 +9,9 @@ import net.minecraft.util.IIcon;
import net.minecraft.world.World;
import net.minecraftforge.fluids.BlockFluidFinite;
import net.minecraftforge.fluids.Fluid;
import tconstruct.common.TContent;
import tconstruct.common.TRepo;
import tconstruct.library.TConstructRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class LiquidMetalFinite extends BlockFluidFinite
{
@@ -41,7 +40,6 @@ public class LiquidMetalFinite extends BlockFluidFinite
}
@Override
@SideOnly(Side.CLIENT)
public IIcon getIcon (int side, int meta)
{
if (side == 0 || side == 1)
@@ -59,7 +57,7 @@ public class LiquidMetalFinite extends BlockFluidFinite
}
if (!(entity instanceof EntityItem) && !entity.isImmuneToFire())
{
entity.attackEntityFrom(DamageSource.lava, 4);
entity.attackEntityFrom(DamageSource.lava, 4.0F);
entity.setFire(15);
}
}
@@ -3,6 +3,7 @@ package tconstruct.blocks;
import java.util.List;
import mantle.blocks.abstracts.InventoryBlock;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
@@ -360,7 +361,8 @@ public class SearedBlock extends InventoryBlock
return world.getBlockMetadata(x, y, z) == 1;
}
public void onNeighborBlockChange (World world, int x, int y, int z, int neighborBlockID)
@Override
public void onNeighborBlockChange (World world, int x, int y, int z, Block neighborBlock)
{
if (world.isBlockIndirectlyGettingPowered(x, y, z) && world.getBlockMetadata(x, y, z) == 1)
{
@@ -295,9 +295,9 @@ public class SmelteryBlock extends InventoryBlock
/* Updating */
@Override
public void onNeighborBlockChange (World world, int x, int y, int z, Block nBlockID)
public void onNeighborBlockChange (World world, int x, int y, int z, Block block)
{
// System.out.println("Neighbor changed");
//System.out.println("Neighbor changed");
TileEntity logic = world.getTileEntity(x, y, z);
if (logic instanceof IServantLogic)
{
+55 -33
View File
@@ -89,11 +89,14 @@ public class StoneTorch extends MantleBlock
* Checks to see if its valid to put this block at the specified
* coordinates. Args: world, x, y, z
*/
@Override
public boolean canPlaceBlockAt (World par1World, int par2, int par3, int par4)
@Override
public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4)
{
return par1World.isSideSolid(par2 - 1, par3, par4, EAST, true) || par1World.isSideSolid(par2 + 1, par3, par4, WEST, true) || par1World.isSideSolid(par2, par3, par4 - 1, SOUTH, true)
|| par1World.isSideSolid(par2, par3, par4 + 1, NORTH, true) || canPlaceTorchOn(par1World, par2, par3 - 1, par4);
return par1World.isSideSolid(par2 - 1, par3, par4, EAST, true) ||
par1World.isSideSolid(par2 + 1, par3, par4, WEST, true) ||
par1World.isSideSolid(par2, par3, par4 - 1, SOUTH, true) ||
par1World.isSideSolid(par2, par3, par4 + 1, NORTH, true) ||
canPlaceTorchOn(par1World, par2, par3 - 1, par4);
}
/**
@@ -101,34 +104,10 @@ public class StoneTorch extends MantleBlock
* side, hitX, hitY, hitZ, block metadata
*/
@Override
public int onBlockPlaced (World par1World, int par2, int par3, int par4, int par5, float par6, float par7, float par8, int par9)
public int onBlockPlaced(World par1World, int par2, int par3, int par4, int par5, float par6, float par7, float par8, int par9)
{
int j1 = par9;
if (par5 == 0)
{
if (this.canPlaceTorchOn(par1World, par2, par3 - 1, par4))
{
j1 = 5;
}
else if (par1World.isSideSolid(par2, par3, par4 + 1, NORTH, true))
{
j1 = 4;
}
else if (par1World.isSideSolid(par2, par3, par4 - 1, SOUTH, true))
{
j1 = 3;
}
else if (par1World.isSideSolid(par2 + 1, par3, par4, WEST, true))
{
j1 = 2;
}
else if (par1World.isSideSolid(par2 - 1, par3, par4, EAST, true))
{
j1 = 1;
}
}
if (par5 == 1 && this.canPlaceTorchOn(par1World, par2, par3 - 1, par4))
{
j1 = 5;
@@ -156,6 +135,46 @@ public class StoneTorch extends MantleBlock
return j1;
}
public void updateTick(World par1World, int par2, int par3, int par4, Random random)
{
super.updateTick(par1World, par2, par3, par4, random);
if (par1World.getBlockMetadata(par2, par3, par4) == 0)
{
this.onBlockAdded(par1World, par2, par3, par4);
}
}
// JAVADOC METHOD $$ func_149726_b
public void onBlockAdded(World p_149726_1_, int p_149726_2_, int p_149726_3_, int p_149726_4_)
{
if (p_149726_1_.getBlockMetadata(p_149726_2_, p_149726_3_, p_149726_4_) == 0)
{
if (p_149726_1_.isSideSolid(p_149726_2_ - 1, p_149726_3_, p_149726_4_, EAST, true))
{
p_149726_1_.setBlockMetadataWithNotify(p_149726_2_, p_149726_3_, p_149726_4_, 1, 2);
}
else if (p_149726_1_.isSideSolid(p_149726_2_ + 1, p_149726_3_, p_149726_4_, WEST, true))
{
p_149726_1_.setBlockMetadataWithNotify(p_149726_2_, p_149726_3_, p_149726_4_, 2, 2);
}
else if (p_149726_1_.isSideSolid(p_149726_2_, p_149726_3_, p_149726_4_ - 1, SOUTH, true))
{
p_149726_1_.setBlockMetadataWithNotify(p_149726_2_, p_149726_3_, p_149726_4_, 3, 2);
}
else if (p_149726_1_.isSideSolid(p_149726_2_, p_149726_3_, p_149726_4_ + 1, NORTH, true))
{
p_149726_1_.setBlockMetadataWithNotify(p_149726_2_, p_149726_3_, p_149726_4_, 4, 2);
}
else if (this.canPlaceTorchOn(p_149726_1_, p_149726_2_, p_149726_3_ - 1, p_149726_4_))
{
p_149726_1_.setBlockMetadataWithNotify(p_149726_2_, p_149726_3_, p_149726_4_, 5, 2);
}
}
this.dropTorchIfCantStay(p_149726_1_, p_149726_2_, p_149726_3_, p_149726_4_);
}
@Override
@SideOnly(Side.CLIENT)
@@ -169,12 +188,13 @@ public class StoneTorch extends MantleBlock
* neighbor changed (coordinates passed are their own) Args: x, y, z,
* neighbor blockID
*/
public void onNeighborBlockChange (World par1World, int par2, int par3, int par4, int par5)
@Override
public void onNeighborBlockChange (World par1World, int par2, int par3, int par4, Block par5)
{
this.func_94397_d(par1World, par2, par3, par4, par5);
}
protected boolean func_94397_d (World par1World, int par2, int par3, int par4, int par5)
protected boolean func_94397_d(World par1World, int par2, int par3, int par4, Block par5)
{
if (this.dropTorchIfCantStay(par1World, par2, par3, par4))
{
@@ -209,6 +229,7 @@ public class StoneTorch extends MantleBlock
if (flag)
{
this.dropBlockAsItem(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), 0);
par1World.setBlockToAir(par2, par3, par4);
return true;
}
else
@@ -234,7 +255,8 @@ public class StoneTorch extends MantleBlock
if (par1World.getBlock(par2, par3, par4) == (Block) this)
{
this.dropBlockAsItem(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), 0);
WorldHelper.setBlockToAir(par1World, par2, par3, par4);
par1World.setBlockToAir(par2, par3, par4);
//WorldHelper.setBlockToAir(par1World, par2, par3, par4);
}
return false;
@@ -6,8 +6,6 @@ import net.minecraft.util.IIcon;
import net.minecraftforge.fluids.BlockFluidClassic;
import net.minecraftforge.fluids.Fluid;
import tconstruct.library.TConstructRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class TConstructFluid extends BlockFluidClassic
{
@@ -20,7 +18,6 @@ public class TConstructFluid extends BlockFluidClassic
{
super(fluid, material);
this.texture = texture;
// TODO setCreativeTab()
this.setCreativeTab(TConstructRegistry.blockTab);
}
@@ -36,7 +33,6 @@ public class TConstructFluid extends BlockFluidClassic
return alpha ? 1 : 0;
}
// TODO registerBlockIcons
@Override
public void registerBlockIcons (IIconRegister iconRegister)
{
@@ -44,13 +40,11 @@ public class TConstructFluid extends BlockFluidClassic
flowIcon = iconRegister.registerIcon("tinker:" + texture + "_flow");
}
// TODO getIcon()
@Override
@SideOnly(Side.CLIENT)
public IIcon getIcon (int side, int meta)
{
if (side == 0 || side == 1)
return stillIcon;
return flowIcon;
}
}
}
@@ -15,6 +15,7 @@ import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.Vec3;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.ForgeHooks;
import tconstruct.blocks.logic.TankAirLogic;
import tconstruct.client.block.TankAirRender;
import cpw.mods.fml.relauncher.Side;
@@ -29,7 +30,7 @@ public class TankAirBlock extends BlockContainer
}
@Override
public TileEntity createNewTileEntity (World world, int i)
public TileEntity createNewTileEntity (World world, int var2)
{
return new TankAirLogic();
}
@@ -1,5 +1,7 @@
package tconstruct.blocks.logic;
import tconstruct.TConstruct;
import tconstruct.library.crafting.AlloyMix;
import mantle.blocks.abstracts.MultiServantLogic;
import mantle.blocks.iface.IFacingLogic;
import mantle.blocks.iface.IMasterLogic;
@@ -20,7 +22,6 @@ public class AdaptiveDrainLogic extends MultiServantLogic implements IFluidHandl
{
byte direction;
@Override
public boolean canUpdate ()
{
return false;
@@ -51,7 +52,7 @@ public class AdaptiveDrainLogic extends MultiServantLogic implements IFluidHandl
if (hasValidMaster() && canDrain(from, null))
{
AdaptiveSmelteryLogic smeltery = (AdaptiveSmelteryLogic) worldObj.getTileEntity(getMasterPosition().x, getMasterPosition().y, getMasterPosition().z);
// TConstruct.logger.info("Found master");
// TConstruct.logger.info("Found master");
return smeltery.drain(from, maxDrain, doDrain);
}
return null;
@@ -150,7 +151,6 @@ public class AdaptiveDrainLogic extends MultiServantLogic implements IFluidHandl
}
}
@Override
public void readFromNBT (NBTTagCompound tags)
{
super.readFromNBT(tags);
@@ -176,7 +176,7 @@ public class AdaptiveDrainLogic extends MultiServantLogic implements IFluidHandl
@Override
public void onDataPacket (NetworkManager net, S35PacketUpdateTileEntity packet)
{
worldObj.markBlockRangeForRenderUpdate(xCoord, yCoord, zCoord, xCoord, yCoord, zCoord);
readFromNBT(packet.func_148857_g());
worldObj.markBlockRangeForRenderUpdate(xCoord, yCoord, zCoord, xCoord, yCoord, zCoord);
}
}
@@ -0,0 +1,70 @@
package tconstruct.blocks.logic;
import tconstruct.inventory.FrypanContainer;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemFood;
import net.minecraft.item.ItemHoe;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemSword;
import net.minecraft.item.ItemTool;
import net.minecraft.item.crafting.FurnaceRecipes;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
import cpw.mods.fml.common.registry.GameRegistry;
/* Slots
* 0: Battlesign item
*/
public class BattlesignLogic extends EquipLogic
{
public BattlesignLogic()
{
super(1);
}
@Override
public String getDefaultName ()
{
return "decoration.battlesign";
}
/* NBT */
public void readFromNBT (NBTTagCompound tags)
{
super.readFromNBT(tags);
}
public void writeToNBT (NBTTagCompound tags)
{
super.writeToNBT(tags);
}
@Override
public Container getGuiContainer (InventoryPlayer inventoryplayer, World world, int x, int y, int z)
{
return null; //Not a normal gui block
}
@Override
public String getInventoryName()
{
return null;
}
@Override
public void openInventory()
{
}
@Override
public void closeInventory()
{
}
}
@@ -1,5 +1,6 @@
package tconstruct.blocks.logic;
import tconstruct.TConstruct;
import mantle.blocks.iface.IActiveLogic;
import mantle.blocks.iface.IFacingLogic;
import net.minecraft.entity.EntityLivingBase;
@@ -14,7 +15,6 @@ import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.FluidTankInfo;
import net.minecraftforge.fluids.IFluidHandler;
import tconstruct.TConstruct;
public class FaucetLogic extends TileEntity implements IFacingLogic, IActiveLogic, IFluidHandler
{
@@ -103,7 +103,7 @@ public class FaucetLogic extends TileEntity implements IFacingLogic, IActiveLogi
@Override
public void setDirection (int side)
{
// direction = (byte) side;
//direction = (byte) side;
}
@Override
@@ -644,7 +644,9 @@ public class TProxyClient extends TProxyCommon
TConstructClientRegistry.registerManualModifier("fluxmod2", ironpick.copy(), new ItemStack(Blocks.dirt));
TConstructClientRegistry.registerManualModifier("tier1free", ironpick.copy(), new ItemStack(Items.diamond), new ItemStack(Blocks.gold_block));
TConstructClientRegistry.registerManualModifier("tier1.5free", ironpick.copy(), new ItemStack(Items.golden_apple, 1, 1), new ItemStack(Blocks.diamond_block));
TConstructClientRegistry.registerManualModifier("tier2free", ironpick.copy(), new ItemStack(Items.nether_star));
TConstructClientRegistry.registerManualModifier("creativefree", ironpick.copy(), new ItemStack(TRepo.creativeModifier));
TConstructClientRegistry.registerManualSmeltery("brownstone", new ItemStack(TRepo.speedBlock), new ItemStack(TRepo.moltenTin, 1), new ItemStack(Blocks.gravel));
TConstructClientRegistry.registerManualSmeltery("clearglass", new ItemStack(TRepo.clearGlass), new ItemStack(TRepo.moltenGlass, 1), null);
@@ -733,7 +735,7 @@ public class TProxyClient extends TProxyCommon
"The Dagger is a short blade that can be thrown.\n\nSpecial Ability:\n- Throw Item\n\nDamage: Low\nDurability: Moderate\n\nRequired parts:\n- Knife Blade\n- Crossbar\n- Handle",
"The Frying is a heavy weapon that uses sheer weight to stun foes.\n\nSpecial Ability: Block\nNatural Ability: Heavy\nShift+rClick: Place Frying Pan\nDamage: Low\nDurability: High\n\nRequired parts:\n- Pan\n- Handle",
// "The Battlesign is an advance in weapon technology worthy of Zombie Pigmen everywhere.\n\nSpecial Ability: Block\nShift-rClick: Place sign\nDamage: Low\nDurability: Average\n\nRequired parts:\n- Board\n- Handle"
"The Battlesign is an advance in weapon technology worthy of Zombie Pigmen everywhere.\n\nSpecial Ability: Block\nDamage: Low\nDurability: Average\n\nRequired parts:\n- Sign Board\n- Handle",
"The Battlesign is an advance in weapon technology worthy of Zombie Pigmen everywhere.\n\nSpecial Ability:\nDamage Reflector\n\nNatural Ability: Writable\n\nDamage: Low\nDurability: Average",
"The Chisel is a utility tool that carves shapes into blocks.\n\nCrafting Grid:\n- Shape Items\nSpecial Ability: Chisel\nDurability: Average\n\nRequired parts:\n- Chisel Head\n- Handle" };
void addToolButtons ()
+10 -1
View File
@@ -84,6 +84,7 @@ import tconstruct.entity.projectile.ArrowEntity;
import tconstruct.entity.projectile.DaggerEntity;
import tconstruct.entity.projectile.LaunchedPotion;
import tconstruct.items.Bowstring;
import tconstruct.items.CreativeModifier;
import tconstruct.items.DiamondApple;
import tconstruct.items.FilledBucket;
import tconstruct.items.Fletching;
@@ -184,6 +185,10 @@ public class TContent implements IFuelHandler
TRepo.furnaceSlab = new FurnaceSlab(Material.rock).setBlockName("FurnaceSlab");
TRepo.heldItemBlock = new EquipBlock(Material.wood).setBlockName("Frypan");
/* battlesignBlock = new BattlesignBlock(PHConstruct.battlesignBlock).setUnlocalizedName("Battlesign");
GameRegistry.registerBlock(battlesignBlock, "BattlesignBlock");
ameRegistry.registerTileEntity(BattlesignLogic.class, "BattlesignLogic");*/
TRepo.craftedSoil = new SoilBlock().setLightOpacity(0).setBlockName("TConstruct.Soil");
TRepo.craftedSoil.stepSound = Block.soundTypeGravel;
@@ -681,6 +686,9 @@ public class TContent implements IFuelHandler
// GameRegistry.registerItem(TRepo.glove, "glove");
GameRegistry.registerItem(TRepo.knapsack, "knapsack");
GameRegistry.registerItem(TRepo.goldHead, "goldHead");
TRepo.creativeModifier = new CreativeModifier().setUnlocalizedName("tconstruct.modifier.creative");
GameRegistry.registerItem(TRepo.creativeModifier, "creativeModifier");
LiquidCasting basinCasting = TConstruct.getBasinCasting();
TRepo.materialWood = EnumHelper.addArmorMaterial("WOOD", 2, new int[] { 1, 2, 2, 1 }, 3);
@@ -725,7 +733,6 @@ public class TContent implements IFuelHandler
// Vanilla stack sizes
Items.wooden_door.setMaxStackSize(16);
Items.iron_door.setMaxStackSize(16);
Items.snowball.setMaxStackSize(64);
Items.boat.setMaxStackSize(16);
Items.minecart.setMaxStackSize(3);
// Items.minecartEmpty.setMaxStackSize(3);
@@ -877,6 +884,8 @@ public class TContent implements IFuelHandler
void setupToolTabs ()
{
TConstructRegistry.materialTab.init(new ItemStack(TRepo.titleIcon, 1, 255));
TConstructRegistry.materialTab.init(new ItemStack(TRepo.manualBook, 1, 0));
TConstructRegistry.partTab.init(new ItemStack(TRepo.titleIcon, 1, 255));
TConstructRegistry.blockTab.init(new ItemStack(TRepo.toolStationWood));
ItemStack tool = new ItemStack(TRepo.longsword, 1, 0);
@@ -99,6 +99,7 @@ import tconstruct.modifiers.tools.ModAttack;
import tconstruct.modifiers.tools.ModAutoSmelt;
import tconstruct.modifiers.tools.ModBlaze;
import tconstruct.modifiers.tools.ModButtertouch;
import tconstruct.modifiers.tools.ModCreativeToolModifier;
import tconstruct.modifiers.tools.ModDurability;
import tconstruct.modifiers.tools.ModExtraModifier;
import tconstruct.modifiers.tools.ModFlux;
@@ -374,6 +375,7 @@ public class TRecipes
tb.registerToolMod(new ModExtraModifier(new ItemStack[] { diamond, new ItemStack(Blocks.gold_block) }, "Tier1Free"));
tb.registerToolMod(new ModExtraModifier(new ItemStack[] { new ItemStack(Blocks.diamond_block), new ItemStack(Items.golden_apple, 1, 1) }, "Tier1.5Free"));
tb.registerToolMod(new ModExtraModifier(new ItemStack[] { new ItemStack(Items.nether_star) }, "Tier2Free"));
tb.registerToolMod(new ModCreativeToolModifier(new ItemStack[] { new ItemStack(TRepo.creativeModifier) }));
ItemStack silkyJewel = new ItemStack(TRepo.materials, 1, 26);
tb.registerToolMod(new ModButtertouch(new ItemStack[] { silkyJewel }, 12));
@@ -675,7 +677,7 @@ public class TRecipes
GameRegistry.addRecipe(new ItemStack(TRepo.metalBlock, 1, 2), patBlock, '#', new ItemStack(TRepo.materials, 1, 5)); // Manyullyn
GameRegistry.addRecipe(new ItemStack(TRepo.metalBlock, 1, 8), patBlock, '#', new ItemStack(TRepo.materials, 1, 15)); // Alumite
GameRegistry.addRecipe(new ItemStack(TRepo.metalBlock, 1, 9), patBlock, '#', new ItemStack(TRepo.materials, 1, 16)); // Steel
GameRegistry.addRecipe(new ItemStack(TRepo.materials, 1, 11), patBlock, '#', new ItemStack(TRepo.materials, 1, 12)); // Aluminum raw ->
GameRegistry.addRecipe(new ItemStack(TRepo.materials, 1, 11), "#", '#', new ItemStack(TRepo.materials, 1, 12)); // Aluminum raw ->
// ingot
GameRegistry.addRecipe(new ItemStack(TRepo.materials, 9, 9), "m", 'm', new ItemStack(TRepo.metalBlock, 1, 3)); // Copper
@@ -794,8 +796,7 @@ public class TRecipes
GameRegistry.addRecipe(new ItemStack(TRepo.diamondApple), " d ", "d#d", " d ", 'd', new ItemStack(Items.diamond), '#', new ItemStack(Items.apple));
GameRegistry.addShapelessRecipe(new ItemStack(TRepo.heartCanister, 1, 2), new ItemStack(TRepo.diamondApple), new ItemStack(TRepo.materials, 1, 8), new ItemStack(TRepo.heartCanister, 1, 0),
new ItemStack(TRepo.heartCanister, 1, 1));
GameRegistry.addShapelessRecipe(new ItemStack(TRepo.heartCanister, 1, 4), new ItemStack(TRepo.heartCanister, 1, 2), new ItemStack(TRepo.heartCanister, 1, 3), new ItemStack(Items.golden_apple,
1, 1));
GameRegistry.addShapelessRecipe(new ItemStack(TRepo.heartCanister, 1, 4), new ItemStack(TRepo.heartCanister, 1, 2), new ItemStack(TRepo.heartCanister, 1, 3), new ItemStack(Items.golden_apple, 1, 1));
//GameRegistry.addShapelessRecipe(new ItemStack(heartCanister, 1, 6), new ItemStack(heartCanister, 1, 0), new ItemStack(heartCanister, 1, 4), new ItemStack(heartCanister, 1, 5));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(TRepo.knapsack, 1, 0), "###", "rmr", "###", '#', new ItemStack(Items.leather), 'r', new ItemStack(TRepo.toughRod, 1, 2), 'm',
@@ -106,6 +106,7 @@ public class TRepo
public static Block furnaceSlab;
public static Block heldItemBlock;
public static Block battlesignBlock;
public static Block craftedSoil;
public static Block smeltery;
@@ -238,6 +239,8 @@ public class TRepo
public static ModFlux modFlux;
public static ModLapis modLapis;
public static ModAttack modAttack;
public static Item creativeModifier;
// Wearables
public static Item heavyHelmet;
@@ -1,7 +1,9 @@
package tconstruct.entity;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.item.ItemStack;
import net.minecraft.util.DamageSource;
import net.minecraft.world.World;
public class FancyEntityItem extends EntityItem
@@ -9,6 +11,8 @@ public class FancyEntityItem extends EntityItem
public FancyEntityItem(World par1World, double par2, double par4, double par6)
{
super(par1World, par2, par4, par6);
this.isImmuneToFire = true;
this.lifespan = 72000;
}
public FancyEntityItem(World par1World, double par2, double par4, double par6, ItemStack par8ItemStack)
@@ -21,5 +25,24 @@ public class FancyEntityItem extends EntityItem
public FancyEntityItem(World par1World)
{
super(par1World);
this.isImmuneToFire = true;
this.lifespan = 72000;
}
public FancyEntityItem(World world, Entity original, ItemStack stack)
{
this(world, original.posX, original.posY, original.posZ);
this.delayBeforeCanPickup = 20;
this.motionX = original.motionX;
this.motionY = original.motionY;
this.motionZ = original.motionZ;
this.setEntityItemStack(stack);
}
public boolean attackEntityFrom (DamageSource par1DamageSource, float par2)
{
if (par1DamageSource.getDamageType().equals("outOfWorld"))
return true;
return false;
}
}
@@ -1,26 +0,0 @@
package tconstruct.entity;
import net.minecraft.entity.monster.EntityCreeper;
import net.minecraft.world.World;
public class Skyla extends EntityCreeper
{
public Skyla(World par1World)
{
super(par1World);
// username = "Skyla";
// texture = "/mods/tinker/textures/mob/skyla.png";
}
/*
* @Override public void sendChatToPlayer (String var1) {}
*
* @Override public boolean canCommandSenderUseCommand (int var1, String
* var2) { return false; }
*
* @Override public ChunkCoordinates getPlayerCoordinates () { return null;
* }
*/
}
@@ -0,0 +1,67 @@
package tconstruct.items;
import java.util.List;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.StatCollector;
import tconstruct.library.TConstructRegistry;
import tconstruct.library.crafting.ToolBuilder;
import tconstruct.library.crafting.ToolRecipe;
import tconstruct.library.tools.ToolCore;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class CreativeModifier extends Item
{
public CreativeModifier()
{
super();
this.setCreativeTab(TConstructRegistry.materialTab);
}
@SideOnly(Side.CLIENT)
/**
* returns a list of items with the same ID, but different meta (eg: dye returns 16 items)
*/
@Override
public void getSubItems (Item par1, CreativeTabs par2CreativeTabs, List par3List)
{
par3List.add(new ItemStack(par1, 1, 0));
for (ToolRecipe recipe : ToolBuilder.instance.combos)
{
ToolCore tool = recipe.getType();
ItemStack item = new ItemStack(par1, 1, 0);
NBTTagCompound compound = new NBTTagCompound();
compound.setString("TargetLock", tool.getToolName());
item.setTagCompound(compound);
par3List.add(item);
}
}
@SideOnly(Side.CLIENT)
@Override
public void registerIcons (IIconRegister iconRegister)
{
this.itemIcon = iconRegister.registerIcon("tinker:skull_char_gold");
}
@Override
@SideOnly(Side.CLIENT)
public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean par4)
{
if (stack.hasTagCompound())
{
String targetLock = "None";
targetLock = stack.getTagCompound().getString("TargetLock");
list.add(StatCollector.translateToLocal("creativeModLock.tooltip") + targetLock);
}
}
}
@@ -18,6 +18,7 @@ public class ToolPart extends CraftingItem implements IToolPart
public ToolPart(String textureType, String name)
{
super(toolMaterialNames, buildTextureNames(textureType), "parts/", "tinker", TConstructRegistry.materialTab);
this.setCreativeTab(TConstructRegistry.partTab);
this.setHasSubtypes(true);
this.setMaxDamage(0);
this.partName = name;
@@ -38,6 +38,7 @@ public class TConstructRegistry
/* Creative tabs */
public static TabTools toolTab;
public static TabTools partTab;
public static TabTools materialTab;
public static TabTools blockTab;
@@ -22,6 +22,7 @@ import net.minecraft.util.IIcon;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
import tconstruct.entity.FancyEntityItem;
import tconstruct.library.ActiveToolMod;
import tconstruct.library.TConstructRegistry;
import tconstruct.library.crafting.ToolBuilder;
@@ -57,8 +58,8 @@ public abstract class ToolCore extends Item implements IEnergyContainerItem
{
// TE power constants -- TODO grab these from the items added
protected int capacity = 400000;
protected int maxReceive = 80;
protected int maxExtract = 80;
protected int maxReceive = 2000;
protected int maxExtract = 2000;
protected Random random = new Random();
protected int damageVsEntity;
@@ -777,6 +778,17 @@ public abstract class ToolCore extends Item implements IEnergyContainerItem
}
return tags.getCompoundTag("InfiTool").getInteger("Damage");
}
/* Prevent tools from dying */
public boolean hasCustomEntity (ItemStack stack)
{
return true;
}
public Entity createEntity (World world, Entity location, ItemStack itemstack)
{
return new FancyEntityItem(world, location, itemstack);
}
// TE support section -- from COFH core API reference section
public void setMaxTransfer (int maxTransfer)
@@ -0,0 +1,43 @@
package tconstruct.modifiers.tools;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import tconstruct.library.tools.ToolCore;
import tconstruct.library.tools.ToolMod;
public class ModCreativeToolModifier extends ToolMod
{
public ModCreativeToolModifier(ItemStack[] items)
{
super(items, 0, "");
}
@Override
protected boolean canModify (ItemStack tool, ItemStack[] input)
{
ToolCore toolItem = (ToolCore) tool.getItem();
for (ItemStack stack : input)
{
if (stack != null && stack.hasTagCompound())
{
String targetLock = stack.getTagCompound().getString("TargetLock");
if (!targetLock.equals("") && !targetLock.equals(toolItem.getToolName()))
return false;
}
}
return true;
}
@Override
public void modify (ItemStack[] input, ItemStack tool)
{
NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool");
int modifiers = tags.getInteger("Modifiers");
modifiers += 1;
tags.setInteger("Modifiers", modifiers);
}
public void addMatchingEffect (ItemStack tool)
{
}
}
@@ -23,17 +23,23 @@ import net.minecraft.entity.monster.IMob;
import net.minecraft.entity.passive.EntityChicken;
import net.minecraft.entity.passive.EntityCow;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.projectile.EntityArrow;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemFood;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.FurnaceRecipes;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.DamageSource;
import net.minecraft.util.EntityDamageSourceIndirect;
import net.minecraft.util.MovingObjectPosition.MovingObjectType;
import net.minecraft.util.Vec3;
import net.minecraft.world.GameRules;
import net.minecraft.world.World;
import net.minecraftforge.event.entity.living.LivingAttackEvent;
import net.minecraftforge.event.entity.living.LivingDeathEvent;
import net.minecraftforge.event.entity.living.LivingDropsEvent;
import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent;
@@ -162,6 +168,13 @@ public class TEventHandler
event.overrideResult(arrow);
}
}
if (event.tool == TRepo.battlesign)
{
int modifiers = toolTag.getInteger("Modifiers");
modifiers += 1;
toolTag.setInteger("Modifiers", modifiers);
}
}
private boolean allowCrafting (int head, int handle, int accessory)
@@ -240,14 +253,95 @@ public class TEventHandler
@SubscribeEvent
public void onHurt (LivingHurtEvent event)
{
if (event.entityLiving instanceof EntityPlayer)
EntityLivingBase reciever = event.entityLiving;
if (reciever instanceof EntityPlayer)
{
EntityPlayer player = (EntityPlayer) event.entityLiving;
// Cutlass
ItemStack stack = player.getCurrentEquippedItem();
if (stack != null && stack.getItem() == TRepo.cutlass && player.isUsingItem())
if (stack != null && player.isUsingItem())
{
player.addPotionEffect(new PotionEffect(Potion.moveSpeed.id, 3 * 20, 1));
Item item = stack.getItem();
if (item == TRepo.cutlass)
{
player.addPotionEffect(new PotionEffect(Potion.moveSpeed.id, 3 * 20, 1));
}
else if (item == TRepo.battlesign)
{
event.ammount *= 1.5; //Puts battlesign blocking at 3/4 instead of 1/2
}
}
}
else if (reciever instanceof EntityCreeper)
{
Entity attacker = event.source.getEntity();
if (attacker instanceof EntityLivingBase)
{
Entity target = ((EntityCreeper) reciever).getAttackTarget();
if (target != null)
{
float d1 = reciever.getDistanceToEntity(((EntityCreeper) reciever).getAttackTarget());
float d2 = reciever.getDistanceToEntity(attacker);
if (d2 < d1)
{
((EntityCreeper) event.entityLiving).setAttackTarget((EntityLivingBase) event.source.getEntity());
}
}
}
}
}
@SubscribeEvent
public void onAttack (LivingAttackEvent event)
{
//System.out.println("Damage: "+event.ammount);
if (event.entityLiving instanceof EntityPlayer)
{
EntityPlayer player = (EntityPlayer) event.entityLiving;
//Cutlass
ItemStack stack = player.getCurrentEquippedItem();
if (stack != null && stack.getItem() == TRepo.battlesign && player.isUsingItem())
{
DamageSource source = event.source;
if (!source.isUnblockable() && !source.isMagicDamage() && !source.isExplosion())
{
if (source instanceof EntityDamageSourceIndirect)
{
if (random.nextInt(3) == 0)
{
Entity attacker = source.getEntity();
Entity projectile = ((EntityDamageSourceIndirect) source).getSourceOfDamage();
projectile.motionX *= -1;
projectile.motionZ *= -1;
projectile.setDead();
event.setCanceled(true);
if (projectile.getClass() == EntityArrow.class && !player.worldObj.isRemote)
{
EntityArrow reflection = null;
if (attacker instanceof EntityLivingBase)
reflection = new EntityArrow(player.worldObj, (EntityLivingBase) attacker, 0);
else
reflection = new EntityArrow(player.worldObj, player, 0);
Vec3 look = player.getLookVec();
reflection.posX = projectile.posX;
reflection.posY = projectile.posY;
reflection.posZ = projectile.posZ;
reflection.motionX = (projectile.motionX + (look.xCoord * 8)) / 6;
reflection.motionY = (projectile.motionY + (look.yCoord * 8)) / 6;
reflection.motionZ = (projectile.motionZ + (look.zCoord * 8)) / 6;
reflection.damage = ((EntityArrow) projectile).damage;
player.worldObj.spawnEntityInWorld(reflection);
}
}
}
else
{
Entity attacker = source.getEntity();
attacker.attackEntityFrom(DamageSource.causeThornsDamage(player), event.ammount);
}
}
}
}
}
@@ -40,6 +40,7 @@ public class PHConstruct
vanillaMetalBlocks = config.get("Difficulty Changes", "Craft vanilla metal blocks", true).getBoolean(true);
lavaFortuneInteraction = config.get("Difficulty Changes", "Enable Auto-Smelt and Fortune interaction", true).getBoolean(true);
removeVanillaToolRecipes = config.get("Difficulty Changes", "Remove Vanilla Tool Recipes", false).getBoolean(false);
labotimizeVanillaTools = config.get("Difficulty Changes", "Remove Vanilla Tool Effectiveness", false).getBoolean(false);
stencilTableCrafting = config.get("Difficulty Changes", "Craft Stencil Tables", true).getBoolean(true);
miningLevelIncrease = config.get("Difficulty Changes", "Modifiers increase Mining Level", true).getBoolean(true);
denyMattock = config.get("Difficulty Changes", "Deny creation of non-metal mattocks", false).getBoolean(false);
@@ -273,6 +274,7 @@ public class PHConstruct
public static boolean craftMetalTools;
public static boolean vanillaMetalBlocks;
public static boolean removeVanillaToolRecipes;
public static boolean labotimizeVanillaTools;
public static boolean stencilTableCrafting;
public static boolean miningLevelIncrease;
public static boolean denyMattock;
@@ -18,6 +18,7 @@ import net.minecraftforge.event.entity.EntityEvent;
import net.minecraftforge.event.entity.living.LivingDeathEvent;
import net.minecraftforge.event.entity.living.LivingFallEvent;
import net.minecraftforge.event.entity.player.PlayerDropsEvent;
import tconstruct.common.TContent;
import tconstruct.common.TRepo;
import tconstruct.library.tools.AbilityHelper;
import tconstruct.util.config.PHConstruct;
@@ -70,6 +71,8 @@ public class TPlayerHandler
stats.level = entityplayer.experienceLevel;
stats.hunger = entityplayer.getFoodStats().getFoodLevel();
//stats.battlesignBonus = tags.getCompoundTag("TConstruct").getBoolean("battlesignBonus");
// gamerule naturalRegeneration false
if (!PHConstruct.enableHealthRegen)
@@ -77,6 +80,7 @@ public class TPlayerHandler
if (!stats.beginnerManual)
{
stats.beginnerManual = true;
stats.battlesignBonus = true;
if (PHConstruct.beginnerBook)
{
ItemStack diary = new ItemStack(TRepo.manualBook);
@@ -116,6 +120,34 @@ public class TPlayerHandler
AbilityHelper.spawnItemAtPlayer(entityplayer, pattern);
}
if (entityplayer.getDisplayName().toLowerCase().equals("zisteau"))
{
spawnPigmanModifier(entityplayer);
}
}
else
{
if (!stats.battlesignBonus)
{
stats.battlesignBonus = true;
ItemStack modifier = new ItemStack(TRepo.creativeModifier);
NBTTagCompound compound = new NBTTagCompound();
compound.setTag("display", new NBTTagCompound());
NBTTagList list = new NBTTagList();
list.appendTag(new NBTTagString("Battlesigns were buffed recently."));
list.appendTag(new NBTTagString("This might make up for it."));
compound.getCompoundTag("display").setTag("Lore", list);
compound.setString("TargetLock", TRepo.battlesign.getToolName());
modifier.setTagCompound(compound);
AbilityHelper.spawnItemAtPlayer(entityplayer, modifier);
if (entityplayer.getDisplayName().toLowerCase().equals("zisteau"))
{
spawnPigmanModifier(entityplayer);
}
}
}
if (PHConstruct.gregtech && Loader.isModLoaded("GregTech-Addon"))
@@ -129,6 +161,23 @@ public class TPlayerHandler
}
}
}
void spawnPigmanModifier(EntityPlayer entityplayer)
{
ItemStack modifier = new ItemStack(TRepo.creativeModifier);
NBTTagCompound compound = new NBTTagCompound();
compound.setTag("display", new NBTTagCompound());
compound.getCompoundTag("display").setString("Name", "Zistonian Bonus Modifier");
NBTTagList list = new NBTTagList();
list.appendTag(new NBTTagString("Zombie Pigmen seem to have a natural affinty"));
list.appendTag(new NBTTagString("for these types of weapons."));
compound.getCompoundTag("display").setTag("Lore", list);
compound.setString("TargetLock", TRepo.battlesign.getToolName());
modifier.setTagCompound(compound);
AbilityHelper.spawnItemAtPlayer(entityplayer, modifier);
}
public void onPlayerRespawn (EntityPlayer entityplayer)
{
@@ -20,6 +20,7 @@ public class TPlayerStats implements IExtendedEntityProperties
public boolean beginnerManual;
public boolean materialManual;
public boolean smelteryManual;
public boolean battlesignBonus;
public ArmorExtended armor;
public KnapsackInventory knapsack;
@@ -47,6 +48,7 @@ public class TPlayerStats implements IExtendedEntityProperties
tTag.setBoolean("beginnerManual", this.beginnerManual);
tTag.setBoolean("materialManual", this.materialManual);
tTag.setBoolean("smelteryManual", this.smelteryManual);
tTag.setBoolean("battlesignBonus", this.battlesignBonus);
compound.setTag(PROP_NAME, tTag);
}
@@ -60,6 +62,7 @@ public class TPlayerStats implements IExtendedEntityProperties
this.beginnerManual = properties.getBoolean("beginnerManual");
this.materialManual = properties.getBoolean("materialManual");
this.smelteryManual = properties.getBoolean("smelteryManual");
this.battlesignBonus = properties.getBoolean("battlesignBonus");
}
@Override