Added more tools, resources, added blast furnace, clay pot, started
adding metals, ores, improved water indicator.
|
|
@ -1,5 +1,6 @@
|
||||||
package projectzombie.display;
|
package projectzombie.display;
|
||||||
|
|
||||||
|
import gl_engine.MathHelpers;
|
||||||
import gl_engine.matrix.Matrix4;
|
import gl_engine.matrix.Matrix4;
|
||||||
import gl_engine.vec.Vec3d;
|
import gl_engine.vec.Vec3d;
|
||||||
import projectzombie.Main;
|
import projectzombie.Main;
|
||||||
|
|
|
||||||
|
|
@ -136,6 +136,7 @@ public class DisplayRender
|
||||||
GL33.glUniformMatrix4fv(Main.window.glsl_rotated, true, rotated.getArray());
|
GL33.glUniformMatrix4fv(Main.window.glsl_rotated, true, rotated.getArray());
|
||||||
GL33.glUniformMatrix4fv(Main.window.glsl_projection_sun, true, Camera.camera.projection_sun.getArray());
|
GL33.glUniformMatrix4fv(Main.window.glsl_projection_sun, true, Camera.camera.projection_sun.getArray());
|
||||||
GL33.glUniform1i(Main.window.glsl_time, (int)((System.currentTimeMillis() / 10) % 1000));
|
GL33.glUniform1i(Main.window.glsl_time, (int)((System.currentTimeMillis() / 10) % 1000));
|
||||||
|
GL33.glUniform1i(Main.window.glsl_do_lighting, 1);
|
||||||
|
|
||||||
Main.world.markPoolDirty();
|
Main.world.markPoolDirty();
|
||||||
|
|
||||||
|
|
@ -170,6 +171,8 @@ public class DisplayRender
|
||||||
Main.world.render(camera);
|
Main.world.render(camera);
|
||||||
|
|
||||||
player.chunk = Main.world.getLayer().getChunk(player.getPos().xz());
|
player.chunk = Main.world.getLayer().getChunk(player.getPos().xz());
|
||||||
|
|
||||||
|
GL33.glUniform1i(Main.window.glsl_do_lighting, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ import org.lwjgl.opengl.GL33;
|
||||||
|
|
||||||
import gl_engine.MathHelpers;
|
import gl_engine.MathHelpers;
|
||||||
import gl_engine.matrix.Matrix4;
|
import gl_engine.matrix.Matrix4;
|
||||||
|
import gl_engine.vec.Vec2d;
|
||||||
import gl_engine.vec.Vec3d;
|
import gl_engine.vec.Vec3d;
|
||||||
import projectzombie.Main;
|
import projectzombie.Main;
|
||||||
import projectzombie.init.Models;
|
import projectzombie.init.Models;
|
||||||
|
|
@ -94,9 +95,11 @@ public class DisplayRenderUI
|
||||||
ModelGui model_health_b = Models.UI_HEALTH_BG;
|
ModelGui model_health_b = Models.UI_HEALTH_BG;
|
||||||
ModelGui model_temperature = Models.UI_TEMPERATURE;
|
ModelGui model_temperature = Models.UI_TEMPERATURE;
|
||||||
ModelGui model_water = Models.UI_WATER;
|
ModelGui model_water = Models.UI_WATER;
|
||||||
|
Matrix4 matrix;
|
||||||
|
|
||||||
|
{
|
||||||
double offset = -(79 * 15.0) / 160;
|
double offset = -(79 * 15.0) / 160;
|
||||||
Matrix4 matrix = Matrix4.translate(offset, -9.5 + (1.5 * 17) / 16, 0);
|
matrix = Matrix4.translate(offset, -9.5 + (1.5 * 17) / 16, 0);
|
||||||
|
|
||||||
model_health_b.setModel(matrix);
|
model_health_b.setModel(matrix);
|
||||||
model_health_b.render();
|
model_health_b.render();
|
||||||
|
|
@ -109,14 +112,38 @@ public class DisplayRenderUI
|
||||||
|
|
||||||
model_health_f.setModel(matrix);
|
model_health_f.setModel(matrix);
|
||||||
model_health_f.render();
|
model_health_f.render();
|
||||||
|
}
|
||||||
GL33.glUniform1i(Main.window.glsl_do_discard_coords, 0);
|
|
||||||
|
|
||||||
double temperature = MathHelpers.smoothStep(Main.player.getTemperature());
|
double temperature = MathHelpers.smoothStep(Main.player.getTemperature());
|
||||||
double hydration = MathHelpers.smoothStep(1 - Main.player.getHydration()) * 0.75;
|
double hydration = MathHelpers.smoothStep(1 - Main.player.getHydration());
|
||||||
|
|
||||||
GL33.glUniform4f(Main.window.glsl_discard_coords, -1, -1, 1, 1);
|
{
|
||||||
|
Vec2d offset = new Vec2d((1 * 0.75) / 8, -9.5 + (1.5 * 17) / 16);
|
||||||
|
|
||||||
|
matrix = Matrix4.translate(offset.x, offset.y, 0);
|
||||||
|
|
||||||
|
GL33.glUniform1i(Main.window.glsl_do_discard_coords, 0);
|
||||||
|
GL33.glUniform4f(Main.window.glsl_color, 0.65f, 0.65f, 0.65f, 1);
|
||||||
|
|
||||||
|
model_water.setModel(matrix);
|
||||||
|
model_water.render();
|
||||||
|
|
||||||
|
GL33.glUniform1i(Main.window.glsl_do_discard_coords, 1);
|
||||||
|
|
||||||
|
GL33.glUniform4f(Main.window.glsl_discard_coords,
|
||||||
|
(float)offset.x, (float)offset.y,
|
||||||
|
(float)(offset.x + model_water.getWidth()),
|
||||||
|
(float)(offset.y + model_water.getHeight() * Main.player.getHydration()));
|
||||||
|
|
||||||
|
GL33.glUniform4f(Main.window.glsl_color,
|
||||||
|
(float)hydration * 0.75f, calculateGreen(hydration), 1 - (float)hydration, 1);
|
||||||
|
|
||||||
|
model_water.render();
|
||||||
|
|
||||||
|
GL33.glUniform1i(Main.window.glsl_do_discard_coords, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
GL33.glUniform4f(Main.window.glsl_color,
|
GL33.glUniform4f(Main.window.glsl_color,
|
||||||
(float)temperature, calculateGreen(temperature), 1 - (float)temperature, 1);
|
(float)temperature, calculateGreen(temperature), 1 - (float)temperature, 1);
|
||||||
|
|
||||||
|
|
@ -124,14 +151,7 @@ public class DisplayRenderUI
|
||||||
|
|
||||||
model_temperature.setModel(matrix);
|
model_temperature.setModel(matrix);
|
||||||
model_temperature.render();
|
model_temperature.render();
|
||||||
|
}
|
||||||
GL33.glUniform4f(Main.window.glsl_color,
|
|
||||||
(float)hydration * 0.75f, calculateGreen(hydration), 1 - (float)hydration, 1);
|
|
||||||
|
|
||||||
matrix = Matrix4.translate((1 * 0.75) / 8, -9.5 + (1.5 * 17) / 16, 0);
|
|
||||||
|
|
||||||
model_water.setModel(matrix);
|
|
||||||
model_water.render();
|
|
||||||
|
|
||||||
GL33.glUniform4f(Main.window.glsl_color, 1, 1, 1, 1);
|
GL33.glUniform4f(Main.window.glsl_color, 1, 1, 1, 1);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -46,6 +46,7 @@ public class DisplayWindow implements IMainloopTask
|
||||||
public int glsl_contrast;
|
public int glsl_contrast;
|
||||||
public int glsl_discard_coords;
|
public int glsl_discard_coords;
|
||||||
public int glsl_do_discard_coords;
|
public int glsl_do_discard_coords;
|
||||||
|
public int glsl_do_lighting;
|
||||||
public int glsl_model;
|
public int glsl_model;
|
||||||
public int glsl_camera;
|
public int glsl_camera;
|
||||||
public int glsl_projection;
|
public int glsl_projection;
|
||||||
|
|
@ -142,6 +143,7 @@ public class DisplayWindow implements IMainloopTask
|
||||||
glsl_time = GL33.glGetUniformLocation(environmentRenderer.program, "time");
|
glsl_time = GL33.glGetUniformLocation(environmentRenderer.program, "time");
|
||||||
glsl_discard_coords = GL33.glGetUniformLocation(environmentRenderer.program, "discard_coords");
|
glsl_discard_coords = GL33.glGetUniformLocation(environmentRenderer.program, "discard_coords");
|
||||||
glsl_do_discard_coords = GL33.glGetUniformLocation(environmentRenderer.program, "do_discard_coords");
|
glsl_do_discard_coords = GL33.glGetUniformLocation(environmentRenderer.program, "do_discard_coords");
|
||||||
|
glsl_do_lighting = GL33.glGetUniformLocation(environmentRenderer.program, "do_lighting");
|
||||||
glsl_color = GL33.glGetUniformLocation(environmentRenderer.program, "color");
|
glsl_color = GL33.glGetUniformLocation(environmentRenderer.program, "color");
|
||||||
glsl_contrast = GL33.glGetUniformLocation(environmentRenderer.program, "contrast");
|
glsl_contrast = GL33.glGetUniformLocation(environmentRenderer.program, "contrast");
|
||||||
glsl_billboard = GL33.glGetUniformLocation(environmentRenderer.program, "billboard");
|
glsl_billboard = GL33.glGetUniformLocation(environmentRenderer.program, "billboard");
|
||||||
|
|
|
||||||
|
|
@ -24,8 +24,8 @@ public abstract class Entity implements IBdfClassManager
|
||||||
public double hitbox = 1;
|
public double hitbox = 1;
|
||||||
public boolean isSolid = false;
|
public boolean isSolid = false;
|
||||||
public Chunk chunk;
|
public Chunk chunk;
|
||||||
protected TileState tile_front;
|
private TileState tile_front;
|
||||||
protected TileState tile_back;
|
private TileState tile_back;
|
||||||
protected static final Random rand = new Random();
|
protected static final Random rand = new Random();
|
||||||
public boolean emitsLight = false;
|
public boolean emitsLight = false;
|
||||||
private boolean isDead = false;
|
private boolean isDead = false;
|
||||||
|
|
@ -294,11 +294,12 @@ public abstract class Entity implements IBdfClassManager
|
||||||
isDead = true;
|
isDead = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void activateTile()
|
public void activateTile(Vec2i tpos)
|
||||||
{
|
{
|
||||||
// Get the tile position and the layer
|
// Get the tile position and the layer
|
||||||
Layer layer = Main.world.getLayer();
|
Layer layer = Main.world.getLayer();
|
||||||
Vec2i tpos = new Vec2i(MathHelpers.floor(pos.x)+0, MathHelpers.floor(pos.z)+0);
|
TileState tile_front = layer.getFrontTile(tpos);
|
||||||
|
TileState tile_back = layer.getBackTile(tpos);
|
||||||
|
|
||||||
// Activate both tiles
|
// Activate both tiles
|
||||||
tile_front.tile.onActivated(layer, tpos, this, tile_front);
|
tile_front.tile.onActivated(layer, tpos, this, tile_front);
|
||||||
|
|
|
||||||
|
|
@ -157,6 +157,6 @@ public class EntityExplosion extends Entity
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Model getModel() {
|
public Model getModel() {
|
||||||
return Models.EMPTY;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ public class EntityFlare extends EntityTnt
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Model getModel() {
|
public Model getModel() {
|
||||||
return active ? Models.ENTITY_FLARE : Models.EMPTY;
|
return active ? Models.ENTITY_FLARE : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -99,7 +99,7 @@ public class EntityTnt extends Entity implements EntityHoldsEntities
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Model getModel() {
|
public Model getModel() {
|
||||||
return active ? Models.ENTITY_TNT : Models.EMPTY;
|
return active ? Models.ENTITY_TNT : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,7 @@ import projectzombie.entity.EntityItem;
|
||||||
import projectzombie.entity.particle.ParticleBreak;
|
import projectzombie.entity.particle.ParticleBreak;
|
||||||
import projectzombie.init.Items;
|
import projectzombie.init.Items;
|
||||||
import projectzombie.init.Models;
|
import projectzombie.init.Models;
|
||||||
|
import projectzombie.init.Tiles;
|
||||||
import projectzombie.inventory.Inventory;
|
import projectzombie.inventory.Inventory;
|
||||||
import projectzombie.inventory.InventoryArmor;
|
import projectzombie.inventory.InventoryArmor;
|
||||||
import projectzombie.inventory.InventoryClothing;
|
import projectzombie.inventory.InventoryClothing;
|
||||||
|
|
@ -32,6 +33,7 @@ import projectzombie.model.ModelPlayer;
|
||||||
import projectzombie.settings.Cheats;
|
import projectzombie.settings.Cheats;
|
||||||
import projectzombie.task.Task;
|
import projectzombie.task.Task;
|
||||||
import projectzombie.task.TaskDeathScreen;
|
import projectzombie.task.TaskDeathScreen;
|
||||||
|
import projectzombie.tiles.TileSapling;
|
||||||
import projectzombie.util.math.ItemStack;
|
import projectzombie.util.math.ItemStack;
|
||||||
import projectzombie.util.math.TileState;
|
import projectzombie.util.math.TileState;
|
||||||
import projectzombie.world.chunk.Chunk;
|
import projectzombie.world.chunk.Chunk;
|
||||||
|
|
@ -53,7 +55,7 @@ public class EntityPlayer extends Entity implements
|
||||||
private double health = health_max;
|
private double health = health_max;
|
||||||
private double temperature = 0.5;
|
private double temperature = 0.5;
|
||||||
private double hydration = 1;
|
private double hydration = 1;
|
||||||
private int break_progress = 0;
|
private double break_progress = 0;
|
||||||
private Vec2i break_pos = new Vec2i(0, 0);
|
private Vec2i break_pos = new Vec2i(0, 0);
|
||||||
public boolean dead = false;
|
public boolean dead = false;
|
||||||
public boolean in_animation = false;
|
public boolean in_animation = false;
|
||||||
|
|
@ -96,6 +98,10 @@ public class EntityPlayer extends Entity implements
|
||||||
for(int i=0;i<tasks.length;i++) {
|
for(int i=0;i<tasks.length;i++) {
|
||||||
this.tasks.add(tasks[i]);
|
this.tasks.add(tasks[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(hydration > 1) {
|
||||||
|
hydration = 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getAmmo() {
|
public int getAmmo() {
|
||||||
|
|
@ -268,7 +274,9 @@ public class EntityPlayer extends Entity implements
|
||||||
|
|
||||||
if(is.isEmpty() || !is.item.onPlayerLeftClick(is, Main.world.getLayer(), this, place_pos))
|
if(is.isEmpty() || !is.item.onPlayerLeftClick(is, Main.world.getLayer(), this, place_pos))
|
||||||
{
|
{
|
||||||
ItemTool tool = (is.item instanceof ItemTool) ? (ItemTool) is.item : null;
|
boolean isTool = is.item instanceof ItemTool;
|
||||||
|
ItemTool tool = isTool ? (ItemTool) is.item : null;
|
||||||
|
double speed = isTool ? ((ItemTool) is.item).toolSpeed(is) : 1;
|
||||||
Vec2i pos = place_pos.toInt();
|
Vec2i pos = place_pos.toInt();
|
||||||
|
|
||||||
for(int ti=0;ti<2;ti++)
|
for(int ti=0;ti<2;ti++)
|
||||||
|
|
@ -281,9 +289,9 @@ public class EntityPlayer extends Entity implements
|
||||||
ts = layer.getBackTile(pos);
|
ts = layer.getBackTile(pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(ts.tile.canTileBreak(tile_front, is, tool))
|
if(ts.tile.canTileBreak(ts, is, tool))
|
||||||
{
|
{
|
||||||
break_progress += 1;
|
break_progress += speed;
|
||||||
|
|
||||||
if(!pos.equal(break_pos)) {
|
if(!pos.equal(break_pos)) {
|
||||||
break_progress = 0;
|
break_progress = 0;
|
||||||
|
|
@ -300,11 +308,13 @@ public class EntityPlayer extends Entity implements
|
||||||
new Vec3d(0, 0, 0), stack));
|
new Vec3d(0, 0, 0), stack));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(ts.tile.doBreak(layer, chunk, ts, pos)) {
|
||||||
if(ti == 0) {
|
if(ti == 0) {
|
||||||
layer.breakFrontTile(pos);
|
layer.breakFrontTile(pos);
|
||||||
} else {
|
} else {
|
||||||
layer.breakBackTile(pos);
|
layer.breakBackTile(pos);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
break_progress = 0;
|
break_progress = 0;
|
||||||
|
|
||||||
|
|
@ -323,10 +333,11 @@ public class EntityPlayer extends Entity implements
|
||||||
if(dead || in_animation) return;
|
if(dead || in_animation) return;
|
||||||
|
|
||||||
ItemStack is = inventory.getItem(inventory_hand);
|
ItemStack is = inventory.getItem(inventory_hand);
|
||||||
Vec2d place_pos = getPos().xz().add(MathHelpers.moveTowards2(1, Math.toRadians(angle)));
|
Vec2d movement = MathHelpers.moveTowards2(1, Math.toRadians(angle));
|
||||||
|
Vec2d place_pos = getPos().xz().add(movement);
|
||||||
|
|
||||||
if(is.isEmpty() || !is.item.onPlayerRightClick(is, Main.world.getLayer(), this, place_pos)) {
|
if(is.isEmpty() || !is.item.onPlayerRightClick(is, Main.world.getLayer(), this, place_pos)) {
|
||||||
activateTile();
|
activateTile(getPos().xz().add(movement.multiply(0.5)).toInt());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -399,6 +410,7 @@ public class EntityPlayer extends Entity implements
|
||||||
|
|
||||||
public void render()
|
public void render()
|
||||||
{
|
{
|
||||||
|
Layer layer = Main.world.getLayer();
|
||||||
Model model = getModel();
|
Model model = getModel();
|
||||||
model.setModel(Matrix4.identity());
|
model.setModel(Matrix4.identity());
|
||||||
model.render();
|
model.render();
|
||||||
|
|
@ -412,13 +424,14 @@ public class EntityPlayer extends Entity implements
|
||||||
Model model_place = holding.item.getPlaceModel(holding);
|
Model model_place = holding.item.getPlaceModel(holding);
|
||||||
Model model_spawn = holding.item.getSpawnModel(holding);
|
Model model_spawn = holding.item.getSpawnModel(holding);
|
||||||
Vec2d pos = ppos.xz().add(MathHelpers.moveTowards2(1, Math.toRadians(angle)));
|
Vec2d pos = ppos.xz().add(MathHelpers.moveTowards2(1, Math.toRadians(angle)));
|
||||||
|
boolean render_place_model = model_place != null && layer.getFrontTile(pos.toInt()).tile == Tiles.VOID;
|
||||||
|
|
||||||
if(model_place != null || model_spawn != null)
|
if(render_place_model || model_spawn != null)
|
||||||
{
|
{
|
||||||
GL33.glUniform4f(Main.window.glsl_color, 0.5f, 0.75f, 0.5f, 1);
|
GL33.glUniform4f(Main.window.glsl_color, 0.5f, 0.75f, 0.5f, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(model_place != null)
|
if(render_place_model)
|
||||||
{
|
{
|
||||||
model_place.setModel(Matrix4.translate(Math.floor(pos.x) - ppos.x + 0.5, 0, Math.floor(pos.y) - ppos.z + 0.5));
|
model_place.setModel(Matrix4.translate(Math.floor(pos.x) - ppos.x + 0.5, 0, Math.floor(pos.y) - ppos.z + 0.5));
|
||||||
model_place.render();
|
model_place.render();
|
||||||
|
|
@ -430,7 +443,7 @@ public class EntityPlayer extends Entity implements
|
||||||
model_spawn.render();
|
model_spawn.render();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(model_place != null || model_spawn != null)
|
if(render_place_model || model_spawn != null)
|
||||||
{
|
{
|
||||||
GL33.glUniform4f(Main.window.glsl_color, 1, 1, 1, 1);
|
GL33.glUniform4f(Main.window.glsl_color, 1, 1, 1, 1);
|
||||||
}
|
}
|
||||||
|
|
@ -468,8 +481,13 @@ public class EntityPlayer extends Entity implements
|
||||||
tasks.add(task);
|
tasks.add(task);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void rehydrate() {
|
public void rehydrate()
|
||||||
|
{
|
||||||
hydration += 0.001;
|
hydration += 0.001;
|
||||||
|
|
||||||
|
if(hydration > 1) {
|
||||||
|
hydration = 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -8,15 +8,12 @@ import projectzombie.model.IModel;
|
||||||
|
|
||||||
public abstract class TileEntity extends Entity
|
public abstract class TileEntity extends Entity
|
||||||
{
|
{
|
||||||
public TileEntity(Vec2i pos) {
|
public TileEntity() {
|
||||||
super(new Vec3d(pos.x, 0, pos.y), new Vec3d(0, 0, 0));
|
super(new Vec3d(0, 0, 0), new Vec3d(0, 0, 0));
|
||||||
}
|
|
||||||
|
|
||||||
protected TileEntity() {
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IModel getModel() {
|
public IModel getModel() {
|
||||||
return Models.EMPTY;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,257 @@
|
||||||
|
package projectzombie.entity.tileentity;
|
||||||
|
|
||||||
|
import bdf.types.BdfNamedList;
|
||||||
|
import bdf.types.BdfObject;
|
||||||
|
import gl_engine.vec.Vec2i;
|
||||||
|
import projectzombie.Main;
|
||||||
|
import projectzombie.init.Items;
|
||||||
|
import projectzombie.init.Tiles;
|
||||||
|
import projectzombie.inventory.Inventory;
|
||||||
|
import projectzombie.items.ItemBurnable;
|
||||||
|
import projectzombie.items.ItemSmeltable;
|
||||||
|
import projectzombie.items.ItemFlint;
|
||||||
|
import projectzombie.items.ItemSmeltable;
|
||||||
|
import projectzombie.items.modifier.ItemModifierDamage;
|
||||||
|
import projectzombie.menu.MenuInventoryStorage;
|
||||||
|
import projectzombie.menu.gui.GUIItemSlotGetter;
|
||||||
|
import projectzombie.util.math.ItemStack;
|
||||||
|
import projectzombie.util.math.TileState;
|
||||||
|
import projectzombie.world.chunk.Chunk;
|
||||||
|
import projectzombie.world.layer.Layer;
|
||||||
|
|
||||||
|
public class TileEntityBlastFurnace extends TileEntity
|
||||||
|
{
|
||||||
|
private ItemStack burning;
|
||||||
|
private Inventory inventory;
|
||||||
|
private int next_level;
|
||||||
|
private int burn_time;
|
||||||
|
private int smelt_time;
|
||||||
|
private int smelt_slot = -1;
|
||||||
|
private int level;
|
||||||
|
|
||||||
|
public TileEntityBlastFurnace(BdfObject bdf) {
|
||||||
|
BdfClassLoad(bdf);
|
||||||
|
}
|
||||||
|
|
||||||
|
public TileEntityBlastFurnace(Vec2i pos) {
|
||||||
|
inventory = new Inventory(8);
|
||||||
|
burning = ItemStack.getEmpty();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void BdfClassLoad(BdfObject bdf) {
|
||||||
|
super.BdfClassLoad(bdf);
|
||||||
|
|
||||||
|
BdfNamedList nl = bdf.getNamedList();
|
||||||
|
|
||||||
|
inventory = new Inventory(nl.get("inventory"));
|
||||||
|
burning = new ItemStack(nl.get("burning"));
|
||||||
|
|
||||||
|
burn_time = nl.get("burnTime").getInteger();
|
||||||
|
smelt_time = nl.get("smeltTime").getInteger();
|
||||||
|
smelt_slot = nl.get("smeltSlot").getInteger();
|
||||||
|
next_level = nl.get("nextLevel").getInteger();
|
||||||
|
level = nl.get("level").getInteger();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void BdfClassSave(BdfObject bdf) {
|
||||||
|
super.BdfClassSave(bdf);
|
||||||
|
|
||||||
|
BdfNamedList nl = bdf.getNamedList();
|
||||||
|
|
||||||
|
inventory.BdfClassSave(nl.get("inventory"));
|
||||||
|
burning.BdfClassSave(nl.get("burning"));
|
||||||
|
|
||||||
|
nl.set("burnTime", bdf.newObject().setInteger(burn_time));
|
||||||
|
nl.set("smeltTime", bdf.newObject().setInteger(smelt_time));
|
||||||
|
nl.set("smeltSlot", bdf.newObject().setInteger(smelt_slot));
|
||||||
|
nl.set("nextLevel", bdf.newObject().setInteger(next_level));
|
||||||
|
nl.set("level", bdf.newObject().setInteger(level));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateTile() {
|
||||||
|
chunk.setFrontTile(new TileState(Tiles.BLAST_FURNACE, (byte)level), getPos().xz().toInt());
|
||||||
|
}
|
||||||
|
|
||||||
|
private void checkForFuel()
|
||||||
|
{
|
||||||
|
for(int i=0;i<inventory.getSlotCount();i++)
|
||||||
|
{
|
||||||
|
ItemStack stack = inventory.getItem(i);
|
||||||
|
|
||||||
|
if(stack.isEmpty()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(stack.item instanceof ItemBurnable)
|
||||||
|
{
|
||||||
|
stack.count -= 1;
|
||||||
|
|
||||||
|
burning = stack.copy();
|
||||||
|
burning.count = 1;
|
||||||
|
|
||||||
|
burn_time = ((ItemBurnable)stack.item).getBurnTime(burning);
|
||||||
|
|
||||||
|
if(level < 4)
|
||||||
|
{
|
||||||
|
level = 4;
|
||||||
|
updateTile();
|
||||||
|
|
||||||
|
Vec2i tpos = getPos().xz().toInt();
|
||||||
|
|
||||||
|
if(chunk.getBackTile(tpos).tile == Tiles.GRASS) {
|
||||||
|
chunk.setBackTile(Tiles.GRASS_BURNT.getDefaultState(), tpos);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void tick(Chunk chunk, Layer layer)
|
||||||
|
{
|
||||||
|
super.tick(chunk, layer);
|
||||||
|
|
||||||
|
// Check for smeltable items if things aren't being smelted
|
||||||
|
if(inventory.getItem(smelt_slot).isEmpty())
|
||||||
|
{
|
||||||
|
for(int i=0;i<inventory.getSlotCount();i++)
|
||||||
|
{
|
||||||
|
ItemStack stack = inventory.getItem(i);
|
||||||
|
|
||||||
|
if(stack.isEmpty()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(stack.item instanceof ItemSmeltable) {
|
||||||
|
smelt_slot = i;
|
||||||
|
smelt_time = 1600;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Smelt the item thats currently being smelted
|
||||||
|
// and process them if they have finished smelting.
|
||||||
|
// Make sure any non-smeltable items don't get smelted.
|
||||||
|
{
|
||||||
|
ItemStack stack = inventory.getItem(smelt_slot);
|
||||||
|
|
||||||
|
if(!stack.isEmpty() && stack.item instanceof ItemSmeltable)
|
||||||
|
{
|
||||||
|
smelt_time -= 1;
|
||||||
|
|
||||||
|
if(smelt_time < 0)
|
||||||
|
{
|
||||||
|
stack.count -= 1;
|
||||||
|
|
||||||
|
ItemStack[] result = ((ItemSmeltable)stack.item).getSmeltProducts(stack);
|
||||||
|
|
||||||
|
for(int i=0;i<result.length;i++) {
|
||||||
|
inventory.addItem(result[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check for fuel if the fuel has run out
|
||||||
|
if(burning.isEmpty())
|
||||||
|
{
|
||||||
|
// Check for fuel and possibly add it if its available
|
||||||
|
checkForFuel();
|
||||||
|
|
||||||
|
if(!burning.isEmpty()) {
|
||||||
|
next_level = 1600;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if there is fuel
|
||||||
|
// This could have changed since
|
||||||
|
// the last check for fuel
|
||||||
|
if(!burning.isEmpty())
|
||||||
|
{
|
||||||
|
burn_time -= 1;
|
||||||
|
|
||||||
|
if(burn_time < 0)
|
||||||
|
{
|
||||||
|
burn_time = 0;
|
||||||
|
burning.count = 0;
|
||||||
|
|
||||||
|
for(ItemStack stack : ((ItemBurnable)burning.item).getBurnProducts(burning)) {
|
||||||
|
inventory.addItem(stack);
|
||||||
|
}
|
||||||
|
|
||||||
|
checkForFuel();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
next_level -= 1;
|
||||||
|
|
||||||
|
// Make the fire burn brighter/darker based on whether there is fuel or not
|
||||||
|
if(next_level < 0)
|
||||||
|
{
|
||||||
|
if(burning.isEmpty())
|
||||||
|
{
|
||||||
|
next_level = 200;
|
||||||
|
level -= 1;
|
||||||
|
|
||||||
|
if(level < 0) {
|
||||||
|
level = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
else {
|
||||||
|
updateTile();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
else
|
||||||
|
{
|
||||||
|
next_level = 1600;
|
||||||
|
level += 1;
|
||||||
|
|
||||||
|
if(level > 16) {
|
||||||
|
level = 16;
|
||||||
|
}
|
||||||
|
|
||||||
|
else {
|
||||||
|
updateTile();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Inventory getInventory() {
|
||||||
|
return inventory;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onOpened() {
|
||||||
|
Main.menu = new MenuInventoryStorage(Main.menu, inventory, new GUIItemSlotGetter() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setItemStack(ItemStack stack) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isAllowed(ItemStack stack)
|
||||||
|
{
|
||||||
|
if(stack.item instanceof ItemBurnable) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(stack.item instanceof ItemSmeltable) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ItemStack getItemStack() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,22 +1,264 @@
|
||||||
package projectzombie.entity.tileentity;
|
package projectzombie.entity.tileentity;
|
||||||
|
|
||||||
|
import bdf.types.BdfNamedList;
|
||||||
import bdf.types.BdfObject;
|
import bdf.types.BdfObject;
|
||||||
import gl_engine.vec.Vec2i;
|
import gl_engine.vec.Vec2i;
|
||||||
|
import projectzombie.Main;
|
||||||
|
import projectzombie.init.Items;
|
||||||
|
import projectzombie.init.Tiles;
|
||||||
|
import projectzombie.inventory.Inventory;
|
||||||
|
import projectzombie.items.ItemBurnable;
|
||||||
|
import projectzombie.items.ItemCookable;
|
||||||
|
import projectzombie.items.ItemFlint;
|
||||||
|
import projectzombie.items.ItemSmeltable;
|
||||||
|
import projectzombie.items.modifier.ItemModifierDamage;
|
||||||
|
import projectzombie.menu.MenuInventoryStorage;
|
||||||
|
import projectzombie.menu.gui.GUIItemSlotGetter;
|
||||||
|
import projectzombie.util.math.ItemStack;
|
||||||
|
import projectzombie.util.math.TileState;
|
||||||
import projectzombie.world.chunk.Chunk;
|
import projectzombie.world.chunk.Chunk;
|
||||||
import projectzombie.world.layer.Layer;
|
import projectzombie.world.layer.Layer;
|
||||||
|
|
||||||
public class TileEntityCampfire extends TileEntity
|
public class TileEntityCampfire extends TileEntity
|
||||||
{
|
{
|
||||||
|
private ItemStack burning;
|
||||||
|
private Inventory inventory;
|
||||||
|
private int next_level;
|
||||||
|
private int burn_time;
|
||||||
|
private int cook_time;
|
||||||
|
private int cook_slot;
|
||||||
|
private int level;
|
||||||
|
|
||||||
public TileEntityCampfire(BdfObject bdf) {
|
public TileEntityCampfire(BdfObject bdf) {
|
||||||
BdfClassLoad(bdf);
|
BdfClassLoad(bdf);
|
||||||
}
|
}
|
||||||
|
|
||||||
public TileEntityCampfire(Vec2i pos) {
|
public TileEntityCampfire(Vec2i pos) {
|
||||||
super(pos);
|
inventory = new Inventory(8);
|
||||||
|
burning = ItemStack.getEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void tick(Chunk chunk, Layer layer) {
|
public void BdfClassLoad(BdfObject bdf) {
|
||||||
|
super.BdfClassLoad(bdf);
|
||||||
|
|
||||||
|
BdfNamedList nl = bdf.getNamedList();
|
||||||
|
|
||||||
|
inventory = new Inventory(nl.get("inventory"));
|
||||||
|
burning = new ItemStack(nl.get("burning"));
|
||||||
|
|
||||||
|
burn_time = nl.get("burnTime").getInteger();
|
||||||
|
cook_time = nl.get("cookTime").getInteger();
|
||||||
|
cook_slot = nl.get("cookSlot").getInteger();
|
||||||
|
next_level = nl.get("nextLevel").getInteger();
|
||||||
|
level = nl.get("level").getInteger();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void BdfClassSave(BdfObject bdf) {
|
||||||
|
super.BdfClassSave(bdf);
|
||||||
|
|
||||||
|
BdfNamedList nl = bdf.getNamedList();
|
||||||
|
|
||||||
|
inventory.BdfClassSave(nl.get("inventory"));
|
||||||
|
burning.BdfClassSave(nl.get("burning"));
|
||||||
|
|
||||||
|
nl.set("burnTime", bdf.newObject().setInteger(burn_time));
|
||||||
|
nl.set("cookTime", bdf.newObject().setInteger(cook_time));
|
||||||
|
nl.set("cookSlot", bdf.newObject().setInteger(cook_slot));
|
||||||
|
nl.set("nextLevel", bdf.newObject().setInteger(next_level));
|
||||||
|
nl.set("level", bdf.newObject().setInteger(level));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateTile() {
|
||||||
|
chunk.setFrontTile(new TileState(Tiles.CAMPFIRE, (byte)level), getPos().xz().toInt());
|
||||||
|
}
|
||||||
|
|
||||||
|
private void checkForFuel()
|
||||||
|
{
|
||||||
|
for(int i=0;i<inventory.getSlotCount();i++)
|
||||||
|
{
|
||||||
|
ItemStack stack = inventory.getItem(i);
|
||||||
|
|
||||||
|
if(stack.isEmpty()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(stack.item instanceof ItemBurnable)
|
||||||
|
{
|
||||||
|
stack.count -= 1;
|
||||||
|
|
||||||
|
burning = stack.copy();
|
||||||
|
burning.count = 1;
|
||||||
|
|
||||||
|
burn_time = ((ItemBurnable)stack.item).getBurnTime(burning);
|
||||||
|
|
||||||
|
if(level < 4)
|
||||||
|
{
|
||||||
|
level = 4;
|
||||||
|
updateTile();
|
||||||
|
|
||||||
|
Vec2i tpos = getPos().xz().toInt();
|
||||||
|
|
||||||
|
if(chunk.getBackTile(tpos).tile == Tiles.GRASS) {
|
||||||
|
chunk.setBackTile(Tiles.GRASS_BURNT.getDefaultState(), tpos);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void tick(Chunk chunk, Layer layer)
|
||||||
|
{
|
||||||
super.tick(chunk, layer);
|
super.tick(chunk, layer);
|
||||||
|
|
||||||
|
// Check for fuel if the fuel has run out
|
||||||
|
if(burning.isEmpty())
|
||||||
|
{
|
||||||
|
// Check for fuel and possibly add it if its available
|
||||||
|
checkForFuel();
|
||||||
|
|
||||||
|
if(!burning.isEmpty()) {
|
||||||
|
next_level = 1600;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if there is fuel
|
||||||
|
// This could have changed since
|
||||||
|
// the last check for fuel
|
||||||
|
if(!burning.isEmpty())
|
||||||
|
{
|
||||||
|
burn_time -= 1;
|
||||||
|
|
||||||
|
if(burn_time < 0)
|
||||||
|
{
|
||||||
|
burn_time = 0;
|
||||||
|
burning.count = 0;
|
||||||
|
|
||||||
|
for(ItemStack stack : ((ItemBurnable)burning.item).getBurnProducts(burning)) {
|
||||||
|
inventory.addItem(stack);
|
||||||
|
}
|
||||||
|
|
||||||
|
checkForFuel();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(level > 0)
|
||||||
|
{
|
||||||
|
ItemStack stack = inventory.getItem(cook_slot);
|
||||||
|
|
||||||
|
// Check for cookable items if things aren't being cooked
|
||||||
|
if(stack.isEmpty() || !(stack.item instanceof ItemCookable))
|
||||||
|
{
|
||||||
|
cook_time = 1600;
|
||||||
|
|
||||||
|
for(int i=0;i<inventory.getSlotCount();i++)
|
||||||
|
{
|
||||||
|
ItemStack check = inventory.getItem(i);
|
||||||
|
|
||||||
|
if(check.isEmpty()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(check.item instanceof ItemCookable) {
|
||||||
|
cook_slot = i;
|
||||||
|
cook_time = 1600;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Cook the item thats currently being cooked
|
||||||
|
// and process them if they have finished cooking.
|
||||||
|
// Make sure any non-cookable items don't get cooked.
|
||||||
|
|
||||||
|
stack = inventory.getItem(cook_slot);
|
||||||
|
|
||||||
|
if(!stack.isEmpty() && stack.item instanceof ItemCookable)
|
||||||
|
{
|
||||||
|
cook_time -= 1;
|
||||||
|
|
||||||
|
if(cook_time < 0)
|
||||||
|
{
|
||||||
|
stack.count -= 1;
|
||||||
|
cook_time = 1600;
|
||||||
|
|
||||||
|
ItemStack[] result = ((ItemCookable)stack.item).getCookProducts(stack);
|
||||||
|
|
||||||
|
for(int i=0;i<result.length;i++) {
|
||||||
|
inventory.addItem(result[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
next_level -= 1;
|
||||||
|
|
||||||
|
// Make the fire burn brighter/darker based on whether there is fuel or not
|
||||||
|
if(next_level < 0)
|
||||||
|
{
|
||||||
|
if(burning.isEmpty())
|
||||||
|
{
|
||||||
|
next_level = 200;
|
||||||
|
level -= 1;
|
||||||
|
|
||||||
|
if(level < 0) {
|
||||||
|
level = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
else {
|
||||||
|
updateTile();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
else
|
||||||
|
{
|
||||||
|
next_level = 1600;
|
||||||
|
level += 1;
|
||||||
|
|
||||||
|
if(level > 16) {
|
||||||
|
level = 16;
|
||||||
|
}
|
||||||
|
|
||||||
|
else {
|
||||||
|
updateTile();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Inventory getInventory() {
|
||||||
|
return inventory;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onOpened() {
|
||||||
|
Main.menu = new MenuInventoryStorage(Main.menu, inventory, new GUIItemSlotGetter() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setItemStack(ItemStack stack) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isAllowed(ItemStack stack)
|
||||||
|
{
|
||||||
|
if(stack.item instanceof ItemBurnable) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(stack.item instanceof ItemCookable) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ItemStack getItemStack() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,42 @@
|
||||||
|
package projectzombie.entity.tileentity;
|
||||||
|
|
||||||
|
import bdf.types.BdfNamedList;
|
||||||
|
import bdf.types.BdfObject;
|
||||||
|
import projectzombie.util.math.ItemStack;
|
||||||
|
|
||||||
|
public class TileEntityClayPot extends TileEntity
|
||||||
|
{
|
||||||
|
private double volume;
|
||||||
|
|
||||||
|
public TileEntityClayPot(double volume) {
|
||||||
|
this.volume = volume;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TileEntityClayPot(BdfObject bdf) {
|
||||||
|
BdfClassLoad(bdf);
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getVolume() {
|
||||||
|
return volume;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setVolume(double volume) {
|
||||||
|
this.volume = volume;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void BdfClassLoad(BdfObject bdf) {
|
||||||
|
super.BdfClassLoad(bdf);
|
||||||
|
|
||||||
|
BdfNamedList nl = bdf.getNamedList();
|
||||||
|
volume = nl.get("volume").getDouble();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void BdfClassSave(BdfObject bdf) {
|
||||||
|
super.BdfClassSave(bdf);
|
||||||
|
|
||||||
|
BdfNamedList nl = bdf.getNamedList();
|
||||||
|
nl.set("volume", bdf.newObject().setDouble(volume));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -16,7 +16,9 @@ import projectzombie.entity.EntityTnt;
|
||||||
import projectzombie.entity.EntityZombie;
|
import projectzombie.entity.EntityZombie;
|
||||||
import projectzombie.entity.EntityZombieArmored;
|
import projectzombie.entity.EntityZombieArmored;
|
||||||
import projectzombie.entity.player.EntityPlayer;
|
import projectzombie.entity.player.EntityPlayer;
|
||||||
|
import projectzombie.entity.tileentity.TileEntityBlastFurnace;
|
||||||
import projectzombie.entity.tileentity.TileEntityCampfire;
|
import projectzombie.entity.tileentity.TileEntityCampfire;
|
||||||
|
import projectzombie.entity.tileentity.TileEntityClayPot;
|
||||||
|
|
||||||
public class Entities
|
public class Entities
|
||||||
{
|
{
|
||||||
|
|
@ -49,5 +51,7 @@ public class Entities
|
||||||
register(EntityPlayer.class);
|
register(EntityPlayer.class);
|
||||||
register(EntityContainer.class);
|
register(EntityContainer.class);
|
||||||
register(TileEntityCampfire.class);
|
register(TileEntityCampfire.class);
|
||||||
|
register(TileEntityBlastFurnace.class);
|
||||||
|
register(TileEntityClayPot.class);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,9 @@ import java.util.ArrayList;
|
||||||
import bdf.types.BdfObject;
|
import bdf.types.BdfObject;
|
||||||
import projectzombie.items.modifier.ItemModifier;
|
import projectzombie.items.modifier.ItemModifier;
|
||||||
import projectzombie.items.modifier.ItemModifierDamage;
|
import projectzombie.items.modifier.ItemModifierDamage;
|
||||||
|
import projectzombie.items.modifier.ItemModifierFluidStorage;
|
||||||
import projectzombie.items.modifier.ItemModifierMeta;
|
import projectzombie.items.modifier.ItemModifierMeta;
|
||||||
|
import projectzombie.items.modifier.ItemModifierWater;
|
||||||
|
|
||||||
public class ItemModifiers
|
public class ItemModifiers
|
||||||
{
|
{
|
||||||
|
|
@ -27,5 +29,7 @@ public class ItemModifiers
|
||||||
{
|
{
|
||||||
register(ItemModifierMeta.class);
|
register(ItemModifierMeta.class);
|
||||||
register(ItemModifierDamage.class);
|
register(ItemModifierDamage.class);
|
||||||
|
register(ItemModifierFluidStorage.class);
|
||||||
|
register(ItemModifierWater.class);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,12 @@ import java.util.ArrayList;
|
||||||
import projectzombie.items.Item;
|
import projectzombie.items.Item;
|
||||||
import projectzombie.items.ItemAcorn;
|
import projectzombie.items.ItemAcorn;
|
||||||
import projectzombie.items.ItemAmmo;
|
import projectzombie.items.ItemAmmo;
|
||||||
|
import projectzombie.items.ItemAsh;
|
||||||
|
import projectzombie.items.ItemBlastFurnace;
|
||||||
import projectzombie.items.ItemCampfire;
|
import projectzombie.items.ItemCampfire;
|
||||||
|
import projectzombie.items.ItemCharcoal;
|
||||||
|
import projectzombie.items.ItemClayPot;
|
||||||
|
import projectzombie.items.ItemClayPotWet;
|
||||||
import projectzombie.items.ItemEmpty;
|
import projectzombie.items.ItemEmpty;
|
||||||
import projectzombie.items.ItemFlare;
|
import projectzombie.items.ItemFlare;
|
||||||
import projectzombie.items.ItemFlint;
|
import projectzombie.items.ItemFlint;
|
||||||
|
|
@ -16,9 +21,15 @@ import projectzombie.items.ItemHempSeed;
|
||||||
import projectzombie.items.ItemInfestation;
|
import projectzombie.items.ItemInfestation;
|
||||||
import projectzombie.items.ItemLantern;
|
import projectzombie.items.ItemLantern;
|
||||||
import projectzombie.items.ItemLog;
|
import projectzombie.items.ItemLog;
|
||||||
|
import projectzombie.items.ItemMetal;
|
||||||
|
import projectzombie.items.ItemOre;
|
||||||
import projectzombie.items.ItemPlantFibre;
|
import projectzombie.items.ItemPlantFibre;
|
||||||
import projectzombie.items.ItemRock;
|
import projectzombie.items.ItemRock;
|
||||||
|
import projectzombie.items.ItemStoneHatchet;
|
||||||
|
import projectzombie.items.ItemStonePick;
|
||||||
|
import projectzombie.items.ItemStoneShovel;
|
||||||
import projectzombie.items.ItemTnt;
|
import projectzombie.items.ItemTnt;
|
||||||
|
import projectzombie.items.ItemWorkbench;
|
||||||
import projectzombie.items.spawner.ItemSpawnDummy;
|
import projectzombie.items.spawner.ItemSpawnDummy;
|
||||||
import projectzombie.items.spawner.ItemSpawnZombie;
|
import projectzombie.items.spawner.ItemSpawnZombie;
|
||||||
|
|
||||||
|
|
@ -52,6 +63,17 @@ public class Items
|
||||||
register(INFESTATION);
|
register(INFESTATION);
|
||||||
register(FLINT_HATCHET);
|
register(FLINT_HATCHET);
|
||||||
register(CAMPFIRE);
|
register(CAMPFIRE);
|
||||||
|
register(CHARCOAL);
|
||||||
|
register(ASH);
|
||||||
|
register(WORKBENCH);
|
||||||
|
register(STONE_HATCHET);
|
||||||
|
register(STONE_PICK);
|
||||||
|
register(STONE_SHOVEL);
|
||||||
|
register(METAL);
|
||||||
|
register(ORE);
|
||||||
|
register(BLAST_FURNACE);
|
||||||
|
register(CLAY_POT);
|
||||||
|
register(CLAY_POT_WET);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final Item AMMO = new ItemAmmo();
|
public static final Item AMMO = new ItemAmmo();
|
||||||
|
|
@ -72,4 +94,15 @@ public class Items
|
||||||
public static final Item CAMPFIRE = new ItemCampfire();
|
public static final Item CAMPFIRE = new ItemCampfire();
|
||||||
public static final Item FLINT_HATCHET = new ItemFlintHatchet();
|
public static final Item FLINT_HATCHET = new ItemFlintHatchet();
|
||||||
public static final Item INFESTATION = new ItemInfestation();
|
public static final Item INFESTATION = new ItemInfestation();
|
||||||
|
public static final Item CHARCOAL = new ItemCharcoal();
|
||||||
|
public static final Item ASH = new ItemAsh();
|
||||||
|
public static final Item WORKBENCH = new ItemWorkbench();
|
||||||
|
public static final Item STONE_SHOVEL = new ItemStoneShovel();
|
||||||
|
public static final Item STONE_PICK = new ItemStonePick();
|
||||||
|
public static final Item STONE_HATCHET = new ItemStoneHatchet();
|
||||||
|
public static final Item METAL = new ItemMetal();
|
||||||
|
public static final Item ORE = new ItemOre();
|
||||||
|
public static final Item BLAST_FURNACE = new ItemBlastFurnace();
|
||||||
|
public static final Item CLAY_POT = new ItemClayPot();
|
||||||
|
public static final Item CLAY_POT_WET = new ItemClayPotWet();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@ import projectzombie.model.ModelVertical;
|
||||||
public class Models
|
public class Models
|
||||||
{
|
{
|
||||||
public static final Model EMPTY = new ModelEmpty();
|
public static final Model EMPTY = new ModelEmpty();
|
||||||
|
public static final Model TILE_MISSING = new ModelTile(Resources.TEX_EMPTY);
|
||||||
|
|
||||||
public static final Model TILE_TALL_GRASS = new ModelTallGrass();
|
public static final Model TILE_TALL_GRASS = new ModelTallGrass();
|
||||||
public static final Model TILE_GRASS = new ModelGrass();
|
public static final Model TILE_GRASS = new ModelGrass();
|
||||||
|
|
@ -28,6 +29,12 @@ public class Models
|
||||||
public static final Model TILE_TREE_SNOW = new ModelTreeSnow();
|
public static final Model TILE_TREE_SNOW = new ModelTreeSnow();
|
||||||
|
|
||||||
public static final Model TILE_CAMPFIRE = new ModelCross(Resources.ATLAS.get("/tile/campfire.png"));
|
public static final Model TILE_CAMPFIRE = new ModelCross(Resources.ATLAS.get("/tile/campfire.png"));
|
||||||
|
public static final Model TILE_BLAST_FURNACE = new ModelBox(Resources.ATLAS.get("/tile/blast_furnace.png"));
|
||||||
|
public static final Model TILE_WORKBENCH = new ModelBox(Resources.ATLAS.get("/tile/workbench.png"));
|
||||||
|
public static final Model TILE_CLAY_POT_EMPTY = new ModelBox(Resources.ATLAS.get("/tile/clay_pot_empty.png"));
|
||||||
|
public static final Model TILE_CLAY_POT_WATER_1 = new ModelBox(Resources.ATLAS.get("/tile/clay_pot_water_1.png"));
|
||||||
|
public static final Model TILE_CLAY_POT_WATER_2 = new ModelBox(Resources.ATLAS.get("/tile/clay_pot_water_2.png"));
|
||||||
|
public static final Model TILE_CLAY_POT_WATER_3 = new ModelBox(Resources.ATLAS.get("/tile/clay_pot_water_3.png"));
|
||||||
|
|
||||||
public static final Model TILE_SAPLING_1 = new ModelCross(Resources.ATLAS.get("/tile/sapling1.png"));
|
public static final Model TILE_SAPLING_1 = new ModelCross(Resources.ATLAS.get("/tile/sapling1.png"));
|
||||||
public static final Model TILE_SAPLING_2 = new ModelCross(Resources.ATLAS.get("/tile/sapling2.png"));
|
public static final Model TILE_SAPLING_2 = new ModelCross(Resources.ATLAS.get("/tile/sapling2.png"));
|
||||||
|
|
@ -56,6 +63,7 @@ public class Models
|
||||||
public static final Model TILE_SANDSTONE = new ModelTile(Resources.ATLAS.get("/tile/sandstone.png"));
|
public static final Model TILE_SANDSTONE = new ModelTile(Resources.ATLAS.get("/tile/sandstone.png"));
|
||||||
public static final Model TILE_SANDSTONE_WALL = new ModelTile(Resources.ATLAS.get("/tile/sandstone_wall.png"));
|
public static final Model TILE_SANDSTONE_WALL = new ModelTile(Resources.ATLAS.get("/tile/sandstone_wall.png"));
|
||||||
public static final Model TILE_GRASS_INFESTED = new ModelTile(Resources.ATLAS.get("/tile/grass_infested.png"));
|
public static final Model TILE_GRASS_INFESTED = new ModelTile(Resources.ATLAS.get("/tile/grass_infested.png"));
|
||||||
|
public static final Model TILE_GRASS_BURNT = new ModelTile(Resources.ATLAS.get("/tile/grass_burnt.png"));
|
||||||
public static final Model TILE_SAND = new ModelTile(Resources.ATLAS.get("/tile/sand.png"));
|
public static final Model TILE_SAND = new ModelTile(Resources.ATLAS.get("/tile/sand.png"));
|
||||||
public static final Model TILE_STONE = new ModelTile(Resources.ATLAS.get("/tile/stone.png"));
|
public static final Model TILE_STONE = new ModelTile(Resources.ATLAS.get("/tile/stone.png"));
|
||||||
public static final Model TILE_DIRT = new ModelTile(Resources.ATLAS.get("/tile/dirt.png"));
|
public static final Model TILE_DIRT = new ModelTile(Resources.ATLAS.get("/tile/dirt.png"));
|
||||||
|
|
@ -72,6 +80,10 @@ public class Models
|
||||||
public static final Model TILE_LAVA = new ModelTile(Resources.ATLAS.get("/tile/lava.png"), 16, 50);
|
public static final Model TILE_LAVA = new ModelTile(Resources.ATLAS.get("/tile/lava.png"), 16, 50);
|
||||||
public static final Model TILE_LAVA_FLOW = new ModelTile(Resources.ATLAS.get("/tile/lava_flow.png"), 16, 50);
|
public static final Model TILE_LAVA_FLOW = new ModelTile(Resources.ATLAS.get("/tile/lava_flow.png"), 16, 50);
|
||||||
public static final Model TILE_LANTERN = new ModelVertical(Resources.ATLAS.get("/tile/lantern.png"), 4, 5);
|
public static final Model TILE_LANTERN = new ModelVertical(Resources.ATLAS.get("/tile/lantern.png"), 4, 5);
|
||||||
|
public static final Model TILE_ORE_IRON = new ModelTile(Resources.ATLAS.get("/tile/ore_iron.png"));
|
||||||
|
public static final Model TILE_ORE_GOLD = new ModelTile(Resources.ATLAS.get("/tile/ore_gold.png"));
|
||||||
|
public static final Model TILE_ORE_TIN = new ModelTile(Resources.ATLAS.get("/tile/ore_tin.png"));
|
||||||
|
public static final Model TILE_ORE_COPPER = new ModelTile(Resources.ATLAS.get("/tile/ore_copper.png"));
|
||||||
|
|
||||||
public static final Model ENTITY_BOSS_IDLE = new ModelVertical(Resources.ATLAS.get("/entity/boss1/boss_still.png"), new Vec2d(4, 4));
|
public static final Model ENTITY_BOSS_IDLE = new ModelVertical(Resources.ATLAS.get("/entity/boss1/boss_still.png"), new Vec2d(4, 4));
|
||||||
public static final Model ENTITY_BOSS_FIRING = new ModelVertical(Resources.ATLAS.get("/entity/boss1/boss_firing.png"), new Vec2d(4, 4), 4, 50);
|
public static final Model ENTITY_BOSS_FIRING = new ModelVertical(Resources.ATLAS.get("/entity/boss1/boss_firing.png"), new Vec2d(4, 4), 4, 50);
|
||||||
|
|
@ -131,7 +143,10 @@ public class Models
|
||||||
public static final ModelItem UI_SLOT_CLOTHING_BOOTS = new ModelItem(Resources.ATLAS.get("/gui/slot_clothing_boots.png"));
|
public static final ModelItem UI_SLOT_CLOTHING_BOOTS = new ModelItem(Resources.ATLAS.get("/gui/slot_clothing_boots.png"));
|
||||||
|
|
||||||
public static final ModelItem ITEM_EMPTY = ModelItem.createEmpty();
|
public static final ModelItem ITEM_EMPTY = ModelItem.createEmpty();
|
||||||
|
public static final ModelItem ITEM_MISSING = new ModelItem(Resources.TEX_EMPTY);
|
||||||
public static final ModelItem ITEM_CAMPFIRE = new ModelItem(Resources.ATLAS.get("/tile/campfire.png"));
|
public static final ModelItem ITEM_CAMPFIRE = new ModelItem(Resources.ATLAS.get("/tile/campfire.png"));
|
||||||
|
public static final ModelItem ITEM_BLAST_FURNACE = new ModelItem(Resources.ATLAS.get("/item/blast_furnace.png"));
|
||||||
|
public static final ModelItem ITEM_WORKBENCH = new ModelItem(Resources.ATLAS.get("/item/workbench.png"));
|
||||||
public static final ModelItem ITEM_GRAPPLING_HOOK = new ModelItem(Resources.ATLAS.get("/item/grappling_hook.png"));
|
public static final ModelItem ITEM_GRAPPLING_HOOK = new ModelItem(Resources.ATLAS.get("/item/grappling_hook.png"));
|
||||||
public static final ModelItem ITEM_HEALTH_POTION = new ModelItem(Resources.ATLAS.get("/item/health_potion.png"));
|
public static final ModelItem ITEM_HEALTH_POTION = new ModelItem(Resources.ATLAS.get("/item/health_potion.png"));
|
||||||
public static final ModelItem ITEM_AMMO_BOX = new ModelItem(Resources.ATLAS.get("/item/ammo_box.png"));
|
public static final ModelItem ITEM_AMMO_BOX = new ModelItem(Resources.ATLAS.get("/item/ammo_box.png"));
|
||||||
|
|
@ -139,6 +154,22 @@ public class Models
|
||||||
public static final ModelItem ITEM_FLARE = new ModelItem(Resources.ATLAS.get("/entity/flare.png"));
|
public static final ModelItem ITEM_FLARE = new ModelItem(Resources.ATLAS.get("/entity/flare.png"));
|
||||||
public static final ModelItem ITEM_LANTERN = new ModelItem(Resources.ATLAS.get("/tile/lantern.png"), 4, 5);
|
public static final ModelItem ITEM_LANTERN = new ModelItem(Resources.ATLAS.get("/tile/lantern.png"), 4, 5);
|
||||||
|
|
||||||
|
public static final ModelItem ITEM_CLAY_POT_WET = new ModelItem(Resources.ATLAS.get("/item/clay_pot_wet.png"));
|
||||||
|
public static final ModelItem ITEM_CLAY_POT_EMPTY = new ModelItem(Resources.ATLAS.get("/item/clay_pot_empty.png"));
|
||||||
|
public static final ModelItem ITEM_CLAY_POT_WATER_1 = new ModelItem(Resources.ATLAS.get("/item/clay_pot_water1.png"));
|
||||||
|
public static final ModelItem ITEM_CLAY_POT_WATER_2 = new ModelItem(Resources.ATLAS.get("/item/clay_pot_water2.png"));
|
||||||
|
public static final ModelItem ITEM_CLAY_POT_WATER_3 = new ModelItem(Resources.ATLAS.get("/item/clay_pot_water3.png"));
|
||||||
|
|
||||||
|
public static final ModelItem ITEM_FLINT_HATCHET = new ModelItem(Resources.ATLAS.get("/item/flint_hatchet.png"));
|
||||||
|
public static final ModelItem ITEM_STONE_HATCHET = new ModelItem(Resources.ATLAS.get("/item/stone_hatchet.png"));
|
||||||
|
public static final ModelItem ITEM_STONE_PICK = new ModelItem(Resources.ATLAS.get("/item/stone_pick.png"));
|
||||||
|
public static final ModelItem ITEM_STONE_SHOVEL = new ModelItem(Resources.ATLAS.get("/item/stone_shovel.png"));
|
||||||
|
|
||||||
|
public static final ModelItem ITEM_ORE_IRON = new ModelItem(Resources.ATLAS.get("/item/ore_iron.png"));
|
||||||
|
public static final ModelItem ITEM_ORE_COPPER = new ModelItem(Resources.ATLAS.get("/item/ore_copper.png"));
|
||||||
|
public static final ModelItem ITEM_ORE_TIN = new ModelItem(Resources.ATLAS.get("/item/ore_tin.png"));
|
||||||
|
public static final ModelItem ITEM_ORE_GOLD = new ModelItem(Resources.ATLAS.get("/item/ore_gold.png"));
|
||||||
|
|
||||||
public static final ModelItem ITEM_SPAWN_ZOMBIE = new ModelItem(Resources.ATLAS.get("/entity/zombie_front_moving.png"), 4, 10);
|
public static final ModelItem ITEM_SPAWN_ZOMBIE = new ModelItem(Resources.ATLAS.get("/entity/zombie_front_moving.png"), 4, 10);
|
||||||
public static final ModelItem ITEM_SPAWN_DUMMY = new ModelItem(Resources.ATLAS.get("/entity/dummy.png"));
|
public static final ModelItem ITEM_SPAWN_DUMMY = new ModelItem(Resources.ATLAS.get("/entity/dummy.png"));
|
||||||
|
|
||||||
|
|
@ -146,14 +177,21 @@ public class Models
|
||||||
public static final ModelItem ITEM_SNOW_PILE = new ModelItem(Resources.ATLAS.get("/item/snow_pile.png"));
|
public static final ModelItem ITEM_SNOW_PILE = new ModelItem(Resources.ATLAS.get("/item/snow_pile.png"));
|
||||||
public static final ModelItem ITEM_SANDSTONE = new ModelItem(Resources.ATLAS.get("/item/sandstone.png"));
|
public static final ModelItem ITEM_SANDSTONE = new ModelItem(Resources.ATLAS.get("/item/sandstone.png"));
|
||||||
public static final ModelItem ITEM_FLINT = new ModelItem(Resources.ATLAS.get("/item/flint.png"));
|
public static final ModelItem ITEM_FLINT = new ModelItem(Resources.ATLAS.get("/item/flint.png"));
|
||||||
|
public static final ModelItem ITEM_CLAY = new ModelItem(Resources.ATLAS.get("/item/clay.png"));
|
||||||
public static final ModelItem ITEM_FLINT_HATCHET = new ModelItem(Resources.ATLAS.get("/item/flint_hatchet.png"));
|
public static final ModelItem ITEM_IRON = new ModelItem(Resources.ATLAS.get("/item/iron.png"));
|
||||||
|
public static final ModelItem ITEM_COPPER = new ModelItem(Resources.ATLAS.get("/item/copper.png"));
|
||||||
|
public static final ModelItem ITEM_TIN = new ModelItem(Resources.ATLAS.get("/item/tin.png"));
|
||||||
|
public static final ModelItem ITEM_GOLD = new ModelItem(Resources.ATLAS.get("/item/gold.png"));
|
||||||
|
public static final ModelItem ITEM_SLAG = new ModelItem(Resources.ATLAS.get("/item/slag.png"));
|
||||||
|
public static final ModelItem ITEM_COAL = new ModelItem(Resources.ATLAS.get("/item/coal.png"));
|
||||||
|
|
||||||
public static final ModelItem ITEM_PLANT_FIBRE = new ModelItem(Resources.ATLAS.get("/item/plant_fibre.png"));
|
public static final ModelItem ITEM_PLANT_FIBRE = new ModelItem(Resources.ATLAS.get("/item/plant_fibre.png"));
|
||||||
public static final ModelItem ITEM_HEMP_SEED = new ModelItem(Resources.ATLAS.get("/item/hemp_seed.png"));
|
public static final ModelItem ITEM_HEMP_SEED = new ModelItem(Resources.ATLAS.get("/item/hemp_seed.png"));
|
||||||
public static final ModelItem ITEM_ACORN = new ModelItem(Resources.ATLAS.get("/item/acorn.png"));
|
public static final ModelItem ITEM_ACORN = new ModelItem(Resources.ATLAS.get("/item/acorn.png"));
|
||||||
public static final ModelItem ITEM_LOG = new ModelItem(Resources.ATLAS.get("/item/log.png"));
|
public static final ModelItem ITEM_LOG = new ModelItem(Resources.ATLAS.get("/item/log.png"));
|
||||||
public static final ModelItem ITEM_LOG_SNOW = new ModelItem(Resources.ATLAS.get("/item/log_snow.png"));
|
public static final ModelItem ITEM_LOG_SNOW = new ModelItem(Resources.ATLAS.get("/item/log_snow.png"));
|
||||||
|
public static final ModelItem ITEM_CHARCOAL = new ModelItem(Resources.ATLAS.get("/item/charcoal.png"));
|
||||||
|
public static final ModelItem ITEM_ASH = new ModelItem(Resources.ATLAS.get("/item/ash.png"));
|
||||||
|
|
||||||
// Player varients
|
// Player varients
|
||||||
public static final ModelPlayer ENTITY_PLAYER_W = new ModelPlayer(
|
public static final ModelPlayer ENTITY_PLAYER_W = new ModelPlayer(
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ import projectzombie.inventory.Crafting;
|
||||||
import projectzombie.inventory.recipe.Recipe;
|
import projectzombie.inventory.recipe.Recipe;
|
||||||
import projectzombie.inventory.recipe.RecipeBasic;
|
import projectzombie.inventory.recipe.RecipeBasic;
|
||||||
import projectzombie.items.modifier.ItemModifierDamage;
|
import projectzombie.items.modifier.ItemModifierDamage;
|
||||||
|
import projectzombie.items.modifier.ItemModifierMeta;
|
||||||
import projectzombie.util.math.ItemStack;
|
import projectzombie.util.math.ItemStack;
|
||||||
|
|
||||||
public class Recipes
|
public class Recipes
|
||||||
|
|
@ -38,30 +39,77 @@ public class Recipes
|
||||||
{
|
{
|
||||||
recipies = new ArrayList<Recipe>();
|
recipies = new ArrayList<Recipe>();
|
||||||
|
|
||||||
|
// Basic crafting items
|
||||||
|
|
||||||
recipies.add(new RecipeBasic(
|
recipies.add(new RecipeBasic(
|
||||||
new ItemStack[] {
|
new ItemStack[] {
|
||||||
new ItemStack(Items.FLINT, 2),
|
new ItemStack(Items.FLINT, 2),
|
||||||
new ItemStack(Items.PLANT_FIBRE, 5),
|
new ItemStack(Items.PLANT_FIBRE, 5),
|
||||||
}, new Crafting[] {
|
}, new Crafting[] {
|
||||||
Crafting.BASIC,
|
Crafting.BASIC,
|
||||||
}, new ItemStack(Items.FLINT_HATCHET, 1, new ItemModifierDamage(0, 10))));
|
|
||||||
|
|
||||||
recipies.add(new RecipeBasic(
|
|
||||||
new ItemStack[] {
|
|
||||||
new ItemStack(Items.FLINT, 1),
|
|
||||||
new ItemStack(Items.PLANT_FIBRE, 1),
|
|
||||||
}, new Crafting[] {
|
|
||||||
Crafting.BASIC,
|
|
||||||
}, new ItemStack(Items.FLINT_HATCHET, 1)));
|
}, new ItemStack(Items.FLINT_HATCHET, 1)));
|
||||||
|
|
||||||
recipies.add(new RecipeBasic(
|
recipies.add(new RecipeBasic(
|
||||||
new ItemStack[] {
|
new ItemStack[] {
|
||||||
new ItemStack(Items.LOG, 1),
|
new ItemStack(Items.LOG, 12),
|
||||||
new ItemStack(Items.ROCK, 1),
|
new ItemStack(Items.ROCK, 8, new ItemModifierMeta(0)),
|
||||||
}, new Crafting[] {
|
}, new Crafting[] {
|
||||||
Crafting.BASIC,
|
Crafting.BASIC,
|
||||||
}, new ItemStack(Items.CAMPFIRE, 1)));
|
}, new ItemStack(Items.CAMPFIRE, 1)));
|
||||||
|
|
||||||
|
recipies.add(new RecipeBasic(
|
||||||
|
new ItemStack[] {
|
||||||
|
new ItemStack(Items.LOG, 16),
|
||||||
|
new ItemStack(Items.ROCK, 4, new ItemModifierMeta(0)),
|
||||||
|
new ItemStack(Items.PLANT_FIBRE, 8),
|
||||||
|
}, new Crafting[] {
|
||||||
|
Crafting.BASIC,
|
||||||
|
}, new ItemStack(Items.WORKBENCH, 1)));
|
||||||
|
|
||||||
|
|
||||||
|
// Workbench items
|
||||||
|
|
||||||
|
recipies.add(new RecipeBasic(
|
||||||
|
new ItemStack[] {
|
||||||
|
new ItemStack(Items.LOG, 4),
|
||||||
|
new ItemStack(Items.ROCK, 3, new ItemModifierMeta(0)),
|
||||||
|
new ItemStack(Items.PLANT_FIBRE, 3),
|
||||||
|
}, new Crafting[] {
|
||||||
|
Crafting.WOODEN_WORKBENCH,
|
||||||
|
}, new ItemStack(Items.STONE_PICK, 1)));
|
||||||
|
|
||||||
|
recipies.add(new RecipeBasic(
|
||||||
|
new ItemStack[] {
|
||||||
|
new ItemStack(Items.LOG, 4),
|
||||||
|
new ItemStack(Items.ROCK, 2, new ItemModifierMeta(0)),
|
||||||
|
new ItemStack(Items.PLANT_FIBRE, 3),
|
||||||
|
}, new Crafting[] {
|
||||||
|
Crafting.WOODEN_WORKBENCH,
|
||||||
|
}, new ItemStack(Items.STONE_SHOVEL, 1)));
|
||||||
|
|
||||||
|
recipies.add(new RecipeBasic(
|
||||||
|
new ItemStack[] {
|
||||||
|
new ItemStack(Items.LOG, 4),
|
||||||
|
new ItemStack(Items.ROCK, 3, new ItemModifierMeta(0)),
|
||||||
|
new ItemStack(Items.PLANT_FIBRE, 3),
|
||||||
|
}, new Crafting[] {
|
||||||
|
Crafting.WOODEN_WORKBENCH,
|
||||||
|
}, new ItemStack(Items.STONE_HATCHET, 1)));
|
||||||
|
|
||||||
|
recipies.add(new RecipeBasic(
|
||||||
|
new ItemStack[] {
|
||||||
|
new ItemStack(Items.ROCK, 8, new ItemModifierMeta(3)),
|
||||||
|
}, new Crafting[] {
|
||||||
|
Crafting.WOODEN_WORKBENCH,
|
||||||
|
}, new ItemStack(Items.CLAY_POT_WET, 1)));
|
||||||
|
|
||||||
|
recipies.add(new RecipeBasic(
|
||||||
|
new ItemStack[] {
|
||||||
|
new ItemStack(Items.ROCK, 32, new ItemModifierMeta(3)),
|
||||||
|
}, new Crafting[] {
|
||||||
|
Crafting.WOODEN_WORKBENCH,
|
||||||
|
}, new ItemStack(Items.BLAST_FURNACE, 1)));
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,12 +3,15 @@ package projectzombie.init;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
import projectzombie.tiles.Tile;
|
import projectzombie.tiles.Tile;
|
||||||
|
import projectzombie.tiles.TileBlastFurnace;
|
||||||
import projectzombie.tiles.TileBossPortal;
|
import projectzombie.tiles.TileBossPortal;
|
||||||
import projectzombie.tiles.TileCactus;
|
import projectzombie.tiles.TileCactus;
|
||||||
import projectzombie.tiles.TileCampfire;
|
import projectzombie.tiles.TileCampfire;
|
||||||
import projectzombie.tiles.TileChest;
|
import projectzombie.tiles.TileChest;
|
||||||
|
import projectzombie.tiles.TileClayPot;
|
||||||
import projectzombie.tiles.TileDirt;
|
import projectzombie.tiles.TileDirt;
|
||||||
import projectzombie.tiles.TileGrass;
|
import projectzombie.tiles.TileGrass;
|
||||||
|
import projectzombie.tiles.TileGrassBurnt;
|
||||||
import projectzombie.tiles.TileGrassInfested;
|
import projectzombie.tiles.TileGrassInfested;
|
||||||
import projectzombie.tiles.TileHemp;
|
import projectzombie.tiles.TileHemp;
|
||||||
import projectzombie.tiles.TileIce;
|
import projectzombie.tiles.TileIce;
|
||||||
|
|
@ -18,6 +21,7 @@ import projectzombie.tiles.TileLadderUp;
|
||||||
import projectzombie.tiles.TileLantern;
|
import projectzombie.tiles.TileLantern;
|
||||||
import projectzombie.tiles.TileLava;
|
import projectzombie.tiles.TileLava;
|
||||||
import projectzombie.tiles.TileLavaFlow;
|
import projectzombie.tiles.TileLavaFlow;
|
||||||
|
import projectzombie.tiles.TileOre;
|
||||||
import projectzombie.tiles.TilePortalDown;
|
import projectzombie.tiles.TilePortalDown;
|
||||||
import projectzombie.tiles.TileRock;
|
import projectzombie.tiles.TileRock;
|
||||||
import projectzombie.tiles.TileSand;
|
import projectzombie.tiles.TileSand;
|
||||||
|
|
@ -31,6 +35,7 @@ import projectzombie.tiles.TileTree;
|
||||||
import projectzombie.tiles.TileVoid;
|
import projectzombie.tiles.TileVoid;
|
||||||
import projectzombie.tiles.TileWall;
|
import projectzombie.tiles.TileWall;
|
||||||
import projectzombie.tiles.TileWater;
|
import projectzombie.tiles.TileWater;
|
||||||
|
import projectzombie.tiles.TileWorkbench;
|
||||||
|
|
||||||
public class Tiles
|
public class Tiles
|
||||||
{
|
{
|
||||||
|
|
@ -76,6 +81,11 @@ public class Tiles
|
||||||
register(TALL_GRASS);
|
register(TALL_GRASS);
|
||||||
register(SAPLING);
|
register(SAPLING);
|
||||||
register(CAMPFIRE);
|
register(CAMPFIRE);
|
||||||
|
register(GRASS_BURNT);
|
||||||
|
register(WORKBENCH);
|
||||||
|
register(BLAST_FURNACE);
|
||||||
|
register(CLAY_POT);
|
||||||
|
register(ORE);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final Tile GRASS = new TileGrass();
|
public static final Tile GRASS = new TileGrass();
|
||||||
|
|
@ -106,4 +116,9 @@ public class Tiles
|
||||||
public static final Tile SAPLING = new TileSapling();
|
public static final Tile SAPLING = new TileSapling();
|
||||||
public static final Tile HEMP = new TileHemp();
|
public static final Tile HEMP = new TileHemp();
|
||||||
public static final Tile CAMPFIRE = new TileCampfire();
|
public static final Tile CAMPFIRE = new TileCampfire();
|
||||||
|
public static final Tile GRASS_BURNT = new TileGrassBurnt();
|
||||||
|
public static final Tile WORKBENCH = new TileWorkbench();
|
||||||
|
public static final Tile BLAST_FURNACE = new TileBlastFurnace();
|
||||||
|
public static final Tile CLAY_POT = new TileClayPot();
|
||||||
|
public static final Tile ORE = new TileOre();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
package projectzombie.inventory;
|
package projectzombie.inventory;
|
||||||
|
|
||||||
public enum Crafting {
|
public enum Crafting {
|
||||||
BASIC
|
BASIC, WOODEN_WORKBENCH
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,9 +4,14 @@ import bdf.classes.IBdfClassManager;
|
||||||
import bdf.types.BdfArray;
|
import bdf.types.BdfArray;
|
||||||
import bdf.types.BdfNamedList;
|
import bdf.types.BdfNamedList;
|
||||||
import bdf.types.BdfObject;
|
import bdf.types.BdfObject;
|
||||||
|
import gl_engine.vec.Vec2d;
|
||||||
|
import gl_engine.vec.Vec3d;
|
||||||
|
import projectzombie.entity.EntityItem;
|
||||||
import projectzombie.items.Item;
|
import projectzombie.items.Item;
|
||||||
import projectzombie.items.modifier.ItemModifier;
|
import projectzombie.items.modifier.ItemModifier;
|
||||||
import projectzombie.util.math.ItemStack;
|
import projectzombie.util.math.ItemStack;
|
||||||
|
import projectzombie.world.chunk.Chunk;
|
||||||
|
import projectzombie.world.layer.Layer;
|
||||||
|
|
||||||
public class Inventory implements IInventory, IBdfClassManager
|
public class Inventory implements IInventory, IBdfClassManager
|
||||||
{
|
{
|
||||||
|
|
@ -98,6 +103,19 @@ public class Inventory implements IInventory, IBdfClassManager
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void dropInventory(Layer layer, Chunk chunk, Vec3d pos, Vec3d velocity)
|
||||||
|
{
|
||||||
|
for(int i=0;i<items.length;i++)
|
||||||
|
{
|
||||||
|
if(!items[i].isEmpty())
|
||||||
|
{
|
||||||
|
chunk.spawnEntity(new EntityItem(pos, velocity, items[i]));
|
||||||
|
|
||||||
|
items[i] = ItemStack.getEmpty();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void removeItem(ItemStack stack)
|
public void removeItem(ItemStack stack)
|
||||||
{
|
{
|
||||||
for(ItemStack check : items) {
|
for(ItemStack check : items) {
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ public class RecipeBasic implements Recipe
|
||||||
public boolean canCraft(Crafting tool)
|
public boolean canCraft(Crafting tool)
|
||||||
{
|
{
|
||||||
for(Crafting tool_required : tools_required) {
|
for(Crafting tool_required : tools_required) {
|
||||||
if(tool == tool_required) {
|
if(tool == tool_required || tool_required == Crafting.BASIC) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -28,10 +28,6 @@ public abstract class Item
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getName(ItemStack stack) {
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
public double getLightLevel() {
|
public double getLightLevel() {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
@ -45,6 +41,7 @@ public abstract class Item
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract ModelItem getModel(ItemStack stack);
|
public abstract ModelItem getModel(ItemStack stack);
|
||||||
|
public abstract String getName(ItemStack stack);
|
||||||
|
|
||||||
public void onPickedUp(ItemStack stack, Layer layer, Chunk chunk, Entity entity)
|
public void onPickedUp(ItemStack stack, Layer layer, Chunk chunk, Entity entity)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,30 @@
|
||||||
|
package projectzombie.items;
|
||||||
|
|
||||||
|
import projectzombie.items.modifier.ItemModifierDamage;
|
||||||
|
import projectzombie.util.math.ItemStack;
|
||||||
|
|
||||||
|
public abstract class ItemAbstractTool extends Item implements ItemTool
|
||||||
|
{
|
||||||
|
public ItemAbstractTool() {
|
||||||
|
max = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected abstract int getMaxDamage();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void toolOnUse(ItemStack stack)
|
||||||
|
{
|
||||||
|
ItemModifierDamage modifier = (ItemModifierDamage) stack.getModifier(ItemModifierDamage.class);
|
||||||
|
|
||||||
|
if(modifier == null) {
|
||||||
|
modifier = new ItemModifierDamage(0, getMaxDamage());
|
||||||
|
stack.addModifier(modifier);
|
||||||
|
}
|
||||||
|
|
||||||
|
modifier.damage(1);
|
||||||
|
|
||||||
|
if(modifier.isBroken()) {
|
||||||
|
stack.count = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -4,6 +4,7 @@ import gl_engine.vec.Vec2d;
|
||||||
import gl_engine.vec.Vec2i;
|
import gl_engine.vec.Vec2i;
|
||||||
import gl_engine.vec.Vec3d;
|
import gl_engine.vec.Vec3d;
|
||||||
import projectzombie.entity.player.EntityPlayer;
|
import projectzombie.entity.player.EntityPlayer;
|
||||||
|
import projectzombie.init.Items;
|
||||||
import projectzombie.init.Models;
|
import projectzombie.init.Models;
|
||||||
import projectzombie.init.Tiles;
|
import projectzombie.init.Tiles;
|
||||||
import projectzombie.model.Model;
|
import projectzombie.model.Model;
|
||||||
|
|
@ -13,7 +14,7 @@ import projectzombie.util.math.ItemStack;
|
||||||
import projectzombie.world.chunk.Chunk;
|
import projectzombie.world.chunk.Chunk;
|
||||||
import projectzombie.world.layer.Layer;
|
import projectzombie.world.layer.Layer;
|
||||||
|
|
||||||
public class ItemAcorn extends Item
|
public class ItemAcorn extends Item implements ItemBurnable
|
||||||
{
|
{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -46,4 +47,16 @@ public class ItemAcorn extends Item
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getBurnTime(ItemStack stack) {
|
||||||
|
return 800;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ItemStack[] getBurnProducts(ItemStack stack) {
|
||||||
|
return new ItemStack[] {
|
||||||
|
new ItemStack(Items.ASH, 1),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,21 @@
|
||||||
|
package projectzombie.items;
|
||||||
|
|
||||||
|
import projectzombie.init.Models;
|
||||||
|
import projectzombie.model.Model;
|
||||||
|
import projectzombie.model.ModelItem;
|
||||||
|
import projectzombie.util.math.ItemStack;
|
||||||
|
|
||||||
|
public class ItemAsh extends Item
|
||||||
|
{
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ModelItem getModel(ItemStack stack) {
|
||||||
|
return Models.ITEM_ASH;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName(ItemStack stack) {
|
||||||
|
return "Ash";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,47 @@
|
||||||
|
package projectzombie.items;
|
||||||
|
|
||||||
|
import gl_engine.vec.Vec2d;
|
||||||
|
import gl_engine.vec.Vec2i;
|
||||||
|
import projectzombie.entity.player.EntityPlayer;
|
||||||
|
import projectzombie.init.Models;
|
||||||
|
import projectzombie.init.Tiles;
|
||||||
|
import projectzombie.model.Model;
|
||||||
|
import projectzombie.model.ModelItem;
|
||||||
|
import projectzombie.util.math.ItemStack;
|
||||||
|
import projectzombie.world.chunk.Chunk;
|
||||||
|
import projectzombie.world.layer.Layer;
|
||||||
|
|
||||||
|
public class ItemBlastFurnace extends Item
|
||||||
|
{
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ModelItem getModel(ItemStack stack) {
|
||||||
|
return Models.ITEM_BLAST_FURNACE;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Model getPlaceModel(ItemStack stack) {
|
||||||
|
return Models.TILE_BLAST_FURNACE;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName(ItemStack stack) {
|
||||||
|
return "Blast Furnace";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onPlayerRightClick(ItemStack stack, Layer layer, EntityPlayer player, Vec2d place_pos)
|
||||||
|
{
|
||||||
|
Vec2i pos = place_pos.toInt();
|
||||||
|
|
||||||
|
if(layer.getFrontTile(pos).tile != Tiles.VOID) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
stack.count -= 1;
|
||||||
|
layer.setFrontTile(Tiles.BLAST_FURNACE.getDefaultState(), pos);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
package projectzombie.items;
|
||||||
|
|
||||||
|
import projectzombie.util.math.ItemStack;
|
||||||
|
|
||||||
|
public interface ItemBurnable
|
||||||
|
{
|
||||||
|
public int getBurnTime(ItemStack stack);
|
||||||
|
public ItemStack[] getBurnProducts(ItemStack stack);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,21 @@
|
||||||
|
package projectzombie.items;
|
||||||
|
|
||||||
|
import projectzombie.init.Models;
|
||||||
|
import projectzombie.model.Model;
|
||||||
|
import projectzombie.model.ModelItem;
|
||||||
|
import projectzombie.util.math.ItemStack;
|
||||||
|
|
||||||
|
public class ItemCharcoal extends Item
|
||||||
|
{
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ModelItem getModel(ItemStack stack) {
|
||||||
|
return Models.ITEM_CHARCOAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName(ItemStack stack) {
|
||||||
|
return "Charcoal";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,118 @@
|
||||||
|
package projectzombie.items;
|
||||||
|
|
||||||
|
import gl_engine.vec.Vec2d;
|
||||||
|
import gl_engine.vec.Vec2i;
|
||||||
|
import projectzombie.entity.player.EntityPlayer;
|
||||||
|
import projectzombie.entity.tileentity.TileEntityClayPot;
|
||||||
|
import projectzombie.init.Items;
|
||||||
|
import projectzombie.init.Models;
|
||||||
|
import projectzombie.init.Tiles;
|
||||||
|
import projectzombie.items.modifier.ItemModifierFluidStorage;
|
||||||
|
import projectzombie.items.modifier.ItemModifierMeta;
|
||||||
|
import projectzombie.items.modifier.ItemModifierWater;
|
||||||
|
import projectzombie.model.Model;
|
||||||
|
import projectzombie.model.ModelItem;
|
||||||
|
import projectzombie.util.math.ItemStack;
|
||||||
|
import projectzombie.util.math.TileState;
|
||||||
|
import projectzombie.world.layer.Layer;
|
||||||
|
|
||||||
|
public class ItemClayPot extends Item
|
||||||
|
{
|
||||||
|
public ItemClayPot() {
|
||||||
|
max = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ModelItem getModel(ItemStack stack)
|
||||||
|
{
|
||||||
|
ItemModifierWater fluid = (ItemModifierWater)stack.getModifier(ItemModifierWater.class);
|
||||||
|
|
||||||
|
if(fluid == null) {
|
||||||
|
fluid = new ItemModifierWater(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
switch((int)(fluid.getVolume() * 4))
|
||||||
|
{
|
||||||
|
case 0: return Models.ITEM_CLAY_POT_EMPTY;
|
||||||
|
case 1: return Models.ITEM_CLAY_POT_WATER_1;
|
||||||
|
case 2: return Models.ITEM_CLAY_POT_WATER_2;
|
||||||
|
default: return Models.ITEM_CLAY_POT_WATER_3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Model getPlaceModel(ItemStack stack)
|
||||||
|
{
|
||||||
|
ItemModifierWater fluid = (ItemModifierWater)stack.getModifier(ItemModifierWater.class);
|
||||||
|
|
||||||
|
if(fluid == null) {
|
||||||
|
fluid = new ItemModifierWater(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
switch((int)Math.ceil(fluid.getVolume() * 3))
|
||||||
|
{
|
||||||
|
case 0: return Models.TILE_CLAY_POT_EMPTY;
|
||||||
|
case 1: return Models.TILE_CLAY_POT_WATER_1;
|
||||||
|
case 2: return Models.TILE_CLAY_POT_WATER_2;
|
||||||
|
default: return Models.TILE_CLAY_POT_WATER_3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName(ItemStack stack) {
|
||||||
|
return "Clay Pot";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public double getDamage(ItemStack stack)
|
||||||
|
{
|
||||||
|
ItemModifierWater fluid = (ItemModifierWater)stack.getModifier(ItemModifierWater.class);
|
||||||
|
|
||||||
|
if(fluid == null) {
|
||||||
|
fluid = new ItemModifierWater(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 1 - fluid.getVolume();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onPlayerRightClick(ItemStack stack, Layer layer, EntityPlayer player, Vec2d place_pos)
|
||||||
|
{
|
||||||
|
Vec2i tpos = place_pos.toInt();
|
||||||
|
TileState ts = layer.getFrontTile(tpos);
|
||||||
|
ItemModifierWater fluid = (ItemModifierWater)stack.getModifier(ItemModifierWater.class);
|
||||||
|
|
||||||
|
if(fluid == null) {
|
||||||
|
fluid = new ItemModifierWater(0);
|
||||||
|
stack.addModifier(fluid);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Increase the fluid storage if the affecting tile is water
|
||||||
|
if(ts.tile == Tiles.WATER)
|
||||||
|
{
|
||||||
|
double volume = fluid.getVolume();
|
||||||
|
|
||||||
|
volume += 0.001;
|
||||||
|
|
||||||
|
if(volume > 1) {
|
||||||
|
volume = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
fluid.setVolume(volume);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Only place if the front tile is void
|
||||||
|
if(ts.tile != Tiles.VOID) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
layer.setFrontTile(new TileState(Tiles.CLAY_POT, (byte)Math.ceil(fluid.getVolume() * 3)), tpos);
|
||||||
|
layer.createTileEntity(tpos, new TileEntityClayPot(fluid.getVolume()));
|
||||||
|
stack.count -= 1;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,31 @@
|
||||||
|
package projectzombie.items;
|
||||||
|
|
||||||
|
import projectzombie.init.Items;
|
||||||
|
import projectzombie.init.Models;
|
||||||
|
import projectzombie.model.ModelItem;
|
||||||
|
import projectzombie.util.math.ItemStack;
|
||||||
|
|
||||||
|
public class ItemClayPotWet extends Item implements ItemCookable
|
||||||
|
{
|
||||||
|
public ItemClayPotWet() {
|
||||||
|
max = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ItemStack[] getCookProducts(ItemStack stack) {
|
||||||
|
return new ItemStack[] {
|
||||||
|
new ItemStack(Items.CLAY_POT, 1),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ModelItem getModel(ItemStack stack) {
|
||||||
|
return Models.ITEM_CLAY_POT_WET;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName(ItemStack stack) {
|
||||||
|
return "Wet Clay Pot";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
package projectzombie.items;
|
||||||
|
|
||||||
|
import projectzombie.util.math.ItemStack;
|
||||||
|
|
||||||
|
public interface ItemCookable
|
||||||
|
{
|
||||||
|
public ItemStack[] getCookProducts(ItemStack stack);
|
||||||
|
}
|
||||||
|
|
@ -22,4 +22,8 @@ public class ItemEmpty extends Item
|
||||||
return Models.ITEM_EMPTY;
|
return Models.ITEM_EMPTY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName(ItemStack stack) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,47 +7,26 @@ import projectzombie.items.modifier.ItemModifierMeta;
|
||||||
import projectzombie.model.ModelItem;
|
import projectzombie.model.ModelItem;
|
||||||
import projectzombie.util.math.ItemStack;
|
import projectzombie.util.math.ItemStack;
|
||||||
|
|
||||||
public class ItemFlintHatchet extends Item implements ItemTool
|
public class ItemFlintHatchet extends ItemAbstractTool
|
||||||
{
|
{
|
||||||
public ItemFlintHatchet() {
|
|
||||||
max = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int toolPowerAxe(ItemStack stack) {
|
public int toolPower(ItemStack stack) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int toolPowerPickaxe(ItemStack stack) {
|
public ItemToolType toolType(ItemStack stack) {
|
||||||
return 0;
|
return ItemToolType.HATCHET;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int toolPowerShovel(ItemStack stack) {
|
public double toolSpeed(ItemStack stack) {
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int toolSpeed(ItemStack stack) {
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void toolOnUse(ItemStack stack)
|
protected int getMaxDamage() {
|
||||||
{
|
return 10;
|
||||||
ItemModifierDamage modifier = (ItemModifierDamage) stack.getModifier(ItemModifierDamage.class);
|
|
||||||
|
|
||||||
if(modifier == null) {
|
|
||||||
modifier = new ItemModifierDamage(0, 10);
|
|
||||||
stack.addModifier(modifier);
|
|
||||||
}
|
|
||||||
|
|
||||||
modifier.damage(1);
|
|
||||||
|
|
||||||
if(modifier.isBroken()) {
|
|
||||||
stack.count = 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -26,4 +26,9 @@ public class ItemInfestation extends Item
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName(ItemStack stack) {
|
||||||
|
return "Infestation";
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,12 @@
|
||||||
package projectzombie.items;
|
package projectzombie.items;
|
||||||
|
|
||||||
|
import projectzombie.init.Items;
|
||||||
import projectzombie.init.Models;
|
import projectzombie.init.Models;
|
||||||
import projectzombie.items.modifier.ItemModifierMeta;
|
import projectzombie.items.modifier.ItemModifierMeta;
|
||||||
import projectzombie.model.ModelItem;
|
import projectzombie.model.ModelItem;
|
||||||
import projectzombie.util.math.ItemStack;
|
import projectzombie.util.math.ItemStack;
|
||||||
|
|
||||||
public class ItemLog extends Item
|
public class ItemLog extends Item implements ItemBurnable
|
||||||
{
|
{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -23,4 +24,17 @@ public class ItemLog extends Item
|
||||||
return "Log";
|
return "Log";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getBurnTime(ItemStack stack) {
|
||||||
|
return 3200;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ItemStack[] getBurnProducts(ItemStack stack) {
|
||||||
|
return new ItemStack[] {
|
||||||
|
new ItemStack(Items.CHARCOAL, 1),
|
||||||
|
new ItemStack(Items.ASH, 2),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,36 @@
|
||||||
|
package projectzombie.items;
|
||||||
|
|
||||||
|
import projectzombie.init.Items;
|
||||||
|
import projectzombie.init.Models;
|
||||||
|
import projectzombie.items.modifier.ItemModifierMeta;
|
||||||
|
import projectzombie.model.ModelItem;
|
||||||
|
import projectzombie.util.math.ItemStack;
|
||||||
|
|
||||||
|
public class ItemMetal extends Item
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public ModelItem getModel(ItemStack stack)
|
||||||
|
{
|
||||||
|
switch(ItemModifierMeta.getStackMeta(stack))
|
||||||
|
{
|
||||||
|
case 0: return Models.ITEM_IRON;
|
||||||
|
case 1: return Models.ITEM_COPPER;
|
||||||
|
case 2: return Models.ITEM_TIN;
|
||||||
|
case 3: return Models.ITEM_GOLD;
|
||||||
|
default: return Models.ITEM_MISSING;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName(ItemStack stack)
|
||||||
|
{
|
||||||
|
switch(ItemModifierMeta.getStackMeta(stack))
|
||||||
|
{
|
||||||
|
case 0: return "Iron";
|
||||||
|
case 1: return "Copper";
|
||||||
|
case 2: return "Tin";
|
||||||
|
case 3: return "Gold";
|
||||||
|
default: return "Metal";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,45 @@
|
||||||
|
package projectzombie.items;
|
||||||
|
|
||||||
|
import projectzombie.init.Items;
|
||||||
|
import projectzombie.init.Models;
|
||||||
|
import projectzombie.items.modifier.ItemModifierMeta;
|
||||||
|
import projectzombie.model.ModelItem;
|
||||||
|
import projectzombie.util.math.ItemStack;
|
||||||
|
|
||||||
|
public class ItemOre extends Item implements ItemSmeltable
|
||||||
|
{
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ModelItem getModel(ItemStack stack)
|
||||||
|
{
|
||||||
|
switch(ItemModifierMeta.getStackMeta(stack))
|
||||||
|
{
|
||||||
|
case 0: return Models.ITEM_ORE_IRON;
|
||||||
|
case 1: return Models.ITEM_ORE_COPPER;
|
||||||
|
case 2: return Models.ITEM_ORE_TIN;
|
||||||
|
case 3: return Models.ITEM_ORE_GOLD;
|
||||||
|
default: return Models.ITEM_MISSING;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName(ItemStack stack)
|
||||||
|
{
|
||||||
|
switch(ItemModifierMeta.getStackMeta(stack))
|
||||||
|
{
|
||||||
|
case 0: return "Iron Ore";
|
||||||
|
case 1: return "Copper Ore";
|
||||||
|
case 2: return "Tin Ore";
|
||||||
|
case 3: return "Gold Ore";
|
||||||
|
default: return "Ore";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ItemStack[] getSmeltProducts(ItemStack stack) {
|
||||||
|
return new ItemStack[] {
|
||||||
|
new ItemStack(Items.METAL, 1, stack.modifiers.clone()),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -12,9 +12,11 @@ public class ItemRock extends Item
|
||||||
public ModelItem getModel(ItemStack stack)
|
public ModelItem getModel(ItemStack stack)
|
||||||
{
|
{
|
||||||
switch(ItemModifierMeta.getStackMeta(stack)) {
|
switch(ItemModifierMeta.getStackMeta(stack)) {
|
||||||
|
case 0: return Models.ITEM_ROCK;
|
||||||
case 1: return Models.ITEM_SNOW_PILE;
|
case 1: return Models.ITEM_SNOW_PILE;
|
||||||
case 2: return Models.ITEM_SANDSTONE;
|
case 2: return Models.ITEM_SANDSTONE;
|
||||||
default: return Models.ITEM_ROCK;
|
case 3: return Models.ITEM_CLAY;
|
||||||
|
default: return Models.ITEM_MISSING;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -22,8 +24,10 @@ public class ItemRock extends Item
|
||||||
public String getName(ItemStack stack)
|
public String getName(ItemStack stack)
|
||||||
{
|
{
|
||||||
switch(ItemModifierMeta.getStackMeta(stack)) {
|
switch(ItemModifierMeta.getStackMeta(stack)) {
|
||||||
|
case 0: return "Rock";
|
||||||
case 1: return "Snow";
|
case 1: return "Snow";
|
||||||
case 2: return "Sandstone";
|
case 2: return "Sandstone";
|
||||||
|
case 3: return "Clay";
|
||||||
default: return "Rock";
|
default: return "Rock";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
package projectzombie.items;
|
||||||
|
|
||||||
|
import projectzombie.util.math.ItemStack;
|
||||||
|
|
||||||
|
public interface ItemSmeltable
|
||||||
|
{
|
||||||
|
public ItemStack[] getSmeltProducts(ItemStack stack);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,40 @@
|
||||||
|
package projectzombie.items;
|
||||||
|
|
||||||
|
import projectzombie.init.Models;
|
||||||
|
import projectzombie.model.ModelItem;
|
||||||
|
import projectzombie.util.math.ItemStack;
|
||||||
|
|
||||||
|
public class ItemStoneHatchet extends ItemAbstractTool
|
||||||
|
{
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int getMaxDamage() {
|
||||||
|
return 20;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int toolPower(ItemStack stack) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ItemToolType toolType(ItemStack stack) {
|
||||||
|
return ItemToolType.HATCHET;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public double toolSpeed(ItemStack stack) {
|
||||||
|
return 1.5;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ModelItem getModel(ItemStack stack) {
|
||||||
|
return Models.ITEM_STONE_HATCHET;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName(ItemStack stack) {
|
||||||
|
return "Stone Hatchet";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,40 @@
|
||||||
|
package projectzombie.items;
|
||||||
|
|
||||||
|
import projectzombie.init.Models;
|
||||||
|
import projectzombie.model.ModelItem;
|
||||||
|
import projectzombie.util.math.ItemStack;
|
||||||
|
|
||||||
|
public class ItemStonePick extends ItemAbstractTool
|
||||||
|
{
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int toolPower(ItemStack stack) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public double toolSpeed(ItemStack stack) {
|
||||||
|
return 1.5;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ItemToolType toolType(ItemStack stack) {
|
||||||
|
return ItemToolType.PICK;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int getMaxDamage() {
|
||||||
|
return 20;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ModelItem getModel(ItemStack stack) {
|
||||||
|
return Models.ITEM_STONE_PICK;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName(ItemStack stack) {
|
||||||
|
return "Stone Pick";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,40 @@
|
||||||
|
package projectzombie.items;
|
||||||
|
|
||||||
|
import projectzombie.init.Models;
|
||||||
|
import projectzombie.model.ModelItem;
|
||||||
|
import projectzombie.util.math.ItemStack;
|
||||||
|
|
||||||
|
public class ItemStoneShovel extends ItemAbstractTool
|
||||||
|
{
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int toolPower(ItemStack stack) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public double toolSpeed(ItemStack stack) {
|
||||||
|
return 1.5;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ItemToolType toolType(ItemStack stack) {
|
||||||
|
return ItemToolType.SHOVEL;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int getMaxDamage() {
|
||||||
|
return 16;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ModelItem getModel(ItemStack stack) {
|
||||||
|
return Models.ITEM_STONE_SHOVEL;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName(ItemStack stack) {
|
||||||
|
return "Stone Shovel";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -4,9 +4,8 @@ import projectzombie.util.math.ItemStack;
|
||||||
|
|
||||||
public interface ItemTool
|
public interface ItemTool
|
||||||
{
|
{
|
||||||
public int toolPowerAxe(ItemStack stack);
|
public int toolPower(ItemStack stack);
|
||||||
public int toolPowerPickaxe(ItemStack stack);
|
public double toolSpeed(ItemStack stack);
|
||||||
public int toolPowerShovel(ItemStack stack);
|
public ItemToolType toolType(ItemStack stack);
|
||||||
public int toolSpeed(ItemStack stack);
|
|
||||||
public void toolOnUse(ItemStack stack);
|
public void toolOnUse(ItemStack stack);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
package projectzombie.items;
|
||||||
|
|
||||||
|
public enum ItemToolType {
|
||||||
|
NONE, HATCHET, PICK, SHOVEL
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,47 @@
|
||||||
|
package projectzombie.items;
|
||||||
|
|
||||||
|
import gl_engine.vec.Vec2d;
|
||||||
|
import gl_engine.vec.Vec2i;
|
||||||
|
import projectzombie.entity.player.EntityPlayer;
|
||||||
|
import projectzombie.init.Models;
|
||||||
|
import projectzombie.init.Tiles;
|
||||||
|
import projectzombie.model.Model;
|
||||||
|
import projectzombie.model.ModelItem;
|
||||||
|
import projectzombie.util.math.ItemStack;
|
||||||
|
import projectzombie.world.layer.Layer;
|
||||||
|
|
||||||
|
public class ItemWorkbench extends Item
|
||||||
|
{
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ModelItem getModel(ItemStack stack) {
|
||||||
|
return Models.ITEM_WORKBENCH;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Model getPlaceModel(ItemStack stack) {
|
||||||
|
return Models.TILE_WORKBENCH;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName(ItemStack stack) {
|
||||||
|
return "Workbench";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onPlayerRightClick(ItemStack stack, Layer layer, EntityPlayer player, Vec2d place_pos)
|
||||||
|
{
|
||||||
|
Vec2i tpos = place_pos.toInt();
|
||||||
|
|
||||||
|
if(layer.getFrontTile(tpos).tile != Tiles.VOID) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
layer.setFrontTile(Tiles.WORKBENCH.getDefaultState(), tpos);
|
||||||
|
|
||||||
|
stack.count -= 1;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,70 @@
|
||||||
|
package projectzombie.items.modifier;
|
||||||
|
|
||||||
|
import bdf.types.BdfNamedList;
|
||||||
|
import bdf.types.BdfObject;
|
||||||
|
|
||||||
|
public class ItemModifierFluidStorage extends ItemModifier
|
||||||
|
{
|
||||||
|
public static final byte FLUID_NONE = 0;
|
||||||
|
public static final byte FLUID_WATER = 1;
|
||||||
|
|
||||||
|
private byte type;
|
||||||
|
private double volume;
|
||||||
|
|
||||||
|
public byte getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setType(byte type) {
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getVolume() {
|
||||||
|
return volume;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setVolume(double volume) {
|
||||||
|
this.volume = volume;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ItemModifierFluidStorage(byte type, double volume) {
|
||||||
|
this.type = type;
|
||||||
|
this.volume = volume;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ItemModifierFluidStorage(BdfObject bdf) {
|
||||||
|
BdfClassLoad(bdf);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void BdfClassLoad(BdfObject bdf) {
|
||||||
|
BdfNamedList nl = bdf.getNamedList();
|
||||||
|
type = nl.get("type").getByte();
|
||||||
|
volume = nl.get("volume").getDouble();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void BdfClassSave(BdfObject bdf) {
|
||||||
|
BdfNamedList nl = bdf.getNamedList();
|
||||||
|
nl.set("type", bdf.newObject().setByte(type));
|
||||||
|
nl.set("volume", bdf.newObject().setDouble(volume));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isEqual(ItemModifier other)
|
||||||
|
{
|
||||||
|
if(!(other instanceof ItemModifierFluidStorage)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
ItemModifierFluidStorage other_fs = (ItemModifierFluidStorage)other;
|
||||||
|
|
||||||
|
return other_fs.type == type && other_fs.volume == volume;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ItemModifier copy() {
|
||||||
|
return new ItemModifierFluidStorage(type, volume);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,54 @@
|
||||||
|
package projectzombie.items.modifier;
|
||||||
|
|
||||||
|
import bdf.types.BdfNamedList;
|
||||||
|
import bdf.types.BdfObject;
|
||||||
|
|
||||||
|
public class ItemModifierWater extends ItemModifier
|
||||||
|
{
|
||||||
|
private double volume;
|
||||||
|
|
||||||
|
public double getVolume() {
|
||||||
|
return volume;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setVolume(double volume) {
|
||||||
|
this.volume = volume;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ItemModifierWater(double volume) {
|
||||||
|
this.volume = volume;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ItemModifierWater(BdfObject bdf) {
|
||||||
|
BdfClassLoad(bdf);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void BdfClassLoad(BdfObject bdf) {
|
||||||
|
BdfNamedList nl = bdf.getNamedList();
|
||||||
|
volume = nl.get("volume").getDouble();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void BdfClassSave(BdfObject bdf) {
|
||||||
|
BdfNamedList nl = bdf.getNamedList();
|
||||||
|
nl.set("volume", bdf.newObject().setDouble(volume));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isEqual(ItemModifier other)
|
||||||
|
{
|
||||||
|
if(!(other instanceof ItemModifierWater)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
ItemModifierWater other_fs = (ItemModifierWater)other;
|
||||||
|
|
||||||
|
return other_fs.volume == volume;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ItemModifier copy() {
|
||||||
|
return new ItemModifierWater(volume);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -22,4 +22,9 @@ public class ItemSpawnDummy extends ItemSpawn
|
||||||
layer.spawnEntity(new EntityDummy(pos, velocity));
|
layer.spawnEntity(new EntityDummy(pos, velocity));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName(ItemStack stack) {
|
||||||
|
return "Spawn Dummy";
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -22,4 +22,9 @@ public class ItemSpawnZombie extends ItemSpawn
|
||||||
layer.spawnEntity(new EntityZombie(pos, velocity));
|
layer.spawnEntity(new EntityZombie(pos, velocity));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName(ItemStack stack) {
|
||||||
|
return "Spawn Zombie";
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -106,6 +106,7 @@ public class MenuInventoryStorage extends MenuInventory
|
||||||
gui.add(slider);
|
gui.add(slider);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
@Override
|
@Override
|
||||||
public void render()
|
public void render()
|
||||||
{
|
{
|
||||||
|
|
@ -117,4 +118,5 @@ public class MenuInventoryStorage extends MenuInventory
|
||||||
|
|
||||||
super.render();
|
super.render();
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,32 @@
|
||||||
|
package projectzombie.menu.gui;
|
||||||
|
|
||||||
|
import projectzombie.util.math.ItemStack;
|
||||||
|
|
||||||
|
public class GUIItemSlotReadonly extends GUIItemSlot
|
||||||
|
{
|
||||||
|
|
||||||
|
public GUIItemSlotReadonly(double hitboxSize, boolean renderItem, ItemStack stack) {
|
||||||
|
super(hitboxSize, renderItem, new GUIItemSlotGetter()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void setItemStack(ItemStack stack) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isAllowed(ItemStack stack) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ItemStack getItemStack() {
|
||||||
|
return stack.copy();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isReadOnly() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -16,6 +16,7 @@ public class GUIRecipeCard implements GUIContainer
|
||||||
private Vec2d pos;
|
private Vec2d pos;
|
||||||
private Recipe recipe;
|
private Recipe recipe;
|
||||||
private GUIContainer gui;
|
private GUIContainer gui;
|
||||||
|
private GUIItemSlot result_display_slot;
|
||||||
private GUIItemSlot result_slot;
|
private GUIItemSlot result_slot;
|
||||||
private GUIItemSlot[] ingredients;
|
private GUIItemSlot[] ingredients;
|
||||||
private Inventory inventory;
|
private Inventory inventory;
|
||||||
|
|
@ -65,34 +66,19 @@ public class GUIRecipeCard implements GUIContainer
|
||||||
Models.UI_LABEL_RECIPE.getWidth() * 103 / 128.0 + 0.25,
|
Models.UI_LABEL_RECIPE.getWidth() * 103 / 128.0 + 0.25,
|
||||||
Models.UI_LABEL_RECIPE.getHeight() * 9 / 32.0 + 0.25)));
|
Models.UI_LABEL_RECIPE.getHeight() * 9 / 32.0 + 0.25)));
|
||||||
|
|
||||||
|
result_display_slot = new GUIItemSlotReadonly(1, true, recipe.getResult());
|
||||||
|
|
||||||
|
result_display_slot.setPos(pos.add(new Vec2d(
|
||||||
|
Models.UI_LABEL_RECIPE.getWidth() * 87 / 128.0 + 0.25,
|
||||||
|
Models.UI_LABEL_RECIPE.getHeight() * 9 / 32.0 + 0.25)));
|
||||||
|
|
||||||
ItemStack[] ingredients = recipe.getIngredients();
|
ItemStack[] ingredients = recipe.getIngredients();
|
||||||
this.ingredients = new GUIItemSlot[ingredients.length];
|
this.ingredients = new GUIItemSlot[ingredients.length];
|
||||||
|
|
||||||
for(int i=0;i<ingredients.length;i++)
|
for(int i=0;i<ingredients.length;i++)
|
||||||
{
|
{
|
||||||
ItemStack ingredient = ingredients[i];
|
ItemStack ingredient = ingredients[i];
|
||||||
|
GUIItemSlot ingredientDisplay = new GUIItemSlotReadonly(1, true, ingredient);
|
||||||
GUIItemSlot ingredientDisplay = new GUIItemSlot(1, true, new GUIItemSlotGetter()
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public void setItemStack(ItemStack stack) {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isAllowed(ItemStack stack) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ItemStack getItemStack() {
|
|
||||||
return ingredient.copy();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isReadOnly() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
ingredientDisplay.setPos(pos.add(new Vec2d(
|
ingredientDisplay.setPos(pos.add(new Vec2d(
|
||||||
Models.UI_LABEL_RECIPE.getWidth() * (27 + 16 * i) / 128.0 + 0.25,
|
Models.UI_LABEL_RECIPE.getWidth() * (27 + 16 * i) / 128.0 + 0.25,
|
||||||
|
|
@ -115,12 +101,13 @@ public class GUIRecipeCard implements GUIContainer
|
||||||
|
|
||||||
private GUIComponent[] allComponents()
|
private GUIComponent[] allComponents()
|
||||||
{
|
{
|
||||||
GUIComponent[] components = new GUIComponent[ingredients.length + 1];
|
GUIComponent[] components = new GUIComponent[ingredients.length + 2];
|
||||||
|
|
||||||
components[0] = result_slot;
|
components[0] = result_slot;
|
||||||
|
components[1] = result_display_slot;
|
||||||
|
|
||||||
for(int i=0;i<ingredients.length;i++) {
|
for(int i=0;i<ingredients.length;i++) {
|
||||||
components[i+1] = ingredients[i];
|
components[i+2] = ingredients[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
return components;
|
return components;
|
||||||
|
|
|
||||||
|
|
@ -40,6 +40,10 @@ public abstract class Tile
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean canTileSpeedBreak(TileState state, ItemStack stack, ItemTool tool) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
public double getLightDissipation(TileState state) {
|
public double getLightDissipation(TileState state) {
|
||||||
return light_dissipation;
|
return light_dissipation;
|
||||||
}
|
}
|
||||||
|
|
@ -66,7 +70,11 @@ public abstract class Tile
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onDestroy(Layer layer, Chunk chunk, TileState state, Vec2i pos) {
|
public boolean doBreak(Layer layer, Chunk chunk, TileState state, Vec2i pos) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onDestroy(Layer layer, Chunk chunk, TileState oldState, TileState newState, Vec2i pos) {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,89 @@
|
||||||
|
package projectzombie.tiles;
|
||||||
|
|
||||||
|
import gl_engine.MathHelpers;
|
||||||
|
import gl_engine.vec.Vec2i;
|
||||||
|
import gl_engine.vec.Vec3d;
|
||||||
|
import projectzombie.entity.Entity;
|
||||||
|
import projectzombie.entity.tileentity.TileEntityBlastFurnace;
|
||||||
|
import projectzombie.entity.tileentity.TileEntityCampfire;
|
||||||
|
import projectzombie.init.Items;
|
||||||
|
import projectzombie.init.Models;
|
||||||
|
import projectzombie.init.Tiles;
|
||||||
|
import projectzombie.inventory.Inventory;
|
||||||
|
import projectzombie.items.ItemTool;
|
||||||
|
import projectzombie.items.ItemToolType;
|
||||||
|
import projectzombie.model.Model;
|
||||||
|
import projectzombie.util.math.ItemStack;
|
||||||
|
import projectzombie.util.math.TileState;
|
||||||
|
import projectzombie.world.chunk.Chunk;
|
||||||
|
import projectzombie.world.layer.Layer;
|
||||||
|
|
||||||
|
public class TileBlastFurnace extends Tile
|
||||||
|
{
|
||||||
|
|
||||||
|
public TileBlastFurnace() {
|
||||||
|
this.emitsLight = true;
|
||||||
|
this.tileSolid = true;
|
||||||
|
this.tileHitbox = 0.5;
|
||||||
|
this.hardness = 800;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public double getLightLevel(TileState state, Vec2i pos) {
|
||||||
|
return 1 - MathHelpers.squared(1 - state.meta / 16.0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Model getModel(byte meta) {
|
||||||
|
return Models.TILE_CAMPFIRE;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onActivated(Layer layer, Vec2i tpos, Entity entity, TileState state) {
|
||||||
|
super.onActivated(layer, tpos, entity, state);
|
||||||
|
|
||||||
|
TileEntityCampfire te = (TileEntityCampfire)layer.getTileEntity(tpos);
|
||||||
|
|
||||||
|
if(!(te instanceof TileEntityCampfire)) {
|
||||||
|
te = new TileEntityCampfire(tpos);
|
||||||
|
layer.createTileEntity(tpos, te);
|
||||||
|
}
|
||||||
|
|
||||||
|
te.onOpened();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canTileBreak(TileState state, ItemStack stack, ItemTool tool) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canTileSpeedBreak(TileState state, ItemStack stack, ItemTool tool) {
|
||||||
|
return (tool != null && tool.toolType(stack) == ItemToolType.PICK);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ItemStack[] getTileDrops(TileState state) {
|
||||||
|
return new ItemStack[] {
|
||||||
|
new ItemStack(Items.BLAST_FURNACE, 1),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDestroy(Layer layer, Chunk chunk, TileState oldState, TileState newState, Vec2i pos) {
|
||||||
|
super.onDestroy(layer, chunk, oldState, newState, pos);
|
||||||
|
|
||||||
|
if(newState.tile == Tiles.CAMPFIRE) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
TileEntityBlastFurnace te = (TileEntityBlastFurnace)chunk.getTileEntity(pos);
|
||||||
|
|
||||||
|
if(te != null) {
|
||||||
|
te.getInventory().dropInventory(layer, chunk, pos.toDouble().add(0.5).xny(), new Vec3d(0, 0, 0));
|
||||||
|
}
|
||||||
|
|
||||||
|
chunk.destroyTileEntity(pos);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -1,9 +1,17 @@
|
||||||
package projectzombie.tiles;
|
package projectzombie.tiles;
|
||||||
|
|
||||||
|
import gl_engine.MathHelpers;
|
||||||
import gl_engine.vec.Vec2i;
|
import gl_engine.vec.Vec2i;
|
||||||
|
import gl_engine.vec.Vec3d;
|
||||||
|
import projectzombie.entity.Entity;
|
||||||
import projectzombie.entity.tileentity.TileEntityCampfire;
|
import projectzombie.entity.tileentity.TileEntityCampfire;
|
||||||
import projectzombie.init.Models;
|
import projectzombie.init.Models;
|
||||||
|
import projectzombie.init.Tiles;
|
||||||
|
import projectzombie.inventory.Inventory;
|
||||||
|
import projectzombie.items.ItemTool;
|
||||||
|
import projectzombie.items.ItemToolType;
|
||||||
import projectzombie.model.Model;
|
import projectzombie.model.Model;
|
||||||
|
import projectzombie.util.math.ItemStack;
|
||||||
import projectzombie.util.math.TileState;
|
import projectzombie.util.math.TileState;
|
||||||
import projectzombie.world.chunk.Chunk;
|
import projectzombie.world.chunk.Chunk;
|
||||||
import projectzombie.world.layer.Layer;
|
import projectzombie.world.layer.Layer;
|
||||||
|
|
@ -15,11 +23,12 @@ public class TileCampfire extends Tile
|
||||||
this.emitsLight = true;
|
this.emitsLight = true;
|
||||||
this.tileSolid = true;
|
this.tileSolid = true;
|
||||||
this.tileHitbox = 0.5;
|
this.tileHitbox = 0.5;
|
||||||
|
this.hardness = 800;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double getLightLevel(TileState state, Vec2i pos) {
|
public double getLightLevel(TileState state, Vec2i pos) {
|
||||||
return 1;
|
return 1 - MathHelpers.squared(1 - state.meta / 16.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -28,17 +37,46 @@ public class TileCampfire extends Tile
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onGenerate(Layer layer, Chunk chunk, TileState state, Vec2i pos) {
|
public void onActivated(Layer layer, Vec2i tpos, Entity entity, TileState state) {
|
||||||
super.onGenerate(layer, chunk, state, pos);
|
super.onActivated(layer, tpos, entity, state);
|
||||||
|
|
||||||
chunk.createTileEntity(pos, new TileEntityCampfire(pos));
|
TileEntityCampfire te = (TileEntityCampfire)layer.getTileEntity(tpos);
|
||||||
|
|
||||||
|
if(!(te instanceof TileEntityCampfire)) {
|
||||||
|
te = new TileEntityCampfire(tpos);
|
||||||
|
layer.createTileEntity(tpos, te);
|
||||||
|
}
|
||||||
|
|
||||||
|
te.onOpened();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDestroy(Layer layer, Chunk chunk, TileState state, Vec2i pos) {
|
public boolean canTileBreak(TileState state, ItemStack stack, ItemTool tool) {
|
||||||
super.onDestroy(layer, chunk, state, pos);
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canTileSpeedBreak(TileState state, ItemStack stack, ItemTool tool) {
|
||||||
|
return (tool != null && tool.toolType(stack) == ItemToolType.HATCHET);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDestroy(Layer layer, Chunk chunk, TileState oldState, TileState newState, Vec2i pos) {
|
||||||
|
super.onDestroy(layer, chunk, oldState, newState, pos);
|
||||||
|
|
||||||
|
if(newState.tile == Tiles.CAMPFIRE) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
TileEntityCampfire te = (TileEntityCampfire)chunk.getTileEntity(pos);
|
||||||
|
|
||||||
|
if(te != null) {
|
||||||
|
te.getInventory().dropInventory(layer, chunk, pos.toDouble().add(0.5).xny(), new Vec3d(0, 0, 0));
|
||||||
|
}
|
||||||
|
|
||||||
chunk.destroyTileEntity(pos);
|
chunk.destroyTileEntity(pos);
|
||||||
|
|
||||||
|
System.out.println("Campfire destroyed");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,112 @@
|
||||||
|
package projectzombie.tiles;
|
||||||
|
|
||||||
|
import gl_engine.vec.Vec2i;
|
||||||
|
import gl_engine.vec.Vec3d;
|
||||||
|
import projectzombie.entity.Entity;
|
||||||
|
import projectzombie.entity.EntityItem;
|
||||||
|
import projectzombie.entity.player.EntityPlayer;
|
||||||
|
import projectzombie.entity.tileentity.TileEntityClayPot;
|
||||||
|
import projectzombie.init.Items;
|
||||||
|
import projectzombie.init.Models;
|
||||||
|
import projectzombie.init.Tiles;
|
||||||
|
import projectzombie.items.ItemTool;
|
||||||
|
import projectzombie.items.ItemToolType;
|
||||||
|
import projectzombie.items.modifier.ItemModifierFluidStorage;
|
||||||
|
import projectzombie.items.modifier.ItemModifierWater;
|
||||||
|
import projectzombie.model.Model;
|
||||||
|
import projectzombie.util.math.ItemStack;
|
||||||
|
import projectzombie.util.math.TileState;
|
||||||
|
import projectzombie.world.chunk.Chunk;
|
||||||
|
import projectzombie.world.layer.Layer;
|
||||||
|
|
||||||
|
public class TileClayPot extends Tile
|
||||||
|
{
|
||||||
|
public TileClayPot() {
|
||||||
|
tileSolid = true;
|
||||||
|
tileHitbox = 0.3;
|
||||||
|
hardness = 100;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Model getModel(byte meta)
|
||||||
|
{
|
||||||
|
switch(meta)
|
||||||
|
{
|
||||||
|
case 0: return Models.TILE_CLAY_POT_EMPTY;
|
||||||
|
case 1: return Models.TILE_CLAY_POT_WATER_1;
|
||||||
|
case 2: return Models.TILE_CLAY_POT_WATER_2;
|
||||||
|
case 3: return Models.TILE_CLAY_POT_WATER_3;
|
||||||
|
default: return Models.TILE_MISSING;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canTileBreak(TileState state, ItemStack stack, ItemTool tool) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canTileSpeedBreak(TileState state, ItemStack stack, ItemTool tool) {
|
||||||
|
return tool != null && tool.toolType(stack) == ItemToolType.PICK;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onActivated(Layer layer, Vec2i tpos, Entity entity, TileState state) {
|
||||||
|
super.onActivated(layer, tpos, entity, state);
|
||||||
|
|
||||||
|
TileEntityClayPot te = (TileEntityClayPot)layer.getTileEntity(tpos);
|
||||||
|
|
||||||
|
if(te == null) {
|
||||||
|
te = new TileEntityClayPot(0);
|
||||||
|
layer.createTileEntity(tpos, te);
|
||||||
|
}
|
||||||
|
|
||||||
|
double volume = te.getVolume();
|
||||||
|
|
||||||
|
if(volume <= 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(entity instanceof EntityPlayer)
|
||||||
|
{
|
||||||
|
EntityPlayer player = (EntityPlayer)entity;
|
||||||
|
|
||||||
|
System.out.println(player.getHydration());
|
||||||
|
|
||||||
|
if(player.getHydration() < 1)
|
||||||
|
{
|
||||||
|
player.rehydrate();
|
||||||
|
|
||||||
|
volume -= 0.0005;
|
||||||
|
|
||||||
|
if(volume < 0) {
|
||||||
|
volume = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
te.setVolume(volume);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDestroy(Layer layer, Chunk chunk, TileState oldState, TileState newState, Vec2i pos) {
|
||||||
|
super.onDestroy(layer, chunk, oldState, newState, pos);
|
||||||
|
|
||||||
|
if(newState.tile == Tiles.CLAY_POT) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
TileEntityClayPot te = (TileEntityClayPot)chunk.getTileEntity(pos);
|
||||||
|
|
||||||
|
if(te == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
chunk.spawnEntity(new EntityItem(pos.toDouble().add(0.5).xny(),
|
||||||
|
new Vec3d(0, 0, 0), new ItemStack(Items.CLAY_POT, 1,
|
||||||
|
new ItemModifierWater(te.getVolume()))));
|
||||||
|
|
||||||
|
te.kill();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,12 @@
|
||||||
|
package projectzombie.tiles;
|
||||||
|
|
||||||
|
import projectzombie.init.Models;
|
||||||
|
import projectzombie.model.Model;
|
||||||
|
|
||||||
|
public class TileGrassBurnt extends Tile
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public Model getModel(byte meta) {
|
||||||
|
return Models.TILE_GRASS_BURNT;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -13,15 +13,9 @@ public class TileLadder extends Tile
|
||||||
this.tileSolid = true;
|
this.tileSolid = true;
|
||||||
this.tileHitbox = 0.3;
|
this.tileHitbox = 0.3;
|
||||||
this.unbreakable = true;
|
this.unbreakable = true;
|
||||||
this.emitsLight = true;
|
|
||||||
this.passNaturalLight = false;
|
this.passNaturalLight = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public double getLightLevel(TileState state, Vec2i pos) {
|
|
||||||
return 0.5;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Model getModel(byte meta) {
|
public Model getModel(byte meta) {
|
||||||
return Models.TILE_LADDER;
|
return Models.TILE_LADDER;
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,21 @@
|
||||||
|
package projectzombie.tiles;
|
||||||
|
|
||||||
|
import projectzombie.init.Models;
|
||||||
|
import projectzombie.model.Model;
|
||||||
|
|
||||||
|
public class TileOre extends Tile
|
||||||
|
{
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Model getModel(byte meta) {
|
||||||
|
switch(meta)
|
||||||
|
{
|
||||||
|
case 0: return Models.TILE_ORE_IRON;
|
||||||
|
case 1: return Models.TILE_ORE_COPPER;
|
||||||
|
case 2: return Models.TILE_ORE_TIN;
|
||||||
|
case 3: return Models.TILE_ORE_GOLD;
|
||||||
|
default: return Models.TILE_MISSING;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -38,7 +38,7 @@ public class TileRock extends Tile implements TileBulletBreakable
|
||||||
public ItemStack[] getTileDrops(TileState state) {
|
public ItemStack[] getTileDrops(TileState state) {
|
||||||
return new ItemStack[] {
|
return new ItemStack[] {
|
||||||
new ItemStack(Items.ROCK, 1, new ItemModifierMeta(state.meta)),
|
new ItemStack(Items.ROCK, 1, new ItemModifierMeta(state.meta)),
|
||||||
new ItemStack(Items.FLINT, state.meta == 0 && Math.random() > 0.8 ? 1 : 0),
|
new ItemStack(Items.FLINT, state.meta == 0 && Math.random() > 0.75 ? 1 : 0),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ public class TileTallGrass extends Tile
|
||||||
@Override
|
@Override
|
||||||
public ItemStack[] getTileDrops(TileState state) {
|
public ItemStack[] getTileDrops(TileState state) {
|
||||||
return new ItemStack[] {
|
return new ItemStack[] {
|
||||||
new ItemStack(Items.PLANT_FIBRE, Math.random() > 0.9 ? 1 : 0),
|
new ItemStack(Items.PLANT_FIBRE, Math.random() > 0.6 ? 1 : 0),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ package projectzombie.tiles;
|
||||||
import projectzombie.init.Items;
|
import projectzombie.init.Items;
|
||||||
import projectzombie.init.Models;
|
import projectzombie.init.Models;
|
||||||
import projectzombie.items.ItemTool;
|
import projectzombie.items.ItemTool;
|
||||||
|
import projectzombie.items.ItemToolType;
|
||||||
import projectzombie.items.modifier.ItemModifierMeta;
|
import projectzombie.items.modifier.ItemModifierMeta;
|
||||||
import projectzombie.model.Model;
|
import projectzombie.model.Model;
|
||||||
import projectzombie.util.math.ItemStack;
|
import projectzombie.util.math.ItemStack;
|
||||||
|
|
@ -19,13 +20,13 @@ public class TileTree extends Tile implements TileBulletBreakable
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canTileBreak(TileState state, ItemStack stack, ItemTool tool)
|
public boolean canTileBreak(TileState state, ItemStack stack, ItemTool tool) {
|
||||||
{
|
return (tool != null && tool.toolType(stack) == ItemToolType.HATCHET);
|
||||||
if(tool == null) {
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return tool.toolPowerAxe(stack) > 0;
|
@Override
|
||||||
|
public boolean canTileSpeedBreak(TileState state, ItemStack stack, ItemTool tool) {
|
||||||
|
return canTileBreak(state, stack, tool);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -4,8 +4,13 @@ import gl_engine.vec.Vec2i;
|
||||||
import projectzombie.entity.Entity;
|
import projectzombie.entity.Entity;
|
||||||
import projectzombie.entity.particle.ParticleWater;
|
import projectzombie.entity.particle.ParticleWater;
|
||||||
import projectzombie.entity.player.EntityPlayer;
|
import projectzombie.entity.player.EntityPlayer;
|
||||||
|
import projectzombie.init.Items;
|
||||||
import projectzombie.init.Models;
|
import projectzombie.init.Models;
|
||||||
|
import projectzombie.items.ItemTool;
|
||||||
|
import projectzombie.items.ItemToolType;
|
||||||
|
import projectzombie.items.modifier.ItemModifierMeta;
|
||||||
import projectzombie.model.Model;
|
import projectzombie.model.Model;
|
||||||
|
import projectzombie.util.math.ItemStack;
|
||||||
import projectzombie.util.math.TileState;
|
import projectzombie.util.math.TileState;
|
||||||
import projectzombie.world.chunk.Chunk;
|
import projectzombie.world.chunk.Chunk;
|
||||||
import projectzombie.world.layer.Layer;
|
import projectzombie.world.layer.Layer;
|
||||||
|
|
@ -16,6 +21,7 @@ public class TileWater extends Tile
|
||||||
public TileWater() {
|
public TileWater() {
|
||||||
this.slowness = 0.5;
|
this.slowness = 0.5;
|
||||||
this.unbreakable = true;
|
this.unbreakable = true;
|
||||||
|
this.hardness = 800;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -38,6 +44,28 @@ public class TileWater extends Tile
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canTileBreak(TileState state, ItemStack stack, ItemTool tool) {
|
||||||
|
return (tool != null && tool.toolType(stack) == ItemToolType.SHOVEL);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canTileSpeedBreak(TileState state, ItemStack stack, ItemTool tool) {
|
||||||
|
return canTileBreak(state, stack, tool);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean doBreak(Layer layer, Chunk chunk, TileState state, Vec2i pos) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ItemStack[] getTileDrops(TileState state) {
|
||||||
|
return new ItemStack[] {
|
||||||
|
new ItemStack(Items.ROCK, 2, new ItemModifierMeta(3)),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Model getModel(byte meta) {
|
public Model getModel(byte meta) {
|
||||||
return Models.TILE_WATER;
|
return Models.TILE_WATER;
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,46 @@
|
||||||
|
package projectzombie.tiles;
|
||||||
|
|
||||||
|
import gl_engine.vec.Vec2i;
|
||||||
|
import projectzombie.Main;
|
||||||
|
import projectzombie.entity.Entity;
|
||||||
|
import projectzombie.init.Models;
|
||||||
|
import projectzombie.inventory.Crafting;
|
||||||
|
import projectzombie.items.ItemTool;
|
||||||
|
import projectzombie.items.ItemToolType;
|
||||||
|
import projectzombie.menu.MenuInventoryBasic;
|
||||||
|
import projectzombie.model.Model;
|
||||||
|
import projectzombie.util.math.ItemStack;
|
||||||
|
import projectzombie.util.math.TileState;
|
||||||
|
import projectzombie.world.layer.Layer;
|
||||||
|
|
||||||
|
public class TileWorkbench extends Tile
|
||||||
|
{
|
||||||
|
public TileWorkbench() {
|
||||||
|
tileSolid = true;
|
||||||
|
tileHitbox = 0.4;
|
||||||
|
hardness = 200;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Model getModel(byte meta) {
|
||||||
|
return Models.TILE_WORKBENCH;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canTileBreak(TileState state, ItemStack stack, ItemTool tool) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canTileSpeedBreak(TileState state, ItemStack stack, ItemTool tool) {
|
||||||
|
return (tool != null && tool.toolType(stack) == ItemToolType.HATCHET);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onActivated(Layer layer, Vec2i tpos, Entity entity, TileState state) {
|
||||||
|
super.onActivated(layer, tpos, entity, state);
|
||||||
|
|
||||||
|
Main.menu = new MenuInventoryBasic(Main.menu, Crafting.WOODEN_WORKBENCH);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -521,13 +521,16 @@ public class Chunk implements IBdfClassManager
|
||||||
|
|
||||||
public void setBackTile(TileState tile, int id)
|
public void setBackTile(TileState tile, int id)
|
||||||
{
|
{
|
||||||
|
Vec2i pos = Vec2i.fromId(CHUNK_SIZE, id).add(c_pos.multiply(16));
|
||||||
|
tiles_back[id].onDestroy(layer, this, new TileState(tiles_back[id], tiles_back_meta[id]), tile, pos);
|
||||||
|
|
||||||
// Set the back tile
|
// Set the back tile
|
||||||
this.tiles_back[id] = tile.tile;
|
tiles_back[id] = tile.tile;
|
||||||
this.tiles_back_meta[id] = tile.meta;
|
tiles_back_meta[id] = tile.meta;
|
||||||
|
|
||||||
setDirty();
|
setDirty();
|
||||||
|
|
||||||
tile.tile.onGenerate(layer, this, tile, Vec2i.fromId(CHUNK_SIZE, id));
|
tile.tile.onGenerate(layer, this, tile, pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setFrontTile(TileState tile, Vec2i pos)
|
public void setFrontTile(TileState tile, Vec2i pos)
|
||||||
|
|
@ -543,13 +546,16 @@ public class Chunk implements IBdfClassManager
|
||||||
|
|
||||||
public void setFrontTile(TileState tile, int id)
|
public void setFrontTile(TileState tile, int id)
|
||||||
{
|
{
|
||||||
|
Vec2i pos = Vec2i.fromId(CHUNK_SIZE, id).add(c_pos.multiply(16));
|
||||||
|
tiles_front[id].onDestroy(layer, this, new TileState(tiles_front[id], tiles_front_meta[id]), tile, pos);
|
||||||
|
|
||||||
// Set the front tile
|
// Set the front tile
|
||||||
this.tiles_front[id] = tile.tile;
|
this.tiles_front[id] = tile.tile;
|
||||||
this.tiles_front_meta[id] = tile.meta;
|
this.tiles_front_meta[id] = tile.meta;
|
||||||
|
|
||||||
setDirty();
|
setDirty();
|
||||||
|
|
||||||
tile.tile.onGenerate(layer, this, tile, Vec2i.fromId(CHUNK_SIZE, id));
|
tile.tile.onGenerate(layer, this, tile, pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
public TileState getBackTile(Vec2i pos)
|
public TileState getBackTile(Vec2i pos)
|
||||||
|
|
@ -608,7 +614,8 @@ public class Chunk implements IBdfClassManager
|
||||||
|
|
||||||
if(!ts.tile.unbreakable) {
|
if(!ts.tile.unbreakable) {
|
||||||
setFrontTile(Tiles.VOID.getDefaultState(), pos);
|
setFrontTile(Tiles.VOID.getDefaultState(), pos);
|
||||||
spawnEntity(new ParticleBreak(new Vec3d(pos.x + 0.5, 0, pos.y + 0.5), new Vec3d(0, 0, 0), ts.tile.getModel(ts.meta)));
|
spawnEntity(new ParticleBreak(new Vec3d(pos.x + 0.5, 0, pos.y + 0.5),
|
||||||
|
new Vec3d(0, 0, 0), ts.tile.getModel(ts.meta)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@ public class LayerGenEarth extends LayerGen
|
||||||
// Get the noise generator
|
// Get the noise generator
|
||||||
double humidity = getHumidity(layer, pos);
|
double humidity = getHumidity(layer, pos);
|
||||||
double light = MathHelpers.map(
|
double light = MathHelpers.map(
|
||||||
MathHelpers.sin(GameTimer.getTime() / 14400.0 - MathHelpers.PI / 4),
|
MathHelpers.sin(MathHelpers.map(GameTimer.getTime() % 720000, 0, 720000, 0, MathHelpers.TWO_PI)),
|
||||||
-1, 1, 0.2 * humidity, 0.2);
|
-1, 1, 0.2 * humidity, 0.2);
|
||||||
NoiseGenerator terrain_noise = layer.noise_gens[0];
|
NoiseGenerator terrain_noise = layer.noise_gens[0];
|
||||||
return MathHelpers.map(terrain_noise.eval(pos.x / World.BIOME_SIZE, pos.y / World.BIOME_SIZE), -1, 1, 0, 0.5 + light);
|
return MathHelpers.map(terrain_noise.eval(pos.x / World.BIOME_SIZE, pos.y / World.BIOME_SIZE), -1, 1, 0, 0.5 + light);
|
||||||
|
|
@ -201,7 +201,7 @@ public class LayerGenEarth extends LayerGen
|
||||||
}
|
}
|
||||||
|
|
||||||
private double getEarthLight() {
|
private double getEarthLight() {
|
||||||
return MathHelpers.sin(((MathHelpers.TWO_PI * (GameTimer.getTime() % 720000)) / 72000.0) + MathHelpers.PI/4) * 0.5 + 0.5;
|
return MathHelpers.sin(Math.toRadians(getSunPosition())) * 0.5 + 0.5;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -210,8 +210,17 @@ public class LayerGenEarth extends LayerGen
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double getSunPosition() {
|
public double getSunPosition()
|
||||||
return (GameTimer.getTime() % 720000) / 200.0 + 45;
|
{
|
||||||
|
int timer = (int)((GameTimer.getTime() + 9000) % 72000);
|
||||||
|
|
||||||
|
if(timer < 48000) {
|
||||||
|
return MathHelpers.map(timer, 0, 48000, 0, 180);
|
||||||
|
}
|
||||||
|
|
||||||
|
else {
|
||||||
|
return 270;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,7 @@ uniform vec3 lighting_day_high;
|
||||||
uniform vec2 lightmap_offset;
|
uniform vec2 lightmap_offset;
|
||||||
uniform vec2 lightmap_size;
|
uniform vec2 lightmap_size;
|
||||||
|
|
||||||
|
uniform int do_lighting;
|
||||||
uniform int do_discard_coords;
|
uniform int do_discard_coords;
|
||||||
uniform vec4 discard_coords;
|
uniform vec4 discard_coords;
|
||||||
uniform vec4 color;
|
uniform vec4 color;
|
||||||
|
|
@ -93,7 +94,8 @@ void main()
|
||||||
float fog = pCameraDepth;
|
float fog = pCameraDepth;
|
||||||
|
|
||||||
FragColor = (fog + (1 - fog) * textureRGB * (mod(int(pFlags / 4), 2) == 1 ? color_grass : vec4(1,1,1,1)) * color)
|
FragColor = (fog + (1 - fog) * textureRGB * (mod(int(pFlags / 4), 2) == 1 ? color_grass : vec4(1,1,1,1)) * color)
|
||||||
* vec4(light_day + max(0, light_src), pFade) * (mod(int(pFlags / 2), 2) == 1 ? rgb : vec4(1, 1, 1, 1))
|
* vec4(do_lighting == 1 ? (light_day + max(0, light_src)) : vec3(1), pFade)
|
||||||
|
* (mod(int(pFlags / 2), 2) == 1 ? rgb : vec4(1, 1, 1, 1))
|
||||||
* saturation + contrast;
|
* saturation + contrast;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 4.4 KiB |
|
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 2.5 KiB |
|
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 2.7 KiB |
|
After Width: | Height: | Size: 2.9 KiB |
|
|
@ -185,6 +185,7 @@
|
||||||
./tile/rock_ice.png
|
./tile/rock_ice.png
|
||||||
./tile/boss_portal.png
|
./tile/boss_portal.png
|
||||||
./tile/ladder.png
|
./tile/ladder.png
|
||||||
|
./tile/grass_burnt.png
|
||||||
./tile/hemp7.png
|
./tile/hemp7.png
|
||||||
./tile/grass_infested.png
|
./tile/grass_infested.png
|
||||||
./tile/tree_branch.png
|
./tile/tree_branch.png
|
||||||
|
|
@ -221,6 +222,7 @@
|
||||||
./entity/zombie_back_still.png
|
./entity/zombie_back_still.png
|
||||||
./entity/zombie_front_still.png
|
./entity/zombie_front_still.png
|
||||||
./item/acorn.png
|
./item/acorn.png
|
||||||
|
./item/clay.png
|
||||||
./item/grappling_hook.png
|
./item/grappling_hook.png
|
||||||
./item/gun_upgrade.png
|
./item/gun_upgrade.png
|
||||||
./item/shield_upgrade.png
|
./item/shield_upgrade.png
|
||||||
|
|
|
||||||
|
After Width: | Height: | Size: 2.2 KiB |