Initial patch update to 1.12.

Some things to note:
Netty is screwy so currently can't join single player. @cpw
Crafting has been MAJORY reworked. The current GameRegistry functions are nooped, this is IN THE WORKS.
  Just need to move the recipe list to a full class registry, and then re implement the in-code recipe registration.
  Also, it IS advised that modders move to JSON, because ideally we'll see a S->C recipe syncing system in 1.13
  which would allow servers to have custom recipes.
  OreDictionary currently 1/2 works, need to write a better algorithm for replacing ingredients.
  Please be patient
Rendering:
  A lot of functions got a new float parameter, this is similar to partial ticks, needs more research
This commit is contained in:
LexManos authored and cpw committed 2017-06-10 22:22:02 -04:00
1 parent 286777b824
commit f1cca475ea
342 files changed
+3878 -2936

No files matched your search

@@ -43,16 +43,17 @@ import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.client.audio.ISound;
import net.minecraft.client.audio.SoundManager;
import net.minecraft.client.gui.BossInfoClient;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.GuiMainMenu;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.model.ModelBiped;
import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.client.renderer.EntityRenderer;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.RenderGlobal;
import net.minecraft.client.renderer.VertexBuffer;
import net.minecraft.client.renderer.block.model.BakedQuad;
import net.minecraft.client.renderer.block.model.BlockFaceUV;
import net.minecraft.client.renderer.block.model.IBakedModel;
@@ -87,7 +88,6 @@ import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.registry.IRegistry;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.world.BossInfoLerping;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraft.world.biome.Biome;
@@ -566,7 +566,7 @@ public class ForgeHooksClient
return ret;
}
public static void putQuadColor(VertexBuffer renderer, BakedQuad quad, int color)
public static void putQuadColor(BufferBuilder renderer, BakedQuad quad, int color)
{
float cb = color & 0xFF;
float cg = (color >>> 8) & 0xFF;
@@ -600,7 +600,7 @@ public class ForgeHooksClient
TileEntitySpecialRenderer<?> r = TileEntityRendererDispatcher.instance.getSpecialRendererByClass(tileClass);
if (r != null)
{
r.renderTileEntityAt(null, 0, 0, 0, 0, -1);
r.func_192841_a(null, 0, 0, 0, 0, -1, 0.0F);
}
}
}
@@ -730,7 +730,7 @@ public class ForgeHooksClient
return new BlockFaceUV(new float[]{ uMin, vMin, uMax, vMax }, angle);
}
public static RenderGameOverlayEvent.BossInfo bossBarRenderPre(ScaledResolution res, BossInfoLerping bossInfo, int x, int y, int increment)
public static RenderGameOverlayEvent.BossInfo bossBarRenderPre(ScaledResolution res, BossInfoClient bossInfo, int x, int y, int increment)
{
RenderGameOverlayEvent.BossInfo evt = new RenderGameOverlayEvent.BossInfo(new RenderGameOverlayEvent(Animation.getPartialTickTime(), res),
BOSSINFO, bossInfo, x, y, increment);
@@ -122,7 +122,7 @@ public class GuiIngameForge extends GuiIngame
if (Minecraft.isFancyGraphicsEnabled())
{
renderVignette(mc.player.getBrightness(partialTicks), res);
renderVignette(mc.player.getBrightness(), res);
}
else
{
@@ -19,6 +19,7 @@
package net.minecraftforge.client.event;
import net.minecraft.util.text.ChatType;
import net.minecraft.util.text.ITextComponent;
import net.minecraftforge.fml.common.eventhandler.Cancelable;
import net.minecraftforge.fml.common.eventhandler.Event;
@@ -27,8 +28,8 @@ import net.minecraftforge.fml.common.eventhandler.Event;
public class ClientChatReceivedEvent extends Event
{
private ITextComponent message;
private final byte type;
public ClientChatReceivedEvent(byte type, ITextComponent message)
private final ChatType type;
public ClientChatReceivedEvent(ChatType type, ITextComponent message)
{
this.type = type;
this.setMessage(message);
@@ -44,13 +45,7 @@ public class ClientChatReceivedEvent extends Event
this.message = message;
}
/**
* Introduced in 1.8:
* 0 : Standard Text Message
* 1 : 'System' message, displayed as standard text.
* 2 : 'Status' message, displayed above action bar, where song notifications are.
*/
public byte getType()
public ChatType getType()
{
return type;
}
@@ -21,10 +21,9 @@ package net.minecraftforge.client.event;
import java.util.ArrayList;
import net.minecraft.world.BossInfoLerping;
import net.minecraftforge.fml.common.eventhandler.Cancelable;
import net.minecraftforge.fml.common.eventhandler.Event;
import net.minecraft.client.gui.BossInfoClient;
import net.minecraft.client.gui.ScaledResolution;
@Cancelable
@@ -107,11 +106,11 @@ public class RenderGameOverlayEvent extends Event
public static class BossInfo extends Pre
{
private final BossInfoLerping bossInfo;
private final BossInfoClient bossInfo;
private final int x;
private final int y;
private int increment;
public BossInfo(RenderGameOverlayEvent parent, ElementType type, BossInfoLerping bossInfo, int x, int y, int increment)
public BossInfo(RenderGameOverlayEvent parent, ElementType type, BossInfoClient bossInfo, int x, int y, int increment)
{
super(parent, type);
this.bossInfo = bossInfo;
@@ -121,9 +120,9 @@ public class RenderGameOverlayEvent extends Event
}
/**
* @return The {@link BossInfoLerping} currently being rendered
* @return The {@link BossInfoClient} currently being rendered
*/
public BossInfoLerping getBossInfo()
public BossInfoClient getBossInfo()
{
return bossInfo;
}
@@ -19,7 +19,7 @@
package net.minecraftforge.client.event;
import net.minecraft.client.renderer.tileentity.RenderItemFrame;
import net.minecraft.client.renderer.entity.RenderItemFrame;
import net.minecraft.entity.item.EntityItemFrame;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.common.eventhandler.Cancelable;
@@ -29,7 +29,7 @@ import javax.annotation.Nonnull;
/**
* This event is called when an item is rendered in an item frame.
*
*
* You can set canceled to do no further vanilla processing.
*/
@Cancelable
@@ -38,7 +38,7 @@ public class RenderItemInFrameEvent extends Event
private final ItemStack item;
private final EntityItemFrame entityItemFrame;
private final RenderItemFrame renderer;
public RenderItemInFrameEvent(EntityItemFrame itemFrame, RenderItemFrame renderItemFrame)
{
item = itemFrame.getDisplayedItem();
@@ -22,10 +22,10 @@ package net.minecraftforge.client.model.animation;
import java.util.List;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.VertexBuffer;
import net.minecraft.client.renderer.block.model.BakedQuad;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.client.renderer.block.model.IBakedModel;
@@ -84,11 +84,11 @@ public class AnimationModelBase<T extends Entity> extends ModelBase implements I
GlStateManager.pushMatrix();
GlStateManager.rotate(180, 0, 0, 1);
Tessellator tessellator = Tessellator.getInstance();
VertexBuffer VertexBuffer = tessellator.getBuffer();
VertexBuffer.begin(GL11.GL_QUADS, DefaultVertexFormats.BLOCK);
VertexBuffer.setTranslation(-0.5, -1.5, -0.5);
BufferBuilder builder = tessellator.getBuffer();
builder.begin(GL11.GL_QUADS, DefaultVertexFormats.BLOCK);
builder.setTranslation(-0.5, -1.5, -0.5);
lighter.setParent(new VertexBufferConsumer(VertexBuffer));
lighter.setParent(new VertexBufferConsumer(builder));
lighter.setWorld(entity.world);
lighter.setState(Blocks.AIR.getDefaultState());
lighter.setBlockPos(pos);
@@ -123,7 +123,7 @@ public class AnimationModelBase<T extends Entity> extends ModelBase implements I
VertexBuffer.pos(1, 1, 1).color(0xFF, 0xFF, 0xFF, 0xFF).tex(1, 1).lightmap(240, 0).endVertex();
VertexBuffer.pos(1, 1, 0).color(0xFF, 0xFF, 0xFF, 0xFF).tex(1, 0).lightmap(240, 0).endVertex();*/
VertexBuffer.setTranslation(0, 0, 0);
builder.setTranslation(0, 0, 0);
tessellator.draw();
GlStateManager.popMatrix();
@@ -22,7 +22,7 @@ package net.minecraftforge.client.model.animation;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.BlockRendererDispatcher;
import net.minecraft.client.renderer.VertexBuffer;
import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.client.renderer.block.model.IBakedModel;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos;
@@ -47,7 +47,7 @@ public class AnimationTESR<T extends TileEntity> extends FastTESR<T> implements
{
protected static BlockRendererDispatcher blockRenderer;
public void renderTileEntityFast(@Nonnull T te, double x, double y, double z, float partialTick, int breakStage, @Nonnull VertexBuffer renderer)
public void renderTileEntityFast(@Nonnull T te, double x, double y, double z, float partialTick, int breakStage, float partial, @Nonnull BufferBuilder renderer)
{
if(!te.hasCapability(CapabilityAnimation.ANIMATION_CAPABILITY, null))
{
@@ -86,4 +86,4 @@ public class AnimationTESR<T extends TileEntity> extends FastTESR<T> implements
}
public void handleEvents(T te, float time, Iterable<Event> pastEvents) {}
}
}
@@ -25,7 +25,7 @@ import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.VertexBuffer;
import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
@@ -36,10 +36,10 @@ import javax.annotation.Nonnull;
public abstract class FastTESR<T extends TileEntity> extends TileEntitySpecialRenderer<T>
{
@Override
public final void renderTileEntityAt(@Nonnull T te, double x, double y, double z, float partialTicks, int destroyStage)
public final void func_192841_a(@Nonnull T te, double x, double y, double z, float partialTicks, int destroyStage, float partial)
{
Tessellator tessellator = Tessellator.getInstance();
VertexBuffer VertexBuffer = tessellator.getBuffer();
BufferBuilder buffer = tessellator.getBuffer();
this.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
RenderHelper.disableStandardItemLighting();
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
@@ -55,10 +55,10 @@ public abstract class FastTESR<T extends TileEntity> extends TileEntitySpecialRe
GlStateManager.shadeModel(GL11.GL_FLAT);
}
VertexBuffer.begin(GL11.GL_QUADS, DefaultVertexFormats.BLOCK);
buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.BLOCK);
renderTileEntityFast(te, x, y, z, partialTicks, destroyStage, VertexBuffer);
VertexBuffer.setTranslation(0, 0, 0);
renderTileEntityFast(te, x, y, z, partialTicks, destroyStage, partial, buffer);
buffer.setTranslation(0, 0, 0);
tessellator.draw();
@@ -66,5 +66,5 @@ public abstract class FastTESR<T extends TileEntity> extends TileEntitySpecialRe
}
@Override
public abstract void renderTileEntityFast(@Nonnull T te, double x, double y, double z, float partialTicks, int destroyStage, @Nonnull VertexBuffer VertexBuffer);
public abstract void renderTileEntityFast(@Nonnull T te, double x, double y, double z, float partialTicks, int destroyStage, float partial, @Nonnull BufferBuilder buffer);
}
@@ -64,12 +64,12 @@ import net.minecraftforge.common.property.Properties;
import net.minecraftforge.fml.common.FMLLog;
import org.apache.commons.lang3.tuple.Pair;
import org.apache.logging.log4j.core.helpers.Strings;
import com.google.common.base.Charsets;
import com.google.common.base.Function;
import com.google.common.base.Objects;
import com.google.common.base.Optional;
import com.google.common.base.Strings;
import com.google.common.cache.CacheBuilder;
import com.google.common.cache.CacheLoader;
import com.google.common.cache.LoadingCache;
@@ -294,8 +294,8 @@ public class OBJModel implements IRetexturableModel, IModelCustomData
String[] pts = splitData[i].split("/");
int vert = Integer.parseInt(pts[0]);
Integer texture = pts.length < 2 || Strings.isEmpty(pts[1]) ? null : Integer.parseInt(pts[1]);
Integer normal = pts.length < 3 || Strings.isEmpty(pts[2]) ? null : Integer.parseInt(pts[2]);
Integer texture = pts.length < 2 || Strings.isNullOrEmpty(pts[1]) ? null : Integer.parseInt(pts[1]);
Integer normal = pts.length < 3 || Strings.isNullOrEmpty(pts[2]) ? null : Integer.parseInt(pts[2]);
vert = vert < 0 ? this.vertices.size() - 1 : vert - 1;
Vertex newV = new Vertex(new Vector4f(this.vertices.get(vert).getPos()), this.vertices.get(vert).getMaterial());
@@ -23,7 +23,7 @@ import java.util.List;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.BlockModelRenderer;
import net.minecraft.client.renderer.VertexBuffer;
import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.client.renderer.block.model.BakedQuad;
import net.minecraft.client.renderer.block.model.IBakedModel;
import net.minecraft.client.renderer.color.BlockColors;
@@ -54,8 +54,8 @@ public class ForgeBlockModelRenderer extends BlockModelRenderer
private final ThreadLocal<VertexBufferConsumer> wrFlat = new ThreadLocal<VertexBufferConsumer>();
private final ThreadLocal<VertexBufferConsumer> wrSmooth = new ThreadLocal<VertexBufferConsumer>();
private final ThreadLocal<VertexBuffer> lastRendererFlat = new ThreadLocal<VertexBuffer>();
private final ThreadLocal<VertexBuffer> lastRendererSmooth = new ThreadLocal<VertexBuffer>();
private final ThreadLocal<BufferBuilder> lastRendererFlat = new ThreadLocal<BufferBuilder>();
private final ThreadLocal<BufferBuilder> lastRendererSmooth = new ThreadLocal<BufferBuilder>();
private final BlockColors colors;
@@ -67,7 +67,7 @@ public class ForgeBlockModelRenderer extends BlockModelRenderer
}
@Override
public boolean renderModelFlat(IBlockAccess world, IBakedModel model, IBlockState state, BlockPos pos, VertexBuffer buffer, boolean checkSides, long rand)
public boolean renderModelFlat(IBlockAccess world, IBakedModel model, IBlockState state, BlockPos pos, BufferBuilder buffer, boolean checkSides, long rand)
{
if(ForgeModContainer.forgeLightPipelineEnabled)
{
@@ -88,7 +88,7 @@ public class ForgeBlockModelRenderer extends BlockModelRenderer
}
@Override
public boolean renderModelSmooth(IBlockAccess world, IBakedModel model, IBlockState state, BlockPos pos, VertexBuffer buffer, boolean checkSides, long rand)
public boolean renderModelSmooth(IBlockAccess world, IBakedModel model, IBlockState state, BlockPos pos, BufferBuilder buffer, boolean checkSides, long rand)
{
if(ForgeModContainer.forgeLightPipelineEnabled)
{
@@ -108,7 +108,7 @@ public class ForgeBlockModelRenderer extends BlockModelRenderer
}
}
public static boolean render(VertexLighterFlat lighter, IBlockAccess world, IBakedModel model, IBlockState state, BlockPos pos, VertexBuffer wr, boolean checkSides, long rand)
public static boolean render(VertexLighterFlat lighter, IBlockAccess world, IBakedModel model, IBlockState state, BlockPos pos, BufferBuilder wr, boolean checkSides, long rand)
{
lighter.setWorld(world);
lighter.setState(state);
@@ -20,7 +20,7 @@
package net.minecraftforge.client.model.pipeline;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.VertexBuffer;
import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.client.renderer.block.model.BakedQuad;
import net.minecraft.client.renderer.vertex.VertexFormat;
import net.minecraft.client.renderer.vertex.VertexFormatElement;
@@ -257,7 +257,7 @@ public class LightUtil
if(tessellator == null)
{
Tessellator tes = Tessellator.getInstance();
VertexBuffer wr = tes.getBuffer();
BufferBuilder wr = tes.getBuffer();
tessellator = new VertexBufferConsumer(wr);
}
return tessellator;
@@ -274,7 +274,7 @@ public class LightUtil
}
// renders quad in any Vertex Format, but is slower
public static void renderQuadColorSlow(VertexBuffer wr, BakedQuad quad, int auxColor)
public static void renderQuadColorSlow(BufferBuilder wr, BakedQuad quad, int auxColor)
{
ItemConsumer cons;
if(wr == Tessellator.getInstance().getBuffer())
@@ -294,7 +294,7 @@ public class LightUtil
quad.pipe(cons);
}
public static void renderQuadColor(VertexBuffer wr, BakedQuad quad, int auxColor)
public static void renderQuadColor(BufferBuilder wr, BakedQuad quad, int auxColor)
{
wr.addVertexData(quad.getVertexData());
ForgeHooksClient.putQuadColor(wr, quad, auxColor);
@@ -19,7 +19,7 @@
package net.minecraftforge.client.model.pipeline;
import net.minecraft.client.renderer.VertexBuffer;
import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.renderer.vertex.VertexFormat;
import net.minecraft.client.renderer.vertex.VertexFormatElement.EnumUsage;
@@ -27,17 +27,17 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.util.EnumFacing;
/**
* Assumes VertexFormatElement is present in the VertexBuffer's vertex format.
* Assumes VertexFormatElement is present in the BufferBuilder's vertex format.
*/
public class VertexBufferConsumer implements IVertexConsumer
{
private static final float[] dummyColor = new float[]{ 1, 1, 1, 1 };
private final VertexBuffer renderer;
private final BufferBuilder renderer;
private final int[] quadData;
private int v = 0;
private BlockPos offset = BlockPos.ORIGIN;
public VertexBufferConsumer(VertexBuffer renderer)
public VertexBufferConsumer(BufferBuilder renderer)
{
super();
this.renderer = renderer;
@@ -1,130 +0,0 @@
/*
* Minecraft Forge
* Copyright (c) 2016.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation version 2.1
* of the License.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
/**
* This software is provided under the terms of the Minecraft Forge Public
* License v1.0.
*/
package net.minecraftforge.common;
import java.util.Arrays;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;
import net.minecraft.stats.Achievement;
import javax.annotation.Nullable;
public class AchievementPage
{
private String name;
private LinkedList<Achievement> achievements;
public AchievementPage(String name, Achievement... achievements)
{
this.name = name;
this.achievements = new LinkedList<Achievement>(Arrays.asList(achievements));
}
public String getName()
{
return name;
}
public List<Achievement> getAchievements()
{
return achievements;
}
private static LinkedList<AchievementPage> achievementPages = new LinkedList<AchievementPage>();
/**
* Registers an achievement page.
* @param page The page.
*/
public static void registerAchievementPage(AchievementPage page)
{
if (getAchievementPage(page.getName()) != null)
{
throw new RuntimeException("Duplicate achievement page name \"" + page.getName() + "\"!");
}
achievementPages.add(page);
}
/**
* Will return an achievement page by its index on the list.
* @param index The page's index.
* @return the achievement page corresponding to the index or null if invalid index
*/
public static AchievementPage getAchievementPage(int index)
{
return achievementPages.get(index);
}
/**
* Will return an achievement page by its name.
* @param name The page's name.
* @return the achievement page with the given name or null if no such page
*/
@Nullable
public static AchievementPage getAchievementPage(String name)
{
for (AchievementPage page : achievementPages)
{
if (page.getName().equals(name))
{
return page;
}
}
return null;
}
/**
* Will return the list of achievement pages.
* @return the list's size
*/
public static Set<AchievementPage> getAchievementPages()
{
return new HashSet<AchievementPage>(achievementPages);
}
/**
* Will return whether an achievement is in any page or not.
* @param achievement The achievement.
*/
public static boolean isAchievementInPages(Achievement achievement)
{
for (AchievementPage page : achievementPages)
{
if (page.getAchievements().contains(achievement))
{
return true;
}
}
return false;
}
public static String getTitle(int index)
{
return index == -1 ? "Minecraft" : getAchievementPage(index).getName();
}
}
@@ -44,6 +44,7 @@ import java.util.Map;
import org.apache.logging.log4j.Level;
import net.minecraft.crash.ICrashReportDetail;
import net.minecraft.item.crafting.Ingredient;
import net.minecraft.nbt.NBTBase;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.stats.StatList;
@@ -523,6 +524,7 @@ public class ForgeModContainer extends DummyModContainer implements WorldAccessC
{
OreDictionary.rebakeMap();
StatList.reinit();
Ingredient.invalidateAll();
}
@@ -54,17 +54,17 @@ public class ForgeVersion
// This is Forge's Mod Id, used for the ForgeModContainer and resource locations
public static final String MOD_ID = "forge";
//This number is incremented every time we remove deprecated code/major API changes, never reset
public static final int majorVersion = 13;
public static final int majorVersion = 14;
//This number is incremented every minecraft release, never reset
public static final int minorVersion = 20;
public static final int minorVersion = 21;
//This number is incremented every time a interface changes or new major feature is added, and reset every Minecraft version
public static final int revisionVersion = 0;
//This number is incremented every time Jenkins builds Forge, and never reset. Should always be 0 in the repo code.
public static final int buildVersion = 0;
// This is the minecraft version we're building for - used in various places in Forge/FML code
public static final String mcVersion = "1.11.2";
public static final String mcVersion = "1.12";
// This is the MCP data version we're using
public static final String mcpVersion = "9.38";
public static final String mcpVersion = "9.40";
@SuppressWarnings("unused")
private static Status status = PENDING;
@SuppressWarnings("unused")
@@ -19,7 +19,7 @@
package net.minecraftforge.common.animation;
import com.google.common.base.Objects;
import com.google.common.base.MoreObjects;
/**
@@ -60,6 +60,6 @@ public final class Event implements Comparable<Event>
@Override
public String toString()
{
return Objects.toStringHelper(getClass()).add("event", event).add("offset", offset).toString();
return MoreObjects.toStringHelper(getClass()).add("event", event).add("offset", offset).toString();
}
}
@@ -20,6 +20,7 @@
package net.minecraftforge.common.model;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Iterators;
import com.google.common.collect.UnmodifiableIterator;
@@ -38,6 +39,7 @@ public enum Models
{
return ((HiddenModelPart) part).getPath().iterator();
}
return Iterators.emptyIterator();
ImmutableSet<String> ret = ImmutableSet.of();
return ret.iterator();
}
}
@@ -41,7 +41,7 @@ import net.minecraftforge.fml.relauncher.SideOnly;
import org.apache.commons.lang3.tuple.Pair;
import org.apache.commons.lang3.tuple.Triple;
import com.google.common.base.Objects;
import com.google.common.base.MoreObjects;
import com.google.common.base.Optional;
import com.google.common.collect.Maps;
@@ -508,7 +508,7 @@ public final class TRSRTransformation implements IModelState, ITransformation
}
/*
* Divides m by m33, sets last row to (0, 0, 0, 1), extracts linear and translation parts
* Divides m by m33, sets last row to (0, 0, 0, 1), extracts linear and translation parts
*/
public static Pair<Matrix3f, Vector3f> toAffine(Matrix4f m)
{
@@ -607,7 +607,7 @@ public final class TRSRTransformation implements IModelState, ITransformation
public String toString()
{
genCheck();
return Objects.toStringHelper(this.getClass())
return MoreObjects.toStringHelper(this.getClass())
.add("matrix", matrix)
.add("translation", translation)
.add("leftRot", leftRot)
@@ -2,7 +2,7 @@ package net.minecraftforge.common.util;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.WorldProvider;
import net.minecraft.world.WorldSavedData;
import net.minecraft.world.storage.WorldSavedData;
public class WorldCapabilityData extends WorldSavedData
{
@@ -56,4 +56,4 @@ public class WorldCapabilityData extends WorldSavedData
this.capNBT = null;
}
}
}
}
@@ -43,12 +43,6 @@ public class AttachCapabilitiesEvent<T> extends GenericEvent<T>
final Map<ResourceLocation, ICapabilityProvider> caps;// package-private for ForgeEventFactory
private final Map<ResourceLocation, ICapabilityProvider> view;
@SuppressWarnings("unchecked")
@Deprecated
public AttachCapabilitiesEvent(T obj)
{
this((Class<T>)Object.class, obj);
}
public AttachCapabilitiesEvent(Class<T> type, T obj)
{
this(type, obj, Maps.<ResourceLocation, ICapabilityProvider>newLinkedHashMap());
@@ -93,83 +87,21 @@ public class AttachCapabilitiesEvent<T> extends GenericEvent<T>
return view;
}
/**
* A version of the parent event which is only fired for Tile Entities.
*/
@Deprecated
public static class TileEntity extends AttachCapabilitiesEvent<net.minecraft.tileentity.TileEntity>
{
private final net.minecraft.tileentity.TileEntity te;
public TileEntity(net.minecraft.tileentity.TileEntity te)
{
super(net.minecraft.tileentity.TileEntity.class, te);
this.te = te;
}
public net.minecraft.tileentity.TileEntity getTileEntity()
{
return this.te;
}
}
/**
* A version of the parent event which is only fired for Entities.
*/
@Deprecated
public static class Entity extends AttachCapabilitiesEvent<net.minecraft.entity.Entity>
{
private final net.minecraft.entity.Entity entity;
public Entity(net.minecraft.entity.Entity entity)
{
super(net.minecraft.entity.Entity.class, entity);
this.entity = entity;
}
public net.minecraft.entity.Entity getEntity()
{
return this.entity;
}
}
/**
* A version of the parent event which is only fired for ItemStacks.
*/
@Deprecated
public static class Item extends AttachCapabilitiesEvent<net.minecraft.item.Item>
{
private final net.minecraft.item.ItemStack stack;
private final net.minecraft.item.Item item;
public Item(net.minecraft.item.Item item, @Nonnull net.minecraft.item.ItemStack stack)
{
super(net.minecraft.item.Item.class, item);
this.item = item;
this.stack = stack;
}
public net.minecraft.item.Item getItem()
{
return this.item;
}
@Nonnull
public net.minecraft.item.ItemStack getItemStack()
{
return this.stack;
}
}
/**
* A version of the parent event which is only fired for Worlds.
*/
@Deprecated
public static class World extends AttachCapabilitiesEvent<net.minecraft.world.World>
{
private final net.minecraft.world.World world;
public World(net.minecraft.world.World world)
{
super(net.minecraft.world.World.class, world);
this.world = world;
}
public net.minecraft.world.World getWorld()
{
return this.world;
}
}
}
@@ -1,117 +0,0 @@
/*
* Minecraft Forge
* Copyright (c) 2016.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation version 2.1
* of the License.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
package net.minecraftforge.event;
import com.google.common.base.Predicate;
import com.google.common.collect.Lists;
import net.minecraft.command.EntitySelector;
import net.minecraft.command.ICommandSender;
import net.minecraft.entity.Entity;
import net.minecraft.util.math.Vec3d;
import net.minecraftforge.fml.common.IEntitySelectorFactory;
import net.minecraftforge.fml.common.eventhandler.Event;
import java.util.List;
import java.util.Map;
/**
* Is not fired anymore.
* Replaced by a factory, which has to be registered with {@link net.minecraftforge.fml.common.registry.GameRegistry#registerEntitySelector(IEntitySelectorFactory, String...)}
* TODO remove in 1.12
*/
@Deprecated
public class EntitySelectorEvent extends Event
{
private final Map<String, String> map;
private final String mainSelector;
private final ICommandSender sender;
private final Vec3d position;
private final List<Predicate<Entity>> selectors;
public EntitySelectorEvent(Map<String, String> map, String mainSelector, ICommandSender sender, Vec3d position)
{
this.map = map;
this.mainSelector = mainSelector;
this.sender = sender;
this.position = position;
selectors = Lists.newArrayList();
}
/**
* Add your custom selector.
* It is recommend to use "modid:name", if checking for own arguments, to avoid inter-mod interference (e.g. "@a[Forge:timeplayed=100]").
*
* @param selector Your custom predicate
*/
public void addPredicate(Predicate<Entity> selector)
{
if (selector == null)
{
throw new NullPointerException("Attempted to add null predicate as entity selector");
}
selectors.add(selector);
}
/**
* @return The main selector used (e.g. 'a' for all players or 'e' for all entities)
*/
public String getMainSelector()
{
return mainSelector;
}
/**
* Example: "@a[test=true]" would result in a map with "test"=>"true"
*
* @return The argument map. Maps all given argument names with its value.
*/
public Map<String, String> getArgumentMap()
{
return map;
}
/**
* See {@link EntitySelector#getPosFromArguments(Map, Vec3d)}
*
* @return A position either specified in the selector arguments or by the players position.
*/
public Vec3d getPosition()
{
return position;
}
/**
* @return The sender of the command.
*/
public ICommandSender getSender()
{
return sender;
}
/**
* @return The list of added custom selectors
*/
List<Predicate<Entity>> getSelectors()
{
return selectors;
}
}
@@ -27,6 +27,7 @@ import java.util.Random;
import com.google.common.base.Predicate;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.command.ICommandSender;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
@@ -54,6 +55,7 @@ import net.minecraft.util.SoundEvent;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.math.Vec3d;
import net.minecraft.util.text.ChatType;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.village.Village;
import net.minecraft.world.Explosion;
@@ -62,7 +64,7 @@ import net.minecraft.world.WorldServer;
import net.minecraft.world.WorldSettings;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.chunk.ChunkPrimer;
import net.minecraft.world.chunk.IChunkGenerator;
import net.minecraft.world.gen.IChunkGenerator;
import net.minecraft.world.storage.IPlayerFileData;
import net.minecraft.world.storage.SaveHandler;
import net.minecraft.world.storage.loot.LootTable;
@@ -125,15 +127,6 @@ import javax.annotation.Nullable;
public class ForgeEventFactory
{
/**
* @deprecated Use {@link #onPlayerMultiBlockPlace(EntityPlayer, List, EnumFacing, EnumHand)} instead.
*/
@Deprecated
public static MultiPlaceEvent onPlayerMultiBlockPlace(EntityPlayer player, List<BlockSnapshot> blockSnapshots, EnumFacing direction)
{
return onPlayerMultiBlockPlace(player, blockSnapshots, direction, null);
}
public static MultiPlaceEvent onPlayerMultiBlockPlace(EntityPlayer player, List<BlockSnapshot> blockSnapshots, EnumFacing direction, @Nullable EnumHand hand)
{
BlockSnapshot snap = blockSnapshots.get(0);
@@ -143,15 +136,6 @@ public class ForgeEventFactory
return event;
}
/**
* @deprecated Use {@link #onPlayerBlockPlace(EntityPlayer, BlockSnapshot, EnumFacing, EnumHand)} instead.
*/
@Deprecated
public static PlaceEvent onPlayerBlockPlace(EntityPlayer player, BlockSnapshot blockSnapshot, EnumFacing direction)
{
return onPlayerBlockPlace(player, blockSnapshot, direction, EnumHand.MAIN_HAND);
}
public static PlaceEvent onPlayerBlockPlace(@Nonnull EntityPlayer player, @Nonnull BlockSnapshot blockSnapshot, @Nonnull EnumFacing direction, @Nonnull EnumHand hand)
{
IBlockState placedAgainst = blockSnapshot.getWorld().getBlockState(blockSnapshot.getPos().offset(direction.getOpposite()));
@@ -254,17 +238,6 @@ public class ForgeEventFactory
return event.getDisplayname();
}
/**
* TODO remove in 1.12
*/
@Deprecated
public static List<Predicate<Entity>> gatherEntitySelectors(Map<String, String> map, String mainSelector, ICommandSender sender, Vec3d position)
{
EntitySelectorEvent event=new EntitySelectorEvent(map, mainSelector, sender, position);
MinecraftForge.EVENT_BUS.post(event);
return event.getSelectors();
}
public static float fireBlockHarvesting(List<ItemStack> drops, World world, BlockPos pos, IBlockState state, int fortune, float dropChance, boolean silkTouch, EntityPlayer player)
{
BlockEvent.HarvestDropsEvent event = new BlockEvent.HarvestDropsEvent(world, pos, state, fortune, dropChance, drops, player, silkTouch);
@@ -272,9 +245,9 @@ public class ForgeEventFactory
return event.getDropChance();
}
public static ItemTooltipEvent onItemTooltip(ItemStack itemStack, EntityPlayer entityPlayer, List<String> toolTip, boolean showAdvancedItemTooltips)
public static ItemTooltipEvent onItemTooltip(ItemStack itemStack, EntityPlayer entityPlayer, List<String> toolTip, ITooltipFlag flags)
{
ItemTooltipEvent event = new ItemTooltipEvent(itemStack, entityPlayer, toolTip, showAdvancedItemTooltips);
ItemTooltipEvent event = new ItemTooltipEvent(itemStack, entityPlayer, toolTip, flags);
MinecraftForge.EVENT_BUS.post(event);
return event;
}
@@ -343,7 +316,7 @@ public class ForgeEventFactory
}
@Nullable
public static ITextComponent onClientChat(byte type, ITextComponent message)
public static ITextComponent onClientChat(ChatType type, ITextComponent message)
{
ClientChatReceivedEvent event = new ClientChatReceivedEvent(type, message);
return MinecraftForge.EVENT_BUS.post(event) ? null : event.getMessage();
@@ -368,14 +341,6 @@ public class ForgeEventFactory
return 0;
}
/**
* @deprecated Use {@link #onApplyBonemeal(EntityPlayer, World, BlockPos, IBlockState, ItemStack, EnumHand)} instead.
*/
@Deprecated
public static int onApplyBonemeal(EntityPlayer player, World world, BlockPos pos, IBlockState state, ItemStack stack)
{
return onApplyBonemeal(player, world, pos, state, stack, null);
}
public static int onApplyBonemeal(@Nonnull EntityPlayer player, @Nonnull World world, @Nonnull BlockPos pos, @Nonnull IBlockState state, @Nonnull ItemStack stack, @Nullable EnumHand hand)
{
@@ -580,15 +545,15 @@ public class ForgeEventFactory
@Nullable
public static CapabilityDispatcher gatherCapabilities(TileEntity tileEntity)
{
return gatherCapabilities(new AttachCapabilitiesEvent.TileEntity(tileEntity), null);
return gatherCapabilities(new AttachCapabilitiesEvent<TileEntity>(TileEntity.class, tileEntity), null);
}
@Nullable
public static CapabilityDispatcher gatherCapabilities(Entity entity)
{
return gatherCapabilities(new AttachCapabilitiesEvent.Entity(entity), null);
return gatherCapabilities(new AttachCapabilitiesEvent<Entity>(Entity.class, entity), null);
}
@Nullable
public static CapabilityDispatcher gatherCapabilities(Village village)
{
@@ -610,7 +575,7 @@ public class ForgeEventFactory
@Nullable
public static CapabilityDispatcher gatherCapabilities(World world, ICapabilityProvider parent)
{
return gatherCapabilities(new AttachCapabilitiesEvent.World(world), parent);
return gatherCapabilities(new AttachCapabilitiesEvent<World>(World.class, world), parent);
}
@Nullable
@@ -658,30 +623,11 @@ public class ForgeEventFactory
return event.getResult() != net.minecraftforge.fml.common.eventhandler.Event.Result.DENY;
}
/**
* @deprecated Use {@link #onChunkPopulate(boolean, IChunkGenerator, World, Random, int, int, boolean)}<br>
* The Random param should not be world.rand, it should be the same chunk-position-seeded rand used by the Chunk Provider.
*/
@Deprecated
public static void onChunkPopulate(boolean pre, IChunkGenerator gen, World world, int x, int z, boolean hasVillageGenerated)
{
MinecraftForge.EVENT_BUS.post(pre ? new PopulateChunkEvent.Pre(gen, world, world.rand, x, z, hasVillageGenerated) : new PopulateChunkEvent.Post(gen, world, world.rand, x, z, hasVillageGenerated));
}
public static void onChunkPopulate(boolean pre, IChunkGenerator gen, World world, Random rand, int x, int z, boolean hasVillageGenerated)
{
MinecraftForge.EVENT_BUS.post(pre ? new PopulateChunkEvent.Pre(gen, world, rand, x, z, hasVillageGenerated) : new PopulateChunkEvent.Post(gen, world, rand, x, z, hasVillageGenerated));
}
/**
* @deprecated Use {@link #loadLootTable(ResourceLocation, LootTable, LootTableManager)}<br>
*/
@Deprecated
public static LootTable loadLootTable(ResourceLocation name, LootTable table)
{
return loadLootTable(name, table, null);
}
public static LootTable loadLootTable(ResourceLocation name, LootTable table, LootTableManager lootTableManager)
{
LootTableLoadEvent event = new LootTableLoadEvent(name, table, lootTableManager);
@@ -705,7 +651,7 @@ public class ForgeEventFactory
net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(e);
return e.getLevel();
}
public static boolean onEntityDestroyBlock(EntityLivingBase entity, BlockPos pos, IBlockState state)
{
return !MinecraftForge.EVENT_BUS.post(new LivingDestroyBlockEvent(entity, pos, state));
@@ -62,12 +62,12 @@ public class BabyEntitySpawnEvent extends Event
//causedByPlayer calculated here to simplify the patch.
EntityPlayer causedByPlayer = null;
if (parentA instanceof EntityAnimal) {
causedByPlayer = ((EntityAnimal)parentA).getPlayerInLove();
causedByPlayer = ((EntityAnimal)parentA).func_191993_do();
}
if (causedByPlayer == null && parentB instanceof EntityAnimal)
{
causedByPlayer = ((EntityAnimal)parentB).getPlayerInLove();
causedByPlayer = ((EntityAnimal)parentB).func_191993_do();
}
this.parentA = parentA;
@@ -102,4 +102,4 @@ public class BabyEntitySpawnEvent extends Event
{
child = proposedChild;
}
}
}
@@ -1,43 +0,0 @@
/*
* Minecraft Forge
* Copyright (c) 2016.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation version 2.1
* of the License.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
package net.minecraftforge.event.entity.player;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.stats.Achievement;
import net.minecraftforge.fml.common.eventhandler.Cancelable;
/**
* When the player receives an achievement. If canceled the player will not receive anything.
*/
@Cancelable
public class AchievementEvent extends PlayerEvent {
private final Achievement achievement;
public AchievementEvent(EntityPlayer player, Achievement achievement)
{
super(player);
this.achievement = achievement;
}
public Achievement getAchievement()
{
return achievement;
}
}
@@ -20,6 +20,8 @@
package net.minecraftforge.event.entity.player;
import java.util.List;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
@@ -27,7 +29,7 @@ import javax.annotation.Nonnull;
public class ItemTooltipEvent extends PlayerEvent
{
private final boolean showAdvancedItemTooltips;
private final ITooltipFlag flags;
@Nonnull
private final ItemStack itemStack;
private final List<String> toolTip;
@@ -35,20 +37,20 @@ public class ItemTooltipEvent extends PlayerEvent
/**
* This event is fired in {@link ItemStack#getTooltip(EntityPlayer, boolean)}, which in turn is called from it's respective GUIContainer.
*/
public ItemTooltipEvent(@Nonnull ItemStack itemStack, EntityPlayer entityPlayer, List<String> toolTip, boolean showAdvancedItemTooltips)
public ItemTooltipEvent(@Nonnull ItemStack itemStack, EntityPlayer entityPlayer, List<String> toolTip, ITooltipFlag flags)
{
super(entityPlayer);
this.itemStack = itemStack;
this.toolTip = toolTip;
this.showAdvancedItemTooltips = showAdvancedItemTooltips;
this.flags = flags;
}
/**
* Whether the advanced information on item tooltips is being shown, toggled by F3+H.
* Use to determine if the advanced information on item tooltips is being shown, toggled by F3+H.
*/
public boolean isShowAdvancedItemTooltips()
public ITooltipFlag getFlags()
{
return showAdvancedItemTooltips;
return flags;
}
/**
@@ -67,4 +69,4 @@ public class ItemTooltipEvent extends PlayerEvent
{
return toolTip;
}
}
}
@@ -22,7 +22,7 @@ package net.minecraftforge.event.terraingen;
import net.minecraftforge.fml.common.eventhandler.Event;
import net.minecraft.world.World;
import net.minecraft.world.chunk.ChunkPrimer;
import net.minecraft.world.chunk.IChunkGenerator;
import net.minecraft.world.gen.IChunkGenerator;
public class ChunkGeneratorEvent extends Event
{
@@ -22,10 +22,7 @@ package net.minecraftforge.event.terraingen;
import java.util.Random;
import net.minecraft.world.World;
import net.minecraft.world.chunk.IChunkGenerator;
import net.minecraft.world.gen.ChunkProviderEnd;
import net.minecraft.world.gen.ChunkProviderHell;
import net.minecraft.world.gen.ChunkProviderOverworld;
import net.minecraft.world.gen.IChunkGenerator;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.common.eventhandler.Cancelable;
import net.minecraftforge.fml.common.eventhandler.Event;
@@ -23,7 +23,7 @@ import java.util.Random;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraft.world.chunk.IChunkGenerator;
import net.minecraft.world.gen.IChunkGenerator;
import net.minecraft.world.gen.MapGenBase;
import net.minecraft.world.gen.feature.WorldGenerator;
import net.minecraftforge.common.MinecraftForge;
@@ -20,7 +20,6 @@
package net.minecraftforge.event.terraingen;
import net.minecraft.world.biome.BiomeProvider;
import net.minecraft.world.gen.ChunkProviderSettings;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.common.eventhandler.Cancelable;
import net.minecraftforge.fml.common.eventhandler.Event;
@@ -27,6 +27,7 @@ import net.minecraft.block.BlockLiquid;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.properties.PropertyInteger;
import net.minecraft.block.state.BlockFaceShape;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.Entity;
@@ -525,7 +526,7 @@ public abstract class BlockFluidBase extends Block implements IFluidBlock
corner[1][1] = 1;
}
}
state = state.withProperty(LEVEL_CORNERS[0], corner[0][0]);
state = state.withProperty(LEVEL_CORNERS[1], corner[0][1]);
state = state.withProperty(LEVEL_CORNERS[2], corner[1][1]);
@@ -728,6 +729,11 @@ public abstract class BlockFluidBase extends Block implements IFluidBlock
return vec;
}
private boolean isBlockSolid(IBlockAccess world, BlockPos pos, EnumFacing face)
{
return world.getBlockState(pos).func_193401_d(world, pos, face) == BlockFaceShape.SOLID;
}
/* IFluidBlock */
@Override
public Fluid getFluid()
@@ -104,8 +104,10 @@ public class UniversalBucket extends Item
@SideOnly(Side.CLIENT)
@Override
public void getSubItems(@Nonnull Item itemIn, @Nullable CreativeTabs tab, @Nonnull NonNullList<ItemStack> subItems)
public void getSubItems(@Nullable CreativeTabs tab, @Nonnull NonNullList<ItemStack> subItems)
{
if (!this.func_194125_a(tab))
return;
for (Fluid fluid : FluidRegistry.getRegisteredFluids().values())
{
if (fluid != FluidRegistry.WATER && fluid != FluidRegistry.LAVA && !fluid.getName().equals("milk"))
@@ -119,7 +119,7 @@ import org.lwjgl.input.Mouse;
import org.lwjgl.opengl.Display;
import com.google.common.base.CharMatcher;
import com.google.common.base.Objects;
import com.google.common.base.MoreObjects;
import com.google.common.base.Strings;
import com.google.common.base.Throwables;
import com.google.common.collect.BiMap;
@@ -332,7 +332,8 @@ public class FMLClientHandler implements IFMLSidedHandler
{
SplashProgress.finish();
client.displayCrashReport(new CrashReport(message, t));
throw Throwables.propagate(t);
Throwables.throwIfUnchecked(t);
throw new RuntimeException(t);
}
public boolean hasError()
@@ -990,7 +991,7 @@ public class FMLClientHandler implements IFMLSidedHandler
if (badType == null)
{
badType = Sets.newHashSet();
brokenTextures.put(resourceLocation.getResourceDomain(), Objects.firstNonNull(error, "Unknown error"), badType);
brokenTextures.put(resourceLocation.getResourceDomain(), MoreObjects.firstNonNull(error, "Unknown error"), badType);
}
badType.add(resourceLocation);
}
@@ -41,16 +41,16 @@ import net.minecraftforge.fml.client.config.DummyConfigElement.DummyCategoryElem
import net.minecraftforge.fml.client.config.DummyConfigElement.DummyListElement;
import net.minecraftforge.fml.client.config.GuiConfigEntries.NumberSliderEntry;
public class FMLConfigGuiFactory implements IModGuiFactory
public class FMLConfigGuiFactory implements IModGuiFactory
{
public static class FMLConfigGuiScreen extends GuiConfig
public static class FMLConfigGuiScreen extends GuiConfig
{
public FMLConfigGuiScreen(GuiScreen parent)
{
super(parent, getConfigElements(), "FML", false, false, I18n.format("fml.config.sample.title"));
}
private static List<IConfigElement> getConfigElements()
{
List<IConfigElement> list = new ArrayList<IConfigElement>();
@@ -58,13 +58,13 @@ public class FMLConfigGuiFactory implements IModGuiFactory
List<IConfigElement> stringsList = new ArrayList<IConfigElement>();
List<IConfigElement> numbersList = new ArrayList<IConfigElement>();
Pattern commaDelimitedPattern = Pattern.compile("([A-Za-z]+((,){1}( )*|$))+?");
// Top Level Settings
list.add(new DummyConfigElement("imABoolean", true, ConfigGuiType.BOOLEAN, "fml.config.sample.imABoolean").setRequiresMcRestart(true));
list.add(new DummyConfigElement("imAnInteger", 42, ConfigGuiType.INTEGER, "fml.config.sample.imAnInteger", -1, 256).setRequiresMcRestart(true));
list.add(new DummyConfigElement("imADouble", 42.4242D, ConfigGuiType.DOUBLE, "fml.config.sample.imADouble", -1.0D, 256.256D).setRequiresMcRestart(true));
list.add(new DummyConfigElement("imAString", "http://www.montypython.net/scripts/string.php", ConfigGuiType.STRING, "fml.config.sample.imAString").setRequiresMcRestart(true));
// Lists category
listsList.add(new DummyListElement("booleanList", new Boolean[] {true, false, true, false, true, false, true, false}, ConfigGuiType.BOOLEAN, "fml.config.sample.booleanList"));
listsList.add(new DummyListElement("booleanListFixed", new Boolean[] {true, false, true, false, true, false, true, false}, ConfigGuiType.BOOLEAN, "fml.config.sample.booleanListFixed", true));
@@ -84,16 +84,16 @@ public class FMLConfigGuiFactory implements IModGuiFactory
listsList.add(new DummyListElement("stringListCustom", new Object[0], ConfigGuiType.STRING, "fml.config.sample.stringListCustom").setArrayEntryClass(CustomArrayEntry.class));
list.add(new DummyCategoryElement("lists", "fml.config.sample.ctgy.lists", listsList));
// Strings category
stringsList.add(new DummyConfigElement("basicString", "Just a regular String value, anything goes.", ConfigGuiType.STRING, "fml.config.sample.basicString"));
stringsList.add(new DummyConfigElement("cycleString", "this", ConfigGuiType.STRING, "fml.config.sample.cycleString", new String[] {"this", "property", "cycles", "through", "a", "list", "of", "valid", "choices"}));
stringsList.add(new DummyConfigElement("patternString", "only, comma, separated, words, can, be, entered, in, this, box", ConfigGuiType.STRING, "fml.config.sample.patternString", commaDelimitedPattern));
stringsList.add(new DummyConfigElement("chatColorPicker", "c", ConfigGuiType.COLOR, "fml.config.sample.chatColorPicker", new String[] {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f"}));
stringsList.add(new DummyConfigElement("modIDSelector", "FML", ConfigGuiType.MOD_ID, "fml.config.sample.modIDSelector"));
list.add(new DummyCategoryElement("strings", "fml.config.sample.ctgy.strings", stringsList));
// Numbers category
numbersList.add((new DummyConfigElement("basicInteger", 42, ConfigGuiType.INTEGER, "fml.config.sample.basicInteger")));
numbersList.add((new DummyConfigElement("boundedInteger", 42, ConfigGuiType.INTEGER, "fml.config.sample.boundedInteger", -1, 256)));
@@ -103,11 +103,11 @@ public class FMLConfigGuiFactory implements IModGuiFactory
numbersList.add(new DummyConfigElement("sliderDouble", 42.4242D, ConfigGuiType.DOUBLE, "fml.config.sample.sliderDouble", -1.0D, 256.256D).setCustomListEntryClass(NumberSliderEntry.class));
list.add(new DummyCategoryElement("numbers", "fml.config.sample.ctgy.numbers", numbersList));
return list;
}
}
@Override
public boolean hasConfigGui()
@@ -123,10 +123,10 @@ public class FMLConfigGuiFactory implements IModGuiFactory
}
@Override
public void drawEntry(int slotIndex, int x, int y, int listWidth, int slotHeight, int mouseX, int mouseY, boolean isSelected)
public void func_192634_a(int slotIndex, int x, int y, int listWidth, int slotHeight, int mouseX, int mouseY, boolean isSelected, float partial)
{
textFieldValue.setTextColor((int) (Math.random() * 0xFFFFFF));
super.drawEntry(slotIndex, x, y, listWidth, slotHeight, mouseX, mouseY, isSelected);
super.func_192634_a(slotIndex, x, y, listWidth, slotHeight, mouseX, mouseY, isSelected, partial);
}
}
@@ -140,7 +140,7 @@ public class FMLConfigGuiFactory implements IModGuiFactory
{
return new FMLConfigGuiScreen(parentScreen);
}
@Override
public Class<? extends GuiScreen> mainConfigGuiClass()
{
@@ -86,7 +86,7 @@ public class GuiErrorBase extends GuiErrorScreen
{
for(GuiButton button : buttonList)
{
button.drawButton(this.mc, mouseX, mouseY);
button.func_191745_a(this.mc, mouseX, mouseY, partialTicks);
}
}
}
@@ -40,7 +40,7 @@ import net.minecraft.client.gui.GuiTextField;
import net.minecraft.client.gui.GuiUtilRenderComponents;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.VertexBuffer;
import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.client.renderer.texture.DynamicTexture;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
@@ -283,7 +283,7 @@ public class GuiModList extends GuiScreen
{
IModGuiFactory guiFactory = FMLClientHandler.instance().getGuiFactoryFor(selectedMod);
GuiScreen newScreen = null;
try
try
{
newScreen = guiFactory.createConfigGui(this);
}
@@ -564,7 +564,7 @@ public class GuiModList extends GuiScreen
{
GlStateManager.enableBlend();
GuiModList.this.mc.renderEngine.bindTexture(logoPath);
VertexBuffer wr = tess.getBuffer();
BufferBuilder wr = tess.getBuffer();
int offset = (this.left + this.listWidth/2) - (logoDims.width / 2);
wr.begin(7, DefaultVertexFormats.POSITION_TEX);
wr.pos(offset, top + logoDims.height, zLevel).tex(0, 1).endVertex();
@@ -61,7 +61,7 @@ public class GuiOldSaveLoadConfirm extends GuiYesNo implements GuiYesNoCallback
for (k = 0; k < this.buttonList.size(); ++k)
{
this.buttonList.get(k).drawButton(this.mc, mouseX, mouseY);
this.buttonList.get(k).func_191745_a(this.mc, mouseX, mouseY, partialTicks);
}
for (k = 0; k < this.labelList.size(); ++k)
@@ -23,9 +23,9 @@ import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.VertexBuffer;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import org.lwjgl.input.Mouse;
import org.lwjgl.opengl.GL11;
@@ -276,7 +276,7 @@ public abstract class GuiScrollingList
this.applyScrollLimits();
Tessellator tess = Tessellator.getInstance();
VertexBuffer worldr = tess.getBuffer();
BufferBuilder worldr = tess.getBuffer();
ScaledResolution res = new ScaledResolution(client);
double scaleW = client.displayWidth / res.getScaledWidth_double();
@@ -403,12 +403,12 @@ public abstract class GuiScrollingList
GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0);
GlStateManager.shadeModel(GL11.GL_SMOOTH);
Tessellator tessellator = Tessellator.getInstance();
VertexBuffer VertexBuffer = tessellator.getBuffer();
VertexBuffer.begin(7, DefaultVertexFormats.POSITION_COLOR);
VertexBuffer.pos(right, top, 0.0D).color(r1, g1, b1, a1).endVertex();
VertexBuffer.pos(left, top, 0.0D).color(r1, g1, b1, a1).endVertex();
VertexBuffer.pos(left, bottom, 0.0D).color(r2, g2, b2, a2).endVertex();
VertexBuffer.pos(right, bottom, 0.0D).color(r2, g2, b2, a2).endVertex();
BufferBuilder buffer = tessellator.getBuffer();
buffer.begin(7, DefaultVertexFormats.POSITION_COLOR);
buffer.pos(right, top, 0.0D).color(r1, g1, b1, a1).endVertex();
buffer.pos(left, top, 0.0D).color(r1, g1, b1, a1).endVertex();
buffer.pos(left, bottom, 0.0D).color(r2, g2, b2, a2).endVertex();
buffer.pos(right, bottom, 0.0D).color(r2, g2, b2, a2).endVertex();
tessellator.draw();
GlStateManager.shadeModel(GL11.GL_FLAT);
GlStateManager.disableBlend();
@@ -48,7 +48,7 @@ public class GuiButtonExt extends GuiButton
* Draws this button to the screen.
*/
@Override
public void drawButton(Minecraft mc, int mouseX, int mouseY)
public void func_191745_a(Minecraft mc, int mouseX, int mouseY, float partial)
{
if (this.visible)
{
@@ -42,7 +42,7 @@ public class GuiCheckBox extends GuiButton
}
@Override
public void drawButton(Minecraft mc, int mouseX, int mouseY)
public void func_191745_a(Minecraft mc, int mouseX, int mouseY, float partial)
{
if (this.visible)
{
@@ -84,7 +84,7 @@ public class GuiConfigEntries extends GuiListExtended
{
super(mc, parent.width, parent.height, parent.titleLine2 != null ? 33 : 23, parent.height - 32, 20);
this.owningScreen = parent;
this.setShowSelectionBox(false);
this.func_193651_b(false);
this.mc = mc;
this.listEntries = new ArrayList<IConfigEntry>();
@@ -562,10 +562,10 @@ public class GuiConfigEntries extends GuiListExtended
}
@Override
public void drawEntry(int slotIndex, int x, int y, int listWidth, int slotHeight, int mouseX, int mouseY, boolean isSelected)
public void func_192634_a(int slotIndex, int x, int y, int listWidth, int slotHeight, int mouseX, int mouseY, boolean isSelected, float partial)
{
this.btnValue.packedFGColour = GuiUtils.getColorCode(this.configElement.getValidValues()[currentIndex].charAt(0), true);
super.drawEntry(slotIndex, x, y, listWidth, slotHeight, mouseX, mouseY, isSelected);
super.func_192634_a(slotIndex, x, y, listWidth, slotHeight, mouseX, mouseY, isSelected, partial);
}
@Override
@@ -910,14 +910,14 @@ public class GuiConfigEntries extends GuiListExtended
public abstract void valueButtonPressed(int slotIndex);
@Override
public void drawEntry(int slotIndex, int x, int y, int listWidth, int slotHeight, int mouseX, int mouseY, boolean isSelected)
public void func_192634_a(int slotIndex, int x, int y, int listWidth, int slotHeight, int mouseX, int mouseY, boolean isSelected, float partial)
{
super.drawEntry(slotIndex, x, y, listWidth, slotHeight, mouseX, mouseY, isSelected);
super.func_192634_a(slotIndex, x, y, listWidth, slotHeight, mouseX, mouseY, isSelected, partial);
this.btnValue.width = this.owningEntryList.controlWidth;
this.btnValue.xPosition = this.owningScreen.entryList.controlX;
this.btnValue.yPosition = y;
this.btnValue.enabled = enabled();
this.btnValue.drawButton(this.mc, mouseX, mouseY);
this.btnValue.func_191745_a(this.mc, mouseX, mouseY, partial);
}
/**
@@ -1190,9 +1190,9 @@ public class GuiConfigEntries extends GuiListExtended
}
@Override
public void drawEntry(int slotIndex, int x, int y, int listWidth, int slotHeight, int mouseX, int mouseY, boolean isSelected)
public void func_192634_a(int slotIndex, int x, int y, int listWidth, int slotHeight, int mouseX, int mouseY, boolean isSelected, float partial)
{
super.drawEntry(slotIndex, x, y, listWidth, slotHeight, mouseX, mouseY, isSelected);
super.func_192634_a(slotIndex, x, y, listWidth, slotHeight, mouseX, mouseY, isSelected, partial);
this.textFieldValue.xPosition = this.owningEntryList.controlX + 2;
this.textFieldValue.yPosition = y + 1;
this.textFieldValue.width = this.owningEntryList.controlWidth - 4;
@@ -1326,14 +1326,14 @@ public class GuiConfigEntries extends GuiListExtended
}
@Override
public void drawEntry(int slotIndex, int x, int y, int listWidth, int slotHeight, int mouseX, int mouseY, boolean isSelected)
public void func_192634_a(int slotIndex, int x, int y, int listWidth, int slotHeight, int mouseX, int mouseY, boolean isSelected, float partial)
{
this.btnSelectCategory.xPosition = listWidth / 2 - 150;
this.btnSelectCategory.yPosition = y;
this.btnSelectCategory.enabled = enabled();
this.btnSelectCategory.drawButton(this.mc, mouseX, mouseY);
this.btnSelectCategory.func_191745_a(this.mc, mouseX, mouseY, partial);
super.drawEntry(slotIndex, x, y, listWidth, slotHeight, mouseX, mouseY, isSelected);
super.func_192634_a(slotIndex, x, y, listWidth, slotHeight, mouseX, mouseY, isSelected, partial);
}
@Override
@@ -1526,7 +1526,7 @@ public class GuiConfigEntries extends GuiListExtended
}
@Override
public void drawEntry(int slotIndex, int x, int y, int listWidth, int slotHeight, int mouseX, int mouseY, boolean isSelected)
public void func_192634_a(int slotIndex, int x, int y, int listWidth, int slotHeight, int mouseX, int mouseY, boolean isSelected, float partial)
{
boolean isChanged = isChanged();
@@ -1545,12 +1545,12 @@ public class GuiConfigEntries extends GuiListExtended
this.btnUndoChanges.xPosition = this.owningEntryList.scrollBarX - 44;
this.btnUndoChanges.yPosition = y;
this.btnUndoChanges.enabled = enabled() && isChanged;
this.btnUndoChanges.drawButton(this.mc, mouseX, mouseY);
this.btnUndoChanges.func_191745_a(this.mc, mouseX, mouseY, partial);
this.btnDefault.xPosition = this.owningEntryList.scrollBarX - 22;
this.btnDefault.yPosition = y;
this.btnDefault.enabled = enabled() && !isDefault();
this.btnDefault.drawButton(this.mc, mouseX, mouseY);
this.btnDefault.func_191745_a(this.mc, mouseX, mouseY, partial);
if (this.tooltipHoverChecker == null)
this.tooltipHoverChecker = new HoverChecker(y, y + slotHeight, x, this.owningScreen.entryList.controlX - 8, 800);
@@ -1624,7 +1624,7 @@ public class GuiConfigEntries extends GuiListExtended
public abstract boolean saveConfigElement();
@Override
public void setSelected(int p_178011_1_, int p_178011_2_, int p_178011_3_){}
public void func_192633_a(int p_178011_1_, int p_178011_2_, int p_178011_3_, float partial){}
@Override
public boolean enabled()
@@ -1674,7 +1674,7 @@ public class GuiConfigEntries extends GuiListExtended
int tagStartPosition = tagStartPosition = target.indexOf(tagStart);
int tagEndPosition = tagEndPosition = target.indexOf(tagEnd, tagStartPosition + tagStart.length());
if (-1 == tagStartPosition || -1 == tagEndPosition)
if (-1 == tagStartPosition || -1 == tagEndPosition)
return target;
String taglessResult = target.substring(0, tagStartPosition);
@@ -60,7 +60,7 @@ public class GuiEditArrayEntries extends GuiListExtended
this.configElement = configElement;
this.beforeValues = beforeValues;
this.currentValues = currentValues;
this.setShowSelectionBox(false);
this.func_193651_b(false);
this.isChanged = !Arrays.deepEquals(beforeValues, currentValues);
this.isDefault = Arrays.deepEquals(currentValues, configElement.getDefaults());
this.canAddMoreEntries = !configElement.isListLengthFixed() && (configElement.getMaxListLength() == -1 || currentValues.length < configElement.getMaxListLength());
@@ -450,9 +450,9 @@ public class GuiEditArrayEntries extends GuiListExtended
}
@Override
public void drawEntry(int slotIndex, int x, int y, int listWidth, int slotHeight, int mouseX, int mouseY, boolean isSelected)
public void func_192634_a(int slotIndex, int x, int y, int listWidth, int slotHeight, int mouseX, int mouseY, boolean isSelected, float partial)
{
super.drawEntry(slotIndex, x, y, listWidth, slotHeight, mouseX, mouseY, isSelected);
super.func_192634_a(slotIndex, x, y, listWidth, slotHeight, mouseX, mouseY, isSelected, partial);
if (configElement.isListLengthFixed() || slotIndex != owningEntryList.listEntries.size() - 1)
{
this.textFieldValue.setVisible(true);
@@ -516,9 +516,9 @@ public class GuiEditArrayEntries extends GuiListExtended
}
@Override
public void drawEntry(int slotIndex, int x, int y, int listWidth, int slotHeight, int mouseX, int mouseY, boolean isSelected)
public void func_192634_a(int slotIndex, int x, int y, int listWidth, int slotHeight, int mouseX, int mouseY, boolean isSelected, float partial)
{
super.drawEntry(slotIndex, x, y, listWidth, slotHeight, mouseX, mouseY, isSelected);
super.func_192634_a(slotIndex, x, y, listWidth, slotHeight, mouseX, mouseY, isSelected, partial);
this.btnValue.xPosition = listWidth / 4;
this.btnValue.yPosition = y;
@@ -529,7 +529,7 @@ public class GuiEditArrayEntries extends GuiListExtended
this.btnValue.displayString = String.valueOf(value);
btnValue.packedFGColour = value ? GuiUtils.getColorCode('2', true) : GuiUtils.getColorCode('4', true);
this.btnValue.drawButton(owningEntryList.getMC(), mouseX, mouseY);
this.btnValue.func_191745_a(owningEntryList.getMC(), mouseX, mouseY, partial);
}
@Override
@@ -593,7 +593,7 @@ public class GuiEditArrayEntries extends GuiListExtended
}
@Override
public void drawEntry(int slotIndex, int x, int y, int listWidth, int slotHeight, int mouseX, int mouseY, boolean isSelected)
public void func_192634_a(int slotIndex, int x, int y, int listWidth, int slotHeight, int mouseX, int mouseY, boolean isSelected, float partial)
{
if (this.getValue() != null && this.isValidated)
owningEntryList.getMC().fontRendererObj.drawString(
@@ -608,7 +608,7 @@ public class GuiEditArrayEntries extends GuiListExtended
this.btnAddNewEntryAbove.visible = true;
this.btnAddNewEntryAbove.xPosition = half + ((half / 2) - 44);
this.btnAddNewEntryAbove.yPosition = y;
this.btnAddNewEntryAbove.drawButton(owningEntryList.getMC(), mouseX, mouseY);
this.btnAddNewEntryAbove.func_191745_a(owningEntryList.getMC(), mouseX, mouseY, partial);
}
else
this.btnAddNewEntryAbove.visible = false;
@@ -618,7 +618,7 @@ public class GuiEditArrayEntries extends GuiListExtended
this.btnRemoveEntry.visible = true;
this.btnRemoveEntry.xPosition = half + ((half / 2) - 22);
this.btnRemoveEntry.yPosition = y;
this.btnRemoveEntry.drawButton(owningEntryList.getMC(), mouseX, mouseY);
this.btnRemoveEntry.func_191745_a(owningEntryList.getMC(), mouseX, mouseY, partial);
}
else
this.btnRemoveEntry.visible = false;
@@ -687,7 +687,7 @@ public class GuiEditArrayEntries extends GuiListExtended
}
@Override
public void setSelected(int p_178011_1_, int p_178011_2_, int p_178011_3_){}
public void func_192633_a(int p_178011_1_, int p_178011_2_, int p_178011_3_, float partial){}
}
public static interface IArrayEntry extends GuiListExtended.IGuiListEntry
@@ -54,7 +54,7 @@ public class GuiSelectStringEntries extends GuiListExtended
this.mc = mc;
this.configElement = configElement;
this.selectableValues = selectableValues;
this.setShowSelectionBox(true);
this.func_193651_b(true);
listEntries = new ArrayList<IGuiSelectStringListEntry>();
@@ -173,7 +173,7 @@ public class GuiSelectStringEntries extends GuiListExtended
}
@Override
public void drawEntry(int slotIndex, int x, int y, int listWidth, int slotHeight, int mouseX, int mouseY, boolean isSelected)
public void func_192634_a(int slotIndex, int x, int y, int listWidth, int slotHeight, int mouseX, int mouseY, boolean isSelected, float partial)
{
owningList.mc.fontRendererObj.drawString(value.getValue(), x + 1, y, slotIndex == owningList.selectedIndex ? 16777215 : 14737632);
}
@@ -195,7 +195,7 @@ public class GuiSelectStringEntries extends GuiListExtended
}
@Override
public void setSelected(int p_178011_1_, int p_178011_2_, int p_178011_3_){}
public void func_192633_a(int p_192633_1_, int p_192633_2_, int p_192633_3_, float p_192633_4_){}
}
public static interface IGuiSelectStringListEntry extends GuiListExtended.IGuiListEntry
@@ -41,7 +41,7 @@ public class GuiUnicodeGlyphButton extends GuiButtonExt
}
@Override
public void drawButton(Minecraft mc, int mouseX, int mouseY)
public void func_191745_a(Minecraft mc, int mouseX, int mouseY, float partial)
{
if (this.visible)
{
@@ -24,7 +24,7 @@ import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.VertexBuffer;
import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
@@ -201,7 +201,7 @@ public class GuiUtils
float uScale = 1f / 0x100;
float vScale = 1f / 0x100;
Tessellator tessellator = Tessellator.getInstance();
VertexBuffer wr = tessellator.getBuffer();
BufferBuilder wr = tessellator.getBuffer();
wr.begin(7, DefaultVertexFormats.POSITION_TEX);
wr.pos(x , y + height, zLevel).tex( u * uScale, ((v + height) * vScale)).endVertex();
wr.pos(x + width, y + height, zLevel).tex((u + width) * uScale, ((v + height) * vScale)).endVertex();
@@ -215,14 +215,14 @@ public class GuiUtils
/**
* Must be called from {@code GuiScreen.renderToolTip} before {@code GuiScreen.drawHoveringText} is called.
*
*
* @param stack The stack for which a tooltip is about to be drawn.
*/
public static void preItemToolTip(@Nonnull ItemStack stack)
{
cachedTooltipStack = stack;
}
/**
* Must be called from {@code GuiScreen.renderToolTip} after {@code GuiScreen.drawHoveringText} is called.
*/
@@ -250,10 +250,10 @@ public class GuiUtils
{
drawHoveringText(cachedTooltipStack, textLines, mouseX, mouseY, screenWidth, screenHeight, maxTextWidth, font);
}
/**
* Use this version if calling from somewhere where ItemStack context is available.
*
*
* @see #drawHoveringText(List, int, int, int, int, int, FontRenderer)
*/
public static void drawHoveringText(@Nonnull final ItemStack stack, List<String> textLines, int mouseX, int mouseY, int screenWidth, int screenHeight, int maxTextWidth, FontRenderer font)
@@ -270,7 +270,7 @@ public class GuiUtils
screenHeight = event.getScreenHeight();
maxTextWidth = event.getMaxWidth();
font = event.getFontRenderer();
GlStateManager.disableRescaleNormal();
RenderHelper.disableStandardItemLighting();
GlStateManager.disableLighting();
@@ -382,7 +382,7 @@ public class GuiUtils
MinecraftForge.EVENT_BUS.post(new RenderTooltipEvent.PostBackground(stack, textLines, tooltipX, tooltipY, font, tooltipTextWidth, tooltipHeight));
int tooltipTop = tooltipY;
for (int lineNumber = 0; lineNumber < textLines.size(); ++lineNumber)
{
String line = textLines.get(lineNumber);
@@ -423,12 +423,12 @@ public class GuiUtils
GlStateManager.shadeModel(7425);
Tessellator tessellator = Tessellator.getInstance();
VertexBuffer vertexbuffer = tessellator.getBuffer();
vertexbuffer.begin(7, DefaultVertexFormats.POSITION_COLOR);
vertexbuffer.pos(right, top, zLevel).color(startRed, startGreen, startBlue, startAlpha).endVertex();
vertexbuffer.pos(left, top, zLevel).color(startRed, startGreen, startBlue, startAlpha).endVertex();
vertexbuffer.pos(left, bottom, zLevel).color(endRed, endGreen, endBlue, endAlpha).endVertex();
vertexbuffer.pos(right, bottom, zLevel).color(endRed, endGreen, endBlue, endAlpha).endVertex();
BufferBuilder buffer = tessellator.getBuffer();
buffer.begin(7, DefaultVertexFormats.POSITION_COLOR);
buffer.pos(right, top, zLevel).color(startRed, startGreen, startBlue, startAlpha).endVertex();
buffer.pos(left, top, zLevel).color(startRed, startGreen, startBlue, startAlpha).endVertex();
buffer.pos(left, bottom, zLevel).color(endRed, endGreen, endBlue, endAlpha).endVertex();
buffer.pos(right, bottom, zLevel).color(endRed, endGreen, endBlue, endAlpha).endVertex();
tessellator.draw();
GlStateManager.shadeModel(7424);
@@ -22,8 +22,8 @@ package net.minecraftforge.fml.common;
import java.util.Random;
import net.minecraft.world.World;
import net.minecraft.world.chunk.IChunkGenerator;
import net.minecraft.world.chunk.IChunkProvider;
import net.minecraft.world.gen.IChunkGenerator;
/**
@@ -35,6 +35,7 @@ import org.apache.logging.log4j.Level;
import org.objectweb.asm.ClassReader;
import org.objectweb.asm.Type;
import com.google.common.base.MoreObjects;
import com.google.common.base.Objects;
import com.google.common.base.Strings;
import com.google.common.collect.Lists;
@@ -98,7 +99,7 @@ public class ASMModParser
@Override
public String toString()
{
return Objects.toStringHelper("ASMAnnotationDiscoverer")
return MoreObjects.toStringHelper("ASMAnnotationDiscoverer")
.add("className", asmType.getClassName())
.add("classVersion", classVersion)
.add("superName", asmSuperType.getClassName())
@@ -26,7 +26,7 @@ import net.minecraftforge.fml.common.discovery.asm.ASMModParser.AnnotationType;
import org.objectweb.asm.Type;
import com.google.common.base.Objects;
import com.google.common.base.MoreObjects;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
@@ -74,7 +74,7 @@ public class ModAnnotation
@Override
public String toString()
{
return Objects.toStringHelper("Annotation")
return MoreObjects.toStringHelper("Annotation")
.add("type",type)
.add("name",asmType.getClassName())
.add("member",member)
@@ -71,7 +71,7 @@ import org.apache.logging.log4j.Level;
// TODO build test suites to validate the behaviour of this stuff and make it less annoyingly magical
public class NetworkDispatcher extends SimpleChannelInboundHandler<Packet<?>> implements ChannelOutboundHandler {
private static boolean DEBUG_HANDSHAKE = Boolean.parseBoolean(System.getProperty("fml.debugNetworkHandshake", "false"));
private static boolean DEBUG_HANDSHAKE = Boolean.parseBoolean(System.getProperty("fml.debugNetworkHandshake", "true"));
private static enum ConnectionState {
OPENING, AWAITING_HANDSHAKE, HANDSHAKING, HANDSHAKECOMPLETE, FINALIZING, CONNECTED;
}
@@ -54,8 +54,6 @@ import net.minecraftforge.fml.common.registry.EntityRegistry.EntityRegistration;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import org.apache.logging.log4j.core.helpers.Integers;
import com.google.common.collect.Lists;
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
@@ -64,8 +62,8 @@ import javax.annotation.Nullable;
public class FMLNetworkHandler
{
public static final int READ_TIMEOUT = Integers.parseInt(System.getProperty("fml.readTimeout","30"),30);
public static final int LOGIN_TIMEOUT = Integers.parseInt(System.getProperty("fml.loginTimeout","600"),600);
public static final int READ_TIMEOUT = Integer.parseInt(System.getProperty("fml.readTimeout","30"));
public static final int LOGIN_TIMEOUT = Integer.parseInt(System.getProperty("fml.loginTimeout","600"));
private static EnumMap<Side, FMLEmbeddedChannel> channelPair;
public static void fmlServerHandshake(PlayerList scm, NetworkManager manager, EntityPlayerMP player)
@@ -41,7 +41,6 @@ import net.minecraftforge.fml.common.network.handshake.NetworkDispatcher;
import net.minecraftforge.fml.relauncher.Side;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.core.helpers.Integers;
import com.google.common.collect.ConcurrentHashMultiset;
import com.google.common.collect.Lists;
@@ -58,7 +57,7 @@ public class FMLProxyPacket implements Packet<INetHandler> {
private INetHandler netHandler;
private NetworkDispatcher dispatcher;
private static Multiset<String> badPackets = ConcurrentHashMultiset.create();
private static int packetCountWarning = Integers.parseInt(System.getProperty("fml.badPacketCounter", "100"), 100);
private static int packetCountWarning = Integer.parseInt(System.getProperty("fml.badPacketCounter", "100"));
public FMLProxyPacket(SPacketCustomPayload original)
{
@@ -43,6 +43,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.CraftingManager;
import net.minecraft.item.crafting.FurnaceRecipes;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.item.crafting.Ingredient;
import net.minecraft.nbt.JsonToNBT;
import net.minecraft.nbt.NBTBase;
import net.minecraft.nbt.NBTException;
@@ -51,8 +52,8 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.World;
import net.minecraft.world.chunk.IChunkGenerator;
import net.minecraft.world.chunk.IChunkProvider;
import net.minecraft.world.gen.IChunkGenerator;
import net.minecraftforge.fml.common.FMLLog;
import net.minecraftforge.fml.common.IFuelHandler;
import net.minecraftforge.fml.common.IWorldGenerator;
@@ -272,24 +273,25 @@ public class GameRegistry
GameData.getMain().registerSubstitutionAlias(nameToSubstitute, type, object);
}
public static void addRecipe(@Nonnull ItemStack output, Object... params)
@Deprecated //TODO Make IRecipe a registry
public static IRecipe addShapedRecipe(ResourceLocation name, @Nonnull ItemStack output, Object... params)
{
addShapedRecipe(output, params);
throw new RuntimeException("TODO: Forge implement IRecipe registry");
//return CraftingManager.addRecipe(output, params);
}
public static IRecipe addShapedRecipe(@Nonnull ItemStack output, Object... params)
@Deprecated //TODO Make IRecipe a registry
public static void addShapelessRecipe(ResourceLocation name, @Nonnull ItemStack output, Ingredient... params)
{
return CraftingManager.getInstance().addRecipe(output, params);
throw new RuntimeException("TODO: Forge implement IRecipe registry");
//CraftingManager.getInstance().addShapelessRecipe(output, params);
}
public static void addShapelessRecipe(@Nonnull ItemStack output, Object... params)
@Deprecated //TODO Make IRecipe a registry
public static void addRecipe(ResourceLocation name, IRecipe recipe)
{
CraftingManager.getInstance().addShapelessRecipe(output, params);
}
public static void addRecipe(IRecipe recipe)
{
CraftingManager.getInstance().getRecipeList().add(recipe);
throw new RuntimeException("TODO: Forge implement IRecipe registry");
//CraftingManager.getInstance().getRecipeList().add(recipe);
}
public static void addSmelting(Block input, @Nonnull ItemStack output, float xp)
@@ -0,0 +1,17 @@
package net.minecraftforge.items.wrapper;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.inventory.EntityEquipmentSlot;
import net.minecraftforge.items.IItemHandler;
/**
* Exposes the armor inventory of an {@link EntityLivingBase} as an {@link IItemHandler} using {@link EntityLivingBase#getItemStackFromSlot} and
* {@link EntityLivingBase#setItemStackToSlot}.
*/
public class EntityArmorInvWrapper extends EntityEquipmentInvWrapper
{
public EntityArmorInvWrapper(final EntityLivingBase entity)
{
super(entity, EntityEquipmentSlot.Type.ARMOR);
}
}
@@ -0,0 +1,170 @@
package net.minecraftforge.items.wrapper;
import com.google.common.collect.ImmutableList;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.inventory.EntityEquipmentSlot;
import net.minecraft.item.ItemStack;
import net.minecraftforge.items.IItemHandler;
import net.minecraftforge.items.IItemHandlerModifiable;
import net.minecraftforge.items.ItemHandlerHelper;
import javax.annotation.Nonnull;
import java.util.ArrayList;
import java.util.List;
/**
* Exposes the armor or hands inventory of an {@link EntityLivingBase} as an {@link IItemHandler} using {@link EntityLivingBase#getItemStackFromSlot} and
* {@link EntityLivingBase#setItemStackToSlot}.
*/
public abstract class EntityEquipmentInvWrapper implements IItemHandlerModifiable
{
/**
* The entity.
*/
protected final EntityLivingBase entity;
/**
* The slots exposed by this wrapper, with {@link EntityEquipmentSlot#index} as the index.
*/
protected final List<EntityEquipmentSlot> slots;
/**
* @param entity The entity.
* @param slotType The slot type to expose.
*/
public EntityEquipmentInvWrapper(final EntityLivingBase entity, final EntityEquipmentSlot.Type slotType)
{
this.entity = entity;
final List<EntityEquipmentSlot> slots = new ArrayList<EntityEquipmentSlot>();
for (final EntityEquipmentSlot slot : EntityEquipmentSlot.values())
{
if (slot.getSlotType() == slotType)
{
slots.add(slot);
}
}
this.slots = ImmutableList.copyOf(slots);
}
@Override
public int getSlots()
{
return slots.size();
}
@Nonnull
@Override
public ItemStack getStackInSlot(final int slot)
{
return entity.getItemStackFromSlot(validateSlotIndex(slot));
}
@Nonnull
@Override
public ItemStack insertItem(final int slot, @Nonnull final ItemStack stack, final boolean simulate)
{
if (stack.isEmpty())
return ItemStack.EMPTY;
final EntityEquipmentSlot equipmentSlot = validateSlotIndex(slot);
final ItemStack existing = entity.getItemStackFromSlot(equipmentSlot);
int limit = getStackLimit(slot, stack);
if (!existing.isEmpty())
{
if (!ItemHandlerHelper.canItemStacksStack(stack, existing))
return stack;
limit -= existing.getCount();
}
if (limit <= 0)
return stack;
boolean reachedLimit = stack.getCount() > limit;
if (!simulate)
{
if (existing.isEmpty())
{
entity.setItemStackToSlot(equipmentSlot, reachedLimit ? ItemHandlerHelper.copyStackWithSize(stack, limit) : stack);
}
else
{
existing.grow(reachedLimit ? limit : stack.getCount());
}
}
return reachedLimit ? ItemHandlerHelper.copyStackWithSize(stack, stack.getCount() - limit) : ItemStack.EMPTY;
}
@Nonnull
@Override
public ItemStack extractItem(final int slot, final int amount, final boolean simulate)
{
if (amount == 0)
return ItemStack.EMPTY;
final EntityEquipmentSlot equipmentSlot = validateSlotIndex(slot);
final ItemStack existing = entity.getItemStackFromSlot(equipmentSlot);
if (existing.isEmpty())
return ItemStack.EMPTY;
final int toExtract = Math.min(amount, existing.getMaxStackSize());
if (existing.getCount() <= toExtract)
{
if (!simulate)
{
entity.setItemStackToSlot(equipmentSlot, ItemStack.EMPTY);
}
return existing;
}
else
{
if (!simulate)
{
entity.setItemStackToSlot(equipmentSlot, ItemHandlerHelper.copyStackWithSize(existing, existing.getCount() - toExtract));
}
return ItemHandlerHelper.copyStackWithSize(existing, toExtract);
}
}
@Override
public int getSlotLimit(final int slot)
{
final EntityEquipmentSlot equipmentSlot = validateSlotIndex(slot);
return equipmentSlot.getSlotType() == EntityEquipmentSlot.Type.ARMOR ? 1 : 64;
}
protected int getStackLimit(final int slot, @Nonnull final ItemStack stack)
{
return Math.min(getSlotLimit(slot), stack.getMaxStackSize());
}
@Override
public void setStackInSlot(final int slot, @Nonnull final ItemStack stack)
{
final EntityEquipmentSlot equipmentSlot = validateSlotIndex(slot);
if (ItemStack.areItemStacksEqual(entity.getItemStackFromSlot(equipmentSlot), stack))
return;
entity.setItemStackToSlot(equipmentSlot, stack);
}
protected EntityEquipmentSlot validateSlotIndex(final int slot)
{
if (slot < 0 || slot >= slots.size())
throw new IllegalArgumentException("Slot " + slot + " not in valid range - [0," + slots.size() + ")");
return slots.get(slot);
}
}
@@ -0,0 +1,17 @@
package net.minecraftforge.items.wrapper;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.inventory.EntityEquipmentSlot;
import net.minecraftforge.items.IItemHandler;
/**
* Exposes the hands inventory of an {@link EntityLivingBase} as an {@link IItemHandler} using {@link EntityLivingBase#getItemStackFromSlot} and
* {@link EntityLivingBase#setItemStackToSlot}.
*/
public class EntityHandsInvWrapper extends EntityEquipmentInvWrapper
{
public EntityHandsInvWrapper(EntityLivingBase entity)
{
super(entity, EntityEquipmentSlot.Type.HAND);
}
}
@@ -25,6 +25,7 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import net.minecraft.block.BlockPrismarine;
@@ -40,6 +41,7 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.CraftingManager;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.item.crafting.Ingredient;
import net.minecraft.item.crafting.ShapedRecipes;
import net.minecraft.item.crafting.ShapelessRecipes;
import net.minecraftforge.common.MinecraftForge;
@@ -347,52 +349,67 @@ public class OreDictionary
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> recipesToRemove = new ArrayList<IRecipe>();
List<IRecipe> recipesToAdd = new ArrayList<IRecipe>();
int replaced = 0;
// Search vanilla recipes for recipes to replace
for(Object obj : recipes)
for(IRecipe obj : CraftingManager.field_193380_a)
{
if(obj.getClass() == ShapedRecipes.class)
if(obj.getClass() == ShapedRecipes.class || obj.getClass() == ShapelessRecipes.class)
{
ShapedRecipes recipe = (ShapedRecipes)obj;
ItemStack output = recipe.getRecipeOutput();
ItemStack output = obj.getRecipeOutput();
if (!output.isEmpty() && containsMatch(false, exclusions, output))
{
continue;
}
if(containsMatch(true, recipe.recipeItems, replaceStacks))
NonNullList<Ingredient> lst = obj.func_192400_c();
for (int x = 0; x < lst.size(); x++)
{
recipesToRemove.add(recipe);
recipesToAdd.add(new ShapedOreRecipe(recipe, replacements));
}
}
else if(obj.getClass() == ShapelessRecipes.class)
{
ShapelessRecipes recipe = (ShapelessRecipes)obj;
ItemStack output = recipe.getRecipeOutput();
if (!output.isEmpty() && containsMatch(false, exclusions, output))
{
continue;
}
Ingredient ing = lst.get(x);
ItemStack[] ingredients = ing.func_193365_a();
String oreName = null;
boolean skip = false;
if(containsMatch(true, recipe.recipeItems.toArray(new ItemStack[recipe.recipeItems.size()]), replaceStacks))
{
recipesToRemove.add((IRecipe)obj);
IRecipe newRecipe = new ShapelessOreRecipe(recipe, replacements);
recipesToAdd.add(newRecipe);
for (ItemStack stack : ingredients)
{
boolean matches = false;
for (Entry<ItemStack, String> ent : replacements.entrySet())
{
if (itemMatches(ent.getKey(), stack, true))
{
matches = true;
if (oreName != null && !oreName.equals(ent.getValue()))
{
FMLLog.info("Invalid recipe found with multiple oredict ingredients in the same ingredient..."); //TODO: Write a dumper?
skip = true;
break;
}
else if (oreName == null)
{
oreName = ent.getValue();
break;
}
}
}
if (!matches && oreName != null)
{
//TODO: Properly fix this, Broken recipe example: Beds
//FMLLog.info("Invalid recipe found with ingredient that partially matches ore entries..."); //TODO: Write a dumper?
skip = true;
}
if (skip)
break;
}
if (!skip && oreName != null)
{
//Replace!
lst.set(x, new OreIngredient(oreName));
replaced++;
}
}
}
}
recipes.removeAll(recipesToRemove);
recipes.addAll(recipesToAdd);
if (recipesToRemove.size() > 0)
{
FMLLog.info("Replaced %d ore recipes", recipesToRemove.size());
}
FMLLog.info("Replaced %d ore ingredients", replaced);
}
/**
@@ -0,0 +1,85 @@
/*
* Minecraft Forge
* Copyright (c) 2016.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation version 2.1
* of the License.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
package net.minecraftforge.oredict;
import javax.annotation.Nullable;
import it.unimi.dsi.fastutil.ints.IntArrayList;
import it.unimi.dsi.fastutil.ints.IntComparators;
import it.unimi.dsi.fastutil.ints.IntList;
import net.minecraft.client.util.RecipeItemHelper;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.Ingredient;
import net.minecraft.util.NonNullList;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public class OreIngredient extends Ingredient
{
private NonNullList<ItemStack> ores;
private IntList itemIds = null;
public OreIngredient(String ore)
{
super(0);
ores = OreDictionary.getOres(ore);
}
@Override
public ItemStack[] func_193365_a()
{
return ores.toArray(new ItemStack[ores.size()]);
}
@SideOnly(Side.CLIENT)
public IntList func_194139_b()
{
if (this.itemIds == null || this.itemIds.size() != ores.size())
{
this.itemIds = new IntArrayList(this.ores.size());
for (ItemStack itemstack : this.ores)
{
this.itemIds.add(RecipeItemHelper.func_194113_b(itemstack));
}
this.itemIds.sort(IntComparators.NATURAL_COMPARATOR);
}
return this.itemIds;
}
public boolean apply(@Nullable ItemStack target)
{
if (target == null)
return false;
for (ItemStack ore : this.ores)
if (OreDictionary.itemMatches(target, ore, false))
return true;
return false;
}
protected void invalidate()
{
this.itemIds = null;
}
}
@@ -51,7 +51,7 @@ import net.minecraft.item.crafting.RecipesBanners.RecipeDuplicatePattern;
import javax.annotation.Nullable;
import static net.minecraftforge.oredict.RecipeSorter.Category.*;
@Deprecated //DO NOT USE IN 1.12 UNTIL THIS DEPRECATION MARKER IS REMOVED THIS WILL MOST LIKELY BE DELETED YOU HAVE BEEN WARNED
public class RecipeSorter implements Comparator<IRecipe>
{
public enum Category
@@ -171,8 +171,8 @@ public class RecipeSorter implements Comparator<IRecipe>
}
else
{
if (r2.getRecipeSize() < r1.getRecipeSize()) return -1;
if (r2.getRecipeSize() > r1.getRecipeSize()) return 1;
if (r2.func_192400_c().size() < r1.func_192400_c().size()) return -1;
if (r2.func_192400_c().size() > r1.func_192400_c().size()) return 1;
return getPriority(r2) - getPriority(r1); // high priority value first!
}
}
@@ -183,7 +183,7 @@ public class RecipeSorter implements Comparator<IRecipe>
bake();
FMLLog.fine("Sorting recipes");
warned.clear();
Collections.sort(CraftingManager.getInstance().getRecipeList(), INSTANCE);
//Collections.sort(CraftingManager.getInstance().getRecipeList(), INSTANCE);
}
public static void register(String name, Class<?> recipe, Category category, String dependencies)
@@ -19,23 +19,22 @@
package net.minecraftforge.oredict;
import java.util.List;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;
import net.minecraft.block.Block;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.item.crafting.Ingredient;
import net.minecraft.inventory.InventoryCrafting;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.ShapedRecipes;
import net.minecraft.util.NonNullList;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
import net.minecraftforge.common.ForgeHooks;
import javax.annotation.Nonnull;
import com.google.common.collect.Maps;
public class ShapedOreRecipe implements IRecipe
{
//Added in for future ease of change, but hard coded for now.
@@ -44,15 +43,17 @@ public class ShapedOreRecipe implements IRecipe
@Nonnull
protected ItemStack output = ItemStack.EMPTY;
protected Object[] input = null;
protected NonNullList<Ingredient> input = null;
protected int width = 0;
protected int height = 0;
protected boolean mirrored = true;
protected ResourceLocation group;
public ShapedOreRecipe(Block result, Object... recipe){ this(new ItemStack(result), recipe); }
public ShapedOreRecipe(Item result, Object... recipe){ this(new ItemStack(result), recipe); }
public ShapedOreRecipe(@Nonnull ItemStack result, Object... recipe)
public ShapedOreRecipe(ResourceLocation group, Block result, Object... recipe){ this(group, new ItemStack(result), recipe); }
public ShapedOreRecipe(ResourceLocation group, Item result, Object... recipe){ this(group, new ItemStack(result), recipe); }
public ShapedOreRecipe(ResourceLocation group, @Nonnull ItemStack result, Object... recipe)
{
this.group = group;
output = result.copy();
String shape = "";
@@ -105,7 +106,7 @@ public class ShapedOreRecipe implements IRecipe
throw new RuntimeException(ret);
}
HashMap<Character, Object> itemMap = new HashMap<Character, Object>();
HashMap<Character, Ingredient> itemMap = Maps.newHashMap();
for (; idx < recipe.length; idx += 2)
{
@@ -114,19 +115,23 @@ public class ShapedOreRecipe implements IRecipe
if (in instanceof ItemStack)
{
itemMap.put(chr, ((ItemStack)in).copy());
itemMap.put(chr, Ingredient.func_193369_a(((ItemStack)in).copy()));
}
else if (in instanceof Item)
{
itemMap.put(chr, new ItemStack((Item)in));
itemMap.put(chr, Ingredient.func_193367_a((Item)in));
}
else if (in instanceof Block)
{
itemMap.put(chr, new ItemStack((Block)in, 1, OreDictionary.WILDCARD_VALUE));
itemMap.put(chr, Ingredient.func_193369_a(new ItemStack((Block)in, 1, OreDictionary.WILDCARD_VALUE)));
}
else if (in instanceof String)
{
itemMap.put(chr, OreDictionary.getOres((String)in));
itemMap.put(chr, new OreIngredient((String)in));
}
else if (in instanceof Ingredient)
{
itemMap.put(chr, (Ingredient)in);
}
else
{
@@ -140,38 +145,11 @@ public class ShapedOreRecipe implements IRecipe
}
}
input = new Object[width * height];
this.input = NonNullList.withSize(width * height, Ingredient.field_193370_a);
int x = 0;
for (char chr : shape.toCharArray())
{
input[x++] = itemMap.get(chr);
}
}
ShapedOreRecipe(ShapedRecipes recipe, Map<ItemStack, String> replacements)
{
output = recipe.getRecipeOutput();
width = recipe.recipeWidth;
height = recipe.recipeHeight;
input = new Object[recipe.recipeItems.length];
for(int i = 0; i < input.length; i++)
{
ItemStack ingredient = recipe.recipeItems[i];
if(ingredient.isEmpty()) continue;
input[i] = recipe.recipeItems[i];
for(Entry<ItemStack, String> replace : replacements.entrySet())
{
if(OreDictionary.itemMatches(replace.getKey(), ingredient, true))
{
input[i] = OreDictionary.getOres(replace.getValue());
break;
}
}
input.add(x++, itemMap.get(chr));
}
}
@@ -179,9 +157,6 @@ public class ShapedOreRecipe implements IRecipe
@Nonnull
public ItemStack getCraftingResult(@Nonnull InventoryCrafting var1){ return output.copy(); }
@Override
public int getRecipeSize(){ return input.length; }
@Override
@Nonnull
public ItemStack getRecipeOutput(){ return output; }
@@ -208,7 +183,6 @@ public class ShapedOreRecipe implements IRecipe
return false;
}
@SuppressWarnings("unchecked")
protected boolean checkMatch(InventoryCrafting inv, int startX, int startY, boolean mirror)
{
for (int x = 0; x < MAX_CRAFT_GRID_WIDTH; x++)
@@ -217,45 +191,21 @@ public class ShapedOreRecipe implements IRecipe
{
int subX = x - startX;
int subY = y - startY;
Object target = null;
Ingredient target = null;
if (subX >= 0 && subY >= 0 && subX < width && subY < height)
{
if (mirror)
{
target = input[width - subX - 1 + subY * width];
target = input.get(width - subX - 1 + subY * width);
}
else
{
target = input[subX + subY * width];
target = input.get(subX + subY * width);
}
}
ItemStack slot = inv.getStackInRowAndColumn(x, y);
if (target instanceof ItemStack)
{
if (!OreDictionary.itemMatches((ItemStack)target, slot, false))
{
return false;
}
}
else if (target instanceof List)
{
boolean matched = false;
Iterator<ItemStack> itr = ((List<ItemStack>)target).iterator();
while (itr.hasNext() && !matched)
{
matched = OreDictionary.itemMatches(itr.next(), slot, false);
}
if (!matched)
{
return false;
}
}
else if (target == null && !slot.isEmpty())
if (!target.apply(inv.getStackInRowAndColumn(x, y)))
{
return false;
}
@@ -271,12 +221,7 @@ public class ShapedOreRecipe implements IRecipe
return this;
}
/**
* Returns the input for this recipe, any mod accessing this value should never
* manipulate the values in this array as it will effect the recipe itself.
* @return The recipes input vales.
*/
public Object[] getInput()
public NonNullList<Ingredient> func_192400_c()
{
return this.input;
}
@@ -296,4 +241,14 @@ public class ShapedOreRecipe implements IRecipe
{
return height;
}
public String func_193358_e()
{
return this.group.toString();
}
public boolean func_194133_a(int p_194133_1_, int p_194133_2_)
{
return p_194133_1_ >= this.width && p_194133_2_ >= this.height;
}
}
@@ -25,11 +25,13 @@ import java.util.Map.Entry;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.item.crafting.Ingredient;
import net.minecraft.inventory.InventoryCrafting;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.ShapelessRecipes;
import net.minecraft.util.NonNullList;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
import net.minecraftforge.common.ForgeHooks;
@@ -39,31 +41,37 @@ public class ShapelessOreRecipe implements IRecipe
{
@Nonnull
protected ItemStack output = ItemStack.EMPTY;
protected NonNullList<Object> input = NonNullList.create();
protected NonNullList<Ingredient > input = NonNullList.create();
protected ResourceLocation group;
public ShapelessOreRecipe(Block result, Object... recipe){ this(new ItemStack(result), recipe); }
public ShapelessOreRecipe(Item result, Object... recipe){ this(new ItemStack(result), recipe); }
public ShapelessOreRecipe(ResourceLocation group, Block result, Object... recipe){ this(group, new ItemStack(result), recipe); }
public ShapelessOreRecipe(ResourceLocation group, Item result, Object... recipe){ this(group, new ItemStack(result), recipe); }
public ShapelessOreRecipe(@Nonnull ItemStack result, Object... recipe)
public ShapelessOreRecipe(ResourceLocation group, @Nonnull ItemStack result, Object... recipe)
{
this.group = group;
output = result.copy();
for (Object in : recipe)
{
if (in instanceof ItemStack)
{
input.add(((ItemStack)in).copy());
input.add(Ingredient.func_193369_a(((ItemStack)in).copy()));
}
else if (in instanceof Item)
{
input.add(new ItemStack((Item)in));
input.add(Ingredient.func_193367_a((Item)in));
}
else if (in instanceof Block)
{
input.add(new ItemStack((Block)in));
input.add(Ingredient.func_193369_a(new ItemStack((Block)in, 1, OreDictionary.WILDCARD_VALUE)));
}
else if (in instanceof String)
{
input.add(OreDictionary.getOres((String)in));
input.add(new OreIngredient((String)in));
}
else if (in instanceof Ingredient)
{
input.add((Ingredient)in);
}
else
{
@@ -78,28 +86,6 @@ public class ShapelessOreRecipe implements IRecipe
}
}
ShapelessOreRecipe(ShapelessRecipes recipe, Map<ItemStack, String> replacements)
{
output = recipe.getRecipeOutput();
for(ItemStack ingredient : recipe.recipeItems)
{
Object finalObj = ingredient;
for(Entry<ItemStack, String> replace : replacements.entrySet())
{
if(OreDictionary.itemMatches(replace.getKey(), ingredient, false))
{
finalObj = OreDictionary.getOres(replace.getValue());
break;
}
}
input.add(finalObj);
}
}
@Override
public int getRecipeSize(){ return input.size(); }
@Override
@Nonnull
public ItemStack getRecipeOutput(){ return output; }
@@ -112,7 +98,7 @@ public class ShapelessOreRecipe implements IRecipe
@Override
public boolean matches(InventoryCrafting var1, World world)
{
NonNullList<Object> required = NonNullList.create();
NonNullList<Ingredient> required = NonNullList.create();
required.addAll(input);
for (int x = 0; x < var1.getSizeInventory(); x++)
@@ -122,31 +108,14 @@ public class ShapelessOreRecipe implements IRecipe
if (!slot.isEmpty())
{
boolean inRecipe = false;
Iterator<Object> req = required.iterator();
Iterator<Ingredient> req = required.iterator();
while (req.hasNext())
{
boolean match = false;
Object next = req.next();
if (next instanceof ItemStack)
{
match = OreDictionary.itemMatches((ItemStack)next, slot, false);
}
else if (next instanceof List)
{
Iterator<ItemStack> itr = ((List<ItemStack>)next).iterator();
while (itr.hasNext() && !match)
{
match = OreDictionary.itemMatches(itr.next(), slot, false);
}
}
if (match)
if (req.next().apply(slot))
{
inRecipe = true;
required.remove(next);
req.remove();
break;
}
}
@@ -161,20 +130,26 @@ public class ShapelessOreRecipe implements IRecipe
return required.isEmpty();
}
/**
* Returns the input for this recipe, any mod accessing this value should never
* manipulate the values in this array as it will effect the recipe itself.
* @return The recipes input vales.
*/
public NonNullList<Object> getInput()
public NonNullList<Ingredient> func_192400_c()
{
return this.input;
}
@Override
@Nonnull
public NonNullList<ItemStack> getRemainingItems(InventoryCrafting inv) //getRecipeLeftovers
public NonNullList<ItemStack> getRemainingItems(InventoryCrafting inv)
{
return ForgeHooks.defaultRecipeGetRemainingItems(inv);
}
public String func_193358_e()
{
return this.group.toString();
}
public boolean func_194133_a(int p_194133_1_, int p_194133_2_)
{
return p_194133_1_ * p_194133_2_ >= this.input.size();
}
}
@@ -21,7 +21,6 @@ package net.minecraftforge.server.console;
import static jline.TerminalFactory.OFF;
import static jline.console.ConsoleReader.RESET_LINE;
import static org.apache.logging.log4j.core.helpers.Booleans.parseBoolean;
import java.io.IOException;
import java.io.PrintStream;
@@ -89,10 +88,10 @@ public class TerminalConsoleAppender extends AbstractAppender
}
if (layout == null)
{
layout = PatternLayout.createLayout(null, null, null, null, null);
layout = PatternLayout.newBuilder().build();
}
boolean ignoreExceptions = parseBoolean(ignore, true);
boolean ignoreExceptions = Boolean.parseBoolean(ignore);
// This is handled by jline
System.setProperty("log4j.skipJansi", "true");