cleanup player controller method names
This commit is contained in:
parent
2bc84f0c66
commit
10fdaf0b1a
2 changed files with 28 additions and 28 deletions
|
@ -698,7 +698,7 @@ public class Client implements IThreadListener {
|
|||
this.entityRenderer.getMouseOver(1.0F);
|
||||
if (/* !this.paused && */ this.world != null)
|
||||
{
|
||||
this.controller.updateController();
|
||||
this.controller.update();
|
||||
}
|
||||
this.textureMap.updateAnimations();
|
||||
if (this.open != null)
|
||||
|
@ -728,7 +728,7 @@ public class Client implements IThreadListener {
|
|||
{
|
||||
if (!Bind.SECONDARY.isDown())
|
||||
{
|
||||
this.controller.onStoppedUsingItem(this.player);
|
||||
this.controller.stopUsing(this.player);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -1267,7 +1267,7 @@ public class Client implements IThreadListener {
|
|||
{
|
||||
BlockPos blockpos = this.pointed.block;
|
||||
|
||||
if (this.world.getState(blockpos).getBlock() != Blocks.air && this.controller.onPlayerDamageBlock(blockpos, this.pointed.side))
|
||||
if (this.world.getState(blockpos).getBlock() != Blocks.air && this.controller.damageBlock(blockpos, this.pointed.side))
|
||||
{
|
||||
this.effectRenderer.addBlockHitEffects(blockpos, this.pointed.side);
|
||||
this.player.swingItem();
|
||||
|
@ -1275,7 +1275,7 @@ public class Client implements IThreadListener {
|
|||
}
|
||||
else
|
||||
{
|
||||
this.controller.resetBlockRemoving();
|
||||
this.controller.resetProgress();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1328,7 +1328,7 @@ public class Client implements IThreadListener {
|
|||
|
||||
private void secondary()
|
||||
{
|
||||
if (!this.controller.getIsHittingBlock())
|
||||
if (!this.controller.isHittingBlock())
|
||||
{
|
||||
this.rightClickTimer = 4;
|
||||
boolean flag = true;
|
||||
|
@ -1360,7 +1360,7 @@ public class Client implements IThreadListener {
|
|||
// flag = false;
|
||||
// }
|
||||
// else
|
||||
if (this.controller.interactWithEntitySendPacket(this.player, this.pointed.entity))
|
||||
if (this.controller.interact(this.player, this.pointed.entity))
|
||||
{
|
||||
flag = false;
|
||||
}
|
||||
|
@ -1374,7 +1374,7 @@ public class Client implements IThreadListener {
|
|||
{
|
||||
int i = itemstack != null ? itemstack.stackSize : 0;
|
||||
|
||||
if (this.controller.onPlayerRightClick(this.player, this.world, itemstack, blockpos, this.pointed.side, this.pointed.vec))
|
||||
if (this.controller.clickRight(this.player, this.world, itemstack, blockpos, this.pointed.side, this.pointed.vec))
|
||||
{
|
||||
flag = false;
|
||||
this.player.swingItem();
|
||||
|
|
|
@ -41,7 +41,7 @@ public class PlayerController {
|
|||
this.handler = handler;
|
||||
}
|
||||
|
||||
public boolean onPlayerDestroyBlock(BlockPos pos, Facing side) {
|
||||
public boolean destroyBlock(BlockPos pos, Facing side) {
|
||||
World world = this.gm.world;
|
||||
State state = world.getState(pos);
|
||||
Block block = state.getBlock();
|
||||
|
@ -84,7 +84,7 @@ public class PlayerController {
|
|||
this.handler.addToSendQueue(new CPacketBreak(CPacketBreak.Action.START_DESTROY_BLOCK, pos, face));
|
||||
return true;
|
||||
}
|
||||
if(!this.hitting || !this.isHittingPosition(pos)) {
|
||||
if(!this.hitting || !this.isHitting(pos)) {
|
||||
if(this.hitting) {
|
||||
this.handler.addToSendQueue(new CPacketBreak(CPacketBreak.Action.ABORT_DESTROY_BLOCK, this.position, face));
|
||||
}
|
||||
|
@ -98,7 +98,7 @@ public class PlayerController {
|
|||
}
|
||||
|
||||
if(flag && block.getPlayerRelativeBlockHardness(this.gm.player, this.gm.player.worldObj, pos) >= 1.0F) {
|
||||
this.onPlayerDestroyBlock(pos, face);
|
||||
this.destroyBlock(pos, face);
|
||||
this.delay = 3;
|
||||
}
|
||||
else {
|
||||
|
@ -115,7 +115,7 @@ public class PlayerController {
|
|||
}
|
||||
}
|
||||
|
||||
public void resetBlockRemoving() {
|
||||
public void resetProgress() {
|
||||
if(this.hitting) {
|
||||
this.handler.addToSendQueue(new CPacketBreak(CPacketBreak.Action.ABORT_DESTROY_BLOCK, this.position, Facing.DOWN));
|
||||
this.hitting = false;
|
||||
|
@ -128,16 +128,16 @@ public class PlayerController {
|
|||
this.interacting = false;
|
||||
}
|
||||
|
||||
public boolean onPlayerDamageBlock(BlockPos pos, Facing face) {
|
||||
public boolean damageBlock(BlockPos pos, Facing face) {
|
||||
if(this.interacting)
|
||||
return false;
|
||||
this.syncCurrentPlayItem();
|
||||
this.syncItem();
|
||||
|
||||
if(this.delay > 0) {
|
||||
--this.delay;
|
||||
return true;
|
||||
}
|
||||
else if(this.isHittingPosition(pos)) {
|
||||
else if(this.isHitting(pos)) {
|
||||
Block block = this.gm.world.getState(pos).getBlock();
|
||||
|
||||
if(block == Blocks.air) {
|
||||
|
@ -157,7 +157,7 @@ public class PlayerController {
|
|||
if(this.damage >= 1.0F) {
|
||||
this.hitting = false;
|
||||
this.handler.addToSendQueue(new CPacketBreak(CPacketBreak.Action.STOP_DESTROY_BLOCK, pos, face));
|
||||
this.onPlayerDestroyBlock(pos, face);
|
||||
this.destroyBlock(pos, face);
|
||||
this.damage = 0.0F;
|
||||
this.stepCounter = 0.0F;
|
||||
this.delay = 5;
|
||||
|
@ -172,8 +172,8 @@ public class PlayerController {
|
|||
}
|
||||
}
|
||||
|
||||
public void updateController() {
|
||||
this.syncCurrentPlayItem();
|
||||
public void update() {
|
||||
this.syncItem();
|
||||
|
||||
if(this.handler.getNetworkManager().isChannelOpen()) {
|
||||
this.handler.getNetworkManager().processReceivedPackets();
|
||||
|
@ -183,7 +183,7 @@ public class PlayerController {
|
|||
}
|
||||
}
|
||||
|
||||
private boolean isHittingPosition(BlockPos pos) {
|
||||
private boolean isHitting(BlockPos pos) {
|
||||
ItemStack stack = this.gm.player.getHeldItem();
|
||||
boolean flag = this.stack == null && stack == null;
|
||||
|
||||
|
@ -196,7 +196,7 @@ public class PlayerController {
|
|||
return pos.equals(this.position) && flag;
|
||||
}
|
||||
|
||||
private void syncCurrentPlayItem() {
|
||||
private void syncItem() {
|
||||
int slot = this.gm.player.inventory.currentItem;
|
||||
|
||||
if(slot != this.lastSelected) {
|
||||
|
@ -205,8 +205,8 @@ public class PlayerController {
|
|||
}
|
||||
}
|
||||
|
||||
public boolean onPlayerRightClick(EntityNPC player, WorldClient world, ItemStack stack, BlockPos pos, Facing side, Vec3 hit) {
|
||||
this.syncCurrentPlayItem();
|
||||
public boolean clickRight(EntityNPC player, WorldClient world, ItemStack stack, BlockPos pos, Facing side, Vec3 hit) {
|
||||
this.syncItem();
|
||||
float f = (float)(hit.xCoord - (double)pos.getX());
|
||||
float f1 = (float)(hit.yCoord - (double)pos.getY());
|
||||
float f2 = (float)(hit.zCoord - (double)pos.getZ());
|
||||
|
@ -254,7 +254,7 @@ public class PlayerController {
|
|||
}
|
||||
|
||||
public boolean sendUseItem(EntityNPC player, World world, ItemStack stack) {
|
||||
this.syncCurrentPlayItem();
|
||||
this.syncItem();
|
||||
this.handler.addToSendQueue(new CPacketPlace(player.inventory.getCurrentItem()));
|
||||
int size = stack.stackSize;
|
||||
ItemStack changed = stack.useItemRightClick(world, player);
|
||||
|
@ -280,13 +280,13 @@ public class PlayerController {
|
|||
}
|
||||
|
||||
public void attackEntity(EntityNPC player, Entity target) {
|
||||
this.syncCurrentPlayItem();
|
||||
this.syncItem();
|
||||
this.handler.addToSendQueue(new CPacketAction(CPacketAction.Action.ATTACK, target.getId()));
|
||||
player.attackTargetEntityWithCurrentItem(target);
|
||||
}
|
||||
|
||||
public boolean interactWithEntitySendPacket(EntityNPC player, Entity target) {
|
||||
this.syncCurrentPlayItem();
|
||||
public boolean interact(EntityNPC player, Entity target) {
|
||||
this.syncItem();
|
||||
this.handler.addToSendQueue(new CPacketAction(CPacketAction.Action.INTERACT, target.getId()));
|
||||
return player.interactWith(target);
|
||||
}
|
||||
|
@ -302,13 +302,13 @@ public class PlayerController {
|
|||
this.handler.addToSendQueue(new CPacketAction(CPacketAction.Action.ENCHANT_ITEM, window | (button << 8)));
|
||||
}
|
||||
|
||||
public void onStoppedUsingItem(EntityNPC player) {
|
||||
this.syncCurrentPlayItem();
|
||||
public void stopUsing(EntityNPC player) {
|
||||
this.syncItem();
|
||||
this.handler.addToSendQueue(new CPacketBreak(CPacketBreak.Action.RELEASE_USE_ITEM, BlockPos.ORIGIN, Facing.DOWN));
|
||||
player.stopUsingItem();
|
||||
}
|
||||
|
||||
public boolean getIsHittingBlock() {
|
||||
public boolean isHittingBlock() {
|
||||
return this.hitting;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue