fix itemstack sizes

This commit is contained in:
Sen 2025-07-07 15:20:52 +02:00
parent 4e94a660ff
commit c376d92790
Signed by: sen
GPG key ID: 3AC50A6F47D1B722
111 changed files with 983 additions and 1353 deletions

View file

@ -1477,7 +1477,7 @@ public class Client implements IThreadListener {
if (this.world.getState(blockpos).getBlock() != Blocks.air)
{
int i = itemstack != null ? itemstack.size : 0;
int i = itemstack != null ? itemstack.getSize() : 0;
if (this.controller.clickRight(this.player, this.world, itemstack, blockpos, this.pointed.side, this.pointed.vec))
{
@ -1490,13 +1490,13 @@ public class Client implements IThreadListener {
return;
}
if (itemstack.size == 0)
if (itemstack.isEmpty())
{
this.player.inventory.mainInventory[this.player.inventory.currentItem] = null;
}
else if (itemstack.size != i) // || this.controller.isCreative())
else if (itemstack.getSize() != i) // || this.controller.isCreative())
{
this.entityRenderer.itemRenderer.resetEquippedProgress();
this.entityRenderer.itemRenderer.resetProgress();
}
}
}
@ -1508,7 +1508,7 @@ public class Client implements IThreadListener {
if (itemstack1 != null && this.controller.sendUseItem(this.player, this.world, itemstack1))
{
this.entityRenderer.itemRenderer.resetEquippedProgress2();
this.entityRenderer.itemRenderer.resetProgress();
}
}
}
@ -1980,7 +1980,7 @@ public class Client implements IThreadListener {
(((EntityLiving)entity).deathTime != 0 ? "Tod: " + ((EntityLiving)entity).deathTime + "t, " : "") + "Rüstung: " + ((EntityLiving)entity).getTotalArmorValue() + ", Pfeile: " + ((EntityLiving)entity).getArrowCountInEntity()
: "Rüstung: n/a, Pfeile: n/a") + "\n" +
(held != null ?
"Gegens.: " + ItemRegistry.getName(held.getItem()) + " x" + held.size : "Gegens.: n/a") + "\n" +
"Gegens.: " + ItemRegistry.getName(held.getItem()) + " x" + held.getSize() : "Gegens.: n/a") + "\n" +
"Eigens.: " + (entity.dead ? "D" : "") + (entity.noClip ? "N" : "") + (entity.onGround ? "G" : "")
+ (entity.canBeCollidedWith() ? "C" : "") + (entity.canBePushed() ? "P" : "")
+ (entity.isBurning() ? "B" : "") + (entity.isPlayer() ? "S" : "")

View file

@ -1,8 +1,11 @@
package client.gui.container;
import java.text.DecimalFormat;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.Map.Entry;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL13;
@ -22,9 +25,13 @@ import client.renderer.ItemRenderer;
import client.renderer.entity.RenderItem;
import client.window.Bind;
import client.window.Button;
import common.attributes.Attribute;
import common.collect.Lists;
import common.collect.Sets;
import common.color.TextColor;
import common.enchantment.Enchantment;
import common.enchantment.EnchantmentHelper;
import common.init.ItemRegistry;
import common.inventory.Container;
import common.inventory.InventoryPlayer;
import common.inventory.Slot;
@ -50,6 +57,7 @@ public abstract class GuiContainer extends Gui
}
}
private static final DecimalFormat DECIMALFORMAT = new DecimalFormat("#.###");
private static final List<ItemStack> ITEM_LIST = Lists.<ItemStack>newArrayList();
private static CheatTab selectedTab = CheatTab.ALL;
@ -94,6 +102,91 @@ public abstract class GuiContainer extends Gui
private Field cheatSearch;
private String cheatLast;
public static String formatAmount(int amount) {
if(amount < 0)
return "0";
if(amount < 1000)
return "" + amount;
else if(amount < 100000)
return (amount / 1000) + "K";
else if(amount < 1000000)
return "." + (amount / 100000) + "M";
else if(amount < 100000000)
return (amount / 1000000) + "M";
else if(amount < 1000000000)
return "." + (amount / 100000000) + "B";
else
return (amount / 1000000000) + "B+";
}
protected List<String> getTooltip(ItemStack stack) {
List<String> list = Lists.<String>newArrayList();
String s = stack.getColoredName();
if(stack.getSize() != 1)
s = TextColor.YELLOW + "" + stack.getSize() + " " + TextColor.RESET + s;
s = s + TextColor.RESET;
list.add(s);
stack.getItem().addInformation(stack, this.gm.player, list);
if(stack.getItem().canBeDyed())
list.add("Farbe: #" + Integer.toHexString(stack.getDyeColor()).toUpperCase());
if(stack.isItemEnchanted()) {
for(Entry<Enchantment, Integer> enc : stack.getEnchantments()) {
list.add(enc.getKey().getFormattedName(enc.getValue()));
}
}
int damage = stack.getItem().getAttackDamageBonus();
damage += EnchantmentHelper.getDamageModifier(stack);
if(damage != 0) {
if(damage > 0)
list.add(TextColor.BLUE + String.format("+%d Angriffsschaden", damage));
else
list.add(TextColor.RED + String.format("-%d Angriffsschaden", damage));
}
Map<Attribute, Float> mods = stack.getAttributeModifiers(null);
if(!mods.isEmpty()) {
list.add("");
for(Entry<Attribute, Float> entry : mods.entrySet()) {
float amt = entry.getValue();
if(stack.getSize() != 1) {
double total = amt * (double)stack.getSize();
if(amt > 0.0D)
list.add(TextColor.BLUE + String.format("+%s %s [%dx +%s]", DECIMALFORMAT.format(total), entry.getKey(), stack.getSize(),
DECIMALFORMAT.format(amt)));
else if(amt < 0.0D)
list.add(TextColor.RED + String.format("-%s %s [%dx -%s]", DECIMALFORMAT.format(total * -1.0), entry.getKey(), stack.getSize(),
DECIMALFORMAT.format(amt * -1.0)));
}
else {
if(amt > 0.0D)
list.add(TextColor.BLUE + String.format("+%s %s", DECIMALFORMAT.format(amt), entry.getKey()));
else if(amt < 0.0D)
list.add(TextColor.RED + String.format("-%s %s", DECIMALFORMAT.format(amt * -1.0), entry.getKey()));
}
}
}
if(stack.getItem().isDamageable()) {
list.add(String.format("Haltbarkeit: %d" + (stack.isItemDamaged() ? " / %d" : ""),
stack.isItemDamaged() ? (stack.getItem().getMaxDamage() - stack.getItemDamage()) : stack.getItem().getMaxDamage(), stack.getItem().getMaxDamage()));
}
if(stack.getRepairCost() > 0)
list.add("Reparaturkosten: " + stack.getRepairCost() + " Mana");
if(stack.getItem().getMaxAmount() == 1)
list.add("Nicht stapelbar");
else
list.add("Stapelbar bis " + stack.getItem().getMaxAmount());
list.add(TextColor.GRAY + ItemRegistry.getName(stack.getItem()));
return list;
}
public Label label(String text, int x, int y) {
x = x * 2 + this.container_x;
y = y * 2 + this.container_y;
@ -315,15 +408,15 @@ public abstract class GuiContainer extends Gui
if (this.dragSplitting && this.dragSplittingSlots.size() > 1)
{
stack = stack.copy();
stack.size = this.dragSplittingRemnant;
stack.setSize(this.dragSplittingRemnant);
if (stack.size == 0)
if (stack.isEmpty())
{
s = "" + TextColor.YELLOW + "0";
}
}
else if(stack == this.cheatStack) {
s = TextColor.DGREEN + "+" + TextColor.GREEN + ItemStack.formatAmount(stack.size);
s = TextColor.DGREEN + "+" + TextColor.GREEN + formatAmount(stack.getSize());
}
this.drawItemStack(stack, mouseX - j2, mouseY - k2, s);
@ -367,7 +460,7 @@ public abstract class GuiContainer extends Gui
}
protected void renderToolTip(ItemStack stack, int x, int y) {
List<String> list = stack.getTooltip(this.gm.player);
List<String> list = this.getTooltip(stack);
StringBuilder sb = new StringBuilder();
for(int i = 0; i < list.size(); ++i) {
if(i != 0)
@ -426,18 +519,18 @@ public abstract class GuiContainer extends Gui
{
itemstack = itemstack1.copy();
flag = true;
Container.computeStackSize(this.dragSplittingSlots, this.dragSplittingLimit, itemstack, slotIn.getStack() == null ? 0 : slotIn.getStack().size);
Container.computeStackSize(this.dragSplittingSlots, this.dragSplittingLimit, itemstack, slotIn.getStack() == null ? 0 : slotIn.getStack().getSize());
if (itemstack.size > itemstack.getMaxStackSize())
if (itemstack.getSize() > itemstack.getMaxStackSize())
{
s = TextColor.YELLOW + ItemStack.formatAmount(itemstack.getMaxStackSize());
itemstack.size = itemstack.getMaxStackSize();
s = TextColor.YELLOW + formatAmount(itemstack.getMaxStackSize());
itemstack.setSize(itemstack.getMaxStackSize());
}
if (itemstack.size > slotIn.getItemStackLimit(itemstack))
if (itemstack.getSize() > slotIn.getItemStackLimit(itemstack))
{
s = TextColor.YELLOW + ItemStack.formatAmount(slotIn.getItemStackLimit(itemstack));
itemstack.size = slotIn.getItemStackLimit(itemstack);
s = TextColor.YELLOW + formatAmount(slotIn.getItemStackLimit(itemstack));
itemstack.setSize(slotIn.getItemStackLimit(itemstack));
}
}
else
@ -462,25 +555,25 @@ public abstract class GuiContainer extends Gui
if (itemstack != null && this.dragSplitting)
{
this.dragSplittingRemnant = itemstack.size;
this.dragSplittingRemnant = itemstack.getSize();
for (Slot slot : this.dragSplittingSlots)
{
ItemStack itemstack1 = itemstack.copy();
int i = slot.getStack() == null ? 0 : slot.getStack().size;
int i = slot.getStack() == null ? 0 : slot.getStack().getSize();
Container.computeStackSize(this.dragSplittingSlots, this.dragSplittingLimit, itemstack1, i);
if (itemstack1.size > itemstack1.getMaxStackSize())
if (itemstack1.getSize() > itemstack1.getMaxStackSize())
{
itemstack1.size = itemstack1.getMaxStackSize();
itemstack1.setSize(itemstack1.getMaxStackSize());
}
if (itemstack1.size > slot.getItemStackLimit(itemstack1))
if (itemstack1.getSize() > slot.getItemStackLimit(itemstack1))
{
itemstack1.size = slot.getItemStackLimit(itemstack1);
itemstack1.setSize(slot.getItemStackLimit(itemstack1));
}
this.dragSplittingRemnant -= itemstack1.size - i;
this.dragSplittingRemnant -= itemstack1.getSize() - i;
}
}
}
@ -507,7 +600,7 @@ public abstract class GuiContainer extends Gui
if(this.cheatStack != null) {
Slot slot = this.getSlotAtPosition(mouseX, mouseY);
if((mouseButton == 0 || mouseButton == 1) && slot != null && this.gm.player != null && slot.canCheatItem())
this.gm.player.client.addToSendQueue(new CPacketCheat(this.cheatStack.getItem(), slot.slotNumber, mouseButton == 0 && this.cheatStack.size > 1));
this.gm.player.client.addToSendQueue(new CPacketCheat(this.cheatStack.getItem(), slot.slotNumber, mouseButton == 0 && this.cheatStack.isStacked()));
if(mouseButton != 1 && !this.gm.ctrl())
this.cheatStack = null;
return;
@ -605,7 +698,7 @@ public abstract class GuiContainer extends Gui
Slot slot = this.getSlotAtPosition(mouseX, mouseY);
ItemStack itemstack = this.gm.player.inventory.getItemStack();
if (this.dragSplitting && slot != null && itemstack != null && itemstack.size > this.dragSplittingSlots.size() && Container.canAddItemToSlot(slot, itemstack, true) && slot.isItemValid(itemstack) && this.inventorySlots.canDragIntoSlot(slot))
if (this.dragSplitting && slot != null && itemstack != null && itemstack.getSize() > this.dragSplittingSlots.size() && Container.canAddItemToSlot(slot, itemstack, true) && slot.isItemValid(itemstack) && this.inventorySlots.canDragIntoSlot(slot))
{
this.dragSplittingSlots.add(slot);
this.updateDragSplitting();
@ -772,13 +865,13 @@ public abstract class GuiContainer extends Gui
{
if (stack != null)
{
if (stack.size != 1 || text != null)
if (stack.getSize() != 1 || text != null)
{
String s = text == null ? ItemStack.formatAmount(stack.size) : text;
String s = text == null ? formatAmount(stack.getSize()) : text;
if (text == null && stack.size < 1)
if (text == null && stack.isEmpty())
{
s = TextColor.RED + ItemStack.formatAmount(stack.size);
s = TextColor.RED + formatAmount(stack.getSize());
}
Drawing.drawTextRight(s, xPosition + 32, yPosition + 33 - Font.YGLYPH, 0xffffffff);
}
@ -855,7 +948,7 @@ public abstract class GuiContainer extends Gui
if(!this.cheatLast.isBlank() && this.gm.player != null) {
for(Iterator<ItemStack> iter = ITEM_LIST.iterator(); iter.hasNext();) {
ItemStack stack = iter.next();
for(String line : stack.getTooltip(this.gm.player)) {
for(String line : this.getTooltip(stack)) {
if(line.toLowerCase().contains(this.cheatLast.toLowerCase())) {
stack = null;
break;
@ -888,8 +981,7 @@ public abstract class GuiContainer extends Gui
this.gm.player.client.addToSendQueue(new CPacketCheat(ITEM_LIST.get(idx).getItem(), slot < 0 ? slot : -2 - slot, full));
}
else {
this.cheatStack = ITEM_LIST.get(idx).copy();
this.cheatStack.size = full ? this.cheatStack.getMaxStackSize() : 1;
this.cheatStack = ITEM_LIST.get(idx).copy(full ? ITEM_LIST.get(idx).getMaxStackSize() : 1);
}
return true;
}

View file

@ -139,7 +139,7 @@ public class EntityRenderer {
float shift = light * (1.0F - dist) + dist;
this.fogMult += (shift - this.fogMult) * 0.1F;
++this.rendererUpdateCount;
this.itemRenderer.updateEquippedItem();
this.itemRenderer.update();
this.addRainParticles();
// this.bossColorModifierPrev = this.bossColorModifier;
//

View file

@ -34,19 +34,13 @@ public class ItemRenderer
private static final Vec3 LIGHT0_POS = (new Vec3(0.20000000298023224D, 1.0D, -0.699999988079071D)).normalize();
private static final Vec3 LIGHT1_POS = (new Vec3(-0.20000000298023224D, 1.0D, 0.699999988079071D)).normalize();
/** A reference to the Game object. */
private final Client gm;
private ItemStack itemToRender;
/**
* How far the current item has been equipped (0 disequipped and 1 fully up)
*/
private float equippedProgress;
private float prevEquippedProgress;
private final RenderManager renderManager;
private final RenderItem itemRenderer;
/** The index of the currently held item (0-8, or -1 if not yet updated) */
private ItemStack itemToRender;
private float equippedProgress;
private float prevEquippedProgress;
private int equippedItemSlot = -1;
private static FloatBuffer setColorBuffer(float r, float g, float b, float a)
@ -136,19 +130,11 @@ public class ItemRenderer
}
}
/**
* Returns true if given block is translucent
*/
private boolean isBlockTranslucent(Block blockIn)
{
return blockIn != null && blockIn.getBlockLayer() == BlockLayer.TRANSLUCENT;
}
/**
* Rotate the render around X and Y
*
* @param angleY The angle for the rotation arround Y
*/
private void rotateArroundXAndY(float angle, float angleY)
{
GL11.glPushMatrix();
@ -158,9 +144,6 @@ public class ItemRenderer
GL11.glPopMatrix();
}
/**
* Set the OpenGL LightMapTextureCoords based on the EntityNPCClient
*/
private void setLightMapFromPlayer(EntityNPC clientPlayer)
{
int i = this.gm.world.getCombinedLight(new BlockPos(clientPlayer.posX, clientPlayer.posY + (double)clientPlayer.getEyeHeight(), clientPlayer.posZ), 0);
@ -169,9 +152,6 @@ public class ItemRenderer
GL13.glMultiTexCoord2f(GL13.GL_TEXTURE1, f, f1);
}
/**
* Rotate the render according to the player's yaw and pitch
*/
private void rotateWithPlayerRotations(EntityNPC entityplayerspIn, float partialTicks)
{
float f = entityplayerspIn.prevRenderArmPitch + (entityplayerspIn.renderArmPitch - entityplayerspIn.prevRenderArmPitch) * partialTicks;
@ -180,11 +160,6 @@ public class ItemRenderer
GL11.glRotatef((entityplayerspIn.rotYaw - f1) * 0.1F, 0.0F, 1.0F, 0.0F);
}
/**
* Return the angle to render the Map
*
* @param pitch The player's pitch
*/
private float getMapAngleFromPitch(float pitch)
{
float f = 1.0F - pitch / 45.0F + 0.1F;
@ -273,12 +248,6 @@ public class ItemRenderer
// }
// }
/**
* Render the player's arm
*
* @param equipProgress The progress of equiping the item
* @param swingProgress The swing movement progression
*/
private void renderPlayerArm(EntityNPC clientPlayer, float equipProgress, float swingProgress)
{
float f = -0.3F * ExtMath.sin(ExtMath.sqrtf(swingProgress) * (float)Math.PI);
@ -305,11 +274,6 @@ public class ItemRenderer
GlState.enableCull();
}
/**
* Rotate and translate render to show item consumption
*
* @param swingProgress The swing movement progress
*/
private void doItemUsedTransformations(float swingProgress)
{
float f = -0.4F * ExtMath.sin(ExtMath.sqrtf(swingProgress) * (float)Math.PI);
@ -318,33 +282,25 @@ public class ItemRenderer
GL11.glTranslatef(f, f1, f2);
}
// /**
// * Perform the drinking animation movement
// *
// * @param partialTicks Partials ticks
// */
// private void performDrinking(EntityNPCSP 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;
// }
//
// SKC.glTranslatef(0.0F, f2, 0.0F);
// float f3 = 1.0F - (float)Math.pow((double)f1, 27.0D);
// SKC.glTranslatef(f3 * 0.6F, f3 * -0.5F, f3 * 0.0F);
// SKC.glRotatef(f3 * 90.0F, 0.0F, 1.0F, 0.0F);
// SKC.glRotatef(f3 * 10.0F, 1.0F, 0.0F, 0.0F);
// SKC.glRotatef(f3 * 30.0F, 0.0F, 0.0F, 1.0F);
// }
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;
}
GL11.glTranslatef(0.0F, f2, 0.0F);
float f3 = 1.0F - (float)Math.pow((double)f1, 27.0D);
GL11.glTranslatef(f3 * 0.6F, f3 * -0.5F, f3 * 0.0F);
GL11.glRotatef(f3 * 90.0F, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(f3 * 10.0F, 1.0F, 0.0F, 0.0F);
GL11.glRotatef(f3 * 30.0F, 0.0F, 0.0F, 1.0F);
}
/**
* Performs transformations prior to the rendering of a held item in first person.
*/
private void transformFirstPersonItem(float equipProgress, float swingProgress)
{
GL11.glTranslatef(0.56F, -0.52F, -0.71999997F);
@ -358,11 +314,6 @@ public class ItemRenderer
GL11.glScalef(0.4F, 0.4F, 0.4F);
}
/**
* Translate and rotate the render to look like holding a bow
*
* @param partialTicks Partial ticks
*/
private void doBowTransformations(float partialTicks, EntityNPC clientPlayer)
{
GL11.glRotatef(-18.0F, 0.0F, 0.0F, 1.0F);
@ -390,9 +341,6 @@ public class ItemRenderer
GL11.glScalef(1.0F, 1.0F, 1.0F + f1 * 0.2F);
}
/**
* Translate and rotate the render for holding a block
*/
private void doBlockTransformations()
{
GL11.glTranslatef(-0.5F, 0.2F, 0.0F);
@ -401,9 +349,6 @@ public class ItemRenderer
GL11.glRotatef(60.0F, 0.0F, 1.0F, 0.0F);
}
/**
* Renders the active item in the player's hand when in first person mode. Args: partialTickTime
*/
public void renderItemInFirstPerson(float partialTicks)
{
float f = 1.0F - (this.prevEquippedProgress + (this.equippedProgress - this.prevEquippedProgress) * partialTicks);
@ -419,11 +364,6 @@ public class ItemRenderer
if (this.itemToRender != null)
{
// if (this.itemToRender.getItem() == Items.filled_map)
// {
// this.renderItemMap(clientplayer, f2, f, f1);
// }
// else
if (clientplayer.getItemInUseCount() > 0)
{
ItemAction enumaction = this.itemToRender.getItemUseAction();
@ -436,9 +376,9 @@ public class ItemRenderer
case EAT:
case DRINK:
// this.performDrinking(clientplayer, partialTicks);
// this.transformFirstPersonItem(f, 0.0F);
// break;
this.performDrinking(clientplayer, partialTicks);
this.transformFirstPersonItem(f, 0.0F);
break;
case BLOCK:
this.transformFirstPersonItem(f, 0.0F);
@ -458,7 +398,7 @@ public class ItemRenderer
this.renderItem(clientplayer, this.itemToRender, Transforms.Camera.FIRST_PERSON);
}
else // if (!clientplayer.isInvisible())
else
{
this.renderPlayerArm(clientplayer, f, f1);
}
@ -468,9 +408,6 @@ public class ItemRenderer
ItemRenderer.disableStandardItemLighting();
}
/**
* Renders all the overlays that are in first person mode. Args: partialTickTime
*/
public void renderOverlays(float partialTicks)
{
GlState.disableAlpha();
@ -496,27 +433,20 @@ public class ItemRenderer
if (iblockstate.getBlock().getRenderType() != -1)
{
this.renderBlockInHand(partialTicks, this.gm.getBlockRendererDispatcher().getModelManager().getTexture(iblockstate));
this.renderBlockInside(partialTicks, this.gm.getBlockRendererDispatcher().getModelManager().getTexture(iblockstate));
}
}
if(this.gm.player.isBurning()) {
this.renderFireInFirstPerson(partialTicks);
this.renderFireOverlay(partialTicks);
}
GlState.enableAlpha();
}
/**
* Render the block in the player's hand
*
* @param partialTicks Partial ticks
* @param atlas The TextureAtlasSprite to render
*/
private void renderBlockInHand(float partialTicks, TextureAtlasSprite atlas)
private void renderBlockInside(float partialTicks, TextureAtlasSprite atlas)
{
this.gm.getTextureManager().bindTexture(TextureMap.BLOCKS);
// Tessellator tessellator = Tessellator.getInstance();
RenderBuffer worldrenderer = Tessellator.getBuffer();
float f = 0.1F;
GlState.color(0.1F, 0.1F, 0.1F, 0.5F);
@ -540,14 +470,8 @@ public class ItemRenderer
GlState.color(1.0F, 1.0F, 1.0F, 1.0F);
}
/**
* Renders the fire on the screen for first person mode. Arg: partialTickTime
*
* @param partialTicks Partial ticks
*/
private void renderFireInFirstPerson(float partialTicks)
private void renderFireOverlay(float partialTicks)
{
// Tessellator tessellator = Tessellator.getInstance();
RenderBuffer worldrenderer = Tessellator.getBuffer();
GlState.color(1.0F, 1.0F, 1.0F, 0.9F);
GlState.depthFunc(GL11.GL_ALWAYS);
@ -587,7 +511,7 @@ public class ItemRenderer
GlState.depthFunc(GL11.GL_LEQUAL);
}
public void updateEquippedItem()
public void update()
{
this.prevEquippedProgress = this.equippedProgress;
EntityNPC entityplayer = this.gm.player;
@ -596,7 +520,7 @@ public class ItemRenderer
if (this.itemToRender != null && itemstack != null)
{
if (!this.itemToRender.getIsItemStackEqual(itemstack))
if (!this.itemToRender.allEquals(itemstack))
{
flag = true;
}
@ -622,18 +546,7 @@ public class ItemRenderer
}
}
/**
* Resets equippedProgress
*/
public void resetEquippedProgress()
{
this.equippedProgress = 0.0F;
}
/**
* Resets equippedProgress
*/
public void resetEquippedProgress2()
public void resetProgress()
{
this.equippedProgress = 0.0F;
}

View file

@ -37,7 +37,7 @@ public class RenderEntityItem extends Render<EntityItem>
else
{
boolean flag = p_177077_9_.isGui3d();
int i = this.func_177078_a(itemstack);
int i = this.getMultiplier(itemstack);
float f = 0.25F;
float f1 = ExtMath.sin(((float)itemIn.getAge() + p_177077_8_) / 10.0F + itemIn.hoverStart) * 0.1F + 0.1F;
float f2 = p_177077_9_.getTransforms().get(Transforms.Camera.GROUND).scale();
@ -62,23 +62,23 @@ public class RenderEntityItem extends Render<EntityItem>
}
}
private int func_177078_a(ItemStack stack)
private int getMultiplier(ItemStack stack)
{
int i = 1;
if (stack.size > 48)
if (stack.getSize() > 48)
{
i = 5;
}
else if (stack.size > 32)
else if (stack.getSize() > 32)
{
i = 4;
}
else if (stack.size > 16)
else if (stack.getSize() > 16)
{
i = 3;
}
else if (stack.size > 1)
else if (stack.getSize() > 1)
{
i = 2;
}

View file

@ -62,9 +62,9 @@ public class PlayerController {
ItemStack stack = this.gm.player.getCurrentEquippedItem();
if(stack != null) {
stack.onBlockDestroyed(world, block, pos, this.gm.player);
stack.getItem().onBlockDestroyed(stack, world, block, pos, this.gm.player);
if(stack.size == 0) {
if(stack.isEmpty()) {
this.gm.player.destroyCurrentEquippedItem();
}
}
@ -189,7 +189,7 @@ public class PlayerController {
if(this.stack != null && stack != null) {
flag = stack.getItem() == this.stack.getItem()
&& ItemStack.areItemStackTagsEqual(stack, this.stack);
&& ItemStack.dataEquals(stack, this.stack);
}
return pos.equals(this.position) && flag;
@ -243,7 +243,7 @@ public class PlayerController {
return false;
}
else {
return stack.onItemUse(player, world, pos, side, f, f1, f2);
return stack.getItem().onItemUse(stack, player, world, pos, side, f, f1, f2);
}
}
else {
@ -255,13 +255,13 @@ public class PlayerController {
public boolean sendUseItem(EntityNPC player, World world, ItemStack stack) {
this.syncItem();
this.handler.addToSendQueue(new CPacketPlace(player.inventory.getCurrentItem()));
int size = stack.size;
ItemStack changed = stack.useItemRightClick(world, player);
int size = stack.getSize();
ItemStack changed = stack.getItem().onItemRightClick(stack, world, player);
if(changed != stack || changed != null && changed.size != size) {
if(changed != stack || changed != null && changed.getSize() != size) {
player.inventory.mainInventory[player.inventory.currentItem] = changed;
if(changed.size == 0) {
if(changed.isEmpty()) {
player.inventory.mainInventory[player.inventory.currentItem] = null;
}