add rocket launcher + fixes
This commit is contained in:
parent
987c76d2c5
commit
eca1f242c4
54 changed files with 452 additions and 478 deletions
|
@ -770,6 +770,8 @@ public class Client implements IThreadListener {
|
|||
if (this.keyBindsHotbar[l].isPressed())
|
||||
{
|
||||
// if(!this.showDebugProfilerChart) {
|
||||
if(this.player.inventory.currentItem != l)
|
||||
this.controller.resetUseCooldown();
|
||||
this.player.inventory.currentItem = l;
|
||||
// }
|
||||
}
|
||||
|
@ -1127,7 +1129,7 @@ public class Client implements IThreadListener {
|
|||
ItemStack itemstack = this.player.inventory.mainInventory[index];
|
||||
if(itemstack != null) {
|
||||
GuiContainer.renderItemOverlay(itemstack,
|
||||
this.fb_x / 2 - 180 + 4 + 1 + index * 40, this.fb_y - 40 + 1, null);
|
||||
this.fb_x / 2 - 180 + 4 + 1 + index * 40, this.fb_y - 40 + 1, null, index == this.player.inventory.currentItem ? this.controller.getUseCooldown() : 0, this.controller.getUseCooldownMax());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1270,8 +1272,10 @@ public class Client implements IThreadListener {
|
|||
// }
|
||||
if(this.zooming)
|
||||
this.zoomLevel = ExtMath.clampf(this.zoomLevel + (dir < 0 ? -0.25f : 0.25f), 2.0f, 16.0f);
|
||||
else if(this.player != null)
|
||||
else if(this.player != null) {
|
||||
this.player.inventory.changeCurrentItem(dir);
|
||||
this.controller.resetUseCooldown();
|
||||
}
|
||||
}
|
||||
|
||||
// public void resize(int width, int height)
|
||||
|
@ -1558,7 +1562,8 @@ public class Client implements IThreadListener {
|
|||
|
||||
InventoryPlayer inventoryplayer = this.player.inventory;
|
||||
|
||||
inventoryplayer.setCurrentItem(item);
|
||||
if(inventoryplayer.setCurrentItem(item))
|
||||
this.controller.resetUseCooldown();
|
||||
if(this.itemCheat) {
|
||||
this.player.client.addToSendQueue(new CPacketCheat(item, -2 - inventoryplayer.currentItem, this.ctrl()));
|
||||
}
|
||||
|
|
|
@ -5,30 +5,27 @@ import common.inventory.IInventory;
|
|||
import common.inventory.InventoryPlayer;
|
||||
|
||||
public class GuiBrewing extends GuiContainer {
|
||||
private final InventoryPlayer playerInventory;
|
||||
private final IInventory tileBrewingStand;
|
||||
private final InventoryPlayer playerInv;
|
||||
private final IInventory brewer;
|
||||
|
||||
public GuiBrewing(InventoryPlayer player, IInventory inc) {
|
||||
super(new ContainerBrewingStand(player, inc));
|
||||
this.playerInventory = player;
|
||||
this.tileBrewingStand = inc;
|
||||
public GuiBrewing(InventoryPlayer player, IInventory brewer) {
|
||||
super(new ContainerBrewingStand(player, brewer));
|
||||
this.playerInv = player;
|
||||
this.brewer = brewer;
|
||||
}
|
||||
|
||||
public void draw() {
|
||||
super.draw();
|
||||
int k = this.tileBrewingStand.getField(0);
|
||||
|
||||
if(k > 0) {
|
||||
int l = (int)(28.0F * (1.0F - (float)k / 400.0F));
|
||||
|
||||
if(l > 0) {
|
||||
this.rect(97, 16, 9, l, 0xffff20);
|
||||
}
|
||||
int progress = this.brewer.getField(0);
|
||||
if(progress > 0) {
|
||||
int value = (int)(28.0F * (1.0F - (float)progress / 400.0F));
|
||||
if(value > 0)
|
||||
this.rect(97, 16, 9, value, 0xffff20);
|
||||
}
|
||||
}
|
||||
|
||||
public void addElements() {
|
||||
this.label(this.tileBrewingStand.getCommandName(), 8, 6);
|
||||
this.label(this.playerInventory.getCommandName(), 8, this.ySize - 96 + 2);
|
||||
this.label(this.brewer.getCommandName(), 8, 6);
|
||||
this.label(this.playerInv.getCommandName(), 8, this.ySize - 96 + 2);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,22 +5,20 @@ import common.inventory.ContainerChest;
|
|||
import common.inventory.IInventory;
|
||||
|
||||
public class GuiChest extends GuiContainer {
|
||||
private final IInventory upperChestInventory;
|
||||
private final IInventory lowerChestInventory;
|
||||
private final int inventoryRows;
|
||||
private final IInventory upper;
|
||||
private final IInventory lower;
|
||||
|
||||
public GuiChest(IInventory upperInv, IInventory lowerInv) {
|
||||
super(new ContainerChest(upperInv, lowerInv, Client.CLIENT.player));
|
||||
this.upperChestInventory = upperInv;
|
||||
this.lowerChestInventory = lowerInv;
|
||||
public GuiChest(IInventory upper, IInventory lower) {
|
||||
super(new ContainerChest(upper, lower, Client.CLIENT.player));
|
||||
this.upper = upper;
|
||||
this.lower = lower;
|
||||
int i = 222;
|
||||
int j = i - 108;
|
||||
this.inventoryRows = lowerInv.getSizeInventory() / 9;
|
||||
this.ySize = j + this.inventoryRows * 18;
|
||||
this.ySize = j + (lower.getSizeInventory() / 9) * 18;
|
||||
}
|
||||
|
||||
public void addElements() {
|
||||
this.label(this.lowerChestInventory.getCommandName(), 8, 6);
|
||||
this.label(this.upperChestInventory.getCommandName(), 8, this.ySize - 96 + 2);
|
||||
this.label(this.lower.getCommandName(), 8, 6);
|
||||
this.label(this.upper.getCommandName(), 8, this.ySize - 96 + 2);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -858,10 +858,10 @@ public abstract class GuiContainer extends Gui
|
|||
|
||||
public void renderItemOverlayIntoGUI(ItemStack stack, int xPosition, int yPosition, String text)
|
||||
{
|
||||
renderItemOverlay(stack, this.container_x + xPosition * 2, this.container_y + yPosition * 2, text);
|
||||
renderItemOverlay(stack, this.container_x + xPosition * 2, this.container_y + yPosition * 2, text, 0, 0);
|
||||
}
|
||||
|
||||
public static void renderItemOverlay(ItemStack stack, int xPosition, int yPosition, String text)
|
||||
public static void renderItemOverlay(ItemStack stack, int xPosition, int yPosition, String text, int bar2, int bar2max)
|
||||
{
|
||||
if (stack != null)
|
||||
{
|
||||
|
@ -884,6 +884,15 @@ public abstract class GuiContainer extends Gui
|
|||
draw(xPosition + 2, yPosition + 26, 26, 2, (255 - i) / 4, 64, 0);
|
||||
draw(xPosition + 2, yPosition + 26, j, 2, 255 - i, i, 0);
|
||||
}
|
||||
|
||||
if (bar2 > 0)
|
||||
{
|
||||
int j = (int)Math.round(28.0D - (double)bar2 * 28.0D / (double)bar2max);
|
||||
int i = (int)Math.round(255.0D - (double)bar2 * 255.0D / (double)bar2max);
|
||||
draw(xPosition + 2, yPosition + 4, 28, 4, 0, 0, 0);
|
||||
draw(xPosition + 2, yPosition + 4, 26, 2, (255 - i) / 8, (255 - i) / 16, i / 4);
|
||||
draw(xPosition + 2 + 28 - j, yPosition + 4, j, 2, (255 - i) / 2, (255 - i) / 4, i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -9,8 +9,8 @@ import common.world.World;
|
|||
public class GuiCrafting extends GuiContainer {
|
||||
private final BlockWorkbench type;
|
||||
|
||||
public GuiCrafting(InventoryPlayer playerInv, World world, BlockWorkbench type) {
|
||||
super(new ContainerWorkbench(playerInv, world, BlockPos.ORIGIN, type));
|
||||
public GuiCrafting(InventoryPlayer inv, World world, BlockWorkbench type) {
|
||||
super(new ContainerWorkbench(inv, world, BlockPos.ORIGIN, type));
|
||||
this.type = type;
|
||||
this.ySize = 112 + 18 * this.type.getSize();
|
||||
}
|
||||
|
|
|
@ -5,17 +5,17 @@ import common.inventory.IInventory;
|
|||
import common.inventory.InventoryPlayer;
|
||||
|
||||
public class GuiDispenser extends GuiContainer {
|
||||
private final InventoryPlayer playerInventory;
|
||||
private final IInventory dispenserInventory;
|
||||
private final InventoryPlayer playerInv;
|
||||
private final IInventory dispenser;
|
||||
|
||||
public GuiDispenser(InventoryPlayer playerInv, IInventory dispenserInv) {
|
||||
super(new ContainerDispenser(playerInv, dispenserInv));
|
||||
this.playerInventory = playerInv;
|
||||
this.dispenserInventory = dispenserInv;
|
||||
public GuiDispenser(InventoryPlayer playerInv, IInventory dispenser) {
|
||||
super(new ContainerDispenser(playerInv, dispenser));
|
||||
this.playerInv = playerInv;
|
||||
this.dispenser = dispenser;
|
||||
}
|
||||
|
||||
public void addElements() {
|
||||
this.label(this.dispenserInventory.getCommandName(), 8, 6);
|
||||
this.label(this.playerInventory.getCommandName(), 8, this.ySize - 96 + 2);
|
||||
this.label(this.dispenser.getCommandName(), 8, 6);
|
||||
this.label(this.playerInv.getCommandName(), 8, this.ySize - 96 + 2);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,10 +17,10 @@ public class GuiEnchant extends GuiContainer implements ButtonCallback {
|
|||
"the elder scrolls klaatu berata niktu xyzzy bless curse light darkness fire air earth water hot dry cold wet ignite snuff embiggen twist shorten stretch fiddle destroy imbue galvanize enchant free limited range of towards inside sphere cube self other ball mental physical grow shrink demon elemental spirit animal creature beast humanoid undead fresh stale "
|
||||
.split(" ");
|
||||
|
||||
private final InventoryPlayer playerInventory;
|
||||
private final InventoryPlayer playerInv;
|
||||
private final Random nameRand = new Random();
|
||||
private final Random random = new Random();
|
||||
private final ContainerEnchantment container;
|
||||
private final ContainerEnchantment enchantment;
|
||||
private final String title;
|
||||
private final ActButton[] buttons = new ActButton[3];
|
||||
private final Label[] labels = new Label[3];
|
||||
|
@ -28,18 +28,18 @@ public class GuiEnchant extends GuiContainer implements ButtonCallback {
|
|||
|
||||
public GuiEnchant(InventoryPlayer inv, World world, String title) {
|
||||
super(new ContainerEnchantment(inv, world));
|
||||
this.playerInventory = inv;
|
||||
this.container = (ContainerEnchantment)this.inventorySlots;
|
||||
this.playerInv = inv;
|
||||
this.enchantment = (ContainerEnchantment)this.inventorySlots;
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public void updateScreen() {
|
||||
super.updateScreen();
|
||||
this.nameRand.setSeed((long)this.container.seed);
|
||||
this.nameRand.setSeed((long)this.enchantment.seed);
|
||||
|
||||
for(int l = 0; l < 3; ++l) {
|
||||
String name = this.getRandomName();
|
||||
int mana = this.container.mana[l];
|
||||
int mana = this.enchantment.mana[l];
|
||||
|
||||
if(mana == 0) {
|
||||
this.buttons[l].enabled = false;
|
||||
|
@ -63,7 +63,7 @@ public class GuiEnchant extends GuiContainer implements ButtonCallback {
|
|||
|
||||
public void addElements() {
|
||||
this.label(this.title, 12, 5);
|
||||
this.label(this.playerInventory.getCommandName(), 8, this.ySize - 96 + 2);
|
||||
this.label(this.playerInv.getCommandName(), 8, this.ySize - 96 + 2);
|
||||
for(int l = 0; l < 3; ++l) {
|
||||
int i1 = 60;
|
||||
int j1 = i1 + 2;
|
||||
|
@ -74,8 +74,8 @@ public class GuiEnchant extends GuiContainer implements ButtonCallback {
|
|||
|
||||
public void use(ActButton btn, PressType type) {
|
||||
for(int k = 0; k < 3; ++k) {
|
||||
if(btn == this.buttons[k] && this.container.enchantItem(this.gm.player, k))
|
||||
this.gm.controller.sendEnchantPacket(this.container.windowId, k);
|
||||
if(btn == this.buttons[k] && this.enchantment.enchantItem(this.gm.player, k))
|
||||
this.gm.controller.sendEnchantPacket(this.enchantment.windowId, k);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -90,8 +90,8 @@ public class GuiEnchant extends GuiContainer implements ButtonCallback {
|
|||
super.drawScreen(mouseX, mouseY);
|
||||
|
||||
for(int j = 0; j < 3; ++j) {
|
||||
int k = this.container.mana[j];
|
||||
Pair<Enchantment, Integer> l = this.container.ench[j];
|
||||
int k = this.enchantment.mana[j];
|
||||
Pair<Enchantment, Integer> l = this.enchantment.ench[j];
|
||||
int i1 = j + 1;
|
||||
|
||||
if(this.isPointInRegion(60, 14 + 19 * j, 108, 17, mouseX, mouseY) && k > 0 && l != null) {
|
||||
|
@ -101,7 +101,7 @@ public class GuiEnchant extends GuiContainer implements ButtonCallback {
|
|||
sb.append(TextColor.WHITE + s + " . . . ?");
|
||||
|
||||
if(this.gm.player.getManaPoints() < k) {
|
||||
sb.append((sb.length() != 0 ? "\n" : "") + TextColor.RED + String.format("%d Mana erforderlich", this.container.mana[j]));
|
||||
sb.append((sb.length() != 0 ? "\n" : "") + TextColor.RED + String.format("%d Mana erforderlich", this.enchantment.mana[j]));
|
||||
}
|
||||
else {
|
||||
String s1 = "";
|
||||
|
|
|
@ -6,17 +6,17 @@ import common.inventory.ContainerEntityInventory;
|
|||
import common.inventory.IInventory;
|
||||
|
||||
public class GuiEntity extends GuiContainer {
|
||||
private final IInventory playerInventory;
|
||||
private final IInventory entityInventory;
|
||||
private final IInventory playerInv;
|
||||
private final IInventory entity;
|
||||
|
||||
public GuiEntity(IInventory playerInv, IInventory entityInv, Entity entity) {
|
||||
super(new ContainerEntityInventory(playerInv, entityInv, entity, Client.CLIENT.player));
|
||||
this.playerInventory = playerInv;
|
||||
this.entityInventory = entityInv;
|
||||
this.playerInv = playerInv;
|
||||
this.entity = entityInv;
|
||||
}
|
||||
|
||||
public void addElements() {
|
||||
this.label(this.entityInventory.getCommandName(), 8, 6);
|
||||
this.label(this.playerInventory.getCommandName(), 8, this.ySize - 96 + 2);
|
||||
this.label(this.entity.getCommandName(), 8, 6);
|
||||
this.label(this.playerInv.getCommandName(), 8, this.ySize - 96 + 2);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,43 +6,43 @@ import common.inventory.InventoryPlayer;
|
|||
import common.tileentity.TileEntityFurnace;
|
||||
|
||||
public class GuiFurnace extends GuiContainer {
|
||||
private final InventoryPlayer playerInventory;
|
||||
private final IInventory tileFurnace;
|
||||
private final InventoryPlayer playerInv;
|
||||
private final IInventory furnace;
|
||||
|
||||
public GuiFurnace(InventoryPlayer playerInv, IInventory furnaceInv) {
|
||||
super(new ContainerFurnace(playerInv, furnaceInv));
|
||||
this.playerInventory = playerInv;
|
||||
this.tileFurnace = furnaceInv;
|
||||
this.playerInv = playerInv;
|
||||
this.furnace = furnaceInv;
|
||||
}
|
||||
|
||||
public void draw() {
|
||||
super.draw();
|
||||
this.rect(58, 36, 12, 14, 0x202020);
|
||||
if(TileEntityFurnace.isBurning(this.tileFurnace)) {
|
||||
int k = this.getBurnLeftScaled(13);
|
||||
k = Math.min(k, 13);
|
||||
this.rect(58, 36 + 13 - k, 12, k + 1, 0xff7f00);
|
||||
if(TileEntityFurnace.isBurning(this.furnace)) {
|
||||
int burn = this.getBurnLeftScaled(13);
|
||||
burn = Math.min(burn, 13);
|
||||
this.rect(58, 36 + 13 - burn, 12, burn + 1, 0xff7f00);
|
||||
}
|
||||
|
||||
int l = this.getCookProgressScaled(24);
|
||||
int progress = this.getCookProgressScaled(24);
|
||||
this.rect(79, 39, 24, 8, 0x606060);
|
||||
if(l > 0)
|
||||
this.rect(79, 39, l + 1, 8, 0xffaf00);
|
||||
if(progress > 0)
|
||||
this.rect(79, 39, progress + 1, 8, 0xffaf00);
|
||||
}
|
||||
|
||||
public void addElements() {
|
||||
this.label(this.tileFurnace.getCommandName(), 8, 6);
|
||||
this.label(this.playerInventory.getCommandName(), 8, this.ySize - 96 + 2);
|
||||
this.label(this.furnace.getCommandName(), 8, 6);
|
||||
this.label(this.playerInv.getCommandName(), 8, this.ySize - 96 + 2);
|
||||
}
|
||||
|
||||
private int getCookProgressScaled(int pixels) {
|
||||
int i = this.tileFurnace.getField(2);
|
||||
int j = this.tileFurnace.getField(3);
|
||||
return j != 0 && i != 0 ? i * pixels / j : 0;
|
||||
int progress = this.furnace.getField(2);
|
||||
int total = this.furnace.getField(3);
|
||||
return total != 0 && progress != 0 ? progress * pixels / total : 0;
|
||||
}
|
||||
|
||||
private int getBurnLeftScaled(int pixels) {
|
||||
int i = this.tileFurnace.getField(1);
|
||||
return this.tileFurnace.getField(0) * pixels / (i == 0 ? 200 : i);
|
||||
int total = this.furnace.getField(1);
|
||||
return this.furnace.getField(0) * pixels / (total == 0 ? 200 : total);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,18 +6,18 @@ import common.inventory.IInventory;
|
|||
import common.inventory.InventoryPlayer;
|
||||
|
||||
public class GuiHopper extends GuiContainer {
|
||||
private final IInventory playerInventory;
|
||||
private final IInventory hopperInventory;
|
||||
private final IInventory playerInv;
|
||||
private final IInventory hopper;
|
||||
|
||||
public GuiHopper(InventoryPlayer playerInv, IInventory hopperInv) {
|
||||
super(new ContainerHopper(playerInv, hopperInv, Client.CLIENT.player));
|
||||
this.playerInventory = playerInv;
|
||||
this.hopperInventory = hopperInv;
|
||||
public GuiHopper(InventoryPlayer playerInv, IInventory hopper) {
|
||||
super(new ContainerHopper(playerInv, hopper, Client.CLIENT.player));
|
||||
this.playerInv = playerInv;
|
||||
this.hopper = hopper;
|
||||
this.ySize = 133;
|
||||
}
|
||||
|
||||
public void addElements() {
|
||||
this.label(this.hopperInventory.getCommandName(), 8, 6);
|
||||
this.label(this.playerInventory.getCommandName(), 8, this.ySize - 96 + 2);
|
||||
this.label(this.hopper.getCommandName(), 8, 6);
|
||||
this.label(this.playerInv.getCommandName(), 8, this.ySize - 96 + 2);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ import common.village.MerchantRecipeList;
|
|||
import common.world.World;
|
||||
|
||||
public class GuiMerchant extends GuiContainer implements ButtonCallback {
|
||||
private final String merchantName;
|
||||
private final String title;
|
||||
|
||||
private int recipe;
|
||||
private ActButton prevBtn;
|
||||
|
@ -24,7 +24,7 @@ public class GuiMerchant extends GuiContainer implements ButtonCallback {
|
|||
|
||||
public GuiMerchant(InventoryPlayer inv, String name, World world) {
|
||||
super(new ContainerMerchant(inv, null, world));
|
||||
this.merchantName = name != null ? name : "NSC";
|
||||
this.title = name != null ? name : "NSC";
|
||||
}
|
||||
|
||||
public void addButtons() {
|
||||
|
@ -39,7 +39,7 @@ public class GuiMerchant extends GuiContainer implements ButtonCallback {
|
|||
}
|
||||
|
||||
public void addElements() {
|
||||
this.label(this.merchantName, 8, 6);
|
||||
this.label(this.title, 8, 6);
|
||||
this.label("Inventar", 8, this.ySize - 96 + 2);
|
||||
}
|
||||
|
||||
|
|
|
@ -9,11 +9,11 @@ import common.world.World;
|
|||
public class GuiRepair extends GuiContainer {
|
||||
private ContainerRepair anvil;
|
||||
private Label info;
|
||||
private InventoryPlayer playerInventory;
|
||||
private InventoryPlayer playerInv;
|
||||
|
||||
public GuiRepair(InventoryPlayer inv, World world) {
|
||||
super(new ContainerRepair(inv, world));
|
||||
this.playerInventory = inv;
|
||||
this.playerInv = inv;
|
||||
this.anvil = (ContainerRepair)this.inventorySlots;
|
||||
}
|
||||
|
||||
|
@ -23,7 +23,7 @@ public class GuiRepair extends GuiContainer {
|
|||
this.info.setText(TextColor.DRED + "Zu teuer!");
|
||||
else if(this.anvil.maximumCost <= 0 || !this.anvil.getSlot(2).getHasStack())
|
||||
this.info.setText("");
|
||||
else if(!this.anvil.getSlot(2).canTakeStack(this.playerInventory.player))
|
||||
else if(!this.anvil.getSlot(2).canTakeStack(this.playerInv.player))
|
||||
this.info.setText(TextColor.RED + "Manakosten: " + this.anvil.maximumCost);
|
||||
else
|
||||
this.info.setText(TextColor.GREEN + "Manakosten: " + this.anvil.maximumCost);
|
||||
|
|
|
@ -30,6 +30,7 @@ import client.renderer.entity.RenderLeashKnot;
|
|||
import client.renderer.entity.RenderLightning;
|
||||
import client.renderer.entity.RenderManager;
|
||||
import client.renderer.entity.RenderMinecart;
|
||||
import client.renderer.entity.RenderMissile;
|
||||
import client.renderer.entity.RenderMooshroom;
|
||||
import client.renderer.entity.RenderMouse;
|
||||
import client.renderer.entity.RenderNpc;
|
||||
|
@ -85,7 +86,6 @@ import common.entity.item.EntityBoat;
|
|||
import common.entity.item.EntityCart;
|
||||
import common.entity.item.EntityCrystal;
|
||||
import common.entity.item.EntityFalling;
|
||||
import common.entity.item.EntityFireworks;
|
||||
import common.entity.item.EntityItem;
|
||||
import common.entity.item.EntityLeashKnot;
|
||||
import common.entity.item.EntityNuke;
|
||||
|
@ -104,6 +104,7 @@ import common.entity.projectile.EntityEgg;
|
|||
import common.entity.projectile.EntityFireCharge;
|
||||
import common.entity.projectile.EntityFireball;
|
||||
import common.entity.projectile.EntityHook;
|
||||
import common.entity.projectile.EntityMissile;
|
||||
import common.entity.projectile.EntityPotion;
|
||||
import common.entity.projectile.EntitySnowball;
|
||||
import common.init.Blocks;
|
||||
|
@ -136,7 +137,6 @@ public abstract class RenderRegistry {
|
|||
map.put(EntityEgg.class, new RenderItemEntity(mgr, Items.egg, ritem));
|
||||
map.put(EntityPotion.class, new RenderPotion(mgr, ritem));
|
||||
map.put(EntityXpBottle.class, new RenderItemEntity(mgr, Items.experience_bottle, ritem));
|
||||
map.put(EntityFireworks.class, new RenderItemEntity(mgr, Items.fireworks, ritem));
|
||||
map.put(EntityFireball.class, new RenderFireball(mgr, 0.75F));
|
||||
map.put(EntityFireCharge.class, new RenderFireball(mgr, 0.5F));
|
||||
map.put(EntityBox.class, new RenderFlyingBox(mgr));
|
||||
|
@ -154,6 +154,7 @@ public abstract class RenderRegistry {
|
|||
map.put(EntityMouse.class, new RenderMouse(mgr, new ModelMouse()));
|
||||
map.put(EntityDie.class, new RenderDie(mgr));
|
||||
map.put(EntityBullet.class, new RenderBullet(mgr));
|
||||
map.put(EntityMissile.class, new RenderMissile(mgr));
|
||||
map.put(EntityLightning.class, new RenderLightning(mgr));
|
||||
models.put(ModelType.HUMANOID, new RenderHumanoid(mgr, 12, 12, "textures/entity/char.png"));
|
||||
models.put(ModelType.ARACHNOID, new RenderArachnoid(mgr));
|
||||
|
|
|
@ -576,6 +576,8 @@ public class ClientPlayer implements IClientPlayer
|
|||
|
||||
if (packetIn.getHeldItemHotbarIndex() >= 0 && packetIn.getHeldItemHotbarIndex() < InventoryPlayer.getHotbarSize())
|
||||
{
|
||||
if(this.gm.player.inventory.currentItem != packetIn.getHeldItemHotbarIndex())
|
||||
this.gm.controller.resetUseCooldown();
|
||||
this.gm.player.inventory.currentItem = packetIn.getHeldItemHotbarIndex();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
package client.renderer.entity;
|
||||
|
||||
import common.entity.projectile.EntityBullet;
|
||||
|
||||
public class RenderMissile extends RenderBullet {
|
||||
private static final String MISSILE_TEXTURE = "textures/entity/missile.png";
|
||||
|
||||
public RenderMissile(RenderManager renderManagerIn) {
|
||||
super(renderManagerIn);
|
||||
}
|
||||
|
||||
protected String getEntityTexture(EntityBullet entity) {
|
||||
return MISSILE_TEXTURE;
|
||||
}
|
||||
}
|
|
@ -35,6 +35,8 @@ public class PlayerController {
|
|||
private boolean hitting;
|
||||
private int lastSelected;
|
||||
private boolean interacting;
|
||||
private int itemUseCooldown;
|
||||
private int itemUseCooldownMax;
|
||||
|
||||
public PlayerController(Client gm, ClientPlayer handler) {
|
||||
this.gm = gm;
|
||||
|
@ -174,6 +176,8 @@ public class PlayerController {
|
|||
|
||||
public void update() {
|
||||
this.syncItem();
|
||||
if(this.itemUseCooldown > 0)
|
||||
--this.itemUseCooldown;
|
||||
|
||||
if(this.handler.getConnection().isChannelOpen()) {
|
||||
this.handler.getConnection().processReceivedPackets();
|
||||
|
@ -254,8 +258,11 @@ public class PlayerController {
|
|||
|
||||
public boolean sendUseItem(EntityNPC player, World world, ItemStack stack) {
|
||||
this.syncItem();
|
||||
if(this.itemUseCooldown > 0)
|
||||
return false;
|
||||
this.handler.addToSendQueue(new CPacketPlace(player.inventory.getCurrentItem()));
|
||||
int size = stack.getSize();
|
||||
this.itemUseCooldown = this.itemUseCooldownMax = stack.getItem().getUseCooldown(stack, world, player);
|
||||
ItemStack changed = stack.getItem().onItemRightClick(stack, world, player);
|
||||
|
||||
if(changed != stack || changed != null && changed.getSize() != size) {
|
||||
|
@ -310,4 +317,16 @@ public class PlayerController {
|
|||
public boolean isHittingBlock() {
|
||||
return this.hitting;
|
||||
}
|
||||
|
||||
public int getUseCooldown() {
|
||||
return this.itemUseCooldown;
|
||||
}
|
||||
|
||||
public int getUseCooldownMax() {
|
||||
return this.itemUseCooldownMax;
|
||||
}
|
||||
|
||||
public void resetUseCooldown() {
|
||||
this.itemUseCooldown = 0;
|
||||
}
|
||||
}
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
client/src/main/resources/textures/entity/missile.png
Executable file
BIN
client/src/main/resources/textures/entity/missile.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 5.2 KiB |
Binary file not shown.
Before Width: | Height: | Size: 192 B |
BIN
client/src/main/resources/textures/items/rocket.png
Executable file
BIN
client/src/main/resources/textures/items/rocket.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 4.7 KiB |
BIN
client/src/main/resources/textures/items/rocket_launcher.png
Executable file
BIN
client/src/main/resources/textures/items/rocket_launcher.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 5.5 KiB |
Loading…
Add table
Add a link
Reference in a new issue