Update MCP mappings to snapshot_nodoc_20161220 (#3551)
This commit is contained in:
parent
1f4007e5d8
commit
5165dc52bf
|
@ -29,7 +29,7 @@ apply plugin: "net.minecraftforge.gradle.launch4j"
|
||||||
minecraft.version = "1.11"
|
minecraft.version = "1.11"
|
||||||
|
|
||||||
minecraft {
|
minecraft {
|
||||||
mappings = 'snapshot_nodoc_20161111'
|
mappings = 'snapshot_nodoc_20161220'
|
||||||
workspaceDir = "projects"
|
workspaceDir = "projects"
|
||||||
versionJson = "jsons/${minecraft.version}-dev.json"
|
versionJson = "jsons/${minecraft.version}-dev.json"
|
||||||
buildUserdev = true
|
buildUserdev = true
|
||||||
|
|
|
@ -8,11 +8,11 @@ buildscript {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
apply plugin: 'net.minecraftforge.gradle.forge'
|
apply plugin: 'net.minecraftforge.gradle.forge'
|
||||||
//Only edit below this line, the above code adds and enables the nessasary things for Forge to be setup.
|
//Only edit below this line, the above code adds and enables the necessary things for Forge to be setup.
|
||||||
|
|
||||||
|
|
||||||
version = "1.0"
|
version = "1.0"
|
||||||
group= "com.yourname.modid" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
|
group = "com.yourname.modid" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
|
||||||
archivesBaseName = "modid"
|
archivesBaseName = "modid"
|
||||||
|
|
||||||
sourceCompatibility = targetCompatibility = "1.6" // Need this here so eclipse task generates correctly.
|
sourceCompatibility = targetCompatibility = "1.6" // Need this here so eclipse task generates correctly.
|
||||||
|
@ -27,7 +27,7 @@ minecraft {
|
||||||
// the mappings can be changed at any time, and must be in the following format.
|
// the mappings can be changed at any time, and must be in the following format.
|
||||||
// snapshot_YYYYMMDD snapshot are built nightly.
|
// snapshot_YYYYMMDD snapshot are built nightly.
|
||||||
// stable_# stables are built at the discretion of the MCP team.
|
// stable_# stables are built at the discretion of the MCP team.
|
||||||
// Use non-default mappings at your own risk. they may not allways work.
|
// Use non-default mappings at your own risk. they may not always work.
|
||||||
// simply re-run your setup task after changing the mappings to update your workspace.
|
// simply re-run your setup task after changing the mappings to update your workspace.
|
||||||
mappings = "@MAPPINGS@"
|
mappings = "@MAPPINGS@"
|
||||||
// makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable.
|
// makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable.
|
||||||
|
@ -57,8 +57,7 @@ dependencies {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
processResources
|
processResources {
|
||||||
{
|
|
||||||
// this will ensure that this task is redone when the versions change.
|
// this will ensure that this task is redone when the versions change.
|
||||||
inputs.property "version", project.version
|
inputs.property "version", project.version
|
||||||
inputs.property "mcversion", project.minecraft.version
|
inputs.property "mcversion", project.minecraft.version
|
||||||
|
@ -71,7 +70,7 @@ processResources
|
||||||
expand 'version':project.version, 'mcversion':project.minecraft.version
|
expand 'version':project.version, 'mcversion':project.minecraft.version
|
||||||
}
|
}
|
||||||
|
|
||||||
// copy everything else, thats not the mcmod.info
|
// copy everything else except the mcmod.info
|
||||||
from(sourceSets.main.resources.srcDirs) {
|
from(sourceSets.main.resources.srcDirs) {
|
||||||
exclude 'mcmod.info'
|
exclude 'mcmod.info'
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,7 +48,7 @@
|
||||||
this.field_151002_e = Item.func_111206_d(p_i47263_1_.func_74779_i("id"));
|
this.field_151002_e = Item.func_111206_d(p_i47263_1_.func_74779_i("id"));
|
||||||
this.field_77994_a = p_i47263_1_.func_74771_c("Count");
|
this.field_77994_a = p_i47263_1_.func_74771_c("Count");
|
||||||
this.field_77991_e = Math.max(0, p_i47263_1_.func_74765_d("Damage"));
|
this.field_77991_e = Math.max(0, p_i47263_1_.func_74765_d("Damage"));
|
||||||
@@ -124,6 +132,7 @@
|
@@ -124,11 +132,12 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
this.func_190923_F();
|
this.func_190923_F();
|
||||||
|
@ -56,6 +56,12 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean func_190926_b()
|
public boolean func_190926_b()
|
||||||
|
{
|
||||||
|
- return this == field_190927_a ? true : (this.field_151002_e != null && this.field_151002_e != Item.func_150898_a(Blocks.field_150350_a) ? (this.field_77994_a <= 0 ? true : this.field_77991_e < -32768 || this.field_77991_e > 65535) : true);
|
||||||
|
+ return this == field_190927_a ? true : (getItemRaw() != null && getItemRaw() != Item.func_150898_a(Blocks.field_150350_a) ? (this.field_77994_a <= 0 ? true : this.field_77991_e < -32768 || this.field_77991_e > 65535) : true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void func_189868_a(DataFixer p_189868_0_)
|
||||||
@@ -148,11 +157,12 @@
|
@@ -148,11 +157,12 @@
|
||||||
|
|
||||||
public Item func_77973_b()
|
public Item func_77973_b()
|
||||||
|
@ -266,7 +272,7 @@
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public int func_190921_D()
|
public int func_190921_D()
|
||||||
{
|
{
|
||||||
@@ -1013,4 +1085,18 @@
|
@@ -1013,4 +1085,28 @@
|
||||||
{
|
{
|
||||||
this.func_190917_f(-p_190918_1_);
|
this.func_190917_f(-p_190918_1_);
|
||||||
}
|
}
|
||||||
|
@ -276,12 +282,22 @@
|
||||||
+ */
|
+ */
|
||||||
+ private void forgeInit()
|
+ private void forgeInit()
|
||||||
+ {
|
+ {
|
||||||
+ if (this.field_151002_e != null)
|
+ Item item = getItemRaw();
|
||||||
|
+ if (item != null)
|
||||||
+ {
|
+ {
|
||||||
+ this.delegate = this.field_151002_e.delegate;
|
+ this.delegate = item.delegate;
|
||||||
+ net.minecraftforge.common.capabilities.ICapabilityProvider provider = this.field_151002_e.initCapabilities(this, this.capNBT);
|
+ net.minecraftforge.common.capabilities.ICapabilityProvider provider = item.initCapabilities(this, this.capNBT);
|
||||||
+ this.capabilities = net.minecraftforge.event.ForgeEventFactory.gatherCapabilities(this.field_151002_e, this, provider);
|
+ this.capabilities = net.minecraftforge.event.ForgeEventFactory.gatherCapabilities(item, this, provider);
|
||||||
+ if (this.capNBT != null && this.capabilities != null) this.capabilities.deserializeNBT(this.capNBT);
|
+ if (this.capNBT != null && this.capabilities != null) this.capabilities.deserializeNBT(this.capNBT);
|
||||||
+ }
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ /**
|
||||||
|
+ * Internal call to get the actual item, not the delegate.
|
||||||
|
+ * In all other methods, FML replaces calls to this.item with the item delegate.
|
||||||
|
+ */
|
||||||
|
+ private Item getItemRaw()
|
||||||
|
+ {
|
||||||
|
+ return this.field_151002_e;
|
||||||
+ }
|
+ }
|
||||||
}
|
}
|
||||||
|
|
|
@ -224,7 +224,7 @@
|
||||||
{
|
{
|
||||||
- if (!p_187251_1_.func_70093_af() || p_187251_1_.func_184614_ca().func_190926_b() && p_187251_1_.func_184592_cb().func_190926_b())
|
- if (!p_187251_1_.func_70093_af() || p_187251_1_.func_184614_ca().func_190926_b() && p_187251_1_.func_184592_cb().func_190926_b())
|
||||||
+ net.minecraftforge.event.entity.player.PlayerInteractEvent.RightClickBlock event = net.minecraftforge.common.ForgeHooks
|
+ net.minecraftforge.event.entity.player.PlayerInteractEvent.RightClickBlock event = net.minecraftforge.common.ForgeHooks
|
||||||
+ .onRightClickBlock(p_187251_1_, p_187251_4_, p_187251_5_, p_187251_6_, net.minecraftforge.common.ForgeHooks.rayTraceEyeHitVec(field_73090_b, getBlockReachDistance() + 1));
|
+ .onRightClickBlock(p_187251_1_, p_187251_4_, p_187251_5_, p_187251_6_, net.minecraftforge.common.ForgeHooks.rayTraceEyeHitVec(p_187251_1_, getBlockReachDistance() + 1));
|
||||||
+ if (event.isCanceled()) return EnumActionResult.PASS;
|
+ if (event.isCanceled()) return EnumActionResult.PASS;
|
||||||
+
|
+
|
||||||
+ EnumActionResult ret = p_187251_3_.onItemUseFirst(p_187251_1_, p_187251_2_, p_187251_5_, p_187251_4_, p_187251_6_, p_187251_7_, p_187251_8_, p_187251_9_);
|
+ EnumActionResult ret = p_187251_3_.onItemUseFirst(p_187251_1_, p_187251_2_, p_187251_5_, p_187251_4_, p_187251_6_, p_187251_7_, p_187251_8_, p_187251_9_);
|
||||||
|
|
|
@ -94,20 +94,20 @@ public class ClientCommandHandler extends CommandHandler
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sender.addChatMessage(format(RED, "commands.generic.permission"));
|
sender.sendMessage(format(RED, "commands.generic.permission"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (WrongUsageException wue)
|
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)
|
catch (CommandException ce)
|
||||||
{
|
{
|
||||||
sender.addChatMessage(format(RED, ce.getMessage(), ce.getErrorObjects()));
|
sender.sendMessage(format(RED, ce.getMessage(), ce.getErrorObjects()));
|
||||||
}
|
}
|
||||||
catch (Throwable t)
|
catch (Throwable t)
|
||||||
{
|
{
|
||||||
sender.addChatMessage(format(RED, "commands.generic.exception"));
|
sender.sendMessage(format(RED, "commands.generic.exception"));
|
||||||
t.printStackTrace();
|
t.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -133,7 +133,7 @@ public class ClientCommandHandler extends CommandHandler
|
||||||
Minecraft mc = FMLClientHandler.instance().getClient();
|
Minecraft mc = FMLClientHandler.instance().getClient();
|
||||||
if (mc.currentScreen instanceof GuiChat)
|
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 (commands != null && !commands.isEmpty())
|
||||||
{
|
{
|
||||||
if (leftOfCursor.indexOf(' ') == -1)
|
if (leftOfCursor.indexOf(' ') == -1)
|
||||||
|
|
|
@ -263,7 +263,7 @@ public class ForgeHooksClient
|
||||||
int distance = 0;
|
int distance = 0;
|
||||||
if (settings.fancyGraphics && ranges.length > 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;
|
int r = 0;
|
||||||
|
@ -672,8 +672,8 @@ public class ForgeHooksClient
|
||||||
|
|
||||||
public static boolean shouldCauseReequipAnimation(@Nonnull ItemStack from, @Nonnull ItemStack to, int slot)
|
public static boolean shouldCauseReequipAnimation(@Nonnull ItemStack from, @Nonnull ItemStack to, int slot)
|
||||||
{
|
{
|
||||||
boolean fromInvalid = from.func_190926_b();
|
boolean fromInvalid = from.isEmpty();
|
||||||
boolean toInvalid = to.func_190926_b();
|
boolean toInvalid = to.isEmpty();
|
||||||
|
|
||||||
if (fromInvalid && toInvalid) return false;
|
if (fromInvalid && toInvalid) return false;
|
||||||
if (fromInvalid || toInvalid) return true;
|
if (fromInvalid || toInvalid) return true;
|
||||||
|
|
|
@ -107,9 +107,9 @@ public class GuiIngameForge extends GuiIngame
|
||||||
eventParent = new RenderGameOverlayEvent(partialTicks, res);
|
eventParent = new RenderGameOverlayEvent(partialTicks, res);
|
||||||
int width = res.getScaledWidth();
|
int width = res.getScaledWidth();
|
||||||
int height = res.getScaledHeight();
|
int height = res.getScaledHeight();
|
||||||
renderHealthMount = mc.thePlayer.getRidingEntity() instanceof EntityLivingBase;
|
renderHealthMount = mc.player.getRidingEntity() instanceof EntityLivingBase;
|
||||||
renderFood = mc.thePlayer.getRidingEntity() == null;
|
renderFood = mc.player.getRidingEntity() == null;
|
||||||
renderJumpBar = mc.thePlayer.isRidingHorse();
|
renderJumpBar = mc.player.isRidingHorse();
|
||||||
|
|
||||||
right_height = 39;
|
right_height = 39;
|
||||||
left_height = 39;
|
left_height = 39;
|
||||||
|
@ -122,7 +122,7 @@ public class GuiIngameForge extends GuiIngame
|
||||||
|
|
||||||
if (Minecraft.isFancyGraphicsEnabled())
|
if (Minecraft.isFancyGraphicsEnabled())
|
||||||
{
|
{
|
||||||
renderVignette(mc.thePlayer.getBrightness(partialTicks), res);
|
renderVignette(mc.player.getBrightness(partialTicks), res);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -132,7 +132,7 @@ public class GuiIngameForge extends GuiIngame
|
||||||
|
|
||||||
if (renderHelmet) renderHelmet(res, partialTicks);
|
if (renderHelmet) renderHelmet(res, partialTicks);
|
||||||
|
|
||||||
if (renderPortal && !mc.thePlayer.isPotionActive(MobEffects.NAUSEA))
|
if (renderPortal && !mc.player.isPotionActive(MobEffects.NAUSEA))
|
||||||
{
|
{
|
||||||
renderPortal(res, partialTicks);
|
renderPortal(res, partialTicks);
|
||||||
}
|
}
|
||||||
|
@ -176,9 +176,9 @@ public class GuiIngameForge extends GuiIngame
|
||||||
renderTitle(width, height, partialTicks);
|
renderTitle(width, height, partialTicks);
|
||||||
|
|
||||||
|
|
||||||
Scoreboard scoreboard = this.mc.theWorld.getScoreboard();
|
Scoreboard scoreboard = this.mc.world.getScoreboard();
|
||||||
ScoreObjective objective = null;
|
ScoreObjective objective = null;
|
||||||
ScorePlayerTeam scoreplayerteam = scoreboard.getPlayersTeam(mc.thePlayer.getName());
|
ScorePlayerTeam scoreplayerteam = scoreboard.getPlayersTeam(mc.player.getName());
|
||||||
if (scoreplayerteam != null)
|
if (scoreplayerteam != null)
|
||||||
{
|
{
|
||||||
int slot = scoreplayerteam.getChatFormat().getColorIndex();
|
int slot = scoreplayerteam.getChatFormat().getColorIndex();
|
||||||
|
@ -251,7 +251,7 @@ public class GuiIngameForge extends GuiIngame
|
||||||
{
|
{
|
||||||
if (pre(HELMET)) return;
|
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)
|
if (this.mc.gameSettings.thirdPersonView == 0 && itemstack != null && itemstack.getItem() != null)
|
||||||
{
|
{
|
||||||
|
@ -261,7 +261,7 @@ public class GuiIngameForge extends GuiIngame
|
||||||
}
|
}
|
||||||
else
|
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 left = width / 2 - 91;
|
||||||
int top = height - left_height;
|
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)
|
for (int i = 1; level > 0 && i < 20; i += 2)
|
||||||
{
|
{
|
||||||
if (i < level)
|
if (i < level)
|
||||||
|
@ -305,7 +305,7 @@ public class GuiIngameForge extends GuiIngame
|
||||||
{
|
{
|
||||||
if (pre(PORTAL)) return;
|
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)
|
if (f1 > 0.0F)
|
||||||
{
|
{
|
||||||
|
@ -344,8 +344,8 @@ public class GuiIngameForge extends GuiIngame
|
||||||
if (player.isInsideOfMaterial(Material.WATER))
|
if (player.isInsideOfMaterial(Material.WATER))
|
||||||
{
|
{
|
||||||
int air = player.getAir();
|
int air = player.getAir();
|
||||||
int full = MathHelper.ceiling_double_int((double)(air - 2) * 10.0D / 300.0D);
|
int full = MathHelper.ceil((double)(air - 2) * 10.0D / 300.0D);
|
||||||
int partial = MathHelper.ceiling_double_int((double)air * 10.0D / 300.0D) - full;
|
int partial = MathHelper.ceil((double)air * 10.0D / 300.0D) - full;
|
||||||
|
|
||||||
for (int i = 0; i < full + partial; ++i)
|
for (int i = 0; i < full + partial; ++i)
|
||||||
{
|
{
|
||||||
|
@ -367,7 +367,7 @@ public class GuiIngameForge extends GuiIngame
|
||||||
GlStateManager.enableBlend();
|
GlStateManager.enableBlend();
|
||||||
|
|
||||||
EntityPlayer player = (EntityPlayer)this.mc.getRenderViewEntity();
|
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;
|
boolean highlight = healthUpdateCounter > (long)updateCounter && (healthUpdateCounter - (long)updateCounter) / 3L %2L == 1L;
|
||||||
|
|
||||||
if (health < this.playerHealth && player.hurtResistantTime > 0)
|
if (health < this.playerHealth && player.hurtResistantTime > 0)
|
||||||
|
@ -393,9 +393,9 @@ public class GuiIngameForge extends GuiIngame
|
||||||
|
|
||||||
IAttributeInstance attrMaxHealth = player.getEntityAttribute(SharedMonsterAttributes.MAX_HEALTH);
|
IAttributeInstance attrMaxHealth = player.getEntityAttribute(SharedMonsterAttributes.MAX_HEALTH);
|
||||||
float healthMax = (float)attrMaxHealth.getAttributeValue();
|
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);
|
int rowHeight = Math.max(10 - (healthRows - 2), 3);
|
||||||
|
|
||||||
this.rand.setSeed((long)(updateCounter * 312871));
|
this.rand.setSeed((long)(updateCounter * 312871));
|
||||||
|
@ -411,17 +411,17 @@ public class GuiIngameForge extends GuiIngame
|
||||||
regen = updateCounter % 25;
|
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);
|
final int BACKGROUND = (highlight ? 25 : 16);
|
||||||
int MARGIN = 16;
|
int MARGIN = 16;
|
||||||
if (player.isPotionActive(MobEffects.POISON)) MARGIN += 36;
|
if (player.isPotionActive(MobEffects.POISON)) MARGIN += 36;
|
||||||
else if (player.isPotionActive(MobEffects.WITHER)) MARGIN += 72;
|
else if (player.isPotionActive(MobEffects.WITHER)) MARGIN += 72;
|
||||||
float absorbRemaining = absorb;
|
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 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 x = left + i % 10 * 8;
|
||||||
int y = top - row * rowHeight;
|
int y = top - row * rowHeight;
|
||||||
|
|
||||||
|
@ -477,7 +477,7 @@ public class GuiIngameForge extends GuiIngame
|
||||||
right_height += 10;
|
right_height += 10;
|
||||||
boolean unused = false;// Unused flag in vanilla, seems to be part of a 'fade out' mechanic
|
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();
|
int level = stats.getFoodLevel();
|
||||||
|
|
||||||
for (int i = 0; i < 10; ++i)
|
for (int i = 0; i < 10; ++i)
|
||||||
|
@ -488,7 +488,7 @@ public class GuiIngameForge extends GuiIngame
|
||||||
int icon = 16;
|
int icon = 16;
|
||||||
byte background = 0;
|
byte background = 0;
|
||||||
|
|
||||||
if (mc.thePlayer.isPotionActive(MobEffects.HUNGER))
|
if (mc.player.isPotionActive(MobEffects.HUNGER))
|
||||||
{
|
{
|
||||||
icon += 36;
|
icon += 36;
|
||||||
background = 13;
|
background = 13;
|
||||||
|
@ -514,12 +514,12 @@ public class GuiIngameForge extends GuiIngame
|
||||||
|
|
||||||
protected void renderSleepFade(int width, int height)
|
protected void renderSleepFade(int width, int height)
|
||||||
{
|
{
|
||||||
if (mc.thePlayer.getSleepTimer() > 0)
|
if (mc.player.getSleepTimer() > 0)
|
||||||
{
|
{
|
||||||
mc.mcProfiler.startSection("sleep");
|
mc.mcProfiler.startSection("sleep");
|
||||||
GlStateManager.disableDepth();
|
GlStateManager.disableDepth();
|
||||||
GlStateManager.disableAlpha();
|
GlStateManager.disableAlpha();
|
||||||
int sleepTime = mc.thePlayer.getSleepTimer();
|
int sleepTime = mc.player.getSleepTimer();
|
||||||
float opacity = (float)sleepTime / 100.0F;
|
float opacity = (float)sleepTime / 100.0F;
|
||||||
|
|
||||||
if (opacity > 1.0F)
|
if (opacity > 1.0F)
|
||||||
|
@ -545,13 +545,13 @@ public class GuiIngameForge extends GuiIngame
|
||||||
if (mc.playerController.gameIsSurvivalOrAdventure())
|
if (mc.playerController.gameIsSurvivalOrAdventure())
|
||||||
{
|
{
|
||||||
mc.mcProfiler.startSection("expBar");
|
mc.mcProfiler.startSection("expBar");
|
||||||
int cap = this.mc.thePlayer.xpBarCap();
|
int cap = this.mc.player.xpBarCap();
|
||||||
int left = width / 2 - 91;
|
int left = width / 2 - 91;
|
||||||
|
|
||||||
if (cap > 0)
|
if (cap > 0)
|
||||||
{
|
{
|
||||||
short barWidth = 182;
|
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;
|
int top = height - 32 + 3;
|
||||||
drawTexturedModalRect(left, top, 0, 64, barWidth, 5);
|
drawTexturedModalRect(left, top, 0, 64, barWidth, 5);
|
||||||
|
|
||||||
|
@ -564,12 +564,12 @@ public class GuiIngameForge extends GuiIngame
|
||||||
this.mc.mcProfiler.endSection();
|
this.mc.mcProfiler.endSection();
|
||||||
|
|
||||||
|
|
||||||
if (mc.playerController.gameIsSurvivalOrAdventure() && mc.thePlayer.experienceLevel > 0)
|
if (mc.playerController.gameIsSurvivalOrAdventure() && mc.player.experienceLevel > 0)
|
||||||
{
|
{
|
||||||
mc.mcProfiler.startSection("expLevel");
|
mc.mcProfiler.startSection("expLevel");
|
||||||
boolean flag1 = false;
|
boolean flag1 = false;
|
||||||
int color = flag1 ? 16777215 : 8453920;
|
int color = flag1 ? 16777215 : 8453920;
|
||||||
String text = "" + mc.thePlayer.experienceLevel;
|
String text = "" + mc.player.experienceLevel;
|
||||||
int x = (width - fontrenderer.getStringWidth(text)) / 2;
|
int x = (width - fontrenderer.getStringWidth(text)) / 2;
|
||||||
int y = height - 31 - 4;
|
int y = height - 31 - 4;
|
||||||
fontrenderer.drawString(text, x + 1, y, 0);
|
fontrenderer.drawString(text, x + 1, y, 0);
|
||||||
|
@ -594,7 +594,7 @@ public class GuiIngameForge extends GuiIngame
|
||||||
GlStateManager.disableBlend();
|
GlStateManager.disableBlend();
|
||||||
|
|
||||||
mc.mcProfiler.startSection("jumpBar");
|
mc.mcProfiler.startSection("jumpBar");
|
||||||
float charge = mc.thePlayer.getHorseJumpPower();
|
float charge = mc.player.getHorseJumpPower();
|
||||||
final int barWidth = 182;
|
final int barWidth = 182;
|
||||||
int x = (width / 2) - (barWidth / 2);
|
int x = (width / 2) - (barWidth / 2);
|
||||||
int filled = (int)(charge * (float)(barWidth + 1));
|
int filled = (int)(charge * (float)(barWidth + 1));
|
||||||
|
@ -657,7 +657,7 @@ public class GuiIngameForge extends GuiIngame
|
||||||
|
|
||||||
mc.mcProfiler.endSection();
|
mc.mcProfiler.endSection();
|
||||||
}
|
}
|
||||||
else if (this.mc.thePlayer.isSpectator())
|
else if (this.mc.player.isSpectator())
|
||||||
{
|
{
|
||||||
this.spectatorGui.renderSelectedItem(res);
|
this.spectatorGui.renderSelectedItem(res);
|
||||||
}
|
}
|
||||||
|
@ -672,7 +672,7 @@ public class GuiIngameForge extends GuiIngame
|
||||||
|
|
||||||
if (mc.isDemo())
|
if (mc.isDemo())
|
||||||
{
|
{
|
||||||
long time = mc.theWorld.getTotalWorldTime();
|
long time = mc.world.getTotalWorldTime();
|
||||||
if (time >= 120500L)
|
if (time >= 120500L)
|
||||||
{
|
{
|
||||||
listR.add(I18n.format("demo.demoExpired"));
|
listR.add(I18n.format("demo.demoExpired"));
|
||||||
|
@ -729,10 +729,10 @@ public class GuiIngameForge extends GuiIngame
|
||||||
|
|
||||||
protected void renderRecordOverlay(int width, int height, float partialTicks)
|
protected void renderRecordOverlay(int width, int height, float partialTicks)
|
||||||
{
|
{
|
||||||
if (recordPlayingUpFor > 0)
|
if (overlayMessageTime > 0)
|
||||||
{
|
{
|
||||||
mc.mcProfiler.startSection("overlayMessage");
|
mc.mcProfiler.startSection("overlayMessage");
|
||||||
float hue = (float)recordPlayingUpFor - partialTicks;
|
float hue = (float)overlayMessageTime - partialTicks;
|
||||||
int opacity = (int)(hue * 256.0F / 20.0F);
|
int opacity = (int)(hue * 256.0F / 20.0F);
|
||||||
if (opacity > 255) opacity = 255;
|
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.translate((float)(width / 2), (float)(height - 68), 0.0F);
|
||||||
GlStateManager.enableBlend();
|
GlStateManager.enableBlend();
|
||||||
GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO);
|
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);
|
int color = (animateOverlayMessageColor ? Color.HSBtoRGB(hue / 50.0F, 0.7F, 0.6F) & WHITE : WHITE);
|
||||||
fontrenderer.drawString(recordPlaying, -fontrenderer.getStringWidth(recordPlaying) / 2, -4, color | (opacity << 24));
|
fontrenderer.drawString(overlayMessage, -fontrenderer.getStringWidth(overlayMessage) / 2, -4, color | (opacity << 24));
|
||||||
GlStateManager.disableBlend();
|
GlStateManager.disableBlend();
|
||||||
GlStateManager.popMatrix();
|
GlStateManager.popMatrix();
|
||||||
}
|
}
|
||||||
|
@ -767,7 +767,7 @@ public class GuiIngameForge extends GuiIngame
|
||||||
}
|
}
|
||||||
if (titlesTimer <= titleFadeOut) opacity = (int)(age * 255.0F / (float)this.titleFadeOut);
|
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)
|
if (opacity > 8)
|
||||||
{
|
{
|
||||||
|
@ -811,14 +811,14 @@ public class GuiIngameForge extends GuiIngame
|
||||||
|
|
||||||
protected void renderPlayerList(int width, int height)
|
protected void renderPlayerList(int width, int height)
|
||||||
{
|
{
|
||||||
ScoreObjective scoreobjective = this.mc.theWorld.getScoreboard().getObjectiveInDisplaySlot(0);
|
ScoreObjective scoreobjective = this.mc.world.getScoreboard().getObjectiveInDisplaySlot(0);
|
||||||
NetHandlerPlayClient handler = mc.thePlayer.connection;
|
NetHandlerPlayClient handler = mc.player.connection;
|
||||||
|
|
||||||
if (mc.gameSettings.keyBindPlayerList.isKeyDown() && (!mc.isIntegratedServerRunning() || handler.getPlayerInfoMap().size() > 1 || scoreobjective != null))
|
if (mc.gameSettings.keyBindPlayerList.isKeyDown() && (!mc.isIntegratedServerRunning() || handler.getPlayerInfoMap().size() > 1 || scoreobjective != null))
|
||||||
{
|
{
|
||||||
this.overlayPlayerList.updatePlayerList(true);
|
this.overlayPlayerList.updatePlayerList(true);
|
||||||
if (pre(PLAYER_LIST)) return;
|
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);
|
post(PLAYER_LIST);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -177,7 +177,7 @@ public final class ModelFluid implements IModelCustomData
|
||||||
if(flow == null) flow = -1000f;
|
if(flow == null) flow = -1000f;
|
||||||
}
|
}
|
||||||
int flowRound = (int)Math.round(Math.toDegrees(flow));
|
int flowRound = (int)Math.round(Math.toDegrees(flow));
|
||||||
flowRound = MathHelper.clamp_int(flowRound, -1000, 1000);
|
flowRound = MathHelper.clamp(flowRound, -1000, 1000);
|
||||||
return flowRound;
|
return flowRound;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -73,11 +73,11 @@ public final class AnimationItemOverrideList extends ItemOverrideList
|
||||||
IAnimationStateMachine asm = stack.getCapability(CapabilityAnimation.ANIMATION_CAPABILITY, null);
|
IAnimationStateMachine asm = stack.getCapability(CapabilityAnimation.ANIMATION_CAPABILITY, null);
|
||||||
if(world == null && entity != null)
|
if(world == null && entity != null)
|
||||||
{
|
{
|
||||||
world = entity.worldObj;
|
world = entity.world;
|
||||||
}
|
}
|
||||||
if(world == null)
|
if(world == null)
|
||||||
{
|
{
|
||||||
world = Minecraft.getMinecraft().theWorld;
|
world = Minecraft.getMinecraft().world;
|
||||||
}
|
}
|
||||||
IModelState state = asm.apply(Animation.getWorldTime(world, Animation.getPartialTickTime())).getLeft();
|
IModelState state = asm.apply(Animation.getWorldTime(world, Animation.getPartialTickTime())).getLeft();
|
||||||
return model.bake(new ModelStateComposition(state, this.state), format, bakedTextureGetter);
|
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);
|
VertexBuffer.setTranslation(-0.5, -1.5, -0.5);
|
||||||
|
|
||||||
lighter.setParent(new VertexBufferConsumer(VertexBuffer));
|
lighter.setParent(new VertexBufferConsumer(VertexBuffer));
|
||||||
lighter.setWorld(entity.worldObj);
|
lighter.setWorld(entity.world);
|
||||||
lighter.setState(Blocks.AIR.getDefaultState());
|
lighter.setState(Blocks.AIR.getDefaultState());
|
||||||
lighter.setBlockPos(pos);
|
lighter.setBlockPos(pos);
|
||||||
boolean empty = true;
|
boolean empty = true;
|
||||||
|
|
|
@ -54,7 +54,7 @@ public class AnimationTESR<T extends TileEntity> extends FastTESR<T> implements
|
||||||
BlockPos pos = te.getPos();
|
BlockPos pos = te.getPos();
|
||||||
IBlockAccess world = MinecraftForgeClient.getRegionRenderCache(te.getWorld(), pos);
|
IBlockAccess world = MinecraftForgeClient.getRegionRenderCache(te.getWorld(), pos);
|
||||||
IBlockState state = world.getBlockState(pos);
|
IBlockState state = world.getBlockState(pos);
|
||||||
if(state.getPropertyNames().contains(Properties.StaticProperty))
|
if(state.getPropertyKeys().contains(Properties.StaticProperty))
|
||||||
{
|
{
|
||||||
state = state.withProperty(Properties.StaticProperty, false);
|
state = state.withProperty(Properties.StaticProperty, false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -330,7 +330,7 @@ public class ModelBlockAnimation
|
||||||
{
|
{
|
||||||
int length = loop ? var.samples.length : (var.samples.length - 1);
|
int length = loop ? var.samples.length : (var.samples.length - 1);
|
||||||
float timeScaled = time * length;
|
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;
|
float progress = timeScaled - s1;
|
||||||
int s2 = s1 + 1;
|
int s2 = s1 + 1;
|
||||||
if(s2 == length && loop) s2 = 0;
|
if(s2 == length && loop) s2 = 0;
|
||||||
|
|
|
@ -190,7 +190,7 @@ public enum B3DLoader implements ICustomModelLoader
|
||||||
this.animation = animation;
|
this.animation = animation;
|
||||||
this.frame = frame;
|
this.frame = frame;
|
||||||
this.nextFrame = nextFrame;
|
this.nextFrame = nextFrame;
|
||||||
this.progress = MathHelper.clamp_float(progress, 0, 1);
|
this.progress = MathHelper.clamp(progress, 0, 1);
|
||||||
this.parent = getParent(parent);
|
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 - 1] * (0 + x) * (0 + y) * (1 - z);
|
||||||
a += ao[sx - 0][sy - 0][sz - 0] * (0 + x) * (0 + y) * (0 + 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;
|
return a;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -204,7 +204,7 @@ public class DimensionManager
|
||||||
tmp.add(entry.getValue());
|
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)
|
public static void initDimension(int dim)
|
||||||
|
|
|
@ -84,7 +84,7 @@ import com.google.common.collect.Sets;
|
||||||
* The basic principle is a ticket based system.
|
* The basic principle is a ticket based system.
|
||||||
* 1. Mods register a callback {@link #setForcedChunkLoadingCallback(Object, LoadingCallback)}
|
* 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.
|
* 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.
|
* 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
|
* 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).
|
* 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()))
|
if (tick.ticketType == Type.ENTITY && tick.entity != null && tick.entity.writeToNBTOptional(new NBTTagCompound()))
|
||||||
{
|
{
|
||||||
ticket.setInteger("chunkX", MathHelper.floor_double(tick.entity.chunkCoordX));
|
ticket.setInteger("chunkX", MathHelper.floor(tick.entity.chunkCoordX));
|
||||||
ticket.setInteger("chunkZ", MathHelper.floor_double(tick.entity.chunkCoordZ));
|
ticket.setInteger("chunkZ", MathHelper.floor(tick.entity.chunkCoordZ));
|
||||||
ticket.setLong("PersistentIDMSB", tick.entity.getPersistentID().getMostSignificantBits());
|
ticket.setLong("PersistentIDMSB", tick.entity.getPersistentID().getMostSignificantBits());
|
||||||
ticket.setLong("PersistentIDLSB", tick.entity.getPersistentID().getLeastSignificantBits());
|
ticket.setLong("PersistentIDLSB", tick.entity.getPersistentID().getLeastSignificantBits());
|
||||||
tickets.appendTag(ticket);
|
tickets.appendTag(ticket);
|
||||||
|
|
|
@ -146,9 +146,9 @@ public class ForgeHooks
|
||||||
public static ItemStack getGrassSeed(Random rand, int fortune)
|
public static ItemStack getGrassSeed(Random rand, int fortune)
|
||||||
{
|
{
|
||||||
SeedEntry entry = WeightedRandom.getRandomItem(rand, seedList);
|
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);
|
return entry.getStack(rand, fortune);
|
||||||
}
|
}
|
||||||
|
@ -167,7 +167,7 @@ public class ForgeHooks
|
||||||
|
|
||||||
ItemStack stack = player.getHeldItemMainhand();
|
ItemStack stack = player.getHeldItemMainhand();
|
||||||
String tool = block.getHarvestTool(state);
|
String tool = block.getHarvestTool(state);
|
||||||
if (stack.func_190926_b() || tool == null)
|
if (stack.isEmpty() || tool == null)
|
||||||
{
|
{
|
||||||
return player.canHarvestBlock(state);
|
return player.canHarvestBlock(state);
|
||||||
}
|
}
|
||||||
|
@ -186,7 +186,7 @@ public class ForgeHooks
|
||||||
IBlockState state = world.getBlockState(pos);
|
IBlockState state = world.getBlockState(pos);
|
||||||
state = state.getBlock().getActualState(state, world, pos);
|
state = state.getBlock().getActualState(state, world, pos);
|
||||||
String tool = state.getBlock().getHarvestTool(state);
|
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);
|
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)
|
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;
|
TileEntity tileentity = null;
|
||||||
ItemStack itemstack;
|
ItemStack itemstack;
|
||||||
|
|
||||||
if (this.objectMouseOver.typeOfHit == RayTraceResult.Type.BLOCK)
|
if (this.objectMouseOver.typeOfHit == RayTraceResult.Type.BLOCK)
|
||||||
{
|
{
|
||||||
BlockPos blockpos = this.objectMouseOver.getBlockPos();
|
BlockPos blockpos = this.objectMouseOver.getBlockPos();
|
||||||
IBlockState iblockstate = this.theWorld.getBlockState(blockpos);
|
IBlockState iblockstate = this.world.getBlockState(blockpos);
|
||||||
Block block = iblockstate.getBlock();
|
Block block = iblockstate.getBlock();
|
||||||
|
|
||||||
if (iblockstate.getMaterial() == Material.AIR)
|
if (iblockstate.getMaterial() == Material.AIR)
|
||||||
|
@ -316,16 +316,16 @@ public class ForgeHooks
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
itemstack = block.getItem(this.theWorld, blockpos, iblockstate);
|
itemstack = block.getItem(this.world, blockpos, iblockstate);
|
||||||
|
|
||||||
if (itemstack.func_190926_b())
|
if (itemstack.isEmpty())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flag && GuiScreen.isCtrlKeyDown() && block.hasTileEntity())
|
if (flag && GuiScreen.isCtrlKeyDown() && block.hasTileEntity())
|
||||||
{
|
{
|
||||||
tileentity = this.theWorld.getTileEntity(blockpos);
|
tileentity = this.world.getTileEntity(blockpos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -348,7 +348,7 @@ public class ForgeHooks
|
||||||
EntityItemFrame entityitemframe = (EntityItemFrame)this.objectMouseOver.entityHit;
|
EntityItemFrame entityitemframe = (EntityItemFrame)this.objectMouseOver.entityHit;
|
||||||
ItemStack itemstack1 = entityitemframe.getDisplayedItem();
|
ItemStack itemstack1 = entityitemframe.getDisplayedItem();
|
||||||
|
|
||||||
if (itemstack1.func_190926_b())
|
if (itemstack1.isEmpty())
|
||||||
{
|
{
|
||||||
itemstack = new ItemStack(Items.ITEM_FRAME);
|
itemstack = new ItemStack(Items.ITEM_FRAME);
|
||||||
}
|
}
|
||||||
|
@ -411,13 +411,13 @@ public class ForgeHooks
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (itemstack.func_190926_b())
|
if (itemstack.isEmpty())
|
||||||
{
|
{
|
||||||
String s = "";
|
String s = "";
|
||||||
|
|
||||||
if (this.objectMouseOver.typeOfHit == RayTraceResult.Type.BLOCK)
|
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)
|
else if (this.objectMouseOver.typeOfHit == RayTraceResult.Type.ENTITY)
|
||||||
{
|
{
|
||||||
|
@ -428,7 +428,7 @@ public class ForgeHooks
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
InventoryPlayer inventoryplayer = this.thePlayer.inventory;
|
InventoryPlayer inventoryplayer = this.player.inventory;
|
||||||
|
|
||||||
if (tileentity != null)
|
if (tileentity != null)
|
||||||
{
|
{
|
||||||
|
@ -440,7 +440,7 @@ public class ForgeHooks
|
||||||
if (flag)
|
if (flag)
|
||||||
{
|
{
|
||||||
inventoryplayer.setPickedItemStack(itemstack);
|
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)
|
else if (i != -1)
|
||||||
{
|
{
|
||||||
|
@ -483,7 +483,7 @@ public class ForgeHooks
|
||||||
result = target.entityHit.getPickedResult(target);
|
result = target.entityHit.getPickedResult(target);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result.func_190926_b())
|
if (result.isEmpty())
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -592,9 +592,9 @@ public class ForgeHooks
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
AxisAlignedBB bb = entity.getEntityBoundingBox();
|
AxisAlignedBB bb = entity.getEntityBoundingBox();
|
||||||
int mX = MathHelper.floor_double(bb.minX);
|
int mX = MathHelper.floor(bb.minX);
|
||||||
int mY = MathHelper.floor_double(bb.minY);
|
int mY = MathHelper.floor(bb.minY);
|
||||||
int mZ = MathHelper.floor_double(bb.minZ);
|
int mZ = MathHelper.floor(bb.minZ);
|
||||||
for (int y2 = mY; y2 < bb.maxY; y2++)
|
for (int y2 = mY; y2 < bb.maxY; y2++)
|
||||||
{
|
{
|
||||||
for (int x2 = mX; x2 < bb.maxX; x2++)
|
for (int x2 = mX; x2 < bb.maxX; x2++)
|
||||||
|
@ -637,9 +637,9 @@ public class ForgeHooks
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!player.worldObj.isRemote)
|
if (!player.world.isRemote)
|
||||||
{
|
{
|
||||||
player.getEntityWorld().spawnEntityInWorld(event.getEntityItem());
|
player.getEntityWorld().spawnEntity(event.getEntityItem());
|
||||||
}
|
}
|
||||||
return event.getEntityItem();
|
return event.getEntityItem();
|
||||||
}
|
}
|
||||||
|
@ -743,7 +743,7 @@ public class ForgeHooks
|
||||||
{
|
{
|
||||||
// Logic from tryHarvestBlock for pre-canceling the event
|
// Logic from tryHarvestBlock for pre-canceling the event
|
||||||
boolean preCancelEvent = false;
|
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;
|
preCancelEvent = true;
|
||||||
|
|
||||||
if (gameType.isAdventure())
|
if (gameType.isAdventure())
|
||||||
|
@ -754,7 +754,7 @@ public class ForgeHooks
|
||||||
if (!entityPlayer.isAllowEdit())
|
if (!entityPlayer.isAllowEdit())
|
||||||
{
|
{
|
||||||
ItemStack itemstack = entityPlayer.getHeldItemMainhand();
|
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;
|
preCancelEvent = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -797,7 +797,7 @@ public class ForgeHooks
|
||||||
{
|
{
|
||||||
// handle all placement events here
|
// handle all placement events here
|
||||||
int meta = itemstack.getItemDamage();
|
int meta = itemstack.getItemDamage();
|
||||||
int size = itemstack.func_190916_E();
|
int size = itemstack.getCount();
|
||||||
NBTTagCompound nbt = null;
|
NBTTagCompound nbt = null;
|
||||||
if (itemstack.getTagCompound() != null)
|
if (itemstack.getTagCompound() != null)
|
||||||
{
|
{
|
||||||
|
@ -816,7 +816,7 @@ public class ForgeHooks
|
||||||
{
|
{
|
||||||
// save new item data
|
// save new item data
|
||||||
int newMeta = itemstack.getItemDamage();
|
int newMeta = itemstack.getItemDamage();
|
||||||
int newSize = itemstack.func_190916_E();
|
int newSize = itemstack.getCount();
|
||||||
NBTTagCompound newNBT = null;
|
NBTTagCompound newNBT = null;
|
||||||
if (itemstack.getTagCompound() != null)
|
if (itemstack.getTagCompound() != null)
|
||||||
{
|
{
|
||||||
|
@ -829,7 +829,7 @@ public class ForgeHooks
|
||||||
|
|
||||||
// make sure to set pre-placement item data for event
|
// make sure to set pre-placement item data for event
|
||||||
itemstack.setItemDamage(meta);
|
itemstack.setItemDamage(meta);
|
||||||
itemstack.func_190920_e(size);
|
itemstack.setCount(size);
|
||||||
if (nbt != null)
|
if (nbt != null)
|
||||||
{
|
{
|
||||||
itemstack.setTagCompound(nbt);
|
itemstack.setTagCompound(nbt);
|
||||||
|
@ -858,7 +858,7 @@ public class ForgeHooks
|
||||||
{
|
{
|
||||||
// Change the stack to its new content
|
// Change the stack to its new content
|
||||||
itemstack.setItemDamage(newMeta);
|
itemstack.setItemDamage(newMeta);
|
||||||
itemstack.func_190920_e(newSize);
|
itemstack.setCount(newSize);
|
||||||
if (nbt != null)
|
if (nbt != null)
|
||||||
{
|
{
|
||||||
itemstack.setTagCompound(newNBT);
|
itemstack.setTagCompound(newNBT);
|
||||||
|
@ -888,7 +888,7 @@ public class ForgeHooks
|
||||||
{
|
{
|
||||||
AnvilUpdateEvent e = new AnvilUpdateEvent(left, right, name, baseCost);
|
AnvilUpdateEvent e = new AnvilUpdateEvent(left, right, name, baseCost);
|
||||||
if (MinecraftForge.EVENT_BUS.post(e)) return false;
|
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());
|
outputSlot.setInventorySlotContents(0, e.getOutput());
|
||||||
container.maximumCost = e.getCost();
|
container.maximumCost = e.getCost();
|
||||||
|
@ -926,7 +926,7 @@ public class ForgeHooks
|
||||||
*/
|
*/
|
||||||
public static NonNullList<ItemStack> defaultRecipeGetRemainingItems(InventoryCrafting inv)
|
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++)
|
for (int i = 0; i < ret.size(); i++)
|
||||||
{
|
{
|
||||||
ret.set(i, getContainerItem(inv.getStackInSlot(i)));
|
ret.set(i, getContainerItem(inv.getStackInSlot(i)));
|
||||||
|
@ -949,26 +949,26 @@ public class ForgeHooks
|
||||||
if (stack.getItem().hasContainerItem(stack))
|
if (stack.getItem().hasContainerItem(stack))
|
||||||
{
|
{
|
||||||
stack = stack.getItem().getContainerItem(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);
|
ForgeEventFactory.onPlayerDestroyItem(craftingPlayer.get(), stack, null);
|
||||||
return ItemStack.field_190927_a;
|
return ItemStack.EMPTY;
|
||||||
}
|
}
|
||||||
return stack;
|
return stack;
|
||||||
}
|
}
|
||||||
return ItemStack.field_190927_a;
|
return ItemStack.EMPTY;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isInsideOfMaterial(Material material, Entity entity, BlockPos pos)
|
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();
|
Block block = state.getBlock();
|
||||||
double eyes = entity.posY + (double)entity.getEyeHeight();
|
double eyes = entity.posY + (double)entity.getEyeHeight();
|
||||||
|
|
||||||
double filled = 1.0f; //If it's not a liquid assume it's a solid block
|
double filled = 1.0f; //If it's not a liquid assume it's a solid block
|
||||||
if (block instanceof IFluidBlock)
|
if (block instanceof IFluidBlock)
|
||||||
{
|
{
|
||||||
filled = ((IFluidBlock)block).getFilledPercentage(entity.worldObj, pos);
|
filled = ((IFluidBlock)block).getFilledPercentage(entity.world, pos);
|
||||||
}
|
}
|
||||||
else if (block instanceof BlockLiquid)
|
else if (block instanceof BlockLiquid)
|
||||||
{
|
{
|
||||||
|
@ -991,7 +991,7 @@ public class ForgeHooks
|
||||||
{
|
{
|
||||||
if (MinecraftForge.EVENT_BUS.post(new AttackEntityEvent(player, target))) return false;
|
if (MinecraftForge.EVENT_BUS.post(new AttackEntityEvent(player, target))) return false;
|
||||||
ItemStack stack = player.getHeldItemMainhand();
|
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)
|
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 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));
|
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)
|
public static Vec3d rayTraceEyeHitVec(EntityLivingBase entity, double length)
|
||||||
|
|
|
@ -53,7 +53,7 @@ public class ForgeInternalHandler
|
||||||
{
|
{
|
||||||
entity.setDead();
|
entity.setDead();
|
||||||
event.setCanceled(true);
|
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++)
|
for (int x = 0; x < inventory.size(); x++)
|
||||||
{
|
{
|
||||||
ItemStack stack = inventory.get(x);
|
ItemStack stack = inventory.get(x);
|
||||||
if (stack.func_190926_b())
|
if (stack.isEmpty())
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -178,13 +178,13 @@ public interface ISpecialArmor
|
||||||
}
|
}
|
||||||
stack.damageItem(itemDamage, entity);
|
stack.damageItem(itemDamage, entity);
|
||||||
}
|
}
|
||||||
if (stack.func_190926_b())
|
if (stack.isEmpty())
|
||||||
{
|
{
|
||||||
/*if (entity instanceof EntityPlayer)
|
/*if (entity instanceof EntityPlayer)
|
||||||
{
|
{
|
||||||
stack.onItemDestroyedByUse((EntityPlayer)entity);
|
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
|
@Nonnull
|
||||||
public ItemStack getOutput(@Nonnull ItemStack input, @Nonnull ItemStack ingredient)
|
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
|
@Nonnull
|
||||||
|
|
|
@ -90,8 +90,8 @@ public class BrewingRecipeRegistry {
|
||||||
@Nonnull
|
@Nonnull
|
||||||
public static ItemStack getOutput(@Nonnull ItemStack input, @Nonnull ItemStack ingredient)
|
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 (input.isEmpty() || input.getMaxStackSize() != 1 || input.getCount() != 1) return ItemStack.EMPTY;
|
||||||
if (ingredient.func_190926_b()) return ItemStack.field_190927_a;
|
if (ingredient.isEmpty()) return ItemStack.EMPTY;
|
||||||
|
|
||||||
for (IBrewingRecipe recipe : recipes)
|
for (IBrewingRecipe recipe : recipes)
|
||||||
{
|
{
|
||||||
|
@ -101,7 +101,7 @@ public class BrewingRecipeRegistry {
|
||||||
return output;
|
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)
|
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)
|
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)
|
for (int i : inputIndexes)
|
||||||
{
|
{
|
||||||
|
@ -141,7 +141,7 @@ public class BrewingRecipeRegistry {
|
||||||
for (int i : inputIndexes)
|
for (int i : inputIndexes)
|
||||||
{
|
{
|
||||||
ItemStack output = getOutput(inputs.get(i), ingredient);
|
ItemStack output = getOutput(inputs.get(i), ingredient);
|
||||||
if (!output.func_190926_b())
|
if (!output.isEmpty())
|
||||||
{
|
{
|
||||||
inputs.set(i, output);
|
inputs.set(i, output);
|
||||||
}
|
}
|
||||||
|
@ -154,7 +154,7 @@ public class BrewingRecipeRegistry {
|
||||||
*/
|
*/
|
||||||
public static boolean isValidIngredient(@Nonnull ItemStack stack)
|
public static boolean isValidIngredient(@Nonnull ItemStack stack)
|
||||||
{
|
{
|
||||||
if (stack.func_190926_b()) return false;
|
if (stack.isEmpty()) return false;
|
||||||
|
|
||||||
for (IBrewingRecipe recipe : recipes)
|
for (IBrewingRecipe recipe : recipes)
|
||||||
{
|
{
|
||||||
|
@ -172,7 +172,7 @@ public class BrewingRecipeRegistry {
|
||||||
*/
|
*/
|
||||||
public static boolean isValidInput(@Nonnull ItemStack stack)
|
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)
|
for (IBrewingRecipe recipe : recipes)
|
||||||
{
|
{
|
||||||
|
|
|
@ -60,16 +60,16 @@ public class VanillaBrewingRecipe implements IBrewingRecipe {
|
||||||
@Override
|
@Override
|
||||||
public ItemStack getOutput(@Nonnull ItemStack input, @Nonnull ItemStack ingredient)
|
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);
|
ItemStack result = PotionHelper.doReaction(ingredient, input);
|
||||||
if (result != input)
|
if (result != input)
|
||||||
{
|
{
|
||||||
return result;
|
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
|
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);
|
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);
|
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)
|
public TRSRTransformation apply(float time)
|
||||||
{
|
{
|
||||||
float clipTime = input.apply(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.
|
@Deprecated //Modders do not use this, use add below, To better allow custom fix types.
|
||||||
public void registerWalker(FixTypes type, IDataWalker walker)
|
public void registerWalker(FixTypes type, IDataWalker walker)
|
||||||
{
|
{
|
||||||
registerWalkerAdd(type, walker);
|
registerVanillaWalker(type, walker);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void registerWalkerAdd(IFixType type, IDataWalker walker)
|
public void registerVanillaWalker(IFixType type, IDataWalker walker)
|
||||||
{
|
{
|
||||||
getWalkers(type).add(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 Vec3d getPositionVector(){ return new Vec3d(0, 0, 0); }
|
||||||
@Override public boolean canCommandSenderUseCommand(int i, String s){ return false; }
|
@Override public boolean canUseCommand(int i, String s){ return false; }
|
||||||
@Override public void addChatComponentMessage(ITextComponent chatmessagecomponent, boolean type){}
|
@Override public void sendStatusMessage(ITextComponent chatComponent, boolean actionBar){}
|
||||||
@Override public void addStat(StatBase par1StatBase, int par2){}
|
@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 void openGui(Object mod, int modGuiId, World world, int x, int y, int z){}
|
||||||
@Override public boolean isEntityInvulnerable(DamageSource source){ return true; }
|
@Override public boolean isEntityInvulnerable(DamageSource source){ return true; }
|
||||||
|
|
|
@ -71,7 +71,7 @@ public class FakePlayerFactory
|
||||||
while (itr.hasNext())
|
while (itr.hasNext())
|
||||||
{
|
{
|
||||||
Entry<GameProfile, FakePlayer> entry = itr.next();
|
Entry<GameProfile, FakePlayer> entry = itr.next();
|
||||||
if (entry.getValue().worldObj == world)
|
if (entry.getValue().world == world)
|
||||||
{
|
{
|
||||||
itr.remove();
|
itr.remove();
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,7 +49,7 @@ public class AnvilUpdateEvent extends Event
|
||||||
{
|
{
|
||||||
this.left = left;
|
this.left = left;
|
||||||
this.right = right;
|
this.right = right;
|
||||||
this.output = ItemStack.field_190927_a;
|
this.output = ItemStack.EMPTY;
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.setCost(cost);
|
this.setCost(cost);
|
||||||
this.setMaterialCost(0);
|
this.setMaterialCost(0);
|
||||||
|
|
|
@ -356,7 +356,7 @@ public class ForgeEventFactory
|
||||||
if (event.getResult() == Result.ALLOW)
|
if (event.getResult() == Result.ALLOW)
|
||||||
{
|
{
|
||||||
if (!world.isRemote)
|
if (!world.isRemote)
|
||||||
stack.func_190918_g(1);
|
stack.shrink(1);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -372,8 +372,8 @@ public class ForgeEventFactory
|
||||||
if (player.capabilities.isCreativeMode)
|
if (player.capabilities.isCreativeMode)
|
||||||
return new ActionResult<ItemStack>(EnumActionResult.SUCCESS, stack);
|
return new ActionResult<ItemStack>(EnumActionResult.SUCCESS, stack);
|
||||||
|
|
||||||
stack.func_190918_g(1);
|
stack.shrink(1);
|
||||||
if (stack.func_190926_b())
|
if (stack.isEmpty())
|
||||||
return new ActionResult<ItemStack>(EnumActionResult.SUCCESS, event.getFilledBucket());
|
return new ActionResult<ItemStack>(EnumActionResult.SUCCESS, event.getFilledBucket());
|
||||||
|
|
||||||
if (!player.inventory.addItemStackToInventory(event.getFilledBucket()))
|
if (!player.inventory.addItemStackToInventory(event.getFilledBucket()))
|
||||||
|
@ -400,8 +400,8 @@ public class ForgeEventFactory
|
||||||
|
|
||||||
public static int onItemExpire(EntityItem entity, @Nonnull ItemStack item)
|
public static int onItemExpire(EntityItem entity, @Nonnull ItemStack item)
|
||||||
{
|
{
|
||||||
if (item.func_190926_b()) return -1;
|
if (item.isEmpty()) return -1;
|
||||||
ItemExpireEvent event = new ItemExpireEvent(entity, (item.func_190926_b() ? 6000 : item.getItem().getEntityLifespan(item, entity.worldObj)));
|
ItemExpireEvent event = new ItemExpireEvent(entity, (item.isEmpty() ? 6000 : item.getItem().getEntityLifespan(item, entity.world)));
|
||||||
if (!MinecraftForge.EVENT_BUS.post(event)) return -1;
|
if (!MinecraftForge.EVENT_BUS.post(event)) return -1;
|
||||||
return event.getExtraLife();
|
return event.getExtraLife();
|
||||||
}
|
}
|
||||||
|
@ -427,7 +427,7 @@ public class ForgeEventFactory
|
||||||
|
|
||||||
public static boolean canMountEntity(Entity entityMounting, Entity entityBeingMounted, boolean isMounting)
|
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)
|
if(isCanceled)
|
||||||
{
|
{
|
||||||
|
@ -498,7 +498,7 @@ public class ForgeEventFactory
|
||||||
|
|
||||||
public static boolean onPotionAttemptBrew(NonNullList<ItemStack> stacks)
|
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++)
|
for (int x = 0; x < tmp.size(); x++)
|
||||||
tmp.set(x, stacks.get(x).copy());
|
tmp.set(x, stacks.get(x).copy());
|
||||||
|
|
||||||
|
@ -577,8 +577,8 @@ public class ForgeEventFactory
|
||||||
Result canContinueSleep = evt.getResult();
|
Result canContinueSleep = evt.getResult();
|
||||||
if (canContinueSleep == Result.DEFAULT)
|
if (canContinueSleep == Result.DEFAULT)
|
||||||
{
|
{
|
||||||
IBlockState state = player.worldObj.getBlockState(player.bedLocation);
|
IBlockState state = player.world.getBlockState(player.bedLocation);
|
||||||
return state.getBlock().isBed(state, player.worldObj, player.bedLocation, player);
|
return state.getBlock().isBed(state, player.world, player.bedLocation, player);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return canContinueSleep == Result.ALLOW;
|
return canContinueSleep == Result.ALLOW;
|
||||||
|
|
|
@ -42,7 +42,7 @@ public class PotionBrewEvent extends Event
|
||||||
@Nonnull
|
@Nonnull
|
||||||
public ItemStack getItem(int index)
|
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);
|
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.
|
* 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 #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
|
* 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
|
* from 0-15 and indicates how many bookshelves surround the enchanting table. The {@link #itemStack} representing the item being
|
||||||
* enchanted is also available.
|
* enchanted is also available.
|
||||||
*/
|
*/
|
||||||
public class EnchantmentLevelSetEvent extends Event
|
public class EnchantmentLevelSetEvent extends Event
|
||||||
|
@ -126,7 +126,7 @@ public class EnchantmentLevelSetEvent extends Event
|
||||||
/**
|
/**
|
||||||
* Set the new level of the enchantment (0-30)
|
* 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)
|
public void setLevel(int level)
|
||||||
{
|
{
|
||||||
|
|
|
@ -30,7 +30,7 @@ import java.util.Collection;
|
||||||
/**
|
/**
|
||||||
* EntityJoinWorldEvent is fired when an Entity joins the world. <br>
|
* EntityJoinWorldEvent is fired when an Entity joins the world. <br>
|
||||||
* This event is fired whenever an Entity is added to the world in
|
* 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>
|
* <br>
|
||||||
* {@link #world} contains the world in which the entity is to join.<br>
|
* {@link #world} contains the world in which the entity is to join.<br>
|
||||||
* <br>
|
* <br>
|
||||||
|
|
|
@ -118,7 +118,7 @@ public class LivingSpawnEvent extends LivingEvent
|
||||||
{
|
{
|
||||||
public AllowDespawn(EntityLiving entity)
|
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>
|
* MinecartInteractEvent is fired when a player interacts with a minecart. <br>
|
||||||
* This event is fired whenever a player interacts with a minecart in
|
* This event is fired whenever a player interacts with a minecart in
|
||||||
* {@link EntityMinecartContainer#processInitialInteract(EntityPlayer, ItemStack, EnumHand)},
|
* {@link EntityMinecartContainer#processInitialInteract(EntityPlayer, EnumHand)},
|
||||||
* {@link EntityMinecartEmpty#processInitialInteract(EntityPlayer, ItemStack, EnumHand)},
|
* {@link EntityMinecartEmpty#processInitialInteract(EntityPlayer, EnumHand)},
|
||||||
* {@link EntityMinecartFurnace#processInitialInteract(EntityPlayer, ItemStack, EnumHand)},
|
* {@link EntityMinecartFurnace#processInitialInteract(EntityPlayer, EnumHand)},
|
||||||
* {@link EntityMinecartHopper#processInitialInteract(EntityPlayer, ItemStack, EnumHand)},
|
* {@link EntityMinecartHopper#processInitialInteract(EntityPlayer, EnumHand)},
|
||||||
* etc.<br>
|
* etc.<br>
|
||||||
* <br>
|
* <br>
|
||||||
* {@link #player} contains the EntityPlayer that is involved with this minecart interaction.<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>
|
* ArrowNockEvent is fired when a player begins using a bow.<br>
|
||||||
* This event is fired whenever a player begins using a bow in
|
* 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>
|
* <br>
|
||||||
* This event is fired on the {@link MinecraftForge#EVENT_BUS}.
|
* 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>
|
* CreateDecorator is fired when a BiomeDecorator is created.<br>
|
||||||
* This event is fired whenever a BiomeDecorator is created in
|
* This event is fired whenever a BiomeDecorator is created in
|
||||||
* {@link DeferredBiomeDecorator#fireCreateEventAndReplace(BiomeGenBase)}.<br>
|
* {@link DeferredBiomeDecorator#fireCreateEventAndReplace(Biome)}.<br>
|
||||||
* <br>
|
* <br>
|
||||||
* {@link #originalBiomeDecorator} contains the original BiomeDecorator that would be used in vanilla.
|
* {@link #originalBiomeDecorator} contains the original BiomeDecorator that would be used in vanilla.
|
||||||
* {@link #newBiomeDecorator} contains the new BiomeDecoration to be used by Minecraft.
|
* {@link #newBiomeDecorator} contains the new BiomeDecoration to be used by Minecraft.
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
package net.minecraftforge.event.terraingen;
|
package net.minecraftforge.event.terraingen;
|
||||||
|
|
||||||
import net.minecraft.world.biome.BiomeProvider;
|
import net.minecraft.world.biome.BiomeProvider;
|
||||||
|
import net.minecraft.world.gen.ChunkProviderSettings;
|
||||||
import net.minecraftforge.common.MinecraftForge;
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
import net.minecraftforge.fml.common.eventhandler.Cancelable;
|
import net.minecraftforge.fml.common.eventhandler.Cancelable;
|
||||||
import net.minecraftforge.fml.common.eventhandler.Event;
|
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>
|
* BiomeSize is fired when vanilla Minecraft attempts to generate biomes.<br>
|
||||||
* This event is fired during biome generation in
|
* This event is fired during biome generation in
|
||||||
* {@link GenLayer#initializeAllBiomeGenerators(long, WorldType, String)}. <br>
|
* {@link GenLayer#initializeAllBiomeGenerators(long, WorldType, ChunkProviderSettings)}. <br>
|
||||||
* <br>
|
* <br>
|
||||||
* {@link #originalSize} the original size of the Biome. <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>
|
* {@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>
|
* 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
|
* 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>
|
* <br>
|
||||||
* This event is not {@link Cancelable}.<br>
|
* This event is not {@link Cancelable}.<br>
|
||||||
* <br>
|
* <br>
|
||||||
|
|
|
@ -353,7 +353,7 @@ public abstract class BlockFluidBase extends Block implements IFluidBlock
|
||||||
@Nonnull
|
@Nonnull
|
||||||
public Item getItemDropped(@Nonnull IBlockState state, @Nonnull Random rand, int fortune)
|
public Item getItemDropped(@Nonnull IBlockState state, @Nonnull Random rand, int fortune)
|
||||||
{
|
{
|
||||||
return Items.field_190931_a;
|
return Items.AIR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -256,14 +256,14 @@ public class BlockFluidFinite extends BlockFluidBase
|
||||||
if (fluidStack.amount < closest)
|
if (fluidStack.amount < closest)
|
||||||
{
|
{
|
||||||
// Figure out maximum level to match stack amount
|
// Figure out maximum level to match stack amount
|
||||||
closest = MathHelper.floor_float(quantaAmount * MathHelper.floor_float(fluidStack.amount / quantaAmount));
|
closest = MathHelper.floor(quantaAmount * MathHelper.floor(fluidStack.amount / quantaAmount));
|
||||||
quanta = MathHelper.floor_float(closest / quantaAmount);
|
quanta = MathHelper.floor(closest / quantaAmount);
|
||||||
}
|
}
|
||||||
if (existing.getBlock() == this)
|
if (existing.getBlock() == this)
|
||||||
{
|
{
|
||||||
int existingQuanta = existing.getValue(LEVEL) + 1;
|
int existingQuanta = existing.getValue(LEVEL) + 1;
|
||||||
int missingQuanta = quantaPerBlock - existingQuanta;
|
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);
|
quanta = Math.min(quanta + existingQuanta, quantaPerBlock);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -282,7 +282,7 @@ public class BlockFluidFinite extends BlockFluidBase
|
||||||
@Override
|
@Override
|
||||||
public FluidStack drain(World world, BlockPos pos, boolean doDrain)
|
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)
|
if (doDrain)
|
||||||
{
|
{
|
||||||
|
|
|
@ -73,12 +73,12 @@ public class DispenseFluidContainer extends BehaviorDefaultDispenseItem
|
||||||
FluidActionResult actionResult = FluidUtil.tryPickUpFluid(stack, null, world, blockpos, dispenserFacing.getOpposite());
|
FluidActionResult actionResult = FluidUtil.tryPickUpFluid(stack, null, world, blockpos, dispenserFacing.getOpposite());
|
||||||
ItemStack resultStack = actionResult.getResult();
|
ItemStack resultStack = actionResult.getResult();
|
||||||
|
|
||||||
if (!actionResult.isSuccess() || resultStack.func_190926_b())
|
if (!actionResult.isSuccess() || resultStack.isEmpty())
|
||||||
{
|
{
|
||||||
return super.dispenseStack(source, stack);
|
return super.dispenseStack(source, stack);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.func_190916_E() == 1)
|
if (stack.getCount() == 1)
|
||||||
{
|
{
|
||||||
return resultStack;
|
return resultStack;
|
||||||
}
|
}
|
||||||
|
@ -88,7 +88,7 @@ public class DispenseFluidContainer extends BehaviorDefaultDispenseItem
|
||||||
}
|
}
|
||||||
|
|
||||||
ItemStack stackCopy = stack.copy();
|
ItemStack stackCopy = stack.copy();
|
||||||
stackCopy.func_190918_g(1);
|
stackCopy.shrink(1);
|
||||||
return stackCopy;
|
return stackCopy;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -99,7 +99,7 @@ public class DispenseFluidContainer extends BehaviorDefaultDispenseItem
|
||||||
private ItemStack dumpContainer(IBlockSource source, @Nonnull ItemStack stack)
|
private ItemStack dumpContainer(IBlockSource source, @Nonnull ItemStack stack)
|
||||||
{
|
{
|
||||||
ItemStack singleStack = stack.copy();
|
ItemStack singleStack = stack.copy();
|
||||||
singleStack.func_190920_e(1);
|
singleStack.setCount(1);
|
||||||
IFluidHandlerItem fluidHandler = FluidUtil.getFluidHandler(singleStack);
|
IFluidHandlerItem fluidHandler = FluidUtil.getFluidHandler(singleStack);
|
||||||
if (fluidHandler == null)
|
if (fluidHandler == null)
|
||||||
{
|
{
|
||||||
|
@ -115,17 +115,17 @@ public class DispenseFluidContainer extends BehaviorDefaultDispenseItem
|
||||||
{
|
{
|
||||||
ItemStack drainedStack = result.getResult();
|
ItemStack drainedStack = result.getResult();
|
||||||
|
|
||||||
if (drainedStack.func_190916_E() == 1)
|
if (drainedStack.getCount() == 1)
|
||||||
{
|
{
|
||||||
return drainedStack;
|
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);
|
this.dispenseBehavior.dispense(source, drainedStack);
|
||||||
}
|
}
|
||||||
|
|
||||||
ItemStack stackCopy = drainedStack.copy();
|
ItemStack stackCopy = drainedStack.copy();
|
||||||
stackCopy.func_190918_g(1);
|
stackCopy.shrink(1);
|
||||||
return stackCopy;
|
return stackCopy;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -34,7 +34,7 @@ import net.minecraft.item.ItemStack;
|
||||||
*/
|
*/
|
||||||
public class FluidActionResult
|
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;
|
public final boolean success;
|
||||||
@Nonnull
|
@Nonnull
|
||||||
|
|
|
@ -65,7 +65,7 @@ public class FluidUtil
|
||||||
@Nonnull
|
@Nonnull
|
||||||
public static FluidActionResult interactWithFluidHandler(@Nonnull ItemStack stack, IFluidHandler fluidHandler, EntityPlayer player)
|
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;
|
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)
|
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
|
ItemStack containerCopy = container.copy(); // do not modify the input
|
||||||
containerCopy.func_190920_e(1);
|
containerCopy.setCount(1);
|
||||||
IFluidHandlerItem containerFluidHandler = getFluidHandler(containerCopy);
|
IFluidHandlerItem containerFluidHandler = getFluidHandler(containerCopy);
|
||||||
if (containerFluidHandler != null)
|
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)
|
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
|
ItemStack containerCopy = container.copy(); // do not modify the input
|
||||||
containerCopy.func_190920_e(1);
|
containerCopy.setCount(1);
|
||||||
IFluidHandlerItem containerFluidHandler = getFluidHandler(containerCopy);
|
IFluidHandlerItem containerFluidHandler = getFluidHandler(containerCopy);
|
||||||
if (containerFluidHandler != null)
|
if (containerFluidHandler != null)
|
||||||
{
|
{
|
||||||
|
@ -191,7 +191,7 @@ public class FluidUtil
|
||||||
@Nonnull
|
@Nonnull
|
||||||
public static FluidActionResult tryFillContainerAndStow(@Nonnull ItemStack container, IFluidHandler fluidSource, IItemHandler inventory, int maxAmount, @Nullable EntityPlayer player)
|
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;
|
return FluidActionResult.FAILURE;
|
||||||
}
|
}
|
||||||
|
@ -204,7 +204,7 @@ public class FluidUtil
|
||||||
return new FluidActionResult(container); // creative mode: item does not change
|
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);
|
FluidActionResult filledReal = tryFillContainer(container, fluidSource, maxAmount, player, true);
|
||||||
if (filledReal.isSuccess())
|
if (filledReal.isSuccess())
|
||||||
|
@ -219,19 +219,19 @@ public class FluidUtil
|
||||||
{
|
{
|
||||||
// check if we can give the itemStack to the inventory
|
// check if we can give the itemStack to the inventory
|
||||||
ItemStack remainder = ItemHandlerHelper.insertItemStacked(inventory, filledSimulated.getResult(), true);
|
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);
|
FluidActionResult filledReal = tryFillContainer(container, fluidSource, maxAmount, player, true);
|
||||||
remainder = ItemHandlerHelper.insertItemStacked(inventory, filledReal.getResult(), false);
|
remainder = ItemHandlerHelper.insertItemStacked(inventory, filledReal.getResult(), false);
|
||||||
|
|
||||||
// give it to the player or drop it at their feet
|
// 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);
|
ItemHandlerHelper.giveItemToPlayer(player, remainder);
|
||||||
}
|
}
|
||||||
|
|
||||||
ItemStack containerCopy = container.copy();
|
ItemStack containerCopy = container.copy();
|
||||||
containerCopy.func_190918_g(1);
|
containerCopy.shrink(1);
|
||||||
return new FluidActionResult(containerCopy);
|
return new FluidActionResult(containerCopy);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -258,7 +258,7 @@ public class FluidUtil
|
||||||
@Nonnull
|
@Nonnull
|
||||||
public static FluidActionResult tryEmptyContainerAndStow(@Nonnull ItemStack container, IFluidHandler fluidDestination, IItemHandler inventory, int maxAmount, @Nullable EntityPlayer player)
|
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;
|
return FluidActionResult.FAILURE;
|
||||||
}
|
}
|
||||||
|
@ -271,7 +271,7 @@ public class FluidUtil
|
||||||
return new FluidActionResult(container); // creative mode: item does not change
|
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);
|
FluidActionResult emptiedReal = tryEmptyContainer(container, fluidDestination, maxAmount, player, true);
|
||||||
if (emptiedReal.isSuccess())
|
if (emptiedReal.isSuccess())
|
||||||
|
@ -286,19 +286,19 @@ public class FluidUtil
|
||||||
{
|
{
|
||||||
// check if we can give the itemStack to the inventory
|
// check if we can give the itemStack to the inventory
|
||||||
ItemStack remainder = ItemHandlerHelper.insertItemStacked(inventory, emptiedSimulated.getResult(), true);
|
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);
|
FluidActionResult emptiedReal = tryEmptyContainer(container, fluidDestination, maxAmount, player, true);
|
||||||
remainder = ItemHandlerHelper.insertItemStacked(inventory, emptiedReal.getResult(), false);
|
remainder = ItemHandlerHelper.insertItemStacked(inventory, emptiedReal.getResult(), false);
|
||||||
|
|
||||||
// give it to the player or drop it at their feet
|
// 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);
|
ItemHandlerHelper.giveItemToPlayer(player, remainder);
|
||||||
}
|
}
|
||||||
|
|
||||||
ItemStack containerCopy = container.copy();
|
ItemStack containerCopy = container.copy();
|
||||||
containerCopy.func_190918_g(1);
|
containerCopy.shrink(1);
|
||||||
return new FluidActionResult(containerCopy);
|
return new FluidActionResult(containerCopy);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -377,10 +377,10 @@ public class FluidUtil
|
||||||
@Nullable
|
@Nullable
|
||||||
public static FluidStack getFluidContained(@Nonnull ItemStack container)
|
public static FluidStack getFluidContained(@Nonnull ItemStack container)
|
||||||
{
|
{
|
||||||
if (!container.func_190926_b())
|
if (!container.isEmpty())
|
||||||
{
|
{
|
||||||
container = container.copy();
|
container = container.copy();
|
||||||
container.func_190920_e(1);
|
container.setCount(1);
|
||||||
IFluidHandlerItem fluidHandler = FluidUtil.getFluidHandler(container);
|
IFluidHandlerItem fluidHandler = FluidUtil.getFluidHandler(container);
|
||||||
if (fluidHandler != null)
|
if (fluidHandler != null)
|
||||||
{
|
{
|
||||||
|
@ -435,7 +435,7 @@ public class FluidUtil
|
||||||
@Nonnull
|
@Nonnull
|
||||||
public static FluidActionResult tryPickUpFluid(@Nonnull ItemStack emptyContainer, @Nullable EntityPlayer playerIn, World worldIn, BlockPos pos, EnumFacing side)
|
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;
|
return FluidActionResult.FAILURE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -86,14 +86,14 @@ public class UniversalBucket extends Item
|
||||||
@Override
|
@Override
|
||||||
public boolean hasContainerItem(@Nonnull ItemStack stack)
|
public boolean hasContainerItem(@Nonnull ItemStack stack)
|
||||||
{
|
{
|
||||||
return !getEmpty().func_190926_b();
|
return !getEmpty().isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nonnull
|
@Nonnull
|
||||||
@Override
|
@Override
|
||||||
public ItemStack getContainerItem(@Nonnull ItemStack itemStack)
|
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
|
// Create a copy such that the game can't mess with it
|
||||||
return getEmpty().copy();
|
return getEmpty().copy();
|
||||||
|
@ -129,7 +129,7 @@ public class UniversalBucket extends Item
|
||||||
FluidStack fluidStack = getFluid(stack);
|
FluidStack fluidStack = getFluid(stack);
|
||||||
if (fluidStack == null)
|
if (fluidStack == null)
|
||||||
{
|
{
|
||||||
if(!getEmpty().func_190926_b())
|
if(!getEmpty().isEmpty())
|
||||||
{
|
{
|
||||||
return getEmpty().getDisplayName();
|
return getEmpty().getDisplayName();
|
||||||
}
|
}
|
||||||
|
@ -183,12 +183,12 @@ public class UniversalBucket extends Item
|
||||||
// success!
|
// success!
|
||||||
player.addStat(StatList.getObjectUseStats(this));
|
player.addStat(StatList.getObjectUseStats(this));
|
||||||
|
|
||||||
itemstack.func_190918_g(1);
|
itemstack.shrink(1);
|
||||||
ItemStack drained = result.getResult();
|
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
|
// 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);
|
return ActionResult.newResult(EnumActionResult.SUCCESS, emptyStack);
|
||||||
}
|
}
|
||||||
|
@ -235,7 +235,7 @@ public class UniversalBucket extends Item
|
||||||
BlockPos pos = target.getBlockPos();
|
BlockPos pos = target.getBlockPos();
|
||||||
|
|
||||||
ItemStack singleBucket = emptyBucket.copy();
|
ItemStack singleBucket = emptyBucket.copy();
|
||||||
singleBucket.func_190920_e(1);
|
singleBucket.setCount(1);
|
||||||
|
|
||||||
FluidActionResult filledResult = FluidUtil.tryPickUpFluid(singleBucket, event.getEntityPlayer(), world, pos, target.sideHit);
|
FluidActionResult filledResult = FluidUtil.tryPickUpFluid(singleBucket, event.getEntityPlayer(), world, pos, target.sideHit);
|
||||||
if (filledResult.isSuccess())
|
if (filledResult.isSuccess())
|
||||||
|
|
|
@ -99,7 +99,7 @@ public class FluidHandlerItemStack implements IFluidHandlerItem, ICapabilityProv
|
||||||
@Override
|
@Override
|
||||||
public int fill(FluidStack resource, boolean doFill)
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -139,7 +139,7 @@ public class FluidHandlerItemStack implements IFluidHandlerItem, ICapabilityProv
|
||||||
@Override
|
@Override
|
||||||
public FluidStack drain(FluidStack resource, boolean doDrain)
|
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;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -149,7 +149,7 @@ public class FluidHandlerItemStack implements IFluidHandlerItem, ICapabilityProv
|
||||||
@Override
|
@Override
|
||||||
public FluidStack drain(int maxDrain, boolean doDrain)
|
public FluidStack drain(int maxDrain, boolean doDrain)
|
||||||
{
|
{
|
||||||
if (container.func_190916_E() != 1 || maxDrain <= 0)
|
if (container.getCount() != 1 || maxDrain <= 0)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -228,7 +228,7 @@ public class FluidHandlerItemStack implements IFluidHandlerItem, ICapabilityProv
|
||||||
protected void setContainerToEmpty()
|
protected void setContainerToEmpty()
|
||||||
{
|
{
|
||||||
super.setContainerToEmpty();
|
super.setContainerToEmpty();
|
||||||
container.func_190918_g(1);
|
container.shrink(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -96,7 +96,7 @@ public class FluidHandlerItemStackSimple implements IFluidHandlerItem, ICapabili
|
||||||
@Override
|
@Override
|
||||||
public int fill(FluidStack resource, boolean doFill)
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -122,7 +122,7 @@ public class FluidHandlerItemStackSimple implements IFluidHandlerItem, ICapabili
|
||||||
@Override
|
@Override
|
||||||
public FluidStack drain(FluidStack resource, boolean doDrain)
|
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;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -132,7 +132,7 @@ public class FluidHandlerItemStackSimple implements IFluidHandlerItem, ICapabili
|
||||||
@Override
|
@Override
|
||||||
public FluidStack drain(int maxDrain, boolean doDrain)
|
public FluidStack drain(int maxDrain, boolean doDrain)
|
||||||
{
|
{
|
||||||
if (container.func_190916_E() != 1 || maxDrain <= 0)
|
if (container.getCount() != 1 || maxDrain <= 0)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -205,7 +205,7 @@ public class FluidHandlerItemStackSimple implements IFluidHandlerItem, ICapabili
|
||||||
protected void setContainerToEmpty()
|
protected void setContainerToEmpty()
|
||||||
{
|
{
|
||||||
super.setContainerToEmpty();
|
super.setContainerToEmpty();
|
||||||
container.func_190918_g(1);
|
container.shrink(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -128,7 +128,7 @@ public class FluidBucketWrapper implements IFluidHandlerItem, ICapabilityProvide
|
||||||
@Override
|
@Override
|
||||||
public int fill(FluidStack resource, boolean doFill)
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -145,7 +145,7 @@ public class FluidBucketWrapper implements IFluidHandlerItem, ICapabilityProvide
|
||||||
@Override
|
@Override
|
||||||
public FluidStack drain(FluidStack resource, boolean doDrain)
|
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;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -167,7 +167,7 @@ public class FluidBucketWrapper implements IFluidHandlerItem, ICapabilityProvide
|
||||||
@Override
|
@Override
|
||||||
public FluidStack drain(int maxDrain, boolean doDrain)
|
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;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -139,7 +139,7 @@ import com.google.gson.JsonObject;
|
||||||
/**
|
/**
|
||||||
* Handles primary communication from hooked code into the system
|
* 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}
|
* {@link Minecraft}
|
||||||
*
|
*
|
||||||
* Obfuscated code should focus on this class and other members of the "server"
|
* 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)
|
public void displayGuiScreen(EntityPlayer player, GuiScreen gui)
|
||||||
{
|
{
|
||||||
if (client.thePlayer==player && gui != null) {
|
if (client.player==player && gui != null) {
|
||||||
client.displayGuiScreen(gui);
|
client.displayGuiScreen(gui);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -567,12 +567,12 @@ public class FMLClientHandler implements IFMLSidedHandler
|
||||||
|
|
||||||
public WorldClient getWorldClient()
|
public WorldClient getWorldClient()
|
||||||
{
|
{
|
||||||
return client.theWorld;
|
return client.world;
|
||||||
}
|
}
|
||||||
|
|
||||||
public EntityPlayerSP getClientPlayerEntity()
|
public EntityPlayerSP getClientPlayerEntity()
|
||||||
{
|
{
|
||||||
return client.thePlayer;
|
return client.player;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -286,7 +286,7 @@ public abstract class GuiScrollingList
|
||||||
GL11.glScissor((int)(left * scaleW), (int)(client.displayHeight - (bottom * scaleH)),
|
GL11.glScissor((int)(left * scaleW), (int)(client.displayHeight - (bottom * scaleH)),
|
||||||
(int)(listWidth * scaleW), (int)(viewHeight * 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);
|
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.allRequireMcRestart = allRequireMcRestart;
|
||||||
this.modID = modID;
|
this.modID = modID;
|
||||||
this.configID = configID;
|
this.configID = configID;
|
||||||
this.isWorldRunning = mc.theWorld != null;
|
this.isWorldRunning = mc.world != null;
|
||||||
if (title != null)
|
if (title != null)
|
||||||
this.title = title;
|
this.title = title;
|
||||||
this.titleLine2 = titleLine2;
|
this.titleLine2 = titleLine2;
|
||||||
|
|
|
@ -65,6 +65,7 @@ public class ItemStackTransformer implements IClassTransformer {
|
||||||
MethodNode getItemMethod = null;
|
MethodNode getItemMethod = null;
|
||||||
for (MethodNode m: classNode.methods)
|
for (MethodNode m: classNode.methods)
|
||||||
{
|
{
|
||||||
|
if (m.name.equals("getItemRaw")) continue;
|
||||||
if (GETITEM_DESC.equals(m.desc) && getItemMethod == null)
|
if (GETITEM_DESC.equals(m.desc) && getItemMethod == null)
|
||||||
{
|
{
|
||||||
getItemMethod = m;
|
getItemMethod = m;
|
||||||
|
@ -81,7 +82,7 @@ public class ItemStackTransformer implements IClassTransformer {
|
||||||
|
|
||||||
for (MethodNode m: classNode.methods)
|
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(); )
|
for (ListIterator<AbstractInsnNode> it = m.instructions.iterator(); it.hasNext(); )
|
||||||
{
|
{
|
||||||
AbstractInsnNode insnNode = it.next();
|
AbstractInsnNode insnNode = it.next();
|
||||||
|
|
|
@ -163,7 +163,7 @@ public class ByteBufUtils {
|
||||||
public static void writeItemStack(ByteBuf to, ItemStack stack)
|
public static void writeItemStack(ByteBuf to, ItemStack stack)
|
||||||
{
|
{
|
||||||
PacketBuffer pb = new PacketBuffer(to);
|
PacketBuffer pb = new PacketBuffer(to);
|
||||||
pb.writeItemStackToBuffer(stack);
|
pb.writeItemStack(stack);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -177,7 +177,7 @@ public class ByteBufUtils {
|
||||||
PacketBuffer pb = new PacketBuffer(from);
|
PacketBuffer pb = new PacketBuffer(from);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
return pb.readItemStackFromBuffer();
|
return pb.readItemStack();
|
||||||
} catch (IOException e)
|
} catch (IOException e)
|
||||||
{
|
{
|
||||||
// Unpossible?
|
// Unpossible?
|
||||||
|
@ -194,7 +194,7 @@ public class ByteBufUtils {
|
||||||
public static void writeTag(ByteBuf to, NBTTagCompound tag)
|
public static void writeTag(ByteBuf to, NBTTagCompound tag)
|
||||||
{
|
{
|
||||||
PacketBuffer pb = new PacketBuffer(to);
|
PacketBuffer pb = new PacketBuffer(to);
|
||||||
pb.writeNBTTagCompoundToBuffer(tag);
|
pb.writeCompoundTag(tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -208,7 +208,7 @@ public class ByteBufUtils {
|
||||||
PacketBuffer pb = new PacketBuffer(from);
|
PacketBuffer pb = new PacketBuffer(from);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
return pb.readNBTTagCompoundFromBuffer();
|
return pb.readCompoundTag();
|
||||||
} catch (IOException e)
|
} catch (IOException e)
|
||||||
{
|
{
|
||||||
// Unpossible?
|
// Unpossible?
|
||||||
|
|
|
@ -148,7 +148,7 @@ public class FMLOutboundHandler extends ChannelOutboundHandlerAdapter {
|
||||||
public List<NetworkDispatcher> selectNetworks(Object args, ChannelHandlerContext context, FMLProxyPacket packet)
|
public List<NetworkDispatcher> selectNetworks(Object args, ChannelHandlerContext context, FMLProxyPacket packet)
|
||||||
{
|
{
|
||||||
ImmutableList.Builder<NetworkDispatcher> builder = ImmutableList.builder();
|
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();
|
NetworkDispatcher dispatcher = player.connection.netManager.channel().attr(NetworkDispatcher.FML_DISPATCHER).get();
|
||||||
if (dispatcher != null) builder.add(dispatcher);
|
if (dispatcher != null) builder.add(dispatcher);
|
||||||
|
@ -176,7 +176,7 @@ public class FMLOutboundHandler extends ChannelOutboundHandlerAdapter {
|
||||||
{
|
{
|
||||||
int dimension = (Integer)args;
|
int dimension = (Integer)args;
|
||||||
ImmutableList.Builder<NetworkDispatcher> builder = ImmutableList.builder();
|
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)
|
if (dimension == player.dimension)
|
||||||
{
|
{
|
||||||
|
@ -210,7 +210,7 @@ public class FMLOutboundHandler extends ChannelOutboundHandlerAdapter {
|
||||||
{
|
{
|
||||||
TargetPoint tp = (TargetPoint)args;
|
TargetPoint tp = (TargetPoint)args;
|
||||||
ImmutableList.Builder<NetworkDispatcher> builder = ImmutableList.builder();
|
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)
|
if (player.dimension == tp.dimension)
|
||||||
{
|
{
|
||||||
|
|
|
@ -630,7 +630,7 @@ public class NetworkDispatcher extends SimpleChannelInboundHandler<Packet<?>> im
|
||||||
|
|
||||||
private MultiPartCustomPayload(PacketBuffer preamble) throws IOException
|
private MultiPartCustomPayload(PacketBuffer preamble) throws IOException
|
||||||
{
|
{
|
||||||
channel = preamble.readStringFromBuffer(20);
|
channel = preamble.readString(20);
|
||||||
part_count = preamble.readUnsignedByte();
|
part_count = preamble.readUnsignedByte();
|
||||||
int length = preamble.readInt();
|
int length = preamble.readInt();
|
||||||
if (length <= 0 || length >= FMLProxyPacket.MAX_LENGTH)
|
if (length <= 0 || length >= FMLProxyPacket.MAX_LENGTH)
|
||||||
|
|
|
@ -54,8 +54,8 @@ public class OpenGuiHandler extends SimpleChannelInboundHandler<FMLMessage.OpenG
|
||||||
|
|
||||||
private void process(OpenGui msg)
|
private void process(OpenGui msg)
|
||||||
{
|
{
|
||||||
EntityPlayer player = FMLClientHandler.instance().getClient().thePlayer;
|
EntityPlayer player = FMLClientHandler.instance().getClient().player;
|
||||||
player.openGui(msg.modId, msg.modGuiId, player.worldObj, msg.x, msg.y, msg.z);
|
player.openGui(msg.modId, msg.modGuiId, player.world, msg.x, msg.y, msg.z);
|
||||||
player.openContainer.windowId = msg.windowId;
|
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
|
* 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.
|
* 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 primary Primary egg color
|
||||||
* @param secondary Secondary 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)
|
public static void registerEgg(ResourceLocation name, int primary, int secondary)
|
||||||
{
|
{
|
||||||
EntityEntry entry = ForgeRegistries.ENTITIES.getValue(name);
|
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 entityClass Entity class added
|
||||||
* @param weightedProb Probability
|
* @param weightedProb Probability
|
||||||
* @param min Min spawn count
|
* @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 entityName The entity name
|
||||||
* @param weightedProb Probability
|
* @param weightedProb Probability
|
||||||
* @param min Min spawn count
|
* @param min Min spawn count
|
||||||
|
@ -352,7 +349,7 @@ public class EntityRegistry
|
||||||
EntityRegistration er = lookupModSpawn(entity.getClass(), true);
|
EntityRegistration er = lookupModSpawn(entity.getClass(), true);
|
||||||
if (er != null)
|
if (er != null)
|
||||||
{
|
{
|
||||||
entityTracker.addEntityToTracker(entity, er.getTrackingRange(), er.getUpdateFrequency(), er.sendsVelocityUpdates());
|
entityTracker.track(entity, er.getTrackingRange(), er.getUpdateFrequency(), er.sendsVelocityUpdates());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -375,7 +375,7 @@ public class GameRegistry
|
||||||
if (item == null)
|
if (item == null)
|
||||||
{
|
{
|
||||||
FMLLog.getLogger().log(Level.TRACE, "Unable to find item with name {}", itemName);
|
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);
|
ItemStack is = new ItemStack(item, stackSize, meta);
|
||||||
if (!Strings.isNullOrEmpty(nbtString))
|
if (!Strings.isNullOrEmpty(nbtString))
|
||||||
|
|
|
@ -37,15 +37,15 @@ public class ItemHandlerHelper
|
||||||
@Nonnull
|
@Nonnull
|
||||||
public static ItemStack insertItem(IItemHandler dest, @Nonnull ItemStack stack, boolean simulate)
|
public static ItemStack insertItem(IItemHandler dest, @Nonnull ItemStack stack, boolean simulate)
|
||||||
{
|
{
|
||||||
if (dest == null || stack.func_190926_b())
|
if (dest == null || stack.isEmpty())
|
||||||
return ItemStack.field_190927_a;
|
return ItemStack.EMPTY;
|
||||||
|
|
||||||
for (int i = 0; i < dest.getSlots(); i++)
|
for (int i = 0; i < dest.getSlots(); i++)
|
||||||
{
|
{
|
||||||
stack = dest.insertItem(i, stack, simulate);
|
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)
|
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 false;
|
||||||
|
|
||||||
return (!a.hasTagCompound() || a.getTagCompound().equals(b.getTagCompound())) && a.areCapsCompatible(b);
|
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)
|
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;
|
return false;
|
||||||
|
|
||||||
if (!a.isStackable())
|
if (!a.isStackable())
|
||||||
|
@ -88,9 +88,9 @@ public class ItemHandlerHelper
|
||||||
public static ItemStack copyStackWithSize(@Nonnull ItemStack itemStack, int size)
|
public static ItemStack copyStackWithSize(@Nonnull ItemStack itemStack, int size)
|
||||||
{
|
{
|
||||||
if (size == 0)
|
if (size == 0)
|
||||||
return ItemStack.field_190927_a;
|
return ItemStack.EMPTY;
|
||||||
ItemStack copy = itemStack.copy();
|
ItemStack copy = itemStack.copy();
|
||||||
copy.func_190920_e(size);
|
copy.setCount(size);
|
||||||
return copy;
|
return copy;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,7 +102,7 @@ public class ItemHandlerHelper
|
||||||
@Nonnull
|
@Nonnull
|
||||||
public static ItemStack insertItemStacked(IItemHandler inventory, @Nonnull ItemStack stack, boolean simulate)
|
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;
|
return stack;
|
||||||
|
|
||||||
// not stackable -> just insert into a new slot
|
// not stackable -> just insert into a new slot
|
||||||
|
@ -121,7 +121,7 @@ public class ItemHandlerHelper
|
||||||
{
|
{
|
||||||
stack = inventory.insertItem(i, stack, simulate);
|
stack = inventory.insertItem(i, stack, simulate);
|
||||||
|
|
||||||
if (stack.func_190926_b())
|
if (stack.isEmpty())
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -129,15 +129,15 @@ public class ItemHandlerHelper
|
||||||
}
|
}
|
||||||
|
|
||||||
// insert remainder into empty slots
|
// insert remainder into empty slots
|
||||||
if (!stack.func_190926_b())
|
if (!stack.isEmpty())
|
||||||
{
|
{
|
||||||
// find empty slot
|
// find empty slot
|
||||||
for (int i = 0; i < sizeInventory; i++)
|
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);
|
stack = inventory.insertItem(i, stack, simulate);
|
||||||
if (stack.func_190926_b())
|
if (stack.isEmpty())
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -163,7 +163,7 @@ public class ItemHandlerHelper
|
||||||
public static void giveItemToPlayer(EntityPlayer player, @Nonnull ItemStack stack, int preferredSlot)
|
public static void giveItemToPlayer(EntityPlayer player, @Nonnull ItemStack stack, int preferredSlot)
|
||||||
{
|
{
|
||||||
IItemHandler inventory = new PlayerMainInvWrapper(player.inventory);
|
IItemHandler inventory = new PlayerMainInvWrapper(player.inventory);
|
||||||
World world = player.worldObj;
|
World world = player.world;
|
||||||
|
|
||||||
// try adding it into the inventory
|
// try adding it into the inventory
|
||||||
ItemStack remainder = stack;
|
ItemStack remainder = stack;
|
||||||
|
@ -173,27 +173,27 @@ public class ItemHandlerHelper
|
||||||
remainder = inventory.insertItem(preferredSlot, stack, false);
|
remainder = inventory.insertItem(preferredSlot, stack, false);
|
||||||
}
|
}
|
||||||
// then into the inventory in general
|
// then into the inventory in general
|
||||||
if(!remainder.func_190926_b())
|
if(!remainder.isEmpty())
|
||||||
{
|
{
|
||||||
remainder = insertItemStacked(inventory, remainder, false);
|
remainder = insertItemStacked(inventory, remainder, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// play sound if something got picked up
|
// 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,
|
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);
|
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
|
// 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 entityitem = new EntityItem(world, player.posX, player.posY + 0.5, player.posZ, stack);
|
||||||
entityitem.setPickupDelay(40);
|
entityitem.setPickupDelay(40);
|
||||||
entityitem.motionX = 0;
|
entityitem.motionX = 0;
|
||||||
entityitem.motionZ = 0;
|
entityitem.motionZ = 0;
|
||||||
|
|
||||||
world.spawnEntityInWorld(entityitem);
|
world.spawnEntity(entityitem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -218,15 +218,15 @@ public class ItemHandlerHelper
|
||||||
{
|
{
|
||||||
ItemStack itemstack = inv.getStackInSlot(j);
|
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;
|
++itemsFound;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
proportion = proportion / (float)inv.getSlots();
|
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)
|
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)
|
public ItemStackHandler(NonNullList<ItemStack> stacks)
|
||||||
|
@ -49,7 +49,7 @@ public class ItemStackHandler implements IItemHandler, IItemHandlerModifiable, I
|
||||||
|
|
||||||
public void setSize(int size)
|
public void setSize(int size)
|
||||||
{
|
{
|
||||||
stacks = NonNullList.func_191197_a(size, ItemStack.field_190927_a);
|
stacks = NonNullList.withSize(size, ItemStack.EMPTY);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -80,8 +80,8 @@ public class ItemStackHandler implements IItemHandler, IItemHandlerModifiable, I
|
||||||
@Nonnull
|
@Nonnull
|
||||||
public ItemStack insertItem(int slot, @Nonnull ItemStack stack, boolean simulate)
|
public ItemStack insertItem(int slot, @Nonnull ItemStack stack, boolean simulate)
|
||||||
{
|
{
|
||||||
if (stack.func_190926_b())
|
if (stack.isEmpty())
|
||||||
return ItemStack.field_190927_a;
|
return ItemStack.EMPTY;
|
||||||
|
|
||||||
validateSlotIndex(slot);
|
validateSlotIndex(slot);
|
||||||
|
|
||||||
|
@ -89,55 +89,55 @@ public class ItemStackHandler implements IItemHandler, IItemHandlerModifiable, I
|
||||||
|
|
||||||
int limit = getStackLimit(slot, stack);
|
int limit = getStackLimit(slot, stack);
|
||||||
|
|
||||||
if (!existing.func_190926_b())
|
if (!existing.isEmpty())
|
||||||
{
|
{
|
||||||
if (!ItemHandlerHelper.canItemStacksStack(stack, existing))
|
if (!ItemHandlerHelper.canItemStacksStack(stack, existing))
|
||||||
return stack;
|
return stack;
|
||||||
|
|
||||||
limit -= existing.func_190916_E();
|
limit -= existing.getCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (limit <= 0)
|
if (limit <= 0)
|
||||||
return stack;
|
return stack;
|
||||||
|
|
||||||
boolean reachedLimit = stack.func_190916_E() > limit;
|
boolean reachedLimit = stack.getCount() > limit;
|
||||||
|
|
||||||
if (!simulate)
|
if (!simulate)
|
||||||
{
|
{
|
||||||
if (existing.func_190926_b())
|
if (existing.isEmpty())
|
||||||
{
|
{
|
||||||
this.stacks.set(slot, reachedLimit ? ItemHandlerHelper.copyStackWithSize(stack, limit) : stack);
|
this.stacks.set(slot, reachedLimit ? ItemHandlerHelper.copyStackWithSize(stack, limit) : stack);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
existing.func_190917_f(reachedLimit ? limit : stack.func_190916_E());
|
existing.grow(reachedLimit ? limit : stack.getCount());
|
||||||
}
|
}
|
||||||
onContentsChanged(slot);
|
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
|
@Nonnull
|
||||||
public ItemStack extractItem(int slot, int amount, boolean simulate)
|
public ItemStack extractItem(int slot, int amount, boolean simulate)
|
||||||
{
|
{
|
||||||
if (amount == 0)
|
if (amount == 0)
|
||||||
return ItemStack.field_190927_a;
|
return ItemStack.EMPTY;
|
||||||
|
|
||||||
validateSlotIndex(slot);
|
validateSlotIndex(slot);
|
||||||
|
|
||||||
ItemStack existing = this.stacks.get(slot);
|
ItemStack existing = this.stacks.get(slot);
|
||||||
|
|
||||||
if (existing.func_190926_b())
|
if (existing.isEmpty())
|
||||||
return ItemStack.field_190927_a;
|
return ItemStack.EMPTY;
|
||||||
|
|
||||||
int toExtract = Math.min(amount, existing.getMaxStackSize());
|
int toExtract = Math.min(amount, existing.getMaxStackSize());
|
||||||
|
|
||||||
if (existing.func_190916_E() <= toExtract)
|
if (existing.getCount() <= toExtract)
|
||||||
{
|
{
|
||||||
if (!simulate)
|
if (!simulate)
|
||||||
{
|
{
|
||||||
this.stacks.set(slot, ItemStack.field_190927_a);
|
this.stacks.set(slot, ItemStack.EMPTY);
|
||||||
onContentsChanged(slot);
|
onContentsChanged(slot);
|
||||||
}
|
}
|
||||||
return existing;
|
return existing;
|
||||||
|
@ -146,7 +146,7 @@ public class ItemStackHandler implements IItemHandler, IItemHandlerModifiable, I
|
||||||
{
|
{
|
||||||
if (!simulate)
|
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);
|
onContentsChanged(slot);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -171,7 +171,7 @@ public class ItemStackHandler implements IItemHandler, IItemHandlerModifiable, I
|
||||||
NBTTagList nbtTagList = new NBTTagList();
|
NBTTagList nbtTagList = new NBTTagList();
|
||||||
for (int i = 0; i < stacks.size(); i++)
|
for (int i = 0; i < stacks.size(); i++)
|
||||||
{
|
{
|
||||||
if (!stacks.get(i).func_190926_b())
|
if (!stacks.get(i).isEmpty())
|
||||||
{
|
{
|
||||||
NBTTagCompound itemTag = new NBTTagCompound();
|
NBTTagCompound itemTag = new NBTTagCompound();
|
||||||
itemTag.setInteger("Slot", i);
|
itemTag.setInteger("Slot", i);
|
||||||
|
|
|
@ -43,7 +43,7 @@ public class SlotItemHandler extends Slot
|
||||||
@Override
|
@Override
|
||||||
public boolean isItemValid(@Nonnull ItemStack stack)
|
public boolean isItemValid(@Nonnull ItemStack stack)
|
||||||
{
|
{
|
||||||
if (stack.func_190926_b())
|
if (stack.isEmpty())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
IItemHandler handler = this.getItemHandler();
|
IItemHandler handler = this.getItemHandler();
|
||||||
|
@ -53,7 +53,7 @@ public class SlotItemHandler extends Slot
|
||||||
IItemHandlerModifiable handlerModifiable = (IItemHandlerModifiable) handler;
|
IItemHandlerModifiable handlerModifiable = (IItemHandlerModifiable) handler;
|
||||||
ItemStack currentStack = handlerModifiable.getStackInSlot(index);
|
ItemStack currentStack = handlerModifiable.getStackInSlot(index);
|
||||||
|
|
||||||
handlerModifiable.setStackInSlot(index, ItemStack.field_190927_a);
|
handlerModifiable.setStackInSlot(index, ItemStack.EMPTY);
|
||||||
|
|
||||||
remainder = handlerModifiable.insertItem(index, stack, true);
|
remainder = handlerModifiable.insertItem(index, stack, true);
|
||||||
|
|
||||||
|
@ -63,7 +63,7 @@ public class SlotItemHandler extends Slot
|
||||||
{
|
{
|
||||||
remainder = handler.insertItem(index, stack, true);
|
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
|
@Override
|
||||||
|
@ -98,27 +98,27 @@ public class SlotItemHandler extends Slot
|
||||||
{
|
{
|
||||||
ItemStack maxAdd = stack.copy();
|
ItemStack maxAdd = stack.copy();
|
||||||
int maxInput = stack.getMaxStackSize();
|
int maxInput = stack.getMaxStackSize();
|
||||||
maxAdd.func_190920_e(maxInput);
|
maxAdd.setCount(maxInput);
|
||||||
|
|
||||||
IItemHandler handler = this.getItemHandler();
|
IItemHandler handler = this.getItemHandler();
|
||||||
ItemStack currentStack = handler.getStackInSlot(index);
|
ItemStack currentStack = handler.getStackInSlot(index);
|
||||||
if (handler instanceof IItemHandlerModifiable) {
|
if (handler instanceof IItemHandlerModifiable) {
|
||||||
IItemHandlerModifiable handlerModifiable = (IItemHandlerModifiable) handler;
|
IItemHandlerModifiable handlerModifiable = (IItemHandlerModifiable) handler;
|
||||||
|
|
||||||
handlerModifiable.setStackInSlot(index, ItemStack.field_190927_a);
|
handlerModifiable.setStackInSlot(index, ItemStack.EMPTY);
|
||||||
|
|
||||||
ItemStack remainder = handlerModifiable.insertItem(index, maxAdd, true);
|
ItemStack remainder = handlerModifiable.insertItem(index, maxAdd, true);
|
||||||
|
|
||||||
handlerModifiable.setStackInSlot(index, currentStack);
|
handlerModifiable.setStackInSlot(index, currentStack);
|
||||||
|
|
||||||
return maxInput - remainder.func_190916_E();
|
return maxInput - remainder.getCount();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ItemStack remainder = handler.insertItem(index, maxAdd, true);
|
ItemStack remainder = handler.insertItem(index, maxAdd, true);
|
||||||
|
|
||||||
int current = currentStack.func_190916_E();
|
int current = currentStack.getCount();
|
||||||
int added = maxInput - remainder.func_190916_E();
|
int added = maxInput - remainder.getCount();
|
||||||
return current + added;
|
return current + added;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -126,7 +126,7 @@ public class SlotItemHandler extends Slot
|
||||||
@Override
|
@Override
|
||||||
public boolean canTakeStack(EntityPlayer playerIn)
|
public boolean canTakeStack(EntityPlayer playerIn)
|
||||||
{
|
{
|
||||||
return !this.getItemHandler().extractItem(index, 1, true).func_190926_b();
|
return !this.getItemHandler().extractItem(index, 1, true).isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -110,7 +110,7 @@ public class VanillaDoubleChestItemHandler extends WeakReference<TileEntityChest
|
||||||
boolean accessingUpperChest = slot < 27;
|
boolean accessingUpperChest = slot < 27;
|
||||||
int targetSlot = accessingUpperChest ? slot : slot - 27;
|
int targetSlot = accessingUpperChest ? slot : slot - 27;
|
||||||
TileEntityChest chest = getChest(accessingUpperChest);
|
TileEntityChest chest = getChest(accessingUpperChest);
|
||||||
return chest != null ? chest.getStackInSlot(targetSlot) : ItemStack.field_190927_a;
|
return chest != null ? chest.getStackInSlot(targetSlot) : ItemStack.EMPTY;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -146,7 +146,7 @@ public class VanillaDoubleChestItemHandler extends WeakReference<TileEntityChest
|
||||||
boolean accessingUpperChest = slot < 27;
|
boolean accessingUpperChest = slot < 27;
|
||||||
int targetSlot = accessingUpperChest ? slot : slot - 27;
|
int targetSlot = accessingUpperChest ? slot : slot - 27;
|
||||||
TileEntityChest chest = getChest(accessingUpperChest);
|
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
|
@Override
|
||||||
|
|
|
@ -45,12 +45,12 @@ public class VanillaHopperItemHandler extends InvWrapper
|
||||||
}
|
}
|
||||||
else
|
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);
|
stack = super.insertItem(slot, stack, simulate);
|
||||||
|
|
||||||
if (wasEmpty && originalStackSize > stack.func_190916_E())
|
if (wasEmpty && originalStackSize > stack.getCount())
|
||||||
{
|
{
|
||||||
if (!hopper.mayTransfer())
|
if (!hopper.mayTransfer())
|
||||||
{
|
{
|
||||||
|
|
|
@ -54,19 +54,19 @@ public class VanillaInventoryCodeHooks
|
||||||
for (int i = 0; i < handler.getSlots(); i++)
|
for (int i = 0; i < handler.getSlots(); i++)
|
||||||
{
|
{
|
||||||
ItemStack extractItem = handler.extractItem(i, 1, true);
|
ItemStack extractItem = handler.extractItem(i, 1, true);
|
||||||
if (!extractItem.func_190926_b())
|
if (!extractItem.isEmpty())
|
||||||
{
|
{
|
||||||
for (int j = 0; j < dest.getSizeInventory(); j++)
|
for (int j = 0; j < dest.getSizeInventory(); j++)
|
||||||
{
|
{
|
||||||
ItemStack destStack = dest.getStackInSlot(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);
|
extractItem = handler.extractItem(i, 1, false);
|
||||||
if (destStack.func_190926_b())
|
if (destStack.isEmpty())
|
||||||
dest.setInventorySlotContents(j, extractItem);
|
dest.setInventorySlotContents(j, extractItem);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
destStack.func_190917_f(1);
|
destStack.grow(1);
|
||||||
dest.setInventorySlotContents(j, destStack);
|
dest.setInventorySlotContents(j, destStack);
|
||||||
}
|
}
|
||||||
dest.markDirty();
|
dest.markDirty();
|
||||||
|
@ -98,10 +98,10 @@ public class VanillaInventoryCodeHooks
|
||||||
ItemStack dispensedStack = stack.copy().splitStack(1);
|
ItemStack dispensedStack = stack.copy().splitStack(1);
|
||||||
ItemStack remainder = putStackInInventoryAllSlots(dropper, destination, itemHandler, dispensedStack);
|
ItemStack remainder = putStackInInventoryAllSlots(dropper, destination, itemHandler, dispensedStack);
|
||||||
|
|
||||||
if (remainder.func_190926_b())
|
if (remainder.isEmpty())
|
||||||
{
|
{
|
||||||
remainder = stack.copy();
|
remainder = stack.copy();
|
||||||
remainder.func_190918_g(1);
|
remainder.shrink(1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -136,13 +136,13 @@ public class VanillaInventoryCodeHooks
|
||||||
{
|
{
|
||||||
for (int i = 0; i < hopper.getSizeInventory(); ++i)
|
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 originalSlotContents = hopper.getStackInSlot(i).copy();
|
||||||
ItemStack insertStack = hopper.decrStackSize(i, 1);
|
ItemStack insertStack = hopper.decrStackSize(i, 1);
|
||||||
ItemStack remainder = putStackInInventoryAllSlots(hopper, destination, itemHandler, insertStack);
|
ItemStack remainder = putStackInInventoryAllSlots(hopper, destination, itemHandler, insertStack);
|
||||||
|
|
||||||
if (remainder.func_190926_b())
|
if (remainder.isEmpty())
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -158,7 +158,7 @@ public class VanillaInventoryCodeHooks
|
||||||
|
|
||||||
private static ItemStack putStackInInventoryAllSlots(TileEntity source, Object destination, IItemHandler destInventory, ItemStack stack)
|
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);
|
stack = insertStack(source, destination, destInventory, stack, slot);
|
||||||
}
|
}
|
||||||
|
@ -172,22 +172,22 @@ public class VanillaInventoryCodeHooks
|
||||||
{
|
{
|
||||||
ItemStack itemstack = destInventory.getStackInSlot(slot);
|
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 insertedItem = false;
|
||||||
boolean inventoryWasEmpty = isEmpty(destInventory);
|
boolean inventoryWasEmpty = isEmpty(destInventory);
|
||||||
|
|
||||||
if (itemstack.func_190926_b())
|
if (itemstack.isEmpty())
|
||||||
{
|
{
|
||||||
destInventory.insertItem(slot, stack, false);
|
destInventory.insertItem(slot, stack, false);
|
||||||
stack = ItemStack.field_190927_a;
|
stack = ItemStack.EMPTY;
|
||||||
insertedItem = true;
|
insertedItem = true;
|
||||||
}
|
}
|
||||||
else if (ItemHandlerHelper.canItemStacksStack(itemstack, stack))
|
else if (ItemHandlerHelper.canItemStacksStack(itemstack, stack))
|
||||||
{
|
{
|
||||||
int originalSize = stack.func_190916_E();
|
int originalSize = stack.getCount();
|
||||||
stack = destInventory.insertItem(slot, stack, false);
|
stack = destInventory.insertItem(slot, stack, false);
|
||||||
insertedItem = originalSize < stack.func_190916_E();
|
insertedItem = originalSize < stack.getCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (insertedItem)
|
if (insertedItem)
|
||||||
|
@ -231,7 +231,7 @@ public class VanillaInventoryCodeHooks
|
||||||
for (int slot = 0; slot < itemHandler.getSlots(); slot++)
|
for (int slot = 0; slot < itemHandler.getSlots(); slot++)
|
||||||
{
|
{
|
||||||
ItemStack stackInSlot = itemHandler.getStackInSlot(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;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -244,7 +244,7 @@ public class VanillaInventoryCodeHooks
|
||||||
for (int slot = 0; slot < itemHandler.getSlots(); slot++)
|
for (int slot = 0; slot < itemHandler.getSlots(); slot++)
|
||||||
{
|
{
|
||||||
ItemStack stackInSlot = itemHandler.getStackInSlot(slot);
|
ItemStack stackInSlot = itemHandler.getStackInSlot(slot);
|
||||||
if (stackInSlot.func_190916_E() > 0)
|
if (stackInSlot.getCount() > 0)
|
||||||
{
|
{
|
||||||
return false;
|
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)
|
public static Pair<IItemHandler, Object> getItemHandler(World worldIn, double x, double y, double z, final EnumFacing side)
|
||||||
{
|
{
|
||||||
Pair<IItemHandler, Object> destination = null;
|
Pair<IItemHandler, Object> destination = null;
|
||||||
int i = MathHelper.floor_double(x);
|
int i = MathHelper.floor(x);
|
||||||
int j = MathHelper.floor_double(y);
|
int j = MathHelper.floor(y);
|
||||||
int k = MathHelper.floor_double(z);
|
int k = MathHelper.floor(z);
|
||||||
BlockPos blockpos = new BlockPos(i, j, k);
|
BlockPos blockpos = new BlockPos(i, j, k);
|
||||||
net.minecraft.block.state.IBlockState state = worldIn.getBlockState(blockpos);
|
net.minecraft.block.state.IBlockState state = worldIn.getBlockState(blockpos);
|
||||||
Block block = state.getBlock();
|
Block block = state.getBlock();
|
||||||
|
|
|
@ -39,7 +39,7 @@ public class EmptyHandler implements IItemHandlerModifiable
|
||||||
@Nonnull
|
@Nonnull
|
||||||
public ItemStack getStackInSlot(int slot)
|
public ItemStack getStackInSlot(int slot)
|
||||||
{
|
{
|
||||||
return ItemStack.field_190927_a;
|
return ItemStack.EMPTY;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -53,7 +53,7 @@ public class EmptyHandler implements IItemHandlerModifiable
|
||||||
@Nonnull
|
@Nonnull
|
||||||
public ItemStack extractItem(int slot, int amount, boolean simulate)
|
public ItemStack extractItem(int slot, int amount, boolean simulate)
|
||||||
{
|
{
|
||||||
return ItemStack.field_190927_a;
|
return ItemStack.EMPTY;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -72,8 +72,8 @@ public class InvWrapper implements IItemHandlerModifiable
|
||||||
@Nonnull
|
@Nonnull
|
||||||
public ItemStack insertItem(int slot, @Nonnull ItemStack stack, boolean simulate)
|
public ItemStack insertItem(int slot, @Nonnull ItemStack stack, boolean simulate)
|
||||||
{
|
{
|
||||||
if (stack.func_190926_b())
|
if (stack.isEmpty())
|
||||||
return ItemStack.field_190927_a;
|
return ItemStack.EMPTY;
|
||||||
|
|
||||||
if (!getInv().isItemValidForSlot(slot, stack))
|
if (!getInv().isItemValidForSlot(slot, stack))
|
||||||
return stack;
|
return stack;
|
||||||
|
@ -81,24 +81,24 @@ public class InvWrapper implements IItemHandlerModifiable
|
||||||
ItemStack stackInSlot = getInv().getStackInSlot(slot);
|
ItemStack stackInSlot = getInv().getStackInSlot(slot);
|
||||||
|
|
||||||
int m;
|
int m;
|
||||||
if (!stackInSlot.func_190926_b())
|
if (!stackInSlot.isEmpty())
|
||||||
{
|
{
|
||||||
if (!ItemHandlerHelper.canItemStacksStack(stack, stackInSlot))
|
if (!ItemHandlerHelper.canItemStacksStack(stack, stackInSlot))
|
||||||
return stack;
|
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)
|
if (!simulate)
|
||||||
{
|
{
|
||||||
ItemStack copy = stack.copy();
|
ItemStack copy = stack.copy();
|
||||||
copy.func_190917_f(stackInSlot.func_190916_E());
|
copy.grow(stackInSlot.getCount());
|
||||||
getInv().setInventorySlotContents(slot, copy);
|
getInv().setInventorySlotContents(slot, copy);
|
||||||
getInv().markDirty();
|
getInv().markDirty();
|
||||||
}
|
}
|
||||||
|
|
||||||
return ItemStack.field_190927_a;
|
return ItemStack.EMPTY;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -107,14 +107,14 @@ public class InvWrapper implements IItemHandlerModifiable
|
||||||
if (!simulate)
|
if (!simulate)
|
||||||
{
|
{
|
||||||
ItemStack copy = stack.splitStack(m);
|
ItemStack copy = stack.splitStack(m);
|
||||||
copy.func_190917_f(stackInSlot.func_190916_E());
|
copy.grow(stackInSlot.getCount());
|
||||||
getInv().setInventorySlotContents(slot, copy);
|
getInv().setInventorySlotContents(slot, copy);
|
||||||
getInv().markDirty();
|
getInv().markDirty();
|
||||||
return stack;
|
return stack;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
stack.func_190918_g(m);
|
stack.shrink(m);
|
||||||
return stack;
|
return stack;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -122,7 +122,7 @@ public class InvWrapper implements IItemHandlerModifiable
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m = Math.min(stack.getMaxStackSize(), getSlotLimit(slot));
|
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
|
// copy the stack to not modify the original one
|
||||||
stack = stack.copy();
|
stack = stack.copy();
|
||||||
|
@ -134,7 +134,7 @@ public class InvWrapper implements IItemHandlerModifiable
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
stack.func_190918_g(m);
|
stack.shrink(m);
|
||||||
return stack;
|
return stack;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -145,7 +145,7 @@ public class InvWrapper implements IItemHandlerModifiable
|
||||||
getInv().setInventorySlotContents(slot, stack);
|
getInv().setInventorySlotContents(slot, stack);
|
||||||
getInv().markDirty();
|
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)
|
public ItemStack extractItem(int slot, int amount, boolean simulate)
|
||||||
{
|
{
|
||||||
if (amount == 0)
|
if (amount == 0)
|
||||||
return ItemStack.field_190927_a;
|
return ItemStack.EMPTY;
|
||||||
|
|
||||||
ItemStack stackInSlot = getInv().getStackInSlot(slot);
|
ItemStack stackInSlot = getInv().getStackInSlot(slot);
|
||||||
|
|
||||||
if (stackInSlot.func_190926_b())
|
if (stackInSlot.isEmpty())
|
||||||
return ItemStack.field_190927_a;
|
return ItemStack.EMPTY;
|
||||||
|
|
||||||
if (simulate)
|
if (simulate)
|
||||||
{
|
{
|
||||||
if (stackInSlot.func_190916_E() < amount)
|
if (stackInSlot.getCount() < amount)
|
||||||
{
|
{
|
||||||
return stackInSlot.copy();
|
return stackInSlot.copy();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ItemStack copy = stackInSlot.copy();
|
ItemStack copy = stackInSlot.copy();
|
||||||
copy.func_190920_e(amount);
|
copy.setCount(amount);
|
||||||
return copy;
|
return copy;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int m = Math.min(stackInSlot.func_190916_E(), amount);
|
int m = Math.min(stackInSlot.getCount(), amount);
|
||||||
|
|
||||||
ItemStack decrStackSize = getInv().decrStackSize(slot, m);
|
ItemStack decrStackSize = getInv().decrStackSize(slot, m);
|
||||||
getInv().markDirty();
|
getInv().markDirty();
|
||||||
|
|
|
@ -49,7 +49,7 @@ public class PlayerArmorInvWrapper extends RangedWrapper
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// check if it's valid for the armor slot
|
// 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);
|
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)
|
public ItemStack insertItem(int slot, @Nonnull ItemStack stack, boolean simulate)
|
||||||
{
|
{
|
||||||
ItemStack rest = super.insertItem(slot, stack, 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
|
// the stack in the slot changed, animate it
|
||||||
ItemStack inSlot = getStackInSlot(slot);
|
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) {
|
else if(getInventoryPlayer().player instanceof EntityPlayerMP) {
|
||||||
getInventoryPlayer().player.openContainer.detectAndSendChanges();
|
getInventoryPlayer().player.openContainer.detectAndSendChanges();
|
||||||
|
|
|
@ -58,7 +58,7 @@ public class RangedWrapper implements IItemHandlerModifiable {
|
||||||
return compose.getStackInSlot(slot + minSlot);
|
return compose.getStackInSlot(slot + minSlot);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ItemStack.field_190927_a;
|
return ItemStack.EMPTY;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -82,7 +82,7 @@ public class RangedWrapper implements IItemHandlerModifiable {
|
||||||
return compose.extractItem(slot + minSlot, amount, simulate);
|
return compose.extractItem(slot + minSlot, amount, simulate);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ItemStack.field_190927_a;
|
return ItemStack.EMPTY;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -78,15 +78,15 @@ public class SidedInvWrapper implements IItemHandlerModifiable
|
||||||
public ItemStack getStackInSlot(int slot)
|
public ItemStack getStackInSlot(int slot)
|
||||||
{
|
{
|
||||||
int i = getSlot(inv, slot, side);
|
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
|
@Override
|
||||||
@Nonnull
|
@Nonnull
|
||||||
public ItemStack insertItem(int slot, @Nonnull ItemStack stack, boolean simulate)
|
public ItemStack insertItem(int slot, @Nonnull ItemStack stack, boolean simulate)
|
||||||
{
|
{
|
||||||
if (stack.func_190926_b())
|
if (stack.isEmpty())
|
||||||
return ItemStack.field_190927_a;
|
return ItemStack.EMPTY;
|
||||||
|
|
||||||
int slot1 = getSlot(inv, slot, side);
|
int slot1 = getSlot(inv, slot, side);
|
||||||
|
|
||||||
|
@ -99,23 +99,23 @@ public class SidedInvWrapper implements IItemHandlerModifiable
|
||||||
ItemStack stackInSlot = inv.getStackInSlot(slot1);
|
ItemStack stackInSlot = inv.getStackInSlot(slot1);
|
||||||
|
|
||||||
int m;
|
int m;
|
||||||
if (!stackInSlot.func_190926_b())
|
if (!stackInSlot.isEmpty())
|
||||||
{
|
{
|
||||||
if (!ItemHandlerHelper.canItemStacksStack(stack, stackInSlot))
|
if (!ItemHandlerHelper.canItemStacksStack(stack, stackInSlot))
|
||||||
return stack;
|
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)
|
if (!simulate)
|
||||||
{
|
{
|
||||||
ItemStack copy = stack.copy();
|
ItemStack copy = stack.copy();
|
||||||
copy.func_190917_f(stackInSlot.func_190916_E());
|
copy.grow(stackInSlot.getCount());
|
||||||
inv.setInventorySlotContents(slot1, copy);
|
inv.setInventorySlotContents(slot1, copy);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ItemStack.field_190927_a;
|
return ItemStack.EMPTY;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -124,13 +124,13 @@ public class SidedInvWrapper implements IItemHandlerModifiable
|
||||||
if (!simulate)
|
if (!simulate)
|
||||||
{
|
{
|
||||||
ItemStack copy = stack.splitStack(m);
|
ItemStack copy = stack.splitStack(m);
|
||||||
copy.func_190917_f(stackInSlot.func_190916_E());
|
copy.grow(stackInSlot.getCount());
|
||||||
inv.setInventorySlotContents(slot1, copy);
|
inv.setInventorySlotContents(slot1, copy);
|
||||||
return stack;
|
return stack;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
stack.func_190918_g(m);
|
stack.shrink(m);
|
||||||
return stack;
|
return stack;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -138,7 +138,7 @@ public class SidedInvWrapper implements IItemHandlerModifiable
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m = Math.min(stack.getMaxStackSize(), getSlotLimit(slot));
|
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
|
// copy the stack to not modify the original one
|
||||||
stack = stack.copy();
|
stack = stack.copy();
|
||||||
|
@ -149,7 +149,7 @@ public class SidedInvWrapper implements IItemHandlerModifiable
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
stack.func_190918_g(m);
|
stack.shrink(m);
|
||||||
return stack;
|
return stack;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -157,7 +157,7 @@ public class SidedInvWrapper implements IItemHandlerModifiable
|
||||||
{
|
{
|
||||||
if (!simulate)
|
if (!simulate)
|
||||||
inv.setInventorySlotContents(slot1, stack);
|
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)
|
public ItemStack extractItem(int slot, int amount, boolean simulate)
|
||||||
{
|
{
|
||||||
if (amount == 0)
|
if (amount == 0)
|
||||||
return ItemStack.field_190927_a;
|
return ItemStack.EMPTY;
|
||||||
|
|
||||||
int slot1 = getSlot(inv, slot, side);
|
int slot1 = getSlot(inv, slot, side);
|
||||||
|
|
||||||
if (slot1 == -1)
|
if (slot1 == -1)
|
||||||
return ItemStack.field_190927_a;
|
return ItemStack.EMPTY;
|
||||||
|
|
||||||
ItemStack stackInSlot = inv.getStackInSlot(slot1);
|
ItemStack stackInSlot = inv.getStackInSlot(slot1);
|
||||||
|
|
||||||
if (stackInSlot.func_190926_b())
|
if (stackInSlot.isEmpty())
|
||||||
return ItemStack.field_190927_a;
|
return ItemStack.EMPTY;
|
||||||
|
|
||||||
if (!inv.canExtractItem(slot1, stackInSlot, side))
|
if (!inv.canExtractItem(slot1, stackInSlot, side))
|
||||||
return ItemStack.field_190927_a;
|
return ItemStack.EMPTY;
|
||||||
|
|
||||||
if (simulate)
|
if (simulate)
|
||||||
{
|
{
|
||||||
if (stackInSlot.func_190916_E() < amount)
|
if (stackInSlot.getCount() < amount)
|
||||||
{
|
{
|
||||||
return stackInSlot.copy();
|
return stackInSlot.copy();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ItemStack copy = stackInSlot.copy();
|
ItemStack copy = stackInSlot.copy();
|
||||||
copy.func_190920_e(amount);
|
copy.setCount(amount);
|
||||||
return copy;
|
return copy;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int m = Math.min(stackInSlot.func_190916_E(), amount);
|
int m = Math.min(stackInSlot.getCount(), amount);
|
||||||
return inv.decrStackSize(slot1, m);
|
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>> idToStack = Lists.newArrayList();
|
||||||
private static List<NonNullList<ItemStack>> idToStackUn = Lists.newArrayList();
|
private static List<NonNullList<ItemStack>> idToStackUn = Lists.newArrayList();
|
||||||
private static Map<Integer, List<Integer>> stackToId = Maps.newHashMapWithExpectedSize((int)(128 * 0.75));
|
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
|
* 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(Blocks.BONE_BLOCK), // Bone Block, to prevent conversion of dyes into bone meal.
|
||||||
new ItemStack(Items.BOAT),
|
new ItemStack(Items.BOAT),
|
||||||
new ItemStack(Items.OAK_DOOR),
|
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();
|
List<IRecipe> recipes = CraftingManager.getInstance().getRecipeList();
|
||||||
|
@ -356,7 +356,7 @@ public class OreDictionary
|
||||||
{
|
{
|
||||||
ShapedRecipes recipe = (ShapedRecipes)obj;
|
ShapedRecipes recipe = (ShapedRecipes)obj;
|
||||||
ItemStack output = recipe.getRecipeOutput();
|
ItemStack output = recipe.getRecipeOutput();
|
||||||
if (!output.func_190926_b() && containsMatch(false, exclusions, output))
|
if (!output.isEmpty() && containsMatch(false, exclusions, output))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -371,7 +371,7 @@ public class OreDictionary
|
||||||
{
|
{
|
||||||
ShapelessRecipes recipe = (ShapelessRecipes)obj;
|
ShapelessRecipes recipe = (ShapelessRecipes)obj;
|
||||||
ItemStack output = recipe.getRecipeOutput();
|
ItemStack output = recipe.getRecipeOutput();
|
||||||
if (!output.func_190926_b() && containsMatch(false, exclusions, output))
|
if (!output.isEmpty() && containsMatch(false, exclusions, output))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -408,7 +408,7 @@ public class OreDictionary
|
||||||
idToName.add(name);
|
idToName.add(name);
|
||||||
val = idToName.size() - 1; //0 indexed
|
val = idToName.size() - 1; //0 indexed
|
||||||
nameToId.put(name, val);
|
nameToId.put(name, val);
|
||||||
NonNullList<ItemStack> back = NonNullList.func_191196_a();
|
NonNullList<ItemStack> back = NonNullList.create();
|
||||||
idToStack.add(back);
|
idToStack.add(back);
|
||||||
idToStackUn.add(back);
|
idToStackUn.add(back);
|
||||||
}
|
}
|
||||||
|
@ -435,7 +435,7 @@ public class OreDictionary
|
||||||
*/
|
*/
|
||||||
public static int[] getOreIDs(@Nonnull ItemStack stack)
|
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>();
|
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)
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -594,7 +594,7 @@ public class OreDictionary
|
||||||
private static void registerOreImpl(String name, @Nonnull ItemStack ore)
|
private static void registerOreImpl(String name, @Nonnull ItemStack ore)
|
||||||
{
|
{
|
||||||
if ("Unknown".equals(name)) return; //prevent bad IDs.
|
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);
|
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.
|
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_WIDTH = 3;
|
||||||
public static final int MAX_CRAFT_GRID_HEIGHT = 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 Object[] input = null;
|
||||||
protected int width = 0;
|
protected int width = 0;
|
||||||
protected int height = 0;
|
protected int height = 0;
|
||||||
|
@ -159,7 +159,7 @@ public class ShapedOreRecipe implements IRecipe
|
||||||
{
|
{
|
||||||
ItemStack ingredient = recipe.recipeItems[i];
|
ItemStack ingredient = recipe.recipeItems[i];
|
||||||
|
|
||||||
if(ingredient.func_190926_b()) continue;
|
if(ingredient.isEmpty()) continue;
|
||||||
|
|
||||||
input[i] = recipe.recipeItems[i];
|
input[i] = recipe.recipeItems[i];
|
||||||
|
|
||||||
|
@ -252,7 +252,7 @@ public class ShapedOreRecipe implements IRecipe
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (target == null && !slot.func_190926_b())
|
else if (target == null && !slot.isEmpty())
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,6 @@
|
||||||
|
|
||||||
package net.minecraftforge.oredict;
|
package net.minecraftforge.oredict;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
@ -38,8 +37,8 @@ import javax.annotation.Nonnull;
|
||||||
|
|
||||||
public class ShapelessOreRecipe implements IRecipe
|
public class ShapelessOreRecipe implements IRecipe
|
||||||
{
|
{
|
||||||
protected ItemStack output = ItemStack.field_190927_a;
|
protected ItemStack output = ItemStack.EMPTY;
|
||||||
protected NonNullList<Object> input = NonNullList.func_191196_a();
|
protected NonNullList<Object> input = NonNullList.create();
|
||||||
|
|
||||||
public ShapelessOreRecipe(Block result, Object... recipe){ this(new ItemStack(result), recipe); }
|
public ShapelessOreRecipe(Block result, Object... recipe){ this(new ItemStack(result), recipe); }
|
||||||
public ShapelessOreRecipe(Item 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
|
@Override
|
||||||
public boolean matches(InventoryCrafting var1, World world)
|
public boolean matches(InventoryCrafting var1, World world)
|
||||||
{
|
{
|
||||||
NonNullList<Object> required = NonNullList.func_191196_a();
|
NonNullList<Object> required = NonNullList.create();
|
||||||
required.addAll(input);
|
required.addAll(input);
|
||||||
|
|
||||||
for (int x = 0; x < var1.getSizeInventory(); x++)
|
for (int x = 0; x < var1.getSizeInventory(); x++)
|
||||||
{
|
{
|
||||||
ItemStack slot = var1.getStackInSlot(x);
|
ItemStack slot = var1.getStackInSlot(x);
|
||||||
|
|
||||||
if (!slot.func_190926_b())
|
if (!slot.isEmpty())
|
||||||
{
|
{
|
||||||
boolean inRecipe = false;
|
boolean inRecipe = false;
|
||||||
Iterator<Object> req = required.iterator();
|
Iterator<Object> req = required.iterator();
|
||||||
|
|
|
@ -48,7 +48,7 @@ public abstract class CommandTreeBase extends CommandBase
|
||||||
|
|
||||||
public void addSubcommand(ICommand c)
|
public void addSubcommand(ICommand c)
|
||||||
{
|
{
|
||||||
commandMap.put(c.getCommandName(), c);
|
commandMap.put(c.getName(), c);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Collection<ICommand> getSubCommands()
|
public Collection<ICommand> getSubCommands()
|
||||||
|
@ -82,7 +82,7 @@ public abstract class CommandTreeBase extends CommandBase
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Nonnull
|
@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)
|
if(args.length == 1)
|
||||||
{
|
{
|
||||||
|
@ -92,7 +92,7 @@ public abstract class CommandTreeBase extends CommandBase
|
||||||
{
|
{
|
||||||
if(c.checkPermission(server, sender))
|
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)
|
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
|
@Override
|
||||||
|
@ -130,7 +130,7 @@ public abstract class CommandTreeBase extends CommandBase
|
||||||
{
|
{
|
||||||
if(args.length < 1)
|
if(args.length < 1)
|
||||||
{
|
{
|
||||||
sender.addChatMessage(new TextComponentString(CommandBase.joinNiceStringFromCollection(commandMap.keySet())));
|
sender.sendMessage(new TextComponentString(CommandBase.joinNiceStringFromCollection(commandMap.keySet())));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -20,16 +20,12 @@
|
||||||
package net.minecraftforge.server.command;
|
package net.minecraftforge.server.command;
|
||||||
|
|
||||||
import java.text.DecimalFormat;
|
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.CommandBase;
|
||||||
import net.minecraft.command.CommandException;
|
import net.minecraft.command.CommandException;
|
||||||
import net.minecraft.command.ICommandSender;
|
import net.minecraft.command.ICommandSender;
|
||||||
import net.minecraft.command.WrongUsageException;
|
import net.minecraft.command.WrongUsageException;
|
||||||
import net.minecraft.server.MinecraftServer;
|
import net.minecraft.server.MinecraftServer;
|
||||||
import net.minecraft.util.math.BlockPos;
|
|
||||||
import net.minecraft.util.text.TextComponentTranslation;
|
import net.minecraft.util.text.TextComponentTranslation;
|
||||||
import net.minecraftforge.common.DimensionManager;
|
import net.minecraftforge.common.DimensionManager;
|
||||||
import net.minecraftforge.server.ForgeTimeTracker;
|
import net.minecraftforge.server.ForgeTimeTracker;
|
||||||
|
@ -39,13 +35,13 @@ public class ForgeCommand extends CommandBase {
|
||||||
private static final DecimalFormat timeFormatter = new DecimalFormat("########0.000");
|
private static final DecimalFormat timeFormatter = new DecimalFormat("########0.000");
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getCommandName()
|
public String getName()
|
||||||
{
|
{
|
||||||
return "forge";
|
return "forge";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getCommandUsage(ICommandSender icommandsender)
|
public String getUsage(ICommandSender icommandsender)
|
||||||
{
|
{
|
||||||
return "commands.forge.usage";
|
return "commands.forge.usage";
|
||||||
}
|
}
|
||||||
|
@ -107,7 +103,7 @@ public class ForgeCommand extends CommandBase {
|
||||||
{
|
{
|
||||||
ForgeTimeTracker.tileEntityTrackingDuration = duration;
|
ForgeTimeTracker.tileEntityTrackingDuration = duration;
|
||||||
ForgeTimeTracker.tileEntityTracking = true;
|
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)
|
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 worldTickTime = ForgeCommand.mean(server.worldTickTimes.get(dimId)) * 1.0E-6D;
|
||||||
double worldTPS = Math.min(1000.0/worldTickTime, 20);
|
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 meanTickTime = ForgeCommand.mean(server.tickTimeArray) * 1.0E-6D;
|
||||||
double meanTPS = Math.min(1000.0/meanTickTime, 20);
|
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
|
else
|
||||||
{
|
{
|
||||||
double worldTickTime = ForgeCommand.mean(server.worldTickTimes.get(dim)) * 1.0E-6D;
|
double worldTickTime = ForgeCommand.mean(server.worldTickTimes.get(dim)) * 1.0E-6D;
|
||||||
double worldTPS = Math.min(1000.0/worldTickTime, 20);
|
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)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,6 @@ public class BreedingTest
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void onBabyBorn(BabyEntitySpawnEvent event) {
|
public void onBabyBorn(BabyEntitySpawnEvent event) {
|
||||||
event.setChild(new EntityCow(event.getParentA().worldObj));
|
event.setChild(new EntityCow(event.getParentA().world));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -268,7 +268,7 @@ public class DynBucketTest
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (heldItem.func_190926_b())
|
if (heldItem.isEmpty())
|
||||||
{
|
{
|
||||||
sendText(playerIn, tank);
|
sendText(playerIn, tank);
|
||||||
return false;
|
return false;
|
||||||
|
@ -290,7 +290,7 @@ public class DynBucketTest
|
||||||
|
|
||||||
private void sendText(EntityPlayer player, IFluidHandler tank)
|
private void sendText(EntityPlayer player, IFluidHandler tank)
|
||||||
{
|
{
|
||||||
if (player.worldObj.isRemote)
|
if (player.world.isRemote)
|
||||||
{
|
{
|
||||||
String text;
|
String text;
|
||||||
IFluidTankProperties[] tankProperties = tank.getTankProperties();
|
IFluidTankProperties[] tankProperties = tank.getTankProperties();
|
||||||
|
@ -301,7 +301,7 @@ public class DynBucketTest
|
||||||
{
|
{
|
||||||
text = "empty";
|
text = "empty";
|
||||||
}
|
}
|
||||||
player.addChatMessage(new TextComponentString(text));
|
player.sendMessage(new TextComponentString(text));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -167,7 +167,7 @@ public class FluidPlacementTest
|
||||||
@Override
|
@Override
|
||||||
public int fill(FluidStack resource, boolean doFill)
|
public int fill(FluidStack resource, boolean doFill)
|
||||||
{
|
{
|
||||||
if (container.func_190916_E() != 1 || resource == null || resource.amount > Fluid.BUCKET_VOLUME || container
|
if (container.getCount() != 1 || resource == null || resource.amount > Fluid.BUCKET_VOLUME || container
|
||||||
.getItem() instanceof ItemBucketMilk || getFluid() != null || !canFillFluidType(resource))
|
.getItem() instanceof ItemBucketMilk || getFluid() != null || !canFillFluidType(resource))
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -96,7 +96,7 @@ public class ItemLayerModelDebug
|
||||||
@Override
|
@Override
|
||||||
public int getHarvestLevel(ItemStack stack, String toolClass, @Nullable EntityPlayer player, @Nullable IBlockState blockState) {
|
public int getHarvestLevel(ItemStack stack, String toolClass, @Nullable EntityPlayer player, @Nullable IBlockState blockState) {
|
||||||
// This tool is a super pickaxe if the player is wearing a helment
|
// This tool is a super pickaxe if the player is wearing a helment
|
||||||
if("pickaxe".equals(toolClass) && player != null && !player.getItemStackFromSlot(EntityEquipmentSlot.HEAD).func_190926_b()) {
|
if("pickaxe".equals(toolClass) && player != null && !player.getItemStackFromSlot(EntityEquipmentSlot.HEAD).isEmpty()) {
|
||||||
return 5;
|
return 5;
|
||||||
}
|
}
|
||||||
return super.getHarvestLevel(stack, toolClass, player, blockState);
|
return super.getHarvestLevel(stack, toolClass, player, blockState);
|
||||||
|
|
|
@ -136,7 +136,7 @@ public class ItemTileDebug
|
||||||
public boolean isFullCube(IBlockState state) { return false; }
|
public boolean isFullCube(IBlockState state) { return false; }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isVisuallyOpaque(IBlockState state) { return false; }
|
public boolean causesSuffocation(IBlockState state) { return false; }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileEntity createNewTileEntity(World world, int meta)
|
public TileEntity createNewTileEntity(World world, int meta)
|
||||||
|
|
|
@ -101,9 +101,9 @@ public class ModelAnimationDebug
|
||||||
public boolean isFullCube(IBlockState state) { return false; }
|
public boolean isFullCube(IBlockState state) { return false; }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockState onBlockPlaced(World world, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer)
|
public IBlockState getStateForPlacement(World world, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer)
|
||||||
{
|
{
|
||||||
return this.getDefaultState().withProperty(FACING, EnumFacing.func_190914_a(pos, placer));
|
return this.getDefaultState().withProperty(FACING, EnumFacing.getDirectionFromEntityLiving(pos, placer));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -383,7 +383,7 @@ public class ModelAnimationDebug
|
||||||
public void onEntityUpdate()
|
public void onEntityUpdate()
|
||||||
{
|
{
|
||||||
super.onEntityUpdate();
|
super.onEntityUpdate();
|
||||||
if(worldObj.isRemote && cycleLength != null)
|
if (world.isRemote && cycleLength != null)
|
||||||
{
|
{
|
||||||
cycleLength.setValue(getHealth() / 5);
|
cycleLength.setValue(getHealth() / 5);
|
||||||
}
|
}
|
||||||
|
|
|
@ -149,7 +149,7 @@ public class ModelBakeEventDebug
|
||||||
public boolean isFullCube(IBlockState state) { return false; }
|
public boolean isFullCube(IBlockState state) { return false; }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isVisuallyOpaque(IBlockState state) { return false; }
|
public boolean causesSuffocation(IBlockState state) { return false; }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileEntity createNewTileEntity(World world, int meta)
|
public TileEntity createNewTileEntity(World world, int meta)
|
||||||
|
|
|
@ -139,10 +139,10 @@ public class ModelLoaderRegistryDebug
|
||||||
public boolean isFullCube(IBlockState state) { return false; }
|
public boolean isFullCube(IBlockState state) { return false; }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isVisuallyOpaque(IBlockState state) { return false; }
|
public boolean causesSuffocation(IBlockState state) { return false; }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockState onBlockPlaced(World world, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer)
|
public IBlockState getStateForPlacement(World world, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer)
|
||||||
{
|
{
|
||||||
return this.getDefaultState().withProperty(FACING, getFacingFromEntity(world, pos, placer));
|
return this.getDefaultState().withProperty(FACING, getFacingFromEntity(world, pos, placer));
|
||||||
}
|
}
|
||||||
|
@ -244,7 +244,7 @@ public class ModelLoaderRegistryDebug
|
||||||
public boolean isFullCube(IBlockState state) { return false; }
|
public boolean isFullCube(IBlockState state) { return false; }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isVisuallyOpaque(IBlockState state) { return false; }
|
public boolean causesSuffocation(IBlockState state) { return false; }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ)
|
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||||
|
@ -329,7 +329,7 @@ public class ModelLoaderRegistryDebug
|
||||||
this.counter++;
|
this.counter++;
|
||||||
this.hidden.add(Integer.toString(this.counter));
|
this.hidden.add(Integer.toString(this.counter));
|
||||||
TextComponentString text = new TextComponentString("" + this.counter);
|
TextComponentString text = new TextComponentString("" + this.counter);
|
||||||
if (this.worldObj.isRemote) Minecraft.getMinecraft().ingameGUI.getChatGUI().printChatMessage(text);
|
if (this.world.isRemote) Minecraft.getMinecraft().ingameGUI.getChatGUI().printChatMessage(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void decrement()
|
public void decrement()
|
||||||
|
@ -342,7 +342,7 @@ public class ModelLoaderRegistryDebug
|
||||||
this.hidden.remove(Integer.toString(this.counter));
|
this.hidden.remove(Integer.toString(this.counter));
|
||||||
this.counter--;
|
this.counter--;
|
||||||
TextComponentString text = new TextComponentString("" + this.counter);
|
TextComponentString text = new TextComponentString("" + this.counter);
|
||||||
if (this.worldObj.isRemote) Minecraft.getMinecraft().ingameGUI.getChatGUI().printChatMessage(text);
|
if (this.world.isRemote) Minecraft.getMinecraft().ingameGUI.getChatGUI().printChatMessage(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMax(int max)
|
public void setMax(int max)
|
||||||
|
@ -381,7 +381,7 @@ public class ModelLoaderRegistryDebug
|
||||||
public boolean isFullCube(IBlockState state) { return false; }
|
public boolean isFullCube(IBlockState state) { return false; }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isVisuallyOpaque(IBlockState state) { return false; }
|
public boolean causesSuffocation(IBlockState state) { return false; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -408,7 +408,7 @@ public class ModelLoaderRegistryDebug
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockState onBlockPlaced(World world, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer)
|
public IBlockState getStateForPlacement(World world, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer)
|
||||||
{
|
{
|
||||||
return this.getDefaultState().withProperty(FACING, getFacingFromEntity(world, pos, placer));
|
return this.getDefaultState().withProperty(FACING, getFacingFromEntity(world, pos, placer));
|
||||||
}
|
}
|
||||||
|
@ -438,7 +438,7 @@ public class ModelLoaderRegistryDebug
|
||||||
public boolean isFullCube(IBlockState state) { return false; }
|
public boolean isFullCube(IBlockState state) { return false; }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isVisuallyOpaque(IBlockState state) { return false; }
|
public boolean causesSuffocation(IBlockState state) { return false; }
|
||||||
|
|
||||||
public static EnumFacing getFacingFromEntity(World worldIn, BlockPos clickedBlock, EntityLivingBase entityIn)
|
public static EnumFacing getFacingFromEntity(World worldIn, BlockPos clickedBlock, EntityLivingBase entityIn)
|
||||||
{
|
{
|
||||||
|
@ -511,11 +511,11 @@ public class ModelLoaderRegistryDebug
|
||||||
|
|
||||||
public void cycleColors()
|
public void cycleColors()
|
||||||
{
|
{
|
||||||
if (this.worldObj.isRemote)
|
if (this.world.isRemote)
|
||||||
{
|
{
|
||||||
FMLLog.info("%b", shouldIncrement);
|
FMLLog.info("%b", shouldIncrement);
|
||||||
/*
|
/*
|
||||||
IBakedModel bakedModel = Minecraft.getMinecraft().getBlockRendererDispatcher().getModelFromBlockState(this.worldObj.getBlockState(this.pos), this.worldObj, this.pos);
|
IBakedModel bakedModel = Minecraft.getMinecraft().getBlockRendererDispatcher().getModelFromBlockState(this.world.getBlockState(this.pos), this.world, this.pos);
|
||||||
if (bakedModel != null && bakedModel instanceof OBJBakedModel)
|
if (bakedModel != null && bakedModel instanceof OBJBakedModel)
|
||||||
{
|
{
|
||||||
OBJBakedModel objBaked = (OBJBakedModel) bakedModel;
|
OBJBakedModel objBaked = (OBJBakedModel) bakedModel;
|
||||||
|
@ -558,7 +558,7 @@ public class ModelLoaderRegistryDebug
|
||||||
objBaked.scheduleRebake();
|
objBaked.scheduleRebake();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.worldObj.markBlockRangeForRenderUpdate(this.pos, this.pos);
|
this.world.markBlockRangeForRenderUpdate(this.pos, this.pos);
|
||||||
}*/
|
}*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -591,10 +591,10 @@ public class ModelLoaderRegistryDebug
|
||||||
public boolean isFullCube(IBlockState state) { return false; }
|
public boolean isFullCube(IBlockState state) { return false; }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isVisuallyOpaque(IBlockState state) { return false; }
|
public boolean causesSuffocation(IBlockState state) { return false; }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockState onBlockPlaced(World world, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer)
|
public IBlockState getStateForPlacement(World world, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer)
|
||||||
{
|
{
|
||||||
return this.getDefaultState().withProperty(FACING, getFacingFromEntity(world, pos, placer));
|
return this.getDefaultState().withProperty(FACING, getFacingFromEntity(world, pos, placer));
|
||||||
}
|
}
|
||||||
|
@ -769,10 +769,10 @@ public class ModelLoaderRegistryDebug
|
||||||
@Override
|
@Override
|
||||||
public void update()
|
public void update()
|
||||||
{
|
{
|
||||||
if (this.worldObj.isRemote)
|
if (this.world.isRemote)
|
||||||
{
|
{
|
||||||
Vector3d teLoc = new Vector3d(this.getPos().getX(), this.getPos().getY(), this.getPos().getZ());
|
Vector3d teLoc = new Vector3d(this.getPos().getX(), this.getPos().getY(), this.getPos().getZ());
|
||||||
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
|
EntityPlayer player = Minecraft.getMinecraft().player;
|
||||||
Vector3d playerLoc = new Vector3d();
|
Vector3d playerLoc = new Vector3d();
|
||||||
playerLoc.setX(player.posX);
|
playerLoc.setX(player.posX);
|
||||||
playerLoc.setY(player.posY + player.getEyeHeight());
|
playerLoc.setY(player.posY + player.getEyeHeight());
|
||||||
|
@ -793,7 +793,7 @@ public class ModelLoaderRegistryDebug
|
||||||
matrix.setIdentity();
|
matrix.setIdentity();
|
||||||
matrix.setRotation(rot);
|
matrix.setRotation(rot);
|
||||||
transform = TRSRTransformation.blockCenterToCorner(new TRSRTransformation(matrix));
|
transform = TRSRTransformation.blockCenterToCorner(new TRSRTransformation(matrix));
|
||||||
this.worldObj.markBlockRangeForRenderUpdate(this.pos, this.pos);
|
this.world.markBlockRangeForRenderUpdate(this.pos, this.pos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,13 +28,13 @@ public class ClientCommandTest {
|
||||||
|
|
||||||
private class TestCommand extends CommandBase {
|
private class TestCommand extends CommandBase {
|
||||||
@Override
|
@Override
|
||||||
public String getCommandName()
|
public String getName()
|
||||||
{
|
{
|
||||||
return "clientCommandTest";
|
return "clientCommandTest";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getCommandUsage(ICommandSender sender)
|
public String getUsage(ICommandSender sender)
|
||||||
{
|
{
|
||||||
return "clientCommandTest <block>";
|
return "clientCommandTest <block>";
|
||||||
}
|
}
|
||||||
|
@ -46,7 +46,7 @@ public class ClientCommandTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> getTabCompletionOptions(MinecraftServer server, ICommandSender sender, String[] args, @Nullable BlockPos pos)
|
public List<String> getTabCompletions(MinecraftServer server, ICommandSender sender, String[] args, @Nullable BlockPos pos)
|
||||||
{
|
{
|
||||||
if (args.length > 0)
|
if (args.length > 0)
|
||||||
{
|
{
|
||||||
|
@ -61,11 +61,11 @@ public class ClientCommandTest {
|
||||||
{
|
{
|
||||||
if (args.length > 0)
|
if (args.length > 0)
|
||||||
{
|
{
|
||||||
sender.addChatMessage(new TextComponentString("Input: " + Arrays.toString(args)));
|
sender.sendMessage(new TextComponentString("Input: " + Arrays.toString(args)));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sender.addChatMessage(new TextComponentString("No arguments."));
|
sender.sendMessage(new TextComponentString("No arguments."));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,13 +32,13 @@ public class CommandTreeBaseTest
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getCommandName()
|
public String getName()
|
||||||
{
|
{
|
||||||
return "treecommand_test";
|
return "treecommand_test";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getCommandUsage(ICommandSender sender)
|
public String getUsage(ICommandSender sender)
|
||||||
{
|
{
|
||||||
return "commands.treecommand_test.usage";
|
return "commands.treecommand_test.usage";
|
||||||
}
|
}
|
||||||
|
@ -46,13 +46,13 @@ public class CommandTreeBaseTest
|
||||||
public static class CommandPing extends CommandBase
|
public static class CommandPing extends CommandBase
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public String getCommandName()
|
public String getName()
|
||||||
{
|
{
|
||||||
return "ping";
|
return "ping";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getCommandUsage(ICommandSender sender)
|
public String getUsage(ICommandSender sender)
|
||||||
{
|
{
|
||||||
return "commands.treecommand_test.ping.usage";
|
return "commands.treecommand_test.ping.usage";
|
||||||
}
|
}
|
||||||
|
@ -60,7 +60,7 @@ public class CommandTreeBaseTest
|
||||||
@Override
|
@Override
|
||||||
public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException
|
public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException
|
||||||
{
|
{
|
||||||
sender.addChatMessage(new TextComponentString("Pong!"));
|
sender.sendMessage(new TextComponentString("Pong!"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,13 +75,13 @@ public class CommandTreeBaseTest
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getCommandName()
|
public String getName()
|
||||||
{
|
{
|
||||||
return "value";
|
return "value";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getCommandUsage(ICommandSender sender)
|
public String getUsage(ICommandSender sender)
|
||||||
{
|
{
|
||||||
return "commands.treecommand_test.value.usage";
|
return "commands.treecommand_test.value.usage";
|
||||||
}
|
}
|
||||||
|
@ -89,13 +89,13 @@ public class CommandTreeBaseTest
|
||||||
public static class CommandSet extends CommandBase
|
public static class CommandSet extends CommandBase
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public String getCommandName()
|
public String getName()
|
||||||
{
|
{
|
||||||
return "set";
|
return "set";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getCommandUsage(ICommandSender sender)
|
public String getUsage(ICommandSender sender)
|
||||||
{
|
{
|
||||||
return "commands.treecommand_test.value.set.usage";
|
return "commands.treecommand_test.value.set.usage";
|
||||||
}
|
}
|
||||||
|
@ -104,20 +104,20 @@ public class CommandTreeBaseTest
|
||||||
public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException
|
public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException
|
||||||
{
|
{
|
||||||
value = CommandTreeTest.parseInt(args[0]);
|
value = CommandTreeTest.parseInt(args[0]);
|
||||||
sender.addChatMessage(new TextComponentString("Test value set to: " + value));
|
sender.sendMessage(new TextComponentString("Test value set to: " + value));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class CommandGet extends CommandBase
|
public static class CommandGet extends CommandBase
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public String getCommandName()
|
public String getName()
|
||||||
{
|
{
|
||||||
return "get";
|
return "get";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getCommandUsage(ICommandSender sender)
|
public String getUsage(ICommandSender sender)
|
||||||
{
|
{
|
||||||
return "commands.treecommand_test.value.get.usage";
|
return "commands.treecommand_test.value.get.usage";
|
||||||
}
|
}
|
||||||
|
@ -125,7 +125,7 @@ public class CommandTreeBaseTest
|
||||||
@Override
|
@Override
|
||||||
public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException
|
public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException
|
||||||
{
|
{
|
||||||
sender.addChatMessage(new TextComponentString("Test value: " + value));
|
sender.sendMessage(new TextComponentString("Test value: " + value));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -98,7 +98,7 @@ public class FluidHandlerTest
|
||||||
|
|
||||||
private static String stackString(@Nonnull ItemStack stack)
|
private static String stackString(@Nonnull ItemStack stack)
|
||||||
{
|
{
|
||||||
if (stack.func_190926_b())
|
if (stack.isEmpty())
|
||||||
{
|
{
|
||||||
return "no item";
|
return "no item";
|
||||||
}
|
}
|
||||||
|
@ -113,13 +113,13 @@ public class FluidHandlerTest
|
||||||
{
|
{
|
||||||
resourceDomain = stack.getItem().getRegistryName().getResourceDomain();
|
resourceDomain = stack.getItem().getRegistryName().getResourceDomain();
|
||||||
}
|
}
|
||||||
return stack.func_190916_E() + " " + stack.getDisplayName() + " (" + resourceDomain + ")";
|
return stack.getCount() + " " + stack.getDisplayName() + " (" + resourceDomain + ")";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static List<ItemStack> getAllItems()
|
private static List<ItemStack> getAllItems()
|
||||||
{
|
{
|
||||||
NonNullList<ItemStack> list = NonNullList.func_191196_a();
|
NonNullList<ItemStack> list = NonNullList.create();
|
||||||
for (Item item : ForgeRegistries.ITEMS.getValues())
|
for (Item item : ForgeRegistries.ITEMS.getValues())
|
||||||
{
|
{
|
||||||
for (CreativeTabs tab : item.getCreativeTabs())
|
for (CreativeTabs tab : item.getCreativeTabs())
|
||||||
|
|
|
@ -65,13 +65,13 @@ public class PermissionTest
|
||||||
public static class CommandPermissionTest extends CommandBase
|
public static class CommandPermissionTest extends CommandBase
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public String getCommandName()
|
public String getName()
|
||||||
{
|
{
|
||||||
return "permission_test";
|
return "permission_test";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getCommandUsage(ICommandSender sender)
|
public String getUsage(ICommandSender sender)
|
||||||
{
|
{
|
||||||
return "commands.permission_test.usage";
|
return "commands.permission_test.usage";
|
||||||
}
|
}
|
||||||
|
@ -89,7 +89,7 @@ public class PermissionTest
|
||||||
|
|
||||||
if(args.length < 1)
|
if(args.length < 1)
|
||||||
{
|
{
|
||||||
sender.addChatMessage(new TextComponentString("claim, unclaim, setblock, read_tile"));
|
sender.sendMessage(new TextComponentString("claim, unclaim, setblock, read_tile"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -104,12 +104,12 @@ public class PermissionTest
|
||||||
if(b)
|
if(b)
|
||||||
{
|
{
|
||||||
//claim chunk
|
//claim chunk
|
||||||
sender.addChatMessage(new TextComponentString("Chunk claimed!"));
|
sender.sendMessage(new TextComponentString("Chunk claimed!"));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//unclaim chunk
|
//unclaim chunk
|
||||||
sender.addChatMessage(new TextComponentString("Chunk unclaimed!"));
|
sender.sendMessage(new TextComponentString("Chunk unclaimed!"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -134,7 +134,7 @@ public class PermissionTest
|
||||||
i = parseInt(args[5], 0, 15);
|
i = parseInt(args[5], 0, 15);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!player.worldObj.isBlockLoaded(blockpos))
|
if(!player.world.isBlockLoaded(blockpos))
|
||||||
{
|
{
|
||||||
throw new CommandException("commands.setblock.outOfWorld");
|
throw new CommandException("commands.setblock.outOfWorld");
|
||||||
}
|
}
|
||||||
|
@ -146,7 +146,7 @@ public class PermissionTest
|
||||||
{
|
{
|
||||||
throw new CommandException("commands.generic.permission");
|
throw new CommandException("commands.generic.permission");
|
||||||
}
|
}
|
||||||
else if(!player.worldObj.setBlockState(blockpos, state, 2))
|
else if(!player.world.setBlockState(blockpos, state, 2))
|
||||||
{
|
{
|
||||||
throw new CommandException("commands.setblock.noChange");
|
throw new CommandException("commands.setblock.noChange");
|
||||||
}
|
}
|
||||||
|
@ -156,12 +156,12 @@ public class PermissionTest
|
||||||
else if(args[0].equals("read_tile"))
|
else if(args[0].equals("read_tile"))
|
||||||
{
|
{
|
||||||
BlockPos blockpos = parseBlockPos(sender, args, 1, false);
|
BlockPos blockpos = parseBlockPos(sender, args, 1, false);
|
||||||
TileEntity tileEntity = player.worldObj.getTileEntity(blockpos);
|
TileEntity tileEntity = player.world.getTileEntity(blockpos);
|
||||||
|
|
||||||
if(PermissionAPI.hasPermission(player.getGameProfile(), Permissions.READ_TILE, new BlockPosContext(player, blockpos, null, null).set(ContextKeys.TILE_ENTITY, tileEntity)))
|
if(PermissionAPI.hasPermission(player.getGameProfile(), Permissions.READ_TILE, new BlockPosContext(player, blockpos, null, null).set(ContextKeys.TILE_ENTITY, tileEntity)))
|
||||||
{
|
{
|
||||||
NBTTagCompound tag = tileEntity == null ? null : tileEntity.serializeNBT();
|
NBTTagCompound tag = tileEntity == null ? null : tileEntity.serializeNBT();
|
||||||
sender.addChatMessage(new TextComponentString(String.valueOf(tag)));
|
sender.sendMessage(new TextComponentString(String.valueOf(tag)));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -61,7 +61,7 @@ public class TestCapabilityMod
|
||||||
if (event.getWorld().getBlockState(event.getPos()).getBlock() == Blocks.DIRT && event.getItemStack().hasCapability(TEST_CAP, null))
|
if (event.getWorld().getBlockState(event.getPos()).getBlock() == Blocks.DIRT && event.getItemStack().hasCapability(TEST_CAP, null))
|
||||||
{
|
{
|
||||||
IExampleCapability cap = event.getItemStack().getCapability(TEST_CAP, null);
|
IExampleCapability cap = event.getItemStack().getCapability(TEST_CAP, null);
|
||||||
event.getEntityPlayer().addChatMessage(new TextComponentString((cap.getVal() ? TextFormatting.GREEN : TextFormatting.RED) + "" + TextFormatting.ITALIC + "TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST"));
|
event.getEntityPlayer().sendMessage(new TextComponentString((cap.getVal() ? TextFormatting.GREEN : TextFormatting.RED) + "" + TextFormatting.ITALIC + "TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST"));
|
||||||
event.setCanceled(true);
|
event.setCanceled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,7 +40,7 @@ public class WorldCapabilityRainTimerTest {
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void attatchTimer(AttachCapabilitiesEvent.World event)
|
public void attatchTimer(AttachCapabilitiesEvent.World event)
|
||||||
{
|
{
|
||||||
if (!event.getWorld().isRemote && !event.getWorld().provider.getHasNoSky())
|
if (!event.getWorld().isRemote && !event.getWorld().provider.hasNoSky())
|
||||||
event.addCapability(new ResourceLocation(MODID, "rainTimer"), new RainTimerProvider());
|
event.addCapability(new ResourceLocation(MODID, "rainTimer"), new RainTimerProvider());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue