Adding wood walls, fully implemented wood floors
This commit is contained in:
parent
02355bfedc
commit
6ef6277148
|
|
@ -32,6 +32,7 @@ import projectzombie.items.ItemStoneShovel;
|
|||
import projectzombie.items.ItemTnt;
|
||||
import projectzombie.items.ItemTorch;
|
||||
import projectzombie.items.ItemWoodPlanks;
|
||||
import projectzombie.items.ItemWoodWall;
|
||||
import projectzombie.items.ItemWorkbench;
|
||||
import projectzombie.items.spawner.ItemSpawnDummy;
|
||||
import projectzombie.items.spawner.ItemSpawnZombie;
|
||||
|
|
@ -80,6 +81,7 @@ public class Items
|
|||
register(TORCH);
|
||||
register(COAL);
|
||||
register(WOOD_PLANKS);
|
||||
register(WOOD_WALL);
|
||||
}
|
||||
|
||||
public static final Item AMMO = new ItemAmmo();
|
||||
|
|
@ -114,4 +116,5 @@ public class Items
|
|||
public static final Item TORCH = new ItemTorch();
|
||||
public static final Item COAL = new ItemCoal();
|
||||
public static final Item WOOD_PLANKS = new ItemWoodPlanks();
|
||||
public static final Item WOOD_WALL = new ItemWoodWall();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -213,8 +213,8 @@ public class Models
|
|||
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"));
|
||||
public static final ModelItem ITEM_WOOD_FLOOR = new ModelItem(Resources.ATLAS.get("/item/wood_floor.png"));
|
||||
public static final ModelItem ITEM_WOOD_SNOW_FLOOR = new ModelItem(Resources.ATLAS.get("/item/wood_snow_floor.png"));
|
||||
public static final ModelItem ITEM_WOOD_WALL = new ModelItem(Resources.ATLAS.get("/item/wood_wall.png"));
|
||||
public static final ModelItem ITEM_WOOD_SNOW_WALL = new ModelItem(Resources.ATLAS.get("/item/wood_snow_wall.png"));
|
||||
public static final ModelItem ITEM_WOOD_PLANKS = new ModelItem(Resources.ATLAS.get("/item/wood_planks.png"));
|
||||
public static final ModelItem ITEM_WOOD_SNOW_PLANKS = new ModelItem(Resources.ATLAS.get("/item/wood_snow_planks.png"));
|
||||
|
||||
|
|
|
|||
|
|
@ -48,6 +48,13 @@ public class Recipes
|
|||
Crafting.BASIC,
|
||||
}, new ItemStack(Items.WOOD_PLANKS, 2)));
|
||||
|
||||
recipies.add(new RecipeBasic(
|
||||
new ItemStack[] {
|
||||
new ItemStack(Items.LOG, 2),
|
||||
}, new Crafting[] {
|
||||
Crafting.BASIC,
|
||||
}, new ItemStack(Items.WOOD_WALL, 1)));
|
||||
|
||||
recipies.add(new RecipeBasic(
|
||||
new ItemStack[] {
|
||||
new ItemStack(Items.FLINT, 2),
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@ import projectzombie.tiles.TileTree;
|
|||
import projectzombie.tiles.TileVoid;
|
||||
import projectzombie.tiles.TileWall;
|
||||
import projectzombie.tiles.TileWater;
|
||||
import projectzombie.tiles.TileWoodFloor;
|
||||
import projectzombie.tiles.TileWorkbench;
|
||||
|
||||
public class Tiles
|
||||
|
|
@ -88,6 +89,7 @@ public class Tiles
|
|||
register(CLAY_POT);
|
||||
register(ORE);
|
||||
register(COAL);
|
||||
register(WOOD_FLOOR);
|
||||
}
|
||||
|
||||
public static final Tile GRASS = new TileGrass();
|
||||
|
|
@ -124,4 +126,5 @@ public class Tiles
|
|||
public static final Tile CLAY_POT = new TileClayPot();
|
||||
public static final Tile ORE = new TileOre();
|
||||
public static final Tile COAL = new TileCoal();
|
||||
public static final Tile WOOD_FLOOR = new TileWoodFloor();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,11 +1,15 @@
|
|||
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.items.modifier.ItemModifierMeta;
|
||||
import projectzombie.model.Model;
|
||||
import projectzombie.model.ModelItem;
|
||||
import projectzombie.util.ItemStack;
|
||||
import projectzombie.util.TileState;
|
||||
import projectzombie.world.layer.Layer;
|
||||
|
||||
public class ItemWoodPlanks extends Item
|
||||
|
|
@ -24,7 +28,7 @@ public class ItemWoodPlanks extends Item
|
|||
|
||||
@Override
|
||||
public boolean showPlaceModel(Layer layer, Vec2i pos, ItemStack stack) {
|
||||
return true;
|
||||
return layer.getBackTile(pos).tile.isNaturalFloorItem && layer.getFrontTile(pos).tile.isNaturalFloorItem;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -32,6 +36,22 @@ public class ItemWoodPlanks extends Item
|
|||
return Models.TILE_WOOD_FLOOR;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onPlayerRightClick(ItemStack stack, Layer layer, EntityPlayer player, Vec2d place_pos)
|
||||
{
|
||||
Vec2i pos = place_pos.toInt();
|
||||
|
||||
if(!layer.getBackTile(pos).tile.isNaturalFloorItem || !layer.getFrontTile(pos).tile.isNaturalFloorItem) {
|
||||
return false;
|
||||
}
|
||||
|
||||
stack.count -= 1;
|
||||
layer.setBackTile(new TileState(Tiles.WOOD_FLOOR, ItemModifierMeta.getStackMeta(stack)), pos);
|
||||
layer.setFrontTile(Tiles.VOID.getDefaultState(), pos);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName(ItemStack stack) {
|
||||
return "Wood Planks";
|
||||
|
|
|
|||
|
|
@ -0,0 +1,30 @@
|
|||
package projectzombie.items;
|
||||
|
||||
import gl_engine.MathHelpers;
|
||||
import projectzombie.Main;
|
||||
import projectzombie.init.Models;
|
||||
import projectzombie.model.Model;
|
||||
import projectzombie.model.ModelItem;
|
||||
import projectzombie.util.ItemStack;
|
||||
|
||||
public class ItemWoodWall extends Item
|
||||
{
|
||||
@Override
|
||||
public Model getPlaceModel(ItemStack stack)
|
||||
{
|
||||
int angle = (int)MathHelpers.mod(Main.player.angle / 90 + 0.5, 4);
|
||||
|
||||
return Models.TILE_WOOD_WALL[angle];
|
||||
}
|
||||
|
||||
@Override
|
||||
public ModelItem getModel(ItemStack stack) {
|
||||
return Models.ITEM_WOOD_WALL;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName(ItemStack stack) {
|
||||
return "Wood Wall";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -48,34 +48,78 @@ public class ModelWall extends Model
|
|||
@Override
|
||||
public float[] getVerticies()
|
||||
{
|
||||
float x1 = 0.5f, z1 = 0.5f, x2 = 0.25f, z2 = -0.5f;
|
||||
float x1=0, x2=0, x3=0, x4=0, z1=0, z2=0, z3=0, z4=0;
|
||||
|
||||
switch(rotation)
|
||||
{
|
||||
case 0:
|
||||
z1 = -0.5f;
|
||||
z2 = -0.5f;
|
||||
z3 = -0.25f;
|
||||
z4 = -0.25f;
|
||||
x1 = 0.5f;
|
||||
x2 = 0.5f;
|
||||
x3 = -0.5f;
|
||||
x4 = -0.5f;
|
||||
break;
|
||||
case 1:
|
||||
x1 = -0.5f;
|
||||
x2 = -0.5f;
|
||||
x3 = -0.25f;
|
||||
x4 = -0.25f;
|
||||
z1 = 0.5f;
|
||||
z2 = 0.5f;
|
||||
z3 = -0.5f;
|
||||
z4 = -0.5f;
|
||||
break;
|
||||
case 2:
|
||||
z1 = 0.5f;
|
||||
z2 = 0.5f;
|
||||
z3 = 0.25f;
|
||||
z4 = 0.25f;
|
||||
x1 = 0.5f;
|
||||
x2 = 0.5f;
|
||||
x3 = -0.5f;
|
||||
x4 = -0.5f;
|
||||
break;
|
||||
case 3:
|
||||
x1 = 0.5f;
|
||||
x2 = 0.5f;
|
||||
x3 = 0.25f;
|
||||
x4 = 0.25f;
|
||||
z1 = 0.5f;
|
||||
z2 = 0.5f;
|
||||
z3 = -0.5f;
|
||||
z4 = -0.5f;
|
||||
break;
|
||||
}
|
||||
|
||||
return new float[]
|
||||
{
|
||||
x1, 0, z1, 0, 0, 0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, z1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0,
|
||||
|
||||
x1, 0, z2, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0,
|
||||
x2, 0, z2, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0,
|
||||
x2, 1, z2, 1, 1, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0,
|
||||
x1, 1, z2, 0, 1, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0,
|
||||
x1, 0, z3, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0,
|
||||
x3, 0, z4, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0,
|
||||
x3, 1, z4, 1, 1, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0,
|
||||
x1, 1, z3, 0, 1, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0,
|
||||
|
||||
x1, 1, z1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0,
|
||||
x2, 1, z1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0,
|
||||
x2, 1, z2, 1, 1, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0,
|
||||
x1, 1, z2, 0, 1, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0,
|
||||
x3, 1, z1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0,
|
||||
x3, 1, z3, 1, 1, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0,
|
||||
x1, 1, z3, 0, 1, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0,
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ public abstract class Tile
|
|||
protected double light_dissipation = 1/8.0;
|
||||
public boolean emitsLight = false;
|
||||
public boolean passNaturalLight = true;
|
||||
public boolean isNaturalFloorItem = false;
|
||||
public int hardness = -1;
|
||||
|
||||
public void onWalkedOn(Chunk chunk, Layer layer, Vec2i pos, Entity entity, TileState state) {
|
||||
|
|
|
|||
|
|
@ -5,6 +5,9 @@ import projectzombie.model.Model;
|
|||
|
||||
public class TileDirt extends Tile
|
||||
{
|
||||
public TileDirt() {
|
||||
isNaturalFloorItem = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Model getModel(byte meta) {
|
||||
|
|
|
|||
|
|
@ -10,6 +10,9 @@ import projectzombie.world.layer.Layer;
|
|||
|
||||
public class TileGrass extends Tile
|
||||
{
|
||||
public TileGrass() {
|
||||
isNaturalFloorItem = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Model getModel(byte meta) {
|
||||
|
|
|
|||
|
|
@ -5,6 +5,10 @@ import projectzombie.model.Model;
|
|||
|
||||
public class TileGrassBurnt extends Tile
|
||||
{
|
||||
public TileGrassBurnt() {
|
||||
isNaturalFloorItem = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Model getModel(byte meta) {
|
||||
return Models.TILE_GRASS_BURNT;
|
||||
|
|
|
|||
|
|
@ -10,6 +10,10 @@ import projectzombie.world.layer.Layer;
|
|||
|
||||
public class TileGrassInfested extends Tile
|
||||
{
|
||||
public TileGrassInfested() {
|
||||
isNaturalFloorItem = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tickRandomly(Layer layer, Chunk chunk, TileState state, Vec2i pos) {
|
||||
super.tickRandomly(layer, chunk, state, pos);
|
||||
|
|
|
|||
|
|
@ -6,6 +6,10 @@ import projectzombie.util.TileState;
|
|||
|
||||
public class TileIce extends TileStone
|
||||
{
|
||||
public TileIce() {
|
||||
isNaturalFloorItem = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Model getModel(byte meta) {
|
||||
return Models.TILE_ICE;
|
||||
|
|
|
|||
|
|
@ -5,6 +5,9 @@ import projectzombie.model.Model;
|
|||
|
||||
public class TileStone extends Tile
|
||||
{
|
||||
public TileStone() {
|
||||
isNaturalFloorItem = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Model getModel(byte meta) {
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ public class TileTallGrass extends Tile
|
|||
{
|
||||
public TileTallGrass() {
|
||||
this.hardness = 200;
|
||||
this.isNaturalFloorItem = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ public class TileVoid extends Tile {
|
|||
// Set some settings
|
||||
this.tileSolid = false;
|
||||
this.tileWalkable = true;
|
||||
isNaturalFloorItem = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ public class TileWater extends Tile
|
|||
this.slowness = 0.5;
|
||||
this.unbreakable = true;
|
||||
this.hardness = 800;
|
||||
this.isNaturalFloorItem = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -0,0 +1,20 @@
|
|||
package projectzombie.tiles;
|
||||
|
||||
import projectzombie.init.Models;
|
||||
import projectzombie.model.Model;
|
||||
|
||||
public class TileWoodFloor extends Tile
|
||||
{
|
||||
|
||||
@Override
|
||||
public Model getModel(byte meta)
|
||||
{
|
||||
switch(meta)
|
||||
{
|
||||
case 0: return Models.TILE_WOOD_FLOOR;
|
||||
case 1: return Models.TILE_WOOD_SNOW_FLOOR;
|
||||
default: return Models.EMPTY;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
package projectzombie.tiles;
|
||||
|
||||
import projectzombie.init.Items;
|
||||
import projectzombie.init.Models;
|
||||
import projectzombie.items.ItemTool;
|
||||
import projectzombie.items.ItemToolType;
|
||||
import projectzombie.items.modifier.ItemModifierMeta;
|
||||
import projectzombie.model.Model;
|
||||
import projectzombie.util.ItemStack;
|
||||
import projectzombie.util.TileState;
|
||||
|
||||
public class TileWoodWall extends Tile
|
||||
{
|
||||
public TileWoodWall()
|
||||
{
|
||||
tileSolid = true;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canTileBreak(TileState state, ItemStack stack, ItemTool tool) {
|
||||
return tool.toolType(stack) == ItemToolType.HATCHET;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canTileSpeedBreak(TileState state, ItemStack stack, ItemTool tool) {
|
||||
return canTileBreak(state, stack, tool);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack[] getTileDrops(TileState state) {
|
||||
return new ItemStack[] {new ItemStack(Items.WOOD_WALL, 1, new ItemModifierMeta(state.meta / 4))};
|
||||
}
|
||||
|
||||
@Override
|
||||
public Model getModel(byte meta)
|
||||
{
|
||||
switch(meta / 4)
|
||||
{
|
||||
case 0: return Models.TILE_WOOD_WALL[meta];
|
||||
case 1: return Models.TILE_WOOD_SNOW_WALL[meta - 4];
|
||||
default: return Models.EMPTY;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue