Merge remote-tracking branch 'origin/master' into local

This commit is contained in:
Robotic-Brain 2013-04-20 11:20:24 +02:00
commit 1bf5bd3a0e
45 changed files with 841 additions and 303 deletions

View file

@ -1,25 +1,28 @@
<?xml version="1.0" ?>
<project name="Equivalent Exchange 3">
<project name="Equivalent Exchange 3" default="build">
<property file="build.properties" prefix="build"/>
<property file="build_number.properties" prefix="build_number"/>
<target name="increment">
<target name="clean">
<delete file="${build.dir.development}\mcp\src\minecraft\mcmod.info" />
<delete dir="${build.dir.development}\mcp\src\minecraft\com\pahimar" />
<delete dir="${build.dir.development}\mcp\reobf\minecraft" />
</target>
<target name="increment_build_number">
<propertyfile file="build_number.properties">
<entry key="build_number" type="int" operation="+" default="1"/>
</propertyfile>
</target>
<target name="clean">
<delete file="${build.dir.development}\mcp\src\minecraft\mcmod.info" />
<delete dir="${build.dir.development}\mcp\src\minecraft\com" />
<delete dir="${build.dir.development}\mcp\reobf\minecraft" />
</target>
<target name="build">
<target name="prep">
<copy todir="${build.dir.development}\mcp\src\minecraft">
<fileset dir="${build.dir.development}\source\Equivalent-Exchange-3\ee3_common\" />
</copy>
</target>
<target name="replace_tokens">
<replace dir="${build.dir.development}\mcp\src\minecraft" token="@VERSION@" value="${build.release.mod.version}" />
<replace dir="${build.dir.development}\mcp\src\minecraft" token="@FINGERPRINT@" value="${build.release.mod.fingerprint}" />
<replace dir="${build.dir.development}\mcp\src\minecraft" token="@BUILD_NUMBER@" value="${build_number.build_number}" />
@ -43,31 +46,15 @@
</exec>
</target>
<target name="release-shared">
<!-- Prep for the release -->
<antcall target="increment" />
<antcall target="clean" />
<antcall target="build" />
<antcall target="recompile" />
<antcall target="reobfuscate" />
<!-- Build the jar -->
<mkdir dir="${build.dir.share}\${build.release.minecraft.version}\${build.release.mod.version}" />
<jar destfile="${build.dir.share}\${build.release.minecraft.version}\${build.release.mod.version}\ee3-universal-${build.release.mod.version}.${build_number.build_number}.jar">
<fileset dir="${build.dir.development}\mcp\src\common\" includes="mcmod.info" />
<fileset dir="${build.dir.development}\mcp\reobf\minecraft" />
<fileset dir="${build.dir.development}\source\Equivalent-Exchange-3\resources" />
</jar>
<!-- Clean up the MCP source now that we are done -->
<antcall target="clean" />
<target name="sign_jar">
<signjar jar="${build.dir.release}\${build.release.minecraft.version}\${build.release.mod.version}\ee3-universal-${build.release.mod.version}-${build_number.build_number}.jar" keystore="${build.keystore.location}" alias="${build.keystore.alias}" storepass="${build.keystore.password}" />
</target>
<target name="release">
<!-- Prep for the release -->
<antcall target="increment" />
<target name="build">
<!-- Prep for the build -->
<antcall target="clean" />
<antcall target="build" />
<antcall target="increment_build_number" />
<antcall target="prep" />
<antcall target="recompile" />
<antcall target="reobfuscate" />
@ -76,11 +63,32 @@
<jar destfile="${build.dir.release}\${build.release.minecraft.version}\${build.release.mod.version}\ee3-universal-${build.release.mod.version}-${build_number.build_number}.jar">
<fileset dir="${build.dir.development}\mcp\src\minecraft\" includes="mcmod.info" />
<fileset dir="${build.dir.development}\mcp\reobf\minecraft" />
<fileset dir="${build.dir.development}\source\Equivalent-Exchange-3\resources" />
<fileset dir="${build.dir.development}\source\Equivalent-Exchange-3\resources" excludes="**/xcf/**" />
</jar>
<!-- Sign the jar -->
<signjar jar="${build.dir.release}\${build.release.minecraft.version}\${build.release.mod.version}\ee3-universal-${build.release.mod.version}-${build_number.build_number}.jar" keystore="${build.keystore.location}" alias="${build.keystore.alias}" storepass="${build.keystore.password}" />
<!-- Clean up the MCP source now that we are done -->
<antcall target="clean" />
</target>
<target name="release">
<!-- Prep for the build -->
<antcall target="clean" />
<antcall target="increment_build_number" />
<antcall target="prep" />
<antcall target="replace_tokens" />
<antcall target="recompile" />
<antcall target="reobfuscate" />
<!-- Build the jar -->
<mkdir dir="${build.dir.release}\${build.release.minecraft.version}\${build.release.mod.version}" />
<jar destfile="${build.dir.release}\${build.release.minecraft.version}\${build.release.mod.version}\ee3-universal-${build.release.mod.version}-${build_number.build_number}.jar">
<fileset dir="${build.dir.development}\mcp\src\minecraft\" includes="mcmod.info" />
<fileset dir="${build.dir.development}\mcp\reobf\minecraft" />
<fileset dir="${build.dir.development}\source\Equivalent-Exchange-3\resources" excludes="**/xcf/**" />
</jar>
<!-- Sign the finished jar -->
<antcall target="sign_jar" />
<!-- Clean up the MCP source now that we are done -->
<antcall target="clean" />

View file

@ -1,3 +1,3 @@
#Fri, 12 Apr 2013 12:55:58 -0400
#Tue, 16 Apr 2013 14:01:55 -0400
build_number=5
build_number=6

View file

@ -59,26 +59,14 @@ import cpw.mods.fml.relauncher.Side;
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
*
*/
@Mod(
modid = Reference.MOD_ID,
name = Reference.MOD_NAME,
version = Reference.VERSION_NUMBER,
dependencies = Reference.DEPENDENCIES,
certificateFingerprint = Reference.FINGERPRINT)
@NetworkMod(
channels = { Reference.CHANNEL_NAME },
clientSideRequired = true,
serverSideRequired = false,
packetHandler = PacketHandler.class)
@Mod(modid = Reference.MOD_ID, name = Reference.MOD_NAME, version = Reference.VERSION_NUMBER, dependencies = Reference.DEPENDENCIES, certificateFingerprint = Reference.FINGERPRINT)
@NetworkMod(channels = { Reference.CHANNEL_NAME }, clientSideRequired = true, serverSideRequired = false, packetHandler = PacketHandler.class)
public class EquivalentExchange3 {
@Instance(Reference.MOD_ID)
public static EquivalentExchange3 instance;
@SidedProxy(
clientSide = Reference.CLIENT_PROXY_CLASS,
serverSide = Reference.SERVER_PROXY_CLASS)
@SidedProxy(clientSide = Reference.CLIENT_PROXY_CLASS, serverSide = Reference.SERVER_PROXY_CLASS)
public static CommonProxy proxy;
public static CreativeTabs tabsEE3 = new CreativeTabEE3(CreativeTabs.getNextID(), Reference.MOD_ID);
@ -157,7 +145,7 @@ public class EquivalentExchange3 {
proxy.registerDrawBlockHighlightHandler();
// Initialize mod tile entities
proxy.initTileEntities();
proxy.registerTileEntities();
// Initialize custom rendering and pre-load textures (Client only)
proxy.initRenderingAndTextures();

View file

@ -39,6 +39,7 @@ public class BlockAlchemicalChest extends BlockEE {
super(id, Material.wood);
this.setUnlocalizedName(Strings.ALCHEMICAL_CHEST_NAME);
this.setBlockBounds(0.0625F, 0.0F, 0.0625F, 0.9375F, 0.875F, 0.9375F);
this.setCreativeTab(EquivalentExchange3.tabsEE3);
}

View file

@ -26,7 +26,7 @@ import com.pahimar.ee3.tileentity.TileAludel;
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
*
*/
public class BlockAludel extends BlockEE {
public class BlockAludelBase extends BlockEE {
/**
* Is the random generator used by aludel to drop the inventory contents in
@ -34,13 +34,13 @@ public class BlockAludel extends BlockEE {
*/
private Random rand = new Random();
public BlockAludel(int id) {
public BlockAludelBase(int id) {
super(id, Material.rock);
this.setUnlocalizedName(Strings.ALUDEL_NAME);
this.setCreativeTab(EquivalentExchange3.tabsEE3);
this.setBlockBounds(0.0625F, 0.0F, 0.0625F, 0.9375F, 1.0F, 0.9375F);
this.setHardness(5F);
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.66F, 1.0F);
}
@Override

View file

@ -35,7 +35,7 @@ public abstract class BlockEE extends BlockContainer {
@SideOnly(Side.CLIENT)
public void registerIcons(IconRegister iconRegister) {
blockIcon = iconRegister.registerIcon(Reference.MOD_ID.toLowerCase() + ":" + this.getUnlocalizedName().substring(this.getUnlocalizedName().indexOf(".") + 1));
blockIcon = iconRegister.registerIcon(Reference.MOD_ID.toLowerCase() + ":" + this.getUnlocalizedName2());
}
/**
@ -66,7 +66,6 @@ public abstract class BlockEE extends BlockContainer {
((TileEE) world.getBlockTileEntity(x, y, z)).setCustomName(itemStack.getDisplayName());
}
((TileEE) world.getBlockTileEntity(x, y, z)).setOwner(entityLiving.getEntityName());
((TileEE) world.getBlockTileEntity(x, y, z)).setOrientation(direction);
}
}

View file

@ -0,0 +1,120 @@
package com.pahimar.ee3.block;
import java.util.Random;
import net.minecraft.block.material.Material;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
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 com.pahimar.ee3.EquivalentExchange3;
import com.pahimar.ee3.lib.GuiIds;
import com.pahimar.ee3.lib.RenderIds;
import com.pahimar.ee3.lib.Strings;
import com.pahimar.ee3.tileentity.TileGlassBell;
public class BlockGlassBell extends BlockEE {
/**
* Is the random generator used by glass bell to drop the inventory contents
* in random directions.
*/
private Random rand = new Random();
public BlockGlassBell(int id) {
super(id, Material.glass);
this.setUnlocalizedName(Strings.GLASS_BELL_NAME);
this.setCreativeTab(EquivalentExchange3.tabsEE3);
this.setBlockBounds(0.125F, 0.0F, 0.125F, 0.875F, 0.66F, 0.875F);
this.setHardness(1.0F);
}
@Override
public TileEntity createNewTileEntity(World world) {
return new TileGlassBell();
}
@Override
public boolean renderAsNormalBlock() {
return false;
}
@Override
public boolean isOpaqueCube() {
return false;
}
@Override
public int getRenderType() {
return RenderIds.glassBellId;
}
@Override
public void breakBlock(World world, int x, int y, int z, int id, int meta) {
dropInventory(world, x, y, z);
super.breakBlock(world, x, y, z, id, meta);
}
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9) {
if (player.isSneaking())
return false;
else {
if (!world.isRemote) {
TileGlassBell tileGlassBell = (TileGlassBell) world.getBlockTileEntity(x, y, z);
if (tileGlassBell != null) {
player.openGui(EquivalentExchange3.instance, GuiIds.GLASS_BELL, world, x, y, z);
}
}
return true;
}
}
private void dropInventory(World world, int x, int y, int z) {
TileEntity tileEntity = world.getBlockTileEntity(x, y, z);
if (!(tileEntity instanceof IInventory))
return;
IInventory inventory = (IInventory) tileEntity;
for (int i = 0; i < inventory.getSizeInventory(); i++) {
ItemStack itemStack = inventory.getStackInSlot(i);
if (itemStack != null && itemStack.stackSize > 0) {
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, new ItemStack(itemStack.itemID, itemStack.stackSize, itemStack.getItemDamage()));
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

@ -22,20 +22,23 @@ public class ModBlocks {
public static Block calcinator;
public static Block aludel;
public static Block alchemicalChest;
public static Block glassBell;
public static Block redWaterStill;
public static Block redWaterFlowing;
public static void init() {
calcinator = new BlockCalcinator(BlockIds.CALCINATOR);
aludel = new BlockAludel(BlockIds.ALUDEL);
aludel = new BlockAludelBase(BlockIds.ALUDEL);
alchemicalChest = new BlockAlchemicalChest(BlockIds.ALCHEMICAL_CHEST);
glassBell = new BlockGlassBell(BlockIds.GLASS_BELL);
redWaterStill = new BlockRedWaterStill(BlockIds.RED_WATER_STILL);
redWaterFlowing = new BlockRedWaterFlowing(BlockIds.RED_WATER_STILL - 1);
GameRegistry.registerBlock(calcinator, Strings.CALCINATOR_NAME);
GameRegistry.registerBlock(aludel, Strings.ALUDEL_NAME);
GameRegistry.registerBlock(alchemicalChest, Strings.ALCHEMICAL_CHEST_NAME);
GameRegistry.registerBlock(glassBell, Strings.GLASS_BELL_NAME);
//GameRegistry.registerBlock(redWaterStill, Strings.RED_WATER_STILL_NAME);
//GameRegistry.registerBlock(redWaterFlowing, Strings.RED_WATER_FLOWING_NAME);

View file

@ -0,0 +1,56 @@
package com.pahimar.ee3.client.gui.inventory;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.StatCollector;
import org.lwjgl.opengl.GL11;
import com.pahimar.ee3.inventory.ContainerGlassBell;
import com.pahimar.ee3.lib.Strings;
import com.pahimar.ee3.lib.Textures;
import com.pahimar.ee3.tileentity.TileGlassBell;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
/**
* Equivalent-Exchange-3
*
* GuiGlassBell
*
* @author pahimar
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
*
*/
@SideOnly(Side.CLIENT)
public class GuiGlassBell extends GuiContainer {
private TileGlassBell tileGlassBell;
public GuiGlassBell(InventoryPlayer inventoryPlayer, TileGlassBell tileGlassBell) {
super(new ContainerGlassBell(inventoryPlayer, tileGlassBell));
this.tileGlassBell = tileGlassBell;
xSize = 176;
ySize = 140;
}
@Override
protected void drawGuiContainerForegroundLayer(int x, int y) {
String containerName = tileGlassBell.isInvNameLocalized() ? tileGlassBell.getInvName() : StatCollector.translateToLocal(tileGlassBell.getInvName());
fontRenderer.drawString(containerName, xSize / 2 - fontRenderer.getStringWidth(containerName) / 2, 6, 4210752);
fontRenderer.drawString(StatCollector.translateToLocal(Strings.CONTAINER_INVENTORY), 8, ySize - 93, 4210752);
}
@Override
protected void drawGuiContainerBackgroundLayer(float var1, int var2, int var3) {
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
mc.renderEngine.bindTexture(Textures.GUI_GLASS_BELL);
int xStart = (width - xSize) / 2;
int yStart = (height - ySize) / 2;
this.drawTexturedModalRect(xStart, yStart, 0, 0, xSize, ySize);
}
}

View file

@ -1,17 +1,10 @@
package com.pahimar.ee3.client.model;
import net.minecraft.client.model.ModelBase;
import net.minecraftforge.client.model.AdvancedModelLoader;
import net.minecraftforge.client.model.IModelCustom;
import net.minecraftforge.common.ForgeDirection;
import org.lwjgl.opengl.GL11;
import com.pahimar.ee3.lib.Models;
import com.pahimar.ee3.lib.Textures;
import com.pahimar.ee3.tileentity.TileAludel;
import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@ -25,7 +18,7 @@ import cpw.mods.fml.relauncher.SideOnly;
*
*/
@SideOnly(Side.CLIENT)
public class ModelAludel extends ModelBase {
public class ModelAludel {
private IModelCustom modelAludel;
@ -36,48 +29,6 @@ public class ModelAludel extends ModelBase {
public void render() {
modelAludel.renderAll();
}
public void render(TileAludel aludel, double x, double y, double z) {
GL11.glPushMatrix();
GL11.glDisable(GL11.GL_LIGHTING);
// Scale, Translate, Rotate
scaleTranslateRotate(x, y, z, aludel.getOrientation());
// Bind texture
FMLClientHandler.instance().getClient().renderEngine.bindTexture(Textures.MODEL_ALUDEL);
// Render
this.render();
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glPopMatrix();
}
private void scaleTranslateRotate(double x, double y, double z, ForgeDirection orientation) {
if (orientation == ForgeDirection.NORTH) {
GL11.glTranslated(x + 1, y, z);
GL11.glRotatef(180F, 0F, 1F, 0F);
GL11.glRotatef(-90F, 1F, 0F, 0F);
}
else if (orientation == ForgeDirection.EAST) {
GL11.glTranslated(x + 1, y, z + 1);
GL11.glRotatef(90F, 0F, 1F, 0F);
GL11.glRotatef(-90F, 1F, 0F, 0F);
}
else if (orientation == ForgeDirection.SOUTH) {
GL11.glTranslated(x, y, z + 1);
GL11.glRotatef(0F, 0F, 1F, 0F);
GL11.glRotatef(-90F, 1F, 0F, 0F);
}
else if (orientation == ForgeDirection.WEST) {
GL11.glTranslated(x, y, z);
GL11.glRotatef(-90F, 0F, 1F, 0F);
GL11.glRotatef(-90F, 1F, 0F, 0F);
}
modelAludel.renderPart("Base");
}
}

View file

@ -1,16 +1,10 @@
package com.pahimar.ee3.client.model;
import net.minecraft.client.model.ModelBase;
import net.minecraftforge.client.model.AdvancedModelLoader;
import net.minecraftforge.client.model.IModelCustom;
import org.lwjgl.opengl.GL11;
import com.pahimar.ee3.lib.Models;
import com.pahimar.ee3.lib.Textures;
import com.pahimar.ee3.tileentity.TileCalcinator;
import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@ -24,7 +18,7 @@ import cpw.mods.fml.relauncher.SideOnly;
*
*/
@SideOnly(Side.CLIENT)
public class ModelCalcinator extends ModelBase {
public class ModelCalcinator {
private IModelCustom modelCalcinator;
@ -38,25 +32,8 @@ public class ModelCalcinator extends ModelBase {
modelCalcinator.renderAll();
}
public void render(TileCalcinator calcinator, double x, double y, double z) {
public void renderPart(String partName) {
GL11.glPushMatrix();
GL11.glDisable(GL11.GL_LIGHTING);
// Scale, Translate, Rotate
GL11.glScalef(1.0F, 1.0F, 1.0F);
GL11.glTranslatef((float) x + 0.5F, (float) y + 0.0F, (float) z + 1.2F);
GL11.glRotatef(45F, 0F, 1F, 0F);
GL11.glRotatef(-90F, 1F, 0F, 0F);
// Bind texture
FMLClientHandler.instance().getClient().renderEngine.bindTexture(Textures.MODEL_CALCINATOR);
// Render
this.render();
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glPopMatrix();
modelCalcinator.renderPart(partName);
}
}

View file

@ -0,0 +1,21 @@
package com.pahimar.ee3.client.model;
import net.minecraftforge.client.model.AdvancedModelLoader;
import net.minecraftforge.client.model.IModelCustom;
import com.pahimar.ee3.lib.Models;
public class ModelGlassBell {
private IModelCustom modelGlassBell;
public ModelGlassBell() {
modelGlassBell = AdvancedModelLoader.loadModel(Models.GLASS_BELL);
}
public void render() {
modelGlassBell.renderPart("Bell");
}
}

View file

@ -24,11 +24,11 @@ import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class ItemAludelRenderer implements IItemRenderer {
private ModelAludel aludelModel;
private ModelAludel modelAludel;
public ItemAludelRenderer() {
aludelModel = new ModelAludel();
modelAludel = new ModelAludel();
}
@Override
@ -48,15 +48,15 @@ public class ItemAludelRenderer implements IItemRenderer {
switch (type) {
case ENTITY: {
renderAludel(-0.5F, 0.0F, 0.5F, 0.66F);
renderAludel(-0.5F, -0.38F, 0.5F, 1.0F);
return;
}
case EQUIPPED: {
renderAludel(0.5F, 0.0F, 1.25F, 0.66F);
renderAludel(0.0F, 0.0F, 1.0F, 1.0F);
return;
}
case INVENTORY: {
renderAludel(-1.0F, -1.2F, 0.0F, 0.85F);
renderAludel(-1.0F, -0.9F, 0.0F, 1.0F);
return;
}
default:
@ -78,7 +78,7 @@ public class ItemAludelRenderer implements IItemRenderer {
FMLClientHandler.instance().getClient().renderEngine.bindTexture(Textures.MODEL_ALUDEL);
// Render
aludelModel.render();
modelAludel.render();
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glPopMatrix();

View file

@ -24,11 +24,11 @@ import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class ItemCalcinatorRenderer implements IItemRenderer {
private ModelCalcinator calcinatorModel;
private ModelCalcinator modelCalcinator;
public ItemCalcinatorRenderer() {
calcinatorModel = new ModelCalcinator();
modelCalcinator = new ModelCalcinator();
}
@Override
@ -78,7 +78,7 @@ public class ItemCalcinatorRenderer implements IItemRenderer {
FMLClientHandler.instance().getClient().renderEngine.bindTexture(Textures.MODEL_CALCINATOR);
// Render
calcinatorModel.render();
modelCalcinator.render();
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glPopMatrix();

View file

@ -0,0 +1,86 @@
package com.pahimar.ee3.client.renderer.item;
import net.minecraft.item.ItemStack;
import net.minecraftforge.client.IItemRenderer;
import org.lwjgl.opengl.GL11;
import com.pahimar.ee3.client.model.ModelGlassBell;
import com.pahimar.ee3.lib.Textures;
import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
/**
* Equivalent-Exchange-3
*
* ItemGlassBellRenderer
*
* @author pahimar
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
*
*/
@SideOnly(Side.CLIENT)
public class ItemGlassBellRenderer implements IItemRenderer {
private ModelGlassBell modelGlassBell;
public ItemGlassBellRenderer() {
modelGlassBell = new ModelGlassBell();
}
@Override
public boolean handleRenderType(ItemStack item, ItemRenderType type) {
return true;
}
@Override
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) {
return true;
}
@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
switch (type) {
case ENTITY: {
renderGlassBell(-0.5F, -1.2F, 0.5F, 1.4F);
return;
}
case EQUIPPED: {
renderGlassBell(-0.2F, -0.85F, 0.8F, 1.4F);
return;
}
case INVENTORY: {
renderGlassBell(-1.0F, -1.675F, 0.0F, 1.4F);
return;
}
default:
return;
}
}
private void renderGlassBell(float x, float y, float z, float scale) {
GL11.glPushMatrix();
GL11.glDisable(GL11.GL_LIGHTING);
// Scale, Translate, Rotate
GL11.glScalef(scale, scale, scale);
GL11.glTranslatef(x, y, z);
GL11.glRotatef(-90F, 1F, 0, 0);
// Bind texture
FMLClientHandler.instance().getClient().renderEngine.bindTexture(Textures.MODEL_GLASS_BELL);
// Render
modelGlassBell.render();
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glPopMatrix();
}
}

View file

@ -25,58 +25,56 @@ import cpw.mods.fml.relauncher.SideOnly;
*
*/
@SideOnly(Side.CLIENT)
public class TileEntityAlchemicalChestRenderer extends
TileEntitySpecialRenderer {
public class TileEntityAlchemicalChestRenderer extends TileEntitySpecialRenderer {
private ModelChest modelChest = new ModelChest();
public void renderAlchemicalChest(TileAlchemicalChest tileAlchemicalChest, double x, double y, double z, float tick) {
ForgeDirection direction = null;
if (tileAlchemicalChest.getWorldObj() != null) {
direction = ForgeDirection.getOrientation(tileAlchemicalChest.getBlockMetadata());
}
FMLClientHandler.instance().getClient().renderEngine.bindTexture(Textures.MODEL_ALCHEMICAL_CHEST);
GL11.glPushMatrix();
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
GL11.glTranslatef((float) x, (float) y + 1.0F, (float) z + 1.0F);
GL11.glScalef(1.0F, -1.0F, -1.0F);
GL11.glTranslatef(0.5F, 0.5F, 0.5F);
short angle = 0;
if (direction != null) {
if (direction == ForgeDirection.NORTH) {
angle = 180;
}
else if (direction == ForgeDirection.SOUTH) {
angle = 0;
}
else if (direction == ForgeDirection.WEST) {
angle = 90;
}
else if (direction == ForgeDirection.EAST) {
angle = -90;
}
}
GL11.glRotatef(angle, 0.0F, 1.0F, 0.0F);
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
float adjustedLidAngle = tileAlchemicalChest.prevLidAngle + (tileAlchemicalChest.lidAngle - tileAlchemicalChest.prevLidAngle) * tick;
adjustedLidAngle = 1.0F - adjustedLidAngle;
adjustedLidAngle = 1.0F - adjustedLidAngle * adjustedLidAngle * adjustedLidAngle;
modelChest.chestLid.rotateAngleX = -(adjustedLidAngle * (float) Math.PI / 2.0F);
modelChest.renderAll();
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
GL11.glPopMatrix();
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
}
@Override
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float tick) {
renderAlchemicalChest((TileAlchemicalChest) tileEntity, x, y, z, tick);
if (tileEntity instanceof TileAlchemicalChest) {
TileAlchemicalChest tileAlchemicalChest = (TileAlchemicalChest) tileEntity;
ForgeDirection direction = null;
if (tileAlchemicalChest.getWorldObj() != null) {
direction = ForgeDirection.getOrientation(tileAlchemicalChest.getBlockMetadata());
}
FMLClientHandler.instance().getClient().renderEngine.bindTexture(Textures.MODEL_ALCHEMICAL_CHEST);
GL11.glPushMatrix();
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
GL11.glTranslatef((float) x, (float) y + 1.0F, (float) z + 1.0F);
GL11.glScalef(1.0F, -1.0F, -1.0F);
GL11.glTranslatef(0.5F, 0.5F, 0.5F);
short angle = 0;
if (direction != null) {
if (direction == ForgeDirection.NORTH) {
angle = 180;
}
else if (direction == ForgeDirection.SOUTH) {
angle = 0;
}
else if (direction == ForgeDirection.WEST) {
angle = 90;
}
else if (direction == ForgeDirection.EAST) {
angle = -90;
}
}
GL11.glRotatef(angle, 0.0F, 1.0F, 0.0F);
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
float adjustedLidAngle = tileAlchemicalChest.prevLidAngle + (tileAlchemicalChest.lidAngle - tileAlchemicalChest.prevLidAngle) * tick;
adjustedLidAngle = 1.0F - adjustedLidAngle;
adjustedLidAngle = 1.0F - adjustedLidAngle * adjustedLidAngle * adjustedLidAngle;
modelChest.chestLid.rotateAngleX = -(adjustedLidAngle * (float) Math.PI / 2.0F);
modelChest.renderAll();
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
GL11.glPopMatrix();
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
}
}
}

View file

@ -2,10 +2,15 @@ package com.pahimar.ee3.client.renderer.tileentity;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.ForgeDirection;
import org.lwjgl.opengl.GL11;
import com.pahimar.ee3.client.model.ModelAludel;
import com.pahimar.ee3.lib.Textures;
import com.pahimar.ee3.tileentity.TileAludel;
import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@ -26,7 +31,48 @@ public class TileEntityAludelRenderer extends TileEntitySpecialRenderer {
@Override
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float tick) {
modelAludel.render((TileAludel) tileEntity, x, y, z);
if (tileEntity instanceof TileAludel) {
TileAludel tileAludel = (TileAludel) tileEntity;
GL11.glPushMatrix();
GL11.glDisable(GL11.GL_LIGHTING);
// Scale, Translate, Rotate
scaleTranslateRotate(x, y, z, tileAludel.getOrientation());
// Bind texture
FMLClientHandler.instance().getClient().renderEngine.bindTexture(Textures.MODEL_ALUDEL);
// Render
modelAludel.render();
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glPopMatrix();
}
}
private void scaleTranslateRotate(double x, double y, double z, ForgeDirection orientation) {
if (orientation == ForgeDirection.NORTH) {
GL11.glTranslated(x + 1, y, z);
GL11.glRotatef(180F, 0F, 1F, 0F);
GL11.glRotatef(-90F, 1F, 0F, 0F);
}
else if (orientation == ForgeDirection.EAST) {
GL11.glTranslated(x + 1, y, z + 1);
GL11.glRotatef(90F, 0F, 1F, 0F);
GL11.glRotatef(-90F, 1F, 0F, 0F);
}
else if (orientation == ForgeDirection.SOUTH) {
GL11.glTranslated(x, y, z + 1);
GL11.glRotatef(0F, 0F, 1F, 0F);
GL11.glRotatef(-90F, 1F, 0F, 0F);
}
else if (orientation == ForgeDirection.WEST) {
GL11.glTranslated(x, y, z);
GL11.glRotatef(-90F, 0F, 1F, 0F);
GL11.glRotatef(-90F, 1F, 0F, 0F);
}
}
}

View file

@ -3,9 +3,13 @@ package com.pahimar.ee3.client.renderer.tileentity;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
import org.lwjgl.opengl.GL11;
import com.pahimar.ee3.client.model.ModelCalcinator;
import com.pahimar.ee3.lib.Textures;
import com.pahimar.ee3.tileentity.TileCalcinator;
import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@ -26,7 +30,30 @@ public class TileEntityCalcinatorRenderer extends TileEntitySpecialRenderer {
@Override
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float tick) {
modelCalcinator.render((TileCalcinator) tileEntity, x, y, z);
}
if (tileEntity instanceof TileCalcinator) {
TileCalcinator tileCalcinator = (TileCalcinator) tileEntity;
GL11.glPushMatrix();
GL11.glDisable(GL11.GL_LIGHTING);
// Scale, Translate, Rotate
GL11.glScalef(1.0F, 1.0F, 1.0F);
GL11.glTranslatef((float) x + 0.5F, (float) y + 0.0F, (float) z + 1.2F);
GL11.glRotatef(45F, 0F, 1F, 0F);
GL11.glRotatef(-90F, 1F, 0F, 0F);
// Bind texture
FMLClientHandler.instance().getClient().renderEngine.bindTexture(Textures.MODEL_CALCINATOR);
// Render
modelCalcinator.renderPart("Calcinator");
if (tileCalcinator.getStackInSlot(TileCalcinator.DUST_INVENTORY_INDEX) != null) {
modelCalcinator.renderPart("Dust");
}
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glPopMatrix();
}
}
}

View file

@ -0,0 +1,104 @@
package com.pahimar.ee3.client.renderer.tileentity;
import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.tileentity.TileEntity;
import org.lwjgl.opengl.GL11;
import com.pahimar.ee3.client.model.ModelGlassBell;
import com.pahimar.ee3.lib.Textures;
import com.pahimar.ee3.tileentity.TileGlassBell;
import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
/**
* Equivalent-Exchange-3
*
* TileEntityGlassBellRenderer
*
* @author pahimar
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
*
*/
@SideOnly(Side.CLIENT)
public class TileEntityGlassBellRenderer extends TileEntitySpecialRenderer {
private ModelGlassBell modelGlassBell = new ModelGlassBell();
private final RenderItem customRenderItem;
private EntityItem ghostEntityItem;
public TileEntityGlassBellRenderer() {
ghostEntityItem = null;
customRenderItem = new RenderItem() {
@Override
public boolean shouldBob() {
return false;
};
};
customRenderItem.setRenderManager(RenderManager.instance);
}
@Override
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float tick) {
if (tileEntity instanceof TileGlassBell) {
TileGlassBell tileGlassBell = (TileGlassBell) tileEntity;
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_CULL_FACE);
GL11.glPushMatrix();
// Scale, Translate, Rotate
GL11.glScalef(1.0F, 1.0F, 1.0F);
GL11.glTranslatef((float) x + 0.5F, (float) y + -1.0F, (float) z + 1.2F);
GL11.glRotatef(45F, 0F, 1F, 0F);
GL11.glRotatef(-90F, 1F, 0F, 0F);
// Bind texture
FMLClientHandler.instance().getClient().renderEngine.bindTexture(Textures.MODEL_GLASS_BELL);
// Render
modelGlassBell.render();
GL11.glPopMatrix();
GL11.glPushMatrix();
for (int i = 0; i < tileGlassBell.getSizeInventory(); i++) {
GL11.glTranslatef((float) x + 0.5F, (float) y + 0.1F, (float) z + 0.5F);
GL11.glScalef(0.5F, 0.5F, 0.5F);
if (ghostEntityItem == null) {
ghostEntityItem = new EntityItem(tileGlassBell.worldObj, tileGlassBell.xCoord, tileGlassBell.yCoord, tileGlassBell.zCoord);
}
if (tileGlassBell.getStackInSlot(i) != null) {
ghostEntityItem.setEntityItemStack(tileGlassBell.getStackInSlot(i));
if (ghostEntityItem.getEntityItem() != null) {
ghostEntityItem.onUpdate();
customRenderItem.doRenderItem(ghostEntityItem, 0, 0, 0, 0, 0);
}
}
}
GL11.glPopMatrix();
GL11.glEnable(GL11.GL_CULL_FACE);
GL11.glEnable(GL11.GL_LIGHTING);
}
}
}

View file

@ -80,6 +80,7 @@ public class ConfigurationHandler {
BlockIds.CALCINATOR = configuration.getBlock(Strings.CALCINATOR_NAME, BlockIds.CALCINATOR_DEFAULT).getInt(BlockIds.CALCINATOR_DEFAULT);
BlockIds.ALUDEL = configuration.getBlock(Strings.ALUDEL_NAME, BlockIds.ALUDEL_DEFAULT).getInt(BlockIds.ALUDEL_DEFAULT);
BlockIds.ALCHEMICAL_CHEST = configuration.getBlock(Strings.ALCHEMICAL_CHEST_NAME, BlockIds.ALCHEMICAL_CHEST_DEFAULT).getInt(BlockIds.ALCHEMICAL_CHEST_DEFAULT);
BlockIds.GLASS_BELL = configuration.getBlock(Strings.GLASS_BELL_NAME, BlockIds.GLASS_BELL_DEFAULT).getInt(BlockIds.GLASS_BELL_DEFAULT);
BlockIds.RED_WATER_STILL = configuration.getBlock(Strings.RED_WATER_STILL_NAME, BlockIds.RED_WATER_STILL_DEFAULT).getInt(BlockIds.RED_WATER_STILL_DEFAULT);
/* Block property configs */

View file

@ -1,48 +0,0 @@
package com.pahimar.ee3.core.helper;
import net.minecraft.block.Block;
import net.minecraft.entity.EntityLiving;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
import com.pahimar.ee3.block.ModBlocks;
import com.pahimar.ee3.configuration.ConfigurationSettings;
/**
* Equivalent-Exchange-3
*
* RedWaterHelper
*
* @author pahimar
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
*
*/
public class RedWaterHelper {
public static boolean handleRedWaterDetection(EntityLiving entity) {
return isBlockInBB(entity.worldObj, entity.boundingBox, ModBlocks.redWaterFlowing) || isBlockInBB(entity.worldObj, entity.boundingBox, ModBlocks.redWaterStill);
}
public static boolean isBlockInBB(World world, AxisAlignedBB par1AxisAlignedBB, Block block) {
int minX = MathHelper.floor_double(par1AxisAlignedBB.minX - ConfigurationSettings.RED_WATER_RANGE_BASE * ConfigurationSettings.RED_WATER_RANGE_MODIFIER * 1.0D);
int maxX = MathHelper.floor_double(par1AxisAlignedBB.maxX + ConfigurationSettings.RED_WATER_RANGE_BASE * ConfigurationSettings.RED_WATER_RANGE_MODIFIER * 1.0D);
int minY = MathHelper.floor_double(par1AxisAlignedBB.minY - ConfigurationSettings.RED_WATER_RANGE_BASE * ConfigurationSettings.RED_WATER_RANGE_MODIFIER * 1.0D);
int maxY = MathHelper.floor_double(par1AxisAlignedBB.maxY + ConfigurationSettings.RED_WATER_RANGE_BASE * ConfigurationSettings.RED_WATER_RANGE_MODIFIER * 1.0D);
int minZ = MathHelper.floor_double(par1AxisAlignedBB.minZ - ConfigurationSettings.RED_WATER_RANGE_BASE * ConfigurationSettings.RED_WATER_RANGE_MODIFIER * 1.0D);
int maxZ = MathHelper.floor_double(par1AxisAlignedBB.maxZ + ConfigurationSettings.RED_WATER_RANGE_BASE * ConfigurationSettings.RED_WATER_RANGE_MODIFIER * 1.0D);
for (int i = minX; i < maxX; ++i) {
for (int j = minY; j < maxY; ++j) {
for (int k = minZ; k < maxZ; ++k) {
Block currentBlock = Block.blocksList[world.getBlockId(i, j, k)];
if (currentBlock != null && currentBlock.blockID == block.blockID)
return true;
}
}
}
return false;
}
}

View file

@ -109,10 +109,11 @@ public class VersionHelper implements Runnable {
}
}
}
private static String getVersionForCheck() {
String[] versionTokens = Reference.VERSION_NUMBER.split(" ");
if (versionTokens.length >= 1) {
return versionTokens[0];
}

View file

@ -13,9 +13,11 @@ import com.pahimar.ee3.client.audio.SoundHandler;
import com.pahimar.ee3.client.renderer.item.ItemAlchemicalChestRenderer;
import com.pahimar.ee3.client.renderer.item.ItemAludelRenderer;
import com.pahimar.ee3.client.renderer.item.ItemCalcinatorRenderer;
import com.pahimar.ee3.client.renderer.item.ItemGlassBellRenderer;
import com.pahimar.ee3.client.renderer.tileentity.TileEntityAlchemicalChestRenderer;
import com.pahimar.ee3.client.renderer.tileentity.TileEntityAludelRenderer;
import com.pahimar.ee3.client.renderer.tileentity.TileEntityCalcinatorRenderer;
import com.pahimar.ee3.client.renderer.tileentity.TileEntityGlassBellRenderer;
import com.pahimar.ee3.core.handlers.DrawBlockHighlightHandler;
import com.pahimar.ee3.core.handlers.KeyBindingHandler;
import com.pahimar.ee3.core.handlers.TransmutationTargetOverlayHandler;
@ -31,6 +33,7 @@ import com.pahimar.ee3.tileentity.TileAlchemicalChest;
import com.pahimar.ee3.tileentity.TileAludel;
import com.pahimar.ee3.tileentity.TileCalcinator;
import com.pahimar.ee3.tileentity.TileEE;
import com.pahimar.ee3.tileentity.TileGlassBell;
import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.client.registry.ClientRegistry;
@ -88,20 +91,23 @@ public class ClientProxy extends CommonProxy {
RenderIds.calcinatorRenderId = RenderingRegistry.getNextAvailableRenderId();
RenderIds.aludelRenderId = RenderingRegistry.getNextAvailableRenderId();
RenderIds.alchemicalChestRenderId = RenderingRegistry.getNextAvailableRenderId();
RenderIds.glassBellId = RenderingRegistry.getNextAvailableRenderId();
MinecraftForgeClient.registerItemRenderer(BlockIds.CALCINATOR, new ItemCalcinatorRenderer());
MinecraftForgeClient.registerItemRenderer(BlockIds.ALUDEL, new ItemAludelRenderer());
MinecraftForgeClient.registerItemRenderer(BlockIds.ALCHEMICAL_CHEST, new ItemAlchemicalChestRenderer());
MinecraftForgeClient.registerItemRenderer(BlockIds.GLASS_BELL, new ItemGlassBellRenderer());
}
@Override
public void initTileEntities() {
public void registerTileEntities() {
super.initTileEntities();
super.registerTileEntities();
ClientRegistry.bindTileEntitySpecialRenderer(TileCalcinator.class, new TileEntityCalcinatorRenderer());
ClientRegistry.bindTileEntitySpecialRenderer(TileAludel.class, new TileEntityAludelRenderer());
ClientRegistry.bindTileEntitySpecialRenderer(TileAlchemicalChest.class, new TileEntityAlchemicalChestRenderer());
ClientRegistry.bindTileEntitySpecialRenderer(TileGlassBell.class, new TileEntityGlassBellRenderer());
}
@Override
@ -111,7 +117,7 @@ public class ClientProxy extends CommonProxy {
}
@Override
public void handleTileEntityPacket(int x, int y, int z, ForgeDirection orientation, short state, String owner, String customName) {
public void handleTileEntityPacket(int x, int y, int z, ForgeDirection orientation, byte state, String customName) {
TileEntity tileEntity = FMLClientHandler.instance().getClient().theWorld.getBlockTileEntity(x, y, z);
@ -119,7 +125,6 @@ public class ClientProxy extends CommonProxy {
if (tileEntity instanceof TileEE) {
((TileEE) tileEntity).setOrientation(orientation);
((TileEE) tileEntity).setState(state);
((TileEE) tileEntity).setOwner(owner);
((TileEE) tileEntity).setCustomName(customName);
}
}

View file

@ -9,12 +9,14 @@ import com.pahimar.ee3.client.gui.inventory.GuiAlchemicalBag;
import com.pahimar.ee3.client.gui.inventory.GuiAlchemicalChest;
import com.pahimar.ee3.client.gui.inventory.GuiAludel;
import com.pahimar.ee3.client.gui.inventory.GuiCalcinator;
import com.pahimar.ee3.client.gui.inventory.GuiGlassBell;
import com.pahimar.ee3.client.gui.inventory.GuiPortableCrafting;
import com.pahimar.ee3.client.gui.inventory.GuiPortableTransmutation;
import com.pahimar.ee3.inventory.ContainerAlchemicalBag;
import com.pahimar.ee3.inventory.ContainerAlchemicalChest;
import com.pahimar.ee3.inventory.ContainerAludel;
import com.pahimar.ee3.inventory.ContainerCalcinator;
import com.pahimar.ee3.inventory.ContainerGlassBell;
import com.pahimar.ee3.inventory.ContainerPortableCrafting;
import com.pahimar.ee3.inventory.ContainerPortableTransmutation;
import com.pahimar.ee3.lib.GuiIds;
@ -22,6 +24,7 @@ import com.pahimar.ee3.lib.Strings;
import com.pahimar.ee3.tileentity.TileAlchemicalChest;
import com.pahimar.ee3.tileentity.TileAludel;
import com.pahimar.ee3.tileentity.TileCalcinator;
import com.pahimar.ee3.tileentity.TileGlassBell;
import cpw.mods.fml.common.network.IGuiHandler;
import cpw.mods.fml.common.registry.GameRegistry;
@ -61,11 +64,12 @@ public class CommonProxy implements IGuiHandler {
}
public void initTileEntities() {
public void registerTileEntities() {
GameRegistry.registerTileEntity(TileCalcinator.class, Strings.TE_CALCINATOR_NAME);
GameRegistry.registerTileEntity(TileAludel.class, Strings.TE_ALUDEL_NAME);
GameRegistry.registerTileEntity(TileAlchemicalChest.class, Strings.TE_ALCHEMICAL_CHEST_NAME);
GameRegistry.registerTileEntity(TileGlassBell.class, Strings.TE_GLASS_BELL_NAME);
}
public void transmuteBlock(ItemStack itemStack, EntityPlayer player, World world, int x, int y, int z, int sideHit) {
@ -76,7 +80,7 @@ public class CommonProxy implements IGuiHandler {
}
public void handleTileEntityPacket(int x, int y, int z, ForgeDirection orientation, short state, String player, String customName) {
public void handleTileEntityPacket(int x, int y, int z, ForgeDirection orientation, byte state, String customName) {
}
@ -102,6 +106,10 @@ public class CommonProxy implements IGuiHandler {
TileAludel tileAludel = (TileAludel) world.getBlockTileEntity(x, y, z);
return new ContainerAludel(player.inventory, tileAludel);
}
else if (ID == GuiIds.GLASS_BELL) {
TileGlassBell tileGlassBell = (TileGlassBell) world.getBlockTileEntity(x, y, z);
return new ContainerGlassBell(player.inventory, tileGlassBell);
}
return null;
}
@ -128,6 +136,10 @@ public class CommonProxy implements IGuiHandler {
TileAludel tileAludel = (TileAludel) world.getBlockTileEntity(x, y, z);
return new GuiAludel(player.inventory, tileAludel);
}
else if (ID == GuiIds.GLASS_BELL) {
TileGlassBell tileGlassBell = (TileGlassBell) world.getBlockTileEntity(x, y, z);
return new GuiGlassBell(player.inventory, tileGlassBell);
}
return null;
}

View file

@ -0,0 +1,54 @@
package com.pahimar.ee3.inventory;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import com.pahimar.ee3.tileentity.TileAludel;
import com.pahimar.ee3.tileentity.TileGlassBell;
/**
* Equivalent-Exchange-3
*
* ContainerGlassBell
*
* @author pahimar
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
*
*/
public class ContainerGlassBell extends Container {
private final int PLAYER_INVENTORY_ROWS = 3;
private final int PLAYER_INVENTORY_COLUMNS = 9;
public ContainerGlassBell(InventoryPlayer inventoryPlayer, TileGlassBell tileGlassBell) {
this.addSlotToContainer(new Slot(tileGlassBell, TileAludel.INPUT_INVENTORY_INDEX, 80, 22));
// 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, 8 + inventoryColumnIndex * 18, 58 + 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, 8 + actionBarSlotIndex * 18, 116));
}
}
@Override
public boolean canInteractWith(EntityPlayer var1) {
return true;
}
@Override
public ItemStack transferStackInSlot(EntityPlayer entityPlayer, int slotIndex) {
return null;
}
}

View file

@ -24,8 +24,7 @@ import cpw.mods.fml.relauncher.SideOnly;
* @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) {

View file

@ -16,11 +16,13 @@ public class BlockIds {
public static int RED_WATER_STILL_DEFAULT = 2453;
public static int ALUDEL_DEFAULT = 2454;
public static int ALCHEMICAL_CHEST_DEFAULT = 2455;
public static int GLASS_BELL_DEFAULT = 2456;
/* Current block ids */
public static int CALCINATOR;
public static int ALUDEL;
public static int ALCHEMICAL_CHEST;
public static int RED_WATER_STILL;
public static int GLASS_BELL;
}

View file

@ -18,5 +18,6 @@ public class GuiIds {
public static final int ALCHEMICAL_CHEST = 4;
public static final int ALCHEMICAL_BAG = 5;
public static final int SHARED_ALCHEMICAL_INVENTORY = 6;
public static final int GLASS_BELL = 7;
}

View file

@ -7,4 +7,5 @@ public class Models {
public static final String ALUDEL = MODEL_LOCATION + "aludel.obj";
public static final String CALCINATOR = MODEL_LOCATION + "calcinator.obj";
public static final String GLASS_BELL = MODEL_LOCATION + "aludel.obj";
}

View file

@ -14,4 +14,5 @@ public class RenderIds {
public static int calcinatorRenderId;
public static int aludelRenderId;
public static int alchemicalChestRenderId;
public static int glassBellId;
}

View file

@ -35,7 +35,6 @@ public class Strings {
public static final String NBT_ITEM_ALCHEMICAL_BAG_GUI_OPEN = "itemAlchemicalBagGuiOpen";
public static final String NBT_ITEM_DISPLAY = "display";
public static final String NBT_ITEM_COLOR = "color";
public static final String NBT_TE_OWNER_KEY = "teOwner";
public static final String NBT_TE_STATE_KEY = "teState";
public static final String NBT_TE_CUSTOM_NAME = "CustomName";
public static final String NBT_TE_DIRECTION_KEY = "teDirection";
@ -44,6 +43,7 @@ public class Strings {
public static final String CALCINATOR_NAME = "calcinator";
public static final String ALUDEL_NAME = "aludel";
public static final String ALCHEMICAL_CHEST_NAME = "alchemicalChest";
public static final String GLASS_BELL_NAME = "glassBell";
public static final String RED_WATER_STILL_NAME = "redWaterStill";
public static final String RED_WATER_FLOWING_NAME = "redWaterFlowing";
@ -52,13 +52,14 @@ public class Strings {
public static final String INERT_STONE_NAME = "stoneInert";
public static final String MINIUM_STONE_NAME = "stoneMinium";
public static final String PHILOSOPHERS_STONE_NAME = "stonePhilosophers";
public static final String ALCHEMICAL_DUST_NAME = "dustAlchemical";
public static final String ALCHEMICAL_DUST_NAME = "alchemicalDust";
public static final String ALCHEMICAL_BAG_NAME = "alchemicalBag";
/* TileEntity name constants */
public static final String TE_CALCINATOR_NAME = "tileCalcinator";
public static final String TE_ALUDEL_NAME = "tileAludel";
public static final String TE_ALCHEMICAL_CHEST_NAME = "tileAlchemicalChest";
public static final String TE_GLASS_BELL_NAME = "tileGlassBell";
/* Transmutation cost related constants */
public static final String TRANSMUTATION_COST = "_cost";
@ -71,6 +72,7 @@ public class Strings {
public static final String CONTAINER_ALUDEL_NAME = "container." + ALUDEL_NAME;
public static final String CONTAINER_ALCHEMICAL_CHEST_NAME = "container." + ALCHEMICAL_CHEST_NAME;
public static final String CONTAINER_ALCHEMICAL_BAG_NAME = "container." + ALCHEMICAL_BAG_NAME;
public static final String CONTAINER_GLASS_BELL_NAME = "container." + GLASS_BELL_NAME;
public static final String CONTAINER_INVENTORY = "container.inventory";
public static final String CONTAINER_PORTABLE_CRAFTING = "container.crafting";

View file

@ -31,11 +31,13 @@ public class Textures {
public static final String GUI_SHARED_ALCHEMICAL_STORAGE = GUI_SHEET_LOCATION + "sharedAlchemicalStorage.png";
public static final String GUI_PORTABLE_CRAFTING = "/gui/crafting.png";
public static final String GUI_PORTABLE_TRANSMUTATION = GUI_SHEET_LOCATION + "portableTransmutation.png";
public static final String GUI_GLASS_BELL = GUI_SHEET_LOCATION + "glassBell.png";
// Model textures
public static final String MODEL_CALCINATOR = MODEL_SHEET_LOCATION + "calcinator.png";
public static final String MODEL_ALUDEL = MODEL_SHEET_LOCATION + "aludel.png";
public static final String MODEL_ALCHEMICAL_CHEST = MODEL_SHEET_LOCATION + "alchemicalChest.png";
public static final String MODEL_GLASS_BELL = MODEL_SHEET_LOCATION + "aludel.png";
// Effect textures
public static final String EFFECT_WORLD_TRANSMUTATION = EFFECTS_LOCATION + "noise.png";

View file

@ -25,12 +25,9 @@ import com.pahimar.ee3.network.packet.PacketTileUpdate;
*
*/
public enum PacketTypeHandler {
KEY(PacketKeyPressed.class),
TILE(PacketTileUpdate.class),
REQUEST_EVENT(PacketRequestEvent.class),
SPAWN_PARTICLE(PacketSpawnParticle.class),
SOUND_EVENT(PacketSoundEvent.class),
ITEM_UPDATE(PacketItemUpdate.class);
KEY(PacketKeyPressed.class), TILE(PacketTileUpdate.class), REQUEST_EVENT(
PacketRequestEvent.class), SPAWN_PARTICLE(PacketSpawnParticle.class), SOUND_EVENT(
PacketSoundEvent.class), ITEM_UPDATE(PacketItemUpdate.class);
private Class<? extends PacketEE> clazz;

View file

@ -25,8 +25,7 @@ public class PacketTileUpdate extends PacketEE {
public int x, y, z;
public byte orientation;
public short state;
public String owner;
public byte state;
public String customName;
public PacketTileUpdate() {
@ -34,7 +33,7 @@ public class PacketTileUpdate extends PacketEE {
super(PacketTypeHandler.TILE, true);
}
public PacketTileUpdate(int x, int y, int z, ForgeDirection orientation, short state, String owner, String customName) {
public PacketTileUpdate(int x, int y, int z, ForgeDirection orientation, byte state, String customName) {
super(PacketTypeHandler.TILE, true);
this.x = x;
@ -42,7 +41,6 @@ public class PacketTileUpdate extends PacketEE {
this.z = z;
this.orientation = (byte) orientation.ordinal();
this.state = state;
this.owner = owner;
this.customName = customName;
}
@ -53,8 +51,7 @@ public class PacketTileUpdate extends PacketEE {
data.writeInt(y);
data.writeInt(z);
data.writeByte(orientation);
data.writeShort(state);
data.writeUTF(owner);
data.writeByte(state);
data.writeUTF(customName);
}
@ -65,15 +62,14 @@ public class PacketTileUpdate extends PacketEE {
y = data.readInt();
z = data.readInt();
orientation = data.readByte();
state = data.readShort();
owner = data.readUTF();
state = data.readByte();
customName = data.readUTF();
}
@Override
public void execute(INetworkManager manager, Player player) {
EquivalentExchange3.proxy.handleTileEntityPacket(x, y, z, ForgeDirection.getOrientation(orientation), state, owner, customName);
EquivalentExchange3.proxy.handleTileEntityPacket(x, y, z, ForgeDirection.getOrientation(orientation), state, customName);
}
}

View file

@ -23,9 +23,15 @@ public class TileCalcinator extends TileEE implements IInventory {
*/
private ItemStack[] inventory;
private final int INVENTORY_SIZE = 3;
public static final int FUEL_INVENTORY_INDEX = 0;
public static final int INPUT_INVENTORY_INDEX = 1;
public static final int DUST_INVENTORY_INDEX = 2;
public TileCalcinator() {
inventory = new ItemStack[3];
inventory = new ItemStack[INVENTORY_SIZE];
}
/**

View file

@ -22,15 +22,13 @@ import com.pahimar.ee3.network.packet.PacketTileUpdate;
public class TileEE extends TileEntity {
private ForgeDirection orientation;
private short state;
private String owner;
private byte state;
private String customName;
public TileEE() {
orientation = ForgeDirection.SOUTH;
state = 0;
owner = "";
customName = "";
}
@ -54,26 +52,11 @@ public class TileEE extends TileEntity {
return state;
}
public void setState(short state) {
public void setState(byte state) {
this.state = state;
}
public String getOwner() {
return owner;
}
public boolean hasOwner() {
return owner != null && owner.length() > 0;
}
public void setOwner(String owner) {
this.owner = owner;
}
public boolean hasCustomName() {
return customName != null && customName.length() > 0;
@ -91,7 +74,7 @@ public class TileEE extends TileEntity {
public boolean isUseableByPlayer(EntityPlayer player) {
return owner.equals(player.username);
return true;
}
@Override
@ -104,11 +87,7 @@ public class TileEE extends TileEntity {
}
if (nbtTagCompound.hasKey(Strings.NBT_TE_STATE_KEY)) {
state = nbtTagCompound.getShort(Strings.NBT_TE_STATE_KEY);
}
if (nbtTagCompound.hasKey(Strings.NBT_TE_OWNER_KEY)) {
owner = nbtTagCompound.getString(Strings.NBT_TE_OWNER_KEY);
state = nbtTagCompound.getByte(Strings.NBT_TE_STATE_KEY);
}
if (nbtTagCompound.hasKey(Strings.NBT_TE_CUSTOM_NAME)) {
@ -122,11 +101,7 @@ public class TileEE extends TileEntity {
super.writeToNBT(nbtTagCompound);
nbtTagCompound.setByte(Strings.NBT_TE_DIRECTION_KEY, (byte) orientation.ordinal());
nbtTagCompound.setShort(Strings.NBT_TE_STATE_KEY, state);
if (hasOwner()) {
nbtTagCompound.setString(Strings.NBT_TE_OWNER_KEY, owner);
}
nbtTagCompound.setByte(Strings.NBT_TE_STATE_KEY, state);
if (this.hasCustomName()) {
nbtTagCompound.setString(Strings.NBT_TE_CUSTOM_NAME, customName);
@ -136,7 +111,7 @@ public class TileEE extends TileEntity {
@Override
public Packet getDescriptionPacket() {
return PacketTypeHandler.populatePacket(new PacketTileUpdate(xCoord, yCoord, zCoord, orientation, state, owner, customName));
return PacketTypeHandler.populatePacket(new PacketTileUpdate(xCoord, yCoord, zCoord, orientation, state, customName));
}
}

View file

@ -0,0 +1,144 @@
package com.pahimar.ee3.tileentity;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import com.pahimar.ee3.lib.Strings;
public class TileGlassBell extends TileEE implements IInventory {
/**
* The ItemStacks that hold the items currently being used in the Glass Bell
*/
private ItemStack[] inventory;
private final int INVENTORY_SIZE = 1;
public static final int DISPLAY_SLOT_INVENTORY_INDEX = 0;
public TileGlassBell() {
inventory = new ItemStack[INVENTORY_SIZE];
}
@Override
public int getSizeInventory() {
return inventory.length;
}
@Override
public ItemStack getStackInSlot(int slot) {
return inventory[slot];
}
@Override
public ItemStack decrStackSize(int slot, int amount) {
ItemStack itemStack = getStackInSlot(slot);
if (itemStack != null) {
if (itemStack.stackSize <= amount) {
setInventorySlotContents(slot, null);
}
else {
itemStack = itemStack.splitStack(amount);
if (itemStack.stackSize == 0) {
setInventorySlotContents(slot, null);
}
}
}
return itemStack;
}
@Override
public ItemStack getStackInSlotOnClosing(int slot) {
ItemStack itemStack = getStackInSlot(slot);
if (itemStack != null) {
setInventorySlotContents(slot, null);
}
return itemStack;
}
@Override
public void setInventorySlotContents(int slot, ItemStack itemStack) {
inventory[slot] = itemStack;
if (itemStack != null && itemStack.stackSize > getInventoryStackLimit()) {
itemStack.stackSize = getInventoryStackLimit();
}
}
@Override
public String getInvName() {
return this.hasCustomName() ? this.getCustomName() : Strings.CONTAINER_GLASS_BELL_NAME;
}
@Override
public int getInventoryStackLimit() {
return 64;
}
@Override
public void openChest() {
}
@Override
public void closeChest() {
}
@Override
public void readFromNBT(NBTTagCompound nbtTagCompound) {
super.readFromNBT(nbtTagCompound);
// Read in the ItemStacks in the inventory from NBT
NBTTagList tagList = nbtTagCompound.getTagList("Items");
inventory = new ItemStack[this.getSizeInventory()];
for (int i = 0; i < tagList.tagCount(); ++i) {
NBTTagCompound tagCompound = (NBTTagCompound) tagList.tagAt(i);
byte slot = tagCompound.getByte("Slot");
if (slot >= 0 && slot < inventory.length) {
inventory[slot] = 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 < inventory.length; ++currentIndex) {
if (inventory[currentIndex] != null) {
NBTTagCompound tagCompound = new NBTTagCompound();
tagCompound.setByte("Slot", (byte) currentIndex);
inventory[currentIndex].writeToNBT(tagCompound);
tagList.appendTag(tagCompound);
}
}
nbtTagCompound.setTag("Items", tagList);
}
@Override
public boolean isInvNameLocalized() {
return this.hasCustomName();
}
@Override
public boolean isStackValidForSlot(int i, ItemStack itemstack) {
return true;
}
}

View file

@ -22,10 +22,12 @@
<entry key="tile.calcinator.name">Calcinator</entry>
<entry key="tile.aludel.name">Aludel</entry>
<entry key="tile.alchemicalChest.name">Alchemical Chest</entry>
<entry key="tile.glassBell.name">Glass Bell</entry>
<entry key="container.calcinator">Calcinator</entry>
<entry key="container.aludel">Aludel</entry>
<entry key="container.alchemicalChest">Alchemical Chest</entry>
<entry key="container.alchemicalBag">Alchemical Bag</entry>
<entry key="container.glassBell">Glass Bell</entry>
<entry key="itemGroup.EE3">Equivalent Exchange 3</entry>
<entry key="version.init_log_message">Initializing remote version check against remote version authority, located at</entry>
<entry key="version.uninitialized">Remote version check failed to initialize properly</entry>

View file

@ -421,7 +421,7 @@ f 30/21/16 56/107/16 55/113/16
# 136 faces
#
# object Dome
# object Bell
#
v 0.3768 0.3768 1.6600
@ -517,7 +517,7 @@ vt 0.2188 0.7500 0.9239
vt 0.2188 0.6250 0.9239
# 32 texture coords
g Dome
g Bell
f 83/116/74 84/117/74 85/118/74
f 85/118/74 86/119/74 83/116/74
f 87/120/75 88/121/75 89/122/75

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.9 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 293 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

Binary file not shown.