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.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;
|
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) {
|
if(this.pointedLiquid != null ? block.getMaterial().isLiquid() : block != Blocks.air) {
|
||||||
desc = block.getDisplay();
|
desc = block.getDisplay();
|
||||||
line1 = block.getInfo(this.world, pos, state, this.player);
|
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);
|
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");
|
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()) {
|
if(block.getMiningTool() != null && block.getMiningTool().isLevelled()) {
|
||||||
bar = 1.0f - this.controller.getDamage(pos);
|
bar = (float)(block.getMiningLevel() + 1) / 20.0f;
|
||||||
color = (int)(bar * 255.0f) << 8 | (int)((1.0f - bar) * 255.0f) << 16;
|
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()
|
private void primary()
|
||||||
{
|
{
|
||||||
if (this.leftClickCounter <= 0)
|
if (this.leftClickCounter <= 0)
|
||||||
|
@ -1723,80 +1697,77 @@ public class Client implements IThreadListener {
|
||||||
|
|
||||||
private void secondary()
|
private void secondary()
|
||||||
{
|
{
|
||||||
if (!this.controller.isHittingBlock())
|
this.rightClickTimer = 4;
|
||||||
{
|
boolean flag = true;
|
||||||
this.rightClickTimer = 4;
|
ItemStack itemstack = this.player.getHeldItem();
|
||||||
boolean flag = true;
|
|
||||||
ItemStack itemstack = this.player.getHeldItem();
|
|
||||||
|
|
||||||
if (itemstack != null && itemstack.getItem() == Items.camera && !this.saving)
|
if (itemstack != null && itemstack.getItem() == Items.camera && !this.saving)
|
||||||
|
{
|
||||||
|
this.screenshot = this.cameraUsed = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.pointed == null)
|
||||||
|
{
|
||||||
|
Log.TICK.warn("Null zurückgegeben als 'hitResult', das sollte niemals passieren!");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
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.screenshot = this.cameraUsed = true;
|
this.player.swingItem();
|
||||||
|
this.player.client.addToSendQueue(new CPacketAction(Action.ITEM_ACTION, ItemControl.SECONDARY.ordinal()));
|
||||||
|
if(this.player.getHeldItem() != null && this.player.getHeldItem().isEmpty())
|
||||||
|
this.player.clearHeldItem();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.pointed == null)
|
switch (this.pointed.type)
|
||||||
{
|
{
|
||||||
Log.TICK.warn("Null zurückgegeben als 'hitResult', das sollte niemals passieren!");
|
case ENTITY:
|
||||||
}
|
if (this.controller.interact(this.player, this.pointed.entity))
|
||||||
else
|
{
|
||||||
{
|
flag = false;
|
||||||
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();
|
break;
|
||||||
this.player.client.addToSendQueue(new CPacketAction(Action.ITEM_ACTION, ItemControl.SECONDARY.ordinal()));
|
|
||||||
if(this.player.getHeldItem() != null && this.player.getHeldItem().isEmpty())
|
case BLOCK:
|
||||||
this.player.clearHeldItem();
|
LocalPos blockpos = this.pointed.block;
|
||||||
return;
|
|
||||||
}
|
if (this.world.getState(blockpos).getBlock() != Blocks.air)
|
||||||
|
{
|
||||||
switch (this.pointed.type)
|
int i = itemstack != null ? itemstack.getSize() : 0;
|
||||||
{
|
|
||||||
case ENTITY:
|
if (this.controller.clickRight(this.player, this.world, itemstack, blockpos, this.pointed.side, this.pointed.vec))
|
||||||
if (this.controller.interact(this.player, this.pointed.entity))
|
|
||||||
{
|
{
|
||||||
flag = false;
|
flag = false;
|
||||||
|
this.player.swingItem();
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
if (itemstack == null)
|
||||||
|
|
||||||
case BLOCK:
|
|
||||||
LocalPos blockpos = this.pointed.block;
|
|
||||||
|
|
||||||
if (this.world.getState(blockpos).getBlock() != Blocks.air)
|
|
||||||
{
|
{
|
||||||
int i = itemstack != null ? itemstack.getSize() : 0;
|
return;
|
||||||
|
|
||||||
if (this.controller.clickRight(this.player, this.world, itemstack, blockpos, this.pointed.side, this.pointed.vec))
|
|
||||||
{
|
|
||||||
flag = false;
|
|
||||||
this.player.swingItem();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (itemstack == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (itemstack.isEmpty())
|
|
||||||
{
|
|
||||||
this.player.clearHeldItem();
|
|
||||||
}
|
|
||||||
else if (itemstack.getSize() != i)
|
|
||||||
{
|
|
||||||
this.itemRenderer.resetProgress();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (flag)
|
if (itemstack.isEmpty())
|
||||||
|
{
|
||||||
|
this.player.clearHeldItem();
|
||||||
|
}
|
||||||
|
else if (itemstack.getSize() != i)
|
||||||
|
{
|
||||||
|
this.itemRenderer.resetProgress();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (flag)
|
||||||
|
{
|
||||||
|
ItemStack itemstack1 = this.player.getHeldItem();
|
||||||
|
|
||||||
|
if (itemstack1 != null && this.controller.sendUseItem(this.player, this.world, itemstack1))
|
||||||
{
|
{
|
||||||
ItemStack itemstack1 = this.player.getHeldItem();
|
this.itemRenderer.resetProgress();
|
||||||
|
|
||||||
if (itemstack1 != null && this.controller.sendUseItem(this.player, this.world, itemstack1))
|
|
||||||
{
|
|
||||||
this.itemRenderer.resetProgress();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -708,15 +708,10 @@ public class EffectRenderer {
|
||||||
this.offsetY = rng.floatv() * 3.0F;
|
this.offsetY = rng.floatv() * 3.0F;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Icon(double x, double y, double z, State state, boolean hit) {
|
protected Icon(double x, double y, double z, State state) {
|
||||||
this(x, y, z, hit ? 0.6f : 1.0f, Client.CLIENT.renderer.getModelManager().getTexture(state));
|
this(x, y, z, 1.0f, Client.CLIENT.renderer.getModelManager().getTexture(state));
|
||||||
this.gravity = 1.0F;
|
this.gravity = 1.0F;
|
||||||
this.red = this.green = this.blue = 0.6F;
|
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) {
|
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) -> {
|
this.register(ParticleType.BLOCK_CRACK, (x, y, z, id) -> {
|
||||||
State state = BlockRegistry.byId(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_HUGE, (x, y, z, u) -> new ExplosionSpawner(x, y, z));
|
||||||
this.register(ParticleType.EXPLOSION_LARGE,
|
this.register(ParticleType.EXPLOSION_LARGE,
|
||||||
|
@ -1089,57 +1084,13 @@ public class EffectRenderer {
|
||||||
double d0 = (double)pos.getX() + ((double)j + 0.5D) / (double)i;
|
double d0 = (double)pos.getX() + ((double)j + 0.5D) / (double)i;
|
||||||
double d1 = (double)pos.getY() + ((double)k + 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;
|
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) {
|
public void spawnCritParticles(Entity entity) {
|
||||||
this.add(new HitSpawner(entity));
|
this.add(new HitSpawner(entity));
|
||||||
}
|
}
|
||||||
|
|
|
@ -262,25 +262,6 @@ public class ItemRenderer
|
||||||
GL15.glTranslatef(f, f1, f2);
|
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)
|
private void transformFirstPersonItem(float equipProgress, float swingProgress)
|
||||||
{
|
{
|
||||||
GL15.glTranslatef(0.56F, -0.52F, -0.71999997F);
|
GL15.glTranslatef(0.56F, -0.52F, -0.71999997F);
|
||||||
|
@ -354,12 +335,6 @@ public class ItemRenderer
|
||||||
this.transformFirstPersonItem(f, 0.0F);
|
this.transformFirstPersonItem(f, 0.0F);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EAT:
|
|
||||||
case DRINK:
|
|
||||||
this.performDrinking(clientplayer, partialTicks);
|
|
||||||
this.transformFirstPersonItem(f, 0.0F);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case BLOCK:
|
case BLOCK:
|
||||||
this.transformFirstPersonItem(f, 0.0F);
|
this.transformFirstPersonItem(f, 0.0F);
|
||||||
this.doBlockTransformations();
|
this.doBlockTransformations();
|
||||||
|
|
|
@ -24,13 +24,7 @@ public class PlayerController {
|
||||||
private final Client gm;
|
private final Client gm;
|
||||||
private final ClientPlayer handler;
|
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 int lastSelected;
|
||||||
private boolean interacting;
|
|
||||||
private int itemUseCooldown;
|
private int itemUseCooldown;
|
||||||
private int itemUseCooldownMax;
|
private int itemUseCooldownMax;
|
||||||
|
|
||||||
|
@ -55,8 +49,6 @@ public class PlayerController {
|
||||||
block.onBroken(world, pos, state);
|
block.onBroken(world, pos, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.position = new LocalPos(this.position.getX(), -1, this.position.getZ());
|
|
||||||
|
|
||||||
ItemStack stack = this.gm.player.getHeldItem();
|
ItemStack stack = this.gm.player.getHeldItem();
|
||||||
|
|
||||||
if(stack != null) {
|
if(stack != null) {
|
||||||
|
@ -78,84 +70,19 @@ public class PlayerController {
|
||||||
else {
|
else {
|
||||||
ItemStack stack = this.gm.player.getHeldItem();
|
ItemStack stack = this.gm.player.getHeldItem();
|
||||||
if(stack != null && stack.getItem().onAction(stack, this.gm.player, this.gm.world, ItemControl.PRIMARY, pos)) {
|
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));
|
this.handler.addToSendQueue(new CPacketBreak(CPacketBreak.Action.START_DESTROY_BLOCK, pos, face));
|
||||||
if(this.gm.player.getHeldItem() != null && this.gm.player.getHeldItem().isEmpty())
|
if(this.gm.player.getHeldItem() != null && this.gm.player.getHeldItem().isEmpty())
|
||||||
this.gm.player.clearHeldItem();
|
this.gm.player.clearHeldItem();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if(!this.hitting || !this.isHitting(pos)) {
|
this.handler.addToSendQueue(new CPacketBreak(CPacketBreak.Action.START_DESTROY_BLOCK, pos, face));
|
||||||
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) {
|
|
||||||
block.onStartBreak(this.gm.world, pos, this.gm.player);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(flag && block.getHardness(this.gm.player, this.gm.player.worldObj, pos) >= 1.0F) {
|
|
||||||
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();
|
Block block = this.gm.world.getState(pos).getBlock();
|
||||||
|
if(block != Blocks.air) {
|
||||||
if(block == Blocks.air) {
|
block.onStartBreak(this.gm.world, pos, this.gm.player);
|
||||||
this.hitting = false;
|
if(this.gm.player.canHarvestBlock(block))
|
||||||
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.destroyBlock(pos, face);
|
||||||
this.damage = 0.0F;
|
|
||||||
this.delay = 5;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
}
|
return true;
|
||||||
else {
|
|
||||||
return this.clickBlock(pos, face);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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() {
|
private void syncItem() {
|
||||||
int slot = this.gm.player.getSelectedIndex();
|
int slot = this.gm.player.getSelectedIndex();
|
||||||
|
|
||||||
|
@ -294,10 +209,6 @@ public class PlayerController {
|
||||||
player.stopUsingItem();
|
player.stopUsingItem();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isHittingBlock() {
|
|
||||||
return this.hitting;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getUseCooldown() {
|
public int getUseCooldown() {
|
||||||
return this.itemUseCooldown;
|
return this.itemUseCooldown;
|
||||||
}
|
}
|
||||||
|
@ -309,8 +220,4 @@ public class PlayerController {
|
||||||
public void resetUseCooldown() {
|
public void resetUseCooldown() {
|
||||||
this.itemUseCooldown = 0;
|
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)
|
private BlockDoor getBlockDoor(LocalPos pos)
|
||||||
{
|
{
|
||||||
Block block = this.theEntity.worldObj.getState(pos).getBlock();
|
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;
|
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() {
|
public final State getState() {
|
||||||
return this.defaultState;
|
return this.defaultState;
|
||||||
}
|
}
|
||||||
|
@ -1013,7 +1006,7 @@ public class Block {
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getFuelAmount() {
|
public int getFuelAmount() {
|
||||||
return this.material == Material.WOOD ? 300 : 0;
|
return this.material == Material.BURNABLE ? 300 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void getModifiers(Map<Attribute, Float> map) {
|
public void getModifiers(Map<Attribute, Float> map) {
|
||||||
|
@ -1084,7 +1077,9 @@ public class Block {
|
||||||
if(this.light != 0)
|
if(this.light != 0)
|
||||||
tooltip.add(Color.BLUE + "Licht" + Color.DARK_GRAY + ": " + Color.NEON + String.format("%06x", this.light));
|
tooltip.add(Color.BLUE + "Licht" + Color.DARK_GRAY + ": " + Color.NEON + String.format("%06x", this.light));
|
||||||
if(this.hardness != 0)
|
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
|
@Clientside
|
||||||
|
|
|
@ -9,31 +9,25 @@ public enum Material {
|
||||||
LOOSE {{
|
LOOSE {{
|
||||||
;
|
;
|
||||||
}},
|
}},
|
||||||
WOOD {{
|
BURNABLE {{ // is fuel
|
||||||
this.setBurning().setTool(Equipment.AXE);
|
this.setBurning();
|
||||||
}},
|
}},
|
||||||
SOLID {{
|
SOLID {{
|
||||||
this.setRequiredTool(Equipment.PICKAXE);
|
this.setTool(Equipment.PICKAXE);
|
||||||
}},
|
}},
|
||||||
TRANSLUCENT {{
|
TRANSLUCENT {{
|
||||||
this.setTranslucent();
|
this.setTranslucent();
|
||||||
}},
|
}},
|
||||||
BURNABLE {{
|
SOFT {{ // can't connect to fences+walls
|
||||||
this.setBurning();
|
|
||||||
}},
|
|
||||||
SOFT {{ // can break faster with sword, can't connect to fences+walls
|
|
||||||
this.setNoPushMobility();
|
this.setNoPushMobility();
|
||||||
}},
|
}},
|
||||||
PISTON {{
|
IMMOVABLE {{
|
||||||
this.setImmovableMobility();
|
this.setImmovableMobility();
|
||||||
}},
|
}},
|
||||||
HEAVY {{
|
PLANT {{
|
||||||
this.setRequiredTool(Equipment.PICKAXE).setImmovableMobility();
|
|
||||||
}},
|
|
||||||
PLANT {{ // can break faster with sword
|
|
||||||
this.setNonSolid().setNoPushMobility();
|
this.setNonSolid().setNoPushMobility();
|
||||||
}},
|
}},
|
||||||
SMALL {{ // can be placed more easily
|
SMALL {{ // can be replaced by anvil
|
||||||
this.setNonSolid().setNoPushMobility();
|
this.setNonSolid().setNoPushMobility();
|
||||||
}},
|
}},
|
||||||
FLEECE {{
|
FLEECE {{
|
||||||
|
@ -60,20 +54,20 @@ public enum Material {
|
||||||
HOT {{
|
HOT {{
|
||||||
this.setLiquid(true).setReplaceable().setNoPushMobility();
|
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();
|
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();
|
this.setNonSolid().setBurning().setNoPushMobility().setReplaceable();
|
||||||
}},
|
}},
|
||||||
FIRE {{
|
FIRE {{
|
||||||
this.setNonSolid().setReplaceable().setNoPushMobility();
|
this.setNonSolid().setReplaceable().setNoPushMobility();
|
||||||
}},
|
}},
|
||||||
POWDER {{ // can harvest with shovel, precipitation block
|
POWDER {{ // precipitation block
|
||||||
this.setNonSolid().setReplaceable().setNoPushMobility();
|
this.setNonSolid().setReplaceable().setNoPushMobility();
|
||||||
}},
|
}},
|
||||||
FLUFF {{ // can harvest with shears
|
FLUFF {{
|
||||||
this.setPassable().setRequiredTool(Equipment.SWORD).setNoPushMobility();
|
this.setPassable().setTool(Equipment.SWORD).setNoPushMobility();
|
||||||
}};
|
}};
|
||||||
|
|
||||||
private boolean solid = true;
|
private boolean solid = true;
|
||||||
|
@ -85,7 +79,6 @@ public enum Material {
|
||||||
private boolean hot;
|
private boolean hot;
|
||||||
private boolean burnable;
|
private boolean burnable;
|
||||||
private boolean replaceable;
|
private boolean replaceable;
|
||||||
private boolean requiresTool;
|
|
||||||
// 0 - normal; 1 - can't push other blocks; 2 - can't be pushed
|
// 0 - normal; 1 - can't push other blocks; 2 - can't be pushed
|
||||||
private int mobility;
|
private int mobility;
|
||||||
private Equipment tool;
|
private Equipment tool;
|
||||||
|
@ -121,12 +114,6 @@ public enum Material {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Material setRequiredTool(Equipment tool) {
|
|
||||||
this.requiresTool = true;
|
|
||||||
this.tool = tool;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected Material setTool(Equipment tool) {
|
protected Material setTool(Equipment tool) {
|
||||||
this.tool = tool;
|
this.tool = tool;
|
||||||
return this;
|
return this;
|
||||||
|
@ -188,10 +175,6 @@ public enum Material {
|
||||||
return this.opaque;
|
return this.opaque;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isToolRequired() {
|
|
||||||
return this.requiresTool;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getMobility() {
|
public int getMobility() {
|
||||||
return this.mobility;
|
return this.mobility;
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@ public class BlockBookshelf extends Block
|
||||||
{
|
{
|
||||||
public BlockBookshelf()
|
public BlockBookshelf()
|
||||||
{
|
{
|
||||||
super(Material.WOOD);
|
super(Material.BURNABLE);
|
||||||
this.setTab(CheatTab.DECORATION);
|
this.setTab(CheatTab.DECORATION);
|
||||||
this.setFlammable(30, 20);
|
this.setFlammable(30, 20);
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,7 +70,7 @@ public class BlockDoor extends Block implements Rotatable {
|
||||||
super(material);
|
super(material);
|
||||||
this.setDefaultState(this.getBaseState().withProperty(FACING, Facing.NORTH).withProperty(OPEN, false)
|
this.setDefaultState(this.getBaseState().withProperty(FACING, Facing.NORTH).withProperty(OPEN, false)
|
||||||
.withProperty(HINGE, EnumHingePosition.LEFT).withProperty(HALF, EnumDoorHalf.LOWER));
|
.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);
|
DOORS.add(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,7 @@ public class BlockFence extends Block
|
||||||
{
|
{
|
||||||
super(p_i46395_1_);
|
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.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;
|
this.texture = texture;
|
||||||
FENCES.add(this);
|
FENCES.add(this);
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,7 @@ public class BlockFenceGate extends Block implements Rotatable
|
||||||
|
|
||||||
public BlockFenceGate(WoodType type)
|
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.setDefaultState(this.getBaseState().withProperty(OPEN, Boolean.valueOf(false)).withProperty(IN_WALL, Boolean.valueOf(false)));
|
||||||
this.setTab(CheatTab.WOOD);
|
this.setTab(CheatTab.WOOD);
|
||||||
this.texture = type.getName() + "_planks";
|
this.texture = type.getName() + "_planks";
|
||||||
|
|
|
@ -202,6 +202,6 @@ public class BlockSlab extends Block implements Directional {
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getFuelAmount() {
|
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 f = 0.5F;
|
||||||
float f1 = 1.0F;
|
float f1 = 1.0F;
|
||||||
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 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) {
|
public void setKeyItem(ItemKey key) {
|
||||||
|
|
|
@ -48,7 +48,7 @@ public class BlockHugeMushroom extends Block {
|
||||||
private final Block smallBlock;
|
private final Block smallBlock;
|
||||||
|
|
||||||
public BlockHugeMushroom(Block smallBlock) {
|
public BlockHugeMushroom(Block smallBlock) {
|
||||||
super(Material.WOOD);
|
super(Material.BURNABLE);
|
||||||
this.setDefaultState(this.getBaseState().withProperty(VARIANT, BlockHugeMushroom.EnumType.ALL_OUTSIDE));
|
this.setDefaultState(this.getBaseState().withProperty(VARIANT, BlockHugeMushroom.EnumType.ALL_OUTSIDE));
|
||||||
this.smallBlock = smallBlock;
|
this.smallBlock = smallBlock;
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@ import common.model.Model.ModelProvider;
|
||||||
import common.model.ModelRotation;
|
import common.model.ModelRotation;
|
||||||
import common.properties.Property;
|
import common.properties.Property;
|
||||||
import common.util.LocalPos;
|
import common.util.LocalPos;
|
||||||
|
import common.util.Equipment;
|
||||||
import common.util.Facing;
|
import common.util.Facing;
|
||||||
import common.world.State;
|
import common.world.State;
|
||||||
import common.world.World;
|
import common.world.World;
|
||||||
|
@ -18,11 +19,12 @@ public class BlockLog extends BlockRotatedPillar
|
||||||
{
|
{
|
||||||
public BlockLog()
|
public BlockLog()
|
||||||
{
|
{
|
||||||
super(Material.WOOD);
|
super(Material.BURNABLE);
|
||||||
this.setDefaultState(this.getBaseState().withProperty(AXIS, Facing.Axis.Y));
|
this.setDefaultState(this.getBaseState().withProperty(AXIS, Facing.Axis.Y));
|
||||||
this.setTab(CheatTab.WOOD);
|
this.setTab(CheatTab.WOOD);
|
||||||
this.setHardness(2.0F);
|
this.setHardness(2.0F);
|
||||||
this.setFlammable(5, 5);
|
this.setFlammable(5, 5);
|
||||||
|
this.setMiningTool(Equipment.AXE);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onRemoved(AWorldServer worldIn, LocalPos pos, State state)
|
public void onRemoved(AWorldServer worldIn, LocalPos pos, State state)
|
||||||
|
|
|
@ -33,7 +33,7 @@ public class BlockAnvil extends BlockFalling implements Rotatable
|
||||||
|
|
||||||
public BlockAnvil(int damage)
|
public BlockAnvil(int damage)
|
||||||
{
|
{
|
||||||
super(Material.HEAVY);
|
super(Material.IMMOVABLE);
|
||||||
this.damage = damage;
|
this.damage = damage;
|
||||||
this.setDefaultState(this.getBaseState().withProperty(FACING, Facing.NORTH));
|
this.setDefaultState(this.getBaseState().withProperty(FACING, Facing.NORTH));
|
||||||
this.setOpacity(0);
|
this.setOpacity(0);
|
||||||
|
|
|
@ -50,7 +50,7 @@ public class BlockChest extends Block implements ITileEntityProvider, Rotatable
|
||||||
|
|
||||||
public BlockChest(int capacity)
|
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.setDefaultState(this.getBaseState().withProperty(FACING, Facing.NORTH).withProperty(OPEN, false));
|
||||||
this.capacity = capacity;
|
this.capacity = capacity;
|
||||||
this.setTab(CheatTab.TECHNOLOGY);
|
this.setTab(CheatTab.TECHNOLOGY);
|
||||||
|
|
|
@ -250,7 +250,7 @@ public class BlockPistonBase extends Block implements Directional
|
||||||
|
|
||||||
public BlockPistonBase(boolean isSticky)
|
public BlockPistonBase(boolean isSticky)
|
||||||
{
|
{
|
||||||
super(Material.PISTON);
|
super(Material.IMMOVABLE);
|
||||||
this.setDefaultState(this.getBaseState().withProperty(FACING, Facing.NORTH).withProperty(EXTENDED, Boolean.valueOf(false)));
|
this.setDefaultState(this.getBaseState().withProperty(FACING, Facing.NORTH).withProperty(EXTENDED, Boolean.valueOf(false)));
|
||||||
this.isSticky = isSticky;
|
this.isSticky = isSticky;
|
||||||
this.setHardness(0.5F);
|
this.setHardness(0.5F);
|
||||||
|
|
|
@ -28,7 +28,7 @@ public class BlockPistonHead extends Block implements Directional
|
||||||
|
|
||||||
public BlockPistonHead(boolean sticky)
|
public BlockPistonHead(boolean sticky)
|
||||||
{
|
{
|
||||||
super(Material.PISTON);
|
super(Material.IMMOVABLE);
|
||||||
this.setDefaultState(this.getBaseState().withProperty(FACING, Facing.NORTH));
|
this.setDefaultState(this.getBaseState().withProperty(FACING, Facing.NORTH));
|
||||||
this.setHardness(0.5F);
|
this.setHardness(0.5F);
|
||||||
this.sticky = sticky;
|
this.sticky = sticky;
|
||||||
|
|
|
@ -23,7 +23,7 @@ public class BlockSign extends Block implements ITileEntityProvider, Rotatable
|
||||||
{
|
{
|
||||||
public BlockSign()
|
public BlockSign()
|
||||||
{
|
{
|
||||||
super(Material.WOOD);
|
super(Material.BURNABLE);
|
||||||
float f = 0.25F;
|
float f = 0.25F;
|
||||||
float f1 = 1.0F;
|
float f1 = 1.0F;
|
||||||
this.setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, f1, 0.5F + f);
|
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)
|
public BlockWorkbench(int tier)
|
||||||
{
|
{
|
||||||
super(Material.WOOD);
|
super(Material.BURNABLE);
|
||||||
this.setTab(CheatTab.TECHNOLOGY);
|
this.setTab(CheatTab.TECHNOLOGY);
|
||||||
this.tier = tier;
|
this.tier = tier;
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,12 +21,7 @@ public enum Effect {
|
||||||
return String.format(Color.RED + "-%d%% Geschwindigkeit", 15 * (amp + 1));
|
return String.format(Color.RED + "-%d%% Geschwindigkeit", 15 * (amp + 1));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
HASTE("haste", "Eile", "Trank der Eile", false, 14270531) {
|
PUNCHING("punching", "Schlagkraft", "Trank der Schlagkraft", false, 0xffff00),
|
||||||
public double getEffectiveness() {
|
|
||||||
return 1.5;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
FATIGUE("mining_fatigue", "Abbaulähmung", "Trank der Trägheit", true, 4866583),
|
|
||||||
STRENGTH("strength", 2, 180, "Stärke", "Trank der Stärke", false, 9643043) {
|
STRENGTH("strength", 2, 180, "Stärke", "Trank der Stärke", false, 9643043) {
|
||||||
public String getTooltip(int amp) {
|
public String getTooltip(int amp) {
|
||||||
return String.format(Color.BLUE + "+%d%% Angriffsschaden", 50 * (amp + 1));
|
return String.format(Color.BLUE + "+%d%% Angriffsschaden", 50 * (amp + 1));
|
||||||
|
|
|
@ -299,22 +299,6 @@ public enum Enchantment implements Displayable, Identifyable
|
||||||
return 3;
|
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") {
|
SILK_TOUCH("silk_touch", 1, EnchantmentType.DIGGER, "Behutsamkeit") {
|
||||||
public int getMinEnchantability(int enchantmentLevel)
|
public int getMinEnchantability(int enchantmentLevel)
|
||||||
{
|
{
|
||||||
|
|
|
@ -213,30 +213,6 @@ public class EnchantmentHelper
|
||||||
return getEnchantmentLevel(Enchantment.FIRE_ASPECT, player instanceof EntityNPC npc ? npc.getHeldItem() : null);
|
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.
|
* 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);
|
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)
|
public static ItemStack getEnchantedArmor(Enchantment ench, EntityLiving entity)
|
||||||
{
|
{
|
||||||
if(entity instanceof EntityNPC npc) {
|
if(entity instanceof EntityNPC npc) {
|
||||||
|
|
|
@ -1640,11 +1640,6 @@ public abstract class EntityNPC extends EntityLiving implements IInventory
|
||||||
|
|
||||||
if (itemstack == this.itemInUse)
|
if (itemstack == this.itemInUse)
|
||||||
{
|
{
|
||||||
if (this.itemInUseCount <= 25 && this.itemInUseCount % 4 == 0)
|
|
||||||
{
|
|
||||||
this.updateItemUse(itemstack, 5);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (--this.itemInUseCount == 0 && !this.worldObj.client)
|
if (--this.itemInUseCount == 0 && !this.worldObj.client)
|
||||||
{
|
{
|
||||||
this.onItemUseFinish();
|
this.onItemUseFinish();
|
||||||
|
@ -2883,7 +2878,6 @@ public abstract class EntityNPC extends EntityLiving implements IInventory
|
||||||
// super.onItemUseFinish();
|
// super.onItemUseFinish();
|
||||||
if (this.itemInUse != null)
|
if (this.itemInUse != null)
|
||||||
{
|
{
|
||||||
this.updateItemUse(this.itemInUse, 16);
|
|
||||||
int i = this.itemInUse.getSize();
|
int i = this.itemInUse.getSize();
|
||||||
ItemStack itemstack = this.itemInUse.getItem().onItemUseFinish(this.itemInUse, this.worldObj, this);
|
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;
|
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
|
@Clientside
|
||||||
public void handleStatusUpdate(byte id)
|
public void handleStatusUpdate(byte id)
|
||||||
{
|
{
|
||||||
|
@ -3228,64 +3206,9 @@ public abstract class EntityNPC extends EntityLiving implements IInventory
|
||||||
return entityitem;
|
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)
|
public boolean canHarvestBlock(Block block)
|
||||||
{
|
{
|
||||||
if(!block.getMaterial().isToolRequired())
|
if(block.getMiningTool() == null || this.hasEffect(Effect.PUNCHING))
|
||||||
return true;
|
return true;
|
||||||
return this.getHeldItem() != null && this.getHeldItem().getItem() instanceof ItemTool tool && block.getMiningTool() == tool.getToolType() && (!tool.getToolType().isLevelled() || tool.getToolLevel() >= block.getMiningLevel());
|
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) {
|
public void setGodMode(boolean god) {
|
||||||
this.fallDistance = 0.0F;
|
this.fallDistance = 0.0F;
|
||||||
if(!god) {
|
if(!god) {
|
||||||
this.removeEffect(Effect.HASTE);
|
this.removeEffect(Effect.PUNCHING);
|
||||||
this.removeEffect(Effect.RESISTANCE);
|
this.removeEffect(Effect.RESISTANCE);
|
||||||
this.removeEffect(Effect.FIRE_RESISTANCE);
|
this.removeEffect(Effect.FIRE_RESISTANCE);
|
||||||
this.removeEffect(Effect.FLYING);
|
this.removeEffect(Effect.FLYING);
|
||||||
|
@ -4492,7 +4415,7 @@ public abstract class EntityNPC extends EntityLiving implements IInventory
|
||||||
this.setHealth(this.getMaxHealth());
|
this.setHealth(this.getMaxHealth());
|
||||||
this.setManaPoints(this.getMaxMana());
|
this.setManaPoints(this.getMaxMana());
|
||||||
this.clearEffects(false);
|
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.RESISTANCE, Integer.MAX_VALUE, 255));
|
||||||
this.addEffect(new StatusEffect(Effect.FIRE_RESISTANCE, Integer.MAX_VALUE, 0));
|
this.addEffect(new StatusEffect(Effect.FIRE_RESISTANCE, Integer.MAX_VALUE, 0));
|
||||||
this.addEffect(new StatusEffect(Effect.FLYING, Integer.MAX_VALUE, 1));
|
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)
|
register(wood.getName() + "_sapling", (new BlockSapling(wood)).setHardness(0.0F)
|
||||||
.setDisplay(wood.getDisplay() + "setzling"));
|
.setDisplay(wood.getDisplay() + "setzling"));
|
||||||
register(wood.getName() + "_trunk", (new BlockSlab(log, wood.getName() + "_log_top", wood.getName() + "_log_top")).setDisplay(wood.getDisplay() + "holzscheibe"));
|
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);
|
.setDisplay(wood.getDisplay() + "holzbretter").setTab(CheatTab.WOOD).setFlammable(5, 20);
|
||||||
register(wood.getName() + "_planks", planks);
|
register(wood.getName() + "_planks", planks);
|
||||||
register(wood.getName() + "_stairs", (new BlockStairs(planks))
|
register(wood.getName() + "_stairs", (new BlockStairs(planks))
|
||||||
.setDisplay(wood.getDisplay() + "holztreppe").setFlammable(5, 20));
|
.setDisplay(wood.getDisplay() + "holztreppe").setFlammable(5, 20));
|
||||||
register(wood.getName() + "_slab", (new BlockSlab(planks)).setDisplay(wood.getDisplay() + "holzstufe").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));
|
.setHardness(2.0F).setDisplay(wood.getDisplay() + "holzzaun").setFlammable(5, 20));
|
||||||
register(wood.getName() + "_fence_gate", (new BlockFenceGate(wood)).setHardness(2.0F)
|
register(wood.getName() + "_fence_gate", (new BlockFenceGate(wood)).setHardness(2.0F)
|
||||||
.setDisplay(wood.getDisplay() + "holzzauntor").setFlammable(5, 20));
|
.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));
|
.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(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("bookshelf", (new BlockBookshelf()).setHardness(1.5F).setDisplay("Bücherregal"));
|
||||||
register("cake", (new BlockCake()).setHardness(0.5F).setDisplay("Kuchen").setTab(CheatTab.DECORATION));
|
register("cake", (new BlockCake()).setHardness(0.5F).setDisplay("Kuchen").setTab(CheatTab.DECORATION));
|
||||||
register("dragon_egg", (new BlockDragonEgg()).setHardness(3.0F)
|
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("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("iron_trapdoor", (new BlockTrapDoor(Material.SOLID)).setHardness(5.0F).setDisplay("Eisenfalltür"));
|
||||||
|
|
||||||
register("core", new BlockCore().setHardness(1.5F).setDisplay("Chunk-Lade-Kern"));
|
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)
|
register("stone_pressure_plate", (new BlockPressurePlate(Material.SOLID, BlockPressurePlate.Sensitivity.MOBS)).setHardness(0.5F)
|
||||||
.setDisplay("Steindruckplatte"));
|
.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"));
|
.setHardness(0.5F).setDisplay("Holzdruckplatte"));
|
||||||
register("light_weighted_pressure_plate", (new BlockPressurePlateWeighted(Material.SOLID, 15)).setHardness(0.5F)
|
register("light_weighted_pressure_plate", (new BlockPressurePlateWeighted(Material.SOLID, 15)).setHardness(0.5F)
|
||||||
.setDisplay("Wägeplatte (niedrige Gewichte)"));
|
.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_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_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_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 = 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_feather_falling_4 = get("enchanted_book_feather_falling_4");
|
||||||
public static final ItemEnchantedBook enchanted_book_fire_aspect = get("enchanted_book_fire_aspect");
|
public static final ItemEnchantedBook enchanted_book_fire_aspect = get("enchanted_book_fire_aspect");
|
||||||
|
|
|
@ -9,7 +9,6 @@ import common.util.Equipment;
|
||||||
public class ToolMaterial {
|
public class ToolMaterial {
|
||||||
private final int harvestLevel;
|
private final int harvestLevel;
|
||||||
private final int durability;
|
private final int durability;
|
||||||
private final int efficiency;
|
|
||||||
private final int damage;
|
private final int damage;
|
||||||
private final float radiationResistance;
|
private final float radiationResistance;
|
||||||
private final float magicResistance;
|
private final float magicResistance;
|
||||||
|
@ -22,10 +21,9 @@ public class ToolMaterial {
|
||||||
private boolean magnetic;
|
private boolean magnetic;
|
||||||
private int defColor = 0xffffffff;
|
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.harvestLevel = level;
|
||||||
this.durability = uses;
|
this.durability = uses;
|
||||||
this.efficiency = efficiency;
|
|
||||||
this.damage = damage;
|
this.damage = damage;
|
||||||
this.enchantability = ench;
|
this.enchantability = ench;
|
||||||
this.maxDamageFactor = auses;
|
this.maxDamageFactor = auses;
|
||||||
|
@ -53,10 +51,6 @@ public class ToolMaterial {
|
||||||
return this.durability;
|
return this.durability;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getEfficiency() {
|
|
||||||
return this.efficiency;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getDamage() {
|
public int getDamage() {
|
||||||
return this.damage;
|
return this.damage;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
package common.item;
|
package common.item;
|
||||||
|
|
||||||
public enum ItemAction {
|
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.init.SoundEvent;
|
||||||
import common.item.CheatTab;
|
import common.item.CheatTab;
|
||||||
import common.item.Item;
|
import common.item.Item;
|
||||||
import common.item.ItemAction;
|
|
||||||
import common.item.ItemStack;
|
import common.item.ItemStack;
|
||||||
import common.item.ItemCategory;
|
import common.item.ItemCategory;
|
||||||
import common.world.World;
|
import common.world.World;
|
||||||
|
@ -33,21 +32,6 @@ public class ItemFood extends Item
|
||||||
return ItemCategory.CONSUMABLE;
|
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)
|
protected void onFoodEaten(ItemStack stack, World worldIn, EntityNPC player)
|
||||||
{
|
{
|
||||||
if (!worldIn.client && this.potionId != null && worldIn.rand.floatv() < this.potionEffectProbability)
|
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
|
* 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));
|
playerIn.playSound(SoundEvent.EAT, 0.5F + 0.5F * (float)playerIn.getRNG().zrange(2));
|
||||||
return itemStackIn;
|
// 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)
|
public int getHealAmount(ItemStack stack)
|
||||||
|
|
|
@ -4,9 +4,9 @@ import java.util.Map;
|
||||||
|
|
||||||
import common.entity.npc.Attribute;
|
import common.entity.npc.Attribute;
|
||||||
import common.entity.npc.EntityNPC;
|
import common.entity.npc.EntityNPC;
|
||||||
|
import common.init.SoundEvent;
|
||||||
import common.item.CheatTab;
|
import common.item.CheatTab;
|
||||||
import common.item.Item;
|
import common.item.Item;
|
||||||
import common.item.ItemAction;
|
|
||||||
import common.item.ItemStack;
|
import common.item.ItemStack;
|
||||||
import common.item.ItemCategory;
|
import common.item.ItemCategory;
|
||||||
import common.util.Clientside;
|
import common.util.Clientside;
|
||||||
|
@ -23,23 +23,11 @@ public class ItemMilkBottle extends Item {
|
||||||
return ItemCategory.CONSUMABLE;
|
return ItemCategory.CONSUMABLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemStack onItemUseFinish(ItemStack stack, World worldIn, EntityNPC playerIn) {
|
public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityNPC playerIn) {
|
||||||
stack.decrSize();
|
playerIn.playSound(SoundEvent.DRINK, 0.5F);
|
||||||
|
itemStackIn.decrSize();
|
||||||
if(!worldIn.client)
|
if(!worldIn.client)
|
||||||
playerIn.clearEffects(false);
|
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;
|
return itemStackIn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -94,61 +94,6 @@ public class ItemPotion extends Item
|
||||||
{
|
{
|
||||||
return this.type;
|
return this.type;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 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();
|
|
||||||
// }
|
|
||||||
|
|
||||||
if (!worldIn.client)
|
|
||||||
{
|
|
||||||
if (this.effect != null)
|
|
||||||
{
|
|
||||||
if(this.effect.getPotion().isInstant())
|
|
||||||
this.effect.getPotion().onImpact(null, null, playerIn, this.effect.getAmplifier(), 1.0);
|
|
||||||
else
|
|
||||||
playerIn.addEffect(new StatusEffect(this.effect.getPotion(), this.effect.getDuration(), this.effect.getAmplifier()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// playerIn.triggerAchievement(StatRegistry.objectUseStats[ItemRegistry.getIdFromItem(this)]);
|
|
||||||
|
|
||||||
// if (!playerIn.creative)
|
|
||||||
// {
|
|
||||||
if (stack.isEmpty())
|
|
||||||
{
|
|
||||||
return new ItemStack(Items.bottle);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!playerIn.addItemStackToInventory(new ItemStack(Items.bottle))) {
|
|
||||||
playerIn.dropItem(new ItemStack(Items.bottle), false);
|
|
||||||
}
|
|
||||||
// }
|
|
||||||
|
|
||||||
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) {
|
public boolean onAction(ItemStack stack, EntityNPC player, World world, ItemControl control, LocalPos block) {
|
||||||
if(control == ItemControl.TERTIARY || control == ItemControl.QUARTERNARY) {
|
if(control == ItemControl.TERTIARY || control == ItemControl.QUARTERNARY) {
|
||||||
|
@ -164,10 +109,40 @@ public class ItemPotion extends Item
|
||||||
/**
|
/**
|
||||||
* Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer
|
* 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));
|
// if (!playerIn.creative)
|
||||||
return itemStackIn;
|
// {
|
||||||
|
playerIn.playSound(SoundEvent.DRINK, 0.5F);
|
||||||
|
stack.decrSize();
|
||||||
|
// }
|
||||||
|
|
||||||
|
if (!worldIn.client)
|
||||||
|
{
|
||||||
|
if (this.effect != null)
|
||||||
|
{
|
||||||
|
if(this.effect.getPotion().isInstant())
|
||||||
|
this.effect.getPotion().onImpact(null, null, playerIn, this.effect.getAmplifier(), 1.0);
|
||||||
|
else
|
||||||
|
playerIn.addEffect(new StatusEffect(this.effect.getPotion(), this.effect.getDuration(), this.effect.getAmplifier()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// playerIn.triggerAchievement(StatRegistry.objectUseStats[ItemRegistry.getIdFromItem(this)]);
|
||||||
|
|
||||||
|
// if (!playerIn.creative)
|
||||||
|
// {
|
||||||
|
if (stack.isEmpty())
|
||||||
|
{
|
||||||
|
return new ItemStack(Items.bottle);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!playerIn.addItemStackToInventory(new ItemStack(Items.bottle))) {
|
||||||
|
playerIn.dropItem(new ItemStack(Items.bottle), false);
|
||||||
|
}
|
||||||
|
// }
|
||||||
|
|
||||||
|
return stack;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Clientside
|
@Clientside
|
||||||
|
|
|
@ -44,7 +44,6 @@ public class ItemTool extends Item {
|
||||||
{
|
{
|
||||||
if(this.type.isLevelled())
|
if(this.type.isLevelled())
|
||||||
tooltip.add(Color.VIOLET + "Level " + (this.material.getHarvestLevel() + 1));
|
tooltip.add(Color.VIOLET + "Level " + (this.material.getHarvestLevel() + 1));
|
||||||
tooltip.add(Color.DARK_GREEN + "+" + (this.material.getEfficiency() - 1) + " Abbaueffizienz");
|
|
||||||
int damage = this.getAttackDamageBonus(stack);
|
int damage = this.getAttackDamageBonus(stack);
|
||||||
if(damage > 0)
|
if(damage > 0)
|
||||||
tooltip.add(Color.BLUE + "+" + damage + " Angriffsschaden");
|
tooltip.add(Color.BLUE + "+" + damage + " Angriffsschaden");
|
||||||
|
@ -73,10 +72,6 @@ public class ItemTool extends Item {
|
||||||
return this.material.getHarvestLevel();
|
return this.material.getHarvestLevel();
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getToolEfficiency() {
|
|
||||||
return this.material.getEfficiency();
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getItemEnchantability() {
|
public int getItemEnchantability() {
|
||||||
return this.material.getEnchantability();
|
return this.material.getEnchantability();
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,8 +62,6 @@ public class CPacketBreak implements Packet<IPlayer>
|
||||||
public static enum Action
|
public static enum Action
|
||||||
{
|
{
|
||||||
START_DESTROY_BLOCK,
|
START_DESTROY_BLOCK,
|
||||||
ABORT_DESTROY_BLOCK,
|
|
||||||
STOP_DESTROY_BLOCK,
|
|
||||||
DROP_ALL_ITEMS,
|
DROP_ALL_ITEMS,
|
||||||
DROP_ITEM,
|
DROP_ITEM,
|
||||||
RELEASE_USE_ITEM;
|
RELEASE_USE_ITEM;
|
||||||
|
|
|
@ -212,7 +212,7 @@ public class WalkNodeProcessor extends NodeProcessor
|
||||||
{
|
{
|
||||||
if (!block.getMaterial().isColdLiquid())
|
if (!block.getMaterial().isColdLiquid())
|
||||||
{
|
{
|
||||||
if (!enterDoors && block instanceof BlockDoor && block.getMaterial() == Material.WOOD)
|
if (!enterDoors && block instanceof BlockDoor && block.getMaterial() == Material.BURNABLE)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -239,7 +239,7 @@ public class WalkNodeProcessor extends NodeProcessor
|
||||||
return -3;
|
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)
|
if (block instanceof BlockFence || block instanceof BlockFenceGate || block instanceof BlockWall)
|
||||||
{
|
{
|
||||||
|
|
|
@ -182,7 +182,7 @@ public class Village
|
||||||
private boolean isWoodDoor(AWorldServer world, LocalPos pos)
|
private boolean isWoodDoor(AWorldServer world, LocalPos pos)
|
||||||
{
|
{
|
||||||
Block block = world.getState(pos).getBlock();
|
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()
|
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) {
|
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) {
|
for(EntityNPC player : players) {
|
||||||
player.setGodMode(!remove);
|
player.setGodMode(!remove);
|
||||||
if(!quiet)
|
if(!quiet)
|
||||||
|
|
|
@ -186,15 +186,6 @@ public class Player extends User implements Executor, IPlayer
|
||||||
private Vec3i selOffset;
|
private Vec3i selOffset;
|
||||||
private EditAction edit = EditAction.SELECT;
|
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 boolean isChangingQuantityOnly;
|
||||||
private int respawnTimer;
|
private int respawnTimer;
|
||||||
|
|
||||||
|
@ -234,12 +225,6 @@ public class Player extends User implements Executor, IPlayer
|
||||||
if(this.entity == null)
|
if(this.entity == null)
|
||||||
this.entity = new EntityHuman(world);
|
this.entity = new EntityHuman(world);
|
||||||
this.entity.setServerPlayer(this);
|
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.managedPosX = 0.0;
|
||||||
this.managedPosZ = 0.0;
|
this.managedPosZ = 0.0;
|
||||||
this.combinedHealth = Float.MIN_VALUE;
|
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)
|
public void onBlockClicked(LocalPos pos, Facing side)
|
||||||
|
@ -1115,71 +1045,16 @@ public class Player extends User implements Executor, IPlayer
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (this.creative)
|
|
||||||
// {
|
|
||||||
// if (!this.worldObj.extinguishFire(null, pos, side))
|
|
||||||
// {
|
|
||||||
// this.tryHarvestBlock(pos);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// else
|
|
||||||
// {
|
|
||||||
Block block = this.entity.worldObj.getState(pos).getBlock();
|
Block block = this.entity.worldObj.getState(pos).getBlock();
|
||||||
|
|
||||||
this.entity.worldObj.extinguishFire(null, pos, side);
|
this.entity.worldObj.extinguishFire(null, pos, side);
|
||||||
this.initialDamage = this.curblockDamage;
|
|
||||||
float f = 1.0F;
|
|
||||||
|
|
||||||
if (block != Blocks.air)
|
if (block != Blocks.air)
|
||||||
{
|
{
|
||||||
block.onStartBreak(this.entity.worldObj, pos, this.entity);
|
block.onStartBreak(this.entity.worldObj, pos, this.entity);
|
||||||
f = block.getHardness(this.entity, this.entity.worldObj, pos);
|
if(this.entity.canHarvestBlock(block))
|
||||||
|
this.tryHarvestBlock(pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (block != Blocks.air && f >= 1.0F)
|
|
||||||
{
|
|
||||||
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)
|
private boolean removeBlock(LocalPos pos)
|
||||||
|
@ -2282,8 +2157,6 @@ public class Player extends User implements Executor, IPlayer
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case START_DESTROY_BLOCK:
|
case START_DESTROY_BLOCK:
|
||||||
case ABORT_DESTROY_BLOCK:
|
|
||||||
case STOP_DESTROY_BLOCK:
|
|
||||||
double d0 = this.entity.posX - ((double)blockpos.getX() + 0.5D);
|
double d0 = this.entity.posX - ((double)blockpos.getX() + 0.5D);
|
||||||
double d1 = this.entity.posY - ((double)blockpos.getY() + 0.5D) + 1.5D;
|
double d1 = this.entity.posY - ((double)blockpos.getY() + 0.5D) + 1.5D;
|
||||||
double d2 = this.entity.posZ - ((double)blockpos.getZ() + 0.5D);
|
double d2 = this.entity.posZ - ((double)blockpos.getZ() + 0.5D);
|
||||||
|
@ -2301,32 +2174,13 @@ public class Player extends User implements Executor, IPlayer
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (packetIn.getStatus() == CPacketBreak.Action.START_DESTROY_BLOCK)
|
if (World.isValidXZ(blockpos))
|
||||||
{
|
{
|
||||||
if (World.isValidXZ(blockpos))
|
this.onBlockClicked(blockpos, packetIn.getFacing());
|
||||||
{
|
|
||||||
this.onBlockClicked(blockpos, packetIn.getFacing());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
this.sendPacket(new SPacketBlockChange(worldserver, blockpos));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (packetIn.getStatus() == CPacketBreak.Action.STOP_DESTROY_BLOCK)
|
this.sendPacket(new SPacketBlockChange(worldserver, blockpos));
|
||||||
{
|
|
||||||
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;
|
return;
|
||||||
|
@ -2672,7 +2526,7 @@ public class Player extends User implements Executor, IPlayer
|
||||||
|
|
||||||
case GOD:
|
case GOD:
|
||||||
if(this.isAdmin()) {
|
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.entity.setGodMode(god);
|
||||||
this.addFeed(god ? (Color.GREEN + "Statuseffekte wurden hinzugefügt") : (Color.RED + "Statuseffekte wurden entfernt"));
|
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)
|
private boolean isWoodDoor(WorldServer world, LocalPos doorPos)
|
||||||
{
|
{
|
||||||
Block block = world.getState(doorPos).getBlock();
|
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()
|
public TagObject toTags()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue