mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-12-22 19:39:24 +01:00
-Fixed another Crusher Bug... derp!
This commit is contained in:
parent
a5a79fb95c
commit
f896308888
27 changed files with 536 additions and 147 deletions
|
@ -18,7 +18,7 @@ buildscript {
|
|||
apply plugin: 'forge'
|
||||
apply plugin: 'maven'
|
||||
|
||||
version = "1.7.10-0.0.5.1"
|
||||
version = "1.7.10-0.0.5.2"
|
||||
group = "ellpeck.actuallyadditions"
|
||||
archivesBaseName = "ActuallyAdditions"
|
||||
|
||||
|
|
|
@ -1 +1 @@
|
|||
1.7.10-0.0.5.1
|
||||
1.7.10-0.0.5.2
|
|
@ -75,12 +75,16 @@
|
|||
-Produces Lava from Cobblestone
|
||||
-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
|
||||
-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
|
|
@ -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){
|
||||
if(stackPlayer == null) player.inventory.setInventorySlotContents(player.inventory.currentItem, tile.slots[0].copy());
|
||||
else player.getCurrentEquippedItem().stackSize+=tile.slots[0].stackSize;
|
||||
//TODO Add again when readding Achievements
|
||||
//player.addStat(InitAchievements.achievementCraftFertilizer, 1);
|
||||
tile.slots[0] = null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,8 +4,11 @@ import ellpeck.actuallyadditions.tile.TileEntityInventoryBase;
|
|||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.Random;
|
||||
|
@ -38,4 +41,16 @@ public abstract class BlockContainerBase extends BlockContainer{
|
|||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,6 +2,9 @@ package ellpeck.actuallyadditions.blocks;
|
|||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
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.util.BlockUtil;
|
||||
import ellpeck.actuallyadditions.util.INameableItem;
|
||||
|
@ -23,13 +26,26 @@ import java.util.List;
|
|||
|
||||
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);
|
||||
this.type = type;
|
||||
this.setHarvestLevel("pickaxe", 0);
|
||||
this.setHardness(1.0F);
|
||||
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
|
||||
public String getOredictName(){
|
||||
return this.getName();
|
||||
|
@ -38,26 +54,47 @@ public class BlockPhantomface extends BlockContainerBase implements INameableIte
|
|||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int hitSide, float hitX, float hitY, float hitZ){
|
||||
if(!world.isRemote){
|
||||
TileEntityPhantomface tile = (TileEntityPhantomface)world.getTileEntity(x, y, z);
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
if(tile != null){
|
||||
if(tile.hasBoundTile()){
|
||||
if(tile.isBoundTileInRage()){
|
||||
player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocalFormatted("tooltip."+ModUtil.MOD_ID_LOWER+".phantom.connectedBlock.desc", tile.boundTile.xCoord, tile.boundTile.yCoord, tile.boundTile.zCoord)));
|
||||
return true;
|
||||
if(tile instanceof TileEntityPhantomface){
|
||||
TileEntityPhantomface phantom = (TileEntityPhantomface)tile;
|
||||
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)));
|
||||
}
|
||||
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;
|
||||
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);
|
||||
}
|
||||
player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocal("tooltip."+ModUtil.MOD_ID_LOWER+".phantom.notConnected.desc")));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int par2){
|
||||
return new TileEntityPhantomface();
|
||||
switch(this.type){
|
||||
case PLACER:
|
||||
return new TileEntityPhantomPlacer();
|
||||
case BREAKER:
|
||||
return new TileEntityPhantomPlacer.TileEntityPhantomBreaker();
|
||||
default:
|
||||
return new TileEntityPhantomface();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -73,7 +110,7 @@ public class BlockPhantomface extends BlockContainerBase implements INameableIte
|
|||
|
||||
@Override
|
||||
public String getName(){
|
||||
return "blockPhantomface";
|
||||
return this.type == PLACER ? "blockPhantomPlacer" : (this.type == BREAKER ? "blockPhantomBreaker" : "blockPhantomface");
|
||||
}
|
||||
|
||||
public static class TheItemBlock extends ItemBlock{
|
||||
|
|
|
@ -46,6 +46,8 @@ public class InitBlocks{
|
|||
public static Block blockOilGenerator;
|
||||
|
||||
public static Block blockPhantomface;
|
||||
//public static Block blockPhantomPlacer;
|
||||
//public static Block blockPhantomBreaker;
|
||||
|
||||
public static void init(){
|
||||
Util.logInfo("Initializing Blocks...");
|
||||
|
@ -63,9 +65,15 @@ public class InitBlocks{
|
|||
blockCanolaPress = new BlockCanolaPress();
|
||||
BlockUtil.register(blockCanolaPress, BlockCanolaPress.TheItemBlock.class);
|
||||
|
||||
blockPhantomface = new BlockPhantomface();
|
||||
blockPhantomface = new BlockPhantomface(BlockPhantomface.FACE);
|
||||
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();
|
||||
BlockUtil.register(blockCoalGenerator, BlockCoalGenerator.TheItemBlock.class);
|
||||
|
||||
|
|
|
@ -3,8 +3,8 @@ package ellpeck.actuallyadditions.crafting;
|
|||
import ellpeck.actuallyadditions.items.InitItems;
|
||||
import ellpeck.actuallyadditions.items.metalists.TheDusts;
|
||||
import ellpeck.actuallyadditions.items.metalists.TheFoods;
|
||||
import ellpeck.actuallyadditions.recipe.GrinderRecipeHandler;
|
||||
import ellpeck.actuallyadditions.recipe.GrinderRecipeHandler.SearchCase;
|
||||
import ellpeck.actuallyadditions.recipe.GrinderRecipeRegistry;
|
||||
import ellpeck.actuallyadditions.recipe.GrinderRecipeRegistry.SearchCase;
|
||||
import ellpeck.actuallyadditions.recipe.GrinderRecipes;
|
||||
import ellpeck.actuallyadditions.util.Util;
|
||||
import net.minecraft.init.Blocks;
|
||||
|
@ -13,7 +13,7 @@ import net.minecraft.item.ItemStack;
|
|||
|
||||
public class GrinderCrafting{
|
||||
|
||||
private static GrinderRecipeHandler grindRecHan = GrinderRecipeHandler.instance();
|
||||
private static GrinderRecipeRegistry grindRecReg = GrinderRecipeRegistry.instance();
|
||||
private static GrinderRecipes grindRec = GrinderRecipes.instance();
|
||||
|
||||
public static void init(){
|
||||
|
@ -32,15 +32,15 @@ public class GrinderCrafting{
|
|||
grindRec.registerRecipe("oreNickel", "dustNickel", "dustPlatinum", 30, 2);
|
||||
grindRec.registerRecipe("oreIron", "dustIron", "dustGold", 20, 2);
|
||||
|
||||
grindRecHan.searchCases.add(new SearchCase("oreNether", 6));
|
||||
grindRecHan.searchCases.add(new SearchCase("denseore", 8));
|
||||
grindRecHan.searchCases.add(new SearchCase("ingot", 1));
|
||||
grindRecHan.searchCases.add(new SearchCase("gem", 1));
|
||||
grindRecHan.searchCases.add(new SearchCase("ore", 2));
|
||||
grindRecReg.searchCases.add(new SearchCase("oreNether", 6));
|
||||
grindRecReg.searchCases.add(new SearchCase("denseore", 8));
|
||||
grindRecReg.searchCases.add(new SearchCase("ingot", 1));
|
||||
grindRecReg.searchCases.add(new SearchCase("gem", 1));
|
||||
grindRecReg.searchCases.add(new SearchCase("ore", 2));
|
||||
|
||||
grindRecHan.exceptions.add("ingotBrick");
|
||||
grindRecHan.exceptions.add("ingotBrickNether");
|
||||
grindRecReg.exceptions.add("ingotBrick");
|
||||
grindRecReg.exceptions.add("ingotBrickNether");
|
||||
|
||||
grindRecHan.registerFinally();
|
||||
grindRecReg.registerFinally();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,9 +26,12 @@ public class CreativeTab extends CreativeTabs{
|
|||
public void displayAllReleventItems(List list){
|
||||
this.list = list;
|
||||
|
||||
this.addBlock(InitBlocks.blockPhantomface);
|
||||
//this.addBlock(InitBlocks.blockPhantomPlacer);
|
||||
//this.addBlock(InitBlocks.blockPhantomBreaker);
|
||||
this.addBlock(InitBlocks.blockInputter);
|
||||
this.addBlock(InitBlocks.blockInputterAdvanced);
|
||||
this.addBlock(InitBlocks.blockPhantomface);
|
||||
|
||||
this.addBlock(InitBlocks.blockGreenhouseGlass);
|
||||
this.addBlock(InitBlocks.blockGrinder);
|
||||
this.addBlock(InitBlocks.blockGrinderDouble);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
|
@ -58,6 +58,9 @@ public class GuiHandler implements IGuiHandler{
|
|||
case OIL_GENERATOR_ID:
|
||||
TileEntityBase tileOilGen = (TileEntityBase)world.getTileEntity(x, y, z);
|
||||
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:
|
||||
return null;
|
||||
}
|
||||
|
@ -110,6 +113,9 @@ public class GuiHandler implements IGuiHandler{
|
|||
case OIL_GENERATOR_ID:
|
||||
TileEntityBase tileOilGen = (TileEntityBase)world.getTileEntity(x, y, z);
|
||||
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:
|
||||
return null;
|
||||
}
|
||||
|
@ -130,6 +136,7 @@ public class GuiHandler implements IGuiHandler{
|
|||
public static final int FERMENTING_BARREL_ID = 12;
|
||||
public static final int COAL_GENERATOR_ID = 13;
|
||||
public static final int OIL_GENERATOR_ID = 14;
|
||||
public static final int PHANTOM_PLACER_ID = 15;
|
||||
|
||||
public static void init(){
|
||||
Util.logInfo("Initializing GuiHandler...");
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
|
@ -2,6 +2,7 @@ package ellpeck.actuallyadditions.items;
|
|||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import ellpeck.actuallyadditions.tile.TileEntityPhantomPlacer;
|
||||
import ellpeck.actuallyadditions.tile.TileEntityPhantomface;
|
||||
import ellpeck.actuallyadditions.util.INameableItem;
|
||||
import ellpeck.actuallyadditions.util.ItemUtil;
|
||||
|
@ -10,13 +11,13 @@ import ellpeck.actuallyadditions.util.ModUtil;
|
|||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ChatComponentText;
|
||||
import net.minecraft.util.ChunkCoordinates;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
|
@ -33,34 +34,56 @@ public class ItemPhantomConnector extends Item implements INameableItem{
|
|||
@Override
|
||||
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){
|
||||
//Passing Data to Phantoms
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
|
||||
if(tile != null && tile instanceof TileEntityPhantomface && this.getStoredConnection(stack) != null){
|
||||
TileEntity stored = this.getStoredConnection(stack);
|
||||
if(stored != null && stored.getWorldObj().getTileEntity(stored.xCoord, stored.yCoord, stored.zCoord) == stored){
|
||||
((TileEntityPhantomface)tile).boundTile = stored.getWorldObj().getTileEntity(stored.xCoord, stored.yCoord, stored.zCoord);
|
||||
player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + ".phantom.connected.desc")));
|
||||
this.clearStorage(stack);
|
||||
return true;
|
||||
if(tile != null){
|
||||
//Passing to Face
|
||||
if(tile instanceof TileEntityPhantomface){
|
||||
if(this.checkHasConnection(stack, player)){
|
||||
ChunkCoordinates coords = this.getStoredPosition(stack);
|
||||
TileEntity toStore = this.getStoredWorld(stack).getTileEntity(coords.posX, coords.posY, coords.posZ);
|
||||
if(toStore != null){
|
||||
((TileEntityPhantomface)tile).boundTile = toStore;
|
||||
this.clearStorage(stack);
|
||||
player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocal("tooltip."+ModUtil.MOD_ID_LOWER+".phantom.connected.desc")));
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
if(tile != null && !(tile instanceof TileEntityPhantomface) && tile instanceof IInventory){
|
||||
this.storeConnection(stack, tile);
|
||||
player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + ".phantom.stored.desc")));
|
||||
return true;
|
||||
}
|
||||
else{
|
||||
if(tile instanceof TileEntityPhantomface) 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")));
|
||||
}
|
||||
//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;
|
||||
}
|
||||
|
||||
public boolean checkHasConnection(ItemStack stack, EntityPlayer player){
|
||||
if(this.getStoredPosition(stack) != null && this.getStoredWorld(stack) != null){
|
||||
return true;
|
||||
}
|
||||
else{
|
||||
player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + ".phantom.noBound.desc")));
|
||||
return false;
|
||||
}
|
||||
return super.onItemUse(stack, player, world, x, y, z, par7, par8, par9, par10);
|
||||
}
|
||||
|
||||
@Override
|
||||
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
|
||||
|
@ -69,27 +92,35 @@ public class ItemPhantomConnector extends Item implements INameableItem{
|
|||
return stack;
|
||||
}
|
||||
|
||||
public TileEntity getStoredConnection(ItemStack stack){
|
||||
public ChunkCoordinates getStoredPosition(ItemStack stack){
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
if(tag != null){
|
||||
int x = tag.getInteger("XCoordOfTileStored");
|
||||
int y = tag.getInteger("YCoordOfTileStored");
|
||||
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;
|
||||
}
|
||||
|
||||
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();
|
||||
if(tag == null) tag = new NBTTagCompound();
|
||||
|
||||
tag.setInteger("XCoordOfTileStored", tile.xCoord);
|
||||
tag.setInteger("YCoordOfTileStored", tile.yCoord);
|
||||
tag.setInteger("ZCoordOfTileStored", tile.zCoord);
|
||||
tag.setInteger("WorldOfTileStored", tile.getWorldObj().provider.dimensionId);
|
||||
tag.setInteger("XCoordOfTileStored", x);
|
||||
tag.setInteger("YCoordOfTileStored", y);
|
||||
tag.setInteger("ZCoordOfTileStored", z);
|
||||
tag.setInteger("WorldOfTileStored", world.provider.dimensionId);
|
||||
|
||||
stack.setTagCompound(tag);
|
||||
}
|
||||
|
@ -108,13 +139,14 @@ public class ItemPhantomConnector extends Item implements INameableItem{
|
|||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld) {
|
||||
ItemUtil.addInformation(this, list, 2, "");
|
||||
TileEntity tile = this.getStoredConnection(stack);
|
||||
if(tile != null){
|
||||
ChunkCoordinates coords = this.getStoredPosition(stack);
|
||||
World world = this.getStoredWorld(stack);
|
||||
if(coords != null && world != null){
|
||||
list.add(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + ".phantom.boundTo.desc") + ":");
|
||||
list.add("X: " + tile.xCoord);
|
||||
list.add("Y: " + tile.yCoord);
|
||||
list.add("Z: " + tile.zCoord);
|
||||
list.add(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + ".phantom.inWorld.desc") + " " + tile.getWorldObj().provider.dimensionId);
|
||||
list.add("X: " + coords.posX);
|
||||
list.add("Y: " + coords.posY);
|
||||
list.add("Z: " + coords.posZ);
|
||||
list.add(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + ".phantom.inWorld.desc") + " " + world.provider.dimensionId);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -8,11 +8,11 @@ import org.apache.logging.log4j.Level;
|
|||
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -58,7 +58,7 @@ public class GrinderRecipeHandler{
|
|||
ItemStack input = theInput.copy();
|
||||
ItemStack output = theDust.copy();
|
||||
output.stackSize = resultAmount;
|
||||
if(!GrinderRecipes.instance().hasRecipe(inputName, inputWithDustPrefix)){
|
||||
if(!GrinderRecipes.instance().hasRecipe(input, output)){
|
||||
GrinderRecipes.instance().registerRecipe(input, output, null, 0);
|
||||
}
|
||||
}
|
||||
|
@ -78,4 +78,4 @@ public class GrinderRecipeHandler{
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -57,30 +57,11 @@ public class GrinderRecipes{
|
|||
return null;
|
||||
}
|
||||
|
||||
public boolean hasRecipe(String input, String outputOne){
|
||||
boolean containsInput = false;
|
||||
boolean containsOutput = false;
|
||||
|
||||
public boolean hasRecipe(ItemStack input, ItemStack outputOne){
|
||||
for(GrinderRecipe recipe : recipes){
|
||||
int[] recipeInputIDs = OreDictionary.getOreIDs(recipe.input);
|
||||
for(int recipeInputID : recipeInputIDs){
|
||||
if(input.equals(OreDictionary.getOreName(recipeInputID))){
|
||||
containsInput = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
int[] recipeOutputIDs = OreDictionary.getOreIDs(recipe.firstOutput);
|
||||
for(int recipeOutputID : recipeOutputIDs){
|
||||
if(outputOne.equals(OreDictionary.getOreName(recipeOutputID))){
|
||||
containsOutput = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(containsInput && containsOutput) break;
|
||||
if(recipe.input.isItemEqual(input) && recipe.firstOutput.isItemEqual(outputOne)) return true;
|
||||
}
|
||||
return containsInput && containsOutput;
|
||||
return false;
|
||||
}
|
||||
|
||||
public int getSecondChance(ItemStack input){
|
||||
|
|
|
@ -32,6 +32,8 @@ public class TileEntityBase extends TileEntity{
|
|||
GameRegistry.registerTileEntity(TileEntityOilGenerator.class, ModUtil.MOD_ID_LOWER + ":tileEntityOilGenerator");
|
||||
GameRegistry.registerTileEntity(TileEntityCoalGenerator.class, ModUtil.MOD_ID_LOWER + ":tileEntityCoalGenerator");
|
||||
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
|
||||
|
|
|
@ -62,17 +62,17 @@ public class TileEntityBreaker extends TileEntityInventoryBase{
|
|||
int meta = worldObj.getBlockMetadata(coordsBlock.posX, coordsBlock.posY, coordsBlock.posZ);
|
||||
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));
|
||||
WorldUtil.breakBlockAtSide(sideToManipulate, worldObj, xCoord, yCoord, zCoord);
|
||||
this.addToInventory(drops, true);
|
||||
addToInventory(this.slots, drops, true);
|
||||
this.markDirty();
|
||||
}
|
||||
}
|
||||
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)){
|
||||
this.removeFromInventory(true);
|
||||
removeFromInventory(this.slots, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -95,15 +95,15 @@ public class TileEntityBreaker extends TileEntityInventoryBase{
|
|||
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;
|
||||
for(ItemStack stack : stacks){
|
||||
for(int i = 0; i < this.slots.length; i++){
|
||||
if(this.slots[i] == null || (this.slots[i].isItemEqual(stack) && this.slots[i].stackSize <= stack.getMaxStackSize()-stack.stackSize)){
|
||||
for(int i = 0; i < slots.length; i++){
|
||||
if(slots[i] == null || (slots[i].isItemEqual(stack) && slots[i].stackSize <= stack.getMaxStackSize()-stack.stackSize)){
|
||||
working++;
|
||||
if(actuallyDo){
|
||||
if(this.slots[i] == null) this.slots[i] = stack.copy();
|
||||
else this.slots[i].stackSize += stack.stackSize;
|
||||
if(slots[i] == null) slots[i] = stack.copy();
|
||||
else slots[i].stackSize += stack.stackSize;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -112,13 +112,13 @@ public class TileEntityBreaker extends TileEntityInventoryBase{
|
|||
return working >= stacks.size();
|
||||
}
|
||||
|
||||
public ItemStack removeFromInventory(boolean actuallyDo){
|
||||
for(int i = 0; i < this.slots.length; i++){
|
||||
if(this.slots[i] != null){
|
||||
ItemStack slot = this.slots[i].copy();
|
||||
public static ItemStack removeFromInventory(ItemStack[] slots, boolean actuallyDo){
|
||||
for(int i = 0; i < slots.length; i++){
|
||||
if(slots[i] != null){
|
||||
ItemStack slot = slots[i].copy();
|
||||
if(actuallyDo){
|
||||
this.slots[i].stackSize--;
|
||||
if(this.slots[i].stackSize <= 0) this.slots[i] = null;
|
||||
slots[i].stackSize--;
|
||||
if(slots[i].stackSize <= 0) slots[i] = null;
|
||||
}
|
||||
return slot;
|
||||
}
|
||||
|
|
|
@ -143,7 +143,7 @@ public class TileEntityCanolaPress extends TileEntityInventoryBase implements IE
|
|||
|
||||
@Override
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
|
@ -24,9 +24,12 @@ public class TileEntityCompost extends TileEntityInventoryBase{
|
|||
if(!worldObj.isRemote){
|
||||
|
||||
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;
|
||||
if(this.slots[0] != null && !(this.slots[0].getItem() instanceof ItemFertilizer) && this.slots[0].stackSize >= this.amountNeededToConvert){
|
||||
|
|
|
@ -116,13 +116,13 @@ public class TileEntityFermentingBarrel extends TileEntityInventoryBase implemen
|
|||
|
||||
@Override
|
||||
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;
|
||||
}
|
||||
|
||||
@Override
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -133,12 +133,12 @@ public class TileEntityFermentingBarrel extends TileEntityInventoryBase implemen
|
|||
|
||||
@Override
|
||||
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
|
||||
public boolean canDrain(ForgeDirection from, Fluid fluid){
|
||||
return fluid == FluidRegistry.getFluid(InitBlocks.fluidOil.getName());
|
||||
return fluid == InitBlocks.fluidOil;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -138,7 +138,7 @@ public class TileEntityOilGenerator extends TileEntityInventoryBase implements I
|
|||
|
||||
@Override
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -154,7 +154,7 @@ public class TileEntityOilGenerator extends TileEntityInventoryBase implements I
|
|||
|
||||
@Override
|
||||
public boolean canFill(ForgeDirection from, Fluid fluid){
|
||||
return fluid == FluidRegistry.getFluid(InitBlocks.fluidOil.getName());
|
||||
return fluid == InitBlocks.fluidOil;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
|
@ -22,14 +22,16 @@ public class TileEntityPhantomface extends TileEntityInventoryBase{
|
|||
|
||||
@Override
|
||||
public void updateEntity(){
|
||||
if(!this.hasBoundTile()) this.boundTile = null;
|
||||
if(!worldObj.isRemote){
|
||||
if(!this.hasBoundTile()) this.boundTile = null;
|
||||
|
||||
if(this.tempX > 0 || this.tempY > 0 || this.tempZ > 0){
|
||||
this.boundTile = tempWorld.getTileEntity(tempX, tempY, tempZ);
|
||||
this.tempX = 0;
|
||||
this.tempY = 0;
|
||||
this.tempZ = 0;
|
||||
this.tempWorld = null;
|
||||
if(this.tempX > 0 || this.tempY > 0 || this.tempZ > 0){
|
||||
this.boundTile = tempWorld.getTileEntity(tempX, tempY, tempZ);
|
||||
this.tempX = 0;
|
||||
this.tempY = 0;
|
||||
this.tempZ = 0;
|
||||
this.tempWorld = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -49,7 +51,14 @@ public class TileEntityPhantomface extends TileEntityInventoryBase{
|
|||
}
|
||||
|
||||
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
|
||||
|
|
|
@ -5,7 +5,7 @@ import org.apache.logging.log4j.Logger;
|
|||
|
||||
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 NAME = "Actually Additions";
|
||||
|
|
|
@ -10,7 +10,6 @@ import net.minecraft.world.World;
|
|||
import net.minecraft.world.WorldServer;
|
||||
import net.minecraftforge.common.IPlantable;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.fluids.FluidContainerRegistry;
|
||||
import net.minecraftforge.fluids.FluidTank;
|
||||
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){
|
||||
if(side == ForgeDirection.UNKNOWN){
|
||||
world.setBlockToAir(x, y, z);
|
||||
return;
|
||||
}
|
||||
ChunkCoordinates c = getCoordsFromSide(side, x, y, z);
|
||||
if(c != null){
|
||||
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){
|
||||
if(world instanceof WorldServer){
|
||||
if(FluidContainerRegistry.isBucket(stack) && stack.isItemEqual(FluidContainerRegistry.EMPTY_BUCKET)){
|
||||
//if()
|
||||
return false;
|
||||
}
|
||||
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)){
|
||||
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.ordinal(), 0, 0, 0);
|
||||
}
|
||||
return stack.tryPlaceItemIntoWorld(FakePlayerUtil.newFakePlayer(world), world,x, y, z, side == ForgeDirection.UNKNOWN ? 0 : side.ordinal(), 0, 0, 0);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -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.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
|
||||
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
|
||||
|
@ -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.15.name=MISSINGNO
|
||||
|
||||
tooltip.actuallyadditions.phantom.connected.desc=<TileEntity connected to this Phantomface!>
|
||||
tooltip.actuallyadditions.phantom.stored.desc=<TileEntity stored to this Connector!>
|
||||
tooltip.actuallyadditions.phantom.connected.desc=<Block connected!>
|
||||
tooltip.actuallyadditions.phantom.stored.desc=<Block stored to this Connector!>
|
||||
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.boundTo.desc=Bound to
|
||||
tooltip.actuallyadditions.phantom.connectedBlock.desc=Connected to TileEntity 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.notConnected.desc=This Phantomface isn't connected to anything!
|
||||
tooltip.actuallyadditions.phantom.connectedBlock.desc=Connected to Block at %s, %s, %s
|
||||
tooltip.actuallyadditions.phantom.connectedNoRange.desc=Connected to Block at %s, %s, %s but it is not in Range!
|
||||
tooltip.actuallyadditions.phantom.notConnected.desc=This isn't connected to anything!
|
||||
|
||||
item.actuallyadditions.itemMiscMashedFood.name=Mashed Food
|
||||
item.actuallyadditions.itemFertilizer.name=Fertilizer
|
||||
|
@ -372,6 +380,10 @@ container.actuallyadditions.canolaPress.name=Canola Press
|
|||
container.actuallyadditions.fermentingBarrel.name=Fermenting Barrel
|
||||
container.actuallyadditions.coalGenerator.name=Coal 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.ballOfHair.name=Ball Of Hair Usage
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
"modid": "ActuallyAdditions",
|
||||
"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!",
|
||||
"version": "0.0.5.1",
|
||||
"version": "0.0.5.2",
|
||||
"mcversion": "1.7.10",
|
||||
"url": "https://github.com/Ellpeck/ActuallyAdditions",
|
||||
"updateUrl": "",
|
||||
|
|
Loading…
Reference in a new issue