general Block* code cleanup
This commit is contained in:
parent
8bd9370bab
commit
7fd8879c73
294 changed files with 2229 additions and 2650 deletions
|
@ -114,6 +114,7 @@ import common.future.ListenableFuture;
|
|||
import common.future.ListenableFutureTask;
|
||||
import common.future.ThreadFactoryBuilder;
|
||||
import common.init.BlockRegistry;
|
||||
import common.init.Blocks;
|
||||
import common.init.Config;
|
||||
import common.init.EntityRegistry;
|
||||
import common.init.ItemRegistry;
|
||||
|
@ -129,7 +130,6 @@ import common.item.ItemStack;
|
|||
import common.log.Log;
|
||||
import common.log.LogLevel;
|
||||
import common.log.Message;
|
||||
import common.material.Material;
|
||||
import common.network.IThreadListener;
|
||||
import common.network.NetConnection;
|
||||
import common.network.PacketDecoder;
|
||||
|
@ -1267,7 +1267,7 @@ public class Client implements IThreadListener {
|
|||
{
|
||||
BlockPos blockpos = this.pointed.block;
|
||||
|
||||
if (this.world.getState(blockpos).getBlock().getMaterial() != Material.air && this.controller.onPlayerDamageBlock(blockpos, this.pointed.side))
|
||||
if (this.world.getState(blockpos).getBlock() != Blocks.air && this.controller.onPlayerDamageBlock(blockpos, this.pointed.side))
|
||||
{
|
||||
this.effectRenderer.addBlockHitEffects(blockpos, this.pointed.side);
|
||||
this.player.swingItem();
|
||||
|
@ -1293,7 +1293,7 @@ public class Client implements IThreadListener {
|
|||
else
|
||||
{
|
||||
ItemStack itemstack = this.player.inventory.getCurrentItem();
|
||||
if ((this.pointed.type != ObjectType.BLOCK || this.world.getState(this.pointed.block).getBlock().getMaterial() == Material.air) && itemstack != null && itemstack.getItem().onAction(itemstack, this.player, this.world, ItemControl.PRIMARY, null))
|
||||
if ((this.pointed.type != ObjectType.BLOCK || this.world.getState(this.pointed.block).getBlock() == Blocks.air) && itemstack != null && itemstack.getItem().onAction(itemstack, this.player, this.world, ItemControl.PRIMARY, null))
|
||||
{
|
||||
this.player.swingItem();
|
||||
this.player.client.addToSendQueue(new CPacketAction(Action.ITEM_ACTION, ItemControl.PRIMARY.ordinal()));
|
||||
|
@ -1310,7 +1310,7 @@ public class Client implements IThreadListener {
|
|||
case BLOCK:
|
||||
this.player.swingItem();
|
||||
BlockPos blockpos = this.pointed.block;
|
||||
if (this.world.getState(blockpos).getBlock().getMaterial() != Material.air)
|
||||
if (this.world.getState(blockpos).getBlock() != Blocks.air)
|
||||
{
|
||||
this.controller.clickBlock(blockpos, this.pointed.side);
|
||||
break;
|
||||
|
@ -1345,7 +1345,7 @@ public class Client implements IThreadListener {
|
|||
}
|
||||
else
|
||||
{
|
||||
if ((this.pointed.type != ObjectType.BLOCK || this.world.getState(this.pointed.block).getBlock().getMaterial() == Material.air) && itemstack != null && itemstack.getItem().onAction(itemstack, this.player, this.world, ItemControl.SECONDARY, null))
|
||||
if ((this.pointed.type != ObjectType.BLOCK || this.world.getState(this.pointed.block).getBlock() == Blocks.air) && itemstack != null && itemstack.getItem().onAction(itemstack, this.player, this.world, ItemControl.SECONDARY, null))
|
||||
{
|
||||
this.player.swingItem();
|
||||
this.player.client.addToSendQueue(new CPacketAction(Action.ITEM_ACTION, ItemControl.SECONDARY.ordinal()));
|
||||
|
@ -1370,7 +1370,7 @@ public class Client implements IThreadListener {
|
|||
case BLOCK:
|
||||
BlockPos blockpos = this.pointed.block;
|
||||
|
||||
if (this.world.getState(blockpos).getBlock().getMaterial() != Material.air)
|
||||
if (this.world.getState(blockpos).getBlock() != Blocks.air)
|
||||
{
|
||||
int i = itemstack != null ? itemstack.stackSize : 0;
|
||||
|
||||
|
@ -1430,7 +1430,7 @@ public class Client implements IThreadListener {
|
|||
BlockPos blockpos = this.pointed.block;
|
||||
Block block = this.world.getState(blockpos).getBlock();
|
||||
|
||||
if (block.getMaterial() == Material.air)
|
||||
if (block == Blocks.air)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package client.gui.container;
|
||||
|
||||
import common.block.BlockWorkbench;
|
||||
import common.block.tech.BlockWorkbench;
|
||||
import common.inventory.ContainerWorkbench;
|
||||
import common.inventory.InventoryPlayer;
|
||||
import common.util.BlockPos;
|
||||
|
|
|
@ -35,7 +35,7 @@ import common.attributes.AttributeInstance;
|
|||
import common.attributes.AttributeMap;
|
||||
import common.attributes.AttributeModifier;
|
||||
import common.block.Block;
|
||||
import common.block.BlockWorkbench;
|
||||
import common.block.tech.BlockWorkbench;
|
||||
import common.collect.Lists;
|
||||
import common.collect.Maps;
|
||||
import common.dimension.Dimension;
|
||||
|
|
|
@ -8,7 +8,7 @@ import java.nio.IntBuffer;
|
|||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import common.block.Block;
|
||||
import common.block.BlockLiquid;
|
||||
import common.block.liquid.BlockLiquid;
|
||||
import common.entity.Entity;
|
||||
import common.entity.npc.EntityNPC;
|
||||
import common.util.BlockPos;
|
||||
|
|
|
@ -15,7 +15,7 @@ import client.renderer.texture.TextureAtlasSprite;
|
|||
import client.renderer.texture.TextureMap;
|
||||
import client.renderer.tileentity.TileEntityItemStackRenderer;
|
||||
import common.block.Block;
|
||||
import common.block.BlockLiquid;
|
||||
import common.block.liquid.BlockLiquid;
|
||||
import common.collect.Maps;
|
||||
import common.init.BlockRegistry;
|
||||
import common.init.FluidRegistry;
|
||||
|
|
|
@ -20,6 +20,7 @@ import common.entity.Entity;
|
|||
import common.entity.npc.EntityNPC;
|
||||
import common.entity.types.EntityAnimal;
|
||||
import common.entity.types.EntityLiving;
|
||||
import common.init.Blocks;
|
||||
import common.init.Items;
|
||||
import common.init.SoundEvent;
|
||||
import common.material.Material;
|
||||
|
@ -1168,7 +1169,7 @@ public class EntityRenderer {
|
|||
if(temp < 194.0f || this.random.chance(5))
|
||||
this.gm.world.spawnParticle(temp >= 194.0f && this.random.chance(10) ? ParticleType.LAVA : ParticleType.SMOKE_NORMAL, (double)blockpos1.getX() + d3, (double)((float)blockpos1.getY() + 0.1F) - block.getBlockBoundsMinY(), (double)blockpos1.getZ() + d4, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
else if (block.getMaterial() != Material.air)
|
||||
else if (block != Blocks.air)
|
||||
{
|
||||
block.setBlockBoundsBasedOnState(world, blockpos2);
|
||||
++j;
|
||||
|
|
|
@ -192,7 +192,7 @@ public class RegionRenderCache implements IWorldAccess
|
|||
// */
|
||||
// public boolean isAirBlock(BlockPos pos)
|
||||
// {
|
||||
// return this.getBlockState(pos).getBlock().getMaterial() == Material.air;
|
||||
// return this.getBlockState(pos).getBlock() == Blocks.air;
|
||||
// }
|
||||
|
||||
public int getLightFor(LightType p_175628_1_, BlockPos pos)
|
||||
|
|
|
@ -28,9 +28,9 @@ import client.renderer.tileentity.TileEntityRendererDispatcher;
|
|||
import client.world.ChunkClient;
|
||||
import client.world.WorldClient;
|
||||
import common.block.Block;
|
||||
import common.block.BlockChest;
|
||||
import common.block.BlockSign;
|
||||
import common.block.BlockSkull;
|
||||
import common.block.tech.BlockChest;
|
||||
import common.block.tile.BlockSign;
|
||||
import common.block.tile.BlockSkull;
|
||||
import common.collect.Lists;
|
||||
import common.collect.Maps;
|
||||
import common.collect.Sets;
|
||||
|
@ -38,7 +38,7 @@ import common.entity.Entity;
|
|||
import common.entity.npc.EntityNPC;
|
||||
import common.entity.projectile.EntityBox;
|
||||
import common.entity.types.EntityLiving;
|
||||
import common.material.Material;
|
||||
import common.init.Blocks;
|
||||
import common.model.BlockLayer;
|
||||
import common.rng.Random;
|
||||
import common.sound.Sound;
|
||||
|
@ -1580,7 +1580,7 @@ public class RenderGlobal
|
|||
{
|
||||
State iblockstate = this.theWorld.getState(blockpos);
|
||||
|
||||
if (iblockstate.getBlock().getMaterial() != Material.air)
|
||||
if (iblockstate.getBlock() != Blocks.air)
|
||||
{
|
||||
int i = destroyblockprogress.getPartialBlockDamage();
|
||||
TextureAtlasSprite textureatlassprite = this.destroyBlockIcons[i];
|
||||
|
@ -1616,7 +1616,7 @@ public class RenderGlobal
|
|||
BlockPos blockpos = movingObjectPositionIn.block;
|
||||
Block block = this.theWorld.getState(blockpos).getBlock();
|
||||
|
||||
if (block.getMaterial() != Material.air) // && this.theWorld.getWorldBorder().contains(blockpos))
|
||||
if (block != Blocks.air) // && this.theWorld.getWorldBorder().contains(blockpos))
|
||||
{
|
||||
block.setBlockBoundsBasedOnState(this.theWorld, blockpos);
|
||||
double d0 = player.lastTickPosX + (player.posX - player.lastTickPosX) * (double)partialTicks;
|
||||
|
|
|
@ -8,7 +8,7 @@ import java.util.Set;
|
|||
import client.renderer.texture.TextureAtlasSprite;
|
||||
import client.renderer.texture.TextureMap;
|
||||
import common.block.Block;
|
||||
import common.block.BlockLiquid;
|
||||
import common.block.liquid.BlockLiquid;
|
||||
import common.collect.Maps;
|
||||
import common.init.BlockRegistry;
|
||||
import common.init.Blocks;
|
||||
|
|
|
@ -6,7 +6,7 @@ import client.Client;
|
|||
import client.renderer.BlockRenderer;
|
||||
import client.renderer.GlState;
|
||||
import client.renderer.texture.TextureMap;
|
||||
import common.block.BlockTNT;
|
||||
import common.block.tech.BlockTNT;
|
||||
import common.entity.item.EntityTnt;
|
||||
import common.init.Blocks;
|
||||
import common.util.ExtMath;
|
||||
|
|
|
@ -16,7 +16,7 @@ import common.block.Block;
|
|||
import common.collect.Lists;
|
||||
import common.collect.Maps;
|
||||
import common.entity.Entity;
|
||||
import common.material.Material;
|
||||
import common.init.Blocks;
|
||||
import common.model.ParticleType;
|
||||
import common.rng.Random;
|
||||
import common.util.BlockPos;
|
||||
|
@ -319,7 +319,7 @@ public class EffectRenderer
|
|||
|
||||
public void addBlockDestroyEffects(BlockPos pos, State state)
|
||||
{
|
||||
if (state.getBlock().getMaterial() != Material.air)
|
||||
if (state.getBlock() != Blocks.air)
|
||||
{
|
||||
state = state.getBlock().getActualState(state, this.worldObj, pos);
|
||||
int i = 4;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package client.renderer.particle;
|
||||
|
||||
import common.block.Block;
|
||||
import common.block.BlockLiquid;
|
||||
import common.block.liquid.BlockLiquid;
|
||||
import common.material.Material;
|
||||
import common.util.BlockPos;
|
||||
import common.util.ExtMath;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package client.renderer.particle;
|
||||
|
||||
import common.block.BlockLiquid;
|
||||
import common.block.liquid.BlockLiquid;
|
||||
import common.material.Material;
|
||||
import common.model.ParticleType;
|
||||
import common.util.BlockPos;
|
||||
|
|
|
@ -6,7 +6,7 @@ import client.renderer.GlState;
|
|||
import client.renderer.model.ModelChest;
|
||||
import client.renderer.model.ModelLargeChest;
|
||||
import common.block.Block;
|
||||
import common.block.BlockChest;
|
||||
import common.block.tech.BlockChest;
|
||||
import common.tileentity.TileEntityChest;
|
||||
|
||||
|
||||
|
|
|
@ -11,10 +11,9 @@ import client.renderer.RenderBuffer;
|
|||
import client.renderer.Tessellator;
|
||||
import client.renderer.texture.TextureMap;
|
||||
import common.block.Block;
|
||||
import common.block.BlockPistonBase;
|
||||
import common.block.BlockPistonHead;
|
||||
import common.block.tech.BlockPistonBase;
|
||||
import common.block.tech.BlockPistonHead;
|
||||
import common.init.Blocks;
|
||||
import common.material.Material;
|
||||
import common.tileentity.TileEntityPiston;
|
||||
import common.util.BlockPos;
|
||||
import common.world.State;
|
||||
|
@ -30,7 +29,7 @@ public class TileEntityPistonRenderer extends TileEntitySpecialRenderer<TileEnti
|
|||
State iblockstate = te.getPistonState();
|
||||
Block block = iblockstate.getBlock();
|
||||
|
||||
if (block.getMaterial() != Material.air && te.getProgress(partialTicks) < 1.0F)
|
||||
if (block != Blocks.air && te.getProgress(partialTicks) < 1.0F)
|
||||
{
|
||||
// Tessellator tessellator = Tessellator.getInstance();
|
||||
RenderBuffer worldrenderer = Tessellator.getBuffer();
|
||||
|
|
|
@ -7,11 +7,11 @@ import common.block.Block;
|
|||
import common.entity.Entity;
|
||||
import common.entity.npc.EntityNPC;
|
||||
import common.init.BlockRegistry;
|
||||
import common.init.Blocks;
|
||||
import common.init.EntityRegistry;
|
||||
import common.item.ItemBlock;
|
||||
import common.item.ItemControl;
|
||||
import common.item.ItemStack;
|
||||
import common.material.Material;
|
||||
import common.packet.CPacketAction;
|
||||
import common.packet.CPacketBreak;
|
||||
import common.packet.CPacketClick;
|
||||
|
@ -118,7 +118,7 @@ public class PlayerController
|
|||
State iblockstate = world.getState(pos);
|
||||
Block block1 = iblockstate.getBlock();
|
||||
|
||||
if (block1.getMaterial() == Material.air)
|
||||
if (block1 == Blocks.air)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -211,7 +211,7 @@ public class PlayerController
|
|||
|
||||
this.netClientHandler.addToSendQueue(new CPacketBreak(CPacketBreak.Action.START_DESTROY_BLOCK, loc, face));
|
||||
Block block1 = this.gm.world.getState(loc).getBlock();
|
||||
boolean flag = block1.getMaterial() != Material.air;
|
||||
boolean flag = block1 != Blocks.air;
|
||||
|
||||
if (flag && this.curBlockDamageMP == 0.0F)
|
||||
{
|
||||
|
@ -280,7 +280,7 @@ public class PlayerController
|
|||
{
|
||||
Block block = this.gm.world.getState(posBlock).getBlock();
|
||||
|
||||
if (block.getMaterial() == Material.air)
|
||||
if (block == Blocks.air)
|
||||
{
|
||||
this.isHittingBlock = false;
|
||||
return false;
|
||||
|
|
|
@ -15,12 +15,12 @@ import common.entity.Entity;
|
|||
import common.entity.item.EntityCart;
|
||||
import common.entity.npc.EntityNPC;
|
||||
import common.init.BlockRegistry;
|
||||
import common.init.Blocks;
|
||||
import common.init.ItemRegistry;
|
||||
import common.init.Items;
|
||||
import common.init.SoundEvent;
|
||||
import common.item.ItemDye;
|
||||
import common.log.Log;
|
||||
import common.material.Material;
|
||||
import common.model.ParticleType;
|
||||
import common.nbt.NBTTagCompound;
|
||||
import common.rng.Random;
|
||||
|
@ -637,7 +637,7 @@ public class WorldClient extends AWorldClient
|
|||
case 2001:
|
||||
Block block = BlockRegistry.getBlockById(data & 4095);
|
||||
|
||||
if (block.getMaterial() != Material.air)
|
||||
if (block != Blocks.air)
|
||||
{
|
||||
this.gm.getSoundManager().playSound(new PositionedSound(block.sound.getBreakSound(), 1.0F, /* block.sound.getFrequency() * 0.8F, */ (float)blockPosIn.getX() + 0.5F, (float)blockPosIn.getY() + 0.5F, (float)blockPosIn.getZ() + 0.5F));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue