change block destruction logic
This commit is contained in:
parent
2504f24b7b
commit
2d476cbf8a
39 changed files with 175 additions and 746 deletions
|
@ -1078,7 +1078,8 @@ public class Client implements IThreadListener {
|
|||
this.secondary();
|
||||
}
|
||||
|
||||
this.sendClickBlockToController(this.open == null && Bind.PRIMARY.isDown() && this.viewEntity == this.player);
|
||||
if(this.open != null || !Bind.PRIMARY.isDown() || this.viewEntity != this.player)
|
||||
this.leftClickCounter = 0;
|
||||
}
|
||||
|
||||
this.primary = this.secondary = this.tertiary = this.quarternary = false;
|
||||
|
@ -1335,11 +1336,11 @@ public class Client implements IThreadListener {
|
|||
if(this.pointedLiquid != null ? block.getMaterial().isLiquid() : block != Blocks.air) {
|
||||
desc = block.getDisplay();
|
||||
line1 = block.getInfo(this.world, pos, state, this.player);
|
||||
boolean toolReq = block.getMaterial().isToolRequired();
|
||||
boolean toolReq = !this.player.hasEffect(Effect.PUNCHING);
|
||||
boolean harvestable = this.player.canHarvestBlock(block);
|
||||
line2 = Color.BLUE + "Werkzeug" + Color.DARK_GRAY + ": " + (block.getMiningTool() != null ? (toolReq ? (harvestable ? Color.GREEN : Color.RED) : Color.LIGHT_GRAY) + block.getMiningTool().getDisplay() + (block.getMiningTool().isLevelled() ? (toolReq ? (harvestable ? Color.ORK : Color.CRIMSON) : Color.DARK_GRAY) + " Level " + (toolReq ? (harvestable ? Color.DARK_GREEN : Color.DARK_RED) : Color.GRAY) + (block.getMiningLevel() + 1) : "") : Color.GRAY + "Keins");
|
||||
if(this.controller.isHittingBlock()) {
|
||||
bar = 1.0f - this.controller.getDamage(pos);
|
||||
if(block.getMiningTool() != null && block.getMiningTool().isLevelled()) {
|
||||
bar = (float)(block.getMiningLevel() + 1) / 20.0f;
|
||||
color = (int)(bar * 255.0f) << 8 | (int)((1.0f - bar) * 255.0f) << 16;
|
||||
}
|
||||
}
|
||||
|
@ -1646,33 +1647,6 @@ public class Client implements IThreadListener {
|
|||
}
|
||||
}
|
||||
|
||||
private void sendClickBlockToController(boolean leftClick)
|
||||
{
|
||||
if (!leftClick)
|
||||
{
|
||||
this.leftClickCounter = 0;
|
||||
this.controller.resetInteraction();
|
||||
}
|
||||
|
||||
if (this.leftClickCounter <= 0 && !this.player.isUsingItem())
|
||||
{
|
||||
if (leftClick && this.pointed != null && this.pointed.type == HitPosition.ObjectType.BLOCK)
|
||||
{
|
||||
LocalPos blockpos = this.pointed.block;
|
||||
|
||||
if (this.world.getState(blockpos).getBlock() != Blocks.air && this.controller.damageBlock(blockpos, this.pointed.side))
|
||||
{
|
||||
this.effectRenderer.damageBlock(blockpos, this.pointed.side);
|
||||
this.player.swingItem();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.controller.resetProgress();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void primary()
|
||||
{
|
||||
if (this.leftClickCounter <= 0)
|
||||
|
@ -1722,8 +1696,6 @@ public class Client implements IThreadListener {
|
|||
}
|
||||
|
||||
private void secondary()
|
||||
{
|
||||
if (!this.controller.isHittingBlock())
|
||||
{
|
||||
this.rightClickTimer = 4;
|
||||
boolean flag = true;
|
||||
|
@ -1799,7 +1771,6 @@ public class Client implements IThreadListener {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void tertiary()
|
||||
{
|
||||
|
|
|
@ -708,15 +708,10 @@ public class EffectRenderer {
|
|||
this.offsetY = rng.floatv() * 3.0F;
|
||||
}
|
||||
|
||||
protected Icon(double x, double y, double z, State state, boolean hit) {
|
||||
this(x, y, z, hit ? 0.6f : 1.0f, Client.CLIENT.renderer.getModelManager().getTexture(state));
|
||||
protected Icon(double x, double y, double z, State state) {
|
||||
this(x, y, z, 1.0f, Client.CLIENT.renderer.getModelManager().getTexture(state));
|
||||
this.gravity = 1.0F;
|
||||
this.red = this.green = this.blue = 0.6F;
|
||||
if(hit) {
|
||||
this.motionX *= 0.2;
|
||||
this.motionY = (this.motionY - 0.1) * 0.2 + 0.1;
|
||||
this.motionZ *= 0.2;
|
||||
}
|
||||
}
|
||||
|
||||
protected Icon(double x, double y, double z, Item item) {
|
||||
|
@ -964,7 +959,7 @@ public class EffectRenderer {
|
|||
});
|
||||
this.register(ParticleType.BLOCK_CRACK, (x, y, z, id) -> {
|
||||
State state = BlockRegistry.byId(id);
|
||||
return state == null ? null : new Icon(x, y, z, state, false);
|
||||
return state == null ? null : new Icon(x, y, z, state);
|
||||
});
|
||||
this.register(ParticleType.EXPLOSION_HUGE, (x, y, z, u) -> new ExplosionSpawner(x, y, z));
|
||||
this.register(ParticleType.EXPLOSION_LARGE,
|
||||
|
@ -1089,57 +1084,13 @@ public class EffectRenderer {
|
|||
double d0 = (double)pos.getX() + ((double)j + 0.5D) / (double)i;
|
||||
double d1 = (double)pos.getY() + ((double)k + 0.5D) / (double)i;
|
||||
double d2 = (double)pos.getZ() + ((double)l + 0.5D) / (double)i;
|
||||
this.add(new Icon(d0, d1, d2, state, false));
|
||||
this.add(new Icon(d0, d1, d2, state));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void damageBlock(LocalPos pos, Facing side) {
|
||||
State iblockstate = this.world.getState(pos);
|
||||
Block block = iblockstate.getBlock();
|
||||
|
||||
if(block != Blocks.air) {
|
||||
int i = pos.getX();
|
||||
int j = pos.getY();
|
||||
int k = pos.getZ();
|
||||
float f = 0.1F;
|
||||
double d0 = (double)i + this.rng.doublev() * (block.getBlockBoundsMaxX() - block.getBlockBoundsMinX() - (double)(f * 2.0F)) + (double)f
|
||||
+ block.getBlockBoundsMinX();
|
||||
double d1 = (double)j + this.rng.doublev() * (block.getBlockBoundsMaxY() - block.getBlockBoundsMinY() - (double)(f * 2.0F)) + (double)f
|
||||
+ block.getBlockBoundsMinY();
|
||||
double d2 = (double)k + this.rng.doublev() * (block.getBlockBoundsMaxZ() - block.getBlockBoundsMinZ() - (double)(f * 2.0F)) + (double)f
|
||||
+ block.getBlockBoundsMinZ();
|
||||
|
||||
if(side == Facing.DOWN) {
|
||||
d1 = (double)j + block.getBlockBoundsMinY() - (double)f;
|
||||
}
|
||||
|
||||
if(side == Facing.UP) {
|
||||
d1 = (double)j + block.getBlockBoundsMaxY() + (double)f;
|
||||
}
|
||||
|
||||
if(side == Facing.NORTH) {
|
||||
d2 = (double)k + block.getBlockBoundsMinZ() - (double)f;
|
||||
}
|
||||
|
||||
if(side == Facing.SOUTH) {
|
||||
d2 = (double)k + block.getBlockBoundsMaxZ() + (double)f;
|
||||
}
|
||||
|
||||
if(side == Facing.WEST) {
|
||||
d0 = (double)i + block.getBlockBoundsMinX() - (double)f;
|
||||
}
|
||||
|
||||
if(side == Facing.EAST) {
|
||||
d0 = (double)i + block.getBlockBoundsMaxX() + (double)f;
|
||||
}
|
||||
|
||||
this.add(new Icon(d0, d1, d2, iblockstate, true));
|
||||
}
|
||||
}
|
||||
|
||||
public void spawnCritParticles(Entity entity) {
|
||||
this.add(new HitSpawner(entity));
|
||||
}
|
||||
|
|
|
@ -262,25 +262,6 @@ public class ItemRenderer
|
|||
GL15.glTranslatef(f, f1, f2);
|
||||
}
|
||||
|
||||
private void performDrinking(EntityNPC clientPlayer, float partialTicks)
|
||||
{
|
||||
float f = (float)clientPlayer.getItemInUseCount() - partialTicks + 1.0F;
|
||||
float f1 = f / (float)this.itemToRender.getMaxItemUseDuration();
|
||||
float f2 = ExtMath.absf(ExtMath.cos(f / 4.0F * (float)Math.PI) * 0.1F);
|
||||
|
||||
if (f1 >= 0.8F)
|
||||
{
|
||||
f2 = 0.0F;
|
||||
}
|
||||
|
||||
GL15.glTranslatef(0.0F, f2, 0.0F);
|
||||
float f3 = 1.0F - (float)Math.pow((double)f1, 27.0D);
|
||||
GL15.glTranslatef(f3 * 0.6F, f3 * -0.5F, f3 * 0.0F);
|
||||
GL15.glRotatef(f3 * 90.0F, 0.0F, 1.0F, 0.0F);
|
||||
GL15.glRotatef(f3 * 10.0F, 1.0F, 0.0F, 0.0F);
|
||||
GL15.glRotatef(f3 * 30.0F, 0.0F, 0.0F, 1.0F);
|
||||
}
|
||||
|
||||
private void transformFirstPersonItem(float equipProgress, float swingProgress)
|
||||
{
|
||||
GL15.glTranslatef(0.56F, -0.52F, -0.71999997F);
|
||||
|
@ -354,12 +335,6 @@ public class ItemRenderer
|
|||
this.transformFirstPersonItem(f, 0.0F);
|
||||
break;
|
||||
|
||||
case EAT:
|
||||
case DRINK:
|
||||
this.performDrinking(clientplayer, partialTicks);
|
||||
this.transformFirstPersonItem(f, 0.0F);
|
||||
break;
|
||||
|
||||
case BLOCK:
|
||||
this.transformFirstPersonItem(f, 0.0F);
|
||||
this.doBlockTransformations();
|
||||
|
|
|
@ -24,13 +24,7 @@ public class PlayerController {
|
|||
private final Client gm;
|
||||
private final ClientPlayer handler;
|
||||
|
||||
private LocalPos position = new LocalPos(-1, -World.MAX_SIZE_Y - 1, -1);
|
||||
private ItemStack stack;
|
||||
private float damage;
|
||||
private int delay;
|
||||
private boolean hitting;
|
||||
private int lastSelected;
|
||||
private boolean interacting;
|
||||
private int itemUseCooldown;
|
||||
private int itemUseCooldownMax;
|
||||
|
||||
|
@ -55,8 +49,6 @@ public class PlayerController {
|
|||
block.onBroken(world, pos, state);
|
||||
}
|
||||
|
||||
this.position = new LocalPos(this.position.getX(), -1, this.position.getZ());
|
||||
|
||||
ItemStack stack = this.gm.player.getHeldItem();
|
||||
|
||||
if(stack != null) {
|
||||
|
@ -78,86 +70,21 @@ public class PlayerController {
|
|||
else {
|
||||
ItemStack stack = this.gm.player.getHeldItem();
|
||||
if(stack != null && stack.getItem().onAction(stack, this.gm.player, this.gm.world, ItemControl.PRIMARY, pos)) {
|
||||
this.interacting = true;
|
||||
this.handler.addToSendQueue(new CPacketBreak(CPacketBreak.Action.START_DESTROY_BLOCK, pos, face));
|
||||
if(this.gm.player.getHeldItem() != null && this.gm.player.getHeldItem().isEmpty())
|
||||
this.gm.player.clearHeldItem();
|
||||
return true;
|
||||
}
|
||||
if(!this.hitting || !this.isHitting(pos)) {
|
||||
if(this.hitting) {
|
||||
this.handler.addToSendQueue(new CPacketBreak(CPacketBreak.Action.ABORT_DESTROY_BLOCK, this.position, face));
|
||||
}
|
||||
|
||||
this.handler.addToSendQueue(new CPacketBreak(CPacketBreak.Action.START_DESTROY_BLOCK, pos, face));
|
||||
Block block = this.gm.world.getState(pos).getBlock();
|
||||
boolean flag = block != Blocks.air;
|
||||
|
||||
if(flag && this.damage == 0.0F) {
|
||||
if(block != Blocks.air) {
|
||||
block.onStartBreak(this.gm.world, pos, this.gm.player);
|
||||
}
|
||||
|
||||
if(flag && block.getHardness(this.gm.player, this.gm.player.worldObj, pos) >= 1.0F) {
|
||||
if(this.gm.player.canHarvestBlock(block))
|
||||
this.destroyBlock(pos, face);
|
||||
this.delay = 3;
|
||||
}
|
||||
else {
|
||||
this.hitting = true;
|
||||
this.position = pos;
|
||||
this.stack = this.gm.player.getHeldItem();
|
||||
this.damage = 0.0F;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public void resetProgress() {
|
||||
if(this.hitting) {
|
||||
this.handler.addToSendQueue(new CPacketBreak(CPacketBreak.Action.ABORT_DESTROY_BLOCK, this.position, Facing.DOWN));
|
||||
this.hitting = false;
|
||||
this.damage = 0.0F;
|
||||
}
|
||||
}
|
||||
|
||||
public void resetInteraction() {
|
||||
this.interacting = false;
|
||||
}
|
||||
|
||||
public boolean damageBlock(LocalPos pos, Facing face) {
|
||||
if(this.interacting)
|
||||
return false;
|
||||
this.syncItem();
|
||||
|
||||
if(this.delay > 0) {
|
||||
--this.delay;
|
||||
return true;
|
||||
}
|
||||
else if(this.isHitting(pos)) {
|
||||
Block block = this.gm.world.getState(pos).getBlock();
|
||||
|
||||
if(block == Blocks.air) {
|
||||
this.hitting = false;
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
this.damage += block.getHardness(this.gm.player, this.gm.player.worldObj, pos);
|
||||
|
||||
if(this.damage >= 1.0F) {
|
||||
this.hitting = false;
|
||||
this.handler.addToSendQueue(new CPacketBreak(CPacketBreak.Action.STOP_DESTROY_BLOCK, pos, face));
|
||||
this.destroyBlock(pos, face);
|
||||
this.damage = 0.0F;
|
||||
this.delay = 5;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else {
|
||||
return this.clickBlock(pos, face);
|
||||
}
|
||||
}
|
||||
|
||||
public void update() {
|
||||
this.syncItem();
|
||||
|
@ -172,18 +99,6 @@ public class PlayerController {
|
|||
}
|
||||
}
|
||||
|
||||
private boolean isHitting(LocalPos pos) {
|
||||
ItemStack stack = this.gm.player.getHeldItem();
|
||||
boolean flag = this.stack == null && stack == null;
|
||||
|
||||
if(this.stack != null && stack != null) {
|
||||
flag = stack.getItem() == this.stack.getItem()
|
||||
&& ItemStack.dataEquals(stack, this.stack);
|
||||
}
|
||||
|
||||
return pos.equals(this.position) && flag;
|
||||
}
|
||||
|
||||
private void syncItem() {
|
||||
int slot = this.gm.player.getSelectedIndex();
|
||||
|
||||
|
@ -294,10 +209,6 @@ public class PlayerController {
|
|||
player.stopUsingItem();
|
||||
}
|
||||
|
||||
public boolean isHittingBlock() {
|
||||
return this.hitting;
|
||||
}
|
||||
|
||||
public int getUseCooldown() {
|
||||
return this.itemUseCooldown;
|
||||
}
|
||||
|
@ -309,8 +220,4 @@ public class PlayerController {
|
|||
public void resetUseCooldown() {
|
||||
this.itemUseCooldown = 0;
|
||||
}
|
||||
|
||||
public float getDamage(LocalPos pos) {
|
||||
return this.hitting && pos.equals(this.position) ? this.damage : 0.0f;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -113,6 +113,6 @@ public abstract class EntityAIDoorInteract extends EntityAIBase
|
|||
private BlockDoor getBlockDoor(LocalPos pos)
|
||||
{
|
||||
Block block = this.theEntity.worldObj.getState(pos).getBlock();
|
||||
return block instanceof BlockDoor && block.getMaterial() == Material.WOOD ? (BlockDoor)block : null;
|
||||
return block instanceof BlockDoor && block.getMaterial() == Material.BURNABLE ? (BlockDoor)block : null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -560,13 +560,6 @@ public class Block {
|
|||
return this.maxZ;
|
||||
}
|
||||
|
||||
public final float getHardness(EntityNPC player, World world, LocalPos pos) {
|
||||
float f = (float)this.hardness;
|
||||
return f < 0.0F ? 0.0F
|
||||
: (!player.canHarvestBlock(this) ? player.getToolDigEfficiency(this) / f / 100.0F
|
||||
: player.getToolDigEfficiency(this) / f / 30.0F);
|
||||
}
|
||||
|
||||
public final State getState() {
|
||||
return this.defaultState;
|
||||
}
|
||||
|
@ -1013,7 +1006,7 @@ public class Block {
|
|||
}
|
||||
|
||||
public int getFuelAmount() {
|
||||
return this.material == Material.WOOD ? 300 : 0;
|
||||
return this.material == Material.BURNABLE ? 300 : 0;
|
||||
}
|
||||
|
||||
public void getModifiers(Map<Attribute, Float> map) {
|
||||
|
@ -1084,7 +1077,9 @@ public class Block {
|
|||
if(this.light != 0)
|
||||
tooltip.add(Color.BLUE + "Licht" + Color.DARK_GRAY + ": " + Color.NEON + String.format("%06x", this.light));
|
||||
if(this.hardness != 0)
|
||||
tooltip.add(Color.BLUE + "Härte" + Color.DARK_GRAY + ": " + Color.NEON + this.hardness);
|
||||
tooltip.add(Color.LIGHT_GRAY + "Härte" + Color.GRAY + ": " + Color.BEIGE + this.hardness);
|
||||
if(this.miningTool != null && this.miningTool.isLevelled())
|
||||
tooltip.add(Color.VIOLET + "Level" + Color.DARK_VIOLET + ": " + Color.DARK_MAGENTA + (this.miningLevel + 1));
|
||||
}
|
||||
|
||||
@Clientside
|
||||
|
|
|
@ -9,31 +9,25 @@ public enum Material {
|
|||
LOOSE {{
|
||||
;
|
||||
}},
|
||||
WOOD {{
|
||||
this.setBurning().setTool(Equipment.AXE);
|
||||
BURNABLE {{ // is fuel
|
||||
this.setBurning();
|
||||
}},
|
||||
SOLID {{
|
||||
this.setRequiredTool(Equipment.PICKAXE);
|
||||
this.setTool(Equipment.PICKAXE);
|
||||
}},
|
||||
TRANSLUCENT {{
|
||||
this.setTranslucent();
|
||||
}},
|
||||
BURNABLE {{
|
||||
this.setBurning();
|
||||
}},
|
||||
SOFT {{ // can break faster with sword, can't connect to fences+walls
|
||||
SOFT {{ // can't connect to fences+walls
|
||||
this.setNoPushMobility();
|
||||
}},
|
||||
PISTON {{
|
||||
IMMOVABLE {{
|
||||
this.setImmovableMobility();
|
||||
}},
|
||||
HEAVY {{
|
||||
this.setRequiredTool(Equipment.PICKAXE).setImmovableMobility();
|
||||
}},
|
||||
PLANT {{ // can break faster with sword
|
||||
PLANT {{
|
||||
this.setNonSolid().setNoPushMobility();
|
||||
}},
|
||||
SMALL {{ // can be placed more easily
|
||||
SMALL {{ // can be replaced by anvil
|
||||
this.setNonSolid().setNoPushMobility();
|
||||
}},
|
||||
FLEECE {{
|
||||
|
@ -60,20 +54,20 @@ public enum Material {
|
|||
HOT {{
|
||||
this.setLiquid(true).setReplaceable().setNoPushMobility();
|
||||
}},
|
||||
LEAVES {{ // can break faster with sword, precipitation block, special treatment in some worldgen
|
||||
LEAVES {{ // precipitation block, special treatment in some worldgen
|
||||
this.setBurning().setTranslucent().setNoPushMobility();
|
||||
}},
|
||||
BUSH {{ // can break faster with sword, can be replaced by small tree leaves
|
||||
BUSH {{ // can be replaced by small tree leaves
|
||||
this.setNonSolid().setBurning().setNoPushMobility().setReplaceable();
|
||||
}},
|
||||
FIRE {{
|
||||
this.setNonSolid().setReplaceable().setNoPushMobility();
|
||||
}},
|
||||
POWDER {{ // can harvest with shovel, precipitation block
|
||||
POWDER {{ // precipitation block
|
||||
this.setNonSolid().setReplaceable().setNoPushMobility();
|
||||
}},
|
||||
FLUFF {{ // can harvest with shears
|
||||
this.setPassable().setRequiredTool(Equipment.SWORD).setNoPushMobility();
|
||||
FLUFF {{
|
||||
this.setPassable().setTool(Equipment.SWORD).setNoPushMobility();
|
||||
}};
|
||||
|
||||
private boolean solid = true;
|
||||
|
@ -85,7 +79,6 @@ public enum Material {
|
|||
private boolean hot;
|
||||
private boolean burnable;
|
||||
private boolean replaceable;
|
||||
private boolean requiresTool;
|
||||
// 0 - normal; 1 - can't push other blocks; 2 - can't be pushed
|
||||
private int mobility;
|
||||
private Equipment tool;
|
||||
|
@ -121,12 +114,6 @@ public enum Material {
|
|||
return this;
|
||||
}
|
||||
|
||||
protected Material setRequiredTool(Equipment tool) {
|
||||
this.requiresTool = true;
|
||||
this.tool = tool;
|
||||
return this;
|
||||
}
|
||||
|
||||
protected Material setTool(Equipment tool) {
|
||||
this.tool = tool;
|
||||
return this;
|
||||
|
@ -188,10 +175,6 @@ public enum Material {
|
|||
return this.opaque;
|
||||
}
|
||||
|
||||
public boolean isToolRequired() {
|
||||
return this.requiresTool;
|
||||
}
|
||||
|
||||
public int getMobility() {
|
||||
return this.mobility;
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ public class BlockBookshelf extends Block
|
|||
{
|
||||
public BlockBookshelf()
|
||||
{
|
||||
super(Material.WOOD);
|
||||
super(Material.BURNABLE);
|
||||
this.setTab(CheatTab.DECORATION);
|
||||
this.setFlammable(30, 20);
|
||||
}
|
||||
|
|
|
@ -70,7 +70,7 @@ public class BlockDoor extends Block implements Rotatable {
|
|||
super(material);
|
||||
this.setDefaultState(this.getBaseState().withProperty(FACING, Facing.NORTH).withProperty(OPEN, false)
|
||||
.withProperty(HINGE, EnumHingePosition.LEFT).withProperty(HALF, EnumDoorHalf.LOWER));
|
||||
this.setTab(material == Material.WOOD ? CheatTab.WOOD : CheatTab.TECHNOLOGY);
|
||||
this.setTab(material == Material.BURNABLE ? CheatTab.WOOD : CheatTab.TECHNOLOGY);
|
||||
DOORS.add(this);
|
||||
}
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ public class BlockFence extends Block
|
|||
{
|
||||
super(p_i46395_1_);
|
||||
this.setDefaultState(this.getBaseState().withProperty(NORTH, Boolean.valueOf(false)).withProperty(EAST, Boolean.valueOf(false)).withProperty(SOUTH, Boolean.valueOf(false)).withProperty(WEST, Boolean.valueOf(false)));
|
||||
this.setTab(p_i46395_1_ == Material.WOOD ? CheatTab.WOOD : CheatTab.BLOCKS);
|
||||
this.setTab(p_i46395_1_ == Material.BURNABLE ? CheatTab.WOOD : CheatTab.BLOCKS);
|
||||
this.texture = texture;
|
||||
FENCES.add(this);
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ public class BlockFenceGate extends Block implements Rotatable
|
|||
|
||||
public BlockFenceGate(WoodType type)
|
||||
{
|
||||
super(Material.WOOD);
|
||||
super(Material.BURNABLE);
|
||||
this.setDefaultState(this.getBaseState().withProperty(OPEN, Boolean.valueOf(false)).withProperty(IN_WALL, Boolean.valueOf(false)));
|
||||
this.setTab(CheatTab.WOOD);
|
||||
this.texture = type.getName() + "_planks";
|
||||
|
|
|
@ -202,6 +202,6 @@ public class BlockSlab extends Block implements Directional {
|
|||
}
|
||||
|
||||
public int getFuelAmount() {
|
||||
return this.material == Material.WOOD ? 150 : 0;
|
||||
return this.material == Material.BURNABLE ? 150 : 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ public class BlockTrapDoor extends Block implements Rotatable
|
|||
float f = 0.5F;
|
||||
float f1 = 1.0F;
|
||||
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
|
||||
this.setTab(materialIn == Material.WOOD ? CheatTab.WOOD : CheatTab.TECHNOLOGY);
|
||||
this.setTab(materialIn == Material.BURNABLE ? CheatTab.WOOD : CheatTab.TECHNOLOGY);
|
||||
}
|
||||
|
||||
public void setKeyItem(ItemKey key) {
|
||||
|
|
|
@ -48,7 +48,7 @@ public class BlockHugeMushroom extends Block {
|
|||
private final Block smallBlock;
|
||||
|
||||
public BlockHugeMushroom(Block smallBlock) {
|
||||
super(Material.WOOD);
|
||||
super(Material.BURNABLE);
|
||||
this.setDefaultState(this.getBaseState().withProperty(VARIANT, BlockHugeMushroom.EnumType.ALL_OUTSIDE));
|
||||
this.smallBlock = smallBlock;
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@ import common.model.Model.ModelProvider;
|
|||
import common.model.ModelRotation;
|
||||
import common.properties.Property;
|
||||
import common.util.LocalPos;
|
||||
import common.util.Equipment;
|
||||
import common.util.Facing;
|
||||
import common.world.State;
|
||||
import common.world.World;
|
||||
|
@ -18,11 +19,12 @@ public class BlockLog extends BlockRotatedPillar
|
|||
{
|
||||
public BlockLog()
|
||||
{
|
||||
super(Material.WOOD);
|
||||
super(Material.BURNABLE);
|
||||
this.setDefaultState(this.getBaseState().withProperty(AXIS, Facing.Axis.Y));
|
||||
this.setTab(CheatTab.WOOD);
|
||||
this.setHardness(2.0F);
|
||||
this.setFlammable(5, 5);
|
||||
this.setMiningTool(Equipment.AXE);
|
||||
}
|
||||
|
||||
public void onRemoved(AWorldServer worldIn, LocalPos pos, State state)
|
||||
|
|
|
@ -33,7 +33,7 @@ public class BlockAnvil extends BlockFalling implements Rotatable
|
|||
|
||||
public BlockAnvil(int damage)
|
||||
{
|
||||
super(Material.HEAVY);
|
||||
super(Material.IMMOVABLE);
|
||||
this.damage = damage;
|
||||
this.setDefaultState(this.getBaseState().withProperty(FACING, Facing.NORTH));
|
||||
this.setOpacity(0);
|
||||
|
|
|
@ -50,7 +50,7 @@ public class BlockChest extends Block implements ITileEntityProvider, Rotatable
|
|||
|
||||
public BlockChest(int capacity)
|
||||
{
|
||||
super(capacity <= 30 ? Material.WOOD : Material.SOLID);
|
||||
super(capacity <= 30 ? Material.BURNABLE : Material.SOLID);
|
||||
this.setDefaultState(this.getBaseState().withProperty(FACING, Facing.NORTH).withProperty(OPEN, false));
|
||||
this.capacity = capacity;
|
||||
this.setTab(CheatTab.TECHNOLOGY);
|
||||
|
|
|
@ -250,7 +250,7 @@ public class BlockPistonBase extends Block implements Directional
|
|||
|
||||
public BlockPistonBase(boolean isSticky)
|
||||
{
|
||||
super(Material.PISTON);
|
||||
super(Material.IMMOVABLE);
|
||||
this.setDefaultState(this.getBaseState().withProperty(FACING, Facing.NORTH).withProperty(EXTENDED, Boolean.valueOf(false)));
|
||||
this.isSticky = isSticky;
|
||||
this.setHardness(0.5F);
|
||||
|
|
|
@ -28,7 +28,7 @@ public class BlockPistonHead extends Block implements Directional
|
|||
|
||||
public BlockPistonHead(boolean sticky)
|
||||
{
|
||||
super(Material.PISTON);
|
||||
super(Material.IMMOVABLE);
|
||||
this.setDefaultState(this.getBaseState().withProperty(FACING, Facing.NORTH));
|
||||
this.setHardness(0.5F);
|
||||
this.sticky = sticky;
|
||||
|
|
|
@ -23,7 +23,7 @@ public class BlockSign extends Block implements ITileEntityProvider, Rotatable
|
|||
{
|
||||
public BlockSign()
|
||||
{
|
||||
super(Material.WOOD);
|
||||
super(Material.BURNABLE);
|
||||
float f = 0.25F;
|
||||
float f1 = 1.0F;
|
||||
this.setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, f1, 0.5F + f);
|
||||
|
|
|
@ -19,7 +19,7 @@ public class BlockWorkbench extends Block
|
|||
|
||||
public BlockWorkbench(int tier)
|
||||
{
|
||||
super(Material.WOOD);
|
||||
super(Material.BURNABLE);
|
||||
this.setTab(CheatTab.TECHNOLOGY);
|
||||
this.tier = tier;
|
||||
}
|
||||
|
|
|
@ -21,12 +21,7 @@ public enum Effect {
|
|||
return String.format(Color.RED + "-%d%% Geschwindigkeit", 15 * (amp + 1));
|
||||
}
|
||||
},
|
||||
HASTE("haste", "Eile", "Trank der Eile", false, 14270531) {
|
||||
public double getEffectiveness() {
|
||||
return 1.5;
|
||||
}
|
||||
},
|
||||
FATIGUE("mining_fatigue", "Abbaulähmung", "Trank der Trägheit", true, 4866583),
|
||||
PUNCHING("punching", "Schlagkraft", "Trank der Schlagkraft", false, 0xffff00),
|
||||
STRENGTH("strength", 2, 180, "Stärke", "Trank der Stärke", false, 9643043) {
|
||||
public String getTooltip(int amp) {
|
||||
return String.format(Color.BLUE + "+%d%% Angriffsschaden", 50 * (amp + 1));
|
||||
|
|
|
@ -299,22 +299,6 @@ public enum Enchantment implements Displayable, Identifyable
|
|||
return 3;
|
||||
}
|
||||
},
|
||||
EFFICIENCY("efficiency", 10, EnchantmentType.DIGGER, "Effizienz") {
|
||||
public int getMinEnchantability(int enchantmentLevel)
|
||||
{
|
||||
return 1 + 10 * (enchantmentLevel - 1);
|
||||
}
|
||||
|
||||
public int getMaxEnchantability(int enchantmentLevel)
|
||||
{
|
||||
return super.getMinEnchantability(enchantmentLevel) + 50;
|
||||
}
|
||||
|
||||
public int getMaxLevel()
|
||||
{
|
||||
return 5;
|
||||
}
|
||||
},
|
||||
SILK_TOUCH("silk_touch", 1, EnchantmentType.DIGGER, "Behutsamkeit") {
|
||||
public int getMinEnchantability(int enchantmentLevel)
|
||||
{
|
||||
|
|
|
@ -213,30 +213,6 @@ public class EnchantmentHelper
|
|||
return getEnchantmentLevel(Enchantment.FIRE_ASPECT, player instanceof EntityNPC npc ? npc.getHeldItem() : null);
|
||||
}
|
||||
|
||||
// /**
|
||||
// * Returns the 'Water Breathing' modifier of enchantments on player equipped armors.
|
||||
// */
|
||||
// public static int getRespiration(Entity player)
|
||||
// {
|
||||
// return getMaxEnchantmentLevel(Enchantment.respiration.effectId, player.getInventory());
|
||||
// }
|
||||
|
||||
// /**
|
||||
// * Returns the level of the Depth Strider enchantment.
|
||||
// */
|
||||
// public static int getDepthStriderModifier(Entity player)
|
||||
// {
|
||||
// return getMaxEnchantmentLevel(Enchantment.depthStrider.effectId, player.getInventory());
|
||||
// }
|
||||
|
||||
/**
|
||||
* Return the extra efficiency of tools based on enchantments on equipped player item.
|
||||
*/
|
||||
public static int getEfficiencyModifier(EntityLiving player)
|
||||
{
|
||||
return getEnchantmentLevel(Enchantment.EFFICIENCY, player instanceof EntityNPC npc ? npc.getHeldItem() : null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the silk touch status of enchantments on current equipped item of player.
|
||||
*/
|
||||
|
@ -277,14 +253,6 @@ public class EnchantmentHelper
|
|||
return getEnchantmentLevel(Enchantment.LOOTING, player instanceof EntityNPC npc ? npc.getHeldItem() : null);
|
||||
}
|
||||
|
||||
// /**
|
||||
// * Returns the aqua affinity status of enchantments on current equipped item of player.
|
||||
// */
|
||||
// public static boolean getAquaAffinityModifier(EntityLivingBase player)
|
||||
// {
|
||||
// return getMaxEnchantmentLevel(Enchantment.aquaAffinity.effectId, player.getInventory()) > 0;
|
||||
// }
|
||||
|
||||
public static ItemStack getEnchantedArmor(Enchantment ench, EntityLiving entity)
|
||||
{
|
||||
if(entity instanceof EntityNPC npc) {
|
||||
|
|
|
@ -1640,11 +1640,6 @@ public abstract class EntityNPC extends EntityLiving implements IInventory
|
|||
|
||||
if (itemstack == this.itemInUse)
|
||||
{
|
||||
if (this.itemInUseCount <= 25 && this.itemInUseCount % 4 == 0)
|
||||
{
|
||||
this.updateItemUse(itemstack, 5);
|
||||
}
|
||||
|
||||
if (--this.itemInUseCount == 0 && !this.worldObj.client)
|
||||
{
|
||||
this.onItemUseFinish();
|
||||
|
@ -2883,7 +2878,6 @@ public abstract class EntityNPC extends EntityLiving implements IInventory
|
|||
// super.onItemUseFinish();
|
||||
if (this.itemInUse != null)
|
||||
{
|
||||
this.updateItemUse(this.itemInUse, 16);
|
||||
int i = this.itemInUse.getSize();
|
||||
ItemStack itemstack = this.itemInUse.getItem().onItemUseFinish(this.itemInUse, this.worldObj, this);
|
||||
|
||||
|
@ -3034,22 +3028,6 @@ public abstract class EntityNPC extends EntityLiving implements IInventory
|
|||
return this.isUsingItem() && this.itemInUse.getItem().getItemUseAction() == ItemAction.BLOCK;
|
||||
}
|
||||
|
||||
/**
|
||||
* Plays sounds and makes particles for item in use state
|
||||
*/
|
||||
protected void updateItemUse(ItemStack itemStackIn, int p_71010_2_)
|
||||
{
|
||||
if (itemStackIn.getItemUseAction() == ItemAction.DRINK)
|
||||
{
|
||||
this.playSound(SoundEvent.DRINK, 0.5F);
|
||||
}
|
||||
|
||||
if (itemStackIn.getItemUseAction() == ItemAction.EAT)
|
||||
{
|
||||
this.playSound(SoundEvent.EAT, 0.5F + 0.5F * (float)this.rand.zrange(2));
|
||||
}
|
||||
}
|
||||
|
||||
@Clientside
|
||||
public void handleStatusUpdate(byte id)
|
||||
{
|
||||
|
@ -3228,64 +3206,9 @@ public abstract class EntityNPC extends EntityLiving implements IInventory
|
|||
return entityitem;
|
||||
}
|
||||
|
||||
/**
|
||||
* Block hardness will be further counted in game/block/Block.getPlayerRelativeBlockHardness
|
||||
*/
|
||||
public float getToolDigEfficiency(Block block)
|
||||
{
|
||||
float f = this.getHeldItem() != null && this.getHeldItem().getItem() instanceof ItemTool tool && block.getMiningTool() == tool.getToolType() ? tool.getToolEfficiency() : 1.0f;
|
||||
|
||||
if (f > 1.0F)
|
||||
{
|
||||
int i = EnchantmentHelper.getEfficiencyModifier(this);
|
||||
ItemStack itemstack = this.getHeldItem();
|
||||
|
||||
if (i > 0 && itemstack != null)
|
||||
{
|
||||
f += (float)(i * i + 1);
|
||||
}
|
||||
}
|
||||
|
||||
if (this.hasEffect(Effect.HASTE))
|
||||
{
|
||||
int speed = this.getEffect(Effect.HASTE).getAmplifier();
|
||||
if(speed >= 255)
|
||||
return 1000000.0f;
|
||||
f *= 1.0F + (float)(speed + 1) * 0.2F;
|
||||
}
|
||||
|
||||
if (this.hasEffect(Effect.FATIGUE))
|
||||
{
|
||||
float f1 = 1.0F;
|
||||
|
||||
switch (this.getEffect(Effect.FATIGUE).getAmplifier())
|
||||
{
|
||||
case 0:
|
||||
f1 = 0.3F;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
f1 = 0.09F;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
f1 = 0.0027F;
|
||||
break;
|
||||
|
||||
case 3:
|
||||
default:
|
||||
f1 = 8.1E-4F;
|
||||
}
|
||||
|
||||
f *= f1;
|
||||
}
|
||||
|
||||
return f;
|
||||
}
|
||||
|
||||
public boolean canHarvestBlock(Block block)
|
||||
{
|
||||
if(!block.getMaterial().isToolRequired())
|
||||
if(block.getMiningTool() == null || this.hasEffect(Effect.PUNCHING))
|
||||
return true;
|
||||
return this.getHeldItem() != null && this.getHeldItem().getItem() instanceof ItemTool tool && block.getMiningTool() == tool.getToolType() && (!tool.getToolType().isLevelled() || tool.getToolLevel() >= block.getMiningLevel());
|
||||
}
|
||||
|
@ -4481,7 +4404,7 @@ public abstract class EntityNPC extends EntityLiving implements IInventory
|
|||
public void setGodMode(boolean god) {
|
||||
this.fallDistance = 0.0F;
|
||||
if(!god) {
|
||||
this.removeEffect(Effect.HASTE);
|
||||
this.removeEffect(Effect.PUNCHING);
|
||||
this.removeEffect(Effect.RESISTANCE);
|
||||
this.removeEffect(Effect.FIRE_RESISTANCE);
|
||||
this.removeEffect(Effect.FLYING);
|
||||
|
@ -4492,7 +4415,7 @@ public abstract class EntityNPC extends EntityLiving implements IInventory
|
|||
this.setHealth(this.getMaxHealth());
|
||||
this.setManaPoints(this.getMaxMana());
|
||||
this.clearEffects(false);
|
||||
this.addEffect(new StatusEffect(Effect.HASTE, Integer.MAX_VALUE, 255));
|
||||
this.addEffect(new StatusEffect(Effect.PUNCHING, Integer.MAX_VALUE, 255));
|
||||
this.addEffect(new StatusEffect(Effect.RESISTANCE, Integer.MAX_VALUE, 255));
|
||||
this.addEffect(new StatusEffect(Effect.FIRE_RESISTANCE, Integer.MAX_VALUE, 0));
|
||||
this.addEffect(new StatusEffect(Effect.FLYING, Integer.MAX_VALUE, 1));
|
||||
|
|
|
@ -290,17 +290,17 @@ public abstract class BlockRegistry {
|
|||
register(wood.getName() + "_sapling", (new BlockSapling(wood)).setHardness(0.0F)
|
||||
.setDisplay(wood.getDisplay() + "setzling"));
|
||||
register(wood.getName() + "_trunk", (new BlockSlab(log, wood.getName() + "_log_top", wood.getName() + "_log_top")).setDisplay(wood.getDisplay() + "holzscheibe"));
|
||||
Block planks = (new Block(Material.WOOD)).setHardness(2.0F)
|
||||
Block planks = (new Block(Material.BURNABLE)).setHardness(2.0F)
|
||||
.setDisplay(wood.getDisplay() + "holzbretter").setTab(CheatTab.WOOD).setFlammable(5, 20);
|
||||
register(wood.getName() + "_planks", planks);
|
||||
register(wood.getName() + "_stairs", (new BlockStairs(planks))
|
||||
.setDisplay(wood.getDisplay() + "holztreppe").setFlammable(5, 20));
|
||||
register(wood.getName() + "_slab", (new BlockSlab(planks)).setDisplay(wood.getDisplay() + "holzstufe").setFlammable(5, 20));
|
||||
register(wood.getName() + "_fence", (new BlockFence(Material.WOOD, wood.getName() + "_planks"))
|
||||
register(wood.getName() + "_fence", (new BlockFence(Material.BURNABLE, wood.getName() + "_planks"))
|
||||
.setHardness(2.0F).setDisplay(wood.getDisplay() + "holzzaun").setFlammable(5, 20));
|
||||
register(wood.getName() + "_fence_gate", (new BlockFenceGate(wood)).setHardness(2.0F)
|
||||
.setDisplay(wood.getDisplay() + "holzzauntor").setFlammable(5, 20));
|
||||
register(wood.getName() + "_door", (new BlockDoor(Material.WOOD)).setHardness(3.0F)
|
||||
register(wood.getName() + "_door", (new BlockDoor(Material.BURNABLE)).setHardness(3.0F)
|
||||
.setDisplay(wood.getDisplay() + "holztür").setFlammable(5, 20));
|
||||
}
|
||||
|
||||
|
@ -333,7 +333,7 @@ public abstract class BlockRegistry {
|
|||
register(color.getName() + "_bed", (new BlockBed(color)).setHardness(0.2F).setDisplay(color.getSubject(0) + " Bett"));
|
||||
}
|
||||
|
||||
register("ladder", (new BlockLadder()).setHardness(0.4F).setDisplay("Leiter").setMiningTool(Equipment.AXE));
|
||||
register("ladder", (new BlockLadder()).setHardness(0.4F).setDisplay("Leiter"));
|
||||
register("bookshelf", (new BlockBookshelf()).setHardness(1.5F).setDisplay("Bücherregal"));
|
||||
register("cake", (new BlockCake()).setHardness(0.5F).setDisplay("Kuchen").setTab(CheatTab.DECORATION));
|
||||
register("dragon_egg", (new BlockDragonEgg()).setHardness(3.0F)
|
||||
|
@ -538,7 +538,7 @@ public abstract class BlockRegistry {
|
|||
}
|
||||
|
||||
register("iron_door", (new BlockDoor(Material.SOLID)).setHardness(5.0F).setDisplay("Eisentür"));
|
||||
register("trapdoor", (new BlockTrapDoor(Material.WOOD)).setHardness(3.0F).setDisplay("Holzfalltür").setFlammable(5, 20));
|
||||
register("trapdoor", (new BlockTrapDoor(Material.BURNABLE)).setHardness(3.0F).setDisplay("Holzfalltür").setFlammable(5, 20));
|
||||
register("iron_trapdoor", (new BlockTrapDoor(Material.SOLID)).setHardness(5.0F).setDisplay("Eisenfalltür"));
|
||||
|
||||
register("core", new BlockCore().setHardness(1.5F).setDisplay("Chunk-Lade-Kern"));
|
||||
|
@ -606,7 +606,7 @@ public abstract class BlockRegistry {
|
|||
|
||||
register("stone_pressure_plate", (new BlockPressurePlate(Material.SOLID, BlockPressurePlate.Sensitivity.MOBS)).setHardness(0.5F)
|
||||
.setDisplay("Steindruckplatte"));
|
||||
register("wooden_pressure_plate", (new BlockPressurePlate(Material.WOOD, BlockPressurePlate.Sensitivity.EVERYTHING))
|
||||
register("wooden_pressure_plate", (new BlockPressurePlate(Material.BURNABLE, BlockPressurePlate.Sensitivity.EVERYTHING))
|
||||
.setHardness(0.5F).setDisplay("Holzdruckplatte"));
|
||||
register("light_weighted_pressure_plate", (new BlockPressurePlateWeighted(Material.SOLID, 15)).setHardness(0.5F)
|
||||
.setDisplay("Wägeplatte (niedrige Gewichte)"));
|
||||
|
|
|
@ -825,9 +825,6 @@ public abstract class Items {
|
|||
public static final ItemEnchantedBook enchanted_book_draining_5 = get("enchanted_book_draining_5");
|
||||
public static final ItemEnchantedBook enchanted_book_draining_7 = get("enchanted_book_draining_7");
|
||||
public static final ItemEnchantedBook enchanted_book_draining_9 = get("enchanted_book_draining_9");
|
||||
public static final ItemEnchantedBook enchanted_book_efficiency = get("enchanted_book_efficiency");
|
||||
public static final ItemEnchantedBook enchanted_book_efficiency_3 = get("enchanted_book_efficiency_3");
|
||||
public static final ItemEnchantedBook enchanted_book_efficiency_5 = get("enchanted_book_efficiency_5");
|
||||
public static final ItemEnchantedBook enchanted_book_feather_falling = get("enchanted_book_feather_falling");
|
||||
public static final ItemEnchantedBook enchanted_book_feather_falling_4 = get("enchanted_book_feather_falling_4");
|
||||
public static final ItemEnchantedBook enchanted_book_fire_aspect = get("enchanted_book_fire_aspect");
|
||||
|
|
|
@ -9,7 +9,6 @@ import common.util.Equipment;
|
|||
public class ToolMaterial {
|
||||
private final int harvestLevel;
|
||||
private final int durability;
|
||||
private final int efficiency;
|
||||
private final int damage;
|
||||
private final float radiationResistance;
|
||||
private final float magicResistance;
|
||||
|
@ -22,10 +21,9 @@ public class ToolMaterial {
|
|||
private boolean magnetic;
|
||||
private int defColor = 0xffffffff;
|
||||
|
||||
protected ToolMaterial(int level, float rad, float mag, int uses, int efficiency, int damage, int ench, int auses, int aench, int r1, int r2, int r3, int r4) {
|
||||
protected ToolMaterial(int level, float rad, float mag, int uses, int d, int damage, int ench, int auses, int aench, int r1, int r2, int r3, int r4) {
|
||||
this.harvestLevel = level;
|
||||
this.durability = uses;
|
||||
this.efficiency = efficiency;
|
||||
this.damage = damage;
|
||||
this.enchantability = ench;
|
||||
this.maxDamageFactor = auses;
|
||||
|
@ -53,10 +51,6 @@ public class ToolMaterial {
|
|||
return this.durability;
|
||||
}
|
||||
|
||||
public int getEfficiency() {
|
||||
return this.efficiency;
|
||||
}
|
||||
|
||||
public int getDamage() {
|
||||
return this.damage;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
package common.item;
|
||||
|
||||
public enum ItemAction {
|
||||
NONE, EAT, DRINK, BLOCK, AIM;
|
||||
NONE, BLOCK, AIM;
|
||||
}
|
||||
|
|
|
@ -6,7 +6,6 @@ import common.entity.npc.EntityNPC;
|
|||
import common.init.SoundEvent;
|
||||
import common.item.CheatTab;
|
||||
import common.item.Item;
|
||||
import common.item.ItemAction;
|
||||
import common.item.ItemStack;
|
||||
import common.item.ItemCategory;
|
||||
import common.world.World;
|
||||
|
@ -33,21 +32,6 @@ public class ItemFood extends Item
|
|||
return ItemCategory.CONSUMABLE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the player finishes using this Item (E.g. finishes eating.). Not called when the player stops using
|
||||
* the Item before the action is complete.
|
||||
*/
|
||||
public ItemStack onItemUseFinish(ItemStack stack, World worldIn, EntityNPC playerIn)
|
||||
{
|
||||
// if(!playerIn.creative)
|
||||
stack.decrSize();
|
||||
worldIn.playSoundAtEntity(playerIn, SoundEvent.EAT, 0.5F);
|
||||
playerIn.heal((int)((float)this.getHealAmount(stack) * 0.5f * (1.0f + worldIn.rand.floatv())));
|
||||
this.onFoodEaten(stack, worldIn, playerIn);
|
||||
// playerIn.triggerAchievement(StatRegistry.objectUseStats[ItemRegistry.getIdFromItem(this)]);
|
||||
return stack;
|
||||
}
|
||||
|
||||
protected void onFoodEaten(ItemStack stack, World worldIn, EntityNPC player)
|
||||
{
|
||||
if (!worldIn.client && this.potionId != null && worldIn.rand.floatv() < this.potionEffectProbability)
|
||||
|
@ -56,29 +40,19 @@ public class ItemFood extends Item
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* How long it takes to use or consume an item
|
||||
*/
|
||||
public int getMaxItemUseDuration(ItemStack stack)
|
||||
{
|
||||
return 32;
|
||||
}
|
||||
|
||||
/**
|
||||
* returns the action that specifies what animation to play when the items is being used
|
||||
*/
|
||||
public ItemAction getItemUseAction()
|
||||
{
|
||||
return ItemAction.EAT;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer
|
||||
*/
|
||||
public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityNPC playerIn)
|
||||
public ItemStack onItemRightClick(ItemStack stack, World worldIn, EntityNPC playerIn)
|
||||
{
|
||||
playerIn.setItemInUse(itemStackIn, this.getMaxItemUseDuration(itemStackIn));
|
||||
return itemStackIn;
|
||||
playerIn.playSound(SoundEvent.EAT, 0.5F + 0.5F * (float)playerIn.getRNG().zrange(2));
|
||||
// if(!playerIn.creative)
|
||||
stack.decrSize();
|
||||
// worldIn.playSoundAtEntity(playerIn, SoundEvent.EAT, 0.5F);
|
||||
playerIn.heal((int)((float)this.getHealAmount(stack) * 0.5f * (1.0f + worldIn.rand.floatv())));
|
||||
this.onFoodEaten(stack, worldIn, playerIn);
|
||||
// playerIn.triggerAchievement(StatRegistry.objectUseStats[ItemRegistry.getIdFromItem(this)]);
|
||||
return stack;
|
||||
}
|
||||
|
||||
public int getHealAmount(ItemStack stack)
|
||||
|
|
|
@ -4,9 +4,9 @@ import java.util.Map;
|
|||
|
||||
import common.entity.npc.Attribute;
|
||||
import common.entity.npc.EntityNPC;
|
||||
import common.init.SoundEvent;
|
||||
import common.item.CheatTab;
|
||||
import common.item.Item;
|
||||
import common.item.ItemAction;
|
||||
import common.item.ItemStack;
|
||||
import common.item.ItemCategory;
|
||||
import common.util.Clientside;
|
||||
|
@ -23,23 +23,11 @@ public class ItemMilkBottle extends Item {
|
|||
return ItemCategory.CONSUMABLE;
|
||||
}
|
||||
|
||||
public ItemStack onItemUseFinish(ItemStack stack, World worldIn, EntityNPC playerIn) {
|
||||
stack.decrSize();
|
||||
public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityNPC playerIn) {
|
||||
playerIn.playSound(SoundEvent.DRINK, 0.5F);
|
||||
itemStackIn.decrSize();
|
||||
if(!worldIn.client)
|
||||
playerIn.clearEffects(false);
|
||||
return stack;
|
||||
}
|
||||
|
||||
public int getMaxItemUseDuration(ItemStack stack) {
|
||||
return 32;
|
||||
}
|
||||
|
||||
public ItemAction getItemUseAction() {
|
||||
return ItemAction.DRINK;
|
||||
}
|
||||
|
||||
public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityNPC playerIn) {
|
||||
playerIn.setItemInUse(itemStackIn, this.getMaxItemUseDuration(itemStackIn));
|
||||
return itemStackIn;
|
||||
}
|
||||
|
||||
|
|
|
@ -95,14 +95,25 @@ public class ItemPotion extends Item
|
|||
return this.type;
|
||||
}
|
||||
|
||||
public boolean onAction(ItemStack stack, EntityNPC player, World world, ItemControl control, LocalPos block) {
|
||||
if(control == ItemControl.TERTIARY || control == ItemControl.QUARTERNARY) {
|
||||
stack.decrSize();
|
||||
world.playSoundAtEntity(player, SoundEvent.THROW, 0.5F);
|
||||
if(!world.client)
|
||||
world.spawnEntityInWorld(new EntityPotion(world, player, stack));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the player finishes using this Item (E.g. finishes eating.). Not called when the player stops using
|
||||
* the Item before the action is complete.
|
||||
* Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer
|
||||
*/
|
||||
public ItemStack onItemUseFinish(ItemStack stack, World worldIn, EntityNPC playerIn)
|
||||
public ItemStack onItemRightClick(ItemStack stack, World worldIn, EntityNPC playerIn)
|
||||
{
|
||||
// if (!playerIn.creative)
|
||||
// {
|
||||
playerIn.playSound(SoundEvent.DRINK, 0.5F);
|
||||
stack.decrSize();
|
||||
// }
|
||||
|
||||
|
@ -134,42 +145,6 @@ public class ItemPotion extends Item
|
|||
return stack;
|
||||
}
|
||||
|
||||
/**
|
||||
* How long it takes to use or consume an item
|
||||
*/
|
||||
public int getMaxItemUseDuration(ItemStack stack)
|
||||
{
|
||||
return 32;
|
||||
}
|
||||
|
||||
/**
|
||||
* returns the action that specifies what animation to play when the items is being used
|
||||
*/
|
||||
public ItemAction getItemUseAction()
|
||||
{
|
||||
return ItemAction.DRINK;
|
||||
}
|
||||
|
||||
public boolean onAction(ItemStack stack, EntityNPC player, World world, ItemControl control, LocalPos block) {
|
||||
if(control == ItemControl.TERTIARY || control == ItemControl.QUARTERNARY) {
|
||||
stack.decrSize();
|
||||
world.playSoundAtEntity(player, SoundEvent.THROW, 0.5F);
|
||||
if(!world.client)
|
||||
world.spawnEntityInWorld(new EntityPotion(world, player, stack));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer
|
||||
*/
|
||||
public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityNPC playerIn)
|
||||
{
|
||||
playerIn.setItemInUse(itemStackIn, this.getMaxItemUseDuration(itemStackIn));
|
||||
return itemStackIn;
|
||||
}
|
||||
|
||||
@Clientside
|
||||
public int getPotionColor()
|
||||
{
|
||||
|
|
|
@ -44,7 +44,6 @@ public class ItemTool extends Item {
|
|||
{
|
||||
if(this.type.isLevelled())
|
||||
tooltip.add(Color.VIOLET + "Level " + (this.material.getHarvestLevel() + 1));
|
||||
tooltip.add(Color.DARK_GREEN + "+" + (this.material.getEfficiency() - 1) + " Abbaueffizienz");
|
||||
int damage = this.getAttackDamageBonus(stack);
|
||||
if(damage > 0)
|
||||
tooltip.add(Color.BLUE + "+" + damage + " Angriffsschaden");
|
||||
|
@ -73,10 +72,6 @@ public class ItemTool extends Item {
|
|||
return this.material.getHarvestLevel();
|
||||
}
|
||||
|
||||
public int getToolEfficiency() {
|
||||
return this.material.getEfficiency();
|
||||
}
|
||||
|
||||
public int getItemEnchantability() {
|
||||
return this.material.getEnchantability();
|
||||
}
|
||||
|
|
|
@ -62,8 +62,6 @@ public class CPacketBreak implements Packet<IPlayer>
|
|||
public static enum Action
|
||||
{
|
||||
START_DESTROY_BLOCK,
|
||||
ABORT_DESTROY_BLOCK,
|
||||
STOP_DESTROY_BLOCK,
|
||||
DROP_ALL_ITEMS,
|
||||
DROP_ITEM,
|
||||
RELEASE_USE_ITEM;
|
||||
|
|
|
@ -212,7 +212,7 @@ public class WalkNodeProcessor extends NodeProcessor
|
|||
{
|
||||
if (!block.getMaterial().isColdLiquid())
|
||||
{
|
||||
if (!enterDoors && block instanceof BlockDoor && block.getMaterial() == Material.WOOD)
|
||||
if (!enterDoors && block instanceof BlockDoor && block.getMaterial() == Material.BURNABLE)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
@ -239,7 +239,7 @@ public class WalkNodeProcessor extends NodeProcessor
|
|||
return -3;
|
||||
}
|
||||
}
|
||||
else if (!block.isPassable(world, mpos) && (!breakDoors || !(block instanceof BlockDoor) || block.getMaterial() != Material.WOOD))
|
||||
else if (!block.isPassable(world, mpos) && (!breakDoors || !(block instanceof BlockDoor) || block.getMaterial() != Material.BURNABLE))
|
||||
{
|
||||
if (block instanceof BlockFence || block instanceof BlockFenceGate || block instanceof BlockWall)
|
||||
{
|
||||
|
|
|
@ -182,7 +182,7 @@ public class Village
|
|||
private boolean isWoodDoor(AWorldServer world, LocalPos pos)
|
||||
{
|
||||
Block block = world.getState(pos).getBlock();
|
||||
return block instanceof BlockDoor ? block.getMaterial() == Material.WOOD : false;
|
||||
return block instanceof BlockDoor ? block.getMaterial() == Material.BURNABLE : false;
|
||||
}
|
||||
|
||||
private void updatePosition()
|
||||
|
|
|
@ -21,7 +21,7 @@ public class CommandGod extends Command {
|
|||
}
|
||||
|
||||
public void exec(CommandEnvironment env, Executor exec, List<EntityNPC> players, boolean remove, boolean quiet) {
|
||||
remove = !remove && exec.isPlayer() && players.size() == 1 && players.get(0).connection == exec ? players.get(0).hasEffect(Effect.HASTE) && players.get(0).getEffect(Effect.HASTE).getAmplifier() == 255 : remove;
|
||||
remove = !remove && exec.isPlayer() && players.size() == 1 && players.get(0).connection == exec ? players.get(0).hasEffect(Effect.PUNCHING) && players.get(0).getEffect(Effect.PUNCHING).getAmplifier() == 255 : remove;
|
||||
for(EntityNPC player : players) {
|
||||
player.setGodMode(!remove);
|
||||
if(!quiet)
|
||||
|
|
|
@ -186,15 +186,6 @@ public class Player extends User implements Executor, IPlayer
|
|||
private Vec3i selOffset;
|
||||
private EditAction edit = EditAction.SELECT;
|
||||
|
||||
private LocalPos startPos = LocalPos.ORIGIN;
|
||||
private LocalPos removingPos = LocalPos.ORIGIN;
|
||||
private boolean isDestroyingBlock;
|
||||
private boolean receivedFinishDiggingPacket;
|
||||
private int initialDamage;
|
||||
private int curblockDamage;
|
||||
private int initialBlockDamage;
|
||||
private int durabilityRemainingOnBlock = -1;
|
||||
|
||||
private boolean isChangingQuantityOnly;
|
||||
private int respawnTimer;
|
||||
|
||||
|
@ -234,12 +225,6 @@ public class Player extends User implements Executor, IPlayer
|
|||
if(this.entity == null)
|
||||
this.entity = new EntityHuman(world);
|
||||
this.entity.setServerPlayer(this);
|
||||
this.isDestroyingBlock = false;
|
||||
this.receivedFinishDiggingPacket = false;
|
||||
this.initialDamage = 0;
|
||||
this.curblockDamage = 0;
|
||||
this.initialBlockDamage = 0;
|
||||
this.durabilityRemainingOnBlock = -1;
|
||||
this.managedPosX = 0.0;
|
||||
this.managedPosZ = 0.0;
|
||||
this.combinedHealth = Float.MIN_VALUE;
|
||||
|
@ -1048,61 +1033,6 @@ public class Player extends User implements Executor, IPlayer
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
++this.curblockDamage;
|
||||
|
||||
if (this.receivedFinishDiggingPacket)
|
||||
{
|
||||
int i = this.curblockDamage - this.initialBlockDamage;
|
||||
Block block = this.entity.worldObj.getState(this.removingPos).getBlock();
|
||||
|
||||
if (block == Blocks.air)
|
||||
{
|
||||
this.receivedFinishDiggingPacket = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
float f = block.getHardness(this.entity, this.entity.worldObj, this.removingPos) * (float)(i + 1);
|
||||
int j = (int)(f * 10.0F);
|
||||
|
||||
if (j != this.durabilityRemainingOnBlock)
|
||||
{
|
||||
this.durabilityRemainingOnBlock = j;
|
||||
}
|
||||
|
||||
if (f >= 1.0F)
|
||||
{
|
||||
this.receivedFinishDiggingPacket = false;
|
||||
this.tryHarvestBlock(this.removingPos);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (this.isDestroyingBlock)
|
||||
{
|
||||
Block block1 = this.entity.worldObj.getState(this.startPos).getBlock();
|
||||
|
||||
if (block1 == Blocks.air)
|
||||
{
|
||||
this.durabilityRemainingOnBlock = -1;
|
||||
this.isDestroyingBlock = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
int k = this.curblockDamage - this.initialDamage;
|
||||
float f1 = block1.getHardness(this.entity, this.entity.worldObj, this.removingPos) * (float)(k + 1);
|
||||
int l = (int)(f1 * 10.0F);
|
||||
|
||||
if (l != this.durabilityRemainingOnBlock)
|
||||
{
|
||||
this.durabilityRemainingOnBlock = l;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void onBlockClicked(LocalPos pos, Facing side)
|
||||
|
@ -1115,71 +1045,16 @@ public class Player extends User implements Executor, IPlayer
|
|||
return;
|
||||
}
|
||||
|
||||
// if (this.creative)
|
||||
// {
|
||||
// if (!this.worldObj.extinguishFire(null, pos, side))
|
||||
// {
|
||||
// this.tryHarvestBlock(pos);
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
Block block = this.entity.worldObj.getState(pos).getBlock();
|
||||
|
||||
this.entity.worldObj.extinguishFire(null, pos, side);
|
||||
this.initialDamage = this.curblockDamage;
|
||||
float f = 1.0F;
|
||||
|
||||
if (block != Blocks.air)
|
||||
{
|
||||
block.onStartBreak(this.entity.worldObj, pos, this.entity);
|
||||
f = block.getHardness(this.entity, this.entity.worldObj, pos);
|
||||
}
|
||||
|
||||
if (block != Blocks.air && f >= 1.0F)
|
||||
{
|
||||
if(this.entity.canHarvestBlock(block))
|
||||
this.tryHarvestBlock(pos);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.isDestroyingBlock = true;
|
||||
this.startPos = pos;
|
||||
int i = (int)(f * 10.0F);
|
||||
this.durabilityRemainingOnBlock = i;
|
||||
}
|
||||
// }
|
||||
}
|
||||
|
||||
public void blockRemoving(LocalPos pos)
|
||||
{
|
||||
if (pos.equals(this.startPos))
|
||||
{
|
||||
int i = this.curblockDamage - this.initialDamage;
|
||||
Block block = this.entity.worldObj.getState(pos).getBlock();
|
||||
|
||||
if (block != Blocks.air)
|
||||
{
|
||||
float f = block.getHardness(this.entity, this.entity.worldObj, pos) * (float)(i + 1);
|
||||
|
||||
if (f >= 0.7F)
|
||||
{
|
||||
this.isDestroyingBlock = false;
|
||||
this.tryHarvestBlock(pos);
|
||||
}
|
||||
else if (!this.receivedFinishDiggingPacket)
|
||||
{
|
||||
this.isDestroyingBlock = false;
|
||||
this.receivedFinishDiggingPacket = true;
|
||||
this.removingPos = pos;
|
||||
this.initialBlockDamage = this.initialDamage;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void cancelDestroyingBlock()
|
||||
{
|
||||
this.isDestroyingBlock = false;
|
||||
}
|
||||
|
||||
private boolean removeBlock(LocalPos pos)
|
||||
|
@ -2282,8 +2157,6 @@ public class Player extends User implements Executor, IPlayer
|
|||
return;
|
||||
|
||||
case START_DESTROY_BLOCK:
|
||||
case ABORT_DESTROY_BLOCK:
|
||||
case STOP_DESTROY_BLOCK:
|
||||
double d0 = this.entity.posX - ((double)blockpos.getX() + 0.5D);
|
||||
double d1 = this.entity.posY - ((double)blockpos.getY() + 0.5D) + 1.5D;
|
||||
double d2 = this.entity.posZ - ((double)blockpos.getZ() + 0.5D);
|
||||
|
@ -2300,8 +2173,6 @@ public class Player extends User implements Executor, IPlayer
|
|||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (packetIn.getStatus() == CPacketBreak.Action.START_DESTROY_BLOCK)
|
||||
{
|
||||
if (World.isValidXZ(blockpos))
|
||||
{
|
||||
|
@ -2311,23 +2182,6 @@ public class Player extends User implements Executor, IPlayer
|
|||
{
|
||||
this.sendPacket(new SPacketBlockChange(worldserver, blockpos));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (packetIn.getStatus() == CPacketBreak.Action.STOP_DESTROY_BLOCK)
|
||||
{
|
||||
this.blockRemoving(blockpos);
|
||||
}
|
||||
else if (packetIn.getStatus() == CPacketBreak.Action.ABORT_DESTROY_BLOCK)
|
||||
{
|
||||
this.cancelDestroyingBlock();
|
||||
}
|
||||
|
||||
if (worldserver.getState(blockpos).getBlock() != Blocks.air)
|
||||
{
|
||||
this.sendPacket(new SPacketBlockChange(worldserver, blockpos));
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -2672,7 +2526,7 @@ public class Player extends User implements Executor, IPlayer
|
|||
|
||||
case GOD:
|
||||
if(this.isAdmin()) {
|
||||
boolean god = !this.entity.hasEffect(Effect.HASTE) || this.entity.getEffect(Effect.HASTE).getAmplifier() != 255;
|
||||
boolean god = !this.entity.hasEffect(Effect.PUNCHING) || this.entity.getEffect(Effect.PUNCHING).getAmplifier() != 255;
|
||||
this.entity.setGodMode(god);
|
||||
this.addFeed(god ? (Color.GREEN + "Statuseffekte wurden hinzugefügt") : (Color.RED + "Statuseffekte wurden entfernt"));
|
||||
}
|
||||
|
|
|
@ -244,7 +244,7 @@ public class VillageCollection
|
|||
private boolean isWoodDoor(WorldServer world, LocalPos doorPos)
|
||||
{
|
||||
Block block = world.getState(doorPos).getBlock();
|
||||
return block instanceof BlockDoor ? block.getMaterial() == Material.WOOD : false;
|
||||
return block instanceof BlockDoor ? block.getMaterial() == Material.BURNABLE : false;
|
||||
}
|
||||
|
||||
public TagObject toTags()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue