Move art/sprite related constants out of the general Reference class into their out Sprites lib class, move the RenderTickHandler into the client package (where it belongs),
This commit is contained in:
parent
fa1271f5c5
commit
0ecca70ffe
18 changed files with 238 additions and 203 deletions
|
@ -13,6 +13,7 @@ import cpw.mods.fml.common.registry.LanguageRegistry;
|
|||
import cpw.mods.fml.common.registry.TickRegistry;
|
||||
import ee3.client.core.handlers.DrawBlockHighlightHandler;
|
||||
import ee3.client.core.handlers.KeyBindingHandler;
|
||||
import ee3.client.core.handlers.RenderTickHandler;
|
||||
import ee3.client.core.handlers.SoundHandler;
|
||||
import ee3.client.core.helper.KeyBindingHelper;
|
||||
import ee3.client.render.RenderCalcinator;
|
||||
|
@ -20,10 +21,9 @@ import ee3.client.render.RenderItemCalcinator;
|
|||
import ee3.client.render.TextureRedWaterFX;
|
||||
import ee3.client.render.TextureRedWaterFlowFX;
|
||||
import ee3.common.core.CommonProxy;
|
||||
import ee3.common.core.handlers.RenderTickHandler;
|
||||
import ee3.common.lib.BlockIds;
|
||||
import ee3.common.lib.Reference;
|
||||
import ee3.common.lib.RenderIds;
|
||||
import ee3.common.lib.Sprites;
|
||||
import ee3.common.tile.TileCalcinator;
|
||||
import static ee3.common.lib.CustomItemRarity.*;
|
||||
|
||||
|
@ -96,8 +96,8 @@ public class ClientProxy extends CommonProxy {
|
|||
|
||||
RenderIds.calcinatorRenderId = RenderingRegistry.getNextAvailableRenderId();
|
||||
|
||||
MinecraftForgeClient.preloadTexture(Reference.SPRITE_SHEET_LOCATION + Reference.BLOCK_SPRITE_SHEET);
|
||||
MinecraftForgeClient.preloadTexture(Reference.SPRITE_SHEET_LOCATION + Reference.ITEM_SPRITE_SHEET);
|
||||
MinecraftForgeClient.preloadTexture(Sprites.SPRITE_SHEET_LOCATION + Sprites.BLOCK_SPRITE_SHEET);
|
||||
MinecraftForgeClient.preloadTexture(Sprites.SPRITE_SHEET_LOCATION + Sprites.ITEM_SPRITE_SHEET);
|
||||
|
||||
FMLClientHandler.instance().getClient().renderEngine.registerTextureFX(new TextureRedWaterFX());
|
||||
FMLClientHandler.instance().getClient().renderEngine.registerTextureFX(new TextureRedWaterFlowFX());
|
||||
|
|
|
@ -6,7 +6,7 @@ import org.lwjgl.opengl.GL12;
|
|||
import ee3.common.item.ITransmutationStone;
|
||||
import ee3.common.item.IChargeable;
|
||||
import ee3.common.lib.ConfigurationSettings;
|
||||
import ee3.common.lib.Reference;
|
||||
import ee3.common.lib.Sprites;
|
||||
import net.minecraft.src.EnumMovingObjectType;
|
||||
import net.minecraft.src.RenderEngine;
|
||||
import net.minecraft.src.Tessellator;
|
||||
|
@ -38,18 +38,18 @@ public class DrawBlockHighlightHandler {
|
|||
double iPX = event.player.prevPosX + (event.player.posX - event.player.prevPosX) * event.partialTicks;
|
||||
double iPY = event.player.prevPosY + (event.player.posY - event.player.prevPosY) * event.partialTicks;
|
||||
double iPZ = event.player.prevPosZ + (event.player.posZ - event.player.prevPosZ) * event.partialTicks;
|
||||
int texture = event.context.renderEngine.getTexture(Reference.SPRITE_SHEET_LOCATION + "noise.png");
|
||||
int texture = event.context.renderEngine.getTexture(Sprites.SPRITE_SHEET_LOCATION + Sprites.WORLD_TRANSMUTATION_TEXTURE);
|
||||
|
||||
int xScale = 1;
|
||||
int yScale = 1;
|
||||
int zScale = 1;
|
||||
int chargeLevel;
|
||||
int itemChargeLevel = 0;
|
||||
|
||||
|
||||
if (event.currentItem.getItem() instanceof IChargeable) {
|
||||
itemChargeLevel = ((IChargeable)event.currentItem.getItem()).getCharge(event.currentItem);
|
||||
itemChargeLevel = ((IChargeable) event.currentItem.getItem()).getCharge(event.currentItem);
|
||||
}
|
||||
|
||||
|
||||
chargeLevel = 1 + itemChargeLevel * 2;
|
||||
|
||||
if ((event.target.sideHit == 0) || (event.target.sideHit == 1)) {
|
||||
|
@ -132,15 +132,15 @@ public class DrawBlockHighlightHandler {
|
|||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
GL11.glColor4f(1, 1, 1, transparency);
|
||||
GL11.glColor4f(1, 1, 1, slide);
|
||||
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setColorRGBA_F(1, 1, 1, transparency);
|
||||
tessellator.setColorRGBA_F(1, 1, 1, slide);
|
||||
|
||||
tessellator.addVertexWithUV(-0.5D, 0.5D, 0F, 0, pulse);
|
||||
tessellator.addVertexWithUV(0.5D, 0.5D, 0F, 0, pulse);
|
||||
tessellator.addVertexWithUV(0.5D, -0.5D, 0F, 1, pulse);
|
||||
tessellator.addVertexWithUV(-0.5D, -0.5D, 0F, 1, pulse);
|
||||
tessellator.addVertexWithUV(-0.5D, 0.5D, 0F, 0, 1);
|
||||
tessellator.addVertexWithUV(0.5D, 0.5D, 0F, 1, 1);
|
||||
tessellator.addVertexWithUV(0.5D, -0.5D, 0F, 1, 0);
|
||||
tessellator.addVertexWithUV(-0.5D, -0.5D, 0F, 0, 0);
|
||||
|
||||
tessellator.draw();
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package ee3.common.core.handlers;
|
||||
package ee3.client.core.handlers;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
|
@ -19,7 +19,6 @@ import net.minecraft.src.ScaledResolution;
|
|||
import cpw.mods.fml.client.FMLClientHandler;
|
||||
import cpw.mods.fml.common.ITickHandler;
|
||||
import cpw.mods.fml.common.TickType;
|
||||
import ee3.client.core.handlers.DrawBlockHighlightHandler;
|
||||
import ee3.client.core.helper.RenderUtils;
|
||||
import ee3.common.core.helper.TransmutationHelper;
|
||||
import ee3.common.core.helper.VersionHelper;
|
||||
|
@ -44,7 +43,7 @@ public class RenderTickHandler implements ITickHandler {
|
|||
if (type.contains(TickType.RENDER)) {
|
||||
if (player != null) {
|
||||
currentItemStack = player.inventory.getCurrentItem();
|
||||
|
||||
|
||||
if ((currentItemStack != null) && (minecraft.inGameHasFocus) && (currentItemStack.getItem() instanceof ITransmutationStone) && (ConfigurationSettings.ENABLE_OVERLAY_WORLD_TRANSMUTATION)) {
|
||||
renderStoneHUD(minecraft, player, currentItemStack, (Float) tickData[0]);
|
||||
}
|
||||
|
@ -66,39 +65,39 @@ public class RenderTickHandler implements ITickHandler {
|
|||
|
||||
private static void renderStoneHUD(Minecraft minecraft, EntityPlayer player, ItemStack stack, float partialTicks) {
|
||||
|
||||
float overlayScale = 2F; // TODO config option
|
||||
float overlayScale = 2F; // TODO config option
|
||||
float blockScale = overlayScale / 2;
|
||||
float overlayOpacity = 1F; // TODO config option
|
||||
|
||||
float overlayOpacity = 1F; // TODO config option
|
||||
|
||||
MovingObjectPosition rayTrace = minecraft.objectMouseOver;
|
||||
ItemStack currentBlock = null;
|
||||
|
||||
|
||||
if ((player.worldObj != null) && (rayTrace != null)) {
|
||||
currentBlock = TransmutationHelper.getNextBlock(player.worldObj.getBlockId(rayTrace.blockX, rayTrace.blockY, rayTrace.blockZ), player.worldObj.getBlockMetadata(rayTrace.blockX, rayTrace.blockY, rayTrace.blockZ), player.isSneaking());
|
||||
}
|
||||
|
||||
|
||||
GL11.glPushMatrix();
|
||||
ScaledResolution sr = new ScaledResolution(minecraft.gameSettings, minecraft.displayWidth, minecraft.displayHeight);
|
||||
GL11.glClear(256);
|
||||
GL11.glMatrixMode(GL11.GL_PROJECTION);
|
||||
GL11.glLoadIdentity();
|
||||
GL11.glOrtho(0.0D, sr.getScaledWidth_double(), sr.getScaledHeight_double(), 0.0D, 1000.0D, 3000.0D);
|
||||
GL11.glMatrixMode(GL11.GL_MODELVIEW);
|
||||
GL11.glLoadIdentity();
|
||||
GL11.glTranslatef(0.0F, 0.0F, -2000.0F);
|
||||
|
||||
GL11.glPushMatrix();
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
GL11.glEnable(GL11.GL_COLOR_MATERIAL);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
RenderUtils.renderItemIntoGUI(minecraft.fontRenderer, minecraft.renderEngine, stack, (int) (sr.getScaledWidth() - (16 * overlayScale)), (int) (sr.getScaledHeight() - (16 * overlayScale)), overlayOpacity / 2, overlayScale);
|
||||
if ((currentBlock != null) && (currentBlock.getItem() instanceof ItemBlock)) {
|
||||
RenderUtils.renderRotatingBlockIntoGUI(minecraft.fontRenderer, minecraft.renderEngine, currentBlock, (int) (sr.getScaledWidth() - (16 * overlayScale) / 2 - 8), (int) (sr.getScaledHeight() - (16 * overlayScale) / 2 - 8), -90, blockScale);
|
||||
}
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glPopMatrix();
|
||||
ScaledResolution sr = new ScaledResolution(minecraft.gameSettings, minecraft.displayWidth, minecraft.displayHeight);
|
||||
GL11.glClear(256);
|
||||
GL11.glMatrixMode(GL11.GL_PROJECTION);
|
||||
GL11.glLoadIdentity();
|
||||
GL11.glOrtho(0.0D, sr.getScaledWidth_double(), sr.getScaledHeight_double(), 0.0D, 1000.0D, 3000.0D);
|
||||
GL11.glMatrixMode(GL11.GL_MODELVIEW);
|
||||
GL11.glLoadIdentity();
|
||||
GL11.glTranslatef(0.0F, 0.0F, -2000.0F);
|
||||
|
||||
GL11.glPushMatrix();
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
GL11.glEnable(GL11.GL_COLOR_MATERIAL);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
RenderUtils.renderItemIntoGUI(minecraft.fontRenderer, minecraft.renderEngine, stack, (int) (sr.getScaledWidth() - (16 * overlayScale)), (int) (sr.getScaledHeight() - (16 * overlayScale)), overlayOpacity / 2, overlayScale);
|
||||
if ((currentBlock != null) && (currentBlock.getItem() instanceof ItemBlock)) {
|
||||
RenderUtils.renderRotatingBlockIntoGUI(minecraft.fontRenderer, minecraft.renderEngine, currentBlock, (int) (sr.getScaledWidth() - (16 * overlayScale) / 2 - 8), (int) (sr.getScaledHeight() - (16 * overlayScale) / 2 - 8), -90, blockScale);
|
||||
}
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glPopMatrix();
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
|
@ -6,7 +6,7 @@ import cpw.mods.fml.common.Side;
|
|||
import cpw.mods.fml.common.asm.SideOnly;
|
||||
import cpw.mods.fml.common.registry.LanguageRegistry;
|
||||
import ee3.common.container.ContainerCalcinator;
|
||||
import ee3.common.lib.Reference;
|
||||
import ee3.common.lib.Sprites;
|
||||
import ee3.common.lib.Strings;
|
||||
import ee3.common.tile.TileCalcinator;
|
||||
import net.minecraft.src.Container;
|
||||
|
@ -42,7 +42,7 @@ public class GuiCalcinator extends GuiContainer {
|
|||
|
||||
protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3)
|
||||
{
|
||||
int var4 = this.mc.renderEngine.getTexture(Reference.GUI_SHEET_LOCATION + "calcinator.png");
|
||||
int var4 = this.mc.renderEngine.getTexture(Sprites.GUI_SHEET_LOCATION + Sprites.CALCINATOR_MODEL_TEXTURE);
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
this.mc.renderEngine.bindTexture(var4);
|
||||
int var5 = (this.width - this.xSize) / 2;
|
||||
|
|
|
@ -2,7 +2,7 @@ package ee3.client.render;
|
|||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import ee3.common.lib.Reference;
|
||||
import ee3.common.lib.Sprites;
|
||||
import ee3.common.tile.TileCalcinator;
|
||||
import net.minecraft.src.ModelBase;
|
||||
import net.minecraft.src.ModelRenderer;
|
||||
|
@ -130,7 +130,7 @@ public class ModelCalcinator extends ModelBase {
|
|||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
|
||||
GL11.glTranslated(x, y, z);
|
||||
ForgeHooksClient.bindTexture(Reference.SPRITE_SHEET_LOCATION + Reference.CALCINATOR_TEXTURE_SHEET, 0);
|
||||
ForgeHooksClient.bindTexture(Sprites.SPRITE_SHEET_LOCATION + Sprites.CALCINATOR_MODEL_TEXTURE, 0);
|
||||
|
||||
firePotBottom.render(scale);
|
||||
bowlBottom.render(scale);
|
||||
|
|
|
@ -3,6 +3,7 @@ package ee3.client.render;
|
|||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import ee3.common.lib.Reference;
|
||||
import ee3.common.lib.Sprites;
|
||||
import net.minecraft.src.ItemStack;
|
||||
import net.minecraft.src.Tessellator;
|
||||
import net.minecraftforge.client.ForgeHooksClient;
|
||||
|
@ -48,7 +49,7 @@ public class RenderItemCalcinator implements IItemRenderer {
|
|||
|
||||
private void renderCalcinator(float x, float y, float z) {
|
||||
Tessellator tesselator = Tessellator.instance;
|
||||
ForgeHooksClient.bindTexture(Reference.SPRITE_SHEET_LOCATION + "calcinator.png", 0);
|
||||
ForgeHooksClient.bindTexture(Sprites.SPRITE_SHEET_LOCATION + Sprites.CALCINATOR_MODEL_TEXTURE, 0);
|
||||
GL11.glPushMatrix(); //start
|
||||
GL11.glTranslatef(x, y, z); //size
|
||||
calcinatorModel.render(0.0625F);
|
||||
|
|
|
@ -6,7 +6,7 @@ import net.minecraft.src.RenderEngine;
|
|||
import net.minecraftforge.client.MinecraftForgeClient;
|
||||
import cpw.mods.fml.client.FMLTextureFX;
|
||||
import ee3.common.block.ModBlocks;
|
||||
import ee3.common.lib.Reference;
|
||||
import ee3.common.lib.Sprites;
|
||||
|
||||
/**
|
||||
* TextureRedWaterFX
|
||||
|
@ -42,7 +42,7 @@ public class TextureRedWaterFX extends FMLTextureFX {
|
|||
|
||||
@Override
|
||||
public void bindImage(RenderEngine renderEngine) {
|
||||
GL11.glBindTexture(GL11.GL_TEXTURE_2D, renderEngine.getTexture(Reference.SPRITE_SHEET_LOCATION + Reference.BLOCK_SPRITE_SHEET));
|
||||
GL11.glBindTexture(GL11.GL_TEXTURE_2D, renderEngine.getTexture(Sprites.SPRITE_SHEET_LOCATION + Sprites.BLOCK_SPRITE_SHEET));
|
||||
}
|
||||
|
||||
public void onTick() {
|
||||
|
|
|
@ -6,7 +6,7 @@ import org.lwjgl.opengl.GL11;
|
|||
|
||||
import cpw.mods.fml.client.FMLTextureFX;
|
||||
import ee3.common.block.ModBlocks;
|
||||
import ee3.common.lib.Reference;
|
||||
import ee3.common.lib.Sprites;
|
||||
|
||||
/**
|
||||
* TextureRedWaterFlowFX
|
||||
|
@ -43,7 +43,7 @@ public class TextureRedWaterFlowFX extends FMLTextureFX {
|
|||
|
||||
@Override
|
||||
public void bindImage(RenderEngine renderEngine) {
|
||||
GL11.glBindTexture(GL11.GL_TEXTURE_2D, renderEngine.getTexture(Reference.SPRITE_SHEET_LOCATION + Reference.BLOCK_SPRITE_SHEET));
|
||||
GL11.glBindTexture(GL11.GL_TEXTURE_2D, renderEngine.getTexture(Sprites.SPRITE_SHEET_LOCATION + Sprites.BLOCK_SPRITE_SHEET));
|
||||
}
|
||||
|
||||
public void onTick() {
|
||||
|
|
|
@ -17,6 +17,7 @@ import cpw.mods.fml.common.network.NetworkMod;
|
|||
import cpw.mods.fml.common.network.NetworkRegistry;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.common.registry.TickRegistry;
|
||||
import ee3.client.core.handlers.RenderTickHandler;
|
||||
import ee3.common.block.ModBlocks;
|
||||
import ee3.common.core.CommonProxy;
|
||||
import ee3.common.core.CreativeTabEE3;
|
||||
|
@ -28,7 +29,6 @@ import ee3.common.core.handlers.ItemPickupHandler;
|
|||
import ee3.common.core.handlers.LocalizationHandler;
|
||||
import ee3.common.core.handlers.PacketHandler;
|
||||
import ee3.common.core.handlers.PlayerDestroyItemHandler;
|
||||
import ee3.common.core.handlers.RenderTickHandler;
|
||||
import ee3.common.core.handlers.VersionCheckTickHandler;
|
||||
import ee3.common.core.helper.LogHelper;
|
||||
import ee3.common.core.helper.VersionHelper;
|
||||
|
|
|
@ -2,6 +2,8 @@ package ee3.common.block;
|
|||
|
||||
import ee3.common.EquivalentExchange3;
|
||||
import ee3.common.lib.Reference;
|
||||
import ee3.common.lib.Sprites;
|
||||
import ee3.common.lib.Strings;
|
||||
import net.minecraft.src.BlockFlowing;
|
||||
import net.minecraft.src.CreativeTabs;
|
||||
import net.minecraft.src.Material;
|
||||
|
@ -22,12 +24,12 @@ public class BlockRedWaterFlowing extends BlockFlowing {
|
|||
this.blockHardness = 100F;
|
||||
this.setLightOpacity(3);
|
||||
this.setCreativeTab(EquivalentExchange3.tabsEE3);
|
||||
this.setBlockName("redWaterFlowing");
|
||||
this.setBlockName(Strings.RED_WATER_FLOWING_NAME);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTextureFile() {
|
||||
return Reference.SPRITE_SHEET_LOCATION + Reference.BLOCK_SPRITE_SHEET;
|
||||
return Sprites.SPRITE_SHEET_LOCATION + Sprites.BLOCK_SPRITE_SHEET;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
package ee3.common.block;
|
||||
|
||||
import ee3.common.EquivalentExchange3;
|
||||
import ee3.common.lib.Reference;
|
||||
import ee3.common.lib.Sprites;
|
||||
import ee3.common.lib.Strings;
|
||||
import net.minecraft.src.BlockStationary;
|
||||
import net.minecraft.src.Material;
|
||||
|
||||
|
@ -20,7 +21,7 @@ public class BlockRedWaterStill extends BlockStationary {
|
|||
super(id, Material.water);
|
||||
this.blockHardness = 100F;
|
||||
this.setLightOpacity(3);
|
||||
this.setBlockName("redWaterStill");
|
||||
this.setBlockName(Strings.RED_WATER_STILL_NAME);
|
||||
this.setCreativeTab(EquivalentExchange3.tabsEE3);
|
||||
this.disableStats();
|
||||
this.setRequiresSelfNotify();
|
||||
|
@ -28,7 +29,7 @@ public class BlockRedWaterStill extends BlockStationary {
|
|||
|
||||
@Override
|
||||
public String getTextureFile() {
|
||||
return Reference.SPRITE_SHEET_LOCATION + Reference.BLOCK_SPRITE_SHEET;
|
||||
return Sprites.SPRITE_SHEET_LOCATION + Sprites.BLOCK_SPRITE_SHEET;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -16,19 +16,22 @@ import net.minecraft.src.ItemStack;
|
|||
*/
|
||||
public class EquivalencyHandler {
|
||||
|
||||
private static final EquivalencyHandler instance = new EquivalencyHandler();
|
||||
|
||||
private static final EquivalencyHandler instance = new EquivalencyHandler();
|
||||
|
||||
private static ArrayList<ArrayList<ItemStack>> equivalencyList = new ArrayList<ArrayList<ItemStack>>();
|
||||
|
||||
|
||||
public static EquivalencyHandler instance() {
|
||||
return instance;
|
||||
|
||||
return instance;
|
||||
}
|
||||
|
||||
|
||||
public ArrayList<ArrayList<ItemStack>> getAllLists() {
|
||||
return equivalencyList;
|
||||
|
||||
return equivalencyList;
|
||||
}
|
||||
|
||||
public void addObjects(Object obj1, Object obj2) {
|
||||
|
||||
ItemStack stack1 = GeneralHelper.convertObjectToItemStack(obj1);
|
||||
ItemStack stack2 = GeneralHelper.convertObjectToItemStack(obj2);
|
||||
|
||||
|
@ -39,7 +42,7 @@ public class EquivalencyHandler {
|
|||
|
||||
if ((stack1Index != null) && (stack2Index != null)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if ((stack1Index != null) && (stack2Index == null)) {
|
||||
currentList = equivalencyList.get(stack1Index.intValue());
|
||||
currentList.add(stack2);
|
||||
|
@ -58,6 +61,7 @@ public class EquivalencyHandler {
|
|||
}
|
||||
|
||||
public void addObjects(Object... objList) {
|
||||
|
||||
if (objList.length < 2)
|
||||
return;
|
||||
|
||||
|
@ -67,6 +71,7 @@ public class EquivalencyHandler {
|
|||
}
|
||||
|
||||
public Integer getIndexInList(Object obj) {
|
||||
|
||||
ItemStack checkStack = GeneralHelper.convertObjectToItemStack(obj);
|
||||
ArrayList<ItemStack> currentList;
|
||||
int i = 0;
|
||||
|
@ -83,25 +88,27 @@ public class EquivalencyHandler {
|
|||
|
||||
return null;
|
||||
}
|
||||
|
||||
public Integer getIndexinList(int id, int meta) {
|
||||
ArrayList<ItemStack> currentList;
|
||||
int i = 0;
|
||||
|
||||
while (i < equivalencyList.size()) {
|
||||
currentList = equivalencyList.get(i);
|
||||
for (ItemStack currentStack : currentList) {
|
||||
if ((id == currentStack.itemID) && (meta == currentStack.getItemDamage())) {
|
||||
return new Integer(i);
|
||||
}
|
||||
}
|
||||
++i;
|
||||
}
|
||||
public Integer getIndexInList(int id, int meta) {
|
||||
|
||||
return null;
|
||||
ArrayList<ItemStack> currentList;
|
||||
int i = 0;
|
||||
|
||||
while (i < equivalencyList.size()) {
|
||||
currentList = equivalencyList.get(i);
|
||||
for (ItemStack currentStack : currentList) {
|
||||
if ((id == currentStack.itemID) && (meta == currentStack.getItemDamage())) {
|
||||
return new Integer(i);
|
||||
}
|
||||
}
|
||||
++i;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public ArrayList<ItemStack> getEquivalencyList(Object obj) {
|
||||
|
||||
ItemStack checkStack = GeneralHelper.convertObjectToItemStack(obj);
|
||||
|
||||
if (checkStack == null)
|
||||
|
@ -117,95 +124,106 @@ public class EquivalencyHandler {
|
|||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public ArrayList<ItemStack> getEquivalencyList(int id, int meta) {
|
||||
for (ArrayList<ItemStack> list : equivalencyList) {
|
||||
for (ItemStack currentStack : list) {
|
||||
if ((id == currentStack.itemID) && (meta == currentStack.getItemDamage())) {
|
||||
return list;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
for (ArrayList<ItemStack> list : equivalencyList) {
|
||||
for (ItemStack currentStack : list) {
|
||||
if ((id == currentStack.itemID) && (meta == currentStack.getItemDamage())) {
|
||||
return list;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public ItemStack getNextInList(Object obj) {
|
||||
ItemStack checkStack = GeneralHelper.convertObjectToItemStack(obj);
|
||||
|
||||
if (checkStack != null) {
|
||||
return getNextInList(checkStack.itemID, checkStack.getItemDamage());
|
||||
}
|
||||
|
||||
return null;
|
||||
ItemStack checkStack = GeneralHelper.convertObjectToItemStack(obj);
|
||||
|
||||
if (checkStack != null) {
|
||||
return getNextInList(checkStack.itemID, checkStack.getItemDamage());
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public ItemStack getNextInList(int id, int meta) {
|
||||
ArrayList<ItemStack> list = getEquivalencyList(id, meta);
|
||||
|
||||
ItemStack currentStack;
|
||||
ItemStack returnStack = null;
|
||||
int i = 0;
|
||||
ArrayList<ItemStack> list = getEquivalencyList(id, meta);
|
||||
|
||||
if (list != null) {
|
||||
if (list.size() == 1) {
|
||||
return list.get(i);
|
||||
}
|
||||
|
||||
while (i < list.size()) {
|
||||
currentStack = list.get(i);
|
||||
|
||||
if ((id == currentStack.itemID) && (meta == currentStack.getItemDamage())) {
|
||||
returnStack = list.get((i + 1) % list.size());
|
||||
break;
|
||||
}
|
||||
|
||||
++i;
|
||||
}
|
||||
}
|
||||
ItemStack currentStack;
|
||||
ItemStack returnStack = null;
|
||||
int i = 0;
|
||||
|
||||
return returnStack;
|
||||
}
|
||||
|
||||
public ItemStack getPrevInList(Object obj) {
|
||||
ItemStack checkStack = GeneralHelper.convertObjectToItemStack(obj);
|
||||
|
||||
if (checkStack != null) {
|
||||
return getPrevInList(checkStack.itemID, checkStack.getItemDamage());
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public ItemStack getPrevInList(int id, int meta) {
|
||||
ArrayList<ItemStack> list = getEquivalencyList(id, meta);
|
||||
|
||||
ItemStack currentStack;
|
||||
ItemStack returnStack = null;
|
||||
int i = 0;
|
||||
|
||||
if (list != null) {
|
||||
if (list.size() == 1) {
|
||||
if (list != null) {
|
||||
if (list.size() == 1) {
|
||||
return list.get(i);
|
||||
}
|
||||
|
||||
while (i < list.size()) {
|
||||
currentStack = list.get(i);
|
||||
|
||||
if ((id == currentStack.itemID) && (meta == currentStack.getItemDamage())) {
|
||||
int index = ((i - 1) + list.size()) % list.size();
|
||||
returnStack = list.get(index);
|
||||
break;
|
||||
}
|
||||
|
||||
++i;
|
||||
}
|
||||
}
|
||||
|
||||
return returnStack;
|
||||
while (i < list.size()) {
|
||||
currentStack = list.get(i);
|
||||
|
||||
if ((id == currentStack.itemID) && (meta == currentStack.getItemDamage())) {
|
||||
returnStack = list.get((i + 1) % list.size());
|
||||
break;
|
||||
}
|
||||
|
||||
++i;
|
||||
}
|
||||
}
|
||||
|
||||
return returnStack;
|
||||
}
|
||||
|
||||
public ItemStack getPrevInList(Object obj) {
|
||||
|
||||
ItemStack checkStack = GeneralHelper.convertObjectToItemStack(obj);
|
||||
|
||||
if (checkStack != null) {
|
||||
return getPrevInList(checkStack.itemID, checkStack.getItemDamage());
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public ItemStack getPrevInList(int id, int meta) {
|
||||
|
||||
ArrayList<ItemStack> list = getEquivalencyList(id, meta);
|
||||
|
||||
ItemStack currentStack;
|
||||
ItemStack returnStack = null;
|
||||
int i = 0;
|
||||
|
||||
if (list != null) {
|
||||
if (list.size() == 1) {
|
||||
return list.get(i);
|
||||
}
|
||||
|
||||
while (i < list.size()) {
|
||||
currentStack = list.get(i);
|
||||
|
||||
if ((id == currentStack.itemID) && (meta == currentStack.getItemDamage())) {
|
||||
int index = ((i - 1) + list.size()) % list.size();
|
||||
returnStack = list.get(index);
|
||||
break;
|
||||
}
|
||||
|
||||
++i;
|
||||
}
|
||||
}
|
||||
|
||||
return returnStack;
|
||||
}
|
||||
|
||||
public boolean areEquivalent(Object obj1, Object obj2) {
|
||||
|
||||
return (getEquivalencyList(obj1).equals(getEquivalencyList(obj2)));
|
||||
}
|
||||
|
||||
public void debug() {
|
||||
|
||||
int i = 0;
|
||||
for (ArrayList list : equivalencyList) {
|
||||
System.out.println("equivalencyList[" + i + "]: " + list.toString());
|
||||
|
|
|
@ -30,7 +30,7 @@ public class TransmutationHelper {
|
|||
int meta = world.getBlockMetadata(x, y, z);
|
||||
|
||||
if ((world.getBlockMaterial(x, y, z) == Material.leaves) && (Block.blocksList[id] instanceof BlockLeaves)) {
|
||||
meta = meta % 4;
|
||||
meta = meta % 4;
|
||||
}
|
||||
|
||||
ItemStack nextItem = getNextBlock(id, meta, player.isSneaking());
|
||||
|
@ -42,70 +42,75 @@ public class TransmutationHelper {
|
|||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
public static ItemStack getNextBlock(int id, int meta, boolean allowFalling) {
|
||||
|
||||
ArrayList<ItemStack> list = EquivalencyHandler.instance().getEquivalencyList(id, meta);
|
||||
|
||||
|
||||
ItemStack nextStack = null;
|
||||
|
||||
|
||||
if (list != null) {
|
||||
return getNextBlock(id, meta, id, meta, allowFalling);
|
||||
}
|
||||
|
||||
|
||||
return nextStack;
|
||||
}
|
||||
|
||||
|
||||
private static ItemStack getNextBlock(int id, int meta, int origId, int origMeta, boolean allowFalling) {
|
||||
|
||||
ArrayList<ItemStack> list = EquivalencyHandler.instance().getEquivalencyList(id, meta);
|
||||
|
||||
|
||||
ItemStack nextStack = null;
|
||||
|
||||
|
||||
if (list != null) {
|
||||
nextStack = EquivalencyHandler.instance().getNextInList(id, meta);
|
||||
|
||||
/*
|
||||
* If the current item is the same as the original one we started with, then we have
|
||||
* recursed through the entire list and not found a next block so return the original.
|
||||
* This is the "base case" for the recursion.
|
||||
* If the current item is the same as the original one we started
|
||||
* with, then we have recursed through the entire list and not found
|
||||
* a next block so return the original. This is the "base case" for
|
||||
* the recursion.
|
||||
*/
|
||||
if ((nextStack.itemID == origId) && (nextStack.getItemDamage() == origMeta)) {
|
||||
return nextStack;
|
||||
return nextStack;
|
||||
}
|
||||
else {
|
||||
/*
|
||||
* If we are allowing any block (including falling ones) just check to see if the
|
||||
* next item is a block. If it is, return it. Otherwise continue the recursion.
|
||||
*/
|
||||
if (allowFalling) {
|
||||
if (nextStack.getItem() instanceof ItemBlock) {
|
||||
return nextStack;
|
||||
}
|
||||
else {
|
||||
return getNextBlock(nextStack.itemID, nextStack.getItemDamage(), origId, origMeta, allowFalling);
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Else we need to check to make sure the next item is both a block and not an
|
||||
* instance of BlockSand (which all gravity affected blocks are a subclass of.
|
||||
* If the next item is a block, and is not a subclass of BlockSand return it,
|
||||
* otherwise, continue the recursion.
|
||||
*/
|
||||
else {
|
||||
if ((nextStack.getItem() instanceof ItemBlock) && (!(Block.blocksList[nextStack.itemID] instanceof BlockSand))) {
|
||||
return nextStack;
|
||||
}
|
||||
else {
|
||||
return getNextBlock(nextStack.itemID, nextStack.getItemDamage(), origId, origMeta, allowFalling);
|
||||
}
|
||||
}
|
||||
/*
|
||||
* If we are allowing any block (including falling ones) just
|
||||
* check to see if the next item is a block. If it is, return
|
||||
* it. Otherwise continue the recursion.
|
||||
*/
|
||||
if (allowFalling) {
|
||||
if (nextStack.getItem() instanceof ItemBlock) {
|
||||
return nextStack;
|
||||
}
|
||||
else {
|
||||
return getNextBlock(nextStack.itemID, nextStack.getItemDamage(), origId, origMeta, allowFalling);
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Else we need to check to make sure the next item is both a
|
||||
* block and not an instance of BlockSand (which all gravity
|
||||
* affected blocks are a subclass of. If the next item is a
|
||||
* block, and is not a subclass of BlockSand return it,
|
||||
* otherwise, continue the recursion.
|
||||
*/
|
||||
else {
|
||||
if ((nextStack.getItem() instanceof ItemBlock) && (!(Block.blocksList[nextStack.itemID] instanceof BlockSand))) {
|
||||
return nextStack;
|
||||
}
|
||||
else {
|
||||
return getNextBlock(nextStack.itemID, nextStack.getItemDamage(), origId, origMeta, allowFalling);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// In the event the list is null, return null
|
||||
return nextStack;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package ee3.common.item;
|
||||
|
||||
import ee3.common.lib.Reference;
|
||||
import ee3.common.lib.Sprites;
|
||||
import net.minecraft.src.Item;
|
||||
|
||||
/**
|
||||
|
@ -17,7 +18,7 @@ public class ItemEE extends Item {
|
|||
public ItemEE(int id) {
|
||||
super(id - Reference.SHIFTED_ID_RANGE_CORRECTION);
|
||||
maxStackSize = 1;
|
||||
setTextureFile(Reference.SPRITE_SHEET_LOCATION + Reference.ITEM_SPRITE_SHEET);
|
||||
setTextureFile(Sprites.SPRITE_SHEET_LOCATION + Sprites.ITEM_SPRITE_SHEET);
|
||||
setNoRepair();
|
||||
}
|
||||
|
||||
|
|
|
@ -34,14 +34,6 @@ public class Reference {
|
|||
public static final String KEYBINDING_CHARGE = "key.charge";
|
||||
public static final int KEYBINDING_CHARGE_DEFAULT = 47;
|
||||
|
||||
/* Texture related constants */
|
||||
public static final String SPRITE_SHEET_LOCATION = "/ee3/art/sprites/";
|
||||
public static final String ARMOR_SHEET_LOCATION = "/ee3/art/armor/";
|
||||
public static final String GUI_SHEET_LOCATION = "/ee3/art/gui/";
|
||||
public static final String ITEM_SPRITE_SHEET = "ee3_items.png";
|
||||
public static final String BLOCK_SPRITE_SHEET = "ee3_blocks.png";
|
||||
public static final String CALCINATOR_TEXTURE_SHEET = "calcinator.png";
|
||||
|
||||
/* General Tile Entity related constants */
|
||||
public static final String TE_GEN_OWNER_NBT_TAG_LABEL = "owner";
|
||||
public static final String TE_GEN_STATE_NBT_TAG_LABEL = "state";
|
||||
|
|
15
ee3_common/ee3/common/lib/Sprites.java
Normal file
15
ee3_common/ee3/common/lib/Sprites.java
Normal file
|
@ -0,0 +1,15 @@
|
|||
package ee3.common.lib;
|
||||
|
||||
|
||||
public class Sprites {
|
||||
|
||||
public static final String SPRITE_SHEET_LOCATION = "/ee3/art/sprites/";
|
||||
public static final String ARMOR_SHEET_LOCATION = "/ee3/art/armor/";
|
||||
public static final String GUI_SHEET_LOCATION = "/ee3/art/gui/";
|
||||
|
||||
public static final String ITEM_SPRITE_SHEET = "ee3_items.png";
|
||||
public static final String BLOCK_SPRITE_SHEET = "ee3_blocks.png";
|
||||
public static final String CALCINATOR_MODEL_TEXTURE = "calcinator.png";
|
||||
public static final String WORLD_TRANSMUTATION_TEXTURE = "noise.png";
|
||||
|
||||
}
|
|
@ -21,6 +21,7 @@ public class Strings {
|
|||
/* Block name constants */
|
||||
public static final String CALCINATOR_NAME = "calcinator";
|
||||
public static final String RED_WATER_STILL_NAME = "redWaterStill";
|
||||
public static final String RED_WATER_FLOWING_NAME = "redWaterFlowing";
|
||||
|
||||
/* Item name constants */
|
||||
public static final String MINIUM_SHARD_NAME = "miniumShard";
|
||||
|
|
BIN
resources/ee3/art/sprites/test-circle.png
Normal file
BIN
resources/ee3/art/sprites/test-circle.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 19 KiB |
Loading…
Reference in a new issue