Update MCP mappings to snapshot_nodoc_20161220 (#3551)

This commit is contained in:
James Mitchell authored and LexManos committed 2016-12-21 15:52:30 -08:00
1 parent 1f4007e5d8
commit 5165dc52bf
88 files changed
+445 -436

No files matched your search

@@ -94,20 +94,20 @@ public class ClientCommandHandler extends CommandHandler
}
else
{
sender.addChatMessage(format(RED, "commands.generic.permission"));
sender.sendMessage(format(RED, "commands.generic.permission"));
}
}
catch (WrongUsageException wue)
{
sender.addChatMessage(format(RED, "commands.generic.usage", format(RED, wue.getMessage(), wue.getErrorObjects())));
sender.sendMessage(format(RED, "commands.generic.usage", format(RED, wue.getMessage(), wue.getErrorObjects())));
}
catch (CommandException ce)
{
sender.addChatMessage(format(RED, ce.getMessage(), ce.getErrorObjects()));
sender.sendMessage(format(RED, ce.getMessage(), ce.getErrorObjects()));
}
catch (Throwable t)
{
sender.addChatMessage(format(RED, "commands.generic.exception"));
sender.sendMessage(format(RED, "commands.generic.exception"));
t.printStackTrace();
}
@@ -133,7 +133,7 @@ public class ClientCommandHandler extends CommandHandler
Minecraft mc = FMLClientHandler.instance().getClient();
if (mc.currentScreen instanceof GuiChat)
{
List<String> commands = getTabCompletionOptions(mc.thePlayer, leftOfCursor, mc.thePlayer.getPosition());
List<String> commands = getTabCompletions(mc.player, leftOfCursor, mc.player.getPosition());
if (commands != null && !commands.isEmpty())
{
if (leftOfCursor.indexOf(' ') == -1)
@@ -263,7 +263,7 @@ public class ForgeHooksClient
int distance = 0;
if (settings.fancyGraphics && ranges.length > 0)
{
distance = ranges[MathHelper.clamp_int(settings.renderDistanceChunks, 0, ranges.length-1)];
distance = ranges[MathHelper.clamp(settings.renderDistanceChunks, 0, ranges.length-1)];
}
int r = 0;
@@ -672,8 +672,8 @@ public class ForgeHooksClient
public static boolean shouldCauseReequipAnimation(@Nonnull ItemStack from, @Nonnull ItemStack to, int slot)
{
boolean fromInvalid = from.func_190926_b();
boolean toInvalid = to.func_190926_b();
boolean fromInvalid = from.isEmpty();
boolean toInvalid = to.isEmpty();
if (fromInvalid && toInvalid) return false;
if (fromInvalid || toInvalid) return true;
@@ -107,9 +107,9 @@ public class GuiIngameForge extends GuiIngame
eventParent = new RenderGameOverlayEvent(partialTicks, res);
int width = res.getScaledWidth();
int height = res.getScaledHeight();
renderHealthMount = mc.thePlayer.getRidingEntity() instanceof EntityLivingBase;
renderFood = mc.thePlayer.getRidingEntity() == null;
renderJumpBar = mc.thePlayer.isRidingHorse();
renderHealthMount = mc.player.getRidingEntity() instanceof EntityLivingBase;
renderFood = mc.player.getRidingEntity() == null;
renderJumpBar = mc.player.isRidingHorse();
right_height = 39;
left_height = 39;
@@ -122,7 +122,7 @@ public class GuiIngameForge extends GuiIngame
if (Minecraft.isFancyGraphicsEnabled())
{
renderVignette(mc.thePlayer.getBrightness(partialTicks), res);
renderVignette(mc.player.getBrightness(partialTicks), res);
}
else
{
@@ -132,7 +132,7 @@ public class GuiIngameForge extends GuiIngame
if (renderHelmet) renderHelmet(res, partialTicks);
if (renderPortal && !mc.thePlayer.isPotionActive(MobEffects.NAUSEA))
if (renderPortal && !mc.player.isPotionActive(MobEffects.NAUSEA))
{
renderPortal(res, partialTicks);
}
@@ -176,9 +176,9 @@ public class GuiIngameForge extends GuiIngame
renderTitle(width, height, partialTicks);
Scoreboard scoreboard = this.mc.theWorld.getScoreboard();
Scoreboard scoreboard = this.mc.world.getScoreboard();
ScoreObjective objective = null;
ScorePlayerTeam scoreplayerteam = scoreboard.getPlayersTeam(mc.thePlayer.getName());
ScorePlayerTeam scoreplayerteam = scoreboard.getPlayersTeam(mc.player.getName());
if (scoreplayerteam != null)
{
int slot = scoreplayerteam.getChatFormat().getColorIndex();
@@ -251,7 +251,7 @@ public class GuiIngameForge extends GuiIngame
{
if (pre(HELMET)) return;
ItemStack itemstack = this.mc.thePlayer.inventory.armorItemInSlot(3);
ItemStack itemstack = this.mc.player.inventory.armorItemInSlot(3);
if (this.mc.gameSettings.thirdPersonView == 0 && itemstack != null && itemstack.getItem() != null)
{
@@ -261,7 +261,7 @@ public class GuiIngameForge extends GuiIngame
}
else
{
itemstack.getItem().renderHelmetOverlay(itemstack, mc.thePlayer, res, partialTicks);
itemstack.getItem().renderHelmetOverlay(itemstack, mc.player, res, partialTicks);
}
}
@@ -277,7 +277,7 @@ public class GuiIngameForge extends GuiIngame
int left = width / 2 - 91;
int top = height - left_height;
int level = ForgeHooks.getTotalArmorValue(mc.thePlayer);
int level = ForgeHooks.getTotalArmorValue(mc.player);
for (int i = 1; level > 0 && i < 20; i += 2)
{
if (i < level)
@@ -305,7 +305,7 @@ public class GuiIngameForge extends GuiIngame
{
if (pre(PORTAL)) return;
float f1 = mc.thePlayer.prevTimeInPortal + (mc.thePlayer.timeInPortal - mc.thePlayer.prevTimeInPortal) * partialTicks;
float f1 = mc.player.prevTimeInPortal + (mc.player.timeInPortal - mc.player.prevTimeInPortal) * partialTicks;
if (f1 > 0.0F)
{
@@ -344,8 +344,8 @@ public class GuiIngameForge extends GuiIngame
if (player.isInsideOfMaterial(Material.WATER))
{
int air = player.getAir();
int full = MathHelper.ceiling_double_int((double)(air - 2) * 10.0D / 300.0D);
int partial = MathHelper.ceiling_double_int((double)air * 10.0D / 300.0D) - full;
int full = MathHelper.ceil((double)(air - 2) * 10.0D / 300.0D);
int partial = MathHelper.ceil((double)air * 10.0D / 300.0D) - full;
for (int i = 0; i < full + partial; ++i)
{
@@ -367,7 +367,7 @@ public class GuiIngameForge extends GuiIngame
GlStateManager.enableBlend();
EntityPlayer player = (EntityPlayer)this.mc.getRenderViewEntity();
int health = MathHelper.ceiling_float_int(player.getHealth());
int health = MathHelper.ceil(player.getHealth());
boolean highlight = healthUpdateCounter > (long)updateCounter && (healthUpdateCounter - (long)updateCounter) / 3L %2L == 1L;
if (health < this.playerHealth && player.hurtResistantTime > 0)
@@ -393,9 +393,9 @@ public class GuiIngameForge extends GuiIngame
IAttributeInstance attrMaxHealth = player.getEntityAttribute(SharedMonsterAttributes.MAX_HEALTH);
float healthMax = (float)attrMaxHealth.getAttributeValue();
float absorb = MathHelper.ceiling_float_int(player.getAbsorptionAmount());
float absorb = MathHelper.ceil(player.getAbsorptionAmount());
int healthRows = MathHelper.ceiling_float_int((healthMax + absorb) / 2.0F / 10.0F);
int healthRows = MathHelper.ceil((healthMax + absorb) / 2.0F / 10.0F);
int rowHeight = Math.max(10 - (healthRows - 2), 3);
this.rand.setSeed((long)(updateCounter * 312871));
@@ -411,17 +411,17 @@ public class GuiIngameForge extends GuiIngame
regen = updateCounter % 25;
}
final int TOP = 9 * (mc.theWorld.getWorldInfo().isHardcoreModeEnabled() ? 5 : 0);
final int TOP = 9 * (mc.world.getWorldInfo().isHardcoreModeEnabled() ? 5 : 0);
final int BACKGROUND = (highlight ? 25 : 16);
int MARGIN = 16;
if (player.isPotionActive(MobEffects.POISON)) MARGIN += 36;
else if (player.isPotionActive(MobEffects.WITHER)) MARGIN += 72;
float absorbRemaining = absorb;
for (int i = MathHelper.ceiling_float_int((healthMax + absorb) / 2.0F) - 1; i >= 0; --i)
for (int i = MathHelper.ceil((healthMax + absorb) / 2.0F) - 1; i >= 0; --i)
{
//int b0 = (highlight ? 1 : 0);
int row = MathHelper.ceiling_float_int((float)(i + 1) / 10.0F) - 1;
int row = MathHelper.ceil((float)(i + 1) / 10.0F) - 1;
int x = left + i % 10 * 8;
int y = top - row * rowHeight;
@@ -477,7 +477,7 @@ public class GuiIngameForge extends GuiIngame
right_height += 10;
boolean unused = false;// Unused flag in vanilla, seems to be part of a 'fade out' mechanic
FoodStats stats = mc.thePlayer.getFoodStats();
FoodStats stats = mc.player.getFoodStats();
int level = stats.getFoodLevel();
for (int i = 0; i < 10; ++i)
@@ -488,7 +488,7 @@ public class GuiIngameForge extends GuiIngame
int icon = 16;
byte background = 0;
if (mc.thePlayer.isPotionActive(MobEffects.HUNGER))
if (mc.player.isPotionActive(MobEffects.HUNGER))
{
icon += 36;
background = 13;
@@ -514,12 +514,12 @@ public class GuiIngameForge extends GuiIngame
protected void renderSleepFade(int width, int height)
{
if (mc.thePlayer.getSleepTimer() > 0)
if (mc.player.getSleepTimer() > 0)
{
mc.mcProfiler.startSection("sleep");
GlStateManager.disableDepth();
GlStateManager.disableAlpha();
int sleepTime = mc.thePlayer.getSleepTimer();
int sleepTime = mc.player.getSleepTimer();
float opacity = (float)sleepTime / 100.0F;
if (opacity > 1.0F)
@@ -545,13 +545,13 @@ public class GuiIngameForge extends GuiIngame
if (mc.playerController.gameIsSurvivalOrAdventure())
{
mc.mcProfiler.startSection("expBar");
int cap = this.mc.thePlayer.xpBarCap();
int cap = this.mc.player.xpBarCap();
int left = width / 2 - 91;
if (cap > 0)
{
short barWidth = 182;
int filled = (int)(mc.thePlayer.experience * (float)(barWidth + 1));
int filled = (int)(mc.player.experience * (float)(barWidth + 1));
int top = height - 32 + 3;
drawTexturedModalRect(left, top, 0, 64, barWidth, 5);
@@ -564,12 +564,12 @@ public class GuiIngameForge extends GuiIngame
this.mc.mcProfiler.endSection();
if (mc.playerController.gameIsSurvivalOrAdventure() && mc.thePlayer.experienceLevel > 0)
if (mc.playerController.gameIsSurvivalOrAdventure() && mc.player.experienceLevel > 0)
{
mc.mcProfiler.startSection("expLevel");
boolean flag1 = false;
int color = flag1 ? 16777215 : 8453920;
String text = "" + mc.thePlayer.experienceLevel;
String text = "" + mc.player.experienceLevel;
int x = (width - fontrenderer.getStringWidth(text)) / 2;
int y = height - 31 - 4;
fontrenderer.drawString(text, x + 1, y, 0);
@@ -594,7 +594,7 @@ public class GuiIngameForge extends GuiIngame
GlStateManager.disableBlend();
mc.mcProfiler.startSection("jumpBar");
float charge = mc.thePlayer.getHorseJumpPower();
float charge = mc.player.getHorseJumpPower();
final int barWidth = 182;
int x = (width / 2) - (barWidth / 2);
int filled = (int)(charge * (float)(barWidth + 1));
@@ -657,7 +657,7 @@ public class GuiIngameForge extends GuiIngame
mc.mcProfiler.endSection();
}
else if (this.mc.thePlayer.isSpectator())
else if (this.mc.player.isSpectator())
{
this.spectatorGui.renderSelectedItem(res);
}
@@ -672,7 +672,7 @@ public class GuiIngameForge extends GuiIngame
if (mc.isDemo())
{
long time = mc.theWorld.getTotalWorldTime();
long time = mc.world.getTotalWorldTime();
if (time >= 120500L)
{
listR.add(I18n.format("demo.demoExpired"));
@@ -729,10 +729,10 @@ public class GuiIngameForge extends GuiIngame
protected void renderRecordOverlay(int width, int height, float partialTicks)
{
if (recordPlayingUpFor > 0)
if (overlayMessageTime > 0)
{
mc.mcProfiler.startSection("overlayMessage");
float hue = (float)recordPlayingUpFor - partialTicks;
float hue = (float)overlayMessageTime - partialTicks;
int opacity = (int)(hue * 256.0F / 20.0F);
if (opacity > 255) opacity = 255;
@@ -742,8 +742,8 @@ public class GuiIngameForge extends GuiIngame
GlStateManager.translate((float)(width / 2), (float)(height - 68), 0.0F);
GlStateManager.enableBlend();
GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO);
int color = (recordIsPlaying ? Color.HSBtoRGB(hue / 50.0F, 0.7F, 0.6F) & WHITE : WHITE);
fontrenderer.drawString(recordPlaying, -fontrenderer.getStringWidth(recordPlaying) / 2, -4, color | (opacity << 24));
int color = (animateOverlayMessageColor ? Color.HSBtoRGB(hue / 50.0F, 0.7F, 0.6F) & WHITE : WHITE);
fontrenderer.drawString(overlayMessage, -fontrenderer.getStringWidth(overlayMessage) / 2, -4, color | (opacity << 24));
GlStateManager.disableBlend();
GlStateManager.popMatrix();
}
@@ -767,7 +767,7 @@ public class GuiIngameForge extends GuiIngame
}
if (titlesTimer <= titleFadeOut) opacity = (int)(age * 255.0F / (float)this.titleFadeOut);
opacity = MathHelper.clamp_int(opacity, 0, 255);
opacity = MathHelper.clamp(opacity, 0, 255);
if (opacity > 8)
{
@@ -811,14 +811,14 @@ public class GuiIngameForge extends GuiIngame
protected void renderPlayerList(int width, int height)
{
ScoreObjective scoreobjective = this.mc.theWorld.getScoreboard().getObjectiveInDisplaySlot(0);
NetHandlerPlayClient handler = mc.thePlayer.connection;
ScoreObjective scoreobjective = this.mc.world.getScoreboard().getObjectiveInDisplaySlot(0);
NetHandlerPlayClient handler = mc.player.connection;
if (mc.gameSettings.keyBindPlayerList.isKeyDown() && (!mc.isIntegratedServerRunning() || handler.getPlayerInfoMap().size() > 1 || scoreobjective != null))
{
this.overlayPlayerList.updatePlayerList(true);
if (pre(PLAYER_LIST)) return;
this.overlayPlayerList.renderPlayerlist(width, this.mc.theWorld.getScoreboard(), scoreobjective);
this.overlayPlayerList.renderPlayerlist(width, this.mc.world.getScoreboard(), scoreobjective);
post(PLAYER_LIST);
}
else
@@ -177,7 +177,7 @@ public final class ModelFluid implements IModelCustomData
if(flow == null) flow = -1000f;
}
int flowRound = (int)Math.round(Math.toDegrees(flow));
flowRound = MathHelper.clamp_int(flowRound, -1000, 1000);
flowRound = MathHelper.clamp(flowRound, -1000, 1000);
return flowRound;
}
@@ -73,11 +73,11 @@ public final class AnimationItemOverrideList extends ItemOverrideList
IAnimationStateMachine asm = stack.getCapability(CapabilityAnimation.ANIMATION_CAPABILITY, null);
if(world == null && entity != null)
{
world = entity.worldObj;
world = entity.world;
}
if(world == null)
{
world = Minecraft.getMinecraft().theWorld;
world = Minecraft.getMinecraft().world;
}
IModelState state = asm.apply(Animation.getWorldTime(world, Animation.getPartialTickTime())).getLeft();
return model.bake(new ModelStateComposition(state, this.state), format, bakedTextureGetter);
@@ -88,7 +88,7 @@ public class AnimationModelBase<T extends Entity> extends ModelBase implements I
VertexBuffer.setTranslation(-0.5, -1.5, -0.5);
lighter.setParent(new VertexBufferConsumer(VertexBuffer));
lighter.setWorld(entity.worldObj);
lighter.setWorld(entity.world);
lighter.setState(Blocks.AIR.getDefaultState());
lighter.setBlockPos(pos);
boolean empty = true;
@@ -54,7 +54,7 @@ public class AnimationTESR<T extends TileEntity> extends FastTESR<T> implements
BlockPos pos = te.getPos();
IBlockAccess world = MinecraftForgeClient.getRegionRenderCache(te.getWorld(), pos);
IBlockState state = world.getBlockState(pos);
if(state.getPropertyNames().contains(Properties.StaticProperty))
if(state.getPropertyKeys().contains(Properties.StaticProperty))
{
state = state.withProperty(Properties.StaticProperty, false);
}
@@ -330,7 +330,7 @@ public class ModelBlockAnimation
{
int length = loop ? var.samples.length : (var.samples.length - 1);
float timeScaled = time * length;
int s1 = MathHelper.clamp_int((int)Math.round(Math.floor(timeScaled)), 0, length - 1);
int s1 = MathHelper.clamp((int)Math.round(Math.floor(timeScaled)), 0, length - 1);
float progress = timeScaled - s1;
int s2 = s1 + 1;
if(s2 == length && loop) s2 = 0;
@@ -190,7 +190,7 @@ public enum B3DLoader implements ICustomModelLoader
this.animation = animation;
this.frame = frame;
this.nextFrame = nextFrame;
this.progress = MathHelper.clamp_float(progress, 0, 1);
this.progress = MathHelper.clamp(progress, 0, 1);
this.parent = getParent(parent);
}
@@ -175,7 +175,7 @@ public class VertexLighterSmoothAo extends VertexLighterFlat
a += ao[sx - 0][sy - 0][sz - 1] * (0 + x) * (0 + y) * (1 - z);
a += ao[sx - 0][sy - 0][sz - 0] * (0 + x) * (0 + y) * (0 + z);
a = MathHelper.clamp_float(a, 0, 1);
a = MathHelper.clamp(a, 0, 1);
return a;
}
@@ -204,7 +204,7 @@ public class DimensionManager
tmp.add(entry.getValue());
}
server.worldServers = tmp.toArray(new WorldServer[tmp.size()]);
server.worlds = tmp.toArray(new WorldServer[tmp.size()]);
}
public static void initDimension(int dim)
@@ -84,7 +84,7 @@ import com.google.common.collect.Sets;
* The basic principle is a ticket based system.
* 1. Mods register a callback {@link #setForcedChunkLoadingCallback(Object, LoadingCallback)}
* 2. Mods ask for a ticket {@link #requestTicket(Object, World, Type)} and then hold on to that ticket.
* 3. Mods request chunks to stay loaded {@link #forceChunk(Ticket, ChunkCoordIntPair)} or remove chunks from force loading {@link #unforceChunk(Ticket, ChunkCoordIntPair)}.
* 3. Mods request chunks to stay loaded {@link #forceChunk(Ticket, ChunkPos)} or remove chunks from force loading {@link #unforceChunk(Ticket, ChunkPos)}.
* 4. When a world unloads, the tickets associated with that world are saved by the chunk manager.
* 5. When a world loads, saved tickets are offered to the mods associated with the tickets. The {@link Ticket#getModData()} that is set by the mod should be used to re-register
* chunks to stay loaded (and maybe take other actions).
@@ -923,8 +923,8 @@ public class ForgeChunkManager
}
if (tick.ticketType == Type.ENTITY && tick.entity != null && tick.entity.writeToNBTOptional(new NBTTagCompound()))
{
ticket.setInteger("chunkX", MathHelper.floor_double(tick.entity.chunkCoordX));
ticket.setInteger("chunkZ", MathHelper.floor_double(tick.entity.chunkCoordZ));
ticket.setInteger("chunkX", MathHelper.floor(tick.entity.chunkCoordX));
ticket.setInteger("chunkZ", MathHelper.floor(tick.entity.chunkCoordZ));
ticket.setLong("PersistentIDMSB", tick.entity.getPersistentID().getMostSignificantBits());
ticket.setLong("PersistentIDLSB", tick.entity.getPersistentID().getLeastSignificantBits());
tickets.appendTag(ticket);
@@ -146,9 +146,9 @@ public class ForgeHooks
public static ItemStack getGrassSeed(Random rand, int fortune)
{
SeedEntry entry = WeightedRandom.getRandomItem(rand, seedList);
if (entry == null || entry.seed.func_190926_b())
if (entry == null || entry.seed.isEmpty())
{
return ItemStack.field_190927_a;
return ItemStack.EMPTY;
}
return entry.getStack(rand, fortune);
}
@@ -167,7 +167,7 @@ public class ForgeHooks
ItemStack stack = player.getHeldItemMainhand();
String tool = block.getHarvestTool(state);
if (stack.func_190926_b() || tool == null)
if (stack.isEmpty() || tool == null)
{
return player.canHarvestBlock(state);
}
@@ -186,7 +186,7 @@ public class ForgeHooks
IBlockState state = world.getBlockState(pos);
state = state.getBlock().getActualState(state, world, pos);
String tool = state.getBlock().getHarvestTool(state);
if (stack.func_190926_b() || tool == null) return false;
if (stack.isEmpty() || tool == null) return false;
return stack.getItem().getHarvestLevel(stack, tool, null, null) >= state.getBlock().getHarvestLevel(state);
}
@@ -301,14 +301,14 @@ public class ForgeHooks
public static boolean onPickBlock(RayTraceResult target, EntityPlayer player, World world)
{
/*
boolean flag = this.thePlayer.capabilities.isCreativeMode;
boolean flag = this.player.capabilities.isCreativeMode;
TileEntity tileentity = null;
ItemStack itemstack;
if (this.objectMouseOver.typeOfHit == RayTraceResult.Type.BLOCK)
{
BlockPos blockpos = this.objectMouseOver.getBlockPos();
IBlockState iblockstate = this.theWorld.getBlockState(blockpos);
IBlockState iblockstate = this.world.getBlockState(blockpos);
Block block = iblockstate.getBlock();
if (iblockstate.getMaterial() == Material.AIR)
@@ -316,16 +316,16 @@ public class ForgeHooks
return;
}
itemstack = block.getItem(this.theWorld, blockpos, iblockstate);
itemstack = block.getItem(this.world, blockpos, iblockstate);
if (itemstack.func_190926_b())
if (itemstack.isEmpty())
{
return;
}
if (flag && GuiScreen.isCtrlKeyDown() && block.hasTileEntity())
{
tileentity = this.theWorld.getTileEntity(blockpos);
tileentity = this.world.getTileEntity(blockpos);
}
}
else
@@ -348,7 +348,7 @@ public class ForgeHooks
EntityItemFrame entityitemframe = (EntityItemFrame)this.objectMouseOver.entityHit;
ItemStack itemstack1 = entityitemframe.getDisplayedItem();
if (itemstack1.func_190926_b())
if (itemstack1.isEmpty())
{
itemstack = new ItemStack(Items.ITEM_FRAME);
}
@@ -411,13 +411,13 @@ public class ForgeHooks
}
}
if (itemstack.func_190926_b())
if (itemstack.isEmpty())
{
String s = "";
if (this.objectMouseOver.typeOfHit == RayTraceResult.Type.BLOCK)
{
s = ((ResourceLocation)Block.REGISTRY.getNameForObject(this.theWorld.getBlockState(this.objectMouseOver.getBlockPos()).getBlock())).toString();
s = ((ResourceLocation)Block.REGISTRY.getNameForObject(this.world.getBlockState(this.objectMouseOver.getBlockPos()).getBlock())).toString();
}
else if (this.objectMouseOver.typeOfHit == RayTraceResult.Type.ENTITY)
{
@@ -428,7 +428,7 @@ public class ForgeHooks
}
else
{
InventoryPlayer inventoryplayer = this.thePlayer.inventory;
InventoryPlayer inventoryplayer = this.player.inventory;
if (tileentity != null)
{
@@ -440,7 +440,7 @@ public class ForgeHooks
if (flag)
{
inventoryplayer.setPickedItemStack(itemstack);
this.playerController.sendSlotPacket(this.thePlayer.getHeldItem(EnumHand.MAIN_HAND), 36 + inventoryplayer.currentItem);
this.playerController.sendSlotPacket(this.player.getHeldItem(EnumHand.MAIN_HAND), 36 + inventoryplayer.currentItem);
}
else if (i != -1)
{
@@ -483,7 +483,7 @@ public class ForgeHooks
result = target.entityHit.getPickedResult(target);
}
if (result.func_190926_b())
if (result.isEmpty())
{
return false;
}
@@ -592,9 +592,9 @@ public class ForgeHooks
else
{
AxisAlignedBB bb = entity.getEntityBoundingBox();
int mX = MathHelper.floor_double(bb.minX);
int mY = MathHelper.floor_double(bb.minY);
int mZ = MathHelper.floor_double(bb.minZ);
int mX = MathHelper.floor(bb.minX);
int mY = MathHelper.floor(bb.minY);
int mZ = MathHelper.floor(bb.minZ);
for (int y2 = mY; y2 < bb.maxY; y2++)
{
for (int x2 = mX; x2 < bb.maxX; x2++)
@@ -637,9 +637,9 @@ public class ForgeHooks
return null;
}
if (!player.worldObj.isRemote)
if (!player.world.isRemote)
{
player.getEntityWorld().spawnEntityInWorld(event.getEntityItem());
player.getEntityWorld().spawnEntity(event.getEntityItem());
}
return event.getEntityItem();
}
@@ -743,7 +743,7 @@ public class ForgeHooks
{
// Logic from tryHarvestBlock for pre-canceling the event
boolean preCancelEvent = false;
if (gameType.isCreative() && !entityPlayer.getHeldItemMainhand().func_190926_b() && entityPlayer.getHeldItemMainhand().getItem() instanceof ItemSword)
if (gameType.isCreative() && !entityPlayer.getHeldItemMainhand().isEmpty() && entityPlayer.getHeldItemMainhand().getItem() instanceof ItemSword)
preCancelEvent = true;
if (gameType.isAdventure())
@@ -754,7 +754,7 @@ public class ForgeHooks
if (!entityPlayer.isAllowEdit())
{
ItemStack itemstack = entityPlayer.getHeldItemMainhand();
if (itemstack.func_190926_b() || !itemstack.canDestroy(world.getBlockState(pos).getBlock()))
if (itemstack.isEmpty() || !itemstack.canDestroy(world.getBlockState(pos).getBlock()))
preCancelEvent = true;
}
}
@@ -797,7 +797,7 @@ public class ForgeHooks
{
// handle all placement events here
int meta = itemstack.getItemDamage();
int size = itemstack.func_190916_E();
int size = itemstack.getCount();
NBTTagCompound nbt = null;
if (itemstack.getTagCompound() != null)
{
@@ -816,7 +816,7 @@ public class ForgeHooks
{
// save new item data
int newMeta = itemstack.getItemDamage();
int newSize = itemstack.func_190916_E();
int newSize = itemstack.getCount();
NBTTagCompound newNBT = null;
if (itemstack.getTagCompound() != null)
{
@@ -829,7 +829,7 @@ public class ForgeHooks
// make sure to set pre-placement item data for event
itemstack.setItemDamage(meta);
itemstack.func_190920_e(size);
itemstack.setCount(size);
if (nbt != null)
{
itemstack.setTagCompound(nbt);
@@ -858,7 +858,7 @@ public class ForgeHooks
{
// Change the stack to its new content
itemstack.setItemDamage(newMeta);
itemstack.func_190920_e(newSize);
itemstack.setCount(newSize);
if (nbt != null)
{
itemstack.setTagCompound(newNBT);
@@ -888,7 +888,7 @@ public class ForgeHooks
{
AnvilUpdateEvent e = new AnvilUpdateEvent(left, right, name, baseCost);
if (MinecraftForge.EVENT_BUS.post(e)) return false;
if (e.getOutput().func_190926_b()) return true;
if (e.getOutput().isEmpty()) return true;
outputSlot.setInventorySlotContents(0, e.getOutput());
container.maximumCost = e.getCost();
@@ -926,7 +926,7 @@ public class ForgeHooks
*/
public static NonNullList<ItemStack> defaultRecipeGetRemainingItems(InventoryCrafting inv)
{
NonNullList<ItemStack> ret = NonNullList.func_191197_a(inv.getSizeInventory(), ItemStack.field_190927_a);
NonNullList<ItemStack> ret = NonNullList.withSize(inv.getSizeInventory(), ItemStack.EMPTY);
for (int i = 0; i < ret.size(); i++)
{
ret.set(i, getContainerItem(inv.getStackInSlot(i)));
@@ -949,26 +949,26 @@ public class ForgeHooks
if (stack.getItem().hasContainerItem(stack))
{
stack = stack.getItem().getContainerItem(stack);
if (!stack.func_190926_b() && stack.isItemStackDamageable() && stack.getMetadata() > stack.getMaxDamage())
if (!stack.isEmpty() && stack.isItemStackDamageable() && stack.getMetadata() > stack.getMaxDamage())
{
ForgeEventFactory.onPlayerDestroyItem(craftingPlayer.get(), stack, null);
return ItemStack.field_190927_a;
return ItemStack.EMPTY;
}
return stack;
}
return ItemStack.field_190927_a;
return ItemStack.EMPTY;
}
public static boolean isInsideOfMaterial(Material material, Entity entity, BlockPos pos)
{
IBlockState state = entity.worldObj.getBlockState(pos);
IBlockState state = entity.world.getBlockState(pos);
Block block = state.getBlock();
double eyes = entity.posY + (double)entity.getEyeHeight();
double filled = 1.0f; //If it's not a liquid assume it's a solid block
if (block instanceof IFluidBlock)
{
filled = ((IFluidBlock)block).getFilledPercentage(entity.worldObj, pos);
filled = ((IFluidBlock)block).getFilledPercentage(entity.world, pos);
}
else if (block instanceof BlockLiquid)
{
@@ -991,7 +991,7 @@ public class ForgeHooks
{
if (MinecraftForge.EVENT_BUS.post(new AttackEntityEvent(player, target))) return false;
ItemStack stack = player.getHeldItemMainhand();
return stack.func_190926_b() || !stack.getItem().onLeftClickEntity(stack, player, target);
return stack.isEmpty() || !stack.getItem().onLeftClickEntity(stack, player, target);
}
public static boolean onTravelToDimension(Entity entity, int dimension)
@@ -1013,7 +1013,7 @@ public class ForgeHooks
{
Vec3d startPos = new Vec3d(entity.posX, entity.posY + entity.getEyeHeight(), entity.posZ);
Vec3d endPos = startPos.add(new Vec3d(entity.getLookVec().xCoord * length, entity.getLookVec().yCoord * length, entity.getLookVec().zCoord * length));
return entity.worldObj.rayTraceBlocks(startPos, endPos);
return entity.world.rayTraceBlocks(startPos, endPos);
}
public static Vec3d rayTraceEyeHitVec(EntityLivingBase entity, double length)
@@ -53,7 +53,7 @@ public class ForgeInternalHandler
{
entity.setDead();
event.setCanceled(true);
event.getWorld().spawnEntityInWorld(newEntity);
event.getWorld().spawnEntity(newEntity);
}
}
}
@@ -124,7 +124,7 @@ public interface ISpecialArmor
for (int x = 0; x < inventory.size(); x++)
{
ItemStack stack = inventory.get(x);
if (stack.func_190926_b())
if (stack.isEmpty())
{
continue;
}
@@ -178,13 +178,13 @@ public interface ISpecialArmor
}
stack.damageItem(itemDamage, entity);
}
if (stack.func_190926_b())
if (stack.isEmpty())
{
/*if (entity instanceof EntityPlayer)
{
stack.onItemDestroyedByUse((EntityPlayer)entity);
}*/
inventory.set(prop.Slot, ItemStack.field_190927_a);
inventory.set(prop.Slot, ItemStack.EMPTY);
}
}
}
@@ -52,7 +52,7 @@ public abstract class AbstractBrewingRecipe<T> implements IBrewingRecipe {
@Nonnull
public ItemStack getOutput(@Nonnull ItemStack input, @Nonnull ItemStack ingredient)
{
return isInput(input) && isIngredient(ingredient) ? getOutput().copy() : ItemStack.field_190927_a;
return isInput(input) && isIngredient(ingredient) ? getOutput().copy() : ItemStack.EMPTY;
}
@Nonnull
@@ -90,8 +90,8 @@ public class BrewingRecipeRegistry {
@Nonnull
public static ItemStack getOutput(@Nonnull ItemStack input, @Nonnull ItemStack ingredient)
{
if (input.func_190926_b() || input.getMaxStackSize() != 1 || input.func_190916_E() != 1) return ItemStack.field_190927_a;
if (ingredient.func_190926_b()) return ItemStack.field_190927_a;
if (input.isEmpty() || input.getMaxStackSize() != 1 || input.getCount() != 1) return ItemStack.EMPTY;
if (ingredient.isEmpty()) return ItemStack.EMPTY;
for (IBrewingRecipe recipe : recipes)
{
@@ -101,7 +101,7 @@ public class BrewingRecipeRegistry {
return output;
}
}
return ItemStack.field_190927_a;
return ItemStack.EMPTY;
}
/**
@@ -109,7 +109,7 @@ public class BrewingRecipeRegistry {
*/
public static boolean hasOutput(@Nonnull ItemStack input, @Nonnull ItemStack ingredient)
{
return !getOutput(input, ingredient).func_190926_b();
return !getOutput(input, ingredient).isEmpty();
}
/**
@@ -119,7 +119,7 @@ public class BrewingRecipeRegistry {
*/
public static boolean canBrew(NonNullList<ItemStack> inputs, @Nonnull ItemStack ingredient, int[] inputIndexes)
{
if (ingredient.func_190926_b()) return false;
if (ingredient.isEmpty()) return false;
for (int i : inputIndexes)
{
@@ -141,7 +141,7 @@ public class BrewingRecipeRegistry {
for (int i : inputIndexes)
{
ItemStack output = getOutput(inputs.get(i), ingredient);
if (!output.func_190926_b())
if (!output.isEmpty())
{
inputs.set(i, output);
}
@@ -154,7 +154,7 @@ public class BrewingRecipeRegistry {
*/
public static boolean isValidIngredient(@Nonnull ItemStack stack)
{
if (stack.func_190926_b()) return false;
if (stack.isEmpty()) return false;
for (IBrewingRecipe recipe : recipes)
{
@@ -172,7 +172,7 @@ public class BrewingRecipeRegistry {
*/
public static boolean isValidInput(@Nonnull ItemStack stack)
{
if (stack.getMaxStackSize() != 1 || stack.func_190916_E() != 1) return false;
if (stack.getMaxStackSize() != 1 || stack.getCount() != 1) return false;
for (IBrewingRecipe recipe : recipes)
{
@@ -60,16 +60,16 @@ public class VanillaBrewingRecipe implements IBrewingRecipe {
@Override
public ItemStack getOutput(@Nonnull ItemStack input, @Nonnull ItemStack ingredient)
{
if (!input.func_190926_b() && !ingredient.func_190926_b() && isIngredient(ingredient))
if (!input.isEmpty() && !ingredient.isEmpty() && isIngredient(ingredient))
{
ItemStack result = PotionHelper.doReaction(ingredient, input);
if (result != input)
{
return result;
}
return ItemStack.field_190927_a;
return ItemStack.EMPTY;
}
return ItemStack.field_190927_a;
return ItemStack.EMPTY;
}
}
@@ -97,7 +97,7 @@ class ChunkIOProvider implements Runnable
MinecraftForge.EVENT_BUS.post(new ChunkDataEvent.Load(this.chunk, this.nbt)); // Don't call ChunkDataEvent.Load async
this.chunk.setLastSaveTime(provider.worldObj.getTotalWorldTime());
this.chunk.setLastSaveTime(provider.world.getTotalWorldTime());
this.provider.chunkGenerator.recreateStructures(this.chunk, this.chunkInfo.x, this.chunkInfo.z);
provider.id2ChunkMap.put(ChunkPos.asLong(this.chunkInfo.x, this.chunkInfo.z), this.chunk);
@@ -282,7 +282,7 @@ public final class Clips
public TRSRTransformation apply(float time)
{
float clipTime = input.apply(time);
return fromClip.apply(clipTime).slerp(toClip.apply(clipTime), MathHelper.clamp_float(progress.apply(time), 0, 1));
return fromClip.apply(clipTime).slerp(toClip.apply(clipTime), MathHelper.clamp(progress.apply(time), 0, 1));
}
};
}
@@ -129,11 +129,11 @@ public class CompoundDataFixer extends DataFixer
@Deprecated //Modders do not use this, use add below, To better allow custom fix types.
public void registerWalker(FixTypes type, IDataWalker walker)
{
registerWalkerAdd(type, walker);
registerVanillaWalker(type, walker);
}
@Override
public void registerWalkerAdd(IFixType type, IDataWalker walker)
public void registerVanillaWalker(IFixType type, IDataWalker walker)
{
getWalkers(type).add(walker);
}
@@ -43,8 +43,8 @@ public class FakePlayer extends EntityPlayerMP
}
@Override public Vec3d getPositionVector(){ return new Vec3d(0, 0, 0); }
@Override public boolean canCommandSenderUseCommand(int i, String s){ return false; }
@Override public void addChatComponentMessage(ITextComponent chatmessagecomponent, boolean type){}
@Override public boolean canUseCommand(int i, String s){ return false; }
@Override public void sendStatusMessage(ITextComponent chatComponent, boolean actionBar){}
@Override public void addStat(StatBase par1StatBase, int par2){}
@Override public void openGui(Object mod, int modGuiId, World world, int x, int y, int z){}
@Override public boolean isEntityInvulnerable(DamageSource source){ return true; }
@@ -71,7 +71,7 @@ public class FakePlayerFactory
while (itr.hasNext())
{
Entry<GameProfile, FakePlayer> entry = itr.next();
if (entry.getValue().worldObj == world)
if (entry.getValue().world == world)
{
itr.remove();
}
@@ -49,7 +49,7 @@ public class AnvilUpdateEvent extends Event
{
this.left = left;
this.right = right;
this.output = ItemStack.field_190927_a;
this.output = ItemStack.EMPTY;
this.name = name;
this.setCost(cost);
this.setMaterialCost(0);
@@ -356,7 +356,7 @@ public class ForgeEventFactory
if (event.getResult() == Result.ALLOW)
{
if (!world.isRemote)
stack.func_190918_g(1);
stack.shrink(1);
return 1;
}
return 0;
@@ -372,8 +372,8 @@ public class ForgeEventFactory
if (player.capabilities.isCreativeMode)
return new ActionResult<ItemStack>(EnumActionResult.SUCCESS, stack);
stack.func_190918_g(1);
if (stack.func_190926_b())
stack.shrink(1);
if (stack.isEmpty())
return new ActionResult<ItemStack>(EnumActionResult.SUCCESS, event.getFilledBucket());
if (!player.inventory.addItemStackToInventory(event.getFilledBucket()))
@@ -400,8 +400,8 @@ public class ForgeEventFactory
public static int onItemExpire(EntityItem entity, @Nonnull ItemStack item)
{
if (item.func_190926_b()) return -1;
ItemExpireEvent event = new ItemExpireEvent(entity, (item.func_190926_b() ? 6000 : item.getItem().getEntityLifespan(item, entity.worldObj)));
if (item.isEmpty()) return -1;
ItemExpireEvent event = new ItemExpireEvent(entity, (item.isEmpty() ? 6000 : item.getItem().getEntityLifespan(item, entity.world)));
if (!MinecraftForge.EVENT_BUS.post(event)) return -1;
return event.getExtraLife();
}
@@ -427,7 +427,7 @@ public class ForgeEventFactory
public static boolean canMountEntity(Entity entityMounting, Entity entityBeingMounted, boolean isMounting)
{
boolean isCanceled = MinecraftForge.EVENT_BUS.post(new EntityMountEvent(entityMounting, entityBeingMounted, entityMounting.worldObj, isMounting));
boolean isCanceled = MinecraftForge.EVENT_BUS.post(new EntityMountEvent(entityMounting, entityBeingMounted, entityMounting.world, isMounting));
if(isCanceled)
{
@@ -498,7 +498,7 @@ public class ForgeEventFactory
public static boolean onPotionAttemptBrew(NonNullList<ItemStack> stacks)
{
NonNullList<ItemStack> tmp = NonNullList.func_191197_a(stacks.size(), ItemStack.field_190927_a);
NonNullList<ItemStack> tmp = NonNullList.withSize(stacks.size(), ItemStack.EMPTY);
for (int x = 0; x < tmp.size(); x++)
tmp.set(x, stacks.get(x).copy());
@@ -577,8 +577,8 @@ public class ForgeEventFactory
Result canContinueSleep = evt.getResult();
if (canContinueSleep == Result.DEFAULT)
{
IBlockState state = player.worldObj.getBlockState(player.bedLocation);
return state.getBlock().isBed(state, player.worldObj, player.bedLocation, player);
IBlockState state = player.world.getBlockState(player.bedLocation);
return state.getBlock().isBed(state, player.world, player.bedLocation, player);
}
else
return canContinueSleep == Result.ALLOW;
@@ -42,7 +42,7 @@ public class PotionBrewEvent extends Event
@Nonnull
public ItemStack getItem(int index)
{
if (index >= stacks.size()) return ItemStack.field_190927_a;
if (index >= stacks.size()) return ItemStack.EMPTY;
return stacks.get(index);
}
@@ -28,8 +28,8 @@ import net.minecraftforge.fml.common.eventhandler.Event;
* Fired when the enchantment level is set for each of the three potential enchantments in the enchanting table.
* The {@link #level} is set to the vanilla value and can be modified by this event handler.
*
* The {@link #enchantRow} is used to determine which enchantment level is being set, 1, 2, or 3. The {@link power} is a number
* from 0-15 and indicates how many bookshelves surround the enchanting table. The {@link itemStack} representing the item being
* The {@link #enchantRow} is used to determine which enchantment level is being set, 1, 2, or 3. The {@link #power} is a number
* from 0-15 and indicates how many bookshelves surround the enchanting table. The {@link #itemStack} representing the item being
* enchanted is also available.
*/
public class EnchantmentLevelSetEvent extends Event
@@ -126,7 +126,7 @@ public class EnchantmentLevelSetEvent extends Event
/**
* Set the new level of the enchantment (0-30)
*
* @param the new level of the enchantment (0-30)
* @param level the new level of the enchantment (0-30)
*/
public void setLevel(int level)
{
@@ -30,7 +30,7 @@ import java.util.Collection;
/**
* EntityJoinWorldEvent is fired when an Entity joins the world. <br>
* This event is fired whenever an Entity is added to the world in
* {@link World#loadEntities(Collection)}, {@link WorldServer#loadEntities(Collection)} {@link World#joinEntityInSurroundings(Entity)}, and {@link World#spawnEntityInWorld(Entity)}. <br>
* {@link World#loadEntities(Collection)}, {@link WorldServer#loadEntities(Collection)} {@link World#joinEntityInSurroundings(Entity)}, and {@link World#spawnEntity(Entity)}. <br>
* <br>
* {@link #world} contains the world in which the entity is to join.<br>
* <br>
@@ -118,7 +118,7 @@ public class LivingSpawnEvent extends LivingEvent
{
public AllowDespawn(EntityLiving entity)
{
super(entity, entity.worldObj, (float)entity.posX, (float)entity.posY, (float)entity.posZ);
super(entity, entity.world, (float)entity.posX, (float)entity.posY, (float)entity.posZ);
}
}
@@ -35,10 +35,10 @@ import javax.annotation.Nonnull;
/**
* MinecartInteractEvent is fired when a player interacts with a minecart. <br>
* This event is fired whenever a player interacts with a minecart in
* {@link EntityMinecartContainer#processInitialInteract(EntityPlayer, ItemStack, EnumHand)},
* {@link EntityMinecartEmpty#processInitialInteract(EntityPlayer, ItemStack, EnumHand)},
* {@link EntityMinecartFurnace#processInitialInteract(EntityPlayer, ItemStack, EnumHand)},
* {@link EntityMinecartHopper#processInitialInteract(EntityPlayer, ItemStack, EnumHand)},
* {@link EntityMinecartContainer#processInitialInteract(EntityPlayer, EnumHand)},
* {@link EntityMinecartEmpty#processInitialInteract(EntityPlayer, EnumHand)},
* {@link EntityMinecartFurnace#processInitialInteract(EntityPlayer, EnumHand)},
* {@link EntityMinecartHopper#processInitialInteract(EntityPlayer, EnumHand)},
* etc.<br>
* <br>
* {@link #player} contains the EntityPlayer that is involved with this minecart interaction.<br>
@@ -32,7 +32,7 @@ import javax.annotation.Nonnull;
/**
* ArrowNockEvent is fired when a player begins using a bow.<br>
* This event is fired whenever a player begins using a bow in
* {@link ItemBow#onItemRightClick(ItemStack, World, EntityPlayer, EnumHand)}.<br>
* {@link ItemBow#onItemRightClick(World, EntityPlayer, EnumHand)}.<br>
* <br>
* This event is fired on the {@link MinecraftForge#EVENT_BUS}.
**/
@@ -51,7 +51,7 @@ public class BiomeEvent extends Event
/**
* CreateDecorator is fired when a BiomeDecorator is created.<br>
* This event is fired whenever a BiomeDecorator is created in
* {@link DeferredBiomeDecorator#fireCreateEventAndReplace(BiomeGenBase)}.<br>
* {@link DeferredBiomeDecorator#fireCreateEventAndReplace(Biome)}.<br>
* <br>
* {@link #originalBiomeDecorator} contains the original BiomeDecorator that would be used in vanilla.
* {@link #newBiomeDecorator} contains the new BiomeDecoration to be used by Minecraft.
@@ -20,6 +20,7 @@
package net.minecraftforge.event.terraingen;
import net.minecraft.world.biome.BiomeProvider;
import net.minecraft.world.gen.ChunkProviderSettings;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.common.eventhandler.Cancelable;
import net.minecraftforge.fml.common.eventhandler.Event;
@@ -52,7 +53,7 @@ public class WorldTypeEvent extends Event
/**
* BiomeSize is fired when vanilla Minecraft attempts to generate biomes.<br>
* This event is fired during biome generation in
* {@link GenLayer#initializeAllBiomeGenerators(long, WorldType, String)}. <br>
* {@link GenLayer#initializeAllBiomeGenerators(long, WorldType, ChunkProviderSettings)}. <br>
* <br>
* {@link #originalSize} the original size of the Biome. <br>
* {@link #newSize} the new size of the biome. Initially set to the {@link #originalSize}. <br>
@@ -60,7 +60,7 @@ public class ChunkWatchEvent extends Event
/**
* ChunkWatchEvent.Watch is fired when an EntityPlayer begins watching a chunk.<br>
* This event is fired when a chunk is added to the watched chunks of an EntityPlayer in
* {@link PlayerChunkMapEntry#addPlayer(EntityPlayerMP)} and {@link PlayerChunkMapEntry#sentToPlayers()}. <br>
* {@link PlayerChunkMapEntry#addPlayer(EntityPlayerMP)} and {@link PlayerChunkMapEntry#sendToPlayers()}. <br>
* <br>
* This event is not {@link Cancelable}.<br>
* <br>
@@ -353,7 +353,7 @@ public abstract class BlockFluidBase extends Block implements IFluidBlock
@Nonnull
public Item getItemDropped(@Nonnull IBlockState state, @Nonnull Random rand, int fortune)
{
return Items.field_190931_a;
return Items.AIR;
}
@Override
@@ -256,14 +256,14 @@ public class BlockFluidFinite extends BlockFluidBase
if (fluidStack.amount < closest)
{
// Figure out maximum level to match stack amount
closest = MathHelper.floor_float(quantaAmount * MathHelper.floor_float(fluidStack.amount / quantaAmount));
quanta = MathHelper.floor_float(closest / quantaAmount);
closest = MathHelper.floor(quantaAmount * MathHelper.floor(fluidStack.amount / quantaAmount));
quanta = MathHelper.floor(closest / quantaAmount);
}
if (existing.getBlock() == this)
{
int existingQuanta = existing.getValue(LEVEL) + 1;
int missingQuanta = quantaPerBlock - existingQuanta;
closest = Math.min(closest, MathHelper.floor_float(missingQuanta * quantaAmount));
closest = Math.min(closest, MathHelper.floor(missingQuanta * quantaAmount));
quanta = Math.min(quanta + existingQuanta, quantaPerBlock);
}
@@ -282,7 +282,7 @@ public class BlockFluidFinite extends BlockFluidBase
@Override
public FluidStack drain(World world, BlockPos pos, boolean doDrain)
{
final FluidStack fluidStack = new FluidStack(getFluid(), MathHelper.floor_float(getQuantaPercentage(world, pos) * Fluid.BUCKET_VOLUME));
final FluidStack fluidStack = new FluidStack(getFluid(), MathHelper.floor(getQuantaPercentage(world, pos) * Fluid.BUCKET_VOLUME));
if (doDrain)
{
@@ -73,12 +73,12 @@ public class DispenseFluidContainer extends BehaviorDefaultDispenseItem
FluidActionResult actionResult = FluidUtil.tryPickUpFluid(stack, null, world, blockpos, dispenserFacing.getOpposite());
ItemStack resultStack = actionResult.getResult();
if (!actionResult.isSuccess() || resultStack.func_190926_b())
if (!actionResult.isSuccess() || resultStack.isEmpty())
{
return super.dispenseStack(source, stack);
}
if (stack.func_190916_E() == 1)
if (stack.getCount() == 1)
{
return resultStack;
}
@@ -88,7 +88,7 @@ public class DispenseFluidContainer extends BehaviorDefaultDispenseItem
}
ItemStack stackCopy = stack.copy();
stackCopy.func_190918_g(1);
stackCopy.shrink(1);
return stackCopy;
}
@@ -99,7 +99,7 @@ public class DispenseFluidContainer extends BehaviorDefaultDispenseItem
private ItemStack dumpContainer(IBlockSource source, @Nonnull ItemStack stack)
{
ItemStack singleStack = stack.copy();
singleStack.func_190920_e(1);
singleStack.setCount(1);
IFluidHandlerItem fluidHandler = FluidUtil.getFluidHandler(singleStack);
if (fluidHandler == null)
{
@@ -115,17 +115,17 @@ public class DispenseFluidContainer extends BehaviorDefaultDispenseItem
{
ItemStack drainedStack = result.getResult();
if (drainedStack.func_190916_E() == 1)
if (drainedStack.getCount() == 1)
{
return drainedStack;
}
else if (!drainedStack.func_190926_b() && ((TileEntityDispenser)source.getBlockTileEntity()).addItemStack(drainedStack) < 0)
else if (!drainedStack.isEmpty() && ((TileEntityDispenser)source.getBlockTileEntity()).addItemStack(drainedStack) < 0)
{
this.dispenseBehavior.dispense(source, drainedStack);
}
ItemStack stackCopy = drainedStack.copy();
stackCopy.func_190918_g(1);
stackCopy.shrink(1);
return stackCopy;
}
else
@@ -34,7 +34,7 @@ import net.minecraft.item.ItemStack;
*/
public class FluidActionResult
{
public static final FluidActionResult FAILURE = new FluidActionResult(false, ItemStack.field_190927_a);
public static final FluidActionResult FAILURE = new FluidActionResult(false, ItemStack.EMPTY);
public final boolean success;
@Nonnull
@@ -65,7 +65,7 @@ public class FluidUtil
@Nonnull
public static FluidActionResult interactWithFluidHandler(@Nonnull ItemStack stack, IFluidHandler fluidHandler, EntityPlayer player)
{
if (stack.func_190926_b() || fluidHandler == null || player == null)
if (stack.isEmpty() || fluidHandler == null || player == null)
{
return FluidActionResult.FAILURE;
}
@@ -99,7 +99,7 @@ public class FluidUtil
public static FluidActionResult tryFillContainer(@Nonnull ItemStack container, IFluidHandler fluidSource, int maxAmount, @Nullable EntityPlayer player, boolean doFill)
{
ItemStack containerCopy = container.copy(); // do not modify the input
containerCopy.func_190920_e(1);
containerCopy.setCount(1);
IFluidHandlerItem containerFluidHandler = getFluidHandler(containerCopy);
if (containerFluidHandler != null)
{
@@ -144,7 +144,7 @@ public class FluidUtil
public static FluidActionResult tryEmptyContainer(@Nonnull ItemStack container, IFluidHandler fluidDestination, int maxAmount, @Nullable EntityPlayer player, boolean doDrain)
{
ItemStack containerCopy = container.copy(); // do not modify the input
containerCopy.func_190920_e(1);
containerCopy.setCount(1);
IFluidHandlerItem containerFluidHandler = getFluidHandler(containerCopy);
if (containerFluidHandler != null)
{
@@ -191,7 +191,7 @@ public class FluidUtil
@Nonnull
public static FluidActionResult tryFillContainerAndStow(@Nonnull ItemStack container, IFluidHandler fluidSource, IItemHandler inventory, int maxAmount, @Nullable EntityPlayer player)
{
if (container.func_190926_b())
if (container.isEmpty())
{
return FluidActionResult.FAILURE;
}
@@ -204,7 +204,7 @@ public class FluidUtil
return new FluidActionResult(container); // creative mode: item does not change
}
}
else if (container.func_190916_E() == 1) // don't need to stow anything, just fill the container stack
else if (container.getCount() == 1) // don't need to stow anything, just fill the container stack
{
FluidActionResult filledReal = tryFillContainer(container, fluidSource, maxAmount, player, true);
if (filledReal.isSuccess())
@@ -219,19 +219,19 @@ public class FluidUtil
{
// check if we can give the itemStack to the inventory
ItemStack remainder = ItemHandlerHelper.insertItemStacked(inventory, filledSimulated.getResult(), true);
if (remainder.func_190926_b() || player != null)
if (remainder.isEmpty() || player != null)
{
FluidActionResult filledReal = tryFillContainer(container, fluidSource, maxAmount, player, true);
remainder = ItemHandlerHelper.insertItemStacked(inventory, filledReal.getResult(), false);
// give it to the player or drop it at their feet
if (!remainder.func_190926_b() && player != null)
if (!remainder.isEmpty() && player != null)
{
ItemHandlerHelper.giveItemToPlayer(player, remainder);
}
ItemStack containerCopy = container.copy();
containerCopy.func_190918_g(1);
containerCopy.shrink(1);
return new FluidActionResult(containerCopy);
}
}
@@ -258,7 +258,7 @@ public class FluidUtil
@Nonnull
public static FluidActionResult tryEmptyContainerAndStow(@Nonnull ItemStack container, IFluidHandler fluidDestination, IItemHandler inventory, int maxAmount, @Nullable EntityPlayer player)
{
if (container.func_190926_b())
if (container.isEmpty())
{
return FluidActionResult.FAILURE;
}
@@ -271,7 +271,7 @@ public class FluidUtil
return new FluidActionResult(container); // creative mode: item does not change
}
}
else if (container.func_190916_E() == 1) // don't need to stow anything, just fill and edit the container stack
else if (container.getCount() == 1) // don't need to stow anything, just fill and edit the container stack
{
FluidActionResult emptiedReal = tryEmptyContainer(container, fluidDestination, maxAmount, player, true);
if (emptiedReal.isSuccess())
@@ -286,19 +286,19 @@ public class FluidUtil
{
// check if we can give the itemStack to the inventory
ItemStack remainder = ItemHandlerHelper.insertItemStacked(inventory, emptiedSimulated.getResult(), true);
if (remainder.func_190926_b() || player != null)
if (remainder.isEmpty() || player != null)
{
FluidActionResult emptiedReal = tryEmptyContainer(container, fluidDestination, maxAmount, player, true);
remainder = ItemHandlerHelper.insertItemStacked(inventory, emptiedReal.getResult(), false);
// give it to the player or drop it at their feet
if (!remainder.func_190926_b() && player != null)
if (!remainder.isEmpty() && player != null)
{
ItemHandlerHelper.giveItemToPlayer(player, remainder);
}
ItemStack containerCopy = container.copy();
containerCopy.func_190918_g(1);
containerCopy.shrink(1);
return new FluidActionResult(containerCopy);
}
}
@@ -377,10 +377,10 @@ public class FluidUtil
@Nullable
public static FluidStack getFluidContained(@Nonnull ItemStack container)
{
if (!container.func_190926_b())
if (!container.isEmpty())
{
container = container.copy();
container.func_190920_e(1);
container.setCount(1);
IFluidHandlerItem fluidHandler = FluidUtil.getFluidHandler(container);
if (fluidHandler != null)
{
@@ -435,7 +435,7 @@ public class FluidUtil
@Nonnull
public static FluidActionResult tryPickUpFluid(@Nonnull ItemStack emptyContainer, @Nullable EntityPlayer playerIn, World worldIn, BlockPos pos, EnumFacing side)
{
if (emptyContainer.func_190926_b() || worldIn == null || pos == null)
if (emptyContainer.isEmpty() || worldIn == null || pos == null)
{
return FluidActionResult.FAILURE;
}
@@ -86,14 +86,14 @@ public class UniversalBucket extends Item
@Override
public boolean hasContainerItem(@Nonnull ItemStack stack)
{
return !getEmpty().func_190926_b();
return !getEmpty().isEmpty();
}
@Nonnull
@Override
public ItemStack getContainerItem(@Nonnull ItemStack itemStack)
{
if (!getEmpty().func_190926_b())
if (!getEmpty().isEmpty())
{
// Create a copy such that the game can't mess with it
return getEmpty().copy();
@@ -129,7 +129,7 @@ public class UniversalBucket extends Item
FluidStack fluidStack = getFluid(stack);
if (fluidStack == null)
{
if(!getEmpty().func_190926_b())
if(!getEmpty().isEmpty())
{
return getEmpty().getDisplayName();
}
@@ -183,12 +183,12 @@ public class UniversalBucket extends Item
// success!
player.addStat(StatList.getObjectUseStats(this));
itemstack.func_190918_g(1);
itemstack.shrink(1);
ItemStack drained = result.getResult();
ItemStack emptyStack = !drained.func_190926_b() ? drained.copy() : new ItemStack(this);
ItemStack emptyStack = !drained.isEmpty() ? drained.copy() : new ItemStack(this);
// check whether we replace the item or add the empty one to the inventory
if (itemstack.func_190926_b())
if (itemstack.isEmpty())
{
return ActionResult.newResult(EnumActionResult.SUCCESS, emptyStack);
}
@@ -235,7 +235,7 @@ public class UniversalBucket extends Item
BlockPos pos = target.getBlockPos();
ItemStack singleBucket = emptyBucket.copy();
singleBucket.func_190920_e(1);
singleBucket.setCount(1);
FluidActionResult filledResult = FluidUtil.tryPickUpFluid(singleBucket, event.getEntityPlayer(), world, pos, target.sideHit);
if (filledResult.isSuccess())
@@ -99,7 +99,7 @@ public class FluidHandlerItemStack implements IFluidHandlerItem, ICapabilityProv
@Override
public int fill(FluidStack resource, boolean doFill)
{
if (container.func_190916_E() != 1 || resource == null || resource.amount <= 0 || !canFillFluidType(resource))
if (container.getCount() != 1 || resource == null || resource.amount <= 0 || !canFillFluidType(resource))
{
return 0;
}
@@ -139,7 +139,7 @@ public class FluidHandlerItemStack implements IFluidHandlerItem, ICapabilityProv
@Override
public FluidStack drain(FluidStack resource, boolean doDrain)
{
if (container.func_190916_E() != 1 || resource == null || resource.amount <= 0 || !resource.isFluidEqual(getFluid()))
if (container.getCount() != 1 || resource == null || resource.amount <= 0 || !resource.isFluidEqual(getFluid()))
{
return null;
}
@@ -149,7 +149,7 @@ public class FluidHandlerItemStack implements IFluidHandlerItem, ICapabilityProv
@Override
public FluidStack drain(int maxDrain, boolean doDrain)
{
if (container.func_190916_E() != 1 || maxDrain <= 0)
if (container.getCount() != 1 || maxDrain <= 0)
{
return null;
}
@@ -228,7 +228,7 @@ public class FluidHandlerItemStack implements IFluidHandlerItem, ICapabilityProv
protected void setContainerToEmpty()
{
super.setContainerToEmpty();
container.func_190918_g(1);
container.shrink(1);
}
}
@@ -96,7 +96,7 @@ public class FluidHandlerItemStackSimple implements IFluidHandlerItem, ICapabili
@Override
public int fill(FluidStack resource, boolean doFill)
{
if (container.func_190916_E() != 1 || resource == null || resource.amount <= 0 || !canFillFluidType(resource))
if (container.getCount() != 1 || resource == null || resource.amount <= 0 || !canFillFluidType(resource))
{
return 0;
}
@@ -122,7 +122,7 @@ public class FluidHandlerItemStackSimple implements IFluidHandlerItem, ICapabili
@Override
public FluidStack drain(FluidStack resource, boolean doDrain)
{
if (container.func_190916_E() != 1 || resource == null || resource.amount <= 0 || !resource.isFluidEqual(getFluid()))
if (container.getCount() != 1 || resource == null || resource.amount <= 0 || !resource.isFluidEqual(getFluid()))
{
return null;
}
@@ -132,7 +132,7 @@ public class FluidHandlerItemStackSimple implements IFluidHandlerItem, ICapabili
@Override
public FluidStack drain(int maxDrain, boolean doDrain)
{
if (container.func_190916_E() != 1 || maxDrain <= 0)
if (container.getCount() != 1 || maxDrain <= 0)
{
return null;
}
@@ -205,7 +205,7 @@ public class FluidHandlerItemStackSimple implements IFluidHandlerItem, ICapabili
protected void setContainerToEmpty()
{
super.setContainerToEmpty();
container.func_190918_g(1);
container.shrink(1);
}
}
@@ -128,7 +128,7 @@ public class FluidBucketWrapper implements IFluidHandlerItem, ICapabilityProvide
@Override
public int fill(FluidStack resource, boolean doFill)
{
if (container.func_190916_E() != 1 || resource == null || resource.amount < Fluid.BUCKET_VOLUME || container.getItem() instanceof ItemBucketMilk || getFluid() != null || !canFillFluidType(resource))
if (container.getCount() != 1 || resource == null || resource.amount < Fluid.BUCKET_VOLUME || container.getItem() instanceof ItemBucketMilk || getFluid() != null || !canFillFluidType(resource))
{
return 0;
}
@@ -145,7 +145,7 @@ public class FluidBucketWrapper implements IFluidHandlerItem, ICapabilityProvide
@Override
public FluidStack drain(FluidStack resource, boolean doDrain)
{
if (container.func_190916_E() != 1 || resource == null || resource.amount < Fluid.BUCKET_VOLUME)
if (container.getCount() != 1 || resource == null || resource.amount < Fluid.BUCKET_VOLUME)
{
return null;
}
@@ -167,7 +167,7 @@ public class FluidBucketWrapper implements IFluidHandlerItem, ICapabilityProvide
@Override
public FluidStack drain(int maxDrain, boolean doDrain)
{
if (container.func_190916_E() != 1 || maxDrain < Fluid.BUCKET_VOLUME)
if (container.getCount() != 1 || maxDrain < Fluid.BUCKET_VOLUME)
{
return null;
}
@@ -139,7 +139,7 @@ import com.google.gson.JsonObject;
/**
* Handles primary communication from hooked code into the system
*
* The FML entry point is {@link #beginMinecraftLoading(Minecraft, List, IReloadableResourceManager)} called from
* The FML entry point is {@link #beginMinecraftLoading(Minecraft, List, IReloadableResourceManager, MetadataSerializer)} called from
* {@link Minecraft}
*
* Obfuscated code should focus on this class and other members of the "server"
@@ -474,7 +474,7 @@ public class FMLClientHandler implements IFMLSidedHandler
*/
public void displayGuiScreen(EntityPlayer player, GuiScreen gui)
{
if (client.thePlayer==player && gui != null) {
if (client.player==player && gui != null) {
client.displayGuiScreen(gui);
}
}
@@ -567,12 +567,12 @@ public class FMLClientHandler implements IFMLSidedHandler
public WorldClient getWorldClient()
{
return client.theWorld;
return client.world;
}
public EntityPlayerSP getClientPlayerEntity()
{
return client.thePlayer;
return client.player;
}
@Override
@@ -286,7 +286,7 @@ public abstract class GuiScrollingList
GL11.glScissor((int)(left * scaleW), (int)(client.displayHeight - (bottom * scaleH)),
(int)(listWidth * scaleW), (int)(viewHeight * scaleH));
if (this.client.theWorld != null)
if (this.client.world != null)
{
this.drawGradientRect(this.left, this.top, this.right, this.bottom, 0xC0101010, 0xD0101010);
}
@@ -166,7 +166,7 @@ public class GuiConfig extends GuiScreen
this.allRequireMcRestart = allRequireMcRestart;
this.modID = modID;
this.configID = configID;
this.isWorldRunning = mc.theWorld != null;
this.isWorldRunning = mc.world != null;
if (title != null)
this.title = title;
this.titleLine2 = titleLine2;
@@ -65,6 +65,7 @@ public class ItemStackTransformer implements IClassTransformer {
MethodNode getItemMethod = null;
for (MethodNode m: classNode.methods)
{
if (m.name.equals("getItemRaw")) continue;
if (GETITEM_DESC.equals(m.desc) && getItemMethod == null)
{
getItemMethod = m;
@@ -81,7 +82,7 @@ public class ItemStackTransformer implements IClassTransformer {
for (MethodNode m: classNode.methods)
{
if (m.name.equals("forgeInit") || m.name.equals("func_190926_b")) continue;
if (m.name.equals("getItemRaw")) continue;
for (ListIterator<AbstractInsnNode> it = m.instructions.iterator(); it.hasNext(); )
{
AbstractInsnNode insnNode = it.next();
@@ -163,7 +163,7 @@ public class ByteBufUtils {
public static void writeItemStack(ByteBuf to, ItemStack stack)
{
PacketBuffer pb = new PacketBuffer(to);
pb.writeItemStackToBuffer(stack);
pb.writeItemStack(stack);
}
/**
@@ -177,7 +177,7 @@ public class ByteBufUtils {
PacketBuffer pb = new PacketBuffer(from);
try
{
return pb.readItemStackFromBuffer();
return pb.readItemStack();
} catch (IOException e)
{
// Unpossible?
@@ -194,7 +194,7 @@ public class ByteBufUtils {
public static void writeTag(ByteBuf to, NBTTagCompound tag)
{
PacketBuffer pb = new PacketBuffer(to);
pb.writeNBTTagCompoundToBuffer(tag);
pb.writeCompoundTag(tag);
}
/**
@@ -208,7 +208,7 @@ public class ByteBufUtils {
PacketBuffer pb = new PacketBuffer(from);
try
{
return pb.readNBTTagCompoundFromBuffer();
return pb.readCompoundTag();
} catch (IOException e)
{
// Unpossible?
@@ -148,7 +148,7 @@ public class FMLOutboundHandler extends ChannelOutboundHandlerAdapter {
public List<NetworkDispatcher> selectNetworks(Object args, ChannelHandlerContext context, FMLProxyPacket packet)
{
ImmutableList.Builder<NetworkDispatcher> builder = ImmutableList.builder();
for (EntityPlayerMP player : FMLCommonHandler.instance().getMinecraftServerInstance().getPlayerList().getPlayerList())
for (EntityPlayerMP player : FMLCommonHandler.instance().getMinecraftServerInstance().getPlayerList().getPlayers())
{
NetworkDispatcher dispatcher = player.connection.netManager.channel().attr(NetworkDispatcher.FML_DISPATCHER).get();
if (dispatcher != null) builder.add(dispatcher);
@@ -176,7 +176,7 @@ public class FMLOutboundHandler extends ChannelOutboundHandlerAdapter {
{
int dimension = (Integer)args;
ImmutableList.Builder<NetworkDispatcher> builder = ImmutableList.builder();
for (EntityPlayerMP player : FMLCommonHandler.instance().getMinecraftServerInstance().getPlayerList().getPlayerList())
for (EntityPlayerMP player : FMLCommonHandler.instance().getMinecraftServerInstance().getPlayerList().getPlayers())
{
if (dimension == player.dimension)
{
@@ -210,7 +210,7 @@ public class FMLOutboundHandler extends ChannelOutboundHandlerAdapter {
{
TargetPoint tp = (TargetPoint)args;
ImmutableList.Builder<NetworkDispatcher> builder = ImmutableList.builder();
for (EntityPlayerMP player : FMLCommonHandler.instance().getMinecraftServerInstance().getPlayerList().getPlayerList())
for (EntityPlayerMP player : FMLCommonHandler.instance().getMinecraftServerInstance().getPlayerList().getPlayers())
{
if (player.dimension == tp.dimension)
{
@@ -630,7 +630,7 @@ public class NetworkDispatcher extends SimpleChannelInboundHandler<Packet<?>> im
private MultiPartCustomPayload(PacketBuffer preamble) throws IOException
{
channel = preamble.readStringFromBuffer(20);
channel = preamble.readString(20);
part_count = preamble.readUnsignedByte();
int length = preamble.readInt();
if (length <= 0 || length >= FMLProxyPacket.MAX_LENGTH)
@@ -54,8 +54,8 @@ public class OpenGuiHandler extends SimpleChannelInboundHandler<FMLMessage.OpenG
private void process(OpenGui msg)
{
EntityPlayer player = FMLClientHandler.instance().getClient().thePlayer;
player.openGui(msg.modId, msg.modGuiId, player.worldObj, msg.x, msg.y, msg.z);
EntityPlayer player = FMLClientHandler.instance().getClient().player;
player.openGui(msg.modId, msg.modGuiId, player.world, msg.x, msg.y, msg.z);
player.openContainer.windowId = msg.windowId;
}
@@ -202,14 +202,11 @@ public class EntityRegistry
* Once registered mob eggs can be created by using minecraft:spawn_egg with NBT entry 'entity_name' with
* value of the name this class is registered in the classToStringMapping with.
*
* @param entityClass The entity class
* @param name The entity ResourceLocation
* @param primary Primary egg color
* @param secondary Secondary egg color
*
* @throws IllegalArgumentException if entityClass is not registered in classToStringMapping.
*
*/
public static void registerEgg(ResourceLocation name, int primary, int secondary)
{
EntityEntry entry = ForgeRegistries.ENTITIES.getValue(name);
@@ -222,7 +219,7 @@ public class EntityRegistry
}
/**
* Add a spawn entry for the supplied entity in the supplied {@link BiomeGenBase} list
* Add a spawn entry for the supplied entity in the supplied {@link Biome} list
* @param entityClass Entity class added
* @param weightedProb Probability
* @param min Min spawn count
@@ -256,7 +253,7 @@ public class EntityRegistry
}
/**
* Add a spawn entry for the supplied entity in the supplied {@link BiomeGenBase} list
* Add a spawn entry for the supplied entity in the supplied {@link Biome} list
* @param entityName The entity name
* @param weightedProb Probability
* @param min Min spawn count
@@ -352,7 +349,7 @@ public class EntityRegistry
EntityRegistration er = lookupModSpawn(entity.getClass(), true);
if (er != null)
{
entityTracker.addEntityToTracker(entity, er.getTrackingRange(), er.getUpdateFrequency(), er.sendsVelocityUpdates());
entityTracker.track(entity, er.getTrackingRange(), er.getUpdateFrequency(), er.sendsVelocityUpdates());
return true;
}
return false;
@@ -375,7 +375,7 @@ public class GameRegistry
if (item == null)
{
FMLLog.getLogger().log(Level.TRACE, "Unable to find item with name {}", itemName);
return ItemStack.field_190927_a;
return ItemStack.EMPTY;
}
ItemStack is = new ItemStack(item, stackSize, meta);
if (!Strings.isNullOrEmpty(nbtString))
@@ -37,15 +37,15 @@ public class ItemHandlerHelper
@Nonnull
public static ItemStack insertItem(IItemHandler dest, @Nonnull ItemStack stack, boolean simulate)
{
if (dest == null || stack.func_190926_b())
return ItemStack.field_190927_a;
if (dest == null || stack.isEmpty())
return ItemStack.EMPTY;
for (int i = 0; i < dest.getSlots(); i++)
{
stack = dest.insertItem(i, stack, simulate);
if (stack.func_190926_b())
if (stack.isEmpty())
{
return ItemStack.field_190927_a;
return ItemStack.EMPTY;
}
}
@@ -54,7 +54,7 @@ public class ItemHandlerHelper
public static boolean canItemStacksStack(@Nonnull ItemStack a, @Nonnull ItemStack b)
{
if (a.func_190926_b() || !a.isItemEqual(b) || a.hasTagCompound() != b.hasTagCompound())
if (a.isEmpty() || !a.isItemEqual(b) || a.hasTagCompound() != b.hasTagCompound())
return false;
return (!a.hasTagCompound() || a.getTagCompound().equals(b.getTagCompound())) && a.areCapsCompatible(b);
@@ -66,7 +66,7 @@ public class ItemHandlerHelper
*/
public static boolean canItemStacksStackRelaxed(@Nonnull ItemStack a, @Nonnull ItemStack b)
{
if (a.func_190926_b() || b.func_190926_b() || a.getItem() != b.getItem())
if (a.isEmpty() || b.isEmpty() || a.getItem() != b.getItem())
return false;
if (!a.isStackable())
@@ -88,9 +88,9 @@ public class ItemHandlerHelper
public static ItemStack copyStackWithSize(@Nonnull ItemStack itemStack, int size)
{
if (size == 0)
return ItemStack.field_190927_a;
return ItemStack.EMPTY;
ItemStack copy = itemStack.copy();
copy.func_190920_e(size);
copy.setCount(size);
return copy;
}
@@ -102,7 +102,7 @@ public class ItemHandlerHelper
@Nonnull
public static ItemStack insertItemStacked(IItemHandler inventory, @Nonnull ItemStack stack, boolean simulate)
{
if (inventory == null || stack.func_190926_b())
if (inventory == null || stack.isEmpty())
return stack;
// not stackable -> just insert into a new slot
@@ -121,7 +121,7 @@ public class ItemHandlerHelper
{
stack = inventory.insertItem(i, stack, simulate);
if (stack.func_190926_b())
if (stack.isEmpty())
{
break;
}
@@ -129,15 +129,15 @@ public class ItemHandlerHelper
}
// insert remainder into empty slots
if (!stack.func_190926_b())
if (!stack.isEmpty())
{
// find empty slot
for (int i = 0; i < sizeInventory; i++)
{
if (inventory.getStackInSlot(i).func_190926_b())
if (inventory.getStackInSlot(i).isEmpty())
{
stack = inventory.insertItem(i, stack, simulate);
if (stack.func_190926_b())
if (stack.isEmpty())
{
break;
}
@@ -163,7 +163,7 @@ public class ItemHandlerHelper
public static void giveItemToPlayer(EntityPlayer player, @Nonnull ItemStack stack, int preferredSlot)
{
IItemHandler inventory = new PlayerMainInvWrapper(player.inventory);
World world = player.worldObj;
World world = player.world;
// try adding it into the inventory
ItemStack remainder = stack;
@@ -173,27 +173,27 @@ public class ItemHandlerHelper
remainder = inventory.insertItem(preferredSlot, stack, false);
}
// then into the inventory in general
if(!remainder.func_190926_b())
if(!remainder.isEmpty())
{
remainder = insertItemStacked(inventory, remainder, false);
}
// play sound if something got picked up
if (remainder.func_190926_b() || remainder.func_190916_E() != stack.func_190916_E())
if (remainder.isEmpty() || remainder.getCount() != stack.getCount())
{
world.playSound(player, player.posX, player.posY, player.posZ,
SoundEvents.ENTITY_ITEM_PICKUP, SoundCategory.PLAYERS, 0.2F, ((world.rand.nextFloat() - world.rand.nextFloat()) * 0.7F + 1.0F) * 2.0F);
}
// drop remaining itemstack into the world
if (!remainder.func_190926_b() && !world.isRemote)
if (!remainder.isEmpty() && !world.isRemote)
{
EntityItem entityitem = new EntityItem(world, player.posX, player.posY + 0.5, player.posZ, stack);
entityitem.setPickupDelay(40);
entityitem.motionX = 0;
entityitem.motionZ = 0;
world.spawnEntityInWorld(entityitem);
world.spawnEntity(entityitem);
}
}
@@ -218,15 +218,15 @@ public class ItemHandlerHelper
{
ItemStack itemstack = inv.getStackInSlot(j);
if (!itemstack.func_190926_b())
if (!itemstack.isEmpty())
{
proportion += (float)itemstack.func_190916_E() / (float)Math.min(inv.getSlotLimit(j), itemstack.getMaxStackSize());
proportion += (float)itemstack.getCount() / (float)Math.min(inv.getSlotLimit(j), itemstack.getMaxStackSize());
++itemsFound;
}
}
proportion = proportion / (float)inv.getSlots();
return MathHelper.floor_float(proportion * 14.0F) + (itemsFound > 0 ? 1 : 0);
return MathHelper.floor(proportion * 14.0F) + (itemsFound > 0 ? 1 : 0);
}
}
}
@@ -39,7 +39,7 @@ public class ItemStackHandler implements IItemHandler, IItemHandlerModifiable, I
public ItemStackHandler(int size)
{
stacks = NonNullList.func_191197_a(size, ItemStack.field_190927_a);
stacks = NonNullList.withSize(size, ItemStack.EMPTY);
}
public ItemStackHandler(NonNullList<ItemStack> stacks)
@@ -49,7 +49,7 @@ public class ItemStackHandler implements IItemHandler, IItemHandlerModifiable, I
public void setSize(int size)
{
stacks = NonNullList.func_191197_a(size, ItemStack.field_190927_a);
stacks = NonNullList.withSize(size, ItemStack.EMPTY);
}
@Override
@@ -80,8 +80,8 @@ public class ItemStackHandler implements IItemHandler, IItemHandlerModifiable, I
@Nonnull
public ItemStack insertItem(int slot, @Nonnull ItemStack stack, boolean simulate)
{
if (stack.func_190926_b())
return ItemStack.field_190927_a;
if (stack.isEmpty())
return ItemStack.EMPTY;
validateSlotIndex(slot);
@@ -89,55 +89,55 @@ public class ItemStackHandler implements IItemHandler, IItemHandlerModifiable, I
int limit = getStackLimit(slot, stack);
if (!existing.func_190926_b())
if (!existing.isEmpty())
{
if (!ItemHandlerHelper.canItemStacksStack(stack, existing))
return stack;
limit -= existing.func_190916_E();
limit -= existing.getCount();
}
if (limit <= 0)
return stack;
boolean reachedLimit = stack.func_190916_E() > limit;
boolean reachedLimit = stack.getCount() > limit;
if (!simulate)
{
if (existing.func_190926_b())
if (existing.isEmpty())
{
this.stacks.set(slot, reachedLimit ? ItemHandlerHelper.copyStackWithSize(stack, limit) : stack);
}
else
{
existing.func_190917_f(reachedLimit ? limit : stack.func_190916_E());
existing.grow(reachedLimit ? limit : stack.getCount());
}
onContentsChanged(slot);
}
return reachedLimit ? ItemHandlerHelper.copyStackWithSize(stack, stack.func_190916_E()- limit) : ItemStack.field_190927_a;
return reachedLimit ? ItemHandlerHelper.copyStackWithSize(stack, stack.getCount()- limit) : ItemStack.EMPTY;
}
@Nonnull
public ItemStack extractItem(int slot, int amount, boolean simulate)
{
if (amount == 0)
return ItemStack.field_190927_a;
return ItemStack.EMPTY;
validateSlotIndex(slot);
ItemStack existing = this.stacks.get(slot);
if (existing.func_190926_b())
return ItemStack.field_190927_a;
if (existing.isEmpty())
return ItemStack.EMPTY;
int toExtract = Math.min(amount, existing.getMaxStackSize());
if (existing.func_190916_E() <= toExtract)
if (existing.getCount() <= toExtract)
{
if (!simulate)
{
this.stacks.set(slot, ItemStack.field_190927_a);
this.stacks.set(slot, ItemStack.EMPTY);
onContentsChanged(slot);
}
return existing;
@@ -146,7 +146,7 @@ public class ItemStackHandler implements IItemHandler, IItemHandlerModifiable, I
{
if (!simulate)
{
this.stacks.set(slot, ItemHandlerHelper.copyStackWithSize(existing, existing.func_190916_E() - toExtract));
this.stacks.set(slot, ItemHandlerHelper.copyStackWithSize(existing, existing.getCount() - toExtract));
onContentsChanged(slot);
}
@@ -171,7 +171,7 @@ public class ItemStackHandler implements IItemHandler, IItemHandlerModifiable, I
NBTTagList nbtTagList = new NBTTagList();
for (int i = 0; i < stacks.size(); i++)
{
if (!stacks.get(i).func_190926_b())
if (!stacks.get(i).isEmpty())
{
NBTTagCompound itemTag = new NBTTagCompound();
itemTag.setInteger("Slot", i);
@@ -43,7 +43,7 @@ public class SlotItemHandler extends Slot
@Override
public boolean isItemValid(@Nonnull ItemStack stack)
{
if (stack.func_190926_b())
if (stack.isEmpty())
return false;
IItemHandler handler = this.getItemHandler();
@@ -53,7 +53,7 @@ public class SlotItemHandler extends Slot
IItemHandlerModifiable handlerModifiable = (IItemHandlerModifiable) handler;
ItemStack currentStack = handlerModifiable.getStackInSlot(index);
handlerModifiable.setStackInSlot(index, ItemStack.field_190927_a);
handlerModifiable.setStackInSlot(index, ItemStack.EMPTY);
remainder = handlerModifiable.insertItem(index, stack, true);
@@ -63,7 +63,7 @@ public class SlotItemHandler extends Slot
{
remainder = handler.insertItem(index, stack, true);
}
return remainder.func_190926_b() || remainder.func_190916_E() < stack.func_190916_E();
return remainder.isEmpty() || remainder.getCount() < stack.getCount();
}
@Override
@@ -98,27 +98,27 @@ public class SlotItemHandler extends Slot
{
ItemStack maxAdd = stack.copy();
int maxInput = stack.getMaxStackSize();
maxAdd.func_190920_e(maxInput);
maxAdd.setCount(maxInput);
IItemHandler handler = this.getItemHandler();
ItemStack currentStack = handler.getStackInSlot(index);
if (handler instanceof IItemHandlerModifiable) {
IItemHandlerModifiable handlerModifiable = (IItemHandlerModifiable) handler;
handlerModifiable.setStackInSlot(index, ItemStack.field_190927_a);
handlerModifiable.setStackInSlot(index, ItemStack.EMPTY);
ItemStack remainder = handlerModifiable.insertItem(index, maxAdd, true);
handlerModifiable.setStackInSlot(index, currentStack);
return maxInput - remainder.func_190916_E();
return maxInput - remainder.getCount();
}
else
{
ItemStack remainder = handler.insertItem(index, maxAdd, true);
int current = currentStack.func_190916_E();
int added = maxInput - remainder.func_190916_E();
int current = currentStack.getCount();
int added = maxInput - remainder.getCount();
return current + added;
}
}
@@ -126,7 +126,7 @@ public class SlotItemHandler extends Slot
@Override
public boolean canTakeStack(EntityPlayer playerIn)
{
return !this.getItemHandler().extractItem(index, 1, true).func_190926_b();
return !this.getItemHandler().extractItem(index, 1, true).isEmpty();
}
@Override
@@ -110,7 +110,7 @@ public class VanillaDoubleChestItemHandler extends WeakReference<TileEntityChest
boolean accessingUpperChest = slot < 27;
int targetSlot = accessingUpperChest ? slot : slot - 27;
TileEntityChest chest = getChest(accessingUpperChest);
return chest != null ? chest.getStackInSlot(targetSlot) : ItemStack.field_190927_a;
return chest != null ? chest.getStackInSlot(targetSlot) : ItemStack.EMPTY;
}
@Override
@@ -146,7 +146,7 @@ public class VanillaDoubleChestItemHandler extends WeakReference<TileEntityChest
boolean accessingUpperChest = slot < 27;
int targetSlot = accessingUpperChest ? slot : slot - 27;
TileEntityChest chest = getChest(accessingUpperChest);
return chest != null ? chest.getSingleChestHandler().extractItem(targetSlot, amount, simulate) : ItemStack.field_190927_a;
return chest != null ? chest.getSingleChestHandler().extractItem(targetSlot, amount, simulate) : ItemStack.EMPTY;
}
@Override
@@ -45,12 +45,12 @@ public class VanillaHopperItemHandler extends InvWrapper
}
else
{
boolean wasEmpty = getInv().func_191420_l();
boolean wasEmpty = getInv().isEmpty();
int originalStackSize = stack.func_190916_E();
int originalStackSize = stack.getCount();
stack = super.insertItem(slot, stack, simulate);
if (wasEmpty && originalStackSize > stack.func_190916_E())
if (wasEmpty && originalStackSize > stack.getCount())
{
if (!hopper.mayTransfer())
{
@@ -54,19 +54,19 @@ public class VanillaInventoryCodeHooks
for (int i = 0; i < handler.getSlots(); i++)
{
ItemStack extractItem = handler.extractItem(i, 1, true);
if (!extractItem.func_190926_b())
if (!extractItem.isEmpty())
{
for (int j = 0; j < dest.getSizeInventory(); j++)
{
ItemStack destStack = dest.getStackInSlot(j);
if (dest.isItemValidForSlot(j, extractItem) && (destStack.func_190926_b() || destStack.func_190916_E() < destStack.getMaxStackSize() && destStack.func_190916_E() < dest.getInventoryStackLimit() && ItemHandlerHelper.canItemStacksStack(extractItem, destStack)))
if (dest.isItemValidForSlot(j, extractItem) && (destStack.isEmpty() || destStack.getCount() < destStack.getMaxStackSize() && destStack.getCount() < dest.getInventoryStackLimit() && ItemHandlerHelper.canItemStacksStack(extractItem, destStack)))
{
extractItem = handler.extractItem(i, 1, false);
if (destStack.func_190926_b())
if (destStack.isEmpty())
dest.setInventorySlotContents(j, extractItem);
else
{
destStack.func_190917_f(1);
destStack.grow(1);
dest.setInventorySlotContents(j, destStack);
}
dest.markDirty();
@@ -98,10 +98,10 @@ public class VanillaInventoryCodeHooks
ItemStack dispensedStack = stack.copy().splitStack(1);
ItemStack remainder = putStackInInventoryAllSlots(dropper, destination, itemHandler, dispensedStack);
if (remainder.func_190926_b())
if (remainder.isEmpty())
{
remainder = stack.copy();
remainder.func_190918_g(1);
remainder.shrink(1);
}
else
{
@@ -136,13 +136,13 @@ public class VanillaInventoryCodeHooks
{
for (int i = 0; i < hopper.getSizeInventory(); ++i)
{
if (!hopper.getStackInSlot(i).func_190926_b())
if (!hopper.getStackInSlot(i).isEmpty())
{
ItemStack originalSlotContents = hopper.getStackInSlot(i).copy();
ItemStack insertStack = hopper.decrStackSize(i, 1);
ItemStack remainder = putStackInInventoryAllSlots(hopper, destination, itemHandler, insertStack);
if (remainder.func_190926_b())
if (remainder.isEmpty())
{
return true;
}
@@ -158,7 +158,7 @@ public class VanillaInventoryCodeHooks
private static ItemStack putStackInInventoryAllSlots(TileEntity source, Object destination, IItemHandler destInventory, ItemStack stack)
{
for (int slot = 0; slot < destInventory.getSlots() && !stack.func_190926_b(); slot++)
for (int slot = 0; slot < destInventory.getSlots() && !stack.isEmpty(); slot++)
{
stack = insertStack(source, destination, destInventory, stack, slot);
}
@@ -172,22 +172,22 @@ public class VanillaInventoryCodeHooks
{
ItemStack itemstack = destInventory.getStackInSlot(slot);
if (destInventory.insertItem(slot, stack, true).func_190926_b())
if (destInventory.insertItem(slot, stack, true).isEmpty())
{
boolean insertedItem = false;
boolean inventoryWasEmpty = isEmpty(destInventory);
if (itemstack.func_190926_b())
if (itemstack.isEmpty())
{
destInventory.insertItem(slot, stack, false);
stack = ItemStack.field_190927_a;
stack = ItemStack.EMPTY;
insertedItem = true;
}
else if (ItemHandlerHelper.canItemStacksStack(itemstack, stack))
{
int originalSize = stack.func_190916_E();
int originalSize = stack.getCount();
stack = destInventory.insertItem(slot, stack, false);
insertedItem = originalSize < stack.func_190916_E();
insertedItem = originalSize < stack.getCount();
}
if (insertedItem)
@@ -231,7 +231,7 @@ public class VanillaInventoryCodeHooks
for (int slot = 0; slot < itemHandler.getSlots(); slot++)
{
ItemStack stackInSlot = itemHandler.getStackInSlot(slot);
if (stackInSlot.func_190926_b() || stackInSlot.func_190916_E() != stackInSlot.getMaxStackSize())
if (stackInSlot.isEmpty() || stackInSlot.getCount() != stackInSlot.getMaxStackSize())
{
return false;
}
@@ -244,7 +244,7 @@ public class VanillaInventoryCodeHooks
for (int slot = 0; slot < itemHandler.getSlots(); slot++)
{
ItemStack stackInSlot = itemHandler.getStackInSlot(slot);
if (stackInSlot.func_190916_E() > 0)
if (stackInSlot.getCount() > 0)
{
return false;
}
@@ -256,9 +256,9 @@ public class VanillaInventoryCodeHooks
public static Pair<IItemHandler, Object> getItemHandler(World worldIn, double x, double y, double z, final EnumFacing side)
{
Pair<IItemHandler, Object> destination = null;
int i = MathHelper.floor_double(x);
int j = MathHelper.floor_double(y);
int k = MathHelper.floor_double(z);
int i = MathHelper.floor(x);
int j = MathHelper.floor(y);
int k = MathHelper.floor(z);
BlockPos blockpos = new BlockPos(i, j, k);
net.minecraft.block.state.IBlockState state = worldIn.getBlockState(blockpos);
Block block = state.getBlock();
@@ -39,7 +39,7 @@ public class EmptyHandler implements IItemHandlerModifiable
@Nonnull
public ItemStack getStackInSlot(int slot)
{
return ItemStack.field_190927_a;
return ItemStack.EMPTY;
}
@Override
@@ -53,7 +53,7 @@ public class EmptyHandler implements IItemHandlerModifiable
@Nonnull
public ItemStack extractItem(int slot, int amount, boolean simulate)
{
return ItemStack.field_190927_a;
return ItemStack.EMPTY;
}
@Override
@@ -72,8 +72,8 @@ public class InvWrapper implements IItemHandlerModifiable
@Nonnull
public ItemStack insertItem(int slot, @Nonnull ItemStack stack, boolean simulate)
{
if (stack.func_190926_b())
return ItemStack.field_190927_a;
if (stack.isEmpty())
return ItemStack.EMPTY;
if (!getInv().isItemValidForSlot(slot, stack))
return stack;
@@ -81,24 +81,24 @@ public class InvWrapper implements IItemHandlerModifiable
ItemStack stackInSlot = getInv().getStackInSlot(slot);
int m;
if (!stackInSlot.func_190926_b())
if (!stackInSlot.isEmpty())
{
if (!ItemHandlerHelper.canItemStacksStack(stack, stackInSlot))
return stack;
m = Math.min(stack.getMaxStackSize(), getSlotLimit(slot)) - stackInSlot.func_190916_E();
m = Math.min(stack.getMaxStackSize(), getSlotLimit(slot)) - stackInSlot.getCount();
if (stack.func_190916_E() <= m)
if (stack.getCount() <= m)
{
if (!simulate)
{
ItemStack copy = stack.copy();
copy.func_190917_f(stackInSlot.func_190916_E());
copy.grow(stackInSlot.getCount());
getInv().setInventorySlotContents(slot, copy);
getInv().markDirty();
}
return ItemStack.field_190927_a;
return ItemStack.EMPTY;
}
else
{
@@ -107,14 +107,14 @@ public class InvWrapper implements IItemHandlerModifiable
if (!simulate)
{
ItemStack copy = stack.splitStack(m);
copy.func_190917_f(stackInSlot.func_190916_E());
copy.grow(stackInSlot.getCount());
getInv().setInventorySlotContents(slot, copy);
getInv().markDirty();
return stack;
}
else
{
stack.func_190918_g(m);
stack.shrink(m);
return stack;
}
}
@@ -122,7 +122,7 @@ public class InvWrapper implements IItemHandlerModifiable
else
{
m = Math.min(stack.getMaxStackSize(), getSlotLimit(slot));
if (m < stack.func_190916_E())
if (m < stack.getCount())
{
// copy the stack to not modify the original one
stack = stack.copy();
@@ -134,7 +134,7 @@ public class InvWrapper implements IItemHandlerModifiable
}
else
{
stack.func_190918_g(m);
stack.shrink(m);
return stack;
}
}
@@ -145,7 +145,7 @@ public class InvWrapper implements IItemHandlerModifiable
getInv().setInventorySlotContents(slot, stack);
getInv().markDirty();
}
return ItemStack.field_190927_a;
return ItemStack.EMPTY;
}
}
@@ -156,29 +156,29 @@ public class InvWrapper implements IItemHandlerModifiable
public ItemStack extractItem(int slot, int amount, boolean simulate)
{
if (amount == 0)
return ItemStack.field_190927_a;
return ItemStack.EMPTY;
ItemStack stackInSlot = getInv().getStackInSlot(slot);
if (stackInSlot.func_190926_b())
return ItemStack.field_190927_a;
if (stackInSlot.isEmpty())
return ItemStack.EMPTY;
if (simulate)
{
if (stackInSlot.func_190916_E() < amount)
if (stackInSlot.getCount() < amount)
{
return stackInSlot.copy();
}
else
{
ItemStack copy = stackInSlot.copy();
copy.func_190920_e(amount);
copy.setCount(amount);
return copy;
}
}
else
{
int m = Math.min(stackInSlot.func_190916_E(), amount);
int m = Math.min(stackInSlot.getCount(), amount);
ItemStack decrStackSize = getInv().decrStackSize(slot, m);
getInv().markDirty();
@@ -49,7 +49,7 @@ public class PlayerArmorInvWrapper extends RangedWrapper
}
}
// check if it's valid for the armor slot
if (equ != null && slot < 4 && !stack.func_190926_b() && stack.getItem().isValidArmor(stack, equ, getInventoryPlayer().player))
if (equ != null && slot < 4 && !stack.isEmpty() && stack.getItem().isValidArmor(stack, equ, getInventoryPlayer().player))
{
return super.insertItem(slot, stack, simulate);
}
@@ -44,15 +44,15 @@ public class PlayerMainInvWrapper extends RangedWrapper
public ItemStack insertItem(int slot, @Nonnull ItemStack stack, boolean simulate)
{
ItemStack rest = super.insertItem(slot, stack, simulate);
if (rest.func_190916_E()!= stack.func_190916_E())
if (rest.getCount()!= stack.getCount())
{
// the stack in the slot changed, animate it
ItemStack inSlot = getStackInSlot(slot);
if(!inSlot.func_190926_b())
if(!inSlot.isEmpty())
{
if (getInventoryPlayer().player.worldObj.isRemote)
if (getInventoryPlayer().player.world.isRemote)
{
inSlot.func_190915_d(5);
inSlot.setAnimationsToGo(5);
}
else if(getInventoryPlayer().player instanceof EntityPlayerMP) {
getInventoryPlayer().player.openContainer.detectAndSendChanges();
@@ -58,7 +58,7 @@ public class RangedWrapper implements IItemHandlerModifiable {
return compose.getStackInSlot(slot + minSlot);
}
return ItemStack.field_190927_a;
return ItemStack.EMPTY;
}
@Override
@@ -82,7 +82,7 @@ public class RangedWrapper implements IItemHandlerModifiable {
return compose.extractItem(slot + minSlot, amount, simulate);
}
return ItemStack.field_190927_a;
return ItemStack.EMPTY;
}
@Override
@@ -78,15 +78,15 @@ public class SidedInvWrapper implements IItemHandlerModifiable
public ItemStack getStackInSlot(int slot)
{
int i = getSlot(inv, slot, side);
return i == -1 ? ItemStack.field_190927_a : inv.getStackInSlot(i);
return i == -1 ? ItemStack.EMPTY : inv.getStackInSlot(i);
}
@Override
@Nonnull
public ItemStack insertItem(int slot, @Nonnull ItemStack stack, boolean simulate)
{
if (stack.func_190926_b())
return ItemStack.field_190927_a;
if (stack.isEmpty())
return ItemStack.EMPTY;
int slot1 = getSlot(inv, slot, side);
@@ -99,23 +99,23 @@ public class SidedInvWrapper implements IItemHandlerModifiable
ItemStack stackInSlot = inv.getStackInSlot(slot1);
int m;
if (!stackInSlot.func_190926_b())
if (!stackInSlot.isEmpty())
{
if (!ItemHandlerHelper.canItemStacksStack(stack, stackInSlot))
return stack;
m = Math.min(stack.getMaxStackSize(), getSlotLimit(slot)) - stackInSlot.func_190916_E();
m = Math.min(stack.getMaxStackSize(), getSlotLimit(slot)) - stackInSlot.getCount();
if (stack.func_190916_E() <= m)
if (stack.getCount() <= m)
{
if (!simulate)
{
ItemStack copy = stack.copy();
copy.func_190917_f(stackInSlot.func_190916_E());
copy.grow(stackInSlot.getCount());
inv.setInventorySlotContents(slot1, copy);
}
return ItemStack.field_190927_a;
return ItemStack.EMPTY;
}
else
{
@@ -124,13 +124,13 @@ public class SidedInvWrapper implements IItemHandlerModifiable
if (!simulate)
{
ItemStack copy = stack.splitStack(m);
copy.func_190917_f(stackInSlot.func_190916_E());
copy.grow(stackInSlot.getCount());
inv.setInventorySlotContents(slot1, copy);
return stack;
}
else
{
stack.func_190918_g(m);
stack.shrink(m);
return stack;
}
}
@@ -138,7 +138,7 @@ public class SidedInvWrapper implements IItemHandlerModifiable
else
{
m = Math.min(stack.getMaxStackSize(), getSlotLimit(slot));
if (m < stack.func_190916_E())
if (m < stack.getCount())
{
// copy the stack to not modify the original one
stack = stack.copy();
@@ -149,7 +149,7 @@ public class SidedInvWrapper implements IItemHandlerModifiable
}
else
{
stack.func_190918_g(m);
stack.shrink(m);
return stack;
}
}
@@ -157,7 +157,7 @@ public class SidedInvWrapper implements IItemHandlerModifiable
{
if (!simulate)
inv.setInventorySlotContents(slot1, stack);
return ItemStack.field_190927_a;
return ItemStack.EMPTY;
}
}
@@ -177,37 +177,37 @@ public class SidedInvWrapper implements IItemHandlerModifiable
public ItemStack extractItem(int slot, int amount, boolean simulate)
{
if (amount == 0)
return ItemStack.field_190927_a;
return ItemStack.EMPTY;
int slot1 = getSlot(inv, slot, side);
if (slot1 == -1)
return ItemStack.field_190927_a;
return ItemStack.EMPTY;
ItemStack stackInSlot = inv.getStackInSlot(slot1);
if (stackInSlot.func_190926_b())
return ItemStack.field_190927_a;
if (stackInSlot.isEmpty())
return ItemStack.EMPTY;
if (!inv.canExtractItem(slot1, stackInSlot, side))
return ItemStack.field_190927_a;
return ItemStack.EMPTY;
if (simulate)
{
if (stackInSlot.func_190916_E() < amount)
if (stackInSlot.getCount() < amount)
{
return stackInSlot.copy();
}
else
{
ItemStack copy = stackInSlot.copy();
copy.func_190920_e(amount);
copy.setCount(amount);
return copy;
}
}
else
{
int m = Math.min(stackInSlot.func_190916_E(), amount);
int m = Math.min(stackInSlot.getCount(), amount);
return inv.decrStackSize(slot1, m);
}
}
@@ -62,7 +62,7 @@ public class OreDictionary
private static List<NonNullList<ItemStack>> idToStack = Lists.newArrayList();
private static List<NonNullList<ItemStack>> idToStackUn = Lists.newArrayList();
private static Map<Integer, List<Integer>> stackToId = Maps.newHashMapWithExpectedSize((int)(128 * 0.75));
public static final NonNullList<ItemStack> EMPTY_LIST = NonNullList.func_191196_a();
public static final NonNullList<ItemStack> EMPTY_LIST = NonNullList.create();
/**
* Minecraft changed from -1 to Short.MAX_VALUE in 1.5 release for the "block wildcard". Use this in case it
@@ -342,7 +342,7 @@ public class OreDictionary
new ItemStack(Blocks.BONE_BLOCK), // Bone Block, to prevent conversion of dyes into bone meal.
new ItemStack(Items.BOAT),
new ItemStack(Items.OAK_DOOR),
ItemStack.field_190927_a //So the above can have a comma and we don't have to keep editing extra lines.
ItemStack.EMPTY //So the above can have a comma and we don't have to keep editing extra lines.
};
List<IRecipe> recipes = CraftingManager.getInstance().getRecipeList();
@@ -356,7 +356,7 @@ public class OreDictionary
{
ShapedRecipes recipe = (ShapedRecipes)obj;
ItemStack output = recipe.getRecipeOutput();
if (!output.func_190926_b() && containsMatch(false, exclusions, output))
if (!output.isEmpty() && containsMatch(false, exclusions, output))
{
continue;
}
@@ -371,7 +371,7 @@ public class OreDictionary
{
ShapelessRecipes recipe = (ShapelessRecipes)obj;
ItemStack output = recipe.getRecipeOutput();
if (!output.func_190926_b() && containsMatch(false, exclusions, output))
if (!output.isEmpty() && containsMatch(false, exclusions, output))
{
continue;
}
@@ -408,7 +408,7 @@ public class OreDictionary
idToName.add(name);
val = idToName.size() - 1; //0 indexed
nameToId.put(name, val);
NonNullList<ItemStack> back = NonNullList.func_191196_a();
NonNullList<ItemStack> back = NonNullList.create();
idToStack.add(back);
idToStackUn.add(back);
}
@@ -435,7 +435,7 @@ public class OreDictionary
*/
public static int[] getOreIDs(@Nonnull ItemStack stack)
{
if (stack.func_190926_b()) throw new IllegalArgumentException("Stack can not be invalid!");
if (stack.isEmpty()) throw new IllegalArgumentException("Stack can not be invalid!");
Set<Integer> set = new HashSet<Integer>();
@@ -572,7 +572,7 @@ public class OreDictionary
public static boolean itemMatches(@Nonnull ItemStack target, @Nonnull ItemStack input, boolean strict)
{
if (input.func_190926_b() && !target.func_190926_b() || !input.func_190926_b() && target.func_190926_b())
if (input.isEmpty() && !target.isEmpty() || !input.isEmpty() && target.isEmpty())
{
return false;
}
@@ -594,7 +594,7 @@ public class OreDictionary
private static void registerOreImpl(String name, @Nonnull ItemStack ore)
{
if ("Unknown".equals(name)) return; //prevent bad IDs.
if (ore.func_190926_b())
if (ore.isEmpty())
{
FMLLog.bigWarning("Invalid registration attempt for an Ore Dictionary item with name %s has occurred. The registration has been denied to prevent crashes. The mod responsible for the registration needs to correct this.", name);
return; //prevent bad ItemStacks.
@@ -42,7 +42,7 @@ public class ShapedOreRecipe implements IRecipe
public static final int MAX_CRAFT_GRID_WIDTH = 3;
public static final int MAX_CRAFT_GRID_HEIGHT = 3;
protected ItemStack output = ItemStack.field_190927_a;
protected ItemStack output = ItemStack.EMPTY;
protected Object[] input = null;
protected int width = 0;
protected int height = 0;
@@ -159,7 +159,7 @@ public class ShapedOreRecipe implements IRecipe
{
ItemStack ingredient = recipe.recipeItems[i];
if(ingredient.func_190926_b()) continue;
if(ingredient.isEmpty()) continue;
input[i] = recipe.recipeItems[i];
@@ -252,7 +252,7 @@ public class ShapedOreRecipe implements IRecipe
return false;
}
}
else if (target == null && !slot.func_190926_b())
else if (target == null && !slot.isEmpty())
{
return false;
}
@@ -19,7 +19,6 @@
package net.minecraftforge.oredict;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;
@@ -38,8 +37,8 @@ import javax.annotation.Nonnull;
public class ShapelessOreRecipe implements IRecipe
{
protected ItemStack output = ItemStack.field_190927_a;
protected NonNullList<Object> input = NonNullList.func_191196_a();
protected ItemStack output = ItemStack.EMPTY;
protected NonNullList<Object> input = NonNullList.create();
public ShapelessOreRecipe(Block result, Object... recipe){ this(new ItemStack(result), recipe); }
public ShapelessOreRecipe(Item result, Object... recipe){ this(new ItemStack(result), recipe); }
@@ -110,14 +109,14 @@ public class ShapelessOreRecipe implements IRecipe
@Override
public boolean matches(InventoryCrafting var1, World world)
{
NonNullList<Object> required = NonNullList.func_191196_a();
NonNullList<Object> required = NonNullList.create();
required.addAll(input);
for (int x = 0; x < var1.getSizeInventory(); x++)
{
ItemStack slot = var1.getStackInSlot(x);
if (!slot.func_190926_b())
if (!slot.isEmpty())
{
boolean inRecipe = false;
Iterator<Object> req = required.iterator();
@@ -48,7 +48,7 @@ public abstract class CommandTreeBase extends CommandBase
public void addSubcommand(ICommand c)
{
commandMap.put(c.getCommandName(), c);
commandMap.put(c.getName(), c);
}
public Collection<ICommand> getSubCommands()
@@ -82,7 +82,7 @@ public abstract class CommandTreeBase extends CommandBase
@Override
@Nonnull
public List<String> getTabCompletionOptions(@Nonnull MinecraftServer server, @Nonnull ICommandSender sender, @Nonnull String[] args, @Nullable BlockPos pos)
public List<String> getTabCompletions(@Nonnull MinecraftServer server, @Nonnull ICommandSender sender, @Nonnull String[] args, @Nullable BlockPos pos)
{
if(args.length == 1)
{
@@ -92,7 +92,7 @@ public abstract class CommandTreeBase extends CommandBase
{
if(c.checkPermission(server, sender))
{
keys.add(c.getCommandName());
keys.add(c.getName());
}
}
@@ -104,10 +104,10 @@ public abstract class CommandTreeBase extends CommandBase
if(cmd != null)
{
return cmd.getTabCompletionOptions(server, sender, shiftArgs(args), pos);
return cmd.getTabCompletions(server, sender, shiftArgs(args), pos);
}
return super.getTabCompletionOptions(server, sender, args, pos);
return super.getTabCompletions(server, sender, args, pos);
}
@Override
@@ -130,7 +130,7 @@ public abstract class CommandTreeBase extends CommandBase
{
if(args.length < 1)
{
sender.addChatMessage(new TextComponentString(CommandBase.joinNiceStringFromCollection(commandMap.keySet())));
sender.sendMessage(new TextComponentString(CommandBase.joinNiceStringFromCollection(commandMap.keySet())));
}
else
{
@@ -20,16 +20,12 @@
package net.minecraftforge.server.command;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import net.minecraft.command.CommandBase;
import net.minecraft.command.CommandException;
import net.minecraft.command.ICommandSender;
import net.minecraft.command.WrongUsageException;
import net.minecraft.server.MinecraftServer;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.TextComponentTranslation;
import net.minecraftforge.common.DimensionManager;
import net.minecraftforge.server.ForgeTimeTracker;
@@ -39,13 +35,13 @@ public class ForgeCommand extends CommandBase {
private static final DecimalFormat timeFormatter = new DecimalFormat("########0.000");
@Override
public String getCommandName()
public String getName()
{
return "forge";
}
@Override
public String getCommandUsage(ICommandSender icommandsender)
public String getUsage(ICommandSender icommandsender)
{
return "commands.forge.usage";
}
@@ -107,7 +103,7 @@ public class ForgeCommand extends CommandBase {
{
ForgeTimeTracker.tileEntityTrackingDuration = duration;
ForgeTimeTracker.tileEntityTracking = true;
sender.addChatMessage(new TextComponentTranslation("commands.forge.tracking.te.enabled", duration));
sender.sendMessage(new TextComponentTranslation("commands.forge.tracking.te.enabled", duration));
}
private void doTPSLog(MinecraftServer server, ICommandSender sender, String[] args)
@@ -130,17 +126,17 @@ public class ForgeCommand extends CommandBase {
{
double worldTickTime = ForgeCommand.mean(server.worldTickTimes.get(dimId)) * 1.0E-6D;
double worldTPS = Math.min(1000.0/worldTickTime, 20);
sender.addChatMessage(new TextComponentTranslation("commands.forge.tps.summary",String.format("Dim %d", dimId), timeFormatter.format(worldTickTime), timeFormatter.format(worldTPS)));
sender.sendMessage(new TextComponentTranslation("commands.forge.tps.summary",String.format("Dim %d", dimId), timeFormatter.format(worldTickTime), timeFormatter.format(worldTPS)));
}
double meanTickTime = ForgeCommand.mean(server.tickTimeArray) * 1.0E-6D;
double meanTPS = Math.min(1000.0/meanTickTime, 20);
sender.addChatMessage(new TextComponentTranslation("commands.forge.tps.summary","Overall", timeFormatter.format(meanTickTime), timeFormatter.format(meanTPS)));
sender.sendMessage(new TextComponentTranslation("commands.forge.tps.summary","Overall", timeFormatter.format(meanTickTime), timeFormatter.format(meanTPS)));
}
else
{
double worldTickTime = ForgeCommand.mean(server.worldTickTimes.get(dim)) * 1.0E-6D;
double worldTPS = Math.min(1000.0/worldTickTime, 20);
sender.addChatMessage(new TextComponentTranslation("commands.forge.tps.summary",String.format("Dim %d", dim), timeFormatter.format(worldTickTime), timeFormatter.format(worldTPS)));
sender.sendMessage(new TextComponentTranslation("commands.forge.tps.summary",String.format("Dim %d", dim), timeFormatter.format(worldTickTime), timeFormatter.format(worldTPS)));
}
}