Another whack of stuff with varying levels of won't break

This commit is contained in:
pahimar 2015-03-23 11:07:47 -04:00
parent 75cc883063
commit 91c6b6de6d
18 changed files with 505 additions and 34 deletions

View file

@ -177,7 +177,7 @@ public class AlchemyArray implements Comparable<AlchemyArray>
}
public void onUpdate(World world, int arrayX, int arrayY, int arrayZ)
public void onUpdate(World world, int arrayX, int arrayY, int arrayZ, int tickCount)
{
}

View file

@ -1,23 +1,29 @@
package com.pahimar.ee3.array;
import com.pahimar.ee3.EquivalentExchange3;
import com.pahimar.ee3.api.AlchemyArray;
import com.pahimar.ee3.init.ModBlocks;
import com.pahimar.ee3.network.PacketHandler;
import com.pahimar.ee3.network.message.MessageSingleParticleEvent;
import com.pahimar.ee3.reference.Names;
import com.pahimar.ee3.reference.Particles;
import com.pahimar.ee3.reference.Sounds;
import com.pahimar.ee3.reference.Textures;
import com.pahimar.ee3.reference.*;
import com.pahimar.ee3.tileentity.TileEntityAlchemyArray;
import com.pahimar.ee3.tileentity.TileEntityTransmutationTablet;
import com.pahimar.ee3.util.CommonParticleHelper;
import com.pahimar.ee3.util.CommonSoundHelper;
import cpw.mods.fml.common.network.NetworkRegistry;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
public class TransmutationAlchemyArray extends AlchemyArray
import java.util.Random;
public class TransmutationAlchemyArray extends AlchemyArray implements IInventory
{
private ItemStack[] inventory = new ItemStack[25];
public TransmutationAlchemyArray()
{
super(Textures.AlchemyArray.TRANSMUTATION_ALCHEMY_ARRAY, Names.AlchemyArrays.TRANSMUTATION_ALCHEMY_ARRAY);
@ -26,11 +32,21 @@ public class TransmutationAlchemyArray extends AlchemyArray
@Override
public void onArrayActivated(World world, int eventX, int eventY, int eventZ, int arrayX, int arrayY, int arrayZ, EntityPlayer entityPlayer, int sideHit, float hitX, float hitY, float hitZ)
{
if (!world.isRemote)
if (!entityPlayer.isSneaking())
{
entityPlayer.openGui(EquivalentExchange3.instance, GUIs.TRANSMUTATION_ARRAY.ordinal(), world, arrayX, arrayY, arrayZ);
return;
}
if (!world.isRemote && entityPlayer.isSneaking())
{
boolean successFlag = false;
if (world.getTileEntity(arrayX, arrayY, arrayZ) instanceof TileEntityAlchemyArray)
{
TileEntityAlchemyArray tileEntityAlchemyArray = (TileEntityAlchemyArray) world.getTileEntity(arrayX, arrayY, arrayZ);
// First, see if we can make a Transmutation Tablet
if (tileEntityAlchemyArray.getOrientation() == ForgeDirection.UP && tileEntityAlchemyArray.getSize() == 2 && areBlocksValidForTransmutationTablet(world, arrayX, arrayY, arrayZ))
{
world.setBlock(arrayX - 1, arrayY - 1, arrayZ - 1, ModBlocks.ashInfusedStoneSlab, 1, 3);
@ -50,8 +66,39 @@ public class TransmutationAlchemyArray extends AlchemyArray
((TileEntityTransmutationTablet) world.getTileEntity(arrayX, arrayY - 1, arrayZ)).setOrientation(tileEntityAlchemyArray.getOrientation());
}
ejectInventory(world, arrayX, arrayY, arrayZ);
successFlag = true;
}
if (successFlag)
{
CommonSoundHelper.playSoundAtLocation(world.provider.dimensionId, arrayX, arrayY, arrayZ, Sounds.TRANSMUTE, 1f, 1f);
PacketHandler.INSTANCE.sendToAllAround(new MessageSingleParticleEvent(Particles.LARGE_EXPLODE, arrayX + 0.5d, arrayY + 0.625d, arrayZ + 0.5d, 0d, 0d, 0d), new NetworkRegistry.TargetPoint(world.provider.dimensionId, (double) arrayX, (double) arrayY, (double) arrayZ, 128d));
if (tileEntityAlchemyArray.getSize() == 1)
{
CommonParticleHelper.spawnParticleAtLocation(Particles.LARGE_SMOKE, world.provider.dimensionId, arrayX + 0.5d, arrayY, arrayZ + 0.5d, 0d, 0.1d, 0d);
}
else if (tileEntityAlchemyArray.getSize() == 2)
{
for (int i = -1; i <= 1; i++)
{
for (int j = -1; j <= 1; j++)
{
CommonParticleHelper.spawnParticleAtLocation(Particles.LARGE_SMOKE, world.provider.dimensionId, arrayX + i + 0.5d, arrayY, arrayZ + j + 0.5d, 0d, 0.1d, 0d);
}
}
}
else if (tileEntityAlchemyArray.getSize() == 3)
{
for (int i = -2; i <= 2; i++)
{
for (int j = -2; j <= 2; j++)
{
CommonParticleHelper.spawnParticleAtLocation(Particles.LARGE_SMOKE, world.provider.dimensionId, arrayX + i + 0.5d, arrayY, arrayZ + j + 0.5d, 0d, 0.1d, 0d);
}
}
}
}
}
}
@ -74,4 +121,191 @@ public class TransmutationAlchemyArray extends AlchemyArray
return areBlocksValid;
}
@Override
public int getSizeInventory()
{
return inventory.length;
}
@Override
public ItemStack getStackInSlot(int slotIndex)
{
if (slotIndex < getSizeInventory())
{
return inventory[slotIndex];
}
return null;
}
@Override
public ItemStack decrStackSize(int slotIndex, int decrementAmount)
{
ItemStack itemStack = getStackInSlot(slotIndex);
if (itemStack != null)
{
if (itemStack.stackSize <= decrementAmount)
{
setInventorySlotContents(slotIndex, null);
}
else
{
itemStack = itemStack.splitStack(decrementAmount);
if (itemStack.stackSize == 0)
{
setInventorySlotContents(slotIndex, null);
}
}
}
return itemStack;
}
@Override
public ItemStack getStackInSlotOnClosing(int slotIndex)
{
ItemStack itemStack = getStackInSlot(slotIndex);
if (itemStack != null)
{
setInventorySlotContents(slotIndex, null);
}
return itemStack;
}
@Override
public void setInventorySlotContents(int slotIndex, ItemStack itemStack)
{
if (slotIndex < getSizeInventory())
{
inventory[slotIndex] = itemStack;
if (itemStack != null && itemStack.stackSize > getInventoryStackLimit())
{
itemStack.stackSize = getInventoryStackLimit();
}
}
}
@Override
public String getInventoryName()
{
return Names.AlchemyArrays.TRANSMUTATION_ALCHEMY_ARRAY;
}
@Override
public boolean hasCustomInventoryName()
{
return false;
}
@Override
public int getInventoryStackLimit()
{
return 1;
}
@Override
public void markDirty()
{
// NOOP
}
@Override
public boolean isUseableByPlayer(EntityPlayer entityPlayer)
{
return true;
}
@Override
public void openInventory()
{
// NOOP
}
@Override
public void closeInventory()
{
// NOOP
}
@Override
public boolean isItemValidForSlot(int slotIndex, ItemStack itemStack)
{
if (slotIndex < getSizeInventory())
{
return itemStack.getItem() instanceof ItemBlock;
}
return false;
}
@Override
public void readFromNBT(NBTTagCompound nbtTagCompound)
{
super.readFromNBT(nbtTagCompound);
// Read in the ItemStacks in the inventory from NBT
NBTTagList tagList = nbtTagCompound.getTagList(Names.NBT.ITEMS, 10);
inventory = new ItemStack[this.getSizeInventory()];
for (int i = 0; i < tagList.tagCount(); ++i)
{
NBTTagCompound tagCompound = tagList.getCompoundTagAt(i);
byte slotIndex = tagCompound.getByte("Slot");
if (slotIndex >= 0 && slotIndex < inventory.length)
{
inventory[slotIndex] = ItemStack.loadItemStackFromNBT(tagCompound);
}
}
}
@Override
public void writeToNBT(NBTTagCompound nbtTagCompound)
{
super.writeToNBT(nbtTagCompound);
// Write the ItemStacks in the inventory to NBT
NBTTagList tagList = new NBTTagList();
for (int currentIndex = 0; currentIndex < getSizeInventory(); ++currentIndex)
{
if (getStackInSlot(currentIndex) != null)
{
NBTTagCompound tagCompound = new NBTTagCompound();
tagCompound.setByte("Slot", (byte) currentIndex);
getStackInSlot(currentIndex).writeToNBT(tagCompound);
tagList.appendTag(tagCompound);
}
}
nbtTagCompound.setTag(Names.NBT.ITEMS, tagList);
}
protected void ejectInventory(World world, int x, int y, int z)
{
for (int i = 0; i < getSizeInventory(); i++)
{
ItemStack itemStack = getStackInSlot(i);
if (itemStack != null && itemStack.stackSize > 0)
{
Random rand = new Random();
float dX = rand.nextFloat() * 0.8F + 0.1F;
float dY = rand.nextFloat() * 0.8F + 0.1F;
float dZ = rand.nextFloat() * 0.8F + 0.1F;
EntityItem entityItem = new EntityItem(world, x + dX, y + dY, z + dZ, itemStack.copy());
if (itemStack.hasTagCompound())
{
entityItem.getEntityItem().setTagCompound((NBTTagCompound) itemStack.getTagCompound().copy());
}
float factor = 0.05F;
entityItem.motionX = rand.nextGaussian() * factor;
entityItem.motionY = rand.nextGaussian() * factor + 0.2F;
entityItem.motionZ = rand.nextGaussian() * factor;
world.spawnEntityInWorld(entityItem);
itemStack.stackSize = 0;
}
}
}
}

View file

@ -235,7 +235,7 @@ public class BlockAlchemyArray extends BlockEE implements ITileEntityProvider
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer entityPlayer, int sideHit, float hitX, float hitY, float hitZ)
{
if (world.getTileEntity(x, y, z) instanceof TileEntityAlchemyArray && !entityPlayer.isSneaking())
if (world.getTileEntity(x, y, z) instanceof TileEntityAlchemyArray)
{
((TileEntityAlchemyArray) world.getTileEntity(x, y, z)).onBlockActivated(world, x, y, z, entityPlayer, sideHit, hitX, hitY, hitZ);
}

View file

@ -0,0 +1,65 @@
package com.pahimar.ee3.client.gui.inventory;
import com.pahimar.ee3.inventory.ContainerTransmutationArray;
import com.pahimar.ee3.reference.Textures;
import com.pahimar.ee3.tileentity.TileEntityAlchemyArray;
import com.pahimar.repackage.cofh.lib.gui.GuiBase;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.entity.player.InventoryPlayer;
import org.lwjgl.opengl.GL11;
@SideOnly(Side.CLIENT)
public class GuiTransmutationArray extends GuiBase
{
private TileEntityAlchemyArray tileEntityAlchemyArray;
public GuiTransmutationArray(InventoryPlayer inventoryPlayer, TileEntityAlchemyArray tileEntityAlchemyArray)
{
super(new ContainerTransmutationArray(inventoryPlayer, tileEntityAlchemyArray));
this.tileEntityAlchemyArray = tileEntityAlchemyArray;
xSize = 256;
ySize = 256;
}
@Override
public void initGui()
{
super.initGui();
this.drawTitle = false;
this.drawInventory = false;
}
@Override
protected void drawGuiContainerForegroundLayer(int x, int y)
{
super.drawGuiContainerForegroundLayer(x, y);
}
@Override
protected void drawGuiContainerBackgroundLayer(float partialTicks, int x, int y)
{
mouseX = x - guiLeft;
mouseY = y - guiTop;
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
if (tileEntityAlchemyArray.getSize() == 1)
{
bindTexture(Textures.Gui.TRANSMUTATION_ARRAY_1);
}
else if (tileEntityAlchemyArray.getSize() == 2)
{
bindTexture(Textures.Gui.TRANSMUTATION_ARRAY_3);
}
else if (tileEntityAlchemyArray.getSize() == 3)
{
bindTexture(Textures.Gui.TRANSMUTATION_ARRAY_5);
}
drawSizedTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize, 256f, 256f);
GL11.glPushMatrix();
GL11.glTranslatef(guiLeft, guiTop, 0.0F);
drawElements(partialTicks, false);
drawTabs(partialTicks, false);
GL11.glPopMatrix();
}
}

View file

@ -4,7 +4,7 @@ import cpw.mods.fml.client.FMLClientHandler;
public class ClientParticleHelper
{
public static void spawnParticle(String particleName, double xCoord, double yCoord, double zCoord, double xVelocity, double yVelocity, double zVelocity)
public static void spawnParticleAtLocation(String particleName, double xCoord, double yCoord, double zCoord, double xVelocity, double yVelocity, double zVelocity)
{
FMLClientHandler.instance().getWorldClient().spawnParticle(particleName, xCoord, yCoord, zCoord, xVelocity, yVelocity, zVelocity);
}

View file

@ -30,7 +30,7 @@ public class ConfigurationHandler
Settings.General.syncThreshold = configuration.getInt(Messages.Configuration.GENERAL_SYNC_THRESHOLD, Configuration.CATEGORY_GENERAL, 5, 0, Short.MAX_VALUE, StatCollector.translateToLocal(Messages.Configuration.GENERAL_SYNC_THRESHOLD_COMMENT), Messages.Configuration.GENERAL_SYNC_THRESHOLD_LABEL);
Settings.Sounds.soundMode = ConfigurationHelper.getString(configuration, Messages.Configuration.SOUND_MODE, Configuration.CATEGORY_GENERAL, "All", StatCollector.translateToLocal(Messages.Configuration.SOUND_MODE_COMMENT), new String[]{"All", "Self", "None"}, Messages.Configuration.SOUND_MODE_LABEL);
Settings.Abilities.onlyLoadFile = configuration.getBoolean(Messages.Configuration.ABILITIES_ONLY_LOAD_FILE, Configuration.CATEGORY_GENERAL, false, StatCollector.translateToLocal(Messages.Configuration.ABILITIES_ONLY_LOAD_FILE_COMMENT), Messages.Configuration.ABILITIES_ONLY_LOAD_FILE_LABEL);
Settings.DynamicEnergyValueGeneration.regenerateEnergyValuesWhen = ConfigurationHelper.getString(configuration, Messages.Configuration.REGENERATE_ENERGYVALUES_WHEN, Configuration.CATEGORY_GENERAL, "When Mods Change", StatCollector.translateToLocal(Messages.Configuration.REGENERATE_ENERGYVALUES_WHEN_COMMENT), new String[]{"Never", "When Mods Change"}, Messages.Configuration.REGENERATE_ENERGYVALUES_WHEN_LABEL);
Settings.DynamicEnergyValueGeneration.regenerateEnergyValuesWhen = ConfigurationHelper.getString(configuration, Messages.Configuration.REGENERATE_ENERGYVALUES_WHEN, Configuration.CATEGORY_GENERAL, "When Mods Change", StatCollector.translateToLocal(Messages.Configuration.REGENERATE_ENERGYVALUES_WHEN_COMMENT), new String[]{"Never", "When Mods Change", "Always"}, Messages.Configuration.REGENERATE_ENERGYVALUES_WHEN_LABEL);
if (configuration.hasChanged())
{

View file

@ -56,6 +56,11 @@ public class GuiHandler implements IGuiHandler
TileEntityTransmutationTablet tileEntityTransmutationTablet = (TileEntityTransmutationTablet) world.getTileEntity(x, y, z);
return new ContainerTransmutationTablet(entityPlayer.inventory, tileEntityTransmutationTablet);
}
else if (id == GUIs.TRANSMUTATION_ARRAY.ordinal())
{
TileEntityAlchemyArray tileEntityAlchemyArray = (TileEntityAlchemyArray) world.getTileEntity(x, y, z);
return new ContainerTransmutationArray(entityPlayer.inventory, tileEntityAlchemyArray);
}
else if (id == GUIs.SYMBOL_SELECTION.ordinal())
{
return new ContainerSymbolSelection();
@ -110,6 +115,11 @@ public class GuiHandler implements IGuiHandler
TileEntityTransmutationTablet tileEntityTransmutationTablet = (TileEntityTransmutationTablet) world.getTileEntity(x, y, z);
return new GuiTransmutationTablet(entityPlayer.inventory, tileEntityTransmutationTablet);
}
else if (id == GUIs.TRANSMUTATION_ARRAY.ordinal())
{
TileEntityAlchemyArray tileEntityAlchemyArray = (TileEntityAlchemyArray) world.getTileEntity(x, y, z);
return new GuiTransmutationArray(entityPlayer.inventory, tileEntityAlchemyArray);
}
else if (id == GUIs.SYMBOL_SELECTION.ordinal())
{
return new GuiSymbolSelection();

View file

@ -0,0 +1,122 @@
package com.pahimar.ee3.inventory;
import com.pahimar.ee3.tileentity.TileEntityAlchemyArray;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
public class ContainerTransmutationArray extends ContainerEE
{
private TileEntityAlchemyArray tileEntityAlchemyArray;
public ContainerTransmutationArray(InventoryPlayer inventoryPlayer, TileEntityAlchemyArray tileEntityAlchemyArray)
{
this.tileEntityAlchemyArray = tileEntityAlchemyArray;
int maxArrayRowCount = (2 * (tileEntityAlchemyArray.getSize() - 1)) + 1;
int maxArrayColumnCount = maxArrayRowCount;
for (int rowIndex = 0; rowIndex < maxArrayRowCount; rowIndex++)
{
for (int columnIndex = 0; columnIndex < maxArrayColumnCount; columnIndex++)
{
if (tileEntityAlchemyArray.getSize() == 1)
{
this.addSlotToContainer(new Slot(tileEntityAlchemyArray, columnIndex + rowIndex * maxArrayRowCount, 120 + columnIndex * 18, 69 + rowIndex * 18)
{
@Override
public boolean isItemValid(ItemStack itemStack)
{
return itemStack.getItem() instanceof ItemBlock;
}
});
}
else if (tileEntityAlchemyArray.getSize() == 2)
{
this.addSlotToContainer(new Slot(tileEntityAlchemyArray, columnIndex + rowIndex * maxArrayRowCount, 102 + columnIndex * 18, 51 + rowIndex * 18)
{
@Override
public boolean isItemValid(ItemStack itemStack)
{
return itemStack.getItem() instanceof ItemBlock;
}
});
}
else if (tileEntityAlchemyArray.getSize() == 3)
{
this.addSlotToContainer(new Slot(tileEntityAlchemyArray, columnIndex + rowIndex * maxArrayRowCount, 84 + columnIndex * 18, 33 + rowIndex * 18)
{
@Override
public boolean isItemValid(ItemStack itemStack)
{
return itemStack.getItem() instanceof ItemBlock;
}
});
}
}
}
// Add the player's inventory slots to the container
for (int inventoryRowIndex = 0; inventoryRowIndex < PLAYER_INVENTORY_ROWS; ++inventoryRowIndex)
{
for (int inventoryColumnIndex = 0; inventoryColumnIndex < PLAYER_INVENTORY_COLUMNS; ++inventoryColumnIndex)
{
this.addSlotToContainer(new Slot(inventoryPlayer, inventoryColumnIndex + inventoryRowIndex * 9 + 9, 47 + inventoryColumnIndex * 18, 173 + inventoryRowIndex * 18));
}
}
// Add the player's action bar slots to the container
for (int actionBarSlotIndex = 0; actionBarSlotIndex < PLAYER_INVENTORY_COLUMNS; ++actionBarSlotIndex)
{
this.addSlotToContainer(new Slot(inventoryPlayer, actionBarSlotIndex, 47 + actionBarSlotIndex * 18, 231));
}
}
@Override
public ItemStack transferStackInSlot(EntityPlayer entityPlayer, int slotIndex)
{
ItemStack itemStack = null;
Slot slot = (Slot) inventorySlots.get(slotIndex);
int inventorySize = ((2 * (this.tileEntityAlchemyArray.getSize() - 1)) + 1);
inventorySize *= inventorySize;
if (slot != null && slot.getHasStack())
{
ItemStack slotItemStack = slot.getStack();
itemStack = slotItemStack.copy();
/**
* If we are shift-clicking an item out of the container,
* attempt to put it in the first available slot in the entityPlayer's
* inventory
*/
if (slotIndex < inventorySize)
{
if (!this.mergeItemStack(slotItemStack, inventorySize, inventorySlots.size(), false))
{
return null;
}
}
else
{
if (!this.mergeItemStack(slotItemStack, 0, inventorySize, false))
{
return null;
}
}
if (slotItemStack.stackSize == 0)
{
slot.putStack(null);
}
else
{
slot.onSlotChanged();
}
}
return itemStack;
}
}

View file

@ -52,7 +52,7 @@ public class ClientProxy extends CommonProxy
@Override
public void spawnParticle(String particleName, double xCoord, double yCoord, double zCoord, double xVelocity, double yVelocity, double zVelocity)
{
ClientParticleHelper.spawnParticle(particleName, xCoord, yCoord, zCoord, xVelocity, yVelocity, zVelocity);
ClientParticleHelper.spawnParticleAtLocation(particleName, xCoord, yCoord, zCoord, xVelocity, yVelocity, zVelocity);
}
@Override

View file

@ -12,5 +12,6 @@ public enum GUIs
AUGMENTATION_TABLE,
ALCHEMICAL_TOME,
TRANSMUTATION_TABLET,
SYMBOL_SELECTION
SYMBOL_SELECTION,
TRANSMUTATION_ARRAY
}

View file

@ -45,6 +45,9 @@ public final class Textures
public static final ResourceLocation AUGMENTATION_TABLE = ResourceLocationHelper.getResourceLocation(GUI_TEXTURE_LOCATION + "augmentationTable.png");
public static final ResourceLocation PORTABLE_CRAFTING = new ResourceLocation("textures/gui/container/crafting_table.png");
public static final ResourceLocation ALCHEMICAL_TOME = ResourceLocationHelper.getResourceLocation(GUI_TEXTURE_LOCATION + "alchemicalTome.png");
public static final ResourceLocation TRANSMUTATION_ARRAY_1 = ResourceLocationHelper.getResourceLocation(GUI_TEXTURE_LOCATION + "transmutationArray_1.png");
public static final ResourceLocation TRANSMUTATION_ARRAY_3 = ResourceLocationHelper.getResourceLocation(GUI_TEXTURE_LOCATION + "transmutationArray_3.png");
public static final ResourceLocation TRANSMUTATION_ARRAY_5 = ResourceLocationHelper.getResourceLocation(GUI_TEXTURE_LOCATION + "transmutationArray_5.png");
public static final ResourceLocation TRANSMUTATION_TABLET = ResourceLocationHelper.getResourceLocation(GUI_TEXTURE_LOCATION + "transmutationTablet.png");
public static final class Elements

View file

@ -9,6 +9,7 @@ import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.ISidedInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.Packet;
@ -17,12 +18,12 @@ import net.minecraft.world.Explosion;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
public class TileEntityAlchemyArray extends TileEntityEE implements IInventory
public class TileEntityAlchemyArray extends TileEntityEE implements ISidedInventory
{
private AlchemyArray alchemyArray;
private ForgeDirection rotation;
private int size;
private int ticksSinceSync;
private int tickCount;
public TileEntityAlchemyArray()
{
@ -214,8 +215,8 @@ public class TileEntityAlchemyArray extends TileEntityEE implements IInventory
if (!worldObj.isRemote)
{
++ticksSinceSync;
if (ticksSinceSync % 100 == 0)
++tickCount;
if (tickCount % 100 == 0)
{
if (!areDummyBlocksValid())
{
@ -224,7 +225,7 @@ public class TileEntityAlchemyArray extends TileEntityEE implements IInventory
}
}
onUpdate(worldObj, xCoord, yCoord, zCoord);
onUpdate(worldObj, xCoord, yCoord, zCoord, tickCount);
}
}
@ -329,11 +330,11 @@ public class TileEntityAlchemyArray extends TileEntityEE implements IInventory
}
}
public void onUpdate(World world, int x, int y, int z)
public void onUpdate(World world, int x, int y, int z, int tickCount)
{
if (alchemyArray != null)
{
alchemyArray.onUpdate(world, x, y, z);
alchemyArray.onUpdate(world, x, y, z, tickCount);
}
}
@ -358,6 +359,7 @@ public class TileEntityAlchemyArray extends TileEntityEE implements IInventory
{
Class clazz = Class.forName(alchemyArray.getClassName());
alchemyArray = (AlchemyArray) clazz.getConstructor().newInstance();
alchemyArray.readFromNBT(alchemyArrayTagCompound);
}
catch (Exception e)
{
@ -579,4 +581,22 @@ public class TileEntityAlchemyArray extends TileEntityEE implements IInventory
return false;
}
@Override
public int[] getAccessibleSlotsFromSide(int slotIndex)
{
return new int[0];
}
@Override
public boolean canInsertItem(int slotIndex, ItemStack itemStack, int side)
{
return false;
}
@Override
public boolean canExtractItem(int slotIndex, ItemStack itemStack, int side)
{
return false;
}
}

View file

@ -204,6 +204,8 @@ public class TileEntityTransmutationTablet extends TileEntityEE implements ISide
@Override
public void setInventorySlotContents(int slotIndex, ItemStack itemStack)
{
if (slotIndex < getSizeInventory())
{
inventory[slotIndex] = itemStack;
if (itemStack != null && itemStack.stackSize > getInventoryStackLimit())
@ -221,6 +223,7 @@ public class TileEntityTransmutationTablet extends TileEntityEE implements ISide
}
this.energyValue = new EnergyValue(newEnergyValue);
}
}
@Override
public String getInventoryName()

View file

@ -1,5 +1,18 @@
package com.pahimar.ee3.util;
import com.pahimar.ee3.network.PacketHandler;
import com.pahimar.ee3.network.message.MessageSingleParticleEvent;
import cpw.mods.fml.common.network.NetworkRegistry;
public class CommonParticleHelper
{
public static void spawnParticleAtLocation(String particleName, int dimensionId, double xCoord, double yCoord, double zCoord, double xVelocity, double yVelocity, double zVelocity)
{
spawnParticleAtLocation(particleName, dimensionId, xCoord, yCoord, zCoord, xVelocity, yVelocity, zVelocity, 64d);
}
public static void spawnParticleAtLocation(String particleName, int dimensionId, double xCoord, double yCoord, double zCoord, double xVelocity, double yVelocity, double zVelocity, double range)
{
PacketHandler.INSTANCE.sendToAllAround(new MessageSingleParticleEvent(particleName, xCoord, yCoord, zCoord, xVelocity, yVelocity, zVelocity), new NetworkRegistry.TargetPoint(dimensionId, xCoord, yCoord, zCoord, range));
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB