Summoning Altar, chest place fix and hopper mold

This commit is contained in:
JAWolfe04 2016-07-03 03:33:44 -05:00
parent 39a687e537
commit cea198eec0
21 changed files with 992 additions and 2 deletions

View File

@ -1,6 +1,6 @@
minecraft_version=1.7.10
forge_version=10.13.4.1566-1.7.10
tfc_version=0.79.27
mod_version=1.16
mod_version=1.17
mod_id=TerraFirmaPunkTweaks
group_name=com.JAWolfe.TerraFirmaPunkTweaks

Binary file not shown.

View File

@ -1,5 +1,15 @@
Changelog
=================================================
-------------------------------------------------
TFP Tweaks 1.17
-------------------------------------------------
New Features
+Added Necromancy Summoning Altar Compatibility
+Add Hopper Metal Press
Tweaks
+Vanilla chests can no longer be placed
-------------------------------------------------
TFP Tweaks 1.16
-------------------------------------------------

View File

@ -0,0 +1,177 @@
package com.JAWolfe.terrafirmapunktweaks.blocks;
import java.util.Random;
import com.JAWolfe.terrafirmapunktweaks.TerraFirmaPunkTweaks;
import com.JAWolfe.terrafirmapunktweaks.items.TFPItems;
import com.JAWolfe.terrafirmapunktweaks.reference.GUIs;
import com.JAWolfe.terrafirmapunktweaks.tiles.TEAltar;
import com.sirolf2009.necromancy.block.BlockAltar;
import cpw.mods.fml.common.Loader;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import steamcraft.common.init.InitBlocks;
public class BlockTFPAltar extends BlockAltar
{
public BlockTFPAltar()
{
super();
setCreativeTab(null);
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.5F, 1.0F);
}
@Override
public TileEntity createNewTileEntity(World var1, int i)
{
return new TEAltar();
}
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int idk, float what, float these, float are)
{
TEAltar tileEntity = (TEAltar) world.getTileEntity(x, y, z);
if (tileEntity == null)
return false;
else if (player.isSneaking() && (tileEntity.canSpawn() || player.capabilities.isCreativeMode))
{
tileEntity.spawn(player);
return true;
}
else
{
player.openGui(TerraFirmaPunkTweaks.instance, GUIs.TFPALTAR.ordinal(), world, x, y, z);
return true;
}
}
@Override
public void breakBlock(World world, int x, int y, int z, Block block, int meta)
{
TEAltar te = (TEAltar) world.getTileEntity(x, y, z);
Random rand = new Random();
ItemStack[] blockTypes = null;
if (te != null)
{
blockTypes = te.getBlockTypes();
for (int i = 0; i < te.getSizeInventory(); ++i)
{
ItemStack var9 = te.getStackInSlot(i);
if (var9 != null)
{
float var10 = rand.nextFloat() * 0.8F + 0.1F;
float var11 = rand.nextFloat() * 0.8F + 0.1F;
float var12 = rand.nextFloat() * 0.8F + 0.1F;
while (var9.stackSize > 0)
{
int var13 = rand.nextInt(21) + 10;
if (var13 > var9.stackSize)
{
var13 = var9.stackSize;
}
var9.stackSize -= var13;
EntityItem var14 =
new EntityItem(world, x + var10, y + var11, z + var12, new ItemStack(var9.getItem(), var13, var9.getItemDamage()));
var14.motionX = (float) rand.nextGaussian() * 0.05F;
var14.motionY = (float) rand.nextGaussian() * 0.05F + 0.2F;
var14.motionZ = (float) rand.nextGaussian() * 0.05F;
world.spawnEntityInWorld(var14);
}
}
}
EntityItem book = new EntityItem(world, x + 0.5f, y + 0.5f, z + 0.5f, new ItemStack(TFPItems.TFPNecronomicon));
book.motionX = (float) rand.nextGaussian() * 0.05F;
book.motionY = (float) rand.nextGaussian() * 0.05F + 0.2F;
book.motionZ = (float) rand.nextGaussian() * 0.05F;
world.spawnEntityInWorld(book);
}
world.removeTileEntity(x, y, z);
if(blockTypes != null && blockTypes[0] != null && blockTypes[1] != null && blockTypes[2] != null)
{
world.setBlock(x, y, z, Block.getBlockFromItem(blockTypes[0].getItem()), blockTypes[0].getItemDamage(), 3);
switch (meta)
{
case 2:
{
world.setBlock(x, y, z - 1, Block.getBlockFromItem(blockTypes[1].getItem()), blockTypes[1].getItemDamage(), 3);
world.setBlock(x, y, z - 2, Block.getBlockFromItem(blockTypes[2].getItem()), blockTypes[2].getItemDamage(), 3);
if(Loader.isModLoaded("Steamcraft"))
{
world.setBlock(x + 2, y, z - 4, InitBlocks.blockLightningRod, 0, 3);
world.setBlock(x + 2, y, z + 2, InitBlocks.blockLightningRod, 0, 3);
world.setBlock(x - 2, y, z - 4, InitBlocks.blockLightningRod, 0, 3);
world.setBlock(x - 2, y, z + 2, InitBlocks.blockLightningRod, 0, 3);
}
break;
}
case 0:
{
world.setBlock(x, y, z + 1, Block.getBlockFromItem(blockTypes[1].getItem()), blockTypes[1].getItemDamage(), 3);
world.setBlock(x, y, z + 2, Block.getBlockFromItem(blockTypes[2].getItem()), blockTypes[2].getItemDamage(), 3);
if(Loader.isModLoaded("Steamcraft"))
{
world.setBlock(x + 2, y, z + 4, InitBlocks.blockLightningRod, 0, 3);
world.setBlock(x + 2, y, z - 2, InitBlocks.blockLightningRod, 0, 3);
world.setBlock(x - 2, y, z + 4, InitBlocks.blockLightningRod, 0, 3);
world.setBlock(x - 2, y, z - 2, InitBlocks.blockLightningRod, 0, 3);
}
break;
}
case 1:
{
world.setBlock(x - 1, y, z, Block.getBlockFromItem(blockTypes[1].getItem()), blockTypes[1].getItemDamage(), 3);
world.setBlock(x - 2, y, z, Block.getBlockFromItem(blockTypes[2].getItem()), blockTypes[2].getItemDamage(), 3);
if(Loader.isModLoaded("Steamcraft"))
{
world.setBlock(x - 4, y, z + 2, InitBlocks.blockLightningRod, 0, 3);
world.setBlock(x + 2, y, z + 2, InitBlocks.blockLightningRod, 0, 3);
world.setBlock(x - 4, y, z - 2, InitBlocks.blockLightningRod, 0, 3);
world.setBlock(x + 2, y, z - 2, InitBlocks.blockLightningRod, 0, 3);
}
break;
}
case 3:
{
world.setBlock(x + 1, y, z, Block.getBlockFromItem(blockTypes[1].getItem()), blockTypes[1].getItemDamage(), 3);
world.setBlock(x + 2, y, z, Block.getBlockFromItem(blockTypes[2].getItem()), blockTypes[2].getItemDamage(), 3);
if(Loader.isModLoaded("Steamcraft"))
{
world.setBlock(x + 4, y, z + 2, InitBlocks.blockLightningRod, 0, 3);
world.setBlock(x - 2, y, z + 2, InitBlocks.blockLightningRod, 0, 3);
world.setBlock(x + 4, y, z - 2, InitBlocks.blockLightningRod, 0, 3);
world.setBlock(x - 2, y, z - 2, InitBlocks.blockLightningRod, 0, 3);
}
break;
}
}
}
}
@Override
public void onBlockDestroyedByPlayer(World par1World, int x, int y, int z, int par5)
{
}
@Override
public void registerBlockIcons(IIconRegister register)
{
this.blockIcon = Blocks.planks.getIcon(0, 0);
}
}

View File

@ -0,0 +1,140 @@
package com.JAWolfe.terrafirmapunktweaks.blocks;
import com.JAWolfe.terrafirmapunktweaks.TerraFirmaPunkTweaks;
import com.JAWolfe.terrafirmapunktweaks.reference.GUIs;
import com.sirolf2009.necromancy.block.BlockAltarBlock;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
public class BlockTFPAltarBlock extends BlockAltarBlock
{
public BlockTFPAltarBlock()
{
super();
}
private TileEntity getTileEntity(World par1World, int x, int y, int z)
{
switch (par1World.getBlockMetadata(x, y, z))
{
case 2:
if (par1World.getBlock(x, y, z + 1) == this)
return par1World.getTileEntity(x, y, z + 2);
else
return par1World.getTileEntity(x, y, z + 1);
case 0:
if (par1World.getBlock(x, y, z - 1) == this)
return par1World.getTileEntity(x, y, z - 2);
else
return par1World.getTileEntity(x, y, z - 1);
case 1:
if (par1World.getBlock(x + 1, y, z) == this)
return par1World.getTileEntity(x + 2, y, z);
else
return par1World.getTileEntity(x + 1, y, z);
case 3:
if (par1World.getBlock(x - 1, y, z) == this)
return par1World.getTileEntity(x - 2, y, z);
else
return par1World.getTileEntity(x - 1, y, z);
}
return null;
}
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int idk, float what, float these, float are)
{
TileEntity tileEntity = getTileEntity(world, x, y, z);
if (tileEntity == null || player.isSneaking())
return false;
else
{
player.openGui(TerraFirmaPunkTweaks.instance, GUIs.TFPALTAR.ordinal(), world, tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord);
return true;
}
}
@Override
public void breakBlock(World world, int x, int y, int z, Block block, int meta)
{
Block altar = null;
int metaAltar = 0, x1 = 0, y1 = 0, z1 = 0;
switch (meta)
{
case 2:
{
if (world.getBlock(x, y, z + 1) == this)
{
x1 = x; y1 = y; z1 = z + 2;
}
else
{
x1 = x; y1 = y; z1 = z + 1;
}
break;
}
case 0:
{
if (world.getBlock(x, y, z - 1) == this)
{
x1 = x; y1 = y; z1 = z - 2;
}
else
{
x1 = x; y1 = y; z1 = z - 1;
}
break;
}
case 1:
{
if (world.getBlock(x + 1, y, z) == this)
{
x1 = x + 2; y1 = y; z1 = z;
}
else
{
x1 = x + 1; y1 = y; z1 = z;
}
break;
}
case 3:
{
if (world.getBlock(x - 1, y, z) == this)
{
x1 = x - 2; y1 = y; z1 = z;
}
else
{
x1 = x - 1; y1 = y; z1 = z;
}
break;
}
}
altar = world.getBlock(x1, y1, z1);
metaAltar = world.getBlockMetadata(x1, y1, z1);
if(altar instanceof BlockTFPAltar)
{
((BlockTFPAltar)altar).breakBlock(world, x1, y1, z1, altar, metaAltar);
}
}
@Override
public void onBlockDestroyedByPlayer(World world, int x, int y, int z, int meta)
{
}
@Override
public void registerBlockIcons(IIconRegister register)
{
this.blockIcon = Blocks.cobblestone.getIcon(0, 0);
}
}

View File

@ -0,0 +1,122 @@
package com.JAWolfe.terrafirmapunktweaks.blocks;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.init.Blocks;
import net.minecraft.world.World;
import steamcraft.common.blocks.machines.BlockLightningRod;
import steamcraft.common.init.InitBlocks;
public class BlockTFPLigntningRod extends BlockLightningRod
{
public BlockTFPLigntningRod()
{
super(Material.iron);
}
@Override
public void breakBlock(World world, int x, int y, int z, Block block, int meta)
{
Block altar = null;
int metaAltar = 0, x1 = 0, y1 = 0, z1 = 0;
switch (meta)
{
case 2:
{
if (world.getBlock(x - 2, y, z + 4) instanceof BlockTFPAltar)
{
x1 = x - 2; y1 = y; z1 = z + 4;
}
else if (world.getBlock(x - 2, y, z - 2) instanceof BlockTFPAltar)
{
x1 = x - 2; y1 = y; z1 = z - 2;
}
else if (world.getBlock(x + 2, y, z + 4) instanceof BlockTFPAltar)
{
x1 = x + 2; y1 = y; z1 = z + 4;
}
else if (world.getBlock(x + 2, y, z - 2) instanceof BlockTFPAltar)
{
x1 = x + 2; y1 = y; z1 = z - 2;
}
break;
}
case 0:
{
if (world.getBlock(x - 2, y, z - 4) instanceof BlockTFPAltar)
{
x1 = x - 2; y1 = y; z1 = z - 4;
}
else if (world.getBlock(x - 2, y, z + 2) instanceof BlockTFPAltar)
{
x1 = x - 2; y1 = y; z1 = z + 2;
}
else if (world.getBlock(x + 2, y, z - 4) instanceof BlockTFPAltar)
{
x1 = x + 2; y1 = y; z1 = z - 4;
}
else if (world.getBlock(x + 2, y, z + 2) instanceof BlockTFPAltar)
{
x1 = x + 2; y1 = y; z1 = z + 2;
}
break;
}
case 1:
{
if (world.getBlock(x + 4, y, z - 2) instanceof BlockTFPAltar)
{
x1 = x + 4; y1 = y; z1 = z - 2;
}
else if (world.getBlock(x - 2, y, z - 2) instanceof BlockTFPAltar)
{
x1 = x - 2; y1 = y; z1 = z - 2;
}
else if (world.getBlock(x + 4, y, z + 2) instanceof BlockTFPAltar)
{
x1 = x + 4; y1 = y; z1 = z + 2;
}
else if (world.getBlock(x - 2, y, z + 2) instanceof BlockTFPAltar)
{
x1 = x - 2; y1 = y; z1 = z + 2;
}
break;
}
case 3:
{
if (world.getBlock(x - 4, y, z - 2) instanceof BlockTFPAltar)
{
x1 = x - 4; y1 = y; z1 = z - 2;
}
else if (world.getBlock(x + 2, y, z - 2) instanceof BlockTFPAltar)
{
x1 = x + 2; y1 = y; z1 = z - 2;
}
else if (world.getBlock(x - 4, y, z + 2) instanceof BlockTFPAltar)
{
x1 = x - 4; y1 = y; z1 = z + 2;
}
else if (world.getBlock(x + 2, y, z + 2) instanceof BlockTFPAltar)
{
x1 = x + 2; y1 = y; z1 = z + 2;
}
break;
}
}
altar = world.getBlock(x1, y1, z1);
metaAltar = world.getBlockMetadata(x1, y1, z1);
if(altar instanceof BlockTFPAltar)
{
((BlockTFPAltar)altar).breakBlock(world, x1, y1, z1, altar, metaAltar);
}
}
@Override
public void registerBlockIcons(IIconRegister register)
{
this.blockIcon = Blocks.anvil.getIcon(0, 0);
}
}

View File

@ -21,6 +21,9 @@ public class TFPBlocks
public static Block tfpBlood;
public static Block oliveOil;
public static Block tfpWhaleOil;
public static Block tfpAltar;
public static Block tfpAltarBlock;
public static Block tfpLightningRod;
public static int brickOvenRenderID;
@ -43,10 +46,12 @@ public class TFPBlocks
tweakedboiler = new TweakedBoiler(false).setBlockName(SteamcraftBlocks.boiler.getUnlocalizedName().substring(5)).setHardness(5.0F).setResistance(10.0F);
tweakedboilerOn = new TweakedBoiler(true).setBlockName(SteamcraftBlocks.boilerOn.getUnlocalizedName().substring(5)).setHardness(5.0F).setResistance(10.0F);
tweakedFlashBoiler = new TweakedFlashBoiler().setBlockName(SteamcraftBlocks.flashBoiler.getUnlocalizedName().substring(5)).setHardness(5.0f).setResistance(10.0F);
tfpLightningRod = new BlockTFPLigntningRod().setBlockName("tfpLightningRod");
GameRegistry.registerBlock(tweakedboiler, "tweakedboiler");
GameRegistry.registerBlock(tweakedboilerOn, "tweakedboilerOn");
GameRegistry.registerBlock(tweakedFlashBoiler, "tweakedFlashBoiler");
GameRegistry.registerBlock(tfpLightningRod, "tfpLightningRod");
}
if(Loader.isModLoaded("necromancy"))
@ -54,6 +59,12 @@ public class TFPBlocks
tfpBlood = new TFPCustomFluids(TFPFluids.tfpFluidBlood, Material.water).setBlockName("tfpBlood");
GameRegistry.registerBlock(tfpBlood, "tfpBlood");
TFPFluids.tfpFluidBlood.setBlock(tfpBlood);
tfpAltar = new BlockTFPAltar().setHardness(4).setBlockName("tfpSummoningAltar");
GameRegistry.registerBlock(tfpAltar, "tfpSummoningAltar");
tfpAltarBlock = new BlockTFPAltarBlock().setHardness(4).setBlockName("tfpAltarBuildingBlock");
GameRegistry.registerBlock(tfpAltarBlock, "tfpAltarBuildingBlock");
}
if(Loader.isModLoaded("steamcraft2"))

View File

@ -1,8 +1,11 @@
package com.JAWolfe.terrafirmapunktweaks.handlers;
import com.JAWolfe.terrafirmapunktweaks.inventory.GUIBrickOven;
import com.JAWolfe.terrafirmapunktweaks.inventory.GUITFPAltar;
import com.JAWolfe.terrafirmapunktweaks.inventory.containers.ContainerBrickOven;
import com.JAWolfe.terrafirmapunktweaks.inventory.containers.ContainerTFPAltar;
import com.JAWolfe.terrafirmapunktweaks.reference.GUIs;
import com.JAWolfe.terrafirmapunktweaks.tiles.TEAltar;
import com.JAWolfe.terrafirmapunktweaks.tiles.TEBrickOven;
import cpw.mods.fml.common.network.IGuiHandler;
@ -20,6 +23,8 @@ public class GUIHandler implements IGuiHandler
if(ID == GUIs.BRICKOVEN.ordinal() && entity != null && entity instanceof TEBrickOven)
return new ContainerBrickOven(player.inventory, (TEBrickOven)entity);
else if(ID == GUIs.TFPALTAR.ordinal() && entity != null && entity instanceof TEAltar)
return new ContainerTFPAltar(player.inventory, (TEAltar) player.worldObj.getTileEntity(x, y, z));
return null;
}
@ -31,6 +36,8 @@ public class GUIHandler implements IGuiHandler
if(ID == GUIs.BRICKOVEN.ordinal() && entity != null && entity instanceof TEBrickOven)
return new GUIBrickOven(player.inventory, (TEBrickOven)entity, world, x, y, z);
else if(ID == GUIs.TFPALTAR.ordinal() && entity != null && entity instanceof TEAltar)
return new GUITFPAltar(player.inventory, (TEAltar) player.worldObj.getTileEntity(x, y, z));
return null;
}

View File

@ -103,6 +103,16 @@ public class PlayerInteractionHandler
event.entityPlayer.getCurrentEquippedItem().stackSize--;
}
}
if(event.entityPlayer.getCurrentEquippedItem().getItem() == Item.getItemFromBlock(Blocks.chest))
{
event.setCanceled(true);
if(event.entityPlayer.getCurrentEquippedItem().stackSize == 1)
event.entityPlayer.setCurrentItemOrArmor(0, null);
else
event.entityPlayer.getCurrentEquippedItem().stackSize--;
}
}
}

View File

@ -0,0 +1,35 @@
package com.JAWolfe.terrafirmapunktweaks.inventory;
import org.lwjgl.opengl.GL11;
import com.JAWolfe.terrafirmapunktweaks.inventory.containers.ContainerTFPAltar;
import com.JAWolfe.terrafirmapunktweaks.tiles.TEAltar;
import com.sirolf2009.necromancy.lib.ReferenceNecromancy;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.entity.player.InventoryPlayer;
public class GUITFPAltar extends GuiContainer
{
public GUITFPAltar(InventoryPlayer par1InventoryPlayer, TEAltar par2TileEntityAltar)
{
super(new ContainerTFPAltar(par1InventoryPlayer, par2TileEntityAltar));
}
@Override
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY)
{
fontRendererObj.drawString("Blood", 21, 60, 0xFFFFFF);
fontRendererObj.drawString("Soul", 132, 60, 0xFFFFFF);
}
@Override
protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3)
{
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
mc.renderEngine.bindTexture(ReferenceNecromancy.TEXTURES_GUI_ALTAR);
int var5 = (width - xSize) / 2;
int var6 = (height - ySize) / 2;
drawTexturedModalRect(var5, var6, 0, 0, xSize, ySize);
}
}

View File

@ -0,0 +1,109 @@
package com.JAWolfe.terrafirmapunktweaks.inventory.containers;
import com.JAWolfe.terrafirmapunktweaks.blocks.TFPBlocks;
import com.JAWolfe.terrafirmapunktweaks.tiles.TEAltar;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
public class ContainerTFPAltar extends Container
{
private TEAltar altar;
private World worldObj;
private int posX;
private int posY;
private int posZ;
public ContainerTFPAltar(InventoryPlayer inventory, TEAltar tileEntityAltar)
{
worldObj = tileEntityAltar.getWorldObj();
posX = tileEntityAltar.xCoord;
posY = tileEntityAltar.yCoord;
posZ = tileEntityAltar.zCoord;
altar = tileEntityAltar;
addSlotToContainer(new SlotSummoningAltar(altar, 0, 26, 40)); // blood
addSlotToContainer(new SlotSummoningAltar(altar, 1, 134, 39)); // soul
addSlotToContainer(new SlotSummoningAltar(altar, 2, 80, 19)); // head
addSlotToContainer(new SlotSummoningAltar(altar, 3, 80, 36)); // body
addSlotToContainer(new SlotSummoningAltar(altar, 4, 80, 53)); // legs
addSlotToContainer(new SlotSummoningAltar(altar, 5, 63, 36)); // right-arm
addSlotToContainer(new SlotSummoningAltar(altar, 6, 97, 36)); // left-arm
int var3;
for (var3 = 0; var3 < 3; ++var3)
{
for (int var4 = 0; var4 < 9; ++var4)
{
this.addSlotToContainer(new Slot(inventory, var4 + var3 * 9 + 9, 8 + var4 * 18, 84 + var3 * 18));
}
}
for (var3 = 0; var3 < 9; ++var3)
{
this.addSlotToContainer(new Slot(inventory, var3, 8 + var3 * 18, 142));
}
}
@Override
public boolean canInteractWith(EntityPlayer par1EntityPlayer)
{
return worldObj.getBlock(posX, posY, posZ) == TFPBlocks.tfpAltar
? par1EntityPlayer.getDistanceSq(posX + 0.5D, posY + 0.5D, posZ + 0.5D) <= 64D : false;
}
@Override
public ItemStack transferStackInSlot(EntityPlayer entityPlayer, int slotIndex)
{
ItemStack origStack = null;
Slot slot = (Slot) inventorySlots.get(slotIndex);
if (slot != null && slot.getHasStack())
{
ItemStack slotStack = slot.getStack();
origStack = slotStack.copy();
//From altar to inventory
if (slotIndex < 7)
{
if (!mergeItemStack(slotStack, 7, inventorySlots.size(), true))
return null;
}
//From inventory to altar
else
{
for(int i = 0; i < 6; i++)
{
if(((Slot) inventorySlots.get(i)).isItemValid(slotStack) && i < 5)
{
if (!mergeItemStack(slotStack, i, i + 1, true))
return null;
else
break;
}
else if(((Slot) inventorySlots.get(i)).isItemValid(slotStack))
{
if (!mergeItemStack(slotStack, i, i + 1, true))
{
if (!mergeItemStack(slotStack, i + 1, i + 2, true))
return null;
}
}
}
}
if (slotStack.stackSize == 0)
slot.putStack(null);
else
slot.onSlotChanged();
if (slotStack.stackSize == origStack.stackSize)
return null;
slot.onPickupFromSlot(entityPlayer, slotStack);
}
return origStack;
}
}

View File

@ -0,0 +1,43 @@
package com.JAWolfe.terrafirmapunktweaks.inventory.containers;
import com.sirolf2009.necromancy.item.ItemBodyPart;
import com.sirolf2009.necromancy.item.ItemGeneric;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
public class SlotSummoningAltar extends Slot
{
public SlotSummoningAltar(IInventory iinventory, int slotID, int x, int y)
{
super(iinventory, slotID, x, y);
}
@Override
public boolean isItemValid(ItemStack itemstack)
{
if(getSlotIndex() == 0 && itemstack.getItem() instanceof ItemGeneric && itemstack.getItemDamage() == 2)
return true;
else if(getSlotIndex() == 1 && itemstack.getItem() instanceof ItemGeneric && itemstack.getItemDamage() == 1)
return true;
else if(getSlotIndex() == 2 && itemstack.getItem() instanceof ItemBodyPart && ItemBodyPart.necroEntities.get(itemstack.getItemDamage()).contains("Head"))
return true;
else if(getSlotIndex() == 3 && itemstack.getItem() instanceof ItemBodyPart && ItemBodyPart.necroEntities.get(itemstack.getItemDamage()).contains("Torso"))
return true;
else if(getSlotIndex() == 4 && itemstack.getItem() instanceof ItemBodyPart && ItemBodyPart.necroEntities.get(itemstack.getItemDamage()).contains("Legs"))
return true;
else if(getSlotIndex() == 5 && itemstack.getItem() instanceof ItemBodyPart && ItemBodyPart.necroEntities.get(itemstack.getItemDamage()).contains("Arm"))
return true;
else if(getSlotIndex() == 6 && itemstack.getItem() instanceof ItemBodyPart && ItemBodyPart.necroEntities.get(itemstack.getItemDamage()).contains("Arm"))
return true;
return false;
}
@Override
public int getSlotStackLimit()
{
return 1;
}
}

View File

@ -21,6 +21,8 @@ public class TFPItems
public static Item NailMold;
public static Item NutMold;
public static Item WasherMold;
public static Item HopperMold;
public static Item TFPNecronomicon;
public static void initialise()
{
@ -38,6 +40,9 @@ public class TFPItems
{
CustomBucketBlood = new TFPCustomBucket().setUnlocalizedName("Wooden Bucket Blood");
GameRegistry.registerItem(CustomBucketBlood, CustomBucketBlood.getUnlocalizedName());
TFPNecronomicon = new TFPNecronomicon().setUnlocalizedName("TFPNecronomicon");
GameRegistry.registerItem(TFPNecronomicon, TFPNecronomicon.getUnlocalizedName());
}
if(Loader.isModLoaded("ImmersiveEngineering"))
@ -53,6 +58,7 @@ public class TFPItems
NailMold = new MetalMold().setUnlocalizedName("Nail Mold");
NutMold = new MetalMold().setUnlocalizedName("Nut Mold");
WasherMold = new MetalMold().setUnlocalizedName("Washer Mold");
HopperMold = new MetalMold().setUnlocalizedName("Hopper Mold");
GameRegistry.registerItem(BlockMold, BlockMold.getUnlocalizedName());
GameRegistry.registerItem(FenceMold, FenceMold.getUnlocalizedName());
@ -65,6 +71,7 @@ public class TFPItems
GameRegistry.registerItem(NailMold, NailMold.getUnlocalizedName());
GameRegistry.registerItem(NutMold, NutMold.getUnlocalizedName());
GameRegistry.registerItem(WasherMold, WasherMold.getUnlocalizedName());
GameRegistry.registerItem(HopperMold, HopperMold.getUnlocalizedName());
}
if(Loader.isModLoaded("steamcraft2"))

View File

@ -0,0 +1,124 @@
package com.JAWolfe.terrafirmapunktweaks.items;
import com.JAWolfe.terrafirmapunktweaks.blocks.TFPBlocks;
import com.JAWolfe.terrafirmapunktweaks.tiles.TEAltar;
import com.bioxx.tfc.BlockSetup;
import com.bioxx.tfc.Blocks.Terrain.BlockCobble;
import com.bioxx.tfc.Items.ItemTerra;
import com.sirolf2009.necromancy.achievement.AchievementNecromancy;
import cpw.mods.fml.common.Loader;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import steamcraft.common.blocks.machines.BlockLightningRod;
public class TFPNecronomicon extends ItemTerra
{
public TFPNecronomicon()
{
super();
setMaxStackSize(1);
}
@Override
public boolean onItemUse(ItemStack usedItem, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ)
{
if (world.getBlock(x, y, z) == BlockSetup.planks || world.getBlock(x, y, z) == BlockSetup.planks2)
{
if (world.getBlock(x + 1, y, z) instanceof BlockCobble && world.getBlock(x + 2, y, z) instanceof BlockCobble)
{
if(Loader.isModLoaded("Steamcraft"))
{
if(world.getBlock(x + 4, y, z + 2) instanceof BlockLightningRod && world.getBlock(x - 2, y, z + 2) instanceof BlockLightningRod &&
world.getBlock(x + 4, y, z - 2) instanceof BlockLightningRod && world.getBlock(x - 2, y, z - 2) instanceof BlockLightningRod)
{
setLightningRods(3, x + 4, x - 2, x + 4, x - 2, z + 2, z + 2, z - 2, z - 2, y, world);
setBlocks(3, x + 1, z, x + 2, z, world, x, y, z, player, usedItem);
}
}
else
setBlocks(3, x + 1, z, x + 2, z, world, x, y, z, player, usedItem);
return true;
}
if (world.getBlock(x - 1, y, z) instanceof BlockCobble && world.getBlock(x - 2, y, z) instanceof BlockCobble)
{
if(Loader.isModLoaded("Steamcraft"))
{
if(world.getBlock(x - 4, y, z + 2) instanceof BlockLightningRod && world.getBlock(x + 2, y, z + 2) instanceof BlockLightningRod &&
world.getBlock(x - 4, y, z - 2) instanceof BlockLightningRod && world.getBlock(x + 2, y, z - 2) instanceof BlockLightningRod)
{
setLightningRods(1, x - 4, x + 2, x - 4, x + 2, z + 2, z + 2, z - 2, z - 2, y, world);
setBlocks(1, x - 1, z, x - 2, z, world, x, y, z, player, usedItem);
}
}
else
setBlocks(1, x - 1, z, x - 2, z, world, x, y, z, player, usedItem);
return true;
}
if (world.getBlock(x, y, z + 1) instanceof BlockCobble && world.getBlock(x, y, z + 2) instanceof BlockCobble)
{
if(Loader.isModLoaded("Steamcraft"))
{
if(world.getBlock(x + 2, y, z + 4) instanceof BlockLightningRod && world.getBlock(x + 2, y, z - 2) instanceof BlockLightningRod &&
world.getBlock(x - 2, y, z + 4) instanceof BlockLightningRod && world.getBlock(x - 2, y, z - 2) instanceof BlockLightningRod)
{
setLightningRods(0, x + 2, x + 2, x - 2, x - 2, z + 4, z - 2, z + 4, z - 2, y, world);
setBlocks(0, x, z + 1, x, z + 2, world, x, y, z, player, usedItem);
}
}
else
setBlocks(0, x, z + 1, x, z + 2, world, x, y, z, player, usedItem);
return true;
}
if (world.getBlock(x, y, z - 1) instanceof BlockCobble && world.getBlock(x, y, z - 2) instanceof BlockCobble)
{
if(Loader.isModLoaded("Steamcraft"))
{
if(world.getBlock(x + 2, y, z - 4) instanceof BlockLightningRod && world.getBlock(x + 2, y, z + 2) instanceof BlockLightningRod &&
world.getBlock(x - 2, y, z - 4) instanceof BlockLightningRod && world.getBlock(x - 2, y, z + 2) instanceof BlockLightningRod)
{
setLightningRods(2, x + 2, x + 2, x - 2, x - 2, z - 4, z + 2, z - 4, z + 2, y, world);
setBlocks(2, x, z - 1, x, z - 2, world, x, y, z, player, usedItem);
}
}
else
setBlocks(2, x, z - 1, x, z - 2, world, x, y, z, player, usedItem);
return true;
}
}
return false;
}
private void setBlocks(int meta, int x1, int z1, int x2, int z2, World world, int x, int y, int z, EntityPlayer player, ItemStack usedItem)
{
ItemStack[] blockTypes = new ItemStack[3];
blockTypes[0] = new ItemStack(Item.getItemFromBlock(world.getBlock(x, y, z)), 1, world.getBlockMetadata(x, y, z));
blockTypes[1] = new ItemStack(Item.getItemFromBlock(world.getBlock(x1, y, z1)), 1, world.getBlockMetadata(x1, y, z1));
blockTypes[2] = new ItemStack(Item.getItemFromBlock(world.getBlock(x2, y, z2)), 1, world.getBlockMetadata(x2, y, z2));
world.setBlock(x, y, z, TFPBlocks.tfpAltar, meta, 3);
world.setBlock(x1, y, z1, TFPBlocks.tfpAltarBlock, meta, 3);
world.setBlock(x2, y, z2, TFPBlocks.tfpAltarBlock, meta, 3);
player.addStat(AchievementNecromancy.AltarAchieve, 1);
--usedItem.stackSize;
if(world.getTileEntity(x, y, z) instanceof TEAltar)
((TEAltar)world.getTileEntity(x, y, z)).setBlockTypes(blockTypes);
}
private void setLightningRods(int meta, int x1, int x2, int x3, int x4, int z1, int z2, int z3, int z4, int y, World world)
{
world.setBlock(x1, y, z1, TFPBlocks.tfpLightningRod, meta, 3);
world.setBlock(x2, y, z2, TFPBlocks.tfpLightningRod, meta, 3);
world.setBlock(x3, y, z3, TFPBlocks.tfpLightningRod, meta, 3);
world.setBlock(x4, y, z4, TFPBlocks.tfpLightningRod, meta, 3);
}
}

View File

@ -0,0 +1,105 @@
package com.JAWolfe.terrafirmapunktweaks.items;
import org.lwjgl.opengl.GL11;
import com.sirolf2009.necromancy.Necromancy;
import com.sirolf2009.necromancy.client.model.ModelNecronomicon;
import com.sirolf2009.necromancy.core.proxy.ClientProxy;
import com.sirolf2009.necromancy.lib.ReferenceNecromancy;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.item.ItemStack;
import net.minecraftforge.client.IItemRenderer;
public class TFPNecronomiconRenderer implements IItemRenderer
{
private final ModelNecronomicon modelInteractive;
private final ModelNecronomicon modelStatic;
public String[] leftPageContent = {}, rightPageContent = {};
private final FontRenderer font;
public TFPNecronomiconRenderer()
{
modelInteractive = new ModelNecronomicon();
modelStatic = new ModelNecronomicon();
font = Minecraft.getMinecraft().fontRenderer;
}
@Override
public boolean handleRenderType(ItemStack item, ItemRenderType type)
{
return true;
}
@Override
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper)
{
return true;
}
@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data)
{
if (type.equals(ItemRenderType.ENTITY))
{
renderNecronomIIconStatic(0F, 0.2F, 0F, 180F, 1F, 1F, 0.004F);
}
else if (type.equals(ItemRenderType.EQUIPPED))
{
renderNecronomiconInteractive(0.8F, 1.3F, 0.6F, 180F, 180F, 0F, 0.009F);
}
else if (type.equals(ItemRenderType.EQUIPPED_FIRST_PERSON))
{
renderNecronomiconInteractive(0.8F, 1F, -1F, 20F, 100F, 160F, 0.01F);
}
else if (type.equals(ItemRenderType.INVENTORY))
{
renderNecronomIIconStatic(-0.2F, 0.2F, 0.2F, 100F, -20F, -20F, 0.007F);
}
}
private void renderNecronomiconInteractive(float posX, float posY, float posZ, float rotX, float rotY, float rotZ, float scale)
{
modelInteractive.setRotationAngles(100, 0, 0, 0, 0, 0, null);
GL11.glPushMatrix();
GL11.glTranslatef(posX, posY, posZ);
GL11.glRotatef(rotX, 1, 0, 0);
GL11.glRotatef(rotY, 0, 1, 0);
GL11.glRotatef(rotZ, 0, 0, 1);
GL11.glScalef(scale, scale, scale);
ClientProxy.mc.renderEngine.bindTexture(ReferenceNecromancy.TEXTURES_MODELS_NECRONOMICON);
modelInteractive.render(null, 1, 0, 0, 0, 1, 1);
GL11.glRotatef(-54, 0, 1, 0);
GL11.glTranslatef(8, -20, -30);
GL11.glScalef(0.8F, 0.8F, 0.8F);
for (int i = 0; i < rightPageContent.length; i++)
{
font.drawString(rightPageContent[i], 10, -50 + i * 10, 7208960);
}
GL11.glRotatef(-69, 0, 1, 0);
GL11.glTranslatef(-104, 0, 3);
for (int i = 0; i < leftPageContent.length; i++)
{
font.drawString(leftPageContent[i], 10, -50 + i * 10, 7208960);
}
GL11.glPopMatrix();
}
private void renderNecronomIIconStatic(float posX, float posY, float posZ, float rotX, float rotY, float rotZ, float scale)
{
modelInteractive.setRotationAngles(100, 0, 0, 0, 0, 0, null);
GL11.glPushMatrix();
GL11.glTranslatef(posX, posY, posZ);
GL11.glRotatef(rotX, 1, 0, 0);
GL11.glRotatef(rotY, 0, 1, 0);
GL11.glRotatef(rotZ, 0, 0, 1);
GL11.glScalef(scale, scale, scale);
Necromancy.proxy.bindTexture(ReferenceNecromancy.TEXTURES_MODELS_NECRONOMICON);
modelStatic.render(null, 0, 0, 0, 0f, 1, 1);
GL11.glPopMatrix();
}
}

View File

