make game less blocky
This commit is contained in:
parent
aabe877c85
commit
c617be685b
15 changed files with 64 additions and 51 deletions
|
@ -35,7 +35,6 @@ import client.renderer.texture.TextureMap;
|
|||
import client.renderer.tileentity.SpecialRenderer;
|
||||
import client.world.ChunkClient;
|
||||
import common.block.Block;
|
||||
import common.block.BlockFalling;
|
||||
import common.block.Material;
|
||||
import common.block.artificial.BlockSlab;
|
||||
import common.block.liquid.BlockDynamicLiquid;
|
||||
|
@ -1808,7 +1807,7 @@ public class Renderer {
|
|||
this.fluids.put(liquid.first(), sprites);
|
||||
}
|
||||
for(Block block : BlockRegistry.blocks()) {
|
||||
if(block instanceof BlockFalling && !(block instanceof BlockAnvil)) {
|
||||
if(block.isNonBlock()) {
|
||||
String name = BlockRegistry.getName(block);
|
||||
this.dynamic.put(block, texturemap.getAtlasSprite("blocks/" + name));
|
||||
}
|
||||
|
@ -3335,7 +3334,7 @@ public class Renderer {
|
|||
return false;
|
||||
else if(block.getMaterial().isLiquid())
|
||||
return this.renderFluid(world, state, pos, rb);
|
||||
else if(block instanceof BlockFalling && !(block instanceof BlockAnvil))
|
||||
else if(block.isNonBlock())
|
||||
return this.renderDynamic(world, state, pos, rb);
|
||||
State mstate = state;
|
||||
if(!this.gm.debugWorld) {
|
||||
|
@ -3931,7 +3930,7 @@ public class Renderer {
|
|||
{
|
||||
BlockPos blockpos = blockPosIn.add(-(j & 1), 0, -(j >> 1 & 1));
|
||||
|
||||
if (blockAccess.getState(blockpos.up()).getBlock() == block)
|
||||
if (blockAccess.getState(blockpos.up()).getBlock() != Blocks.air)
|
||||
{
|
||||
return 1.0F;
|
||||
}
|
||||
|
|
Before Width: | Height: | Size: 729 KiB After Width: | Height: | Size: 729 KiB |
Before Width: | Height: | Size: 6.1 KiB After Width: | Height: | Size: 6.1 KiB |
Binary file not shown.
Before Width: | Height: | Size: 5 KiB |
BIN
client/src/main/resources/textures/blocks/snowy_grass.png
Executable file
BIN
client/src/main/resources/textures/blocks/snowy_grass.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 207 B |
|
@ -648,6 +648,10 @@ public class Block {
|
|||
return true;
|
||||
}
|
||||
|
||||
public boolean isNonBlock() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isPassable(IBlockAccess world, BlockPos pos) {
|
||||
return !this.material.blocksMovement();
|
||||
}
|
||||
|
|
|
@ -73,4 +73,8 @@ public class BlockFalling extends Block {
|
|||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isNonBlock() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,37 +2,27 @@ package common.block.foliage;
|
|||
|
||||
import common.block.Block;
|
||||
import common.block.Material;
|
||||
import common.block.natural.BlockNonBlock;
|
||||
import common.init.Blocks;
|
||||
import common.item.CheatTab;
|
||||
import common.item.Item;
|
||||
import common.model.Model;
|
||||
import common.model.Model.ModelProvider;
|
||||
import common.properties.Property;
|
||||
import common.properties.PropertyBool;
|
||||
import common.rng.Random;
|
||||
import common.util.BlockPos;
|
||||
import common.vars.Vars;
|
||||
import common.world.IWorldAccess;
|
||||
import common.world.State;
|
||||
import common.world.World;
|
||||
import common.world.AWorldServer;
|
||||
|
||||
public class BlockGrass extends Block implements IGrowable
|
||||
public class BlockGrass extends BlockNonBlock implements IGrowable
|
||||
{
|
||||
public static final PropertyBool SNOWY = PropertyBool.create("snowy");
|
||||
private final boolean snowy;
|
||||
|
||||
public BlockGrass()
|
||||
public BlockGrass(boolean snowy)
|
||||
{
|
||||
super(Material.LOOSE);
|
||||
this.setDefaultState(this.getBaseState().withProperty(SNOWY, Boolean.valueOf(false)));
|
||||
this.setTicked();
|
||||
this.setTab(CheatTab.NATURE);
|
||||
}
|
||||
|
||||
public State getState(State state, IWorldAccess worldIn, BlockPos pos)
|
||||
{
|
||||
Block block = worldIn.getState(pos.up()).getBlock();
|
||||
return state.withProperty(SNOWY, Boolean.valueOf(block == Blocks.snow || block == Blocks.snow_layer));
|
||||
this.snowy = snowy;
|
||||
}
|
||||
|
||||
public void tick(AWorldServer worldIn, BlockPos pos, State state, Random rand)
|
||||
|
@ -42,9 +32,20 @@ public class BlockGrass extends Block implements IGrowable
|
|||
if(Vars.grassDecay)
|
||||
worldIn.setState(pos, Blocks.dirt.getState());
|
||||
}
|
||||
else if(worldIn.getTemperatureC(pos) < 50.0f)
|
||||
else if(worldIn.getTemperatureC(pos) >= 50.0f) {
|
||||
if(Vars.grassDry)
|
||||
worldIn.setState(pos, worldIn.rand.chance(20) ? Blocks.coarse_dirt.getState() :
|
||||
Blocks.dirt.getState());
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Vars.grassSpread && worldIn.getLightFromNeighbors(pos.up()) >= 9)
|
||||
if(this == Blocks.snowy_grass && !worldIn.canFreezeAt(pos)) {
|
||||
worldIn.setState(pos, Blocks.grass.getState());
|
||||
}
|
||||
else if(this == Blocks.grass && worldIn.isRaining() && worldIn.canFreezeAt(pos)) {
|
||||
worldIn.setState(pos, Blocks.snowy_grass.getState());
|
||||
}
|
||||
else if (Vars.grassSpread && worldIn.getLightFromNeighbors(pos.up()) >= 9)
|
||||
{
|
||||
for (int i = 0; i < 4; ++i)
|
||||
{
|
||||
|
@ -59,11 +60,6 @@ public class BlockGrass extends Block implements IGrowable
|
|||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(Vars.grassDry)
|
||||
worldIn.setState(pos, worldIn.rand.chance(20) ? Blocks.coarse_dirt.getState() :
|
||||
Blocks.dirt.getState());
|
||||
}
|
||||
}
|
||||
|
||||
public Item getDrop(State state, Random rand, int fortune)
|
||||
|
@ -85,20 +81,4 @@ public class BlockGrass extends Block implements IGrowable
|
|||
{
|
||||
worldIn.growGrass(pos, state, rand);
|
||||
}
|
||||
|
||||
protected Property[] getProperties()
|
||||
{
|
||||
return new Property[] {SNOWY};
|
||||
}
|
||||
|
||||
public Model getModel(ModelProvider provider, String name, State state) {
|
||||
if(state.getValue(SNOWY))
|
||||
return provider.getModel("dirt").add().d().u("snow").nswe().add().nswe("soil_snowed");
|
||||
else
|
||||
return provider.getModel("dirt").add().d().u("grass_top").nswe().add().nswe("grass_side");
|
||||
}
|
||||
|
||||
protected Property[] getUnsavedProperties() {
|
||||
return new Property[] {SNOWY};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ import common.vars.Vars;
|
|||
import common.world.State;
|
||||
import common.world.AWorldServer;
|
||||
|
||||
public class BlockBlackenedDirt extends Block
|
||||
public class BlockBlackenedDirt extends BlockNonBlock
|
||||
{
|
||||
public BlockBlackenedDirt()
|
||||
{
|
||||
|
|
18
common/src/main/java/common/block/natural/BlockNonBlock.java
Normal file
18
common/src/main/java/common/block/natural/BlockNonBlock.java
Normal file
|
@ -0,0 +1,18 @@
|
|||
package common.block.natural;
|
||||
|
||||
import common.block.Block;
|
||||
import common.block.Material;
|
||||
|
||||
public class BlockNonBlock extends Block {
|
||||
public BlockNonBlock(Material material) {
|
||||
super(material);
|
||||
}
|
||||
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isNonBlock() {
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -7,7 +7,7 @@ import common.item.CheatTab;
|
|||
import common.util.BlockPos;
|
||||
import common.world.World;
|
||||
|
||||
public class BlockSlime extends Block {
|
||||
public class BlockSlime extends BlockNonBlock {
|
||||
public BlockSlime() {
|
||||
super(Material.LOOSE);
|
||||
this.setTab(CheatTab.NATURE);
|
||||
|
|
|
@ -58,6 +58,10 @@ public class BlockAnvil extends BlockFalling implements Rotatable
|
|||
return false;
|
||||
}
|
||||
|
||||
public boolean isNonBlock() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isMagnetic() {
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -211,11 +211,13 @@ public abstract class BlockRegistry {
|
|||
|
||||
|
||||
Block dirt;
|
||||
register("dirt", (dirt = new Block(Material.LOOSE)).setHardness(0.5F).setSound(SoundType.GRAVEL).setDisplay("Erde").setMiningTool(Equipment.SHOVEL).setTab(CheatTab.NATURE));
|
||||
register("dirt", (dirt = new BlockNonBlock(Material.LOOSE)).setHardness(0.5F).setSound(SoundType.GRAVEL).setDisplay("Erde").setMiningTool(Equipment.SHOVEL).setTab(CheatTab.NATURE));
|
||||
Block grass;
|
||||
register("grass", (grass = new BlockGrass()).setHardness(0.6F).setSound(SoundType.GRASS).setDisplay("Gras").setMiningTool(Equipment.SHOVEL));
|
||||
register("grass", (grass = new BlockGrass(false)).setHardness(0.6F).setSound(SoundType.GRASS).setDisplay("Gras").setMiningTool(Equipment.SHOVEL));
|
||||
Block snowy_grass;
|
||||
register("snowy_grass", (snowy_grass = new BlockGrass(true)).setHardness(0.6F).setSound(SoundType.GRASS).setDisplay("Beschneites Gras").setMiningTool(Equipment.SHOVEL));
|
||||
Block coarse_dirt;
|
||||
register("coarse_dirt", (coarse_dirt = new Block(Material.LOOSE)).setHardness(0.5F).setSound(SoundType.GRAVEL).setDisplay("Grobe Erde").setMiningTool(Equipment.SHOVEL).setTab(CheatTab.NATURE));
|
||||
register("coarse_dirt", (coarse_dirt = new BlockNonBlock(Material.LOOSE)).setHardness(0.5F).setSound(SoundType.GRAVEL).setDisplay("Grobe Erde").setMiningTool(Equipment.SHOVEL).setTab(CheatTab.NATURE));
|
||||
Block podzol;
|
||||
register("podzol", (podzol = new BlockPodzol()).setHardness(0.5F).setSound(SoundType.GRAVEL).setDisplay("Podsol").setMiningTool(Equipment.SHOVEL));
|
||||
Block mycelium;
|
||||
|
@ -223,7 +225,7 @@ public abstract class BlockRegistry {
|
|||
Block swamp;
|
||||
register("swamp", (swamp = new BlockSwamp()).setHardness(0.6F).setSound(SoundType.GRASS).setDisplay("Sumpf").setMiningTool(Equipment.SHOVEL));
|
||||
Block tian;
|
||||
register("tian", (tian = new Block(Material.SOLID)).setHardness(2.0F).setResistance(15.0F).setSound(SoundType.STONE)
|
||||
register("tian", (tian = new BlockNonBlock(Material.SOLID)).setHardness(2.0F).setResistance(15.0F).setSound(SoundType.STONE)
|
||||
.setDisplay("Tian").setTab(CheatTab.NATURE));
|
||||
Block tian_soil;
|
||||
register("tian_soil", (tian_soil = new BlockTianSoil()).setHardness(2.0F).setResistance(15.0F).setSound(SoundType.STONE)
|
||||
|
|
|
@ -153,7 +153,7 @@ public abstract class Blocks {
|
|||
public static final BlockClay clay = get("clay");
|
||||
public static final BlockCompressable coal_block = get("coal_block");
|
||||
public static final BlockOre coal_ore = get("coal_ore");
|
||||
public static final Block coarse_dirt = get("coarse_dirt");
|
||||
public static final BlockNonBlock coarse_dirt = get("coarse_dirt");
|
||||
public static final BlockMetalBlock cobalt_block = get("cobalt_block");
|
||||
public static final BlockMetalOre cobalt_ore = get("cobalt_ore");
|
||||
public static final Block cobblestone = get("cobblestone");
|
||||
|
@ -188,7 +188,7 @@ public abstract class Blocks {
|
|||
public static final BlockTallGrass dead_bush = get("dead_bush");
|
||||
public static final BlockDeadBush deadbush = get("deadbush");
|
||||
public static final BlockOre diamond_ore = get("diamond_ore");
|
||||
public static final Block dirt = get("dirt");
|
||||
public static final BlockNonBlock dirt = get("dirt");
|
||||
public static final BlockDispenser dispenser = get("dispenser");
|
||||
public static final BlockDragonEgg dragon_egg = get("dragon_egg");
|
||||
public static final BlockDispenser dropper = get("dropper");
|
||||
|
@ -235,6 +235,7 @@ public abstract class Blocks {
|
|||
public static final BlockMetalOre gold_ore = get("gold_ore");
|
||||
public static final BlockStaticLiquid goo = get("goo");
|
||||
public static final BlockGrass grass = get("grass");
|
||||
public static final BlockGrass snowy_grass = get("snowy_grass");
|
||||
public static final BlockGravel gravel = get("gravel");
|
||||
public static final BlockCarpet gray_carpet = get("gray_carpet");
|
||||
public static final BlockColoredClay gray_clay = get("gray_clay");
|
||||
|
@ -457,7 +458,7 @@ public abstract class Blocks {
|
|||
public static final BlockDoublePlant syringa = get("syringa");
|
||||
public static final BlockTallGrass tallgrass = get("tallgrass");
|
||||
public static final BlockOre thetium_ore = get("thetium_ore");
|
||||
public static final Block tian = get("tian");
|
||||
public static final BlockNonBlock tian = get("tian");
|
||||
public static final BlockDoor tian_wood_door = get("tian_wood_door");
|
||||
public static final BlockFence tian_wood_fence = get("tian_wood_fence");
|
||||
public static final BlockFenceGate tian_wood_fence_gate = get("tian_wood_fence_gate");
|
||||
|
|
|
@ -369,6 +369,7 @@ public abstract class Items {
|
|||
public static final ItemAppleGold charged_apple = get("charged_apple");
|
||||
public static final ItemBucket goo_bucket = get("goo_bucket");
|
||||
public static final Item grass = get("grass");
|
||||
public static final Item snowy_grass = get("snowy_grass");
|
||||
public static final Item gravel = get("gravel");
|
||||
public static final Item gray_carpet = get("gray_carpet");
|
||||
public static final Item gray_clay = get("gray_clay");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue