-Fixed another Crusher Bug... derp!

This commit is contained in:
Ellpeck 2015-05-25 17:00:54 +02:00
parent a5a79fb95c
commit f896308888
27 changed files with 536 additions and 147 deletions

View file

@ -18,7 +18,7 @@ buildscript {
apply plugin: 'forge' apply plugin: 'forge'
apply plugin: 'maven' apply plugin: 'maven'
version = "1.7.10-0.0.5.1" version = "1.7.10-0.0.5.2"
group = "ellpeck.actuallyadditions" group = "ellpeck.actuallyadditions"
archivesBaseName = "ActuallyAdditions" archivesBaseName = "ActuallyAdditions"

View file

@ -1 +1 @@
1.7.10-0.0.5.1 1.7.10-0.0.5.2

View file

@ -75,12 +75,16 @@
-Produces Lava from Cobblestone -Produces Lava from Cobblestone
-Has Upgrade Slots -Has Upgrade Slots
-Phantom Chest
-Is bound to Inventory on Right-Click
-Allows you to open the bound Inventory when placed down
-Range of 10, Range Upgrade adds 15 Range
-Nether Star allows direct GUI Access and adds 50 Range
-Thermopile -Thermopile
-Needs a hot and a cold fluid -Needs a hot and a cold fluid
-Depending on the fluids, it generates more power -Depending on the fluids, it generates more power
-More Effect Rings
-Ring of Growth: Lets Plants grow, more Reach with Tier 2
-Ring of Thorns: Hurts Attackers when they hit you with a Projectile
-Ring of Water Walking
-Ring of Flight
-Ring of Aquadive: Fast underwater movement
-Ring of Suction: Sucks up Items in the area
-Ring of Water Absorption: Removes Water around
-Ring of Striptease (Or something like that): Attacker lose parts of their Armor

View file

@ -53,8 +53,6 @@ public class BlockCompost extends BlockContainerBase implements INameableItem{
else if(tile.slots[0] != null && (stackPlayer == null || (stackPlayer.getItem() instanceof ItemFertilizer && stackPlayer.stackSize <= stackPlayer.getMaxStackSize() - tile.slots[0].stackSize)) && tile.slots[0].getItem() instanceof ItemFertilizer){ else if(tile.slots[0] != null && (stackPlayer == null || (stackPlayer.getItem() instanceof ItemFertilizer && stackPlayer.stackSize <= stackPlayer.getMaxStackSize() - tile.slots[0].stackSize)) && tile.slots[0].getItem() instanceof ItemFertilizer){
if(stackPlayer == null) player.inventory.setInventorySlotContents(player.inventory.currentItem, tile.slots[0].copy()); if(stackPlayer == null) player.inventory.setInventorySlotContents(player.inventory.currentItem, tile.slots[0].copy());
else player.getCurrentEquippedItem().stackSize+=tile.slots[0].stackSize; else player.getCurrentEquippedItem().stackSize+=tile.slots[0].stackSize;
//TODO Add again when readding Achievements
//player.addStat(InitAchievements.achievementCraftFertilizer, 1);
tile.slots[0] = null; tile.slots[0] = null;
} }
} }

View file

@ -4,8 +4,11 @@ import ellpeck.actuallyadditions.tile.TileEntityInventoryBase;
import net.minecraft.block.BlockContainer; import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.item.EntityItem;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World; import net.minecraft.world.World;
import java.util.Random; import java.util.Random;
@ -38,4 +41,16 @@ public abstract class BlockContainerBase extends BlockContainer{
} }
return tileEntity; return tileEntity;
} }
@Override
public boolean hasComparatorInputOverride(){
return true;
}
@Override
public int getComparatorInputOverride(World world, int x, int y, int z, int meta){
TileEntity tile = world.getTileEntity(x, y, z);
if(tile instanceof IInventory) return Container.calcRedstoneFromInventory((IInventory)tile);
return 0;
}
} }

View file

@ -2,6 +2,9 @@ package ellpeck.actuallyadditions.blocks;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.actuallyadditions.ActuallyAdditions;
import ellpeck.actuallyadditions.inventory.GuiHandler;
import ellpeck.actuallyadditions.tile.TileEntityPhantomPlacer;
import ellpeck.actuallyadditions.tile.TileEntityPhantomface; import ellpeck.actuallyadditions.tile.TileEntityPhantomface;
import ellpeck.actuallyadditions.util.BlockUtil; import ellpeck.actuallyadditions.util.BlockUtil;
import ellpeck.actuallyadditions.util.INameableItem; import ellpeck.actuallyadditions.util.INameableItem;
@ -23,13 +26,26 @@ import java.util.List;
public class BlockPhantomface extends BlockContainerBase implements INameableItem{ public class BlockPhantomface extends BlockContainerBase implements INameableItem{
public BlockPhantomface(){ public static final int FACE = 0;
public static final int PLACER = 1;
public static final int BREAKER = 2;
public int type;
public BlockPhantomface(int type){
super(Material.rock); super(Material.rock);
this.type = type;
this.setHarvestLevel("pickaxe", 0); this.setHarvestLevel("pickaxe", 0);
this.setHardness(1.0F); this.setHardness(1.0F);
this.setStepSound(soundTypeStone); this.setStepSound(soundTypeStone);
} }
@Override
public void breakBlock(World world, int x, int y, int z, Block block, int par6){
if(this.type == PLACER || this.type == BREAKER) this.dropInventory(world, x, y, z);
super.breakBlock(world, x, y, z, block, par6);
}
@Override @Override
public String getOredictName(){ public String getOredictName(){
return this.getName(); return this.getName();
@ -38,27 +54,48 @@ public class BlockPhantomface extends BlockContainerBase implements INameableIte
@Override @Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int hitSide, float hitX, float hitY, float hitZ){ public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int hitSide, float hitX, float hitY, float hitZ){
if(!world.isRemote){ if(!world.isRemote){
TileEntityPhantomface tile = (TileEntityPhantomface)world.getTileEntity(x, y, z); TileEntity tile = world.getTileEntity(x, y, z);
if(tile != null){ if(tile != null){
if(tile.hasBoundTile()){ if(tile instanceof TileEntityPhantomface){
if(tile.isBoundTileInRage()){ TileEntityPhantomface phantom = (TileEntityPhantomface)tile;
player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocalFormatted("tooltip."+ModUtil.MOD_ID_LOWER+".phantom.connectedBlock.desc", tile.boundTile.xCoord, tile.boundTile.yCoord, tile.boundTile.zCoord))); if(phantom.hasBoundTile()){
if(phantom.isBoundTileInRage()){
player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocalFormatted("tooltip."+ModUtil.MOD_ID_LOWER+".phantom.connectedBlock.desc", phantom.boundTile.xCoord, phantom.boundTile.yCoord, phantom.boundTile.zCoord)));
}
else player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocalFormatted("tooltip."+ModUtil.MOD_ID_LOWER+".phantom.connectedNoRange.desc", phantom.boundTile.xCoord, phantom.boundTile.yCoord, phantom.boundTile.zCoord)));
}
else player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocal("tooltip."+ModUtil.MOD_ID_LOWER+".phantom.notConnected.desc")));
}
else if(tile instanceof TileEntityPhantomPlacer){
if(player.isSneaking()){
TileEntityPhantomPlacer phantom = (TileEntityPhantomPlacer)tile;
if(phantom.hasBoundPosition()){
if(phantom.isBoundPositionInRange()){
player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocalFormatted("tooltip."+ModUtil.MOD_ID_LOWER+".phantom.connectedBlock.desc", phantom.boundPosition.posX, phantom.boundPosition.posY, phantom.boundPosition.posZ)));
}
else player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocalFormatted("tooltip."+ModUtil.MOD_ID_LOWER+".phantom.connectedNoRange.desc", phantom.boundPosition.posX, phantom.boundPosition.posY, phantom.boundPosition.posZ)));
}
else player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocal("tooltip."+ModUtil.MOD_ID_LOWER+".phantom.notConnected.desc")));
}
else player.openGui(ActuallyAdditions.instance, GuiHandler.PHANTOM_PLACER_ID, world, x, y, z);
}
}
}
return true; return true;
} }
player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocalFormatted("tooltip."+ModUtil.MOD_ID_LOWER+".phantom.connectedNoRange.desc", tile.boundTile.xCoord, tile.boundTile.yCoord, tile.boundTile.zCoord)));
return true;
}
player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocal("tooltip."+ModUtil.MOD_ID_LOWER+".phantom.notConnected.desc")));
return true;
}
}
return false;
}
@Override @Override
public TileEntity createNewTileEntity(World world, int par2){ public TileEntity createNewTileEntity(World world, int par2){
switch(this.type){
case PLACER:
return new TileEntityPhantomPlacer();
case BREAKER:
return new TileEntityPhantomPlacer.TileEntityPhantomBreaker();
default:
return new TileEntityPhantomface(); return new TileEntityPhantomface();
} }
}
@Override @Override
public IIcon getIcon(int side, int metadata){ public IIcon getIcon(int side, int metadata){
@ -73,7 +110,7 @@ public class BlockPhantomface extends BlockContainerBase implements INameableIte
@Override @Override
public String getName(){ public String getName(){
return "blockPhantomface"; return this.type == PLACER ? "blockPhantomPlacer" : (this.type == BREAKER ? "blockPhantomBreaker" : "blockPhantomface");
} }
public static class TheItemBlock extends ItemBlock{ public static class TheItemBlock extends ItemBlock{

View file

@ -46,6 +46,8 @@ public class InitBlocks{
public static Block blockOilGenerator; public static Block blockOilGenerator;
public static Block blockPhantomface; public static Block blockPhantomface;
//public static Block blockPhantomPlacer;
//public static Block blockPhantomBreaker;
public static void init(){ public static void init(){
Util.logInfo("Initializing Blocks..."); Util.logInfo("Initializing Blocks...");
@ -63,9 +65,15 @@ public class InitBlocks{
blockCanolaPress = new BlockCanolaPress(); blockCanolaPress = new BlockCanolaPress();
BlockUtil.register(blockCanolaPress, BlockCanolaPress.TheItemBlock.class); BlockUtil.register(blockCanolaPress, BlockCanolaPress.TheItemBlock.class);
blockPhantomface = new BlockPhantomface(); blockPhantomface = new BlockPhantomface(BlockPhantomface.FACE);
BlockUtil.register(blockPhantomface, BlockPhantomface.TheItemBlock.class); BlockUtil.register(blockPhantomface, BlockPhantomface.TheItemBlock.class);
//blockPhantomPlacer = new BlockPhantomface(BlockPhantomface.PLACER);
//BlockUtil.register(blockPhantomPlacer, BlockPhantomface.TheItemBlock.class);
//blockPhantomBreaker = new BlockPhantomface(BlockPhantomface.BREAKER);
//BlockUtil.register(blockPhantomBreaker, BlockPhantomface.TheItemBlock.class);
blockCoalGenerator = new BlockCoalGenerator(); blockCoalGenerator = new BlockCoalGenerator();
BlockUtil.register(blockCoalGenerator, BlockCoalGenerator.TheItemBlock.class); BlockUtil.register(blockCoalGenerator, BlockCoalGenerator.TheItemBlock.class);

View file

@ -3,8 +3,8 @@ package ellpeck.actuallyadditions.crafting;
import ellpeck.actuallyadditions.items.InitItems; import ellpeck.actuallyadditions.items.InitItems;
import ellpeck.actuallyadditions.items.metalists.TheDusts; import ellpeck.actuallyadditions.items.metalists.TheDusts;
import ellpeck.actuallyadditions.items.metalists.TheFoods; import ellpeck.actuallyadditions.items.metalists.TheFoods;
import ellpeck.actuallyadditions.recipe.GrinderRecipeHandler; import ellpeck.actuallyadditions.recipe.GrinderRecipeRegistry;
import ellpeck.actuallyadditions.recipe.GrinderRecipeHandler.SearchCase; import ellpeck.actuallyadditions.recipe.GrinderRecipeRegistry.SearchCase;
import ellpeck.actuallyadditions.recipe.GrinderRecipes; import ellpeck.actuallyadditions.recipe.GrinderRecipes;
import ellpeck.actuallyadditions.util.Util; import ellpeck.actuallyadditions.util.Util;
import net.minecraft.init.Blocks; import net.minecraft.init.Blocks;
@ -13,7 +13,7 @@ import net.minecraft.item.ItemStack;
public class GrinderCrafting{ public class GrinderCrafting{
private static GrinderRecipeHandler grindRecHan = GrinderRecipeHandler.instance(); private static GrinderRecipeRegistry grindRecReg = GrinderRecipeRegistry.instance();
private static GrinderRecipes grindRec = GrinderRecipes.instance(); private static GrinderRecipes grindRec = GrinderRecipes.instance();
public static void init(){ public static void init(){
@ -32,15 +32,15 @@ public class GrinderCrafting{
grindRec.registerRecipe("oreNickel", "dustNickel", "dustPlatinum", 30, 2); grindRec.registerRecipe("oreNickel", "dustNickel", "dustPlatinum", 30, 2);
grindRec.registerRecipe("oreIron", "dustIron", "dustGold", 20, 2); grindRec.registerRecipe("oreIron", "dustIron", "dustGold", 20, 2);
grindRecHan.searchCases.add(new SearchCase("oreNether", 6)); grindRecReg.searchCases.add(new SearchCase("oreNether", 6));
grindRecHan.searchCases.add(new SearchCase("denseore", 8)); grindRecReg.searchCases.add(new SearchCase("denseore", 8));
grindRecHan.searchCases.add(new SearchCase("ingot", 1)); grindRecReg.searchCases.add(new SearchCase("ingot", 1));
grindRecHan.searchCases.add(new SearchCase("gem", 1)); grindRecReg.searchCases.add(new SearchCase("gem", 1));
grindRecHan.searchCases.add(new SearchCase("ore", 2)); grindRecReg.searchCases.add(new SearchCase("ore", 2));
grindRecHan.exceptions.add("ingotBrick"); grindRecReg.exceptions.add("ingotBrick");
grindRecHan.exceptions.add("ingotBrickNether"); grindRecReg.exceptions.add("ingotBrickNether");
grindRecHan.registerFinally(); grindRecReg.registerFinally();
} }
} }

View file

@ -26,9 +26,12 @@ public class CreativeTab extends CreativeTabs{
public void displayAllReleventItems(List list){ public void displayAllReleventItems(List list){
this.list = list; this.list = list;
this.addBlock(InitBlocks.blockPhantomface);
//this.addBlock(InitBlocks.blockPhantomPlacer);
//this.addBlock(InitBlocks.blockPhantomBreaker);
this.addBlock(InitBlocks.blockInputter); this.addBlock(InitBlocks.blockInputter);
this.addBlock(InitBlocks.blockInputterAdvanced); this.addBlock(InitBlocks.blockInputterAdvanced);
this.addBlock(InitBlocks.blockPhantomface);
this.addBlock(InitBlocks.blockGreenhouseGlass); this.addBlock(InitBlocks.blockGreenhouseGlass);
this.addBlock(InitBlocks.blockGrinder); this.addBlock(InitBlocks.blockGrinder);
this.addBlock(InitBlocks.blockGrinderDouble); this.addBlock(InitBlocks.blockGrinderDouble);

View file

@ -0,0 +1,80 @@
package ellpeck.actuallyadditions.inventory;
import ellpeck.actuallyadditions.tile.TileEntityBase;
import ellpeck.actuallyadditions.tile.TileEntityPhantomPlacer;
import invtweaks.api.container.InventoryContainer;
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;
@InventoryContainer
public class ContainerPhantomPlacer extends Container{
private TileEntityPhantomPlacer placer;
public ContainerPhantomPlacer(InventoryPlayer inventory, TileEntityBase tile){
this.placer = (TileEntityPhantomPlacer)tile;
for (int i = 0; i < 3; i++){
for (int j = 0; j < 3; j++){
this.addSlotToContainer(new Slot(this.placer, j+i*3, 62+j*18, 21+i*18));
}
}
for (int i = 0; i < 3; i++){
for (int j = 0; j < 9; j++){
this.addSlotToContainer(new Slot(inventory, j + i * 9 + 9, 8 + j * 18, 97 + i * 18));
}
}
for (int i = 0; i < 9; i++){
this.addSlotToContainer(new Slot(inventory, i, 8 + i * 18, 155));
}
}
@Override
public boolean canInteractWith(EntityPlayer player){
return this.placer.isUseableByPlayer(player);
}
@Override
public ItemStack transferStackInSlot(EntityPlayer player, int slot){
final int inventoryStart = 9;
final int inventoryEnd = inventoryStart+26;
final int hotbarStart = inventoryEnd+1;
final int hotbarEnd = hotbarStart+8;
Slot theSlot = (Slot)this.inventorySlots.get(slot);
if(theSlot.getHasStack()){
ItemStack currentStack = theSlot.getStack();
ItemStack newStack = currentStack.copy();
if(currentStack.getItem() != null){
if(slot <= hotbarEnd && slot >= inventoryStart){
this.mergeItemStack(newStack, 0, 9, false);
}
if(slot <= hotbarEnd && slot >= hotbarStart){
this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false);
}
else if(slot <= inventoryEnd && slot >= inventoryStart){
this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false);
}
else if(slot < inventoryStart){
this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false);
}
if(newStack.stackSize == 0) theSlot.putStack(null);
else theSlot.onSlotChanged();
if(newStack.stackSize == currentStack.stackSize) return null;
theSlot.onPickupFromSlot(player, newStack);
return currentStack;
}
}
return null;
}
}

View file

@ -58,6 +58,9 @@ public class GuiHandler implements IGuiHandler{
case OIL_GENERATOR_ID: case OIL_GENERATOR_ID:
TileEntityBase tileOilGen = (TileEntityBase)world.getTileEntity(x, y, z); TileEntityBase tileOilGen = (TileEntityBase)world.getTileEntity(x, y, z);
return new ContainerOilGenerator(entityPlayer.inventory, tileOilGen); return new ContainerOilGenerator(entityPlayer.inventory, tileOilGen);
case PHANTOM_PLACER_ID:
TileEntityBase tilePlacer = (TileEntityBase)world.getTileEntity(x, y, z);
return new ContainerPhantomPlacer(entityPlayer.inventory, tilePlacer);
default: default:
return null; return null;
} }
@ -110,6 +113,9 @@ public class GuiHandler implements IGuiHandler{
case OIL_GENERATOR_ID: case OIL_GENERATOR_ID:
TileEntityBase tileOilGen = (TileEntityBase)world.getTileEntity(x, y, z); TileEntityBase tileOilGen = (TileEntityBase)world.getTileEntity(x, y, z);
return new GuiOilGenerator(entityPlayer.inventory, tileOilGen); return new GuiOilGenerator(entityPlayer.inventory, tileOilGen);
case PHANTOM_PLACER_ID:
TileEntityBase tilePlacer = (TileEntityBase)world.getTileEntity(x, y, z);
return new GuiPhantomPlacer(entityPlayer.inventory, tilePlacer);
default: default:
return null; return null;
} }
@ -130,6 +136,7 @@ public class GuiHandler implements IGuiHandler{
public static final int FERMENTING_BARREL_ID = 12; public static final int FERMENTING_BARREL_ID = 12;
public static final int COAL_GENERATOR_ID = 13; public static final int COAL_GENERATOR_ID = 13;
public static final int OIL_GENERATOR_ID = 14; public static final int OIL_GENERATOR_ID = 14;
public static final int PHANTOM_PLACER_ID = 15;
public static void init(){ public static void init(){
Util.logInfo("Initializing GuiHandler..."); Util.logInfo("Initializing GuiHandler...");

View file

@ -0,0 +1,47 @@
package ellpeck.actuallyadditions.inventory;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.actuallyadditions.tile.TileEntityBase;
import ellpeck.actuallyadditions.tile.TileEntityPhantomPlacer;
import ellpeck.actuallyadditions.util.AssetUtil;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
@SideOnly(Side.CLIENT)
public class GuiPhantomPlacer extends GuiContainer{
private TileEntityPhantomPlacer placer;
private static final ResourceLocation resLoc = AssetUtil.getGuiLocation("guiBreaker");
public GuiPhantomPlacer(InventoryPlayer inventory, TileEntityBase tile){
super(new ContainerPhantomPlacer(inventory, tile));
this.placer = (TileEntityPhantomPlacer)tile;
this.xSize = 176;
this.ySize = 93+86;
}
@Override
public void drawGuiContainerForegroundLayer(int x, int y){
AssetUtil.displayNameString(this.fontRendererObj, xSize, -10, this.placer.getInventoryName());
}
@Override
public void drawGuiContainerBackgroundLayer(float f, int x, int y){
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION);
this.drawTexturedModalRect(this.guiLeft, this.guiTop+93, 0, 0, 176, 86);
this.mc.getTextureManager().bindTexture(resLoc);
this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, 176, 93);
}
@Override
public void drawScreen(int x, int y, float f){
super.drawScreen(x, y, f);
}
}

View file

@ -2,6 +2,7 @@ package ellpeck.actuallyadditions.items;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.actuallyadditions.tile.TileEntityPhantomPlacer;
import ellpeck.actuallyadditions.tile.TileEntityPhantomface; import ellpeck.actuallyadditions.tile.TileEntityPhantomface;
import ellpeck.actuallyadditions.util.INameableItem; import ellpeck.actuallyadditions.util.INameableItem;
import ellpeck.actuallyadditions.util.ItemUtil; import ellpeck.actuallyadditions.util.ItemUtil;
@ -10,13 +11,13 @@ import ellpeck.actuallyadditions.util.ModUtil;
import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.EnumRarity; import net.minecraft.item.EnumRarity;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ChatComponentText; import net.minecraft.util.ChatComponentText;
import net.minecraft.util.ChunkCoordinates;
import net.minecraft.util.IIcon; import net.minecraft.util.IIcon;
import net.minecraft.util.StatCollector; import net.minecraft.util.StatCollector;
import net.minecraft.world.World; import net.minecraft.world.World;
@ -33,34 +34,56 @@ public class ItemPhantomConnector extends Item implements INameableItem{
@Override @Override
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int par7, float par8, float par9, float par10){ public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int par7, float par8, float par9, float par10){
if(!world.isRemote){ if(!world.isRemote){
//Passing Data to Phantoms
TileEntity tile = world.getTileEntity(x, y, z); TileEntity tile = world.getTileEntity(x, y, z);
if(tile != null){
if(tile != null && tile instanceof TileEntityPhantomface && this.getStoredConnection(stack) != null){ //Passing to Face
TileEntity stored = this.getStoredConnection(stack); if(tile instanceof TileEntityPhantomface){
if(stored != null && stored.getWorldObj().getTileEntity(stored.xCoord, stored.yCoord, stored.zCoord) == stored){ if(this.checkHasConnection(stack, player)){
((TileEntityPhantomface)tile).boundTile = stored.getWorldObj().getTileEntity(stored.xCoord, stored.yCoord, stored.zCoord); ChunkCoordinates coords = this.getStoredPosition(stack);
player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + ".phantom.connected.desc"))); TileEntity toStore = this.getStoredWorld(stack).getTileEntity(coords.posX, coords.posY, coords.posZ);
if(toStore != null){
((TileEntityPhantomface)tile).boundTile = toStore;
this.clearStorage(stack); this.clearStorage(stack);
player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocal("tooltip."+ModUtil.MOD_ID_LOWER+".phantom.connected.desc")));
return true; return true;
} }
else player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocal("tooltip."+ModUtil.MOD_ID_LOWER+".phantom.notInventory.desc")));
}
return false;
}
//Passing to Placer
else if(tile instanceof TileEntityPhantomPlacer){
if(this.checkHasConnection(stack, player)){
((TileEntityPhantomPlacer)tile).boundPosition = this.getStoredPosition(stack);
((TileEntityPhantomPlacer)tile).boundWorld = this.getStoredWorld(stack);
this.clearStorage(stack);
player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocal("tooltip."+ModUtil.MOD_ID_LOWER+".phantom.connected.desc")));
return true;
}
return false;
}
}
//Storing Connections
this.storeConnection(stack, x, y, z, world);
player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + ".phantom.stored.desc")));
}
return true;
} }
if(tile != null && !(tile instanceof TileEntityPhantomface) && tile instanceof IInventory){ public boolean checkHasConnection(ItemStack stack, EntityPlayer player){
this.storeConnection(stack, tile); if(this.getStoredPosition(stack) != null && this.getStoredWorld(stack) != null){
player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + ".phantom.stored.desc")));
return true; return true;
} }
else{ else{
if(tile instanceof TileEntityPhantomface) player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + ".phantom.noBound.desc"))); player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + ".phantom.noBound.desc")));
else player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + ".phantom.notInventory.desc"))); return false;
} }
} }
return super.onItemUse(stack, player, world, x, y, z, par7, par8, par9, par10);
}
@Override @Override
public void onUpdate(ItemStack stack, World world, Entity entity, int par4, boolean par5){ public void onUpdate(ItemStack stack, World world, Entity entity, int par4, boolean par5){
if(this.getStoredConnection(stack) == null) this.clearStorage(stack); if(this.getStoredPosition(stack) == null || this.getStoredWorld(stack) == null) this.clearStorage(stack);
} }
@Override @Override
@ -69,27 +92,35 @@ public class ItemPhantomConnector extends Item implements INameableItem{
return stack; return stack;
} }
public TileEntity getStoredConnection(ItemStack stack){ public ChunkCoordinates getStoredPosition(ItemStack stack){
NBTTagCompound tag = stack.getTagCompound(); NBTTagCompound tag = stack.getTagCompound();
if(tag != null){ if(tag != null){
int x = tag.getInteger("XCoordOfTileStored"); int x = tag.getInteger("XCoordOfTileStored");
int y = tag.getInteger("YCoordOfTileStored"); int y = tag.getInteger("YCoordOfTileStored");
int z = tag.getInteger("ZCoordOfTileStored"); int z = tag.getInteger("ZCoordOfTileStored");
World world = DimensionManager.getWorld(tag.getInteger("WorldOfTileStored"));
return world.getTileEntity(x, y, z); if(x == 0 && y == 0 && z == 0) return null;
return new ChunkCoordinates(x, y, z);
} }
return null; return null;
} }
public void storeConnection(ItemStack stack, TileEntity tile){ public World getStoredWorld(ItemStack stack){
NBTTagCompound tag = stack.getTagCompound();
if(tag != null){
return DimensionManager.getWorld(tag.getInteger("WorldOfTileStored"));
}
return null;
}
public void storeConnection(ItemStack stack, int x, int y, int z, World world){
NBTTagCompound tag = stack.getTagCompound(); NBTTagCompound tag = stack.getTagCompound();
if(tag == null) tag = new NBTTagCompound(); if(tag == null) tag = new NBTTagCompound();
tag.setInteger("XCoordOfTileStored", tile.xCoord); tag.setInteger("XCoordOfTileStored", x);
tag.setInteger("YCoordOfTileStored", tile.yCoord); tag.setInteger("YCoordOfTileStored", y);
tag.setInteger("ZCoordOfTileStored", tile.zCoord); tag.setInteger("ZCoordOfTileStored", z);
tag.setInteger("WorldOfTileStored", tile.getWorldObj().provider.dimensionId); tag.setInteger("WorldOfTileStored", world.provider.dimensionId);
stack.setTagCompound(tag); stack.setTagCompound(tag);
} }
@ -108,13 +139,14 @@ public class ItemPhantomConnector extends Item implements INameableItem{
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld) { public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld) {
ItemUtil.addInformation(this, list, 2, ""); ItemUtil.addInformation(this, list, 2, "");
TileEntity tile = this.getStoredConnection(stack); ChunkCoordinates coords = this.getStoredPosition(stack);
if(tile != null){ World world = this.getStoredWorld(stack);
if(coords != null && world != null){
list.add(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + ".phantom.boundTo.desc") + ":"); list.add(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + ".phantom.boundTo.desc") + ":");
list.add("X: " + tile.xCoord); list.add("X: " + coords.posX);
list.add("Y: " + tile.yCoord); list.add("Y: " + coords.posY);
list.add("Z: " + tile.zCoord); list.add("Z: " + coords.posZ);
list.add(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + ".phantom.inWorld.desc") + " " + tile.getWorldObj().provider.dimensionId); list.add(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + ".phantom.inWorld.desc") + " " + world.provider.dimensionId);
} }
} }

View file

@ -8,11 +8,11 @@ import org.apache.logging.log4j.Level;
import java.util.ArrayList; import java.util.ArrayList;
public class GrinderRecipeHandler{ public class GrinderRecipeRegistry{
private static final GrinderRecipeHandler instance = new GrinderRecipeHandler(); private static final GrinderRecipeRegistry instance = new GrinderRecipeRegistry();
public static GrinderRecipeHandler instance(){ public static GrinderRecipeRegistry instance(){
return instance; return instance;
} }
@ -58,7 +58,7 @@ public class GrinderRecipeHandler{
ItemStack input = theInput.copy(); ItemStack input = theInput.copy();
ItemStack output = theDust.copy(); ItemStack output = theDust.copy();
output.stackSize = resultAmount; output.stackSize = resultAmount;
if(!GrinderRecipes.instance().hasRecipe(inputName, inputWithDustPrefix)){ if(!GrinderRecipes.instance().hasRecipe(input, output)){
GrinderRecipes.instance().registerRecipe(input, output, null, 0); GrinderRecipes.instance().registerRecipe(input, output, null, 0);
} }
} }

View file

@ -57,30 +57,11 @@ public class GrinderRecipes{
return null; return null;
} }
public boolean hasRecipe(String input, String outputOne){ public boolean hasRecipe(ItemStack input, ItemStack outputOne){
boolean containsInput = false;
boolean containsOutput = false;
for(GrinderRecipe recipe : recipes){ for(GrinderRecipe recipe : recipes){
int[] recipeInputIDs = OreDictionary.getOreIDs(recipe.input); if(recipe.input.isItemEqual(input) && recipe.firstOutput.isItemEqual(outputOne)) return true;
for(int recipeInputID : recipeInputIDs){
if(input.equals(OreDictionary.getOreName(recipeInputID))){
containsInput = true;
break;
} }
} return false;
int[] recipeOutputIDs = OreDictionary.getOreIDs(recipe.firstOutput);
for(int recipeOutputID : recipeOutputIDs){
if(outputOne.equals(OreDictionary.getOreName(recipeOutputID))){
containsOutput = true;
break;
}
}
if(containsInput && containsOutput) break;
}
return containsInput && containsOutput;
} }
public int getSecondChance(ItemStack input){ public int getSecondChance(ItemStack input){

View file

@ -32,6 +32,8 @@ public class TileEntityBase extends TileEntity{
GameRegistry.registerTileEntity(TileEntityOilGenerator.class, ModUtil.MOD_ID_LOWER + ":tileEntityOilGenerator"); GameRegistry.registerTileEntity(TileEntityOilGenerator.class, ModUtil.MOD_ID_LOWER + ":tileEntityOilGenerator");
GameRegistry.registerTileEntity(TileEntityCoalGenerator.class, ModUtil.MOD_ID_LOWER + ":tileEntityCoalGenerator"); GameRegistry.registerTileEntity(TileEntityCoalGenerator.class, ModUtil.MOD_ID_LOWER + ":tileEntityCoalGenerator");
GameRegistry.registerTileEntity(TileEntityPhantomface.class, ModUtil.MOD_ID_LOWER + ":tileEntityPhantomface"); GameRegistry.registerTileEntity(TileEntityPhantomface.class, ModUtil.MOD_ID_LOWER + ":tileEntityPhantomface");
GameRegistry.registerTileEntity(TileEntityPhantomPlacer.class, ModUtil.MOD_ID_LOWER + ":tileEntityPhantomPlacer");
GameRegistry.registerTileEntity(TileEntityPhantomPlacer.TileEntityPhantomBreaker.class, ModUtil.MOD_ID_LOWER + ":tileEntityPhantomBreaker");
} }
@Override @Override

View file

@ -62,17 +62,17 @@ public class TileEntityBreaker extends TileEntityInventoryBase{
int meta = worldObj.getBlockMetadata(coordsBlock.posX, coordsBlock.posY, coordsBlock.posZ); int meta = worldObj.getBlockMetadata(coordsBlock.posX, coordsBlock.posY, coordsBlock.posZ);
drops.addAll(blockToBreak.getDrops(worldObj, coordsBlock.posX, coordsBlock.posY, coordsBlock.posZ, meta, 0)); drops.addAll(blockToBreak.getDrops(worldObj, coordsBlock.posX, coordsBlock.posY, coordsBlock.posZ, meta, 0));
if(this.addToInventory(drops, false)){ if(addToInventory(this.slots, drops, false)){
worldObj.playAuxSFX(2001, coordsBlock.posX, coordsBlock.posY, coordsBlock.posZ, Block.getIdFromBlock(blockToBreak) + (meta << 12)); worldObj.playAuxSFX(2001, coordsBlock.posX, coordsBlock.posY, coordsBlock.posZ, Block.getIdFromBlock(blockToBreak) + (meta << 12));
WorldUtil.breakBlockAtSide(sideToManipulate, worldObj, xCoord, yCoord, zCoord); WorldUtil.breakBlockAtSide(sideToManipulate, worldObj, xCoord, yCoord, zCoord);
this.addToInventory(drops, true); addToInventory(this.slots, drops, true);
this.markDirty(); this.markDirty();
} }
} }
else if(this.isPlacer && worldObj.getBlock(coordsBlock.posX, coordsBlock.posY, coordsBlock.posZ).isReplaceable(worldObj, coordsBlock.posX, coordsBlock.posY, coordsBlock.posZ)){ else if(this.isPlacer && worldObj.getBlock(coordsBlock.posX, coordsBlock.posY, coordsBlock.posZ).isReplaceable(worldObj, coordsBlock.posX, coordsBlock.posY, coordsBlock.posZ)){
ItemStack removeFalse = this.removeFromInventory(false); ItemStack removeFalse = removeFromInventory(this.slots, false);
if(removeFalse != null && WorldUtil.placeBlockAtSide(sideToManipulate, worldObj, xCoord, yCoord, zCoord, removeFalse)){ if(removeFalse != null && WorldUtil.placeBlockAtSide(sideToManipulate, worldObj, xCoord, yCoord, zCoord, removeFalse)){
this.removeFromInventory(true); removeFromInventory(this.slots, true);
} }
} }
} }
@ -95,15 +95,15 @@ public class TileEntityBreaker extends TileEntityInventoryBase{
this.currentTime = compound.getInteger("CurrentTime"); this.currentTime = compound.getInteger("CurrentTime");
} }
public boolean addToInventory(ArrayList<ItemStack> stacks, boolean actuallyDo){ public static boolean addToInventory(ItemStack[] slots, ArrayList<ItemStack> stacks, boolean actuallyDo){
int working = 0; int working = 0;
for(ItemStack stack : stacks){ for(ItemStack stack : stacks){
for(int i = 0; i < this.slots.length; i++){ for(int i = 0; i < slots.length; i++){
if(this.slots[i] == null || (this.slots[i].isItemEqual(stack) && this.slots[i].stackSize <= stack.getMaxStackSize()-stack.stackSize)){ if(slots[i] == null || (slots[i].isItemEqual(stack) && slots[i].stackSize <= stack.getMaxStackSize()-stack.stackSize)){
working++; working++;
if(actuallyDo){ if(actuallyDo){
if(this.slots[i] == null) this.slots[i] = stack.copy(); if(slots[i] == null) slots[i] = stack.copy();
else this.slots[i].stackSize += stack.stackSize; else slots[i].stackSize += stack.stackSize;
} }
break; break;
} }
@ -112,13 +112,13 @@ public class TileEntityBreaker extends TileEntityInventoryBase{
return working >= stacks.size(); return working >= stacks.size();
} }
public ItemStack removeFromInventory(boolean actuallyDo){ public static ItemStack removeFromInventory(ItemStack[] slots, boolean actuallyDo){
for(int i = 0; i < this.slots.length; i++){ for(int i = 0; i < slots.length; i++){
if(this.slots[i] != null){ if(slots[i] != null){
ItemStack slot = this.slots[i].copy(); ItemStack slot = slots[i].copy();
if(actuallyDo){ if(actuallyDo){
this.slots[i].stackSize--; slots[i].stackSize--;
if(this.slots[i].stackSize <= 0) this.slots[i] = null; if(slots[i].stackSize <= 0) slots[i] = null;
} }
return slot; return slot;
} }

View file

@ -143,7 +143,7 @@ public class TileEntityCanolaPress extends TileEntityInventoryBase implements IE
@Override @Override
public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain){ public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain){
if(resource.getFluid() == FluidRegistry.getFluid(InitBlocks.fluidCanolaOil.getName())) return this.tank.drain(resource.amount, doDrain); if(resource.getFluid() == InitBlocks.fluidCanolaOil) return this.tank.drain(resource.amount, doDrain);
return null; return null;
} }

View file

@ -24,9 +24,12 @@ public class TileEntityCompost extends TileEntityInventoryBase{
if(!worldObj.isRemote){ if(!worldObj.isRemote){
if(this.slots[0] != null && this.slots[0].stackSize > 0){ if(this.slots[0] != null && this.slots[0].stackSize > 0){
worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, this.slots[0].stackSize + (this.slots[0].getItem() instanceof ItemFertilizer ? 1 : 0), 2); int toSet = this.slots[0].stackSize + (this.slots[0].getItem() instanceof ItemFertilizer ? 1 : 0);
if(worldObj.getBlockMetadata(xCoord, yCoord, zCoord) != toSet) worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, toSet, 2);
}
else{
if(worldObj.getBlockMetadata(xCoord, yCoord, zCoord) != 0) worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, 0, 2);
} }
else worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, 0, 2);
boolean theFlag = this.conversionTime > 0; boolean theFlag = this.conversionTime > 0;
if(this.slots[0] != null && !(this.slots[0].getItem() instanceof ItemFertilizer) && this.slots[0].stackSize >= this.amountNeededToConvert){ if(this.slots[0] != null && !(this.slots[0].getItem() instanceof ItemFertilizer) && this.slots[0].stackSize >= this.amountNeededToConvert){

View file

@ -116,13 +116,13 @@ public class TileEntityFermentingBarrel extends TileEntityInventoryBase implemen
@Override @Override
public int fill(ForgeDirection from, FluidStack resource, boolean doFill){ public int fill(ForgeDirection from, FluidStack resource, boolean doFill){
if(from != ForgeDirection.DOWN && resource.getFluid() == FluidRegistry.getFluid(InitBlocks.fluidCanolaOil.getName())) return this.canolaTank.fill(resource, doFill); if(from != ForgeDirection.DOWN && resource.getFluid() == InitBlocks.fluidCanolaOil) return this.canolaTank.fill(resource, doFill);
return 0; return 0;
} }
@Override @Override
public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain){ public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain){
if(resource.getFluid() == FluidRegistry.getFluid(InitBlocks.fluidOil.getName())) return this.oilTank.drain(resource.amount, doDrain); if(resource.getFluid() == InitBlocks.fluidOil) return this.oilTank.drain(resource.amount, doDrain);
return null; return null;
} }
@ -133,12 +133,12 @@ public class TileEntityFermentingBarrel extends TileEntityInventoryBase implemen
@Override @Override
public boolean canFill(ForgeDirection from, Fluid fluid){ public boolean canFill(ForgeDirection from, Fluid fluid){
return from != ForgeDirection.DOWN && fluid == FluidRegistry.getFluid(InitBlocks.fluidCanolaOil.getName()); return from != ForgeDirection.DOWN && fluid == InitBlocks.fluidCanolaOil;
} }
@Override @Override
public boolean canDrain(ForgeDirection from, Fluid fluid){ public boolean canDrain(ForgeDirection from, Fluid fluid){
return fluid == FluidRegistry.getFluid(InitBlocks.fluidOil.getName()); return fluid == InitBlocks.fluidOil;
} }
@Override @Override

View file

@ -138,7 +138,7 @@ public class TileEntityOilGenerator extends TileEntityInventoryBase implements I
@Override @Override
public int fill(ForgeDirection from, FluidStack resource, boolean doFill){ public int fill(ForgeDirection from, FluidStack resource, boolean doFill){
if(resource.getFluid() == FluidRegistry.getFluid(InitBlocks.fluidOil.getName())) return this.tank.fill(resource, doFill); if(resource.getFluid() == InitBlocks.fluidOil) return this.tank.fill(resource, doFill);
return 0; return 0;
} }
@ -154,7 +154,7 @@ public class TileEntityOilGenerator extends TileEntityInventoryBase implements I
@Override @Override
public boolean canFill(ForgeDirection from, Fluid fluid){ public boolean canFill(ForgeDirection from, Fluid fluid){
return fluid == FluidRegistry.getFluid(InitBlocks.fluidOil.getName()); return fluid == InitBlocks.fluidOil;
} }
@Override @Override

View file

@ -0,0 +1,154 @@
package ellpeck.actuallyadditions.tile;
import ellpeck.actuallyadditions.util.WorldUtil;
import net.minecraft.block.Block;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.ChunkCoordinates;
import net.minecraft.world.World;
import net.minecraftforge.common.DimensionManager;
import net.minecraftforge.common.util.ForgeDirection;
import java.util.ArrayList;
public class TileEntityPhantomPlacer extends TileEntityInventoryBase{
public static class TileEntityPhantomBreaker extends TileEntityPhantomPlacer{
public TileEntityPhantomBreaker(){
super(9, "phantomBreaker");
this.isBreaker = true;
}
}
public ChunkCoordinates boundPosition;
public World boundWorld;
public int currentTime;
public final int timeNeeded = 30;
public final int range = 3;
public boolean isBreaker;
public TileEntityPhantomPlacer(int slots, String name){
super(slots, name);
}
public TileEntityPhantomPlacer(){
super(9, "phantomPlacer");
this.isBreaker = false;
}
@Override
public void updateEntity(){
if(!worldObj.isRemote){
if(!this.hasBoundPosition()){
this.boundPosition = null;
this.boundWorld = null;
}
if(this.isBoundPositionInRange()){
if(!worldObj.isBlockIndirectlyGettingPowered(xCoord, yCoord, zCoord)){
if(this.currentTime > 0){
this.currentTime--;
if(this.currentTime <= 0){
if(this.isBreaker){
Block blockToBreak = boundWorld.getBlock(boundPosition.posX, boundPosition.posY, boundPosition.posZ);
if(blockToBreak != null && blockToBreak.getBlockHardness(boundWorld, boundPosition.posX, boundPosition.posY, boundPosition.posZ) > -1.0F){
ArrayList<ItemStack> drops = new ArrayList<ItemStack>();
int meta = boundWorld.getBlockMetadata(boundPosition.posX, boundPosition.posY, boundPosition.posZ);
drops.addAll(blockToBreak.getDrops(boundWorld, boundPosition.posX, boundPosition.posY, boundPosition.posZ, meta, 0));
if(TileEntityBreaker.addToInventory(this.slots, drops, false)){
boundWorld.playAuxSFX(2001, boundPosition.posX, boundPosition.posY, boundPosition.posZ, Block.getIdFromBlock(blockToBreak) + (meta << 12));
WorldUtil.breakBlockAtSide(ForgeDirection.UNKNOWN, boundWorld, boundPosition.posX, boundPosition.posY, boundPosition.posZ);
TileEntityBreaker.addToInventory(this.slots, drops, true);
this.markDirty();
}
}
}
else{
if(boundWorld.getBlock(boundPosition.posX, boundPosition.posY, boundPosition.posZ).isReplaceable(boundWorld, boundPosition.posX, boundPosition.posY, boundPosition.posZ)){
ItemStack removeFalse = TileEntityBreaker.removeFromInventory(this.slots, false);
if(removeFalse != null && WorldUtil.placeBlockAtSide(ForgeDirection.UNKNOWN, boundWorld, boundPosition.posX, boundPosition.posY, boundPosition.posZ, removeFalse)){
TileEntityBreaker.removeFromInventory(this.slots, true);
}
}
}
}
}
else this.currentTime = this.timeNeeded;
}
}
}
}
public boolean isBoundPositionInRange(){
if(this.hasBoundPosition()){
int xDif = this.boundPosition.posX-this.xCoord;
int yDif = this.boundPosition.posY-this.yCoord;
int zDif = this.boundPosition.posZ-this.zCoord;
if(xDif >= -this.range && xDif <= this.range){
if(yDif >= -this.range && yDif <= this.range){
if(zDif >= -this.range && zDif <= this.range) return true;
}
}
}
return false;
}
public boolean hasBoundPosition(){
if(this.boundPosition != null && this.boundWorld != null){
if(this.xCoord == this.boundPosition.posX && this.yCoord == this.boundPosition.posY && this.zCoord == this.boundPosition.posZ && this.worldObj == this.boundWorld){
this.boundPosition = null;
this.boundWorld = null;
return false;
}
return this.boundWorld == this.worldObj;
}
return false;
}
@Override
public void writeToNBT(NBTTagCompound compound){
super.writeToNBT(compound);
compound.setInteger("Time", currentTime);
if(this.hasBoundPosition()){
compound.setInteger("XCoordOfTileStored", boundPosition.posX);
compound.setInteger("YCoordOfTileStored", boundPosition.posY);
compound.setInteger("ZCoordOfTileStored", boundPosition.posZ);
compound.setInteger("WorldOfTileStored", boundWorld.provider.dimensionId);
}
}
@Override
public void readFromNBT(NBTTagCompound compound){
super.readFromNBT(compound);
int x = compound.getInteger("XCoordOfTileStored");
int y = compound.getInteger("YCoordOfTileStored");
int z = compound.getInteger("ZCoordOfTileStored");
if(x != 0 && y != 0 && z != 0){
this.boundPosition = new ChunkCoordinates(x, y, z);
this.boundWorld = DimensionManager.getWorld(compound.getInteger("WorldOfTileStored"));
}
}
@Override
public boolean isItemValidForSlot(int i, ItemStack stack){
return true;
}
@Override
public boolean canInsertItem(int slot, ItemStack stack, int side){
return this.isItemValidForSlot(slot, stack);
}
@Override
public boolean canExtractItem(int slot, ItemStack stack, int side){
return false;
}
}

View file

@ -22,6 +22,7 @@ public class TileEntityPhantomface extends TileEntityInventoryBase{
@Override @Override
public void updateEntity(){ public void updateEntity(){
if(!worldObj.isRemote){
if(!this.hasBoundTile()) this.boundTile = null; if(!this.hasBoundTile()) this.boundTile = null;
if(this.tempX > 0 || this.tempY > 0 || this.tempZ > 0){ if(this.tempX > 0 || this.tempY > 0 || this.tempZ > 0){
@ -32,6 +33,7 @@ public class TileEntityPhantomface extends TileEntityInventoryBase{
this.tempWorld = null; this.tempWorld = null;
} }
} }
}
public boolean isBoundTileInRage(){ public boolean isBoundTileInRage(){
if(this.hasBoundTile()){ if(this.hasBoundTile()){
@ -49,7 +51,14 @@ public class TileEntityPhantomface extends TileEntityInventoryBase{
} }
public boolean hasBoundTile(){ public boolean hasBoundTile(){
return this.boundTile != null && boundTile.getWorldObj().getTileEntity(boundTile.xCoord, boundTile.yCoord, boundTile.zCoord) != null && boundTile.getWorldObj() == this.getWorldObj() && boundTile instanceof IInventory; if(this.boundTile != null){
if(this.xCoord == this.boundTile.xCoord && this.yCoord == this.boundTile.yCoord && this.zCoord == this.boundTile.zCoord && this.worldObj == this.boundTile.getWorldObj()){
this.boundTile = null;
return false;
}
return boundTile instanceof IInventory && boundTile.getWorldObj().getTileEntity(boundTile.xCoord, boundTile.yCoord, boundTile.zCoord) == boundTile && boundTile.getWorldObj() == this.worldObj;
}
return false;
} }
@Override @Override

View file

@ -5,7 +5,7 @@ import org.apache.logging.log4j.Logger;
public class ModUtil{ public class ModUtil{
public static final String VERSION = "1.7.10-0.0.5.0"; public static final String VERSION = "1.7.10-0.0.5.2";
public static final String MOD_ID = "ActuallyAdditions"; public static final String MOD_ID = "ActuallyAdditions";
public static final String NAME = "Actually Additions"; public static final String NAME = "Actually Additions";

View file

@ -10,7 +10,6 @@ import net.minecraft.world.World;
import net.minecraft.world.WorldServer; import net.minecraft.world.WorldServer;
import net.minecraftforge.common.IPlantable; import net.minecraftforge.common.IPlantable;
import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.FluidContainerRegistry;
import net.minecraftforge.fluids.FluidTank; import net.minecraftforge.fluids.FluidTank;
import net.minecraftforge.fluids.IFluidHandler; import net.minecraftforge.fluids.IFluidHandler;
@ -22,6 +21,10 @@ public class WorldUtil{
} }
public static void breakBlockAtSide(ForgeDirection side, World world, int x, int y, int z){ public static void breakBlockAtSide(ForgeDirection side, World world, int x, int y, int z){
if(side == ForgeDirection.UNKNOWN){
world.setBlockToAir(x, y, z);
return;
}
ChunkCoordinates c = getCoordsFromSide(side, x, y, z); ChunkCoordinates c = getCoordsFromSide(side, x, y, z);
if(c != null){ if(c != null){
world.setBlockToAir(c.posX, c.posY, c.posZ); world.setBlockToAir(c.posX, c.posY, c.posZ);
@ -52,18 +55,12 @@ public class WorldUtil{
public static boolean placeBlockAtSide(ForgeDirection side, World world, int x, int y, int z, ItemStack stack){ public static boolean placeBlockAtSide(ForgeDirection side, World world, int x, int y, int z, ItemStack stack){
if(world instanceof WorldServer){ if(world instanceof WorldServer){
if(FluidContainerRegistry.isBucket(stack) && stack.isItemEqual(FluidContainerRegistry.EMPTY_BUCKET)){
//if()
return false;
}
if(stack.getItem() instanceof IPlantable){ if(stack.getItem() instanceof IPlantable){
if(((IPlantable)stack.getItem()).getPlant(world, x, y, z).canPlaceBlockAt(world, x+side.offsetX, y+side.offsetY, z+side.offsetZ)){ if(((IPlantable)stack.getItem()).getPlant(world, x, y, z).canPlaceBlockAt(world, x+side.offsetX, y+side.offsetY, z+side.offsetZ)){
return world.setBlock(x+side.offsetX, y+side.offsetY, z+side.offsetZ, ((IPlantable)stack.getItem()).getPlant(world, x, y, z)); return world.setBlock(x+side.offsetX, y+side.offsetY, z+side.offsetZ, ((IPlantable)stack.getItem()).getPlant(world, x, y, z));
} }
} }
if(side != ForgeDirection.UNKNOWN){ return stack.tryPlaceItemIntoWorld(FakePlayerUtil.newFakePlayer(world), world,x, y, z, side == ForgeDirection.UNKNOWN ? 0 : side.ordinal(), 0, 0, 0);
return stack.tryPlaceItemIntoWorld(FakePlayerUtil.newFakePlayer(world), world,x, y, z, side.ordinal(), 0, 0, 0);
}
} }
return false; return false;
} }

View file

@ -55,6 +55,14 @@ tile.actuallyadditions.blockPhantomface.name=Phantomface
tooltip.actuallyadditions.blockPhantomface.desc.1=Like a Hopper-Chain, only Wireless! Connect me with a Phantom Connector! tooltip.actuallyadditions.blockPhantomface.desc.1=Like a Hopper-Chain, only Wireless! Connect me with a Phantom Connector!
tooltip.actuallyadditions.blockPhantomface.desc.2=Input things into me to input into connected Blocks! tooltip.actuallyadditions.blockPhantomface.desc.2=Input things into me to input into connected Blocks!
tile.actuallyadditions.blockPhantomPlacer.name=Phantom Placer
tooltip.actuallyadditions.blockPhantomPlacer.desc.1=Places Blocks from a distance! Connect me with a Phantom Connector!
tooltip.actuallyadditions.blockPhantomPlacer.desc.2=Shift-Right-Click with an empty hand to see its Connections!
tile.actuallyadditions.blockPhantomBreaker.name=Phantom Breaker
tooltip.actuallyadditions.blockPhantomBreaker.desc.1=Breaks Blocks from a distance! Connect me with a Phantom Connector!
tooltip.actuallyadditions.blockPhantomBreaker.desc.2=Shift-Right-Click with an empty hand to see its Connections!
item.actuallyadditions.itemPhantomConnector.name=Phantom Connector item.actuallyadditions.itemPhantomConnector.name=Phantom Connector
tooltip.actuallyadditions.itemPhantomConnector.desc.1=Connects a Phantom Face to any Inventory Block! tooltip.actuallyadditions.itemPhantomConnector.desc.1=Connects a Phantom Face to any Inventory Block!
tooltip.actuallyadditions.itemPhantomConnector.desc.2=Hold ALT to clear the stored TileEntity tooltip.actuallyadditions.itemPhantomConnector.desc.2=Hold ALT to clear the stored TileEntity
@ -108,15 +116,15 @@ tile.actuallyadditions.blockInputter.add.13.name=Efficient Sucking Dilettant
tile.actuallyadditions.blockInputter.add.14.name=Extreme Sand Digger tile.actuallyadditions.blockInputter.add.14.name=Extreme Sand Digger
tile.actuallyadditions.blockInputter.add.15.name=MISSINGNO tile.actuallyadditions.blockInputter.add.15.name=MISSINGNO
tooltip.actuallyadditions.phantom.connected.desc=<TileEntity connected to this Phantomface!> tooltip.actuallyadditions.phantom.connected.desc=<Block connected!>
tooltip.actuallyadditions.phantom.stored.desc=<TileEntity stored to this Connector!> tooltip.actuallyadditions.phantom.stored.desc=<Block stored to this Connector!>
tooltip.actuallyadditions.phantom.noBound.desc=The Connector has no Information stored! tooltip.actuallyadditions.phantom.noBound.desc=The Connector has no Information stored!
tooltip.actuallyadditions.phantom.notInventory.desc=This Block is not an Inventory! tooltip.actuallyadditions.phantom.notInventory.desc=The stored Block is not an Inventory!
tooltip.actuallyadditions.phantom.inWorld.desc=In World tooltip.actuallyadditions.phantom.inWorld.desc=In World
tooltip.actuallyadditions.phantom.boundTo.desc=Bound to tooltip.actuallyadditions.phantom.boundTo.desc=Bound to
tooltip.actuallyadditions.phantom.connectedBlock.desc=Connected to TileEntity at %s, %s, %s tooltip.actuallyadditions.phantom.connectedBlock.desc=Connected to Block at %s, %s, %s
tooltip.actuallyadditions.phantom.connectedNoRange.desc=Connected to TileEntity at %s, %s, %s but it is not in Range! tooltip.actuallyadditions.phantom.connectedNoRange.desc=Connected to Block at %s, %s, %s but it is not in Range!
tooltip.actuallyadditions.phantom.notConnected.desc=This Phantomface isn't connected to anything! tooltip.actuallyadditions.phantom.notConnected.desc=This isn't connected to anything!
item.actuallyadditions.itemMiscMashedFood.name=Mashed Food item.actuallyadditions.itemMiscMashedFood.name=Mashed Food
item.actuallyadditions.itemFertilizer.name=Fertilizer item.actuallyadditions.itemFertilizer.name=Fertilizer
@ -372,6 +380,10 @@ container.actuallyadditions.canolaPress.name=Canola Press
container.actuallyadditions.fermentingBarrel.name=Fermenting Barrel container.actuallyadditions.fermentingBarrel.name=Fermenting Barrel
container.actuallyadditions.coalGenerator.name=Coal Generator container.actuallyadditions.coalGenerator.name=Coal Generator
container.actuallyadditions.oilGenerator.name=Oil Generator container.actuallyadditions.oilGenerator.name=Oil Generator
container.actuallyadditions.phantomPlacer.name=Phantom Placer
container.actuallyadditions.phantomBreaker.name=Phantom Breaker
container.actuallyadditions.phantomface.name=Phantomface
container.actuallyadditions.nei.crushing.name=Crusher container.actuallyadditions.nei.crushing.name=Crusher
container.actuallyadditions.nei.ballOfHair.name=Ball Of Hair Usage container.actuallyadditions.nei.ballOfHair.name=Ball Of Hair Usage

View file

@ -3,7 +3,7 @@
"modid": "ActuallyAdditions", "modid": "ActuallyAdditions",
"name": "Actually Additions", "name": "Actually Additions",
"description": "Actually Additions is a Mod that offers a bunch of things from Machines for Automation and tons of food to advanced Hopper Mechanisms and Effect Rings!", "description": "Actually Additions is a Mod that offers a bunch of things from Machines for Automation and tons of food to advanced Hopper Mechanisms and Effect Rings!",
"version": "0.0.5.1", "version": "0.0.5.2",
"mcversion": "1.7.10", "mcversion": "1.7.10",
"url": "https://github.com/Ellpeck/ActuallyAdditions", "url": "https://github.com/Ellpeck/ActuallyAdditions",
"updateUrl": "", "updateUrl": "",