@ -2,10 +2,17 @@ package com.JAWolfe.terrafirmapunktweaks.proxy;
import com.JAWolfe.terrafirmapunktweaks.blocks.TFPBlocks;
import com.JAWolfe.terrafirmapunktweaks.blocks.TFPBrickOvenRenderer;
import com.JAWolfe.terrafirmapunktweaks.items.TFPItems;
import com.JAWolfe.terrafirmapunktweaks.items.TFPNecronomiconRenderer;
import com.JAWolfe.terrafirmapunktweaks.tiles.TEAltar;
import com.sirolf2009.necromancy.client.renderer.tileentity.TileEntityAltarRenderer;
import cpw.mods.fml.client.registry.ClientRegistry;
import cpw.mods.fml.client.registry.RenderingRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.item.Item;
import net.minecraftforge.client.MinecraftForgeClient;
public class ClientProxy extends CommonProxy
{
@ -21,5 +28,11 @@ public class ClientProxy extends CommonProxy
TFPBlocks.brickOvenRenderID = RenderingRegistry.getNextAvailableRenderId();
RenderingRegistry.registerBlockHandler(TFPBlocks.brickOvenRenderID, new TFPBrickOvenRenderer());
MinecraftForgeClient.registerItemRenderer(TFPItems.TFPNecronomicon, new TFPNecronomiconRenderer());
ClientRegistry.bindTileEntitySpecialRenderer(TEAltar.class, new TileEntityAltarRenderer());
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(TFPBlocks.tfpAltar), new TileEntityAltarRenderer());
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(TFPBlocks.tfpAltarBlock), new TileEntityAltarRenderer());
}
}

View File

@ -2,6 +2,7 @@ package com.JAWolfe.terrafirmapunktweaks.proxy;
import com.JAWolfe.terrafirmapunktweaks.TFPFluids;
import com.JAWolfe.terrafirmapunktweaks.items.TFPItems;
import com.JAWolfe.terrafirmapunktweaks.tiles.TEAltar;
import com.JAWolfe.terrafirmapunktweaks.tiles.TEBoiler;
import com.JAWolfe.terrafirmapunktweaks.tiles.TEBrickOven;
import com.JAWolfe.terrafirmapunktweaks.tiles.TEFlashBoiler;
@ -29,6 +30,10 @@ public class CommonProxy
GameRegistry.registerTileEntity(TEBoiler.class, "TEBoiler");
GameRegistry.registerTileEntity(TEFlashBoiler.class, "TEFlashBoiler");
}
if(Loader.isModLoaded("necromancy"))
{
GameRegistry.registerTileEntity(TEAltar.class, "TEAltar");
}
}
public void registerFluids()

View File

@ -2,5 +2,6 @@ package com.JAWolfe.terrafirmapunktweaks.reference;
public enum GUIs
{
BRICKOVEN
BRICKOVEN,
TFPALTAR
}

View File

@ -0,0 +1,61 @@
package com.JAWolfe.terrafirmapunktweaks.tiles;
import com.sirolf2009.necromancy.tileentity.TileEntityAltar;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
public class TEAltar extends TileEntityAltar
{
ItemStack[] blockTypes = new ItemStack[3];
public TEAltar()
{
super();
}
public void setBlockTypes(ItemStack[] types)
{
blockTypes = types;
}
public ItemStack[] getBlockTypes()
{
return blockTypes;
}
@Override
public void writeToNBT(NBTTagCompound par1NBTTagCompound)
{
super.writeToNBT(par1NBTTagCompound);
NBTTagList nbttaglist = new NBTTagList();
for(int i = 0; i < blockTypes.length; i++)
{
if(blockTypes[i] != null)
{
NBTTagCompound nbttagcompound1 = new NBTTagCompound();
nbttagcompound1.setByte("Slot", (byte)i);
blockTypes[i].writeToNBT(nbttagcompound1);
nbttaglist.appendTag(nbttagcompound1);
}
}
par1NBTTagCompound.setTag("blockTypes", nbttaglist);
}
@Override
public void readFromNBT(NBTTagCompound par1NBTTagCompound)
{
super.readFromNBT(par1NBTTagCompound);
NBTTagList nbttaglist = par1NBTTagCompound.getTagList("blockTypes", 10);
blockTypes = new ItemStack[3];
for(int i = 0; i < nbttaglist.tagCount(); i++)
{
NBTTagCompound nbttagcompound1 = nbttaglist.getCompoundTagAt(i);
byte byte0 = nbttagcompound1.getByte("Slot");
if(byte0 >= 0 && byte0 < blockTypes.length)
blockTypes[byte0] = ItemStack.loadItemStackFromNBT(nbttagcompound1);
}
}
}

View File

@ -11,6 +11,11 @@
gui.tfptweaks.watertank=Water Tank
gui.tfptweaks.steamtank=Steam Tank
#============
#= Entities =
#============
entity.minionNecro.name=Minion
#=========
#= Items =
#=========
@ -29,6 +34,8 @@ item.Bolt Mold.name=Metal Press Mold: Bolt
item.Nail Mold.name=Metal Press Mold: Nail
item.Nut Mold.name=Metal Press Mold: Nut
item.Washer Mold.name=Metal Press Mold: Washer
item.Hopper Mold.name=Metal Press Mold: Hopper
item.TFPNecronomicon.name=Necronomicon
#===========
#= Effects =
@ -61,6 +68,9 @@ tile.TFPBrickOven Phyllite.name=Phyllite Brick Oven
tile.TFPBrickOven Schist.name=Schist Brick Oven
tile.TFPBrickOven Gneiss.name=Gneiss Brick Oven
tile.TFPBrickOven Marble.name=Marble Brick Oven
tile.tfpSummoningAltar.name=Summoning Altar
tile.tfpAltarBuildingBlock.name=Summoning Altar
tile.tfpLightningRod.name=Lightning Rod
#==========
#= Fluids =

Binary file not shown.

After

Width:  |  Height:  |  Size: 291 B