Light update network syncs properly now, and some code style cleanup
This commit is contained in:
parent
519f390c2f
commit
435cbc9164
18 changed files with 150 additions and 129 deletions
|
@ -43,7 +43,7 @@ public abstract class BlockEE extends BlockContainer {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLiving entityLiving, ItemStack itemStack) {
|
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLiving entityLiving, ItemStack itemStack) {
|
||||||
|
|
||||||
int direction = 0;
|
int direction = 0;
|
||||||
int facing = MathHelper.floor_double(entityLiving.rotationYaw * 4.0F / 360.0F + 0.5D) & 3;
|
int facing = MathHelper.floor_double(entityLiving.rotationYaw * 4.0F / 360.0F + 0.5D) & 3;
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,6 @@ package com.pahimar.ee3.block;
|
||||||
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.entity.EntityLiving;
|
import net.minecraft.entity.EntityLiving;
|
||||||
import net.minecraft.entity.item.EntityItem;
|
import net.minecraft.entity.item.EntityItem;
|
||||||
|
@ -15,7 +14,6 @@ import net.minecraft.util.MovingObjectPosition;
|
||||||
import net.minecraft.util.Vec3;
|
import net.minecraft.util.Vec3;
|
||||||
import net.minecraft.world.IBlockAccess;
|
import net.minecraft.world.IBlockAccess;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.common.ForgeDirection;
|
|
||||||
|
|
||||||
import com.pahimar.ee3.EquivalentExchange3;
|
import com.pahimar.ee3.EquivalentExchange3;
|
||||||
import com.pahimar.ee3.lib.GuiIds;
|
import com.pahimar.ee3.lib.GuiIds;
|
||||||
|
@ -88,79 +86,77 @@ public class BlockGlassBell extends BlockEE {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLiving entityLiving, ItemStack itemStack) {
|
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLiving entityLiving, ItemStack itemStack) {
|
||||||
|
|
||||||
if (itemStack.hasDisplayName()) {
|
if (itemStack.hasDisplayName()) {
|
||||||
((TileEE) world.getBlockTileEntity(x, y, z)).setCustomName(itemStack.getDisplayName());
|
((TileEE) world.getBlockTileEntity(x, y, z)).setCustomName(itemStack.getDisplayName());
|
||||||
}
|
}
|
||||||
|
|
||||||
((TileEE) world.getBlockTileEntity(x, y, z)).setOrientation(world.getBlockMetadata(x, y, z));
|
((TileEE) world.getBlockTileEntity(x, y, z)).setOrientation(world.getBlockMetadata(x, y, z));
|
||||||
|
|
||||||
|
world.setBlockMetadataWithNotify(x, y, z, 0, 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int onBlockPlaced(World world, int x, int y, int z, int sideHit, float hitX, float hitY, float hitZ, int metaData) {
|
public int onBlockPlaced(World world, int x, int y, int z, int sideHit, float hitX, float hitY, float hitZ, int metaData) {
|
||||||
|
|
||||||
return sideHit;
|
return sideHit;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Ray traces through the blocks collision from start vector to end vector returning a ray trace hit. Args: world,
|
* Ray traces through the blocks collision from start vector to end vector
|
||||||
* x, y, z, startVec, endVec
|
* returning a ray trace hit. Args: world, x, y, z, startVec, endVec
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public MovingObjectPosition collisionRayTrace(World world, int x, int y, int z, Vec3 startVec, Vec3 endVec)
|
public MovingObjectPosition collisionRayTrace(World world, int x, int y, int z, Vec3 startVec, Vec3 endVec) {
|
||||||
{
|
TileEntity tileEntity = world.getBlockTileEntity(x, y, z);
|
||||||
int metaData = world.getBlockMetadata(x, y, z) & 7;
|
|
||||||
|
|
||||||
switch (ForgeDirection.getOrientation(metaData)) {
|
if (tileEntity != null) {
|
||||||
case DOWN: {
|
if (tileEntity instanceof TileGlassBell) {
|
||||||
this.setBlockBounds(0.125F, 0.33F, 0.125F, 0.875F, 1.0F, 0.875F);
|
|
||||||
break;
|
TileGlassBell tileGlassBell = (TileGlassBell) tileEntity;
|
||||||
}
|
|
||||||
case UP: {
|
switch (tileGlassBell.getOrientation()) {
|
||||||
this.setBlockBounds(0.125F, 0.0F, 0.125F, 0.875F, 0.66F, 0.875F);
|
case DOWN: {
|
||||||
break;
|
this.setBlockBounds(0.125F, 0.33F, 0.125F, 0.875F, 1.0F, 0.875F);
|
||||||
}
|
break;
|
||||||
case NORTH: {
|
}
|
||||||
this.setBlockBounds(0.125F, 0.125F, 0.33F, 0.875F, 0.875F, 1.0F);
|
case UP: {
|
||||||
break;
|
this.setBlockBounds(0.125F, 0.0F, 0.125F, 0.875F, 0.66F, 0.875F);
|
||||||
}
|
break;
|
||||||
case SOUTH: {
|
}
|
||||||
this.setBlockBounds(0.125F, 0.125F, 0.0F, 0.875F, 0.875F, 0.66F);
|
case NORTH: {
|
||||||
break;
|
this.setBlockBounds(0.125F, 0.125F, 0.33F, 0.875F, 0.875F, 1.0F);
|
||||||
}
|
break;
|
||||||
case EAST: {
|
}
|
||||||
this.setBlockBounds(0.0F, 0.125F, 0.125F, 0.66F, 0.875F, 0.875F);
|
case SOUTH: {
|
||||||
break;
|
this.setBlockBounds(0.125F, 0.125F, 0.0F, 0.875F, 0.875F, 0.66F);
|
||||||
}
|
break;
|
||||||
case WEST: {
|
}
|
||||||
this.setBlockBounds(0.33F, 0.125F, 0.125F, 1.0F, 0.875F, 0.875F);
|
case EAST: {
|
||||||
break;
|
this.setBlockBounds(0.0F, 0.125F, 0.125F, 0.66F, 0.875F, 0.875F);
|
||||||
}
|
break;
|
||||||
case UNKNOWN: {
|
}
|
||||||
break;
|
case WEST: {
|
||||||
|
this.setBlockBounds(0.33F, 0.125F, 0.125F, 1.0F, 0.875F, 0.875F);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case UNKNOWN: {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return super.collisionRayTrace(world, x, y, z, startVec, endVec);
|
return super.collisionRayTrace(world, x, y, z, startVec, endVec);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getLightValue(IBlockAccess world, int x, int y, int z) {
|
public int getLightValue(IBlockAccess world, int x, int y, int z) {
|
||||||
|
|
||||||
TileGlassBell tileGlassBell = (TileGlassBell) world.getBlockTileEntity(x, y, z);
|
return world.getBlockMetadata(x, y, z);
|
||||||
|
|
||||||
if (tileGlassBell != null) {
|
|
||||||
if (tileGlassBell.getStackInSlot(0) != null) {
|
|
||||||
if (tileGlassBell.getStackInSlot(0).itemID < 4096) {
|
|
||||||
return Block.lightValue[tileGlassBell.getStackInSlot(0).itemID];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void dropInventory(World world, int x, int y, int z) {
|
private void dropInventory(World world, int x, int y, int z) {
|
||||||
|
@ -196,5 +192,4 @@ public class BlockGlassBell extends BlockEE {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,7 +49,7 @@ public class ModBlocks {
|
||||||
|
|
||||||
private static void initBlockRecipes() {
|
private static void initBlockRecipes() {
|
||||||
|
|
||||||
GameRegistry.addRecipe(new ItemStack(glassBell), new Object[] {"iii", "i i", "i i", Character.valueOf('i'), Block.glass });
|
GameRegistry.addRecipe(new ItemStack(glassBell), new Object[] { "iii", "i i", "i i", Character.valueOf('i'), Block.glass });
|
||||||
GameRegistry.addRecipe(new ItemStack(aludelBase), new Object[] {"iii", "sis", "iii", Character.valueOf('i'), Item.ingotIron, Character.valueOf('s'), Block.stone });
|
GameRegistry.addRecipe(new ItemStack(aludelBase), new Object[] { "iii", "sis", "iii", Character.valueOf('i'), Item.ingotIron, Character.valueOf('s'), Block.stone });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,8 @@ import cpw.mods.fml.relauncher.SideOnly;
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public class TileEntityAlchemicalChestRenderer extends TileEntitySpecialRenderer {
|
public class TileEntityAlchemicalChestRenderer extends
|
||||||
|
TileEntitySpecialRenderer {
|
||||||
|
|
||||||
private ModelChest modelChest = new ModelChest();
|
private ModelChest modelChest = new ModelChest();
|
||||||
|
|
||||||
|
|
|
@ -53,7 +53,7 @@ public class TileEntityGlassBellRenderer extends TileEntitySpecialRenderer {
|
||||||
|
|
||||||
if (tileEntity instanceof TileGlassBell) {
|
if (tileEntity instanceof TileGlassBell) {
|
||||||
TileGlassBell tileGlassBell = (TileGlassBell) tileEntity;
|
TileGlassBell tileGlassBell = (TileGlassBell) tileEntity;
|
||||||
|
|
||||||
GL11.glDisable(GL11.GL_LIGHTING);
|
GL11.glDisable(GL11.GL_LIGHTING);
|
||||||
GL11.glDisable(GL11.GL_CULL_FACE);
|
GL11.glDisable(GL11.GL_CULL_FACE);
|
||||||
|
|
||||||
|
@ -76,14 +76,14 @@ public class TileEntityGlassBellRenderer extends TileEntitySpecialRenderer {
|
||||||
* Render the ghost item inside of the Glass Bell, slowly spinning
|
* Render the ghost item inside of the Glass Bell, slowly spinning
|
||||||
*/
|
*/
|
||||||
GL11.glPushMatrix();
|
GL11.glPushMatrix();
|
||||||
|
|
||||||
for (int i = 0; i < tileGlassBell.getSizeInventory(); i++) {
|
for (int i = 0; i < tileGlassBell.getSizeInventory(); i++) {
|
||||||
|
|
||||||
if (tileGlassBell.getStackInSlot(i) != null) {
|
if (tileGlassBell.getStackInSlot(i) != null) {
|
||||||
|
|
||||||
float scaleFactor = getGhostItemScaleFactor(tileGlassBell.getStackInSlot(i));
|
float scaleFactor = getGhostItemScaleFactor(tileGlassBell.getStackInSlot(i));
|
||||||
float rotationAngle = (float) (720.0 * (double) (System.currentTimeMillis() & 0x3FFFL) / (double) 0x3FFFL);
|
float rotationAngle = (float) (720.0 * (System.currentTimeMillis() & 0x3FFFL) / 0x3FFFL);
|
||||||
|
|
||||||
EntityItem ghostEntityItem = new EntityItem(tileGlassBell.worldObj);
|
EntityItem ghostEntityItem = new EntityItem(tileGlassBell.worldObj);
|
||||||
ghostEntityItem.hoverStart = 0.0F;
|
ghostEntityItem.hoverStart = 0.0F;
|
||||||
ghostEntityItem.setEntityItemStack(tileGlassBell.getStackInSlot(i));
|
ghostEntityItem.setEntityItemStack(tileGlassBell.getStackInSlot(i));
|
||||||
|
@ -91,20 +91,20 @@ public class TileEntityGlassBellRenderer extends TileEntitySpecialRenderer {
|
||||||
translateGhostItemByOrientation(ghostEntityItem.getEntityItem(), x, y, z, tileGlassBell.getOrientation());
|
translateGhostItemByOrientation(ghostEntityItem.getEntityItem(), x, y, z, tileGlassBell.getOrientation());
|
||||||
GL11.glScalef(scaleFactor, scaleFactor, scaleFactor);
|
GL11.glScalef(scaleFactor, scaleFactor, scaleFactor);
|
||||||
GL11.glRotatef(rotationAngle, 0.0F, 1.0F, 0.0F);
|
GL11.glRotatef(rotationAngle, 0.0F, 1.0F, 0.0F);
|
||||||
|
|
||||||
customRenderItem.doRenderItem(ghostEntityItem, 0, 0, 0, 0, 0);
|
customRenderItem.doRenderItem(ghostEntityItem, 0, 0, 0, 0, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
GL11.glPopMatrix();
|
GL11.glPopMatrix();
|
||||||
|
|
||||||
GL11.glEnable(GL11.GL_CULL_FACE);
|
GL11.glEnable(GL11.GL_CULL_FACE);
|
||||||
GL11.glEnable(GL11.GL_LIGHTING);
|
GL11.glEnable(GL11.GL_LIGHTING);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void renderGlassBellByOrientation(double x, double y, double z, ForgeDirection forgeDirection) {
|
private void renderGlassBellByOrientation(double x, double y, double z, ForgeDirection forgeDirection) {
|
||||||
|
|
||||||
switch (forgeDirection) {
|
switch (forgeDirection) {
|
||||||
case DOWN: {
|
case DOWN: {
|
||||||
GL11.glScalef(1.0F, 1.0F, 1.0F);
|
GL11.glScalef(1.0F, 1.0F, 1.0F);
|
||||||
|
@ -151,9 +151,9 @@ public class TileEntityGlassBellRenderer extends TileEntitySpecialRenderer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void translateGhostItemByOrientation(ItemStack ghostItemStack, double x, double y, double z, ForgeDirection forgeDirection) {
|
private void translateGhostItemByOrientation(ItemStack ghostItemStack, double x, double y, double z, ForgeDirection forgeDirection) {
|
||||||
|
|
||||||
if (ghostItemStack != null) {
|
if (ghostItemStack != null) {
|
||||||
if (ghostItemStack.getItem() instanceof ItemBlock) {
|
if (ghostItemStack.getItem() instanceof ItemBlock) {
|
||||||
switch (forgeDirection) {
|
switch (forgeDirection) {
|
||||||
|
@ -225,32 +225,43 @@ public class TileEntityGlassBellRenderer extends TileEntitySpecialRenderer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private float getGhostItemScaleFactor(ItemStack itemStack) {
|
private float getGhostItemScaleFactor(ItemStack itemStack) {
|
||||||
float scaleFactor = 1.0F;
|
float scaleFactor = 1.0F;
|
||||||
|
|
||||||
if (itemStack != null) {
|
if (itemStack != null) {
|
||||||
if (itemStack.getItem() instanceof ItemBlock) {
|
if (itemStack.getItem() instanceof ItemBlock) {
|
||||||
switch (customRenderItem.getMiniBlockCount(itemStack)) {
|
switch (customRenderItem.getMiniBlockCount(itemStack)) {
|
||||||
case 1: return 0.90F;
|
case 1:
|
||||||
case 2: return 0.90F;
|
return 0.90F;
|
||||||
case 3: return 0.90F;
|
case 2:
|
||||||
case 4: return 0.90F;
|
return 0.90F;
|
||||||
case 5: return 0.80F;
|
case 3:
|
||||||
default: return 0.90F;
|
return 0.90F;
|
||||||
|
case 4:
|
||||||
|
return 0.90F;
|
||||||
|
case 5:
|
||||||
|
return 0.80F;
|
||||||
|
default:
|
||||||
|
return 0.90F;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
switch (customRenderItem.getMiniItemCount(itemStack)) {
|
switch (customRenderItem.getMiniItemCount(itemStack)) {
|
||||||
case 1: return 0.65F;
|
case 1:
|
||||||
case 2: return 0.65F;
|
return 0.65F;
|
||||||
case 3: return 0.65F;
|
case 2:
|
||||||
case 4: return 0.65F;
|
return 0.65F;
|
||||||
default: return 0.65F;
|
case 3:
|
||||||
|
return 0.65F;
|
||||||
|
case 4:
|
||||||
|
return 0.65F;
|
||||||
|
default:
|
||||||
|
return 0.65F;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return scaleFactor;
|
return scaleFactor;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,7 +39,7 @@ public class DrawBlockHighlightHandler {
|
||||||
public void onDrawBlockHighlightEvent(DrawBlockHighlightEvent event) {
|
public void onDrawBlockHighlightEvent(DrawBlockHighlightEvent event) {
|
||||||
|
|
||||||
Minecraft minecraft = FMLClientHandler.instance().getClient();
|
Minecraft minecraft = FMLClientHandler.instance().getClient();
|
||||||
|
|
||||||
if (event.currentItem != null) {
|
if (event.currentItem != null) {
|
||||||
if (event.currentItem.getItem() instanceof ITransmutationStone) {
|
if (event.currentItem.getItem() instanceof ITransmutationStone) {
|
||||||
if (event.target.typeOfHit == EnumMovingObjectType.TILE) {
|
if (event.target.typeOfHit == EnumMovingObjectType.TILE) {
|
||||||
|
|
|
@ -1,10 +1,12 @@
|
||||||
package com.pahimar.ee3.core.handlers;
|
package com.pahimar.ee3.core.handlers;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.logging.Level;
|
||||||
|
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
import com.pahimar.ee3.core.helper.GeneralHelper;
|
import com.pahimar.ee3.core.helper.GeneralHelper;
|
||||||
|
import com.pahimar.ee3.core.helper.LogHelper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Equivalent-Exchange-3
|
* Equivalent-Exchange-3
|
||||||
|
@ -246,7 +248,7 @@ public class EquivalencyHandler {
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (ArrayList<ItemStack> list : equivalencyList) {
|
for (ArrayList<ItemStack> list : equivalencyList) {
|
||||||
System.out.println("equivalencyList[" + i + "]: " + list.toString());
|
LogHelper.log(Level.INFO, "equivalencyList[" + i + "]: " + list.toString());
|
||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,12 +23,12 @@ public class ItemHelper {
|
||||||
private static double rand;
|
private static double rand;
|
||||||
|
|
||||||
public static boolean hasColor(ItemStack itemStack) {
|
public static boolean hasColor(ItemStack itemStack) {
|
||||||
|
|
||||||
return !itemStack.hasTagCompound() ? false : !itemStack.getTagCompound().hasKey(Strings.NBT_ITEM_DISPLAY) ? false : itemStack.getTagCompound().getCompoundTag(Strings.NBT_ITEM_DISPLAY).hasKey(Strings.NBT_ITEM_COLOR);
|
return !itemStack.hasTagCompound() ? false : !itemStack.getTagCompound().hasKey(Strings.NBT_ITEM_DISPLAY) ? false : itemStack.getTagCompound().getCompoundTag(Strings.NBT_ITEM_DISPLAY).hasKey(Strings.NBT_ITEM_COLOR);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int getColor(ItemStack itemStack) {
|
public static int getColor(ItemStack itemStack) {
|
||||||
|
|
||||||
NBTTagCompound nbtTagCompound = itemStack.getTagCompound();
|
NBTTagCompound nbtTagCompound = itemStack.getTagCompound();
|
||||||
|
|
||||||
if (nbtTagCompound == null)
|
if (nbtTagCompound == null)
|
||||||
|
@ -39,9 +39,9 @@ public class ItemHelper {
|
||||||
return displayTagCompound == null ? Integer.parseInt(Colours.PURE_WHITE, 16) : displayTagCompound.hasKey(Strings.NBT_ITEM_COLOR) ? displayTagCompound.getInteger(Strings.NBT_ITEM_COLOR) : Integer.parseInt(Colours.PURE_WHITE, 16);
|
return displayTagCompound == null ? Integer.parseInt(Colours.PURE_WHITE, 16) : displayTagCompound.hasKey(Strings.NBT_ITEM_COLOR) ? displayTagCompound.getInteger(Strings.NBT_ITEM_COLOR) : Integer.parseInt(Colours.PURE_WHITE, 16);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setColor(ItemStack itemStack, int color) {
|
public static void setColor(ItemStack itemStack, int color) {
|
||||||
|
|
||||||
if (itemStack != null) {
|
if (itemStack != null) {
|
||||||
|
|
||||||
NBTTagCompound nbtTagCompound = itemStack.getTagCompound();
|
NBTTagCompound nbtTagCompound = itemStack.getTagCompound();
|
||||||
|
@ -61,7 +61,7 @@ public class ItemHelper {
|
||||||
colourTagCompound.setInteger(Strings.NBT_ITEM_COLOR, color);
|
colourTagCompound.setInteger(Strings.NBT_ITEM_COLOR, color);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void dropMiniumShard(EntityPlayer player, EntityLiving entity) {
|
public static void dropMiniumShard(EntityPlayer player, EntityLiving entity) {
|
||||||
|
|
||||||
if (GeneralHelper.isHostileEntity(entity)) {
|
if (GeneralHelper.isHostileEntity(entity)) {
|
||||||
|
|
|
@ -114,12 +114,10 @@ public class VersionHelper implements Runnable {
|
||||||
|
|
||||||
String[] versionTokens = Reference.VERSION_NUMBER.split(" ");
|
String[] versionTokens = Reference.VERSION_NUMBER.split(" ");
|
||||||
|
|
||||||
if (versionTokens.length >= 1) {
|
if (versionTokens.length >= 1)
|
||||||
return versionTokens[0];
|
return versionTokens[0];
|
||||||
}
|
else
|
||||||
else {
|
|
||||||
return Reference.VERSION_NUMBER;
|
return Reference.VERSION_NUMBER;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void logResult() {
|
public static void logResult() {
|
||||||
|
|
|
@ -27,6 +27,7 @@ import com.pahimar.ee3.core.helper.TransmutationHelper;
|
||||||
import com.pahimar.ee3.item.IChargeable;
|
import com.pahimar.ee3.item.IChargeable;
|
||||||
import com.pahimar.ee3.lib.ActionTypes;
|
import com.pahimar.ee3.lib.ActionTypes;
|
||||||
import com.pahimar.ee3.lib.BlockIds;
|
import com.pahimar.ee3.lib.BlockIds;
|
||||||
|
import com.pahimar.ee3.lib.Colours;
|
||||||
import com.pahimar.ee3.lib.RenderIds;
|
import com.pahimar.ee3.lib.RenderIds;
|
||||||
import com.pahimar.ee3.network.PacketTypeHandler;
|
import com.pahimar.ee3.network.PacketTypeHandler;
|
||||||
import com.pahimar.ee3.network.packet.PacketRequestEvent;
|
import com.pahimar.ee3.network.packet.PacketRequestEvent;
|
||||||
|
@ -130,21 +131,25 @@ public class ClientProxy extends CommonProxy {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handleTileWithItemPacket(int x, int y, int z, ForgeDirection orientation, byte state, String customName, int itemID, int metaData, int stackSize, int color) {
|
public void handleTileWithItemPacket(int x, int y, int z, ForgeDirection orientation, byte state, String customName, int itemID, int metaData, int stackSize, int color) {
|
||||||
|
|
||||||
TileEntity tileEntity = FMLClientHandler.instance().getClient().theWorld.getBlockTileEntity(x, y, z);
|
World world = FMLClientHandler.instance().getClient().theWorld;
|
||||||
|
TileEntity tileEntity = world.getBlockTileEntity(x, y, z);
|
||||||
|
|
||||||
this.handleTileEntityPacket(x, y, z, orientation, state, customName);
|
this.handleTileEntityPacket(x, y, z, orientation, state, customName);
|
||||||
|
|
||||||
if (tileEntity != null) {
|
if (tileEntity != null) {
|
||||||
if (tileEntity instanceof TileGlassBell) {
|
if (tileEntity instanceof TileGlassBell) {
|
||||||
|
|
||||||
ItemStack itemStack = new ItemStack(itemID, stackSize, metaData);
|
ItemStack itemStack = new ItemStack(itemID, stackSize, metaData);
|
||||||
ItemHelper.setColor(itemStack, color);
|
if (color != Integer.parseInt(Colours.PURE_WHITE, 16)) {
|
||||||
|
ItemHelper.setColor(itemStack, color);
|
||||||
|
}
|
||||||
|
|
||||||
((TileGlassBell) tileEntity).setInventorySlotContents(0, itemStack);
|
((TileGlassBell) tileEntity).setInventorySlotContents(0, itemStack);
|
||||||
|
world.updateAllLightTypes(x, y, z);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,9 +83,9 @@ public class CommonProxy implements IGuiHandler {
|
||||||
public void handleTileEntityPacket(int x, int y, int z, ForgeDirection orientation, byte state, String customName) {
|
public void handleTileEntityPacket(int x, int y, int z, ForgeDirection orientation, byte state, String customName) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void handleTileWithItemPacket(int x, int y, int z, ForgeDirection orientation, byte state, String customName, int itemID, int metaData, int stackSize, int color) {
|
public void handleTileWithItemPacket(int x, int y, int z, ForgeDirection orientation, byte state, String customName, int itemID, int metaData, int stackSize, int color) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -24,7 +24,8 @@ import cpw.mods.fml.relauncher.SideOnly;
|
||||||
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
|
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class ItemMiniumStone extends ItemEE implements ITransmutationStone, IKeyBound {
|
public class ItemMiniumStone extends ItemEE
|
||||||
|
implements ITransmutationStone, IKeyBound {
|
||||||
|
|
||||||
public ItemMiniumStone(int id) {
|
public ItemMiniumStone(int id) {
|
||||||
|
|
||||||
|
|
|
@ -11,9 +11,8 @@ package com.pahimar.ee3.lib;
|
||||||
*/
|
*/
|
||||||
public class Localizations {
|
public class Localizations {
|
||||||
|
|
||||||
private static final String LANG_RESOURCE_LOCATION = "/mods/ee3/lang/";
|
private static final String LANG_RESOURCE_LOCATION = "/mods/ee3/lang/";
|
||||||
|
|
||||||
public static String[] localeFiles = {
|
public static String[] localeFiles = { LANG_RESOURCE_LOCATION + "cs_CZ.xml", LANG_RESOURCE_LOCATION + "cy_GB.xml", LANG_RESOURCE_LOCATION + "da_DK.xml", LANG_RESOURCE_LOCATION + "de_DE.xml", LANG_RESOURCE_LOCATION + "en_US.xml", LANG_RESOURCE_LOCATION + "es_ES.xml", LANG_RESOURCE_LOCATION + "fi_FI.xml", LANG_RESOURCE_LOCATION + "fr_FR.xml", LANG_RESOURCE_LOCATION + "it_IT.xml", LANG_RESOURCE_LOCATION + "ja_JP.xml", LANG_RESOURCE_LOCATION + "la_IT.xml", LANG_RESOURCE_LOCATION + "nl_NL.xml", LANG_RESOURCE_LOCATION + "nb_NO.xml", LANG_RESOURCE_LOCATION + "pl_PL.xml", LANG_RESOURCE_LOCATION + "pt_BR.xml", LANG_RESOURCE_LOCATION + "pt_PT.xml", LANG_RESOURCE_LOCATION + "ru_RU.xml", LANG_RESOURCE_LOCATION + "sk_SK.xml", LANG_RESOURCE_LOCATION + "sr_RS.xml", LANG_RESOURCE_LOCATION + "sv_SE.xml", LANG_RESOURCE_LOCATION + "tr_TR.xml", LANG_RESOURCE_LOCATION + "zh_CN.xml", LANG_RESOURCE_LOCATION + "zh_TW.xml", LANG_RESOURCE_LOCATION + "el_GR.xml" };
|
||||||
LANG_RESOURCE_LOCATION + "cs_CZ.xml", LANG_RESOURCE_LOCATION + "cy_GB.xml", LANG_RESOURCE_LOCATION + "da_DK.xml", LANG_RESOURCE_LOCATION + "de_DE.xml", LANG_RESOURCE_LOCATION + "en_US.xml", LANG_RESOURCE_LOCATION + "es_ES.xml", LANG_RESOURCE_LOCATION + "fi_FI.xml", LANG_RESOURCE_LOCATION + "fr_FR.xml", LANG_RESOURCE_LOCATION + "it_IT.xml", LANG_RESOURCE_LOCATION + "ja_JP.xml", LANG_RESOURCE_LOCATION + "la_IT.xml", LANG_RESOURCE_LOCATION + "nl_NL.xml", LANG_RESOURCE_LOCATION + "nb_NO.xml", LANG_RESOURCE_LOCATION + "pl_PL.xml", LANG_RESOURCE_LOCATION + "pt_BR.xml", LANG_RESOURCE_LOCATION + "pt_PT.xml", LANG_RESOURCE_LOCATION + "ru_RU.xml", LANG_RESOURCE_LOCATION + "sk_SK.xml", LANG_RESOURCE_LOCATION + "sr_RS.xml", LANG_RESOURCE_LOCATION + "sv_SE.xml", LANG_RESOURCE_LOCATION + "tr_TR.xml", LANG_RESOURCE_LOCATION + "zh_CN.xml", LANG_RESOURCE_LOCATION + "zh_TW.xml", LANG_RESOURCE_LOCATION + "el_GR.xml"};
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,7 +52,7 @@ public class Strings {
|
||||||
public static final String INERT_STONE_NAME = "stoneInert";
|
public static final String INERT_STONE_NAME = "stoneInert";
|
||||||
public static final String MINIUM_STONE_NAME = "stoneMinium";
|
public static final String MINIUM_STONE_NAME = "stoneMinium";
|
||||||
public static final String PHILOSOPHERS_STONE_NAME = "stonePhilosophers";
|
public static final String PHILOSOPHERS_STONE_NAME = "stonePhilosophers";
|
||||||
public static final String ALCHEMICAL_DUST_NAME = "alchemicalDust";
|
public static final String ALCHEMICAL_DUST_NAME = "alchemicalDust";
|
||||||
public static final String ALCHEMICAL_BAG_NAME = "alchemicalBag";
|
public static final String ALCHEMICAL_BAG_NAME = "alchemicalBag";
|
||||||
|
|
||||||
/* TileEntity name constants */
|
/* TileEntity name constants */
|
||||||
|
|
|
@ -26,12 +26,12 @@ import com.pahimar.ee3.network.packet.PacketTileWithItemUpdate;
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public enum PacketTypeHandler {
|
public enum PacketTypeHandler {
|
||||||
KEY(PacketKeyPressed.class),
|
KEY(PacketKeyPressed.class),
|
||||||
TILE(PacketTileUpdate.class),
|
TILE(PacketTileUpdate.class),
|
||||||
REQUEST_EVENT(PacketRequestEvent.class),
|
REQUEST_EVENT(PacketRequestEvent.class),
|
||||||
SPAWN_PARTICLE(PacketSpawnParticle.class),
|
SPAWN_PARTICLE(PacketSpawnParticle.class),
|
||||||
SOUND_EVENT(PacketSoundEvent.class),
|
SOUND_EVENT(PacketSoundEvent.class),
|
||||||
ITEM_UPDATE(PacketItemUpdate.class),
|
ITEM_UPDATE(PacketItemUpdate.class),
|
||||||
TILE_WITH_ITEM(PacketTileWithItemUpdate.class);
|
TILE_WITH_ITEM(PacketTileWithItemUpdate.class);
|
||||||
|
|
||||||
private Class<? extends PacketEE> clazz;
|
private Class<? extends PacketEE> clazz;
|
||||||
|
|
|
@ -69,7 +69,6 @@ public class PacketTileUpdate extends PacketEE {
|
||||||
@Override
|
@Override
|
||||||
public void execute(INetworkManager manager, Player player) {
|
public void execute(INetworkManager manager, Player player) {
|
||||||
|
|
||||||
System.out.println("PacketTileUpdate - Execute");
|
|
||||||
EquivalentExchange3.proxy.handleTileEntityPacket(x, y, z, ForgeDirection.getOrientation(orientation), state, customName);
|
EquivalentExchange3.proxy.handleTileEntityPacket(x, y, z, ForgeDirection.getOrientation(orientation), state, customName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,22 +12,21 @@ import com.pahimar.ee3.network.PacketTypeHandler;
|
||||||
|
|
||||||
import cpw.mods.fml.common.network.Player;
|
import cpw.mods.fml.common.network.Player;
|
||||||
|
|
||||||
|
|
||||||
public class PacketTileWithItemUpdate extends PacketEE {
|
public class PacketTileWithItemUpdate extends PacketEE {
|
||||||
|
|
||||||
public int x, y, z;
|
public int x, y, z;
|
||||||
public byte orientation;
|
public byte orientation;
|
||||||
public byte state;
|
public byte state;
|
||||||
public String customName;
|
public String customName;
|
||||||
public int itemID, metaData, stackSize, color;
|
public int itemID, metaData, stackSize, color;
|
||||||
|
|
||||||
public PacketTileWithItemUpdate() {
|
public PacketTileWithItemUpdate() {
|
||||||
|
|
||||||
super(PacketTypeHandler.TILE_WITH_ITEM, true);
|
super(PacketTypeHandler.TILE_WITH_ITEM, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public PacketTileWithItemUpdate(int x, int y, int z, ForgeDirection orientation, byte state, String customName, int itemID, int metaData, int stackSize, int color) {
|
public PacketTileWithItemUpdate(int x, int y, int z, ForgeDirection orientation, byte state, String customName, int itemID, int metaData, int stackSize, int color) {
|
||||||
|
|
||||||
super(PacketTypeHandler.TILE_WITH_ITEM, true);
|
super(PacketTypeHandler.TILE_WITH_ITEM, true);
|
||||||
this.x = x;
|
this.x = x;
|
||||||
this.y = y;
|
this.y = y;
|
||||||
|
@ -40,7 +39,7 @@ public class PacketTileWithItemUpdate extends PacketEE {
|
||||||
this.stackSize = stackSize;
|
this.stackSize = stackSize;
|
||||||
this.color = color;
|
this.color = color;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void writeData(DataOutputStream data) throws IOException {
|
public void writeData(DataOutputStream data) throws IOException {
|
||||||
|
|
||||||
|
@ -74,7 +73,6 @@ public class PacketTileWithItemUpdate extends PacketEE {
|
||||||
@Override
|
@Override
|
||||||
public void execute(INetworkManager manager, Player player) {
|
public void execute(INetworkManager manager, Player player) {
|
||||||
|
|
||||||
System.out.println("PacketTileWithItemUpdate - Execute");
|
|
||||||
EquivalentExchange3.proxy.handleTileWithItemPacket(x, y, z, ForgeDirection.getOrientation(orientation), state, customName, itemID, metaData, stackSize, color);
|
EquivalentExchange3.proxy.handleTileWithItemPacket(x, y, z, ForgeDirection.getOrientation(orientation), state, customName, itemID, metaData, stackSize, color);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package com.pahimar.ee3.tileentity;
|
package com.pahimar.ee3.tileentity;
|
||||||
|
|
||||||
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.inventory.IInventory;
|
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;
|
||||||
|
@ -100,14 +101,14 @@ public class TileGlassBell extends TileEE implements IInventory {
|
||||||
public void closeChest() {
|
public void closeChest() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemStack getGhostItemStack() {
|
public ItemStack getGhostItemStack() {
|
||||||
|
|
||||||
return ghostItemStack;
|
return ghostItemStack;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setGhostItemStack(ItemStack ghostItemStack) {
|
public void setGhostItemStack(ItemStack ghostItemStack) {
|
||||||
|
|
||||||
this.ghostItemStack = ghostItemStack;
|
this.ghostItemStack = ghostItemStack;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -157,15 +158,26 @@ public class TileGlassBell extends TileEE implements IInventory {
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Packet getDescriptionPacket() {
|
public Packet getDescriptionPacket() {
|
||||||
|
|
||||||
if ((inventory[0] != null) && (inventory[0].stackSize > 0)) {
|
if (inventory[0] != null && inventory[0].stackSize > 0)
|
||||||
return PacketTypeHandler.populatePacket(new PacketTileWithItemUpdate(xCoord, yCoord, zCoord, orientation, state, customName, inventory[0].itemID, inventory[0].getItemDamage(), inventory[0].stackSize, ItemHelper.getColor(inventory[0])));
|
return PacketTypeHandler.populatePacket(new PacketTileWithItemUpdate(xCoord, yCoord, zCoord, orientation, state, customName, inventory[0].itemID, inventory[0].getItemDamage(), inventory[0].stackSize, ItemHelper.getColor(inventory[0])));
|
||||||
|
else
|
||||||
|
return super.getDescriptionPacket();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onInventoryChanged() {
|
||||||
|
|
||||||
|
if (inventory[0] != null) {
|
||||||
|
if (inventory[0].itemID < 4096) {
|
||||||
|
worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, Block.lightValue[inventory[0].itemID], 2);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return super.getDescriptionPacket();
|
worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, 0, 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue