add rocket launcher + fixes
This commit is contained in:
parent
987c76d2c5
commit
eca1f242c4
54 changed files with 452 additions and 478 deletions
|
@ -1016,7 +1016,7 @@ public final class Server implements IThreadListener, Executor {
|
|||
}
|
||||
|
||||
public void syncPlayerInventory(EntityNPC player) {
|
||||
player.connection.sendContainerToPlayer(player.inventoryContainer);
|
||||
player.connection.sendContainer(player.inventoryContainer, player.inventoryContainer.getInventory());
|
||||
player.connection.setPlayerHealthUpdated();
|
||||
player.connection.sendPacket(new SPacketHeldItemChange(player.inventory.currentItem));
|
||||
}
|
||||
|
|
|
@ -36,7 +36,6 @@ import common.inventory.ContainerChest;
|
|||
import common.inventory.ContainerEnchantment;
|
||||
import common.inventory.ContainerEntityInventory;
|
||||
import common.inventory.ContainerMerchant;
|
||||
import common.inventory.ICrafting;
|
||||
import common.inventory.IInventory;
|
||||
import common.inventory.InventoryPlayer;
|
||||
import common.inventory.Slot;
|
||||
|
@ -133,7 +132,7 @@ import server.world.ChunkServer;
|
|||
import server.world.Region;
|
||||
import server.world.WorldServer;
|
||||
|
||||
public class Player extends User implements ICrafting, Executor, IPlayer
|
||||
public class Player extends User implements Executor, IPlayer
|
||||
{
|
||||
private static enum EditAction {
|
||||
SELECT("Auswahlmodus"), COPYPASTE("Kopiermodus"), TRANSFORM("Drehmodus");
|
||||
|
@ -196,6 +195,7 @@ public class Player extends User implements ICrafting, Executor, IPlayer
|
|||
private int lastExperience = -99999999;
|
||||
private int currentWindowId;
|
||||
private int currentFormId;
|
||||
private int itemUseCooldown;
|
||||
|
||||
private int pointedEntity;
|
||||
private BlockPos pointedPosition;
|
||||
|
@ -235,6 +235,7 @@ public class Player extends User implements ICrafting, Executor, IPlayer
|
|||
this.currentWindowId = 0;
|
||||
this.loadedChunks.clear();
|
||||
// this.destroyedItemsNetCache.clear();
|
||||
this.itemUseCooldown = 0;
|
||||
return this.entity;
|
||||
}
|
||||
|
||||
|
@ -255,6 +256,8 @@ public class Player extends User implements ICrafting, Executor, IPlayer
|
|||
this.respawnPlayer();
|
||||
}
|
||||
}
|
||||
if(this.itemUseCooldown > 0)
|
||||
--this.itemUseCooldown;
|
||||
}
|
||||
|
||||
public boolean isOnline() {
|
||||
|
@ -834,38 +837,33 @@ public class Player extends User implements ICrafting, Executor, IPlayer
|
|||
|
||||
|
||||
|
||||
public void sendSlotContents(Container containerToSend, int slotInd, ItemStack stack)
|
||||
public void sendSlot(Container container, int index, ItemStack stack)
|
||||
{
|
||||
if (!(containerToSend.getSlot(slotInd) instanceof SlotCrafting))
|
||||
if (!(container.getSlot(index) instanceof SlotCrafting))
|
||||
{
|
||||
if (!this.isChangingQuantityOnly)
|
||||
{
|
||||
this.sendPacket(new SPacketSetSlot(containerToSend.windowId, slotInd, stack));
|
||||
this.sendPacket(new SPacketSetSlot(container.windowId, index, stack));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void sendContainerToPlayer(Container container)
|
||||
{
|
||||
this.updateCraftingInventory(container, container.getInventory());
|
||||
}
|
||||
|
||||
public void updateCraftingInventory(Container containerToSend, List<ItemStack> itemsList)
|
||||
public void sendContainer(Container container, List<ItemStack> items)
|
||||
{
|
||||
this.sendPacket(new SPacketWindowItems(containerToSend.windowId, itemsList));
|
||||
this.sendPacket(new SPacketWindowItems(container.windowId, items));
|
||||
this.sendPacket(new SPacketSetSlot(-1, -1, this.entity.inventory.getItemStack()));
|
||||
}
|
||||
|
||||
public void sendProgressBarUpdate(Container containerIn, int varToUpdate, int newValue)
|
||||
public void sendProperty(Container container, int variable, int value)
|
||||
{
|
||||
this.sendPacket(new SPacketWindowProperty(containerIn.windowId, varToUpdate, newValue));
|
||||
this.sendPacket(new SPacketWindowProperty(container.windowId, variable, value));
|
||||
}
|
||||
|
||||
public void sendAllWindowProperties(Container p_175173_1_, IInventory p_175173_2_)
|
||||
public void sendProperties(Container container, IInventory inventory)
|
||||
{
|
||||
for (int i = 0; i < p_175173_2_.getFieldCount(); ++i)
|
||||
for (int z = 0; z < inventory.getFieldCount(); z++)
|
||||
{
|
||||
this.sendPacket(new SPacketWindowProperty(p_175173_1_.windowId, i, p_175173_2_.getField(i)));
|
||||
this.sendPacket(new SPacketWindowProperty(container.windowId, z, inventory.getField(z)));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1249,29 +1247,19 @@ public class Player extends User implements ICrafting, Executor, IPlayer
|
|||
// }
|
||||
}
|
||||
|
||||
public boolean tryUseItem(ItemStack stack)
|
||||
public void tryUseItem(ItemStack stack)
|
||||
{
|
||||
// if(this.onPlayerInteract(false, null)) {
|
||||
// return true;
|
||||
// }
|
||||
if(this.itemUseCooldown > 0)
|
||||
return;
|
||||
int i = stack.getSize();
|
||||
int j = stack.getItemDamage();
|
||||
this.itemUseCooldown = stack.getItem().getUseCooldown(stack, this.entity.worldObj, this.entity);
|
||||
ItemStack itemstack = stack.getItem().onItemRightClick(stack, this.entity.worldObj, this.entity);
|
||||
|
||||
if (itemstack != stack || itemstack != null && (itemstack.getSize() != i || itemstack.getMaxItemUseDuration() > 0 || itemstack.getItemDamage() != j))
|
||||
{
|
||||
this.entity.inventory.mainInventory[this.entity.inventory.currentItem] = itemstack;
|
||||
|
||||
// if (this.creative)
|
||||
// {
|
||||
// itemstack.stackSize = i;
|
||||
//
|
||||
// if (itemstack.isItemStackDamageable())
|
||||
// {
|
||||
// itemstack.setItemDamage(j);
|
||||
// }
|
||||
// }
|
||||
|
||||
if (itemstack.isEmpty())
|
||||
{
|
||||
this.entity.inventory.mainInventory[this.entity.inventory.currentItem] = null;
|
||||
|
@ -1279,14 +1267,8 @@ public class Player extends User implements ICrafting, Executor, IPlayer
|
|||
|
||||
if (!this.entity.isUsingItem())
|
||||
{
|
||||
this.sendContainerToPlayer(this.entity.inventoryContainer);
|
||||
this.sendContainer(this.entity.inventoryContainer, this.entity.inventoryContainer.getInventory());
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2637,8 +2619,11 @@ public class Player extends User implements ICrafting, Executor, IPlayer
|
|||
break;
|
||||
|
||||
case SET_ITEMSLOT:
|
||||
if(packetIn.getAuxData() >= 0 && packetIn.getAuxData() < InventoryPlayer.getHotbarSize())
|
||||
if(packetIn.getAuxData() >= 0 && packetIn.getAuxData() < InventoryPlayer.getHotbarSize()) {
|
||||
if(packetIn.getAuxData() != this.entity.inventory.currentItem)
|
||||
this.itemUseCooldown = 0;
|
||||
this.entity.inventory.currentItem = packetIn.getAuxData();
|
||||
}
|
||||
// else
|
||||
// Log.warn(this.user + " versuchte, einen ungültigen Slot zu wählen");
|
||||
break;
|
||||
|
@ -2886,7 +2871,7 @@ public class Player extends User implements ICrafting, Executor, IPlayer
|
|||
list1.add(((Slot)this.entity.openContainer.inventorySlots.get(j)).getStack());
|
||||
}
|
||||
|
||||
this.updateCraftingInventory(this.entity.openContainer, list1);
|
||||
this.sendContainer(this.entity.openContainer, list1);
|
||||
}
|
||||
// }
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue