Setup and import of 1.16 YEET

This commit is contained in:
cpw committed 2020-06-25 17:55:38 -04:00
1 parent 56397043bb
commit 6d15febdb3
931 files changed
+18847 -9127

No files matched your search

@@ -1,457 +0,0 @@
/*
* Minecraft Forge
* Copyright (c) 2016-2019.
*
* 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.client;
import javax.annotation.Nonnull;
import java.nio.ByteBuffer;
import java.util.function.Predicate;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL13;
import org.lwjgl.opengl.GL31;
import com.mojang.blaze3d.platform.GLX;
import com.mojang.blaze3d.platform.GlStateManager;
import com.mojang.blaze3d.systems.RenderSystem;
import net.minecraft.client.Minecraft;
import net.minecraft.client.world.ClientWorld;
import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.client.renderer.GLAllocation;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.texture.DynamicTexture;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.client.renderer.vertex.VertexBuffer;
import net.minecraft.client.renderer.vertex.VertexFormat;
import net.minecraft.client.settings.CloudOption;
import net.minecraft.entity.Entity;
import net.minecraft.resources.IReloadableResourceManager;
import net.minecraft.resources.IResourceManager;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.Vec3d;
import net.minecraftforge.common.ForgeConfig;
import net.minecraftforge.resource.IResourceType;
import net.minecraftforge.resource.ISelectiveResourceReloadListener;
import net.minecraftforge.resource.VanillaResourceType;
/* TODO: reimplement using the new rendering system? or remove?
public class CloudRenderer implements ISelectiveResourceReloadListener
{
// Shared constants.
private static final float PX_SIZE = 1 / 256F;
// Building constants.
private static final VertexFormat FORMAT = DefaultVertexFormats.POSITION_TEX_COLOR;
private static final int TOP_SECTIONS = 12; // Number of slices a top face will span.
private static final int HEIGHT = 4;
private static final float INSET = 0.001F;
private static final float ALPHA = 0.8F;
// Debug
private static final boolean WIREFRAME = false;
// Instance fields
private final Minecraft mc = Minecraft.getInstance();
private final ResourceLocation texture = new ResourceLocation("textures/environment/clouds.png");
private VertexBuffer vbo;
private CloudOption cloudMode = CloudOption.OFF;
private int renderDistance = -1;
private DynamicTexture COLOR_TEX = null;
private int texW;
private int texH;
public CloudRenderer()
{
// Resource manager should always be reloadable.
((IReloadableResourceManager) mc.getResourceManager()).addReloadListener(this);
}
private int getScale()
{
return cloudMode == CloudOption.FANCY ? 12 : 8;
}
private float ceilToScale(float value)
{
float scale = getScale();
return MathHelper.ceil(value / scale) * scale;
}
private void vertices(BufferBuilder buffer)
{
boolean fancy = cloudMode == CloudOption.FANCY; // Defines whether to hide all but the bottom.
float scale = getScale();
float CULL_DIST = 2 * scale;
float bCol = fancy ? 0.7F : 1F;
float sectEnd = ceilToScale((renderDistance * 2) * 16);
float sectStart = -sectEnd;
float sectStep = ceilToScale(sectEnd * 2 / TOP_SECTIONS);
float sectPx = PX_SIZE / scale;
buffer.begin(GL11.GL_QUADS, FORMAT);
float sectX0 = sectStart;
float sectX1 = sectX0;
while (sectX1 < sectEnd)
{
sectX1 += sectStep;
if (sectX1 > sectEnd)
sectX1 = sectEnd;
float sectZ0 = sectStart;
float sectZ1 = sectZ0;
while (sectZ1 < sectEnd)
{
sectZ1 += sectStep;
if (sectZ1 > sectEnd)
sectZ1 = sectEnd;
float u0 = sectX0 * sectPx;
float u1 = sectX1 * sectPx;
float v0 = sectZ0 * sectPx;
float v1 = sectZ1 * sectPx;
// Bottom
buffer.pos(sectX0, 0, sectZ0).tex(u0, v0).color(bCol, bCol, bCol, ALPHA).endVertex();
buffer.pos(sectX1, 0, sectZ0).tex(u1, v0).color(bCol, bCol, bCol, ALPHA).endVertex();
buffer.pos(sectX1, 0, sectZ1).tex(u1, v1).color(bCol, bCol, bCol, ALPHA).endVertex();
buffer.pos(sectX0, 0, sectZ1).tex(u0, v1).color(bCol, bCol, bCol, ALPHA).endVertex();
if (fancy)
{
// Top
buffer.pos(sectX0, HEIGHT, sectZ0).tex(u0, v0).color(1, 1, 1, ALPHA).endVertex();
buffer.pos(sectX0, HEIGHT, sectZ1).tex(u0, v1).color(1, 1, 1, ALPHA).endVertex();
buffer.pos(sectX1, HEIGHT, sectZ1).tex(u1, v1).color(1, 1, 1, ALPHA).endVertex();
buffer.pos(sectX1, HEIGHT, sectZ0).tex(u1, v0).color(1, 1, 1, ALPHA).endVertex();
float slice;
float sliceCoord0;
float sliceCoord1;
for (slice = sectX0; slice < sectX1;)
{
sliceCoord0 = slice * sectPx;
sliceCoord1 = sliceCoord0 + PX_SIZE;
// X sides
if (slice > -CULL_DIST)
{
slice += INSET;
buffer.pos(slice, 0, sectZ1).tex(sliceCoord0, v1).color(0.9F, 0.9F, 0.9F, ALPHA).endVertex();
buffer.pos(slice, HEIGHT, sectZ1).tex(sliceCoord1, v1).color(0.9F, 0.9F, 0.9F, ALPHA).endVertex();
buffer.pos(slice, HEIGHT, sectZ0).tex(sliceCoord1, v0).color(0.9F, 0.9F, 0.9F, ALPHA).endVertex();
buffer.pos(slice, 0, sectZ0).tex(sliceCoord0, v0).color(0.9F, 0.9F, 0.9F, ALPHA).endVertex();
slice -= INSET;
}
slice += scale;
if (slice <= CULL_DIST)
{
slice -= INSET;
buffer.pos(slice, 0, sectZ0).tex(sliceCoord0, v0).color(0.9F, 0.9F, 0.9F, ALPHA).endVertex();
buffer.pos(slice, HEIGHT, sectZ0).tex(sliceCoord1, v0).color(0.9F, 0.9F, 0.9F, ALPHA).endVertex();
buffer.pos(slice, HEIGHT, sectZ1).tex(sliceCoord1, v1).color(0.9F, 0.9F, 0.9F, ALPHA).endVertex();
buffer.pos(slice, 0, sectZ1).tex(sliceCoord0, v1).color(0.9F, 0.9F, 0.9F, ALPHA).endVertex();
slice += INSET;
}
}
for (slice = sectZ0; slice < sectZ1;)
{
sliceCoord0 = slice * sectPx;
sliceCoord1 = sliceCoord0 + PX_SIZE;
// Z sides
if (slice > -CULL_DIST)
{
slice += INSET;
buffer.pos(sectX0, 0, slice).tex(u0, sliceCoord0).color(0.8F, 0.8F, 0.8F, ALPHA).endVertex();
buffer.pos(sectX0, HEIGHT, slice).tex(u0, sliceCoord1).color(0.8F, 0.8F, 0.8F, ALPHA).endVertex();
buffer.pos(sectX1, HEIGHT, slice).tex(u1, sliceCoord1).color(0.8F, 0.8F, 0.8F, ALPHA).endVertex();
buffer.pos(sectX1, 0, slice).tex(u1, sliceCoord0).color(0.8F, 0.8F, 0.8F, ALPHA).endVertex();
slice -= INSET;
}
slice += scale;
if (slice <= CULL_DIST)
{
slice -= INSET;
buffer.pos(sectX1, 0, slice).tex(u1, sliceCoord0).color(0.8F, 0.8F, 0.8F, ALPHA).endVertex();
buffer.pos(sectX1, HEIGHT, slice).tex(u1, sliceCoord1).color(0.8F, 0.8F, 0.8F, ALPHA).endVertex();
buffer.pos(sectX0, HEIGHT, slice).tex(u0, sliceCoord1).color(0.8F, 0.8F, 0.8F, ALPHA).endVertex();
buffer.pos(sectX0, 0, slice).tex(u0, sliceCoord0).color(0.8F, 0.8F, 0.8F, ALPHA).endVertex();
slice += INSET;
}
}
}
sectZ0 = sectZ1;
}
sectX0 = sectX1;
}
}
private void dispose()
{
if (vbo != null)
{
vbo.deleteGlBuffers();
vbo = null;
}
}
private void build()
{
Tessellator tess = Tessellator.getInstance();
BufferBuilder buffer = tess.getBuffer();
vbo = new VertexBuffer(FORMAT);
vertices(buffer);
buffer.finishDrawing();
buffer.reset();
vbo.bufferData(buffer.getByteBuffer());
}
private int fullCoord(double coord, int scale)
{ // Corrects misalignment of UV offset when on negative coords.
return ((int) coord / scale) - (coord < 0 ? 1 : 0);
}
private boolean isBuilt()
{
return vbo != null;
}
public void checkSettings()
{
boolean newEnabled = ForgeConfig.CLIENT.forgeCloudsEnabled.get()
&& mc.gameSettings.getCloudOption() != CloudOption.OFF
&& mc.world != null
&& mc.world.dimension.isSurfaceWorld();
if (isBuilt()
&& (!newEnabled
|| mc.gameSettings.getCloudOption() != cloudMode
|| mc.gameSettings.renderDistanceChunks != renderDistance))
{
dispose();
}
cloudMode = mc.gameSettings.getCloudOption();
renderDistance = mc.gameSettings.renderDistanceChunks;
if (newEnabled && !isBuilt())
{
build();
}
}
public boolean render(int cloudTicks, float partialTicks)
{
if (!isBuilt())
return false;
Entity entity = mc.getRenderViewEntity();
double totalOffset = cloudTicks + partialTicks;
double x = entity.prevPosX + (entity.getPosX() - entity.prevPosX) * partialTicks
+ totalOffset * 0.03;
double y = mc.world.dimension.getCloudHeight()
- (entity.lastTickPosY + (entity.getPosY() - entity.lastTickPosY) * partialTicks)
+ 0.33;
double z = entity.prevPosZ + (entity.getPosZ() - entity.prevPosZ) * partialTicks;
int scale = getScale();
if (cloudMode == CloudOption.FANCY)
z += 0.33 * scale;
// Integer UVs to translate the texture matrix by.
int offU = fullCoord(x, scale);
int offV = fullCoord(z, scale);
RenderSystem.pushMatrix();
// Translate by the remainder after the UV offset.
RenderSystem.translated((offU * scale) - x, y, (offV * scale) - z);
// Modulo to prevent texture samples becoming inaccurate at extreme offsets.
offU = offU % texW;
offV = offV % texH;
// Translate the texture.
RenderSystem.matrixMode(GL11.GL_TEXTURE);
RenderSystem.translatef(offU * PX_SIZE, offV * PX_SIZE, 0);
RenderSystem.matrixMode(GL11.GL_MODELVIEW);
RenderSystem.disableCull();
RenderSystem.enableBlend();
RenderSystem.defaultBlendFunc();
// Color multiplier.
Vec3d color = mc.world.getCloudColour(partialTicks);
float r = (float) color.x;
float g = (float) color.y;
float b = (float) color.z;
if (COLOR_TEX == null)
COLOR_TEX = new DynamicTexture(1, 1, false);
// Apply a color multiplier through a texture upload if shaders aren't supported.
COLOR_TEX.getTextureData().setPixelRGBA(0, 0, 255 << 24
| ((int) (r * 255)) << 16
| ((int) (g * 255)) << 8
| (int) (b * 255));
COLOR_TEX.updateDynamicTexture();
RenderSystem.activeTexture(GL13.GL_TEXTURE1);
RenderSystem.bindTexture(COLOR_TEX.getGlTextureId());
RenderSystem.enableTexture();
// Bind the clouds texture last so the shader's sampler2D is correct.
RenderSystem.activeTexture(GL13.GL_TEXTURE0);
mc.textureManager.bindTexture(texture);
ByteBuffer buffer = Tessellator.getInstance().getBuffer().getByteBuffer();
// Set up pointers for the display list/VBO.
vbo.bindBuffer();
int stride = FORMAT.getSize();
RenderSystem.vertexPointer(3, GL11.GL_FLOAT, stride, 0);
RenderSystem.enableClientState(GL11.GL_VERTEX_ARRAY);
RenderSystem.texCoordPointer(2, GL11.GL_FLOAT, stride, 12);
RenderSystem.enableClientState(GL11.GL_TEXTURE_COORD_ARRAY);
RenderSystem.colorPointer(4, GL11.GL_UNSIGNED_BYTE, stride, 20);
RenderSystem.enableClientState(GL11.GL_COLOR_ARRAY);
// Depth pass to prevent insides rendering from the outside.
RenderSystem.colorMask(false, false, false, false);
vbo.drawArrays(GL11.GL_QUADS);
// Full render.
RenderSystem.colorMask(true, true, true, true);
// Wireframe for debug.
if (WIREFRAME)
{
RenderSystem.polygonMode(GL11.GL_FRONT_AND_BACK, GL11.GL_LINE);
RenderSystem.lineWidth(2.0F);
RenderSystem.disableTexture();
RenderSystem.depthMask(false);
RenderSystem.disableFog();
vbo.drawArrays(GL11.GL_QUADS);
RenderSystem.polygonMode(GL11.GL_FRONT_AND_BACK, GL11.GL_FILL);
RenderSystem.depthMask(true);
RenderSystem.enableTexture();
RenderSystem.enableFog();
}
vbo.drawArrays(GL11.GL_QUADS);
VertexBuffer.unbindBuffer(); // Unbind buffer and disable pointers.
buffer.limit(0);
for (int i = 0; i < FORMAT.getElements().size(); i++)
FORMAT.getElements().get(i).getUsage().postDraw(FORMAT, i, FORMAT.getSize(), buffer);
buffer.position(0);
// Disable our coloring.
RenderSystem.activeTexture(GL13.GL_TEXTURE1);
RenderSystem.disableTexture();
RenderSystem.activeTexture(GL13.GL_TEXTURE0);
// Reset texture matrix.
RenderSystem.matrixMode(GL11.GL_TEXTURE);
RenderSystem.loadIdentity();
RenderSystem.matrixMode(GL11.GL_MODELVIEW);
RenderSystem.disableBlend();
RenderSystem.enableCull();
RenderSystem.popMatrix();
return true;
}
private void reloadTextures()
{
if (mc.textureManager != null)
{
mc.textureManager.bindTexture(texture);
texW = GlStateManager.func_227692_c_(GL11.GL_TEXTURE_2D, 0, GL11.GL_TEXTURE_WIDTH);
texH = GlStateManager.func_227692_c_(GL11.GL_TEXTURE_2D, 0, GL11.GL_TEXTURE_HEIGHT);
}
}
@Override
public void onResourceManagerReload(@Nonnull IResourceManager resourceManager, @Nonnull Predicate<IResourceType> resourcePredicate)
{
if (resourcePredicate.test(VanillaResourceType.TEXTURES))
{
reloadTextures();
}
}
private static CloudRenderer cloudRenderer;
private static CloudRenderer getCloudRenderer()
{
if (cloudRenderer == null)
cloudRenderer = new CloudRenderer();
return cloudRenderer;
}
public static void updateCloudSettings()
{
getCloudRenderer().checkSettings();
}
public static boolean renderClouds(int cloudTicks, float partialTicks, ClientWorld world, Minecraft client)
{
IRenderHandler renderer = world.dimension.getCloudRenderer();
if (renderer != null)
{
renderer.render(cloudTicks, partialTicks, world, client);
return true;
}
return getCloudRenderer().render(cloudTicks, partialTicks);
}
}
*/
@@ -52,7 +52,16 @@ import java.util.stream.Stream;
import javax.annotation.Nonnull;
import net.minecraft.client.renderer.*;
import net.minecraft.client.renderer.model.*;
import net.minecraft.client.settings.KeyBinding;
import net.minecraft.fluid.FluidState;
import net.minecraft.util.math.vector.Matrix3f;
import net.minecraft.util.math.vector.Matrix4f;
import net.minecraft.util.math.vector.TransformationMatrix;
import net.minecraft.util.math.vector.Vector3f;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TranslationTextComponent;
import net.minecraft.world.IBlockDisplayReader;
import net.minecraftforge.client.event.RenderHandEvent;
import net.minecraftforge.client.model.pipeline.LightUtil;
import net.minecraftforge.fml.loading.progress.StartupMessageManager;
@@ -82,13 +91,6 @@ import net.minecraft.client.renderer.FogRenderer.FogType;
import net.minecraft.client.renderer.color.BlockColors;
import net.minecraft.client.renderer.color.ItemColors;
import net.minecraft.client.renderer.entity.model.BipedModel;
import net.minecraft.client.renderer.model.BakedQuad;
import net.minecraft.client.renderer.model.BlockFaceUV;
import net.minecraft.client.renderer.model.IBakedModel;
import net.minecraft.client.renderer.model.ItemCameraTransforms;
import net.minecraft.client.renderer.model.ItemTransformVec3f;
import net.minecraft.client.renderer.model.Material;
import net.minecraft.client.renderer.model.ModelManager;
import net.minecraft.client.renderer.texture.AtlasTexture;
import net.minecraft.client.renderer.texture.NativeImage;
import net.minecraft.client.renderer.texture.OverlayTexture;
@@ -102,7 +104,6 @@ import net.minecraft.entity.Entity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.fluid.Fluid;
import net.minecraft.fluid.IFluidState;
import net.minecraft.inventory.EquipmentSlotType;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.RecipeManager;
@@ -116,7 +117,6 @@ import net.minecraft.util.math.EntityRayTraceResult;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.world.ILightReader;
import net.minecraft.world.World;
import net.minecraft.world.biome.Biome;
import net.minecraftforge.client.event.ColorHandlerEvent;
@@ -174,12 +174,6 @@ public class ForgeHooksClient
return MinecraftForge.EVENT_BUS.post(new DrawHighlightEvent(context, info, target, partialTicks, matrix, buffers));
}
@Deprecated // TODO: Remove in 1.16
public static void dispatchRenderLast(WorldRenderer context, MatrixStack mat, float partialTicks)
{
MinecraftForge.EVENT_BUS.post(new RenderWorldLastEvent(context, mat, partialTicks));
}
public static void dispatchRenderLast(WorldRenderer context, MatrixStack mat, float partialTicks, Matrix4f projectionMatrix, long finishTimeNano)
{
MinecraftForge.EVENT_BUS.post(new RenderWorldLastEvent(context, mat, partialTicks, projectionMatrix, finishTimeNano));
@@ -280,10 +274,11 @@ public class ForgeHooksClient
GameSettings settings = Minecraft.getInstance().gameSettings;
int[] ranges = { 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34 };
int distance = 0;
if (settings.fancyGraphics && ranges.length > 0)
{
distance = ranges[MathHelper.clamp(settings.renderDistanceChunks, 0, ranges.length-1)];
}
//TODO, GraphicsFanciness changed, and is getSkyBlendColour used still?
// if (settings.fancyGraphics && ranges.length > 0)
// {
// distance = ranges[MathHelper.clamp(settings.renderDistanceChunks, 0, ranges.length-1)];
// }
int r = 0;
int g = 0;
@@ -320,16 +315,16 @@ public class ForgeHooksClient
//RenderingRegistry.registerBlockHandler(RenderBlockFluid.instance);
}
public static void renderMainMenu(MainMenuScreen gui, FontRenderer font, int width, int height)
public static void renderMainMenu(MainMenuScreen gui, MatrixStack mStack, FontRenderer font, int width, int height)
{
VersionChecker.Status status = ForgeVersion.getStatus();
if (status == BETA || status == BETA_OUTDATED)
{
// render a warning at the top of the screen,
String line = I18n.format("forge.update.beta.1", TextFormatting.RED, TextFormatting.RESET);
gui.drawString(font, line, (width - font.getStringWidth(line)) / 2, 4 + (0 * (font.FONT_HEIGHT + 1)), -1);
line = I18n.format("forge.update.beta.2");
gui.drawString(font, line, (width - font.getStringWidth(line)) / 2, 4 + (1 * (font.FONT_HEIGHT + 1)), -1);
ITextComponent line = new TranslationTextComponent("forge.update.beta.1", TextFormatting.RED, TextFormatting.RESET);
gui.func_238472_a_(mStack, font, line, (width - font.func_238414_a_(line)) / 2, 4 + (0 * (font.FONT_HEIGHT + 1)), -1);
line = new TranslationTextComponent("forge.update.beta.2");
gui.func_238472_a_(mStack, font, line, (width - font.func_238414_a_(line)) / 2, 4 + (1 * (font.FONT_HEIGHT + 1)), -1);
}
String line = null;
@@ -362,11 +357,11 @@ public class ForgeHooksClient
return worldRenderPass;
}
public static void drawScreen(Screen screen, int mouseX, int mouseY, float partialTicks)
public static void drawScreen(Screen screen, MatrixStack mStack, int mouseX, int mouseY, float partialTicks)
{
if (!MinecraftForge.EVENT_BUS.post(new GuiScreenEvent.DrawScreenEvent.Pre(screen, mouseX, mouseY, partialTicks)))
screen.render(mouseX, mouseY, partialTicks);
MinecraftForge.EVENT_BUS.post(new GuiScreenEvent.DrawScreenEvent.Post(screen, mouseX, mouseY, partialTicks));
if (!MinecraftForge.EVENT_BUS.post(new GuiScreenEvent.DrawScreenEvent.Pre(screen, mStack, mouseX, mouseY, partialTicks)))
screen.func_230430_a_(mStack, mouseX, mouseY, partialTicks);
MinecraftForge.EVENT_BUS.post(new GuiScreenEvent.DrawScreenEvent.Post(screen, mStack, mouseX, mouseY, partialTicks));
}
public static float getFogDensity(FogType type, ActiveRenderInfo info, float partial, float density)
@@ -394,11 +389,11 @@ public class ForgeHooksClient
modelLoader.onPostBakeEvent(modelRegistry);
}
private static final net.minecraft.client.renderer.Matrix4f flipX;
private static final net.minecraft.client.renderer.Matrix3f flipXNormal;
private static final Matrix4f flipX;
private static final Matrix3f flipXNormal;
static {
flipX = Matrix4f.makeScale(-1,1,1);
flipXNormal = new net.minecraft.client.renderer.Matrix3f(flipX);
flipXNormal = new Matrix3f(flipX);
}
public static IBakedModel handleCameraTransforms(MatrixStack matrixStack, IBakedModel model, ItemCameraTransforms.TransformType cameraTransformType, boolean leftHandHackery)
@@ -410,8 +405,8 @@ public class ForgeHooksClient
if (!stack.clear())
{
// Apply the transformation to the real matrix stack, flipping for left hand
net.minecraft.client.renderer.Matrix4f tMat = stack.getLast().getMatrix();
net.minecraft.client.renderer.Matrix3f nMat = stack.getLast().getNormal();
Matrix4f tMat = stack.getLast().getMatrix();
Matrix3f nMat = stack.getLast().getNormal();
if (leftHandHackery)
{
tMat.multiplyBackward(flipX);
@@ -532,7 +527,7 @@ public class ForgeHooksClient
}*/
@SuppressWarnings("deprecation")
public static TextureAtlasSprite[] getFluidSprites(ILightReader world, BlockPos pos, IFluidState fluidStateIn)
public static TextureAtlasSprite[] getFluidSprites(IBlockDisplayReader world, BlockPos pos, FluidState fluidStateIn)
{
ResourceLocation overlayTexture = fluidStateIn.getFluid().getAttributes().getOverlayTexture();
return new TextureAtlasSprite[] {
@@ -542,14 +537,14 @@ public class ForgeHooksClient
};
}
public static void gatherFluidTextures(Set<Material> textures)
public static void gatherFluidTextures(Set<RenderMaterial> textures)
{
ForgeRegistries.FLUIDS.getValues().stream()
.flatMap(ForgeHooksClient::getFluidMaterials)
.forEach(textures::add);
}
public static Stream<Material> getFluidMaterials(Fluid fluid)
public static Stream<RenderMaterial> getFluidMaterials(Fluid fluid)
{
return fluid.getAttributes().getTextures()
.filter(Objects::nonNull)
@@ -557,9 +552,9 @@ public class ForgeHooksClient
}
@SuppressWarnings("deprecation")
public static Material getBlockMaterial(ResourceLocation loc)
public static RenderMaterial getBlockMaterial(ResourceLocation loc)
{
return new Material(AtlasTexture.LOCATION_BLOCKS_TEXTURE, loc);
return new RenderMaterial(AtlasTexture.LOCATION_BLOCKS_TEXTURE, loc);
}
/**
@@ -631,17 +626,17 @@ public class ForgeHooksClient
return from.getItem().shouldCauseReequipAnimation(from, to, changed);
}
public static RenderGameOverlayEvent.BossInfo bossBarRenderPre(MainWindow res, ClientBossInfo bossInfo, int x, int y, int increment)
public static RenderGameOverlayEvent.BossInfo bossBarRenderPre(MatrixStack mStack, MainWindow res, ClientBossInfo bossInfo, int x, int y, int increment)
{
RenderGameOverlayEvent.BossInfo evt = new RenderGameOverlayEvent.BossInfo(new RenderGameOverlayEvent(Animation.getPartialTickTime(), res),
RenderGameOverlayEvent.BossInfo evt = new RenderGameOverlayEvent.BossInfo(mStack, new RenderGameOverlayEvent(mStack, Animation.getPartialTickTime(), res),
BOSSINFO, bossInfo, x, y, increment);
MinecraftForge.EVENT_BUS.post(evt);
return evt;
}
public static void bossBarRenderPost(MainWindow res)
public static void bossBarRenderPost(MatrixStack mStack, MainWindow res)
{
MinecraftForge.EVENT_BUS.post(new RenderGameOverlayEvent.Post(new RenderGameOverlayEvent(Animation.getPartialTickTime(), res), BOSSINFO));
MinecraftForge.EVENT_BUS.post(new RenderGameOverlayEvent.Post(mStack, new RenderGameOverlayEvent(mStack, Animation.getPartialTickTime(), res), BOSSINFO));
}
public static ScreenshotEvent onScreenshot(NativeImage image, File screenshotFile)
@@ -19,6 +19,7 @@
package net.minecraftforge.client.event;
import com.mojang.blaze3d.matrix.MatrixStack;
import net.minecraft.client.gui.screen.inventory.ContainerScreen;
import net.minecraftforge.eventbus.api.Event;
@@ -48,6 +49,7 @@ public class GuiContainerEvent extends Event
*/
public static class DrawForeground extends GuiContainerEvent
{
private final MatrixStack mStack;
private final int mouseX;
private final int mouseY;
@@ -55,16 +57,23 @@ public class GuiContainerEvent extends Event
* Called directly after the GuiContainer has drawn any foreground elements.
*
* @param guiContainer The container.
* @param mStack The MatrixStack.
* @param mouseX The current X position of the players mouse.
* @param mouseY The current Y position of the players mouse.
*/
public DrawForeground(ContainerScreen guiContainer, int mouseX, int mouseY)
public DrawForeground(ContainerScreen guiContainer, MatrixStack mStack, int mouseX, int mouseY)
{
super(guiContainer);
this.mStack = mStack;
this.mouseX = mouseX;
this.mouseY = mouseY;
}
public MatrixStack getMatrixStack()
{
return mStack;
}
public int getMouseX()
{
return mouseX;
@@ -82,6 +91,7 @@ public class GuiContainerEvent extends Event
*/
public static class DrawBackground extends GuiContainerEvent
{
private final MatrixStack mStack;
private final int mouseX;
private final int mouseY;
@@ -89,16 +99,23 @@ public class GuiContainerEvent extends Event
* Called directly after the GuiContainer has drawn any background elements.
*
* @param guiContainer The container.
* @param mStack The MatrixStack.
* @param mouseX The current X position of the players mouse.
* @param mouseY The current Y position of the players mouse.
*/
public DrawBackground(ContainerScreen guiContainer, int mouseX, int mouseY)
public DrawBackground(ContainerScreen guiContainer, MatrixStack mStack, int mouseX, int mouseY)
{
super(guiContainer);
this.mStack = mStack;
this.mouseX = mouseX;
this.mouseY = mouseY;
}
public MatrixStack getMatrixStack()
{
return mStack;
}
public int getMouseX()
{
return mouseX;
@@ -24,6 +24,7 @@ import java.util.Collections;
import java.util.List;
import java.util.function.Consumer;
import com.mojang.blaze3d.matrix.MatrixStack;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.IGuiEventListener;
import net.minecraftforge.api.distmarker.Dist;
@@ -127,18 +128,28 @@ public class GuiScreenEvent extends Event
public static class DrawScreenEvent extends GuiScreenEvent
{
private final MatrixStack mStack;
private final int mouseX;
private final int mouseY;
private final float renderPartialTicks;
public DrawScreenEvent(Screen gui, int mouseX, int mouseY, float renderPartialTicks)
public DrawScreenEvent(Screen gui, MatrixStack mStack, int mouseX, int mouseY, float renderPartialTicks)
{
super(gui);
this.mStack = mStack;
this.mouseX = mouseX;
this.mouseY = mouseY;
this.renderPartialTicks = renderPartialTicks;
}
/**
* The MatrixStack to render with.
*/
public MatrixStack getMatrixStack()
{
return mStack;
}
/**
* The x coordinate of the mouse pointer on the screen.
*/
@@ -170,9 +181,9 @@ public class GuiScreenEvent extends Event
@Cancelable
public static class Pre extends DrawScreenEvent
{
public Pre(Screen gui, int mouseX, int mouseY, float renderPartialTicks)
public Pre(Screen gui, MatrixStack mStack, int mouseX, int mouseY, float renderPartialTicks)
{
super(gui, mouseX, mouseY, renderPartialTicks);
super(gui, mStack, mouseX, mouseY, renderPartialTicks);
}
}
@@ -181,9 +192,9 @@ public class GuiScreenEvent extends Event
*/
public static class Post extends DrawScreenEvent
{
public Post(Screen gui, int mouseX, int mouseY, float renderPartialTicks)
public Post(Screen gui, MatrixStack mStack, int mouseX, int mouseY, float renderPartialTicks)
{
super(gui, mouseX, mouseY, renderPartialTicks);
super(gui, mStack, mouseX, mouseY, renderPartialTicks);
}
}
}
@@ -21,6 +21,7 @@ package net.minecraftforge.client.event;
import java.util.ArrayList;
import com.mojang.blaze3d.matrix.MatrixStack;
import net.minecraftforge.eventbus.api.Cancelable;
import net.minecraftforge.eventbus.api.Event;
import net.minecraft.client.MainWindow;
@@ -70,19 +71,22 @@ public class RenderGameOverlayEvent extends Event
VIGNETTE
}
private final MatrixStack mStack;
private final float partialTicks;
private final MainWindow window;
private final ElementType type;
public RenderGameOverlayEvent(float partialTicks, MainWindow window)
public RenderGameOverlayEvent(MatrixStack mStack, float partialTicks, MainWindow window)
{
this.mStack = mStack;
this.partialTicks = partialTicks;
this.window = window;
this.type = null;
}
private RenderGameOverlayEvent(RenderGameOverlayEvent parent, ElementType type)
private RenderGameOverlayEvent(MatrixStack mStack, RenderGameOverlayEvent parent, ElementType type)
{
this.mStack = mStack;
this.partialTicks = parent.getPartialTicks();
this.window = parent.getWindow();
this.type = type;
@@ -90,17 +94,17 @@ public class RenderGameOverlayEvent extends Event
public static class Pre extends RenderGameOverlayEvent
{
public Pre(RenderGameOverlayEvent parent, ElementType type)
public Pre(MatrixStack mStack, RenderGameOverlayEvent parent, ElementType type)
{
super(parent, type);
super(mStack, parent, type);
}
}
public static class Post extends RenderGameOverlayEvent
{
public Post(RenderGameOverlayEvent parent, ElementType type)
public Post(MatrixStack mStack, RenderGameOverlayEvent parent, ElementType type)
{
super(parent, type);
super(mStack, parent, type);
}
@Override public boolean isCancelable(){ return false; }
}
@@ -111,9 +115,9 @@ public class RenderGameOverlayEvent extends Event
private final int x;
private final int y;
private int increment;
public BossInfo(RenderGameOverlayEvent parent, ElementType type, ClientBossInfo bossInfo, int x, int y, int increment)
public BossInfo(MatrixStack mStack, RenderGameOverlayEvent parent, ElementType type, ClientBossInfo bossInfo, int x, int y, int increment)
{
super(parent, type);
super(mStack, parent, type);
this.bossInfo = bossInfo;
this.x = x;
this.y = y;
@@ -166,9 +170,9 @@ public class RenderGameOverlayEvent extends Event
{
private final ArrayList<String> left;
private final ArrayList<String> right;
public Text(RenderGameOverlayEvent parent, ArrayList<String> left, ArrayList<String> right)
public Text(MatrixStack mStack, RenderGameOverlayEvent parent, ArrayList<String> left, ArrayList<String> right)
{
super(parent, ElementType.TEXT);
super(mStack, parent, ElementType.TEXT);
this.left = left;
this.right = right;
}
@@ -189,9 +193,9 @@ public class RenderGameOverlayEvent extends Event
private int posX;
private int posY;
public Chat(RenderGameOverlayEvent parent, int posX, int posY)
public Chat(MatrixStack mStack, RenderGameOverlayEvent parent, int posX, int posY)
{
super(parent, ElementType.CHAT);
super(mStack, parent, ElementType.CHAT);
this.setPosX(posX);
this.setPosY(posY);
}
@@ -19,12 +19,11 @@
package net.minecraftforge.client.event;
import javax.annotation.Nullable;
import com.mojang.blaze3d.matrix.MatrixStack;
import net.minecraft.client.renderer.IRenderTypeBuffer;
import net.minecraft.client.renderer.entity.EntityRenderer;
import net.minecraft.entity.Entity;
import net.minecraft.util.text.ITextComponent;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.EntityEvent;
import net.minecraftforge.eventbus.api.Event;
@@ -53,20 +52,14 @@ import net.minecraftforge.eventbus.api.Event;
public class RenderNameplateEvent extends EntityEvent
{
private String nameplateContent;
private final String originalContent;
private ITextComponent nameplateContent;
private final ITextComponent originalContent;
private final EntityRenderer<?> entityRenderer;
private final MatrixStack matrixStack;
private final IRenderTypeBuffer renderTypeBuffer;
private final int packedLight;
@Deprecated //TODO 1.16: upon removal, also remove @Nullable on getEntityRenderer(), and update its javadoc
public RenderNameplateEvent(Entity entity, String content, MatrixStack matrixStack, IRenderTypeBuffer renderTypeBuffer)
{
this(entity, content, null, matrixStack, renderTypeBuffer, 0);
}
public RenderNameplateEvent(Entity entity, String content, EntityRenderer<?> entityRenderer, MatrixStack matrixStack, IRenderTypeBuffer renderTypeBuffer, int packedLight)
public RenderNameplateEvent(Entity entity, ITextComponent content, EntityRenderer<?> entityRenderer, MatrixStack matrixStack, IRenderTypeBuffer renderTypeBuffer, int packedLight)
{
super(entity);
this.originalContent = content;
@@ -80,7 +73,7 @@ public class RenderNameplateEvent extends EntityEvent
/**
* Sets the content that is to be rendered on the name plate/tag
*/
public void setContent(String contents)
public void setContent(ITextComponent contents)
{
this.nameplateContent = contents;
}
@@ -88,7 +81,7 @@ public class RenderNameplateEvent extends EntityEvent
/**
* The content being rendered on the name plate/tag
*/
public String getContent()
public ITextComponent getContent()
{
return this.nameplateContent;
}
@@ -96,7 +89,7 @@ public class RenderNameplateEvent extends EntityEvent
/**
* The original content being rendered on the name plate/tag
*/
public String getOriginalContent()
public ITextComponent getOriginalContent()
{
return this.originalContent;
}
@@ -104,7 +97,6 @@ public class RenderNameplateEvent extends EntityEvent
/**
* The entity renderer that renders the name plate/tag, if it was provided
*/
@Nullable
public EntityRenderer<?> getEntityRenderer()
{
return this.entityRenderer;
@@ -26,6 +26,7 @@ import javax.annotation.Nonnull;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.text.ITextProperties;
import net.minecraftforge.event.entity.player.ItemTooltipEvent;
import net.minecraftforge.eventbus.api.Cancelable;
import net.minecraftforge.eventbus.api.Event;
@@ -46,12 +47,12 @@ public abstract class RenderTooltipEvent extends net.minecraftforge.eventbus.api
{
@Nonnull
protected final ItemStack stack;
protected final List<String> lines;
protected final List<? extends ITextProperties> lines;
protected int x;
protected int y;
protected FontRenderer fr;
public RenderTooltipEvent(@Nonnull ItemStack stack, @Nonnull List<String> lines, int x, int y, @Nonnull FontRenderer fr)
public RenderTooltipEvent(@Nonnull ItemStack stack, @Nonnull List<? extends ITextProperties> lines, int x, int y, @Nonnull FontRenderer fr)
{
this.stack = stack;
this.lines = Collections.unmodifiableList(lines); // Leave editing to ItemTooltipEvent
@@ -75,7 +76,7 @@ public abstract class RenderTooltipEvent extends net.minecraftforge.eventbus.api
* @return An <i>unmodifiable</i> list of strings. Use {@link ItemTooltipEvent} to modify tooltip text.
*/
@Nonnull
public List<String> getLines()
public List<? extends ITextProperties> getLines()
{
return lines;
}
@@ -117,7 +118,7 @@ public abstract class RenderTooltipEvent extends net.minecraftforge.eventbus.api
private int screenHeight;
private int maxWidth;
public Pre(@Nonnull ItemStack stack, @Nonnull List<String> lines, int x, int y, int screenWidth, int screenHeight, int maxWidth, @Nonnull FontRenderer fr)
public Pre(@Nonnull ItemStack stack, @Nonnull List<? extends ITextProperties> lines, int x, int y, int screenWidth, int screenHeight, int maxWidth, @Nonnull FontRenderer fr)
{
super(stack, lines, x, y, fr);
this.screenWidth = screenWidth;
@@ -200,7 +201,7 @@ public abstract class RenderTooltipEvent extends net.minecraftforge.eventbus.api
private final int width;
private final int height;
public Post(@Nonnull ItemStack stack, @Nonnull List<String> textLines, int x, int y, @Nonnull FontRenderer fr, int width, int height)
public Post(@Nonnull ItemStack stack, @Nonnull List<? extends ITextProperties> textLines, int x, int y, @Nonnull FontRenderer fr, int width, int height)
{
super(stack, textLines, x, y, fr);
this.width = width;
@@ -229,7 +230,7 @@ public abstract class RenderTooltipEvent extends net.minecraftforge.eventbus.api
*/
public static class PostBackground extends Post
{
public PostBackground(@Nonnull ItemStack stack, @Nonnull List<String> textLines, int x, int y, @Nonnull FontRenderer fr, int width, int height)
public PostBackground(@Nonnull ItemStack stack, @Nonnull List<? extends ITextProperties> textLines, int x, int y, @Nonnull FontRenderer fr, int width, int height)
{ super(stack, textLines, x, y, fr, width, height); }
}
@@ -238,7 +239,7 @@ public abstract class RenderTooltipEvent extends net.minecraftforge.eventbus.api
*/
public static class PostText extends Post
{
public PostText(@Nonnull ItemStack stack, @Nonnull List<String> textLines, int x, int y, @Nonnull FontRenderer fr, int width, int height)
public PostText(@Nonnull ItemStack stack, @Nonnull List<? extends ITextProperties> textLines, int x, int y, @Nonnull FontRenderer fr, int width, int height)
{ super(stack, textLines, x, y, fr, width, height); }
}
@@ -254,7 +255,7 @@ public abstract class RenderTooltipEvent extends net.minecraftforge.eventbus.api
private int borderStart;
private int borderEnd;
public Color(@Nonnull ItemStack stack, @Nonnull List<String> textLines, int x, int y, @Nonnull FontRenderer fr, int background, int borderStart,
public Color(@Nonnull ItemStack stack, @Nonnull List<? extends ITextProperties> textLines, int x, int y, @Nonnull FontRenderer fr, int background, int borderStart,
int borderEnd)
{
super(stack, textLines, x, y, fr);
@@ -21,8 +21,8 @@ package net.minecraftforge.client.event;
import com.mojang.blaze3d.matrix.MatrixStack;
import net.minecraft.client.renderer.Matrix4f;
import net.minecraft.client.renderer.WorldRenderer;
import net.minecraft.util.math.vector.Matrix4f;
public class RenderWorldLastEvent extends net.minecraftforge.eventbus.api.Event
{
@@ -32,16 +32,6 @@ public class RenderWorldLastEvent extends net.minecraftforge.eventbus.api.Event
private final Matrix4f projectionMatrix;
private final long finishTimeNano;
@Deprecated // TODO: Remove in 1.16
public RenderWorldLastEvent(WorldRenderer context, MatrixStack mat, float partialTicks)
{
this.context = context;
this.mat = mat;
this.partialTicks = partialTicks;
this.projectionMatrix = null;
this.finishTimeNano = 0;
}
public RenderWorldLastEvent(WorldRenderer context, MatrixStack mat, float partialTicks, Matrix4f projectionMatrix, long finishTimeNano)
{
this.context = context;
@@ -34,7 +34,7 @@ import net.minecraft.client.renderer.model.ItemCameraTransforms;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.util.Direction;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.ILightReader;
import net.minecraft.world.IBlockDisplayReader;
import net.minecraftforge.client.model.data.IModelData;
public interface IForgeBakedModel
@@ -66,7 +66,7 @@ public interface IForgeBakedModel
return net.minecraftforge.client.ForgeHooksClient.handlePerspective(getBakedModel(), cameraTransformType, mat);
}
default @Nonnull IModelData getModelData(@Nonnull ILightReader world, @Nonnull BlockPos pos, @Nonnull BlockState state, @Nonnull IModelData tileData)
default @Nonnull IModelData getModelData(@Nonnull IBlockDisplayReader world, @Nonnull BlockPos pos, @Nonnull BlockState state, @Nonnull IModelData tileData)
{
return tileData;
}
@@ -19,7 +19,7 @@
package net.minecraftforge.client.extensions;
import net.minecraft.client.renderer.TransformationMatrix;
import net.minecraft.util.math.vector.TransformationMatrix;
/**
* An {@code IModelState} is a function from model part to a transformation that should be applied
@@ -20,8 +20,8 @@
package net.minecraftforge.client.extensions;
import com.mojang.blaze3d.matrix.MatrixStack;
import net.minecraft.client.renderer.*;
import net.minecraft.util.Direction;
import net.minecraft.util.math.vector.*;
/*
* Replacement interface for ModelRotation to allow custom transformations of vanilla models.
@@ -23,13 +23,9 @@ import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.vertex.IVertexBuilder;
import net.minecraft.client.renderer.LightTexture;
import net.minecraft.client.renderer.Matrix3f;
import net.minecraft.client.renderer.Matrix4f;
import net.minecraft.client.renderer.Vector3f;
import net.minecraft.client.renderer.Vector4f;
import net.minecraft.client.renderer.model.BakedQuad;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.util.math.Vec3i;
import net.minecraft.util.math.vector.*;
import net.minecraftforge.client.model.pipeline.LightUtil;
import org.lwjgl.system.MemoryStack;
@@ -60,7 +56,7 @@ public interface IForgeVertexBuilder
// Copy of addQuad with alpha support
default void addVertexData(MatrixStack.Entry matrixEntry, BakedQuad bakedQuad, float[] baseBrightness, float red, float green, float blue, float alpha, int[] lightmapCoords, int overlayCoords, boolean readExistingColor) {
int[] aint = bakedQuad.getVertexData();
Vec3i faceNormal = bakedQuad.getFace().getDirectionVec();
Vector3i faceNormal = bakedQuad.getFace().getDirectionVec();
Vector3f normal = new Vector3f((float)faceNormal.getX(), (float)faceNormal.getY(), (float)faceNormal.getZ());
Matrix4f matrix4f = matrixEntry.getMatrix();
normal.transform(matrixEntry.getNormal());
@@ -24,6 +24,7 @@ import static net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType
import java.util.ArrayList;
import java.util.List;
import com.mojang.blaze3d.matrix.MatrixStack;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.AbstractGui;
@@ -33,8 +34,8 @@ import net.minecraft.client.network.play.ClientPlayNetHandler;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.Entity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.attributes.IAttributeInstance;
import net.minecraft.entity.ai.attributes.Attributes;
import net.minecraft.entity.ai.attributes.ModifiableAttributeInstance;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.block.Blocks;
import net.minecraft.potion.Effects;
@@ -105,11 +106,11 @@ public class ForgeIngameGui extends IngameGui
}
@Override
public void renderGameOverlay(float partialTicks)
public void func_238445_a_(MatrixStack mStack, float partialTicks)
{
this.scaledWidth = this.mc.getMainWindow().getScaledWidth();
this.scaledHeight = this.mc.getMainWindow().getScaledHeight();
eventParent = new RenderGameOverlayEvent(partialTicks, this.mc.getMainWindow());
eventParent = new RenderGameOverlayEvent(mStack, partialTicks, this.mc.getMainWindow());
renderHealthMount = mc.player.getRidingEntity() instanceof LivingEntity;
renderFood = mc.player.getRidingEntity() == null;
renderJumpBar = mc.player.isRidingHorse();
@@ -117,7 +118,7 @@ public class ForgeIngameGui extends IngameGui
right_height = 39;
left_height = 39;
if (pre(ALL)) return;
if (pre(ALL, mStack)) return;
fontrenderer = mc.fontRenderer;
//mc.entityRenderer.setupOverlayRendering();
@@ -132,7 +133,7 @@ public class ForgeIngameGui extends IngameGui
RenderSystem.defaultBlendFunc();
}
if (renderHelmet) renderHelmet(partialTicks);
if (renderHelmet) renderHelmet(partialTicks, mStack);
if (renderPortal && !mc.player.isPotionActive(Effects.NAUSEA))
{
@@ -141,55 +142,55 @@ public class ForgeIngameGui extends IngameGui
if (this.mc.playerController.getCurrentGameType() == GameType.SPECTATOR)
{
if (renderSpectatorTooltip) spectatorGui.renderTooltip(partialTicks);
if (renderSpectatorTooltip) spectatorGui.func_238528_a_(mStack, partialTicks);
}
else if (!this.mc.gameSettings.hideGUI)
{
if (renderHotbar) renderHotbar(partialTicks);
if (renderHotbar) func_238443_a_(partialTicks, mStack);
}
if (!this.mc.gameSettings.hideGUI) {
RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
setBlitOffset(-90);
func_230926_e_(-90);
rand.setSeed((long)(ticks * 312871));
if (renderCrosshairs) renderAttackIndicator();
if (renderBossHealth) renderBossHealth();
if (renderCrosshairs) func_238456_d_(mStack);
if (renderBossHealth) renderBossHealth(mStack);
RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
if (this.mc.playerController.shouldDrawHUD() && this.mc.getRenderViewEntity() instanceof PlayerEntity)
{
if (renderHealth) renderHealth(this.scaledWidth, this.scaledHeight);
if (renderArmor) renderArmor(this.scaledWidth, this.scaledHeight);
if (renderFood) renderFood(this.scaledWidth, this.scaledHeight);
if (renderHealthMount) renderHealthMount(this.scaledWidth, this.scaledHeight);
if (renderAir) renderAir(this.scaledWidth, this.scaledHeight);
if (renderHealth) renderHealth(this.scaledWidth, this.scaledHeight, mStack);
if (renderArmor) renderArmor(mStack, this.scaledWidth, this.scaledHeight);
if (renderFood) renderFood(this.scaledWidth, this.scaledHeight, mStack);
if (renderHealthMount) renderHealthMount(this.scaledWidth, this.scaledHeight, mStack);
if (renderAir) renderAir(this.scaledWidth, this.scaledHeight, mStack);
}
if (renderJumpBar)
{
renderHorseJumpBar(this.scaledWidth / 2 - 91);
func_238446_a_(mStack, this.scaledWidth / 2 - 91);
}
else if (renderExperiance)
{
renderExperience(this.scaledWidth / 2 - 91);
renderExperience(this.scaledWidth / 2 - 91, mStack);
}
if (this.mc.gameSettings.heldItemTooltips && this.mc.playerController.getCurrentGameType() != GameType.SPECTATOR) {
this.renderSelectedItem();
this.func_238453_b_(mStack);
} else if (this.mc.player.isSpectator()) {
this.spectatorGui.renderSelectedItem();
this.spectatorGui.func_238527_a_(mStack);
}
}
renderSleepFade(this.scaledWidth, this.scaledHeight);
renderSleepFade(this.scaledWidth, this.scaledHeight, mStack);
renderHUDText(this.scaledWidth, this.scaledHeight);
renderFPSGraph();
renderPotionEffects();
renderHUDText(this.scaledWidth, this.scaledHeight, mStack);
renderFPSGraph(mStack);
func_238444_a_(mStack);
if (!mc.gameSettings.hideGUI) {
renderRecordOverlay(this.scaledWidth, this.scaledHeight, partialTicks);
renderSubtitles();
renderTitle(this.scaledWidth, this.scaledHeight, partialTicks);
renderRecordOverlay(this.scaledWidth, this.scaledHeight, partialTicks, mStack);
renderSubtitles(mStack);
renderTitle(this.scaledWidth, this.scaledHeight, partialTicks, mStack);
}
@@ -204,66 +205,67 @@ public class ForgeIngameGui extends IngameGui
ScoreObjective scoreobjective1 = objective != null ? objective : scoreboard.getObjectiveInDisplaySlot(1);
if (renderObjective && scoreobjective1 != null)
{
this.renderScoreboard(scoreobjective1);
this.func_238447_a_(mStack, scoreobjective1);
}
RenderSystem.enableBlend();
RenderSystem.blendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0);
RenderSystem.disableAlphaTest();
renderChat(this.scaledWidth, this.scaledHeight);
renderChat(this.scaledWidth, this.scaledHeight, mStack);
renderPlayerList(this.scaledWidth, this.scaledHeight);
renderPlayerList(this.scaledWidth, this.scaledHeight, mStack);
RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
RenderSystem.enableAlphaTest();
post(ALL);
post(ALL, mStack);
}
@Override
protected void renderAttackIndicator()
protected void func_238456_d_(MatrixStack mStack)
{
if (pre(CROSSHAIRS)) return;
bind(AbstractGui.GUI_ICONS_LOCATION);
if (pre(CROSSHAIRS, mStack)) return;
bind(AbstractGui.field_230665_h_);
RenderSystem.enableBlend();
RenderSystem.enableAlphaTest();
super.renderAttackIndicator();
post(CROSSHAIRS);
super.func_238456_d_(mStack);
post(CROSSHAIRS, mStack);
}
@Override
protected void renderPotionEffects()
protected void func_238444_a_(MatrixStack mStack)
{
if (pre(POTION_ICONS)) return;
super.renderPotionEffects();
post(POTION_ICONS);
if (pre(POTION_ICONS, mStack)) return;
super.func_238444_a_(mStack);
post(POTION_ICONS, mStack);
}
protected void renderSubtitles()
protected void renderSubtitles(MatrixStack mStack)
{
if (pre(SUBTITLES)) return;
this.overlaySubtitle.render();
post(SUBTITLES);
if (pre(SUBTITLES, mStack)) return;
this.overlaySubtitle.render(mStack);
post(SUBTITLES, mStack);
}
protected void renderBossHealth()
protected void renderBossHealth(MatrixStack mStack)
{
if (pre(BOSSHEALTH)) return;
bind(AbstractGui.GUI_ICONS_LOCATION);
if (pre(BOSSHEALTH, mStack)) return;
bind(AbstractGui.field_230665_h_);
RenderSystem.defaultBlendFunc();
mc.getProfiler().startSection("bossHealth");
RenderSystem.enableBlend();
this.overlayBoss.render();
this.overlayBoss.func_238484_a_(mStack);
RenderSystem.disableBlend();
mc.getProfiler().endSection();
post(BOSSHEALTH);
post(BOSSHEALTH, mStack);
}
@Override
protected void renderVignette(Entity entity)
{
if (pre(VIGNETTE))
MatrixStack mStack = new MatrixStack();
if (pre(VIGNETTE, mStack))
{
// Need to put this here, since Vanilla assumes this state after the vignette was rendered.
RenderSystem.enableDepthTest();
@@ -271,12 +273,13 @@ public class ForgeIngameGui extends IngameGui
return;
}
super.renderVignette(entity);
post(VIGNETTE);
post(VIGNETTE, mStack);
}
private void renderHelmet(float partialTicks)
private void renderHelmet(float partialTicks, MatrixStack mStack)
{
if (pre(HELMET)) return;
if (pre(HELMET, mStack)) return;
ItemStack itemstack = this.mc.player.inventory.armorItemInSlot(3);
@@ -293,12 +296,12 @@ public class ForgeIngameGui extends IngameGui
}
}
post(HELMET);
post(HELMET, mStack);
}
protected void renderArmor(int width, int height)
protected void renderArmor(MatrixStack mStack, int width, int height)
{
if (pre(ARMOR)) return;
if (pre(ARMOR, mStack)) return;
mc.getProfiler().startSection("armor");
RenderSystem.enableBlend();
@@ -310,15 +313,15 @@ public class ForgeIngameGui extends IngameGui
{
if (i < level)
{
blit(left, top, 34, 9, 9, 9);
func_238474_b_(mStack, left, top, 34, 9, 9, 9);
}
else if (i == level)
{
blit(left, top, 25, 9, 9, 9);
func_238474_b_(mStack, left, top, 25, 9, 9, 9);
}
else if (i > level)
{
blit(left, top, 16, 9, 9, 9);
func_238474_b_(mStack, left, top, 16, 9, 9, 9);
}
left += 8;
}
@@ -326,13 +329,14 @@ public class ForgeIngameGui extends IngameGui
RenderSystem.disableBlend();
mc.getProfiler().endSection();
post(ARMOR);
post(ARMOR, mStack);
}
@Override
protected void renderPortal(float partialTicks)
{
if (pre(PORTAL)) return;
MatrixStack mStack = new MatrixStack();
if (pre(PORTAL, mStack)) return;
float f1 = mc.player.prevTimeInPortal + (mc.player.timeInPortal - mc.player.prevTimeInPortal) * partialTicks;
@@ -341,35 +345,29 @@ public class ForgeIngameGui extends IngameGui
super.renderPortal(f1);
}
post(PORTAL);
post(PORTAL, mStack);
}
@Override
protected void renderHotbar(float partialTicks)
protected void func_238443_a_(float partialTicks, MatrixStack mStack)
{
if (pre(HOTBAR)) return;
if (pre(HOTBAR, mStack)) return;
if (mc.playerController.getCurrentGameType() == GameType.SPECTATOR)
{
this.spectatorGui.renderTooltip(partialTicks);
this.spectatorGui.func_238528_a_(mStack, partialTicks);
}
else
{
super.renderHotbar(partialTicks);
super.func_238443_a_(partialTicks, mStack);
}
post(HOTBAR);
post(HOTBAR, mStack);
}
@Override
public void setOverlayMessage(ITextComponent component, boolean animateColor)
protected void renderAir(int width, int height, MatrixStack mStack)
{
this.setOverlayMessage(component.getFormattedText(), animateColor);
}
protected void renderAir(int width, int height)
{
if (pre(AIR)) return;
if (pre(AIR, mStack)) return;
mc.getProfiler().startSection("air");
PlayerEntity player = (PlayerEntity)this.mc.getRenderViewEntity();
RenderSystem.enableBlend();
@@ -384,20 +382,20 @@ public class ForgeIngameGui extends IngameGui
for (int i = 0; i < full + partial; ++i)
{
blit(left - i * 8 - 9, top, (i < full ? 16 : 25), 18, 9, 9);
func_238474_b_(mStack, left - i * 8 - 9, top, (i < full ? 16 : 25), 18, 9, 9);
}
right_height += 10;
}
RenderSystem.disableBlend();
mc.getProfiler().endSection();
post(AIR);
post(AIR, mStack);
}
public void renderHealth(int width, int height)
public void renderHealth(int width, int height, MatrixStack mStack)
{
bind(GUI_ICONS_LOCATION);
if (pre(HEALTH)) return;
bind(field_230665_h_);
if (pre(HEALTH, mStack)) return;
mc.getProfiler().startSection("health");
RenderSystem.enableBlend();
@@ -426,7 +424,7 @@ public class ForgeIngameGui extends IngameGui
this.playerHealth = health;
int healthLast = this.lastPlayerHealth;
IAttributeInstance attrMaxHealth = player.getAttribute(SharedMonsterAttributes.MAX_HEALTH);
ModifiableAttributeInstance attrMaxHealth = player.getAttribute(Attributes.field_233818_a_);
float healthMax = (float)attrMaxHealth.getValue();
float absorb = MathHelper.ceil(player.getAbsorptionAmount());
@@ -463,46 +461,46 @@ public class ForgeIngameGui extends IngameGui
if (health <= 4) y += rand.nextInt(2);
if (i == regen) y -= 2;
blit(x, y, BACKGROUND, TOP, 9, 9);
func_238474_b_(mStack, x, y, BACKGROUND, TOP, 9, 9);
if (highlight)
{
if (i * 2 + 1 < healthLast)
blit(x, y, MARGIN + 54, TOP, 9, 9); //6
func_238474_b_(mStack, x, y, MARGIN + 54, TOP, 9, 9); //6
else if (i * 2 + 1 == healthLast)
blit(x, y, MARGIN + 63, TOP, 9, 9); //7
func_238474_b_(mStack, x, y, MARGIN + 63, TOP, 9, 9); //7
}
if (absorbRemaining > 0.0F)
{
if (absorbRemaining == absorb && absorb % 2.0F == 1.0F)
{
blit(x, y, MARGIN + 153, TOP, 9, 9); //17
func_238474_b_(mStack, x, y, MARGIN + 153, TOP, 9, 9); //17
absorbRemaining -= 1.0F;
}
else
{
blit(x, y, MARGIN + 144, TOP, 9, 9); //16
func_238474_b_(mStack, x, y, MARGIN + 144, TOP, 9, 9); //16
absorbRemaining -= 2.0F;
}
}
else
{
if (i * 2 + 1 < health)
blit(x, y, MARGIN + 36, TOP, 9, 9); //4
func_238474_b_(mStack, x, y, MARGIN + 36, TOP, 9, 9); //4
else if (i * 2 + 1 == health)
blit(x, y, MARGIN + 45, TOP, 9, 9); //5
func_238474_b_(mStack, x, y, MARGIN + 45, TOP, 9, 9); //5
}
}
RenderSystem.disableBlend();
mc.getProfiler().endSection();
post(HEALTH);
post(HEALTH, mStack);
}
public void renderFood(int width, int height)
public void renderFood(int width, int height, MatrixStack mStack)
{
if (pre(FOOD)) return;
if (pre(FOOD, mStack)) return;
mc.getProfiler().startSection("food");
PlayerEntity player = (PlayerEntity)this.mc.getRenderViewEntity();
@@ -535,19 +533,19 @@ public class ForgeIngameGui extends IngameGui
y = top + (rand.nextInt(3) - 1);
}
blit(x, y, 16 + background * 9, 27, 9, 9);
func_238474_b_(mStack, x, y, 16 + background * 9, 27, 9, 9);
if (idx < level)
blit(x, y, icon + 36, 27, 9, 9);
func_238474_b_(mStack, x, y, icon + 36, 27, 9, 9);
else if (idx == level)
blit(x, y, icon + 45, 27, 9, 9);
func_238474_b_(mStack, x, y, icon + 45, 27, 9, 9);
}
RenderSystem.disableBlend();
mc.getProfiler().endSection();
post(FOOD);
post(FOOD, mStack);
}
protected void renderSleepFade(int width, int height)
protected void renderSleepFade(int width, int height, MatrixStack mStack)
{
if (mc.player.getSleepTimer() > 0)
{
@@ -563,48 +561,48 @@ public class ForgeIngameGui extends IngameGui
}
int color = (int)(220.0F * opacity) << 24 | 1052704;
fill(0, 0, width, height, color);
func_238467_a_(mStack, 0, 0, width, height, color);
RenderSystem.enableAlphaTest();
RenderSystem.enableDepthTest();
mc.getProfiler().endSection();
}
}
protected void renderExperience(int x)
protected void renderExperience(int x, MatrixStack mStack)
{
bind(GUI_ICONS_LOCATION);
if (pre(EXPERIENCE)) return;
bind(field_230665_h_);
if (pre(EXPERIENCE, mStack)) return;
RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
RenderSystem.disableBlend();
if (mc.playerController.gameIsSurvivalOrAdventure())
{
super.renderExpBar(x);
super.func_238454_b_(mStack, x);
}
RenderSystem.enableBlend();
RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
post(EXPERIENCE);
post(EXPERIENCE, mStack);
}
@Override
public void renderHorseJumpBar(int x)
public void func_238446_a_(MatrixStack mStack, int x)
{
bind(GUI_ICONS_LOCATION);
if (pre(JUMPBAR)) return;
bind(field_230665_h_);
if (pre(JUMPBAR, mStack)) return;
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
RenderSystem.disableBlend();
super.renderHorseJumpBar(x);
super.func_238446_a_(mStack, x);
RenderSystem.enableBlend();
mc.getProfiler().endSection();
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
post(JUMPBAR);
post(JUMPBAR, mStack);
}
protected void renderHUDText(int width, int height)
protected void renderHUDText(int width, int height, MatrixStack mStack)
{
mc.getProfiler().startSection("forgeHudText");
RenderSystem.defaultBlendFunc();
@@ -624,23 +622,23 @@ public class ForgeIngameGui extends IngameGui
}
}
if (this.mc.gameSettings.showDebugInfo && !pre(DEBUG))
if (this.mc.gameSettings.showDebugInfo && !pre(DEBUG, mStack))
{
debugOverlay.update();
listL.addAll(debugOverlay.getLeft());
listR.addAll(debugOverlay.getRight());
post(DEBUG);
post(DEBUG, mStack);
}
RenderGameOverlayEvent.Text event = new RenderGameOverlayEvent.Text(eventParent, listL, listR);
RenderGameOverlayEvent.Text event = new RenderGameOverlayEvent.Text(mStack, eventParent, listL, listR);
if (!MinecraftForge.EVENT_BUS.post(event))
{
int top = 2;
for (String msg : listL)
{
if (msg == null) continue;
fill(1, top - 1, 2 + fontrenderer.getStringWidth(msg) + 1, top + fontrenderer.FONT_HEIGHT - 1, -1873784752);
fontrenderer.drawStringWithShadow(msg, 2, top, 14737632);
func_238467_a_(mStack, 1, top - 1, 2 + fontrenderer.getStringWidth(msg) + 1, top + fontrenderer.FONT_HEIGHT - 1, -1873784752);
fontrenderer.func_238421_b_(mStack, msg, 2, top, 14737632);
top += fontrenderer.FONT_HEIGHT;
}
@@ -650,26 +648,26 @@ public class ForgeIngameGui extends IngameGui
if (msg == null) continue;
int w = fontrenderer.getStringWidth(msg);
int left = width - 2 - w;
fill(left - 1, top - 1, left + w + 1, top + fontrenderer.FONT_HEIGHT - 1, -1873784752);
fontrenderer.drawStringWithShadow(msg, left, top, 14737632);
func_238467_a_(mStack, left - 1, top - 1, left + w + 1, top + fontrenderer.FONT_HEIGHT - 1, -1873784752);
fontrenderer.func_238421_b_(mStack, msg, left, top, 14737632);
top += fontrenderer.FONT_HEIGHT;
}
}
mc.getProfiler().endSection();
post(TEXT);
post(TEXT, mStack);
}
protected void renderFPSGraph()
protected void renderFPSGraph(MatrixStack mStack)
{
if (this.mc.gameSettings.showDebugInfo && this.mc.gameSettings.showLagometer && !pre(FPS_GRAPH))
if (this.mc.gameSettings.showDebugInfo && this.mc.gameSettings.showLagometer && !pre(FPS_GRAPH, mStack))
{
this.debugOverlay.render();
post(FPS_GRAPH);
this.debugOverlay.render(mStack);
post(FPS_GRAPH, mStack);
}
}
protected void renderRecordOverlay(int width, int height, float partialTicks)
protected void renderRecordOverlay(int width, int height, float partialTicks, MatrixStack mStack)
{
if (overlayMessageTime > 0)
{
@@ -685,8 +683,8 @@ public class ForgeIngameGui extends IngameGui
RenderSystem.enableBlend();
RenderSystem.defaultBlendFunc();
int color = (animateOverlayMessageColor ? MathHelper.hsvToRGB(hue / 50.0F, 0.7F, 0.6F) & WHITE : WHITE);
renderTextBackground(fontrenderer, -4, fontrenderer.getStringWidth(overlayMessage));
fontrenderer.drawString(overlayMessage, -fontrenderer.getStringWidth(overlayMessage) / 2, -4, color | (opacity << 24));
func_238448_a_(mStack, fontrenderer, -4, fontrenderer.func_238414_a_(overlayMessage), 16777215 | (opacity << 24));
fontrenderer.func_238422_b_(mStack, overlayMessage, -fontrenderer.func_238414_a_(overlayMessage) / 2, -4, color | (opacity << 24));
RenderSystem.disableBlend();
RenderSystem.popMatrix();
}
@@ -695,7 +693,7 @@ public class ForgeIngameGui extends IngameGui
}
}
protected void renderTitle(int width, int height, float partialTicks)
protected void renderTitle(int width, int height, float partialTicks, MatrixStack mStack)
{
if (titlesTimer > 0)
{
@@ -721,11 +719,11 @@ public class ForgeIngameGui extends IngameGui
RenderSystem.pushMatrix();
RenderSystem.scalef(4.0F, 4.0F, 4.0F);
int l = opacity << 24 & -16777216;
this.getFontRenderer().drawStringWithShadow(this.displayedTitle, (float)(-this.getFontRenderer().getStringWidth(this.displayedTitle) / 2), -10.0F, 16777215 | l);
this.getFontRenderer().func_238407_a_(mStack, this.displayedTitle, (float)(-this.getFontRenderer().func_238414_a_(this.displayedTitle) / 2), -10.0F, 16777215 | l);
RenderSystem.popMatrix();
RenderSystem.pushMatrix();
RenderSystem.scalef(2.0F, 2.0F, 2.0F);
this.getFontRenderer().drawStringWithShadow(this.displayedSubTitle, (float)(-this.getFontRenderer().getStringWidth(this.displayedSubTitle) / 2), 5.0F, 16777215 | l);
this.getFontRenderer().func_238407_a_(mStack, this.displayedSubTitle, (float)(-this.getFontRenderer().func_238414_a_(this.displayedSubTitle) / 2), 5.0F, 16777215 | l);
RenderSystem.popMatrix();
RenderSystem.disableBlend();
RenderSystem.popMatrix();
@@ -735,24 +733,24 @@ public class ForgeIngameGui extends IngameGui
}
}
protected void renderChat(int width, int height)
protected void renderChat(int width, int height, MatrixStack mStack)
{
mc.getProfiler().startSection("chat");
RenderGameOverlayEvent.Chat event = new RenderGameOverlayEvent.Chat(eventParent, 0, height - 48);
RenderGameOverlayEvent.Chat event = new RenderGameOverlayEvent.Chat(mStack, eventParent, 0, height - 48);
if (MinecraftForge.EVENT_BUS.post(event)) return;
RenderSystem.pushMatrix();
RenderSystem.translatef((float) event.getPosX(), (float) event.getPosY(), 0.0F);
persistantChatGUI.render(ticks);
persistantChatGUI.func_238492_a_(mStack, ticks);
RenderSystem.popMatrix();
post(CHAT);
post(CHAT, mStack);
mc.getProfiler().endSection();
}
protected void renderPlayerList(int width, int height)
protected void renderPlayerList(int width, int height, MatrixStack mStack)
{
ScoreObjective scoreobjective = this.mc.world.getScoreboard().getObjectiveInDisplaySlot(0);
ClientPlayNetHandler handler = mc.player.connection;
@@ -760,9 +758,9 @@ public class ForgeIngameGui extends IngameGui
if (mc.gameSettings.keyBindPlayerList.isKeyDown() && (!mc.isIntegratedServerRunning() || handler.getPlayerInfoMap().size() > 1 || scoreobjective != null))
{
this.overlayPlayerList.setVisible(true);
if (pre(PLAYER_LIST)) return;
this.overlayPlayerList.render(width, this.mc.world.getScoreboard(), scoreobjective);
post(PLAYER_LIST);
if (pre(PLAYER_LIST, mStack)) return;
this.overlayPlayerList.func_238523_a_(mStack, width, this.mc.world.getScoreboard(), scoreobjective);
post(PLAYER_LIST, mStack);
}
else
{
@@ -770,15 +768,15 @@ public class ForgeIngameGui extends IngameGui
}
}
protected void renderHealthMount(int width, int height)
protected void renderHealthMount(int width, int height, MatrixStack mStack)
{
PlayerEntity player = (PlayerEntity)mc.getRenderViewEntity();
Entity tmp = player.getRidingEntity();
if (!(tmp instanceof LivingEntity)) return;
bind(GUI_ICONS_LOCATION);
bind(field_230665_h_);
if (pre(HEALTHMOUNT)) return;
if (pre(HEALTHMOUNT, mStack)) return;
boolean unused = false;
int left_align = width / 2 + 91;
@@ -807,28 +805,28 @@ public class ForgeIngameGui extends IngameGui
for (int i = 0; i < rowCount; ++i)
{
int x = left_align - i * 8 - 9;
blit(x, top, BACKGROUND, 9, 9, 9);
func_238474_b_(mStack, x, top, BACKGROUND, 9, 9, 9);
if (i * 2 + 1 + heart < health)
blit(x, top, FULL, 9, 9, 9);
func_238474_b_(mStack, x, top, FULL, 9, 9, 9);
else if (i * 2 + 1 + heart == health)
blit(x, top, HALF, 9, 9, 9);
func_238474_b_(mStack, x, top, HALF, 9, 9, 9);
}
right_height += 10;
}
RenderSystem.disableBlend();
post(HEALTHMOUNT);
post(HEALTHMOUNT, mStack);
}
//Helper macros
private boolean pre(ElementType type)
private boolean pre(ElementType type, MatrixStack mStack)
{
return MinecraftForge.EVENT_BUS.post(new RenderGameOverlayEvent.Pre(eventParent, type));
return MinecraftForge.EVENT_BUS.post(new RenderGameOverlayEvent.Pre(mStack, eventParent, type));
}
private void post(ElementType type)
private void post(ElementType type, MatrixStack mStack)
{
MinecraftForge.EVENT_BUS.post(new RenderGameOverlayEvent.Post(eventParent, type));
MinecraftForge.EVENT_BUS.post(new RenderGameOverlayEvent.Post(mStack, eventParent, type));
}
private void bind(ResourceLocation res)
{
@@ -849,8 +847,8 @@ public class ForgeIngameGui extends IngameGui
this.rayTraceBlock = entity.pick(rayTraceDistance, 0.0F, false);
this.rayTraceFluid = entity.pick(rayTraceDistance, 0.0F, true);
}
@Override protected void renderDebugInfoLeft(){}
@Override protected void renderDebugInfoRight(){}
@Override protected void renderDebugInfoLeft(MatrixStack mStack){}
@Override protected void renderDebugInfoRight(MatrixStack mStack){}
private List<String> getLeft()
{
List<String> ret = this.getDebugInfoLeft();
@@ -19,6 +19,7 @@
package net.minecraftforge.client.gui;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.systems.RenderSystem;
import net.minecraft.client.Minecraft;
@@ -51,7 +52,7 @@ public class NotificationModUpdateScreen extends Screen
}
@Override
public void init()
public void func_231160_c_()
{
if (!hasCheckedForUpdates)
{
@@ -64,7 +65,7 @@ public class NotificationModUpdateScreen extends Screen
}
@Override
public void render(int mouseX, int mouseY, float partialTicks)
public void func_230430_a_(MatrixStack mStack, int mouseX, int mouseY, float partialTicks)
{
if (showNotification == null || !showNotification.shouldDraw() || !FMLConfig.runVersionCheck())
{
@@ -73,22 +74,20 @@ public class NotificationModUpdateScreen extends Screen
Minecraft.getInstance().getTextureManager().bindTexture(VERSION_CHECK_ICONS);
RenderSystem.color4f(1, 1, 1, 1);
RenderSystem.pushMatrix();
int x = modButton.x;
int y = modButton.y;
int w = modButton.getWidth();
int x = modButton.field_230690_l_;
int y = modButton.field_230691_m_;
int w = modButton.func_230998_h_();
int h = modButton.getHeight();
blit(x + w - (h / 2 + 4), y + (h / 2 - 4), showNotification.getSheetOffset() * 8, (showNotification.isAnimated() && ((System.currentTimeMillis() / 800 & 1) == 1)) ? 8 : 0, 8, 8, 64, 16);
RenderSystem.popMatrix();
func_238463_a_(mStack, x + w - (h / 2 + 4), y + (h / 2 - 4), showNotification.getSheetOffset() * 8, (showNotification.isAnimated() && ((System.currentTimeMillis() / 800 & 1) == 1)) ? 8 : 0, 8, 8, 64, 16);
}
public static NotificationModUpdateScreen init(MainMenuScreen guiMainMenu, Button modButton)
{
NotificationModUpdateScreen notificationModUpdateScreen = new NotificationModUpdateScreen(modButton);
notificationModUpdateScreen.init(guiMainMenu.getMinecraft(), guiMainMenu.width, guiMainMenu.height);
notificationModUpdateScreen.init();
notificationModUpdateScreen.func_231152_a_(guiMainMenu.getMinecraft(), guiMainMenu.field_230708_k_, guiMainMenu.field_230709_l_);
notificationModUpdateScreen.func_231160_c_();
return notificationModUpdateScreen;
}
@@ -24,6 +24,7 @@ import java.util.List;
import org.lwjgl.opengl.GL11;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.systems.RenderSystem;
import net.minecraft.client.Minecraft;
@@ -75,7 +76,7 @@ public abstract class ScrollPanel extends FocusableGui implements IRenderable
* @param mouseY
* @param mouseX
*/
protected abstract void drawPanel(int entryRight, int relativeY, Tessellator tess, int mouseX, int mouseY);
protected abstract void drawPanel(MatrixStack mStack, int entryRight, int relativeY, Tessellator tess, int mouseX, int mouseY);
protected boolean clickPanel(double mouseX, double mouseY, int button) { return false; }
@@ -105,7 +106,7 @@ public abstract class ScrollPanel extends FocusableGui implements IRenderable
}
@Override
public boolean mouseScrolled(double mouseX, double mouseY, double scroll)
public boolean func_231043_a_(double mouseX, double mouseY, double scroll)
{
if (scroll != 0)
{
@@ -122,15 +123,15 @@ public abstract class ScrollPanel extends FocusableGui implements IRenderable
}
@Override
public boolean isMouseOver(double mouseX, double mouseY)
public boolean func_231047_b_(double mouseX, double mouseY)
{
return mouseX >= this.left && mouseX <= this.left + this.width &&
mouseY >= this.top && mouseY <= this.bottom;
}
@Override
public boolean mouseClicked(double mouseX, double mouseY, int button) {
if (super.mouseClicked(mouseX, mouseY, button))
public boolean func_231044_a_(double mouseX, double mouseY, int button) {
if (super.func_231044_a_(mouseX, mouseY, button))
return true;
this.scrolling = button == 0 && mouseX >= barLeft && mouseX < barLeft + barWidth;
@@ -147,8 +148,8 @@ public abstract class ScrollPanel extends FocusableGui implements IRenderable
}
@Override
public boolean mouseReleased(double p_mouseReleased_1_, double p_mouseReleased_3_, int p_mouseReleased_5_) {
if (super.mouseReleased(p_mouseReleased_1_, p_mouseReleased_3_, p_mouseReleased_5_))
public boolean func_231048_c_(double p_mouseReleased_1_, double p_mouseReleased_3_, int p_mouseReleased_5_) {
if (super.func_231048_c_(p_mouseReleased_1_, p_mouseReleased_3_, p_mouseReleased_5_))
return true;
boolean ret = this.scrolling;
this.scrolling = false;
@@ -168,7 +169,7 @@ public abstract class ScrollPanel extends FocusableGui implements IRenderable
}
@Override
public boolean mouseDragged(double mouseX, double mouseY, int button, double deltaX, double deltaY)
public boolean func_231045_a_(double mouseX, double mouseY, int button, double deltaX, double deltaY)
{
if (this.scrolling)
{
@@ -182,7 +183,7 @@ public abstract class ScrollPanel extends FocusableGui implements IRenderable
}
@Override
public void render(int mouseX, int mouseY, float partialTicks)
public void func_230430_a_(MatrixStack matrix, int mouseX, int mouseY, float partialTicks)
{
this.drawBackground();
@@ -196,13 +197,13 @@ public abstract class ScrollPanel extends FocusableGui implements IRenderable
if (this.client.world != null)
{
this.drawGradientRect(this.left, this.top, this.right, this.bottom, 0xC0101010, 0xD0101010);
this.drawGradientRect(matrix, this.left, this.top, this.right, this.bottom, 0xC0101010, 0xD0101010);
}
else // Draw dark dirt background
{
RenderSystem.disableLighting();
RenderSystem.disableFog();
this.client.getTextureManager().bindTexture(AbstractGui.BACKGROUND_LOCATION);
this.client.getTextureManager().bindTexture(AbstractGui.field_230663_f_);
RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
final float texScale = 32.0F;
worldr.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR);
@@ -214,7 +215,7 @@ public abstract class ScrollPanel extends FocusableGui implements IRenderable
}
int baseY = this.top + border - (int)this.scrollDistance;
this.drawPanel(right, baseY, tess, mouseX, mouseY);
this.drawPanel(matrix, right, baseY, tess, mouseX, mouseY);
RenderSystem.disableDepthTest();
@@ -257,13 +258,13 @@ public abstract class ScrollPanel extends FocusableGui implements IRenderable
GL11.glDisable(GL11.GL_SCISSOR_TEST);
}
protected void drawGradientRect(int left, int top, int right, int bottom, int color1, int color2)
protected void drawGradientRect(MatrixStack mStack, int left, int top, int right, int bottom, int color1, int color2)
{
GuiUtils.drawGradientRect(0, left, top, right, bottom, color1, color2);
GuiUtils.drawGradientRect(mStack.getLast().getMatrix(), 0, left, top, right, bottom, color1, color2);
}
@Override
public List<? extends IGuiEventListener> children()
public List<? extends IGuiEventListener> func_231039_at__()
{
return Collections.emptyList();
}
@@ -28,7 +28,7 @@ import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.mojang.blaze3d.matrix.MatrixStack;
import net.minecraft.block.BlockState;
import net.minecraft.client.renderer.TransformationMatrix;
import net.minecraft.util.math.vector.TransformationMatrix;
import net.minecraft.client.renderer.model.BakedQuad;
import net.minecraft.client.renderer.model.IBakedModel;
import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType;
@@ -33,7 +33,7 @@ import net.minecraft.client.renderer.model.ItemOverrideList;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.util.Direction;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.ILightReader;
import net.minecraft.world.IBlockDisplayReader;
import net.minecraftforge.client.model.data.IModelData;
public abstract class BakedModelWrapper<T extends IBakedModel> implements IBakedModel
@@ -126,7 +126,7 @@ public abstract class BakedModelWrapper<T extends IBakedModel> implements IBaked
@Nonnull
@Override
public IModelData getModelData(@Nonnull ILightReader world, @Nonnull BlockPos pos, @Nonnull BlockState state, @Nonnull IModelData tileData)
public IModelData getModelData(@Nonnull IBlockDisplayReader world, @Nonnull BlockPos pos, @Nonnull BlockState state, @Nonnull IModelData tileData)
{
return originalModel.getModelData(world, pos, state, tileData);
}
@@ -99,7 +99,7 @@ public class BlockModelConfiguration implements IModelConfiguration
}
@Override
public Material resolveTexture(String name)
public RenderMaterial resolveTexture(String name)
{
return owner.resolveTextureName(name);
}
@@ -144,14 +144,14 @@ public class BlockModelConfiguration implements IModelConfiguration
this.visibilityData.copyFrom(other.visibilityData);
}
public Collection<Material> getTextureDependencies(Function<ResourceLocation, IUnbakedModel> modelGetter, Set<Pair<String, String>> missingTextureErrors)
public Collection<RenderMaterial> getTextureDependencies(Function<ResourceLocation, IUnbakedModel> modelGetter, Set<Pair<String, String>> missingTextureErrors)
{
IModelGeometry<?> geometry = getCustomGeometry();
return geometry == null ? Collections.emptySet() :
geometry.getTextures(this, modelGetter, missingTextureErrors);
}
public IBakedModel bake(ModelBakery bakery, Function<Material, TextureAtlasSprite> bakedTextureGetter, IModelTransform modelTransform, ItemOverrideList overrides, ResourceLocation modelLocation)
public IBakedModel bake(ModelBakery bakery, Function<RenderMaterial, TextureAtlasSprite> bakedTextureGetter, IModelTransform modelTransform, ItemOverrideList overrides, ResourceLocation modelLocation)
{
IModelGeometry<?> geometry = getCustomGeometry();
if (geometry == null)
@@ -175,19 +175,19 @@ public class CompositeModel implements IDynamicBakedModel
}
@Override
public void addQuads(IModelConfiguration owner, IModelBuilder<?> modelBuilder, ModelBakery bakery, Function<Material, TextureAtlasSprite> spriteGetter, IModelTransform modelTransform, ResourceLocation modelLocation)
public void addQuads(IModelConfiguration owner, IModelBuilder<?> modelBuilder, ModelBakery bakery, Function<RenderMaterial, TextureAtlasSprite> spriteGetter, IModelTransform modelTransform, ResourceLocation modelLocation)
{
throw new UnsupportedOperationException("Attempted to call adQuads on a Submodel instance. Please don't.");
}
public IBakedModel bakeModel(ModelBakery bakery, Function<Material, TextureAtlasSprite> spriteGetter, IModelTransform modelTransform, ResourceLocation modelLocation)
public IBakedModel bakeModel(ModelBakery bakery, Function<RenderMaterial, TextureAtlasSprite> spriteGetter, IModelTransform modelTransform, ResourceLocation modelLocation)
{
return model.bakeModel(bakery, spriteGetter, new ModelTransformComposition(this.modelTransform, modelTransform,
this.modelTransform.isUvLock() || modelTransform.isUvLock()), modelLocation);
}
@Override
public Collection<Material> getTextures(IModelConfiguration owner, Function<ResourceLocation, IUnbakedModel> modelGetter, Set<Pair<String, String>> missingTextureErrors)
public Collection<RenderMaterial> getTextures(IModelConfiguration owner, Function<ResourceLocation, IUnbakedModel> modelGetter, Set<Pair<String, String>> missingTextureErrors)
{
return model.getTextures(modelGetter, missingTextureErrors);
}
@@ -215,9 +215,9 @@ public class CompositeModel implements IDynamicBakedModel
}
@Override
public IBakedModel bake(IModelConfiguration owner, ModelBakery bakery, Function<Material, TextureAtlasSprite> spriteGetter, IModelTransform modelTransform, ItemOverrideList overrides, ResourceLocation modelLocation)
public IBakedModel bake(IModelConfiguration owner, ModelBakery bakery, Function<RenderMaterial, TextureAtlasSprite> spriteGetter, IModelTransform modelTransform, ItemOverrideList overrides, ResourceLocation modelLocation)
{
Material particleLocation = owner.resolveTexture("particle");
RenderMaterial particleLocation = owner.resolveTexture("particle");
TextureAtlasSprite particle = spriteGetter.apply(particleLocation);
ImmutableMap.Builder<String, IBakedModel> bakedParts = ImmutableMap.builder();
@@ -232,9 +232,9 @@ public class CompositeModel implements IDynamicBakedModel
}
@Override
public Collection<Material> getTextures(IModelConfiguration owner, Function<ResourceLocation, IUnbakedModel> modelGetter, Set<Pair<String, String>> missingTextureErrors)
public Collection<RenderMaterial> getTextures(IModelConfiguration owner, Function<ResourceLocation, IUnbakedModel> modelGetter, Set<Pair<String, String>> missingTextureErrors)
{
Set<Material> textures = new HashSet<>();
Set<RenderMaterial> textures = new HashSet<>();
for(Submodel part : parts.values())
{
textures.addAll(part.getTextures(owner, modelGetter, missingTextureErrors));
@@ -26,8 +26,9 @@ import com.google.common.collect.Sets;
import com.google.gson.JsonDeserializationContext;
import com.google.gson.JsonObject;
import com.mojang.datafixers.util.Pair;
import net.minecraft.client.renderer.Quaternion;
import net.minecraft.client.renderer.TransformationMatrix;
import net.minecraft.client.world.ClientWorld;
import net.minecraft.util.math.vector.Quaternion;
import net.minecraft.util.math.vector.TransformationMatrix;
import net.minecraft.client.renderer.model.*;
import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType;
import net.minecraft.client.renderer.texture.MissingTextureSprite;
@@ -94,27 +95,27 @@ public final class DynamicBucketModel implements IModelGeometry<DynamicBucketMod
}
@Override
public IBakedModel bake(IModelConfiguration owner, ModelBakery bakery, Function<Material, TextureAtlasSprite> spriteGetter, IModelTransform modelTransform, ItemOverrideList overrides, ResourceLocation modelLocation)
public IBakedModel bake(IModelConfiguration owner, ModelBakery bakery, Function<RenderMaterial, TextureAtlasSprite> spriteGetter, IModelTransform modelTransform, ItemOverrideList overrides, ResourceLocation modelLocation)
{
Material particleLocation = owner.resolveTexture("particle");
RenderMaterial particleLocation = owner.resolveTexture("particle");
if (MissingTextureSprite.getLocation().equals(particleLocation.getTextureLocation()))
{
particleLocation = null;
}
Material baseLocation = owner.resolveTexture("base");
RenderMaterial baseLocation = owner.resolveTexture("base");
if (MissingTextureSprite.getLocation().equals(baseLocation.getTextureLocation()))
{
baseLocation = null;
}
Material fluidMaskLocation = owner.resolveTexture("fluid");
RenderMaterial fluidMaskLocation = owner.resolveTexture("fluid");
if (MissingTextureSprite.getLocation().equals(fluidMaskLocation.getTextureLocation()))
{
fluidMaskLocation = null;
}
Material coverLocation = owner.resolveTexture("cover");
RenderMaterial coverLocation = owner.resolveTexture("cover");
if (!MissingTextureSprite.getLocation().equals(coverLocation.getTextureLocation()))
{
// cover (the actual item around the other two)
@@ -188,9 +189,9 @@ public final class DynamicBucketModel implements IModelGeometry<DynamicBucketMod
}
@Override
public Collection<Material> getTextures(IModelConfiguration owner, Function<ResourceLocation, IUnbakedModel> modelGetter, Set<Pair<String, String>> missingTextureErrors)
public Collection<RenderMaterial> getTextures(IModelConfiguration owner, Function<ResourceLocation, IUnbakedModel> modelGetter, Set<Pair<String, String>> missingTextureErrors)
{
Set<Material> texs = Sets.newHashSet();
Set<RenderMaterial> texs = Sets.newHashSet();
texs.add(owner.resolveTexture("particle"));
texs.add(owner.resolveTexture("base"));
@@ -265,7 +266,7 @@ public final class DynamicBucketModel implements IModelGeometry<DynamicBucketMod
}
@Override
public IBakedModel getModelWithOverrides(IBakedModel originalModel, ItemStack stack, @Nullable World world, @Nullable LivingEntity entity)
public IBakedModel func_239290_a_(IBakedModel originalModel, ItemStack stack, @Nullable ClientWorld world, @Nullable LivingEntity entity)
{
return FluidUtil.getFluidContained(stack)
.map(fluidStack -> {
@@ -1,246 +0,0 @@
/*
* Minecraft Forge
* Copyright (c) 2016-2019.
*
* 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.client.model;
import java.util.function.Function;
import com.google.common.cache.CacheBuilder;
import com.google.common.cache.CacheLoader;
import com.google.common.cache.LoadingCache;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Lists;
import com.mojang.blaze3d.matrix.MatrixStack;
import net.minecraft.block.BlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.Matrix4f;
import net.minecraft.client.renderer.Quaternion;
import net.minecraft.client.renderer.TransformationMatrix;
import net.minecraft.client.renderer.Vector3f;
import net.minecraft.client.renderer.model.*;
import net.minecraft.client.renderer.texture.AtlasTexture;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.client.renderer.vertex.VertexFormat;
import net.minecraft.util.Direction;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.Util;
import net.minecraftforge.common.ForgeConfig;
import net.minecraftforge.common.model.TransformationHelper;
import javax.annotation.Nullable;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Random;
import java.util.Set;
final class FancyMissingModel implements IUnbakedModel
{
private static final ResourceLocation font = new ResourceLocation("minecraft", "textures/font/ascii.png");
private static final Material font2 = new Material(AtlasTexture.LOCATION_BLOCKS_TEXTURE, new ResourceLocation("minecraft", "font/ascii"));
private static final TransformationMatrix smallTransformation = new TransformationMatrix(null, null, new Vector3f(.25f, .25f, .25f), null)
.blockCenterToCorner();
private static final SimpleModelFontRenderer fontRenderer = Util.make(() -> {
float [] mv = new float[16];
mv[2*4+0] = 1f / 128f;
mv[0*4+1] =mv[1*4+2] = -mv[2*4+0];
mv[3*4+3] = 1;
mv[0*4+3] = 1;
mv[0*4+3] = 1 + 1f / 0x100;
mv[0*4+3] = 0;
Matrix4f m = new Matrix4f(mv);
return new SimpleModelFontRenderer(
Minecraft.getInstance().gameSettings,
font,
Minecraft.getInstance().getTextureManager(),
false,
m
) {/* TODO Implement once SimpleModelFontRenderer is fixed
@Override
protected float renderUnicodeChar(char c, boolean italic)
{
return super.renderDefaultChar(126, italic);
}
*/};
});
private final IUnbakedModel missingModel;
private final String message;
public FancyMissingModel(IUnbakedModel missingModel, String message)
{
this.missingModel = missingModel;
this.message = message;
}
@Override
public Collection<Material> getTextures(Function<ResourceLocation, IUnbakedModel> modelGetter, Set<com.mojang.datafixers.util.Pair<String, String>> missingTextureErrors)
{
return ImmutableList.of(font2);
}
@Override
public Collection<ResourceLocation> getDependencies()
{
return Collections.emptyList();
}
@Nullable
@Override
public IBakedModel bakeModel(ModelBakery bakery, Function<Material, TextureAtlasSprite> spriteGetter, IModelTransform modelTransform, ResourceLocation modelLocation)
{
IBakedModel bigMissing = missingModel.bakeModel(bakery, spriteGetter, modelTransform, modelLocation);
ModelTransformComposition smallState = new ModelTransformComposition(modelTransform, new SimpleModelTransform(smallTransformation));
IBakedModel smallMissing = missingModel.bakeModel(bakery, spriteGetter, smallState, modelLocation);
return new BakedModel(bigMissing, smallMissing, fontRenderer, message, spriteGetter.apply(font2));
}
static final class BakedModel implements IBakedModel
{
private final SimpleModelFontRenderer fontRenderer;
private final String message;
private final TextureAtlasSprite fontTexture;
private final IBakedModel missingModel;
private final IBakedModel otherModel;
private final boolean big;
private ImmutableList<BakedQuad> quads;
public BakedModel(IBakedModel bigMissing, IBakedModel smallMissing, SimpleModelFontRenderer fontRenderer, String message, TextureAtlasSprite fontTexture)
{
this.missingModel = bigMissing;
otherModel = new BakedModel(smallMissing, fontRenderer, message, fontTexture, this);
this.big = true;
this.fontRenderer = fontRenderer;
this.message = message;
this.fontTexture = fontTexture;
}
public BakedModel(IBakedModel smallMissing, SimpleModelFontRenderer fontRenderer, String message, TextureAtlasSprite fontTexture, BakedModel big)
{
this.missingModel = smallMissing;
otherModel = big;
this.big = false;
this.fontRenderer = fontRenderer;
this.message = message;
this.fontTexture = fontTexture;
}
@Override
public List<BakedQuad> getQuads(@Nullable BlockState state, @Nullable Direction side, Random rand)
{
if (side == null)
{
if (quads == null)
{
fontRenderer.setSprite(fontTexture);
fontRenderer.setFillBlanks(true);
String[] lines = message.split("\\r?\\n");
List<String> splitLines = Lists.newArrayList();
for (int y = 0; y < lines.length; y++)
{
splitLines.addAll(fontRenderer.listFormattedStringToWidth(lines[y], 0x80));
}
for (int y = 0; y < splitLines.size(); y++)
{
fontRenderer.drawString(splitLines.get(y), 0, ((y - splitLines.size() / 2f) * fontRenderer.FONT_HEIGHT) + 0x40, 0xFF00FFFF);
}
ImmutableList.Builder<BakedQuad> builder = ImmutableList.builder();
builder.addAll(missingModel.getQuads (state, side, rand));
builder.addAll(fontRenderer.build());
quads = builder.build();
}
return quads;
}
return missingModel.getQuads (state, side, rand);
}
@Override
public boolean isAmbientOcclusion() { return true; }
@Override
public boolean isGui3d() { return false; }
@Override
public boolean func_230044_c_() { return false; }
@Override
public boolean isBuiltInRenderer() { return false; }
@Override
public TextureAtlasSprite getParticleTexture() { return fontTexture; }
@Override
public ItemOverrideList getOverrides() { return ItemOverrideList.EMPTY; }
@Override
public boolean doesHandlePerspectives()
{
return true;
}
@Override
public IBakedModel handlePerspective(ItemCameraTransforms.TransformType cameraTransformType, MatrixStack mat)
{
TransformationMatrix transform = TransformationMatrix.identity();
boolean big = true;
switch (cameraTransformType)
{
case THIRD_PERSON_LEFT_HAND:
break;
case THIRD_PERSON_RIGHT_HAND:
break;
case FIRST_PERSON_LEFT_HAND:
transform = new TransformationMatrix(new Vector3f(-0.62f, 0.5f, -.5f), new Quaternion(1, -1, -1, 1), null, null);
big = false;
break;
case FIRST_PERSON_RIGHT_HAND:
transform = new TransformationMatrix(new Vector3f(-0.5f, 0.5f, -.5f), new Quaternion(1, 1, 1, 1), null, null);
big = false;
break;
case HEAD:
break;
case GUI:
if (ForgeConfig.CLIENT.zoomInMissingModelTextInGui.get())
{
transform = new TransformationMatrix(null, new Quaternion(1, 1, 1, 1), new Vector3f(4, 4, 4), null);
big = false;
}
else
{
transform = new TransformationMatrix(null, new Quaternion(1, 1, 1, 1), null, null);
big = true;
}
break;
case FIXED:
transform = new TransformationMatrix(null, new Quaternion(-1, -1, 1, 1), null, null);
break;
default:
break;
}
mat.getLast().getMatrix().mul(transform.getMatrix());
if (big != this.big)
{
return otherModel;
}
return this;
}
}
}
@@ -32,7 +32,7 @@ import javax.annotation.Nullable;
import com.mojang.blaze3d.matrix.MatrixStack;
import net.minecraft.block.BlockState;
import net.minecraft.client.renderer.TransformationMatrix;
import net.minecraft.util.math.vector.TransformationMatrix;
import net.minecraft.client.renderer.model.*;
import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
@@ -73,13 +73,13 @@ public final class FluidModel implements IModelGeometry<FluidModel>
}
@Override
public Collection<Material> getTextures(IModelConfiguration owner, Function<ResourceLocation, IUnbakedModel> modelGetter, Set<com.mojang.datafixers.util.Pair<String, String>> missingTextureErrors)
public Collection<RenderMaterial> getTextures(IModelConfiguration owner, Function<ResourceLocation, IUnbakedModel> modelGetter, Set<com.mojang.datafixers.util.Pair<String, String>> missingTextureErrors)
{
return ForgeHooksClient.getFluidMaterials(fluid).collect(Collectors.toList());
}
@Override
public IBakedModel bake(IModelConfiguration owner, ModelBakery bakery, Function<Material, TextureAtlasSprite> spriteGetter, IModelTransform modelTransform, ItemOverrideList overrides, ResourceLocation modelLocation)
public IBakedModel bake(IModelConfiguration owner, ModelBakery bakery, Function<RenderMaterial, TextureAtlasSprite> spriteGetter, IModelTransform modelTransform, ItemOverrideList overrides, ResourceLocation modelLocation)
{
FluidAttributes attrs = fluid.getAttributes();
return new CachingBakedFluid(
@@ -22,7 +22,7 @@ package net.minecraftforge.client.model;
import net.minecraft.client.renderer.model.IModelTransform;
import net.minecraft.client.renderer.model.IUnbakedModel;
import net.minecraft.client.renderer.model.ItemCameraTransforms;
import net.minecraft.client.renderer.model.Material;
import net.minecraft.client.renderer.model.RenderMaterial;
import net.minecraftforge.client.model.geometry.IModelGeometryPart;
import javax.annotation.Nullable;
@@ -55,7 +55,7 @@ public interface IModelConfiguration {
* @param name The name of a texture channel.
* @return The location of the texture, or the missing texture if not found.
*/
Material resolveTexture(String name);
RenderMaterial resolveTexture(String name);
/**
* @return True if the item uses 3D lighting.
@@ -28,7 +28,7 @@ import com.google.gson.JsonDeserializationContext;
import com.google.gson.JsonObject;
import com.mojang.datafixers.util.Pair;
import it.unimi.dsi.fastutil.ints.IntSet;
import net.minecraft.client.renderer.TransformationMatrix;
import net.minecraft.util.math.vector.TransformationMatrix;
import net.minecraft.client.renderer.model.*;
import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
@@ -38,7 +38,6 @@ import net.minecraft.resources.IResourceManager;
import net.minecraft.util.Direction;
import net.minecraft.util.JSONUtils;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.Vec2f;
import net.minecraftforge.client.model.geometry.IModelGeometry;
import net.minecraftforge.client.model.pipeline.BakedQuadBuilder;
import net.minecraftforge.client.model.pipeline.IVertexConsumer;
@@ -64,7 +63,7 @@ public final class ItemLayerModel implements IModelGeometry<ItemLayerModel>
private static final Direction[] HORIZONTALS = {Direction.UP, Direction.DOWN};
private static final Direction[] VERTICALS = {Direction.WEST, Direction.EAST};
private ImmutableList<Material> textures;
private ImmutableList<RenderMaterial> textures;
private final ImmutableSet<Integer> fullbrightLayers;
public ItemLayerModel()
@@ -72,20 +71,20 @@ public final class ItemLayerModel implements IModelGeometry<ItemLayerModel>
this(null, ImmutableSet.of());
}
public ItemLayerModel(ImmutableList<Material> textures)
public ItemLayerModel(ImmutableList<RenderMaterial> textures)
{
this(textures, ImmutableSet.of());
}
public ItemLayerModel(@Nullable ImmutableList<Material> textures, ImmutableSet<Integer> fullbrightLayers)
public ItemLayerModel(@Nullable ImmutableList<RenderMaterial> textures, ImmutableSet<Integer> fullbrightLayers)
{
this.textures = textures;
this.fullbrightLayers = fullbrightLayers;
}
private static ImmutableList<Material> getTextures(IModelConfiguration model)
private static ImmutableList<RenderMaterial> getTextures(IModelConfiguration model)
{
ImmutableList.Builder<Material> builder = ImmutableList.builder();
ImmutableList.Builder<RenderMaterial> builder = ImmutableList.builder();
for(int i = 0; model.isTexturePresent("layer" + i); i++)
{
builder.add(model.resolveTexture("layer" + i));
@@ -94,7 +93,7 @@ public final class ItemLayerModel implements IModelGeometry<ItemLayerModel>
}
@Override
public IBakedModel bake(IModelConfiguration owner, ModelBakery bakery, Function<Material, TextureAtlasSprite> spriteGetter, IModelTransform modelTransform, ItemOverrideList overrides, ResourceLocation modelLocation)
public IBakedModel bake(IModelConfiguration owner, ModelBakery bakery, Function<RenderMaterial, TextureAtlasSprite> spriteGetter, IModelTransform modelTransform, ItemOverrideList overrides, ResourceLocation modelLocation)
{
//TODO: Verify
TransformationMatrix transform = modelTransform.getRotation();
@@ -106,12 +105,12 @@ public final class ItemLayerModel implements IModelGeometry<ItemLayerModel>
return new BakedItemModel(quads, particle, map, overrides, transform.isIdentity(), owner.isSideLit());
}
public static ImmutableList<BakedQuad> getQuadsForSprites(List<Material> textures, TransformationMatrix transform, Function<Material, TextureAtlasSprite> spriteGetter)
public static ImmutableList<BakedQuad> getQuadsForSprites(List<RenderMaterial> textures, TransformationMatrix transform, Function<RenderMaterial, TextureAtlasSprite> spriteGetter)
{
return getQuadsForSprites(textures, transform, spriteGetter, Collections.emptySet());
}
public static ImmutableList<BakedQuad> getQuadsForSprites(List<Material> textures, TransformationMatrix transform, Function<Material, TextureAtlasSprite> spriteGetter, Set<Integer> fullbrights)
public static ImmutableList<BakedQuad> getQuadsForSprites(List<RenderMaterial> textures, TransformationMatrix transform, Function<RenderMaterial, TextureAtlasSprite> spriteGetter, Set<Integer> fullbrights)
{
ImmutableList.Builder<BakedQuad> builder = ImmutableList.builder();
for(int i = 0; i < textures.size(); i++)
@@ -303,7 +302,7 @@ public final class ItemLayerModel implements IModelGeometry<ItemLayerModel>
}
@Override
public Collection<Material> getTextures(IModelConfiguration owner, Function<ResourceLocation, IUnbakedModel> modelGetter, Set<Pair<String, String>> missingTextureErrors)
public Collection<RenderMaterial> getTextures(IModelConfiguration owner, Function<ResourceLocation, IUnbakedModel> modelGetter, Set<Pair<String, String>> missingTextureErrors)
{
textures = getTextures(owner);
return textures;
@@ -21,7 +21,7 @@ package net.minecraftforge.client.model;
import com.google.common.collect.Lists;
import net.minecraft.client.renderer.TransformationMatrix;
import net.minecraft.util.math.vector.TransformationMatrix;
import net.minecraft.client.renderer.model.BakedQuad;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.renderer.vertex.VertexFormat;
@@ -162,7 +162,7 @@ public final class ModelLoader extends ModelBakery
{
if (instance == null)
{
instance = new Material(AtlasTexture.LOCATION_BLOCKS_TEXTURE, LOCATION).getSprite();
instance = new RenderMaterial(AtlasTexture.LOCATION_BLOCKS_TEXTURE, LOCATION).getSprite();
}
return instance;
}
@@ -262,9 +262,9 @@ public final class ModelLoader extends ModelBakery
/**
* Get the default texture getter the models will be baked with.
*/
public static Function<Material, TextureAtlasSprite> defaultTextureGetter()
public static Function<RenderMaterial, TextureAtlasSprite> defaultTextureGetter()
{
return Material::getSprite;
return RenderMaterial::getSprite;
}
public static Function<ResourceLocation, IUnbakedModel> defaultModelGetter()
@@ -26,7 +26,6 @@ import com.google.common.collect.Sets;
import com.google.gson.*;
import com.mojang.datafixers.util.Pair;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.TransformationMatrix;
import net.minecraft.client.renderer.model.*;
import net.minecraft.client.renderer.texture.AtlasTexture;
import net.minecraft.client.renderer.texture.MissingTextureSprite;
@@ -36,6 +35,7 @@ import net.minecraft.resources.IResourceManager;
import net.minecraft.util.Direction;
import net.minecraft.util.JSONUtils;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.vector.TransformationMatrix;
import net.minecraftforge.client.model.geometry.IModelGeometry;
import net.minecraftforge.client.model.geometry.ISimpleModelGeometry;
import net.minecraftforge.client.model.obj.OBJLoader;
@@ -141,7 +141,7 @@ public class ModelLoaderRegistry
private static final Pattern FILESYSTEM_PATH_TO_RESLOC =
Pattern.compile("(?:.*[\\\\/]assets[\\\\/](?<namespace>[a-z_-]+)[\\\\/]textures[\\\\/])?(?<path>[a-z_\\\\/-]+)\\.png");
public static Material resolveTexture(@Nullable String tex, IModelConfiguration owner)
public static RenderMaterial resolveTexture(@Nullable String tex, IModelConfiguration owner)
{
if (tex == null)
return blockMaterial(WHITE_TEXTURE);
@@ -163,14 +163,14 @@ public class ModelLoaderRegistry
return blockMaterial(tex);
}
public static Material blockMaterial(String location)
public static RenderMaterial blockMaterial(String location)
{
return new Material(AtlasTexture.LOCATION_BLOCKS_TEXTURE, new ResourceLocation(location));
return new RenderMaterial(AtlasTexture.LOCATION_BLOCKS_TEXTURE, new ResourceLocation(location));
}
public static Material blockMaterial(ResourceLocation location)
public static RenderMaterial blockMaterial(ResourceLocation location)
{
return new Material(AtlasTexture.LOCATION_BLOCKS_TEXTURE, location);
return new RenderMaterial(AtlasTexture.LOCATION_BLOCKS_TEXTURE, location);
}
@Nullable
@@ -244,7 +244,7 @@ public class ModelLoaderRegistry
}
}
public static IBakedModel bakeHelper(BlockModel blockModel, ModelBakery modelBakery, BlockModel otherModel, Function<Material, TextureAtlasSprite> spriteGetter, IModelTransform modelTransform, ResourceLocation modelLocation, boolean guiLight3d)
public static IBakedModel bakeHelper(BlockModel blockModel, ModelBakery modelBakery, BlockModel otherModel, Function<RenderMaterial, TextureAtlasSprite> spriteGetter, IModelTransform modelTransform, ResourceLocation modelLocation, boolean guiLight3d)
{
IBakedModel model;
IModelGeometry<?> customModel = blockModel.customData.getCustomGeometry();
@@ -273,7 +273,7 @@ public class ModelLoaderRegistry
}
@Override
public void addQuads(IModelConfiguration owner, IModelBuilder<?> modelBuilder, ModelBakery bakery, Function<Material, TextureAtlasSprite> spriteGetter, IModelTransform modelTransform, ResourceLocation modelLocation)
public void addQuads(IModelConfiguration owner, IModelBuilder<?> modelBuilder, ModelBakery bakery, Function<RenderMaterial, TextureAtlasSprite> spriteGetter, IModelTransform modelTransform, ResourceLocation modelLocation)
{
for(BlockPart blockpart : elements) {
for(Direction direction : blockpart.mapFaces.keySet()) {
@@ -291,13 +291,13 @@ public class ModelLoaderRegistry
}
@Override
public Collection<Material> getTextures(IModelConfiguration owner, Function<ResourceLocation, IUnbakedModel> modelGetter, Set<Pair<String, String>> missingTextureErrors)
public Collection<RenderMaterial> getTextures(IModelConfiguration owner, Function<ResourceLocation, IUnbakedModel> modelGetter, Set<Pair<String, String>> missingTextureErrors)
{
Set<Material> textures = Sets.newHashSet();
Set<RenderMaterial> textures = Sets.newHashSet();
for(BlockPart part : elements) {
for(BlockPartFace face : part.mapFaces.values()) {
Material texture = owner.resolveTexture(face.texture);
RenderMaterial texture = owner.resolveTexture(face.texture);
if (Objects.equals(texture, MissingTextureSprite.getLocation().toString())) {
missingTextureErrors.add(Pair.of(face.texture, owner.getModelName()));
}
@@ -20,7 +20,7 @@
package net.minecraftforge.client.model;
import com.google.common.base.Objects;
import net.minecraft.client.renderer.TransformationMatrix;
import net.minecraft.util.math.vector.TransformationMatrix;
import net.minecraft.client.renderer.model.IModelTransform;
/**
@@ -31,7 +31,7 @@ import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.datafixers.util.Pair;
import net.minecraft.block.BlockState;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.TransformationMatrix;
import net.minecraft.util.math.vector.TransformationMatrix;
import net.minecraft.client.renderer.model.*;
import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
@@ -67,16 +67,16 @@ public final class MultiLayerModel implements IModelGeometry<MultiLayerModel>
}
@Override
public Collection<Material> getTextures(IModelConfiguration owner, Function<ResourceLocation, IUnbakedModel> modelGetter, Set<Pair<String, String>> missingTextureErrors)
public Collection<RenderMaterial> getTextures(IModelConfiguration owner, Function<ResourceLocation, IUnbakedModel> modelGetter, Set<Pair<String, String>> missingTextureErrors)
{
Set<Material> materials = Sets.newHashSet();
Set<RenderMaterial> materials = Sets.newHashSet();
materials.add(owner.resolveTexture("particle"));
for (IUnbakedModel m : models.values())
materials.addAll(m.getTextures(modelGetter, missingTextureErrors));
return materials;
}
private static ImmutableMap<RenderType, IBakedModel> buildModels(ImmutableMap<RenderType, IUnbakedModel> models, IModelTransform modelTransform, ModelBakery bakery, Function<Material, TextureAtlasSprite> spriteGetter, ResourceLocation modelLocation)
private static ImmutableMap<RenderType, IBakedModel> buildModels(ImmutableMap<RenderType, IUnbakedModel> models, IModelTransform modelTransform, ModelBakery bakery, Function<RenderMaterial, TextureAtlasSprite> spriteGetter, ResourceLocation modelLocation)
{
ImmutableMap.Builder<RenderType, IBakedModel> builder = ImmutableMap.builder();
for(Map.Entry<RenderType, IUnbakedModel> entry : models.entrySet())
@@ -87,7 +87,7 @@ public final class MultiLayerModel implements IModelGeometry<MultiLayerModel>
}
@Override
public IBakedModel bake(IModelConfiguration owner, ModelBakery bakery, Function<Material, TextureAtlasSprite> spriteGetter, IModelTransform modelTransform, ItemOverrideList overrides, ResourceLocation modelLocation)
public IBakedModel bake(IModelConfiguration owner, ModelBakery bakery, Function<RenderMaterial, TextureAtlasSprite> spriteGetter, IModelTransform modelTransform, ItemOverrideList overrides, ResourceLocation modelLocation)
{
IUnbakedModel missing = ModelLoader.instance().getMissingModel();
@@ -26,12 +26,13 @@ import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.mojang.blaze3d.matrix.MatrixStack;
import net.minecraft.block.BlockState;
import net.minecraft.client.renderer.TransformationMatrix;
import net.minecraft.client.renderer.model.*;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.world.ClientWorld;
import net.minecraft.entity.LivingEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Direction;
import net.minecraft.util.math.vector.TransformationMatrix;
import net.minecraft.world.World;
import net.minecraftforge.client.model.data.IDynamicBakedModel;
import net.minecraftforge.client.model.data.IModelData;
@@ -164,9 +165,9 @@ public class PerspectiveMapWrapper implements IDynamicBakedModel
@Nullable
@Override
public IBakedModel getModelWithOverrides(IBakedModel model, ItemStack stack, @Nullable World worldIn, @Nullable LivingEntity entityIn)
public IBakedModel func_239290_a_(IBakedModel model, ItemStack stack, @Nullable ClientWorld worldIn, @Nullable LivingEntity entityIn)
{
model = parent.getOverrides().getModelWithOverrides(parent, stack, worldIn, entityIn);
model = parent.getOverrides().func_239290_a_(parent, stack, worldIn, entityIn);
return new PerspectiveMapWrapper(model, transforms);
}
@@ -25,9 +25,9 @@ import java.util.List;
import com.google.common.collect.Lists;
import net.minecraft.client.renderer.TransformationMatrix;
import net.minecraft.client.renderer.Vector3f;
import net.minecraft.client.renderer.Vector4f;
import net.minecraft.util.math.vector.TransformationMatrix;
import net.minecraft.util.math.vector.Vector3f;
import net.minecraft.util.math.vector.Vector4f;
import net.minecraft.client.renderer.model.BakedQuad;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.client.renderer.vertex.VertexFormat;
@@ -176,7 +176,7 @@ public class QuadTransformer
int[] outData = Arrays.copyOf(inData, inData.length);
processVertices(inData, outData);
return new BakedQuad(outData, input.getTintIndex(), input.getFace(), input.func_187508_a(), input.shouldApplyDiffuseLighting());
return new BakedQuad(outData, input.getTintIndex(), input.getFace(), input.func_187508_a(), input.func_239287_f_());
}
/**
@@ -208,7 +208,7 @@ public class QuadTransformer
int[] outData = Arrays.copyOf(inData, inData.length);
processVertices(inData, outData);
outputs.add(new BakedQuad(outData, input.getTintIndex(), input.getFace(), input.func_187508_a(), input.shouldApplyDiffuseLighting()));
outputs.add(new BakedQuad(outData, input.getTintIndex(), input.getFace(), input.func_187508_a(), input.func_239287_f_()));
}
return outputs;
}
@@ -1,110 +0,0 @@
/*
* Minecraft Forge
* Copyright (c) 2016-2019.
*
* 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.client.model;
import com.google.common.collect.ImmutableList;
import net.minecraft.client.GameSettings;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.renderer.Matrix4f;
import net.minecraft.client.renderer.TransformationMatrix;
import net.minecraft.client.renderer.Vector3f;
import net.minecraft.client.renderer.Vector4f;
import net.minecraft.client.renderer.model.BakedQuad;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.client.renderer.vertex.VertexFormat;
import net.minecraft.client.renderer.vertex.VertexFormatElement;
import net.minecraft.util.Direction;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.model.pipeline.BakedQuadBuilder;
public abstract class SimpleModelFontRenderer extends FontRenderer {
private float r, g, b, a;
private final TransformationMatrix transform;
private ImmutableList.Builder<BakedQuad> builder = ImmutableList.builder();
private final Vector3f normal = new Vector3f(0, 0, 1);
private final Direction orientation;
private boolean fillBlanks = false;
private TextureAtlasSprite sprite;
public SimpleModelFontRenderer(GameSettings settings, ResourceLocation font, TextureManager manager, boolean isUnicode, Matrix4f matrix)
{
super(manager, null);
this.transform = new TransformationMatrix(matrix);
transform.transformNormal(normal);
orientation = Direction.getFacingFromVector(normal.getX(), normal.getY(), normal.getZ());
}
public void setSprite(TextureAtlasSprite sprite)
{
this.sprite = sprite;
}
public void setFillBlanks(boolean fillBlanks)
{
this.fillBlanks = fillBlanks;
}
private final Vector4f vec = new Vector4f();
private void addVertex(BakedQuadBuilder quadBuilder, float x, float y, float u, float v)
{
ImmutableList<VertexFormatElement> elements = quadBuilder.getVertexFormat().getElements();
for(int e = 0; e < elements.size(); e++)
{
VertexFormatElement element = elements.get(e);
switch(element.getUsage())
{
case POSITION:
vec.set(x, y, 0f, 1f);
transform.transformPosition(vec);
quadBuilder.put(e, vec.getX(), vec.getY(), vec.getZ(), vec.getW());
break;
case COLOR:
quadBuilder.put(e, r, g, b, a);
break;
case NORMAL:
//quadBuilder.put(e, normal.x, normal.y, normal.z, 1);
quadBuilder.put(e, 0, 0, 1, 1);
break;
case UV:
if(element.getIndex() == 0)
{
quadBuilder.put(e, sprite.getInterpolatedU(u * 16), sprite.getInterpolatedV(v * 16), 0, 1);
break;
}
// else fallthrough to default
default:
quadBuilder.put(e);
break;
}
}
}
public ImmutableList<BakedQuad> build()
{
ImmutableList<BakedQuad> ret = builder.build();
builder = ImmutableList.builder();
return ret;
}
}
@@ -19,10 +19,10 @@
package net.minecraftforge.client.model;
import net.minecraft.client.renderer.TransformationMatrix;
import net.minecraft.client.renderer.model.IModelTransform;
import com.google.common.collect.ImmutableMap;
import net.minecraft.util.math.vector.TransformationMatrix;
/**
* Simple implementation of IModelState via a map and a default value.
@@ -27,6 +27,7 @@ import javax.annotation.Nullable;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.model.*;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.world.ClientWorld;
import net.minecraft.entity.LivingEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
@@ -43,14 +44,14 @@ public final class AnimationItemOverrideList extends ItemOverrideList
private final IModelTransform state;
private final Function<Material, TextureAtlasSprite> bakedTextureGetter;
private final Function<RenderMaterial, TextureAtlasSprite> bakedTextureGetter;
public AnimationItemOverrideList(ModelBakery bakery, IUnbakedModel model, ResourceLocation modelLoc, IModelTransform state, Function<Material, TextureAtlasSprite> bakedTextureGetter, ItemOverrideList overrides)
public AnimationItemOverrideList(ModelBakery bakery, IUnbakedModel model, ResourceLocation modelLoc, IModelTransform state, Function<RenderMaterial, TextureAtlasSprite> bakedTextureGetter, ItemOverrideList overrides)
{
this(bakery, model, modelLoc, state, bakedTextureGetter, overrides.getOverrides().reverse());
}
public AnimationItemOverrideList(ModelBakery bakery, IUnbakedModel model, ResourceLocation modelLoc, IModelTransform state, Function<Material, TextureAtlasSprite> bakedTextureGetter, List<ItemOverride> overrides)
public AnimationItemOverrideList(ModelBakery bakery, IUnbakedModel model, ResourceLocation modelLoc, IModelTransform state, Function<RenderMaterial, TextureAtlasSprite> bakedTextureGetter, List<ItemOverride> overrides)
{
super(bakery, model, ModelLoader.defaultModelGetter(), bakedTextureGetter, overrides);
this.bakery = bakery;
@@ -61,7 +62,7 @@ public final class AnimationItemOverrideList extends ItemOverrideList
}
@Override
public IBakedModel getModelWithOverrides(IBakedModel originalModel, ItemStack stack, @Nullable World world, @Nullable LivingEntity entity)
public IBakedModel func_239290_a_(IBakedModel originalModel, ItemStack stack, @Nullable ClientWorld world, @Nullable LivingEntity entity)
{
return stack.getCapability(CapabilityAnimation.ANIMATION_CAPABILITY, null)
.map(asm ->
@@ -80,6 +81,6 @@ public final class AnimationItemOverrideList extends ItemOverrideList
})
// TODO where should uvlock data come from?
.map(state -> model.bakeModel(bakery, bakedTextureGetter, new ModelTransformComposition(state, this.state), modelLoc))
.orElseGet(() -> super.getModelWithOverrides(originalModel, stack, world, entity));
.orElseGet(() -> super.func_239290_a_(originalModel, stack, world, entity));
}
}
@@ -33,8 +33,11 @@ import java.util.TreeMap;
import javax.annotation.Nullable;
import net.minecraft.client.renderer.*;
import net.minecraft.client.renderer.model.IModelTransform;
import net.minecraft.util.math.vector.Matrix4f;
import net.minecraft.util.math.vector.Quaternion;
import net.minecraft.util.math.vector.TransformationMatrix;
import net.minecraft.util.math.vector.Vector3f;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -33,7 +33,7 @@ import net.minecraft.client.renderer.tileentity.TileEntityRenderer;
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.ILightReader;
import net.minecraft.world.IBlockDisplayReader;
import net.minecraftforge.client.MinecraftForgeClient;
import net.minecraftforge.client.model.ModelDataManager;
import net.minecraftforge.client.model.data.IModelData;
@@ -66,7 +66,7 @@ public class TileEntityRendererAnimation<T extends TileEntity> extends TileEntit
}
if(blockRenderer == null) blockRenderer = Minecraft.getInstance().getBlockRendererDispatcher();
BlockPos pos = te.getPos();
ILightReader world = MinecraftForgeClient.getRegionRenderCache(te.getWorld(), pos);
IBlockDisplayReader world = MinecraftForgeClient.getRegionRenderCache(te.getWorld(), pos);
BlockState state = world.getBlockState(pos);
IBakedModel model = blockRenderer.getBlockModelShapes().getModel(state);
IModelData data = model.getModelData(world, pos, state, ModelDataManager.getModelData(te.getWorld(), pos));
@@ -19,7 +19,7 @@
package net.minecraftforge.client.model.b3d;
import net.minecraft.client.renderer.TransformationMatrix;
import net.minecraft.util.math.vector.TransformationMatrix;
import net.minecraftforge.client.model.b3d.B3DLoader.NodeJoint;
import net.minecraftforge.client.model.b3d.B3DModel.Key;
import net.minecraftforge.client.model.b3d.B3DModel.Node;
@@ -38,9 +38,9 @@ import java.util.stream.Collectors;
import javax.annotation.Nullable;
import com.mojang.blaze3d.matrix.MatrixStack;
import net.minecraft.client.renderer.Matrix4f;
import net.minecraft.client.renderer.TransformationMatrix;
import net.minecraft.client.renderer.Vector3f;
import net.minecraft.util.math.vector.Matrix4f;
import net.minecraft.util.math.vector.TransformationMatrix;
import net.minecraft.util.math.vector.Vector3f;
import net.minecraft.client.renderer.model.*;
import net.minecraft.client.renderer.texture.AtlasTexture;
import net.minecraft.client.renderer.texture.MissingTextureSprite;
@@ -446,10 +446,10 @@ public enum B3DLoader implements ISelectiveResourceReloadListener
}
@Override
public Collection<Material> getTextures(Function<ResourceLocation, IUnbakedModel> modelGetter, Set<com.mojang.datafixers.util.Pair<String, String>> missingTextureErrors)
public Collection<RenderMaterial> getTextures(Function<ResourceLocation, IUnbakedModel> modelGetter, Set<com.mojang.datafixers.util.Pair<String, String>> missingTextureErrors)
{
return textures.values().stream().filter(loc -> !loc.startsWith("#"))
.map(t -> new Material(AtlasTexture.LOCATION_BLOCKS_TEXTURE, new ResourceLocation(t)))
.map(t -> new RenderMaterial(AtlasTexture.LOCATION_BLOCKS_TEXTURE, new ResourceLocation(t)))
.collect(Collectors.toList());
}
@@ -461,10 +461,10 @@ public enum B3DLoader implements ISelectiveResourceReloadListener
@Nullable
@Override
public IBakedModel bakeModel(ModelBakery bakery, Function<Material, TextureAtlasSprite> spriteGetter, IModelTransform modelTransform, ResourceLocation modelLocation)
public IBakedModel bakeModel(ModelBakery bakery, Function<RenderMaterial, TextureAtlasSprite> spriteGetter, IModelTransform modelTransform, ResourceLocation modelLocation)
{
ImmutableMap.Builder<String, TextureAtlasSprite> builder = ImmutableMap.builder();
TextureAtlasSprite missing = spriteGetter.apply(new Material(AtlasTexture.LOCATION_BLOCKS_TEXTURE, MissingTextureSprite.getLocation()));
TextureAtlasSprite missing = spriteGetter.apply(new RenderMaterial(AtlasTexture.LOCATION_BLOCKS_TEXTURE, MissingTextureSprite.getLocation()));
for(Map.Entry<String, String> e : textures.entrySet())
{
if(e.getValue().startsWith("#"))
@@ -474,7 +474,7 @@ public enum B3DLoader implements ISelectiveResourceReloadListener
}
else
{
builder.put(e.getKey(), spriteGetter.apply(new Material(AtlasTexture.LOCATION_BLOCKS_TEXTURE, new ResourceLocation(e.getValue()))));
builder.put(e.getKey(), spriteGetter.apply(new RenderMaterial(AtlasTexture.LOCATION_BLOCKS_TEXTURE, new ResourceLocation(e.getValue()))));
}
}
builder.put("missingno", missing);
@@ -39,8 +39,7 @@ import java.util.Set;
import javax.annotation.Nullable;
import net.minecraft.client.renderer.*;
import net.minecraft.util.math.Vec2f;
import net.minecraft.util.math.vector.*;
import net.minecraftforge.versions.forge.ForgeVersion;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.tuple.Pair;
@@ -249,8 +248,8 @@ public class B3DModel
String path = readString();
int flags = buf.getInt();
int blend = buf.getInt();
Vec2f pos = new Vec2f(buf.getFloat(), buf.getFloat());
Vec2f scale = new Vec2f(buf.getFloat(), buf.getFloat());
Vector2f pos = new Vector2f(buf.getFloat(), buf.getFloat());
Vector2f scale = new Vector2f(buf.getFloat(), buf.getFloat());
float rot = buf.getFloat();
ret.add(new Texture(path, flags, blend, pos, scale, rot));
}
@@ -529,15 +528,15 @@ public class B3DModel
public static class Texture
{
public static final Texture White = new Texture("builtin/white", 0, 0, new Vec2f(0, 0), new Vec2f(1, 1), 0);
public static final Texture White = new Texture("builtin/white", 0, 0, new Vector2f(0, 0), new Vector2f(1, 1), 0);
private final String path;
private final int flags;
private final int blend;
private final Vec2f pos;
private final Vec2f scale;
private final Vector2f pos;
private final Vector2f scale;
private final float rot;
public Texture(String path, int flags, int blend, Vec2f pos, Vec2f scale, float rot)
public Texture(String path, int flags, int blend, Vector2f pos, Vector2f scale, float rot)
{
this.path = path;
this.flags = flags;
@@ -562,12 +561,12 @@ public class B3DModel
return blend;
}
public Vec2f getPos()
public Vector2f getPos()
{
return pos;
}
public Vec2f getScale()
public Vector2f getScale()
{
return scale;
}
@@ -47,7 +47,6 @@ import net.minecraft.block.DoorBlock;
import net.minecraft.block.FenceBlock;
import net.minecraft.block.FenceGateBlock;
import net.minecraft.block.FourWayBlock;
import net.minecraft.block.LogBlock;
import net.minecraft.block.PaneBlock;
import net.minecraft.block.RotatedPillarBlock;
import net.minecraft.block.SixWayBlock;
@@ -194,7 +193,7 @@ public abstract class BlockStateProvider implements IDataProvider {
axisBlock(block, blockTexture(block));
}
public void logBlock(LogBlock block) {
public void logBlock(RotatedPillarBlock block) {
axisBlock(block, blockTexture(block), extend(blockTexture(block), "_top"));
}
@@ -49,8 +49,8 @@ public class ExistingFileHelper {
private final boolean enable;
public ExistingFileHelper(Collection<Path> existingPacks, boolean enable) {
this.clientResources = new SimpleReloadableResourceManager(ResourcePackType.CLIENT_RESOURCES, Thread.currentThread());
this.serverData = new SimpleReloadableResourceManager(ResourcePackType.SERVER_DATA, Thread.currentThread());
this.clientResources = new SimpleReloadableResourceManager(ResourcePackType.CLIENT_RESOURCES);
this.serverData = new SimpleReloadableResourceManager(ResourcePackType.SERVER_DATA);
this.clientResources.addResourcePack(new VanillaPack("minecraft", "realms"));
this.serverData.addResourcePack(new VanillaPack("minecraft"));
for (Path existing : existingPacks) {
@@ -36,7 +36,7 @@ import com.google.gson.Gson;
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import net.minecraft.client.renderer.Vector3f;
import net.minecraft.util.math.vector.Vector3f;
import net.minecraft.client.renderer.model.BlockFaceUV;
import net.minecraft.client.renderer.model.BlockPart;
import net.minecraft.client.renderer.model.BlockPartFace;
@@ -53,11 +53,11 @@ import net.minecraft.util.math.MathHelper;
/**
* General purpose model builder, contains all the commonalities between item
* and block models.
*
*
* @see ModelProvider
* @see BlockModelBuilder
* @see ItemModelBuilder
*
*
* @param <T> Self type, for simpler chaining of methods.
*/
@SuppressWarnings("deprecation")
@@ -89,7 +89,7 @@ public class ModelBuilder<T extends ModelBuilder<T>> extends ModelFile {
/**
* Set the parent model for the current model.
*
*
* @param parent the parent model
* @return this builder
* @throws NullPointerException if {@code parent} is {@code null}
@@ -104,7 +104,7 @@ public class ModelBuilder<T extends ModelBuilder<T>> extends ModelFile {
/**
* Set the texture for a given dictionary key.
*
*
* @param key the texture key
* @param texture the texture, can be another key e.g. {@code "#all"}
* @return this builder
@@ -133,7 +133,7 @@ public class ModelBuilder<T extends ModelBuilder<T>> extends ModelFile {
/**
* Set the texture for a given dictionary key.
*
*
* @param key the texture key
* @param texture the texture
* @return this builder
@@ -170,7 +170,7 @@ public class ModelBuilder<T extends ModelBuilder<T>> extends ModelFile {
public T gui3d(boolean gui3d) {
return self();
}
public T guiLight(GuiLight light) {
this.guiLight = light;
return self();
@@ -184,7 +184,7 @@ public class ModelBuilder<T extends ModelBuilder<T>> extends ModelFile {
/**
* Get an existing element builder
*
*
* @param index the index of the existing element builder
* @return the element builder
* @throws IndexOutOfBoundsException if {@code} index is out of bounds
@@ -204,7 +204,7 @@ public class ModelBuilder<T extends ModelBuilder<T>> extends ModelFile {
if (!this.ambientOcclusion) {
root.addProperty("ambientocclusion", this.ambientOcclusion);
}
if (this.guiLight != null) {
root.addProperty("gui_light", this.guiLight.getSerializedName());
}
@@ -240,7 +240,7 @@ public class ModelBuilder<T extends ModelBuilder<T>> extends ModelFile {
if (!this.elements.isEmpty()) {
JsonArray elements = new JsonArray();
this.elements.stream().map(ElementBuilder::build).forEach(part -> {
this.elements.stream().map(ElementBuilder::build).forEach(part -> {
JsonObject partObj = new JsonObject();
partObj.add("from", serializeVector3f(part.positionFrom));
partObj.add("to", serializeVector3f(part.positionTo));
@@ -248,7 +248,7 @@ public class ModelBuilder<T extends ModelBuilder<T>> extends ModelFile {
if (part.partRotation != null) {
JsonObject rotation = new JsonObject();
rotation.add("origin", serializeVector3f(part.partRotation.origin));
rotation.addProperty("axis", part.partRotation.axis.getName());
rotation.addProperty("axis", part.partRotation.axis.func_176610_l());
rotation.addProperty("angle", part.partRotation.angle);
if (part.partRotation.rescale) {
rotation.addProperty("rescale", part.partRotation.rescale);
@@ -271,7 +271,7 @@ public class ModelBuilder<T extends ModelBuilder<T>> extends ModelFile {
faceObj.add("uv", new Gson().toJsonTree(face.blockFaceUV.uvs));
}
if (face.cullFace != null) {
faceObj.addProperty("cullface", face.cullFace.getName());
faceObj.addProperty("cullface", face.cullFace.func_176610_l());
}
if (face.blockFaceUV.rotation != 0) {
faceObj.addProperty("rotation", face.blockFaceUV.rotation);
@@ -279,7 +279,7 @@ public class ModelBuilder<T extends ModelBuilder<T>> extends ModelFile {
if (face.tintIndex != -1) {
faceObj.addProperty("tintindex", face.tintIndex);
}
faces.add(dir.getName(), faceObj);
faces.add(dir.func_176610_l(), faceObj);
}
if (!part.mapFaces.isEmpty()) {
partObj.add("faces", faces);
@@ -341,7 +341,7 @@ public class ModelBuilder<T extends ModelBuilder<T>> extends ModelFile {
/**
* Set the "from" position for this element.
*
*
* @param x x-position for this vector
* @param y y-position for this vector
* @param z z-position for this vector
@@ -358,7 +358,7 @@ public class ModelBuilder<T extends ModelBuilder<T>> extends ModelFile {
/**
* Set the "to" position for this element.
*
*
* @param x x-position for this vector
* @param y y-position for this vector
* @param z z-position for this vector
@@ -375,7 +375,7 @@ public class ModelBuilder<T extends ModelBuilder<T>> extends ModelFile {
/**
* Return or create the face builder for the given direction.
*
*
* @param dir the direction
* @return the face builder for the given direction
* @throws NullPointerException if {@code dir} is {@code null}
@@ -400,7 +400,7 @@ public class ModelBuilder<T extends ModelBuilder<T>> extends ModelFile {
/**
* Modify all <em>possible</em> faces dynamically using a function, creating new
* faces as necessary.
*
*
* @param action the function to apply to each direction
* @return this builder
* @throws NullPointerException if {@code action} is {@code null}
@@ -413,7 +413,7 @@ public class ModelBuilder<T extends ModelBuilder<T>> extends ModelFile {
/**
* Modify all <em>existing</em> faces dynamically using a function.
*
*
* @param action the function to apply to each direction
* @return this builder
* @throws NullPointerException if {@code action} is {@code null}
@@ -427,7 +427,7 @@ public class ModelBuilder<T extends ModelBuilder<T>> extends ModelFile {
/**
* Texture all <em>possible</em> faces in the current element with the given
* texture, creating new faces where necessary.
*
*
* @param texture the texture
* @return this builder
* @throws NullPointerException if {@code texture} is {@code null}
@@ -439,7 +439,7 @@ public class ModelBuilder<T extends ModelBuilder<T>> extends ModelFile {
/**
* Texture all <em>existing</em> faces in the current element with the given
* texture.
*
*
* @param texture the texture
* @return this builder
* @throws NullPointerException if {@code texture} is {@code null}
@@ -451,7 +451,7 @@ public class ModelBuilder<T extends ModelBuilder<T>> extends ModelFile {
/**
* Create a typical cube element, creating new faces as needed, applying the
* given texture, and setting the cullface.
*
*
* @param texture the texture
* @return this builder
* @throws NullPointerException if {@code texture} is {@code null}
@@ -496,7 +496,7 @@ public class ModelBuilder<T extends ModelBuilder<T>> extends ModelFile {
/**
* Set the texture for the current face.
*
*
* @param texture the texture
* @return this builder
* @throws NullPointerException if {@code texture} is {@code null}
@@ -514,7 +514,7 @@ public class ModelBuilder<T extends ModelBuilder<T>> extends ModelFile {
/**
* Set the texture rotation for the current face.
*
*
* @param rot the rotation
* @return this builder
* @throws NullPointerException if {@code rot} is {@code null}
@@ -625,7 +625,7 @@ public class ModelBuilder<T extends ModelBuilder<T>> extends ModelFile {
/**
* Begin building a new transform for the given perspective.
*
*
* @param type the perspective to create or return the builder for
* @return the builder for the given perspective
* @throws NullPointerException if {@code type} is {@code null}
@@ -32,7 +32,7 @@ import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import net.minecraft.block.Block;
import net.minecraft.state.IProperty;
import net.minecraft.state.Property;
public final class MultiPartBlockStateBuilder implements IGeneratedBlockstate {
@@ -74,7 +74,7 @@ public final class MultiPartBlockStateBuilder implements IGeneratedBlockstate {
public class PartBuilder {
public BlockStateProvider.ConfiguredModelList models;
public boolean useOr;
public final Multimap<IProperty<?>, Comparable<?>> conditions = HashMultimap.create();
public final Multimap<Property<?>, Comparable<?>> conditions = HashMultimap.create();
PartBuilder(BlockStateProvider.ConfiguredModelList models) {
this.models = models;
@@ -101,7 +101,7 @@ public final class MultiPartBlockStateBuilder implements IGeneratedBlockstate {
* current block's state
*/
@SafeVarargs
public final <T extends Comparable<T>> PartBuilder condition(IProperty<T> prop, T... values) {
public final <T extends Comparable<T>> PartBuilder condition(Property<T> prop, T... values) {
Preconditions.checkNotNull(prop, "Property must not be null");
Preconditions.checkNotNull(values, "Value list must not be null");
Preconditions.checkArgument(values.length > 0, "Value list must not be empty");
@@ -117,12 +117,12 @@ public final class MultiPartBlockStateBuilder implements IGeneratedBlockstate {
JsonObject out = new JsonObject();
if (!conditions.isEmpty()) {
JsonObject when = new JsonObject();
for (Entry<IProperty<?>, Collection<Comparable<?>>> e : conditions.asMap().entrySet()) {
for (Entry<Property<?>, Collection<Comparable<?>>> e : conditions.asMap().entrySet()) {
StringBuilder activeString = new StringBuilder();
for (Comparable<?> val : e.getValue()) {
if (activeString.length() > 0)
activeString.append("|");
activeString.append(((IProperty) e.getKey()).getName(val));
activeString.append(((Property) e.getKey()).getName(val));
}
when.addProperty(e.getKey().getName(), activeString.toString());
}
@@ -44,7 +44,7 @@ import com.google.gson.JsonObject;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.state.IProperty;
import net.minecraft.state.Property;
import net.minecraftforge.client.model.generators.BlockStateProvider.ConfiguredModelList;
/**
@@ -60,7 +60,7 @@ import net.minecraftforge.client.model.generators.BlockStateProvider.ConfiguredM
* <p>
* This class also provides the convenience methods
* {@link #forAllStates(Function)} and
* {@link #forAllStatesExcept(Function, IProperty...)} for cases where the model
* {@link #forAllStatesExcept(Function, Property...)} for cases where the model
* for each variant can be decided dynamically based on the state's property
* values.
*
@@ -160,11 +160,11 @@ public class VariantBlockStateBuilder implements IGeneratedBlockstate {
return forAllStatesExcept(mapper);
}
public VariantBlockStateBuilder forAllStatesExcept(Function<BlockState, ConfiguredModel[]> mapper, IProperty<?>... ignored) {
public VariantBlockStateBuilder forAllStatesExcept(Function<BlockState, ConfiguredModel[]> mapper, Property<?>... ignored) {
Set<PartialBlockstate> seen = new HashSet<>();
for (BlockState fullState : owner.getStateContainer().getValidStates()) {
Map<IProperty<?>, Comparable<?>> propertyValues = Maps.newLinkedHashMap(fullState.getValues());
for (IProperty<?> p : ignored) {
Map<Property<?>, Comparable<?>> propertyValues = Maps.newLinkedHashMap(fullState.getValues());
for (Property<?> p : ignored) {
propertyValues.remove(p);
}
PartialBlockstate partialState = new PartialBlockstate(owner, propertyValues, this);
@@ -177,7 +177,7 @@ public class VariantBlockStateBuilder implements IGeneratedBlockstate {
public static class PartialBlockstate implements Predicate<BlockState> {
private final Block owner;
private final SortedMap<IProperty<?>, Comparable<?>> setStates;
private final SortedMap<Property<?>, Comparable<?>> setStates;
@Nullable
private final VariantBlockStateBuilder outerBuilder;
@@ -185,22 +185,22 @@ public class VariantBlockStateBuilder implements IGeneratedBlockstate {
this(owner, ImmutableMap.of(), outerBuilder);
}
PartialBlockstate(Block owner, Map<IProperty<?>, Comparable<?>> setStates, @Nullable VariantBlockStateBuilder outerBuilder) {
PartialBlockstate(Block owner, Map<Property<?>, Comparable<?>> setStates, @Nullable VariantBlockStateBuilder outerBuilder) {
this.owner = owner;
this.outerBuilder = outerBuilder;
for (Map.Entry<IProperty<?>, Comparable<?>> entry : setStates.entrySet()) {
IProperty<?> prop = entry.getKey();
for (Map.Entry<Property<?>, Comparable<?>> entry : setStates.entrySet()) {
Property<?> prop = entry.getKey();
Comparable<?> value = entry.getValue();
Preconditions.checkArgument(owner.getStateContainer().getProperties().contains(prop), "Property %s not found on block %s", entry, this.owner);
Preconditions.checkArgument(prop.getAllowedValues().contains(value), "%s is not a valid value for %s", value, prop);
}
this.setStates = Maps.newTreeMap(Comparator.comparing(IProperty::getName));
this.setStates = Maps.newTreeMap(Comparator.comparing(Property::getName));
this.setStates.putAll(setStates);
}
public <T extends Comparable<T>> PartialBlockstate with(IProperty<T> prop, T value) {
public <T extends Comparable<T>> PartialBlockstate with(Property<T> prop, T value) {
Preconditions.checkArgument(!setStates.containsKey(prop), "Property %s has already been set", prop);
Map<IProperty<?>, Comparable<?>> newState = new HashMap<>(setStates);
Map<Property<?>, Comparable<?>> newState = new HashMap<>(setStates);
newState.put(prop, value);
return new PartialBlockstate(owner, newState, outerBuilder);
}
@@ -281,7 +281,7 @@ public class VariantBlockStateBuilder implements IGeneratedBlockstate {
return owner;
}
public SortedMap<IProperty<?>, Comparable<?>> getSetStates() {
public SortedMap<Property<?>, Comparable<?>> getSetStates() {
return setStates;
}
@@ -290,7 +290,7 @@ public class VariantBlockStateBuilder implements IGeneratedBlockstate {
if (blockState.getBlock() != getOwner()) {
return false;
}
for (Map.Entry<IProperty<?>, Comparable<?>> entry : setStates.entrySet()) {
for (Map.Entry<Property<?>, Comparable<?>> entry : setStates.entrySet()) {
if (blockState.get(entry.getKey()) != entry.getValue()) {
return false;
}
@@ -301,13 +301,13 @@ public class VariantBlockStateBuilder implements IGeneratedBlockstate {
@Override
public String toString() {
StringBuilder ret = new StringBuilder();
for (Map.Entry<IProperty<?>, Comparable<?>> entry : setStates.entrySet()) {
for (Map.Entry<Property<?>, Comparable<?>> entry : setStates.entrySet()) {
if (ret.length() > 0) {
ret.append(',');
}
ret.append(entry.getKey().getName())
.append('=')
.append(((IProperty) entry.getKey()).getName(entry.getValue()));
.append(((Property) entry.getKey()).getName(entry.getValue()));
}
return ret.toString();
}
@@ -316,10 +316,10 @@ public class VariantBlockStateBuilder implements IGeneratedBlockstate {
public static Comparator<PartialBlockstate> comparingByProperties() {
// Sort variants inversely by property values, to approximate vanilla style
return (s1, s2) -> {
SortedSet<IProperty<?>> propUniverse = new TreeSet<>(s1.getSetStates().comparator().reversed());
SortedSet<Property<?>> propUniverse = new TreeSet<>(s1.getSetStates().comparator().reversed());
propUniverse.addAll(s1.getSetStates().keySet());
propUniverse.addAll(s2.getSetStates().keySet());
for (IProperty<?> prop : propUniverse) {
for (Property<?> prop : propUniverse) {
Comparable val1 = s1.getSetStates().get(prop);
Comparable val2 = s2.getSetStates().get(prop);
if (val1 == null && val2 != null) {
@@ -45,7 +45,7 @@ public interface IModelGeometry<T extends IModelGeometry<T>>
return Optional.empty();
}
IBakedModel bake(IModelConfiguration owner, ModelBakery bakery, Function<Material, TextureAtlasSprite> spriteGetter, IModelTransform modelTransform, ItemOverrideList overrides, ResourceLocation modelLocation);
IBakedModel bake(IModelConfiguration owner, ModelBakery bakery, Function<RenderMaterial, TextureAtlasSprite> spriteGetter, IModelTransform modelTransform, ItemOverrideList overrides, ResourceLocation modelLocation);
Collection<Material> getTextures(IModelConfiguration owner, Function<ResourceLocation, IUnbakedModel> modelGetter, Set<Pair<String, String>> missingTextureErrors);
Collection<RenderMaterial> getTextures(IModelConfiguration owner, Function<ResourceLocation, IUnbakedModel> modelGetter, Set<Pair<String, String>> missingTextureErrors);
}
@@ -22,8 +22,8 @@ package net.minecraftforge.client.model.geometry;
import com.mojang.datafixers.util.Pair;
import net.minecraft.client.renderer.model.IModelTransform;
import net.minecraft.client.renderer.model.IUnbakedModel;
import net.minecraft.client.renderer.model.Material;
import net.minecraft.client.renderer.model.ModelBakery;
import net.minecraft.client.renderer.model.RenderMaterial;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.model.IModelBuilder;
@@ -38,9 +38,9 @@ public interface IModelGeometryPart
{
String name();
void addQuads(IModelConfiguration owner, IModelBuilder<?> modelBuilder, ModelBakery bakery, Function<Material, TextureAtlasSprite> spriteGetter, IModelTransform modelTransform, ResourceLocation modelLocation);
void addQuads(IModelConfiguration owner, IModelBuilder<?> modelBuilder, ModelBakery bakery, Function<RenderMaterial, TextureAtlasSprite> spriteGetter, IModelTransform modelTransform, ResourceLocation modelLocation);
default Collection<Material> getTextures(IModelConfiguration owner, Function<ResourceLocation, IUnbakedModel> modelGetter, Set<Pair<String, String>> missingTextureErrors) {
default Collection<RenderMaterial> getTextures(IModelConfiguration owner, Function<ResourceLocation, IUnbakedModel> modelGetter, Set<Pair<String, String>> missingTextureErrors) {
// No texture dependencies
return Collections.emptyList();
}
@@ -23,8 +23,8 @@ import com.google.common.collect.Sets;
import com.mojang.datafixers.util.Pair;
import net.minecraft.client.renderer.model.IModelTransform;
import net.minecraft.client.renderer.model.IUnbakedModel;
import net.minecraft.client.renderer.model.Material;
import net.minecraft.client.renderer.model.ModelBakery;
import net.minecraft.client.renderer.model.RenderMaterial;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.model.IModelBuilder;
@@ -43,16 +43,16 @@ public interface IMultipartModelGeometry<T extends IMultipartModelGeometry<T>> e
Optional<? extends IModelGeometryPart> getPart(String name);
@Override
default void addQuads(IModelConfiguration owner, IModelBuilder<?> modelBuilder, ModelBakery bakery, Function<Material, TextureAtlasSprite> spriteGetter, IModelTransform modelTransform, ResourceLocation modelLocation)
default void addQuads(IModelConfiguration owner, IModelBuilder<?> modelBuilder, ModelBakery bakery, Function<RenderMaterial, TextureAtlasSprite> spriteGetter, IModelTransform modelTransform, ResourceLocation modelLocation)
{
getParts().stream().filter(part -> owner.getPartVisibility(part))
.forEach(part -> part.addQuads(owner, modelBuilder, bakery, spriteGetter, modelTransform, modelLocation));
}
@Override
default Collection<Material> getTextures(IModelConfiguration owner, Function<ResourceLocation, IUnbakedModel> modelGetter, Set<Pair<String, String>> missingTextureErrors)
default Collection<RenderMaterial> getTextures(IModelConfiguration owner, Function<ResourceLocation, IUnbakedModel> modelGetter, Set<Pair<String, String>> missingTextureErrors)
{
Set<Material> combined = Sets.newHashSet();
Set<RenderMaterial> combined = Sets.newHashSet();
for (IModelGeometryPart part : getParts())
combined.addAll(part.getTextures(owner, modelGetter, missingTextureErrors));
return combined;
@@ -33,7 +33,7 @@ import java.util.function.Function;
public interface ISimpleModelGeometry<T extends ISimpleModelGeometry<T>> extends IModelGeometry<T>
{
@Override
default IBakedModel bake(IModelConfiguration owner, ModelBakery bakery, Function<Material, TextureAtlasSprite> spriteGetter, IModelTransform modelTransform, ItemOverrideList overrides, ResourceLocation modelLocation)
default IBakedModel bake(IModelConfiguration owner, ModelBakery bakery, Function<RenderMaterial, TextureAtlasSprite> spriteGetter, IModelTransform modelTransform, ItemOverrideList overrides, ResourceLocation modelLocation)
{
TextureAtlasSprite particle = spriteGetter.apply(owner.resolveTexture("particle"));
@@ -44,8 +44,8 @@ public interface ISimpleModelGeometry<T extends ISimpleModelGeometry<T>> extends
return builder.build();
}
void addQuads(IModelConfiguration owner, IModelBuilder<?> modelBuilder, ModelBakery bakery, Function<Material, TextureAtlasSprite> spriteGetter, IModelTransform modelTransform, ResourceLocation modelLocation);
void addQuads(IModelConfiguration owner, IModelBuilder<?> modelBuilder, ModelBakery bakery, Function<RenderMaterial, TextureAtlasSprite> spriteGetter, IModelTransform modelTransform, ResourceLocation modelLocation);
@Override
Collection<Material> getTextures(IModelConfiguration owner, Function<ResourceLocation, IUnbakedModel> modelGetter, Set<Pair<String, String>> missingTextureErrors);
Collection<RenderMaterial> getTextures(IModelConfiguration owner, Function<ResourceLocation, IUnbakedModel> modelGetter, Set<Pair<String, String>> missingTextureErrors);
}
@@ -21,7 +21,7 @@ package net.minecraftforge.client.model.obj;
import com.google.common.collect.Maps;
import joptsimple.internal.Strings;
import net.minecraft.client.renderer.Vector4f;
import net.minecraft.util.math.vector.Vector4f;
import java.io.IOException;
import java.util.Arrays;
@@ -24,16 +24,16 @@ import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
import joptsimple.internal.Strings;
import net.minecraft.client.renderer.TransformationMatrix;
import net.minecraft.client.renderer.Vector3f;
import net.minecraft.client.renderer.Vector4f;
import net.minecraft.client.renderer.model.*;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.renderer.vertex.VertexFormatElement;
import net.minecraft.util.Direction;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.Vec2f;
import net.minecraft.util.math.vector.TransformationMatrix;
import net.minecraft.util.math.vector.Vector2f;
import net.minecraft.util.math.vector.Vector3f;
import net.minecraft.util.math.vector.Vector4f;
import net.minecraftforge.client.model.*;
import net.minecraftforge.client.model.geometry.IModelGeometryPart;
import net.minecraftforge.client.model.geometry.IMultipartModelGeometry;
@@ -52,17 +52,17 @@ import java.util.stream.Collectors;
public class OBJModel implements IMultipartModelGeometry<OBJModel>
{
private static Vector4f COLOR_WHITE = new Vector4f(1, 1, 1, 1);
private static Vec2f[] DEFAULT_COORDS = {
new Vec2f(0, 0),
new Vec2f(0, 1),
new Vec2f(1, 1),
new Vec2f(1, 0),
private static Vector2f[] DEFAULT_COORDS = {
new Vector2f(0, 0),
new Vector2f(0, 1),
new Vector2f(1, 1),
new Vector2f(1, 0),
};
private final Map<String, ModelGroup> parts = Maps.newHashMap();
private final List<Vector3f> positions = Lists.newArrayList();
private final List<Vec2f> texCoords = Lists.newArrayList();
private final List<Vector2f> texCoords = Lists.newArrayList();
private final List<Vector3f> normals = Lists.newArrayList();
private final List<Vector4f> colors = Lists.newArrayList();
@@ -296,12 +296,12 @@ public class OBJModel implements IMultipartModelGeometry<OBJModel>
}
}
public static Vec2f parseVector2(String[] line)
public static Vector2f parseVector2(String[] line)
{
switch (line.length) {
case 1: return new Vec2f(0,0);
case 2: return new Vec2f(Float.parseFloat(line[1]), 0);
default: return new Vec2f(Float.parseFloat(line[1]), Float.parseFloat(line[2]));
case 1: return new Vector2f(0,0);
case 2: return new Vector2f(Float.parseFloat(line[1]), 0);
default: return new Vector2f(Float.parseFloat(line[1]), Float.parseFloat(line[2]));
}
}
@@ -366,11 +366,11 @@ public class OBJModel implements IMultipartModelGeometry<OBJModel>
builder.setQuadTint(tintIndex);
Vec2f uv2 = new Vec2f(0, 0);
Vector2f uv2 = new Vector2f(0, 0);
if (ambientToFullbright)
{
int fakeLight = (int) ((ambientColor.getX() + ambientColor.getY() + ambientColor.getZ()) * 15 / 3.0f);
uv2 = new Vec2f((fakeLight << 4) / 32767.0f, (fakeLight << 4) / 32767.0f);
uv2 = new Vector2f((fakeLight << 4) / 32767.0f, (fakeLight << 4) / 32767.0f);
builder.setApplyDiffuseLighting(fakeLight == 0);
}
else
@@ -387,7 +387,7 @@ public class OBJModel implements IMultipartModelGeometry<OBJModel>
int[] index = indices[Math.min(i,indices.length-1)];
Vector3f pos0 = positions.get(index[0]);
Vector4f position = new Vector4f(pos0);
Vec2f texCoord = index.length >= 2 && texCoords.size() > 0 ? texCoords.get(index[1]) : DEFAULT_COORDS[i];
Vector2f texCoord = index.length >= 2 && texCoords.size() > 0 ? texCoords.get(index[1]) : DEFAULT_COORDS[i];
Vector3f norm0 = !needsNormalRecalculation && index.length >= 3 && normals.size() > 0 ? normals.get(index[2]) : faceNormal;
Vector3f normal = norm0;
Vector4f color = index.length >= 4 && colors.size() > 0 ? colors.get(index[3]) : COLOR_WHITE;
@@ -465,7 +465,7 @@ public class OBJModel implements IMultipartModelGeometry<OBJModel>
return Pair.of(builder.build(), cull);
}
private void putVertexData(IVertexConsumer consumer, Vector4f position0, Vec2f texCoord0, Vector3f normal0, Vector4f color0, Vec2f uv2, TextureAtlasSprite texture)
private void putVertexData(IVertexConsumer consumer, Vector4f position0, Vector2f texCoord0, Vector3f normal0, Vector4f color0, Vector2f uv2, TextureAtlasSprite texture)
{
ImmutableList<VertexFormatElement> elements = consumer.getVertexFormat().getElements();
for(int j=0;j<elements.size();j++)
@@ -524,7 +524,7 @@ public class OBJModel implements IMultipartModelGeometry<OBJModel>
}
@Override
public void addQuads(IModelConfiguration owner, IModelBuilder<?> modelBuilder, ModelBakery bakery, Function<Material, TextureAtlasSprite> spriteGetter, IModelTransform modelTransform, ResourceLocation modelLocation)
public void addQuads(IModelConfiguration owner, IModelBuilder<?> modelBuilder, ModelBakery bakery, Function<RenderMaterial, TextureAtlasSprite> spriteGetter, IModelTransform modelTransform, ResourceLocation modelLocation)
{
for(ModelMesh mesh : meshes)
{
@@ -547,7 +547,7 @@ public class OBJModel implements IMultipartModelGeometry<OBJModel>
}
@Override
public Collection<Material> getTextures(IModelConfiguration owner, Function<ResourceLocation, IUnbakedModel> modelGetter, Set<com.mojang.datafixers.util.Pair<String, String>> missingTextureErrors)
public Collection<RenderMaterial> getTextures(IModelConfiguration owner, Function<ResourceLocation, IUnbakedModel> modelGetter, Set<com.mojang.datafixers.util.Pair<String, String>> missingTextureErrors)
{
return meshes.stream().map(mesh -> ModelLoaderRegistry.resolveTexture(mesh.mat.diffuseColorMap, owner)).collect(Collectors.toSet());
}
@@ -568,7 +568,7 @@ public class OBJModel implements IMultipartModelGeometry<OBJModel>
}
@Override
public void addQuads(IModelConfiguration owner, IModelBuilder<?> modelBuilder, ModelBakery bakery, Function<Material, TextureAtlasSprite> spriteGetter, IModelTransform modelTransform, ResourceLocation modelLocation)
public void addQuads(IModelConfiguration owner, IModelBuilder<?> modelBuilder, ModelBakery bakery, Function<RenderMaterial, TextureAtlasSprite> spriteGetter, IModelTransform modelTransform, ResourceLocation modelLocation)
{
super.addQuads(owner, modelBuilder, bakery, spriteGetter, modelTransform, modelLocation);
@@ -577,9 +577,9 @@ public class OBJModel implements IMultipartModelGeometry<OBJModel>
}
@Override
public Collection<Material> getTextures(IModelConfiguration owner, Function<ResourceLocation, IUnbakedModel> modelGetter, Set<com.mojang.datafixers.util.Pair<String, String>> missingTextureErrors)
public Collection<RenderMaterial> getTextures(IModelConfiguration owner, Function<ResourceLocation, IUnbakedModel> modelGetter, Set<com.mojang.datafixers.util.Pair<String, String>> missingTextureErrors)
{
Set<Material> combined = Sets.newHashSet();
Set<RenderMaterial> combined = Sets.newHashSet();
combined.addAll(super.getTextures(owner, modelGetter, missingTextureErrors));
for (IModelGeometryPart part : getParts())
combined.addAll(part.getTextures(owner, modelGetter, missingTextureErrors));
@@ -27,16 +27,16 @@ import net.minecraft.client.renderer.WorldRenderer;
import net.minecraft.client.renderer.color.BlockColors;
import net.minecraft.util.Direction;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
import net.minecraft.util.math.shapes.VoxelShapes;
import net.minecraft.world.ILightReader;
import net.minecraft.util.math.vector.Vector3d;
import net.minecraft.world.IBlockDisplayReader;
public class BlockInfo
{
private static final Direction[] SIDES = Direction.values();
private final BlockColors colors;
private ILightReader world;
private IBlockDisplayReader world;
private BlockState state;
private BlockPos blockPos;
@@ -71,13 +71,13 @@ public class BlockInfo
public void updateShift()
{
Vec3d offset = state.getOffset(world, blockPos);
Vector3d offset = state.getOffset(world, blockPos);
shx = (float) offset.x;
shy = (float) offset.y;
shz = (float) offset.z;
}
public void setWorld(ILightReader world)
public void setWorld(IBlockDisplayReader world)
{
this.world = world;
cachedTint = -1;
@@ -206,7 +206,7 @@ public class BlockInfo
}
}
public ILightReader getWorld()
public IBlockDisplayReader getWorld()
{
return world;
}
@@ -32,7 +32,7 @@ import net.minecraft.client.renderer.model.IBakedModel;
import net.minecraft.client.renderer.color.BlockColors;
import net.minecraft.util.Direction;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.ILightReader;
import net.minecraft.world.IBlockDisplayReader;
import net.minecraftforge.client.model.data.IModelData;
import net.minecraftforge.common.ForgeConfig;
@@ -51,7 +51,7 @@ public class ForgeBlockModelRenderer extends BlockModelRenderer
}
@Override
public boolean renderModelFlat(ILightReader world, IBakedModel model, BlockState state, BlockPos pos, MatrixStack matrixStack, IVertexBuilder buffer, boolean checkSides, Random rand, long seed, int combinedOverlayIn, IModelData modelData)
public boolean renderModelFlat(IBlockDisplayReader world, IBakedModel model, BlockState state, BlockPos pos, MatrixStack matrixStack, IVertexBuilder buffer, boolean checkSides, Random rand, long seed, int combinedOverlayIn, IModelData modelData)
{
if(ForgeConfig.CLIENT.experimentalForgeLightPipelineEnabled.get())
{
@@ -71,7 +71,7 @@ public class ForgeBlockModelRenderer extends BlockModelRenderer
}
@Override
public boolean renderModelSmooth(ILightReader world, IBakedModel model, BlockState state, BlockPos pos, MatrixStack matrixStack, IVertexBuilder buffer, boolean checkSides, Random rand, long seed, int combinedOverlayIn, IModelData modelData)
public boolean renderModelSmooth(IBlockDisplayReader world, IBakedModel model, BlockState state, BlockPos pos, MatrixStack matrixStack, IVertexBuilder buffer, boolean checkSides, Random rand, long seed, int combinedOverlayIn, IModelData modelData)
{
if(ForgeConfig.CLIENT.experimentalForgeLightPipelineEnabled.get())
{
@@ -90,7 +90,7 @@ public class ForgeBlockModelRenderer extends BlockModelRenderer
}
}
public static boolean render(VertexLighterFlat lighter, ILightReader world, IBakedModel model, BlockState state, BlockPos pos, MatrixStack matrixStack, boolean checkSides, Random rand, long seed, IModelData modelData)
public static boolean render(VertexLighterFlat lighter, IBlockDisplayReader world, IBakedModel model, BlockState state, BlockPos pos, MatrixStack matrixStack, boolean checkSides, Random rand, long seed, IModelData modelData)
{
lighter.setWorld(world);
lighter.setState(state);
@@ -93,7 +93,7 @@ public class LightUtil
{
consumer.setQuadTint(quad.getTintIndex());
}
consumer.setApplyDiffuseLighting(quad.shouldApplyDiffuseLighting());
consumer.setApplyDiffuseLighting(quad.func_239287_f_());
float[] data = new float[4];
VertexFormat formatFrom = consumer.getVertexFormat();
VertexFormat formatTo = DefaultVertexFormats.BLOCK;
@@ -19,9 +19,9 @@
package net.minecraftforge.client.model.pipeline;
import net.minecraft.client.renderer.TransformationMatrix;
import net.minecraft.client.renderer.Vector3f;
import net.minecraft.client.renderer.Vector4f;
import net.minecraft.util.math.vector.TransformationMatrix;
import net.minecraft.util.math.vector.Vector3f;
import net.minecraft.util.math.vector.Vector4f;
public class TRSRTransformer extends VertexTransformer
{
@@ -24,9 +24,7 @@ import com.google.common.collect.Lists;
import com.mojang.blaze3d.matrix.MatrixStack;
import net.minecraft.block.BlockState;
import net.minecraft.client.renderer.GameRenderer;
import net.minecraft.client.renderer.LightTexture;
import net.minecraft.client.renderer.Vector3f;
import net.minecraft.client.renderer.color.BlockColors;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
@@ -34,8 +32,9 @@ import net.minecraft.client.renderer.vertex.VertexFormat;
import net.minecraft.client.renderer.vertex.VertexFormatElement;
import net.minecraft.util.Direction;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.ILightReader;
import net.minecraft.world.IWorldReader;
import net.minecraft.util.math.vector.Vector3f;
import net.minecraft.util.math.vector.Vector4f;
import net.minecraft.world.IBlockDisplayReader;
import java.util.List;
import java.util.Objects;
@@ -222,7 +221,7 @@ public class VertexLighterFlat extends QuadGatheringTransformer
switch(element.getUsage())
{
case POSITION:
final net.minecraft.client.renderer.Vector4f pos = new net.minecraft.client.renderer.Vector4f(
final Vector4f pos = new Vector4f(
position[v][0], position[v][1], position[v][2], 1);
pos.transform(pose.getMatrix());
@@ -232,7 +231,7 @@ public class VertexLighterFlat extends QuadGatheringTransformer
parent.put(e, position[v]);
break;
case NORMAL:
final net.minecraft.client.renderer.Vector3f norm = new net.minecraft.client.renderer.Vector3f(normal[v]);
final Vector3f norm = new Vector3f(normal[v]);
norm.transform(pose.getNormal());
normal[v][0] = norm.getX();
@@ -306,7 +305,7 @@ public class VertexLighterFlat extends QuadGatheringTransformer
this.diffuse = diffuse;
}
public void setWorld(ILightReader world)
public void setWorld(IBlockDisplayReader world)
{
blockInfo.setWorld(world);
}
@@ -49,7 +49,7 @@ public enum KeyModifier {
@Override
public boolean isActive(@Nullable IKeyConflictContext conflictContext)
{
return Screen.hasControlDown();
return Screen.func_231172_r_();
}
@Override
@@ -70,7 +70,7 @@ public enum KeyModifier {
@Override
public boolean isActive(@Nullable IKeyConflictContext conflictContext)
{
return Screen.hasShiftDown();
return Screen.func_231173_s_();
}
@Override
@@ -89,7 +89,7 @@ public enum KeyModifier {
@Override
public boolean isActive(@Nullable IKeyConflictContext conflictContext)
{
return Screen.hasAltDown();
return Screen.func_231174_t_();
}
@Override
@@ -377,7 +377,7 @@ public class BiomeDictionary
addTypes(Biomes.TAIGA, COLD, CONIFEROUS, FOREST, OVERWORLD );
addTypes(Biomes.SWAMP, WET, SWAMP, OVERWORLD );
addTypes(Biomes.RIVER, RIVER, OVERWORLD );
addTypes(Biomes.NETHER, HOT, DRY, NETHER );
addTypes(Biomes.field_235254_j_, HOT, DRY, NETHER );
addTypes(Biomes.THE_END, COLD, DRY, END );
addTypes(Biomes.FROZEN_OCEAN, COLD, OCEAN, SNOWY, OVERWORLD );
addTypes(Biomes.FROZEN_RIVER, COLD, RIVER, SNOWY, OVERWORLD );
@@ -17,7 +17,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
package net.minecraftforge.common;
/*package net.minecraftforge.common;
import java.io.File;
import java.io.IOException;
@@ -63,6 +63,7 @@ import net.minecraft.world.chunk.listener.IChunkStatusListener;
import net.minecraft.world.server.ServerMultiWorld;
import net.minecraft.world.server.ServerWorld;
import net.minecraft.world.dimension.DimensionType;
import net.minecraft.world.storage.SaveFormat;
import net.minecraft.world.storage.SaveHandler;
import net.minecraftforge.common.util.Constants;
import net.minecraftforge.event.world.RegisterDimensionsEvent;
@@ -108,7 +109,7 @@ public class DimensionManager
* @param hasSkyLight does this dimension have a skylight?
* @param magnifier The biome generation processor
* @return the DimensionType for the dimension.
*/
* /
public static DimensionType registerOrGetDimension(ResourceLocation name, ModDimension type, PacketBuffer data, boolean hasSkyLight)
{
return REGISTRY.getValue(name).orElseGet(()->registerDimension(name, type, data, hasSkyLight));
@@ -125,7 +126,7 @@ public class DimensionManager
* @param hasSkyLight skylight for this dimension
* @param magnifier The biome generation processor
* @return the DimensionType for the dimension.
*/
* /
public static DimensionType registerDimension(ResourceLocation name, ModDimension type, PacketBuffer data, boolean hasSkyLight)
{
Validate.notNull(name, "Can not register a dimension with null name");
@@ -154,7 +155,7 @@ public class DimensionManager
* @param dim The dimension
* @param value True to keep loaded, false to allow unloading
* @return The old value for this dimension.
*/
* /
public static boolean keepLoaded(DimensionType dim, boolean value)
{
Validate.notNull(dim, "Dimension type must not be null");
@@ -168,7 +169,7 @@ public class DimensionManager
* Determines if the dimension will stay loaded in memory even if all chunks are unloaded.
* @param dim The dimension
* @return True if the dimension will stay loaded with no chunks loaded.
*/
* /
public static boolean keepLoaded(DimensionType dim)
{
Validate.notNull(dim, "Dimension type must not be null");
@@ -184,7 +185,7 @@ public class DimensionManager
* @param resetUnloadDelay True to reset the unload timer, which is a delay that is used to prevent constant world loading/unloading cycle.
* @param forceLoad True to attempt to load the dimension if the server has it unloaded.
* @return The world, null if unloaded and not loadable.
*/
* /
@Nullable
public static ServerWorld getWorld(MinecraftServer server, DimensionType dim, boolean resetUnloadDelay, boolean forceLoad)
{
@@ -219,7 +220,7 @@ public class DimensionManager
* Vanilla dimensions are not supported and will throw an exception.
*
* @param dim the dimension to delete
*/
* /
public static void markForDeletion(DimensionType dim)
{
if (dim.isVanilla())
@@ -248,7 +249,7 @@ public class DimensionManager
/**
* Deprecated, unregistering dimensions at runtime is not supported.
* @see DimensionManager#markForDeletion(DimensionType)
*/
* /
@Deprecated
public static void unregisterDimension(int id)
{
@@ -302,7 +303,7 @@ public class DimensionManager
/**
* Queues a dimension to unload, if it can be unloaded.
* @param world The world to unload
*/
* /
public static void unloadWorld(ServerWorld world)
{
if (world == null || !canUnloadWorld(world))
@@ -466,7 +467,7 @@ public class DimensionManager
.forEach(foldersScheduledForDeletion::add);
}
public static void processScheduledDeletions(SaveHandler saveHandler)
public static void processScheduledDeletions(SaveFormat.LevelSave levelSave)
{
List<String> toDelete = new ArrayList<>(foldersScheduledForDeletion);
foldersScheduledForDeletion.clear();
@@ -486,7 +487,7 @@ public class DimensionManager
}
for (String folderName : toDelete)
{
File folder = new File(saveHandler.getWorldDirectory(), folderName);
File folder = new File(levelSave.getWorldDir().toFile(), folderName);
try
{
FileUtils.deleteDirectory(folder);
@@ -613,4 +614,4 @@ public class DimensionManager
playerWorlds = players.getPlayers().stream().map(e -> e.world).collect(Collectors.toSet());
return changed;
}
}
}*/
@@ -26,7 +26,7 @@ import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.ChunkPos;
import net.minecraft.util.math.Vec3d;
import net.minecraft.util.math.vector.Vector3d;
import net.minecraft.world.IWorldReader;
import net.minecraft.world.World;
import net.minecraft.world.chunk.IChunk;
@@ -36,6 +36,7 @@ import net.minecraftforge.common.ticket.SimpleTicket;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.util.Collections;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
@@ -43,7 +44,7 @@ import java.util.Set;
public class FarmlandWaterManager
{
private static boolean DEBUG = Boolean.parseBoolean(System.getProperty("forge.debugFarmlandWaterManager", "false"));
private static final Int2ObjectMap<Map<ChunkPos, ChunkTicketManager<Vec3d>>> customWaterHandler = new Int2ObjectOpenHashMap<>();
private static final Int2ObjectMap<Map<ChunkPos, ChunkTicketManager<Vector3d>>> customWaterHandler = new Int2ObjectOpenHashMap<>();
private static final Logger LOGGER = LogManager.getLogger();
/**
@@ -59,11 +60,11 @@ public class FarmlandWaterManager
* @return The ticket for your requested region.
*/
@SuppressWarnings("unchecked")
public static<T extends SimpleTicket<Vec3d>> T addCustomTicket(World world, T ticket, ChunkPos masterChunk, ChunkPos... additionalChunks)
public static<T extends SimpleTicket<Vector3d>> T addCustomTicket(World world, T ticket, ChunkPos masterChunk, ChunkPos... additionalChunks)
{
Preconditions.checkArgument(!world.isRemote, "Water region is only determined server-side");
Map<ChunkPos, ChunkTicketManager<Vec3d>> ticketMap = customWaterHandler.computeIfAbsent(world.getDimension().getType().getId(), id -> new MapMaker().weakValues().makeMap());
ChunkTicketManager<Vec3d>[] additionalTickets = new ChunkTicketManager[additionalChunks.length];
Map<ChunkPos, ChunkTicketManager<Vector3d>> ticketMap = Collections.emptyMap();// customWaterHandler.computeIfAbsent(world.getDimension().getType().getId(), id -> new MapMaker().weakValues().makeMap()); //TODO Dimensions
ChunkTicketManager<Vector3d>[] additionalTickets = new ChunkTicketManager[additionalChunks.length];
for (int i = 0; i < additionalChunks.length; i++)
additionalTickets[i] = ticketMap.computeIfAbsent(additionalChunks[i], ChunkTicketManager::new);
ticket.setManager(ticketMap.computeIfAbsent(masterChunk, ChunkTicketManager::new), additionalTickets);
@@ -116,7 +117,7 @@ public class FarmlandWaterManager
return addCustomTicket(world, new AABBTicket(aabb), masterPos, posSet.toArray(new ChunkPos[0]));
}
private static double getDistanceSq(ChunkPos pos, Vec3d vec3d)
private static double getDistanceSq(ChunkPos pos, Vector3d vec3d)
{
//See ChunkPos#getDistanceSq
double d0 = (double)(pos.x * 16 + 8);
@@ -132,11 +133,11 @@ public class FarmlandWaterManager
*/
public static boolean hasBlockWaterTicket(IWorldReader world, BlockPos pos)
{
ChunkTicketManager<Vec3d> ticketManager = getTicketManager(new ChunkPos(pos.getX() >> 4, pos.getZ() >> 4), world);
ChunkTicketManager<Vector3d> ticketManager = getTicketManager(new ChunkPos(pos.getX() >> 4, pos.getZ() >> 4), world);
if (ticketManager != null)
{
Vec3d posAsVec3d = new Vec3d(pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5);
for (SimpleTicket<Vec3d> ticket : ticketManager.getTickets()) {
Vector3d posAsVec3d = new Vector3d(pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5);
for (SimpleTicket<Vector3d> ticket : ticketManager.getTickets()) {
if (ticket.matches(posAsVec3d))
return true;
}
@@ -146,7 +147,7 @@ public class FarmlandWaterManager
static void removeTickets(IChunk chunk)
{
ChunkTicketManager<Vec3d> ticketManager = getTicketManager(chunk.getPos(), chunk.getWorldForge());
ChunkTicketManager<Vector3d> ticketManager = getTicketManager(chunk.getPos(), chunk.getWorldForge());
if (ticketManager != null)
{
if (DEBUG)
@@ -157,9 +158,9 @@ public class FarmlandWaterManager
}
}
private static ChunkTicketManager<Vec3d> getTicketManager(ChunkPos pos, IWorldReader world) {
private static ChunkTicketManager<Vector3d> getTicketManager(ChunkPos pos, IWorldReader world) {
Preconditions.checkArgument(!world.isRemote(), "Water region is only determined server-side");
Map<ChunkPos, ChunkTicketManager<Vec3d>> ticketMap = customWaterHandler.get(world.getDimension().getType().getId());
Map<ChunkPos, ChunkTicketManager<Vector3d>> ticketMap = Collections.emptyMap();//customWaterHandler.get(world.getDimension().getType().getId()); //TODO Dimensions
if (ticketMap == null)
{
return null;
@@ -47,7 +47,10 @@ import javax.annotation.Nullable;
import net.minecraft.advancements.Advancement;
import net.minecraft.block.Block;
import net.minecraft.fluid.*;
import net.minecraft.util.CachedBlockInfo;
import net.minecraft.loot.LootContext;
import net.minecraft.loot.LootTable;
import net.minecraft.loot.LootTableManager;
import net.minecraft.util.*;
import net.minecraft.block.BlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.screen.Screen;
@@ -85,26 +88,17 @@ import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionUtils;
import net.minecraft.stats.Stats;
import net.minecraft.tags.Tag;
import net.minecraft.util.math.vector.Vector3d;
import net.minecraft.util.text.*;
import net.minecraft.world.spawner.AbstractSpawner;
import net.minecraft.tileentity.FurnaceTileEntity;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.DamageSource;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.IntIdentityHashBiMap;
import net.minecraft.util.JSONUtils;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraft.util.math.EntityRayTraceResult;
import net.minecraft.util.math.Vec3d;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.StringTextComponent;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.util.text.event.ClickEvent;
import net.minecraft.world.Difficulty;
import net.minecraft.world.GameType;
@@ -112,10 +106,6 @@ import net.minecraft.world.IBlockReader;
import net.minecraft.world.IWorld;
import net.minecraft.world.IWorldReader;
import net.minecraft.world.World;
import net.minecraft.world.dimension.DimensionType;
import net.minecraft.world.storage.loot.LootContext;
import net.minecraft.world.storage.loot.LootTable;
import net.minecraft.world.storage.loot.LootTableManager;
import net.minecraftforge.common.loot.IGlobalLootModifier;
import net.minecraftforge.common.loot.LootModifierManager;
import net.minecraftforge.common.util.BlockSnapshot;
@@ -175,7 +165,7 @@ public class ForgeHooks
public static boolean canHarvestBlock(@Nonnull BlockState state, @Nonnull PlayerEntity player, @Nonnull IBlockReader world, @Nonnull BlockPos pos)
{
//state = state.getActualState(world, pos);
if (state.getMaterial().isToolNotRequired())
if (state.func_235783_q_())
{
return true;
}
@@ -184,13 +174,13 @@ public class ForgeHooks
ToolType tool = state.getHarvestTool();
if (stack.isEmpty() || tool == null)
{
return player.canHarvestBlock(state);
return true; // TODO: player.canHarvestBlock(state);
}
int toolLevel = stack.getItem().getHarvestLevel(stack, tool, player, state);
if (toolLevel < 0)
{
return player.canHarvestBlock(state);
return true; //TODO: player.canHarvestBlock(state);
}
return ForgeEventFactory.doPlayerHarvestCheck(player, state, toolLevel >= state.getHarvestLevel());
@@ -256,7 +246,7 @@ public class ForgeHooks
if (state.isAir(world, pos))
return false;
if (isCreative && Screen.hasControlDown() && state.hasTileEntity())
if (isCreative && Screen.func_231172_r_() && state.hasTileEntity())
te = world.getTileEntity(pos);
result = state.getBlock().getPickBlock(state, target, world, pos, player);
@@ -467,7 +457,7 @@ public class ForgeHooks
// Includes ipv4 and domain pattern
// Matches an ip (xx.xxx.xx.xxx) or a domain (something.com) with or
// without a protocol or path.
ITextComponent ichat = null;
IFormattableTextComponent ichat = null;
Matcher matcher = URL_PATTERN.matcher(string);
int lastEnd = 0;
@@ -484,11 +474,11 @@ public class ForgeHooks
if (ichat == null)
ichat = new StringTextComponent(part);
else
ichat.appendText(part);
ichat.func_240702_b_(part);
}
lastEnd = end;
String url = string.substring(start, end);
ITextComponent link = new StringTextComponent(url);
IFormattableTextComponent link = new StringTextComponent(url);
try
{
@@ -500,7 +490,7 @@ public class ForgeHooks
if (ichat == null)
ichat = new StringTextComponent(url);
else
ichat.appendText(url);
ichat.func_240702_b_(url);
continue;
}
url = "http://" + url;
@@ -510,18 +500,16 @@ public class ForgeHooks
{
// Bad syntax bail out!
if (ichat == null) ichat = new StringTextComponent(url);
else ichat.appendText(url);
else ichat.func_240702_b_(url);
continue;
}
// Set the click event and append the link.
ClickEvent click = new ClickEvent(ClickEvent.Action.OPEN_URL, url);
link.getStyle().setClickEvent(click);
link.getStyle().setUnderlined(true);
link.getStyle().setColor(TextFormatting.BLUE);
link.func_230530_a_(link.getStyle().func_240715_a_(click).setUnderlined(true).func_240718_a_(Color.func_240744_a_(TextFormatting.BLUE)));
if (ichat == null)
ichat = new StringTextComponent("");
ichat.appendSibling(link);
ichat.func_230529_a_(link);
}
// Append the rest of the message.
@@ -529,7 +517,7 @@ public class ForgeHooks
if (ichat == null)
ichat = new StringTextComponent(end);
else if (end.length() > 0)
ichat.appendText(string.substring(lastEnd));
ichat.func_230529_a_(new StringTextComponent(string.substring(lastEnd)));
return ichat;
}
@@ -669,7 +657,7 @@ public class ForgeHooks
newBlock.onBlockAdded(world, snap.getPos(), oldBlock, false);
}
world.markAndNotifyBlock(snap.getPos(), null, oldBlock, newBlock, updateFlag);
world.markAndNotifyBlock(snap.getPos(), null, oldBlock, newBlock, updateFlag, 512);
}
player.addStat(Stats.ITEM_USED.get(item));
}
@@ -730,7 +718,7 @@ public class ForgeHooks
return stack.isEmpty() || !stack.getItem().onLeftClickEntity(stack, player, target);
}
public static boolean onTravelToDimension(Entity entity, DimensionType dimension)
public static boolean onTravelToDimension(Entity entity, RegistryKey<World> dimension)
{
EntityTravelToDimensionEvent event = new EntityTravelToDimensionEvent(entity, dimension);
MinecraftForge.EVENT_BUS.post(event);
@@ -747,11 +735,11 @@ public class ForgeHooks
public static ActionResultType onInteractEntityAt(PlayerEntity player, Entity entity, RayTraceResult ray, Hand hand)
{
Vec3d vec3d = ray.getHitVec().subtract(entity.getPositionVec());
Vector3d vec3d = ray.getHitVec().subtract(entity.getPositionVec());
return onInteractEntityAt(player, entity, vec3d, hand);
}
public static ActionResultType onInteractEntityAt(PlayerEntity player, Entity entity, Vec3d vec3d, Hand hand)
public static ActionResultType onInteractEntityAt(PlayerEntity player, Entity entity, Vector3d vec3d, Hand hand)
{
PlayerInteractEvent.EntityInteractSpecific evt = new PlayerInteractEvent.EntityInteractSpecific(player, hand, entity, vec3d);
MinecraftForge.EVENT_BUS.post(evt);
@@ -833,8 +821,10 @@ public class ForgeHooks
if (!custom)
ret = ForgeEventFactory.loadLootTable(name, ret, lootTableManager);
if (ret != null)
/* TODO:
if (ret != null)
ret.freeze();
*/
return ret;
}
@@ -1067,7 +1057,7 @@ public class ForgeHooks
}
@Override
public IFluidState getFluidState(BlockPos pos) {
public FluidState getFluidState(BlockPos pos) {
return Fluids.EMPTY.getDefaultState();
}
@@ -1085,6 +1075,7 @@ public class ForgeHooks
return res == Result.DEFAULT ? 0 : res == Result.DENY ? -1 : 1;
}
/*
@SuppressWarnings("deprecation")
public static <T> void deserializeTagAdditions(Tag.Builder<T> builder, Function<ResourceLocation, Optional<T>> valueGetter, JsonObject json)
{
@@ -1121,6 +1112,7 @@ public class ForgeHooks
}
}
}
*/
private static final Map<IDataSerializer<?>, DataSerializerEntry> serializerEntries = GameData.getSerializerMap();
//private static final ForgeRegistry<DataSerializerEntry> serializerRegistry = (ForgeRegistry<DataSerializerEntry>) ForgeRegistries.DATA_SERIALIZERS;
@@ -1189,10 +1181,12 @@ public class ForgeHooks
* @return The modified list
*/
public static List<ItemStack> modifyLoot(List<ItemStack> list, LootContext context) {
/*
LootModifierManager man = context.getWorld().getServer().getLootModifierManager();
for(IGlobalLootModifier mod : man.getAllLootMods()) {
list = mod.apply(list, context);
}
*/
return list;
}
@@ -89,12 +89,14 @@ public class ForgeInternalHandler
FarmlandWaterManager.removeTickets(event.getChunk());
}
/*
@SubscribeEvent
public void playerChangeDimension(PlayerEvent.PlayerChangedDimensionEvent event)
{
if (event.getPlayer() instanceof ServerPlayerEntity)
DimensionManager.rebuildPlayerMap(((ServerPlayerEntity)event.getPlayer()).server.getPlayerList(), true);
}
*/
@SubscribeEvent
public void playerLogin(PlayerEvent.PlayerLoggedInEvent event)
@@ -20,6 +20,9 @@
package net.minecraftforge.common;
import net.minecraft.util.SoundEvent;
import net.minecraft.world.storage.IServerConfiguration;
import net.minecraft.world.storage.IWorldInfo;
import net.minecraft.world.storage.SaveFormat;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.*;
@@ -44,8 +47,6 @@ import net.minecraft.item.crafting.IRecipe;
import net.minecraft.item.crafting.IRecipeSerializer;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.storage.SaveHandler;
import net.minecraft.world.storage.WorldInfo;
import net.minecraftforge.common.crafting.CompoundIngredient;
import net.minecraftforge.common.crafting.ConditionalRecipe;
import net.minecraftforge.common.crafting.CraftingHelper;
@@ -144,22 +145,24 @@ public class ForgeMod implements WorldPersistenceHooks.WorldPersistenceHook
}
@Override
public CompoundNBT getDataForWriting(SaveHandler handler, WorldInfo info)
public CompoundNBT getDataForWriting(SaveFormat.LevelSave levelSave, IServerConfiguration serverInfo)
{
CompoundNBT forgeData = new CompoundNBT();
CompoundNBT dims = new CompoundNBT();
DimensionManager.writeRegistry(dims);
//TODO Dimensions
// DimensionManager.writeRegistry(dims);
if (!dims.isEmpty())
forgeData.put("dims", dims);
return forgeData;
}
@Override
public void readData(SaveHandler handler, WorldInfo info, CompoundNBT tag)
public void readData(SaveFormat.LevelSave levelSave, IServerConfiguration serverInfo, CompoundNBT tag)
{
if (tag.contains("dims", 10))
DimensionManager.readRegistry(tag.getCompound("dims"));
DimensionManager.processScheduledDeletions(handler);
//TODO Dimensions
// if (tag.contains("dims", 10))
// DimensionManager.readRegistry(tag.getCompound("dims"));
// DimensionManager.processScheduledDeletions(levelSave);
}
public void mappingChanged(FMLModIdMappingEvent evt)
@@ -178,8 +181,9 @@ public class ForgeMod implements WorldPersistenceHooks.WorldPersistenceHook
if (event.includeServer())
{
ForgeBlockTagsProvider blockTags = new ForgeBlockTagsProvider(gen);
gen.addProvider(new ForgeBlockTagsProvider(gen));
gen.addProvider(new ForgeItemTagsProvider(gen));
gen.addProvider(new ForgeItemTagsProvider(gen, blockTags));
gen.addProvider(new ForgeRecipeProvider(gen));
gen.addProvider(new ForgeLootTableProvider(gen));
}
@@ -17,7 +17,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
package net.minecraftforge.common;
/*package net.minecraftforge.common;
import java.util.function.BiFunction;
@@ -34,7 +34,7 @@ import net.minecraftforge.registries.ForgeRegistryEntry;
* We used to be able to create custom Dimensions separate from DimensionType.
* But now that they are hard linked to a single instance, this is the new class that
* defines the 'template' for new dimensions.
*/
* /
public abstract class ModDimension extends ForgeRegistryEntry<ModDimension>
{
public abstract BiFunction<World, DimensionType, ? extends Dimension> getFactory();
@@ -45,7 +45,7 @@ public abstract class ModDimension extends ForgeRegistryEntry<ModDimension>
*
* @param buffer The data buffer to write to.
* @param network true when sent over the network, so you can only data needed by the client.
*/
* /
public void write(PacketBuffer buffer, boolean network){}
/**
@@ -54,7 +54,7 @@ public abstract class ModDimension extends ForgeRegistryEntry<ModDimension>
*
* @param buffer The data buffer to write to.
* @param network true when sent over the network, so you can only data needed by the client.
*/
* /
public void read(PacketBuffer buffer, boolean network){}
public IBiomeMagnifier getMagnifier() {
@@ -67,7 +67,7 @@ public abstract class ModDimension extends ForgeRegistryEntry<ModDimension>
*
* @param factory Factory for creating {@link Dimension} instances from DimType and World.
* @return A custom ModDimension with that factory.
*/
* /
public static ModDimension withFactory(BiFunction<World, DimensionType, ? extends Dimension> factory) {
return new ModDimension() {
@Override
@@ -76,4 +76,4 @@ public abstract class ModDimension extends ForgeRegistryEntry<ModDimension>
}
};
}
}
}*/
+200 -202
View File
@@ -22,229 +22,228 @@ package net.minecraftforge.common;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraft.tags.BlockTags;
import net.minecraft.tags.ITag;
import net.minecraft.tags.ItemTags;
import net.minecraft.tags.Tag;
import net.minecraft.util.ResourceLocation;
public class Tags
{
public static class Blocks
{
public static final Tag<Block> CHESTS = tag("chests");
public static final Tag<Block> CHESTS_ENDER = tag("chests/ender");
public static final Tag<Block> CHESTS_TRAPPED = tag("chests/trapped");
public static final Tag<Block> CHESTS_WOODEN = tag("chests/wooden");
public static final Tag<Block> COBBLESTONE = tag("cobblestone");
public static final Tag<Block> DIRT = tag("dirt");
public static final Tag<Block> END_STONES = tag("end_stones");
public static final Tag<Block> FENCE_GATES = tag("fence_gates");
public static final Tag<Block> FENCE_GATES_WOODEN = tag("fence_gates/wooden");
public static final Tag<Block> FENCES = tag("fences");
public static final Tag<Block> FENCES_NETHER_BRICK = tag("fences/nether_brick");
public static final Tag<Block> FENCES_WOODEN = tag("fences/wooden");
public static final ITag.INamedTag<Block> CHESTS = tag("chests");
public static final ITag.INamedTag<Block> CHESTS_ENDER = tag("chests/ender");
public static final ITag.INamedTag<Block> CHESTS_TRAPPED = tag("chests/trapped");
public static final ITag.INamedTag<Block> CHESTS_WOODEN = tag("chests/wooden");
public static final ITag.INamedTag<Block> COBBLESTONE = tag("cobblestone");
public static final ITag.INamedTag<Block> DIRT = tag("dirt");
public static final ITag.INamedTag<Block> END_STONES = tag("end_stones");
public static final ITag.INamedTag<Block> FENCE_GATES = tag("fence_gates");
public static final ITag.INamedTag<Block> FENCE_GATES_WOODEN = tag("fence_gates/wooden");
public static final ITag.INamedTag<Block> FENCES = tag("fences");
public static final ITag.INamedTag<Block> FENCES_NETHER_BRICK = tag("fences/nether_brick");
public static final ITag.INamedTag<Block> FENCES_WOODEN = tag("fences/wooden");
public static final Tag<Block> GLASS = tag("glass");
public static final Tag<Block> GLASS_BLACK = tag("glass/black");
public static final Tag<Block> GLASS_BLUE = tag("glass/blue");
public static final Tag<Block> GLASS_BROWN = tag("glass/brown");
public static final Tag<Block> GLASS_COLORLESS = tag("glass/colorless");
public static final Tag<Block> GLASS_CYAN = tag("glass/cyan");
public static final Tag<Block> GLASS_GRAY = tag("glass/gray");
public static final Tag<Block> GLASS_GREEN = tag("glass/green");
public static final Tag<Block> GLASS_LIGHT_BLUE = tag("glass/light_blue");
public static final Tag<Block> GLASS_LIGHT_GRAY = tag("glass/light_gray");
public static final Tag<Block> GLASS_LIME = tag("glass/lime");
public static final Tag<Block> GLASS_MAGENTA = tag("glass/magenta");
public static final Tag<Block> GLASS_ORANGE = tag("glass/orange");
public static final Tag<Block> GLASS_PINK = tag("glass/pink");
public static final Tag<Block> GLASS_PURPLE = tag("glass/purple");
public static final Tag<Block> GLASS_RED = tag("glass/red");
public static final Tag<Block> GLASS_WHITE = tag("glass/white");
public static final Tag<Block> GLASS_YELLOW = tag("glass/yellow");
public static final ITag.INamedTag<Block> GLASS = tag("glass");
public static final ITag.INamedTag<Block> GLASS_BLACK = tag("glass/black");
public static final ITag.INamedTag<Block> GLASS_BLUE = tag("glass/blue");
public static final ITag.INamedTag<Block> GLASS_BROWN = tag("glass/brown");
public static final ITag.INamedTag<Block> GLASS_COLORLESS = tag("glass/colorless");
public static final ITag.INamedTag<Block> GLASS_CYAN = tag("glass/cyan");
public static final ITag.INamedTag<Block> GLASS_GRAY = tag("glass/gray");
public static final ITag.INamedTag<Block> GLASS_GREEN = tag("glass/green");
public static final ITag.INamedTag<Block> GLASS_LIGHT_BLUE = tag("glass/light_blue");
public static final ITag.INamedTag<Block> GLASS_LIGHT_GRAY = tag("glass/light_gray");
public static final ITag.INamedTag<Block> GLASS_LIME = tag("glass/lime");
public static final ITag.INamedTag<Block> GLASS_MAGENTA = tag("glass/magenta");
public static final ITag.INamedTag<Block> GLASS_ORANGE = tag("glass/orange");
public static final ITag.INamedTag<Block> GLASS_PINK = tag("glass/pink");
public static final ITag.INamedTag<Block> GLASS_PURPLE = tag("glass/purple");
public static final ITag.INamedTag<Block> GLASS_RED = tag("glass/red");
public static final ITag.INamedTag<Block> GLASS_WHITE = tag("glass/white");
public static final ITag.INamedTag<Block> GLASS_YELLOW = tag("glass/yellow");
public static final Tag<Block> GLASS_PANES = tag("glass_panes");
public static final Tag<Block> GLASS_PANES_BLACK = tag("glass_panes/black");
public static final Tag<Block> GLASS_PANES_BLUE = tag("glass_panes/blue");
public static final Tag<Block> GLASS_PANES_BROWN = tag("glass_panes/brown");
public static final Tag<Block> GLASS_PANES_COLORLESS = tag("glass_panes/colorless");
public static final Tag<Block> GLASS_PANES_CYAN = tag("glass_panes/cyan");
public static final Tag<Block> GLASS_PANES_GRAY = tag("glass_panes/gray");
public static final Tag<Block> GLASS_PANES_GREEN = tag("glass_panes/green");
public static final Tag<Block> GLASS_PANES_LIGHT_BLUE = tag("glass_panes/light_blue");
public static final Tag<Block> GLASS_PANES_LIGHT_GRAY = tag("glass_panes/light_gray");
public static final Tag<Block> GLASS_PANES_LIME = tag("glass_panes/lime");
public static final Tag<Block> GLASS_PANES_MAGENTA = tag("glass_panes/magenta");
public static final Tag<Block> GLASS_PANES_ORANGE = tag("glass_panes/orange");
public static final Tag<Block> GLASS_PANES_PINK = tag("glass_panes/pink");
public static final Tag<Block> GLASS_PANES_PURPLE = tag("glass_panes/purple");
public static final Tag<Block> GLASS_PANES_RED = tag("glass_panes/red");
public static final Tag<Block> GLASS_PANES_WHITE = tag("glass_panes/white");
public static final Tag<Block> GLASS_PANES_YELLOW = tag("glass_panes/yellow");
public static final ITag.INamedTag<Block> GLASS_PANES = tag("glass_panes");
public static final ITag.INamedTag<Block> GLASS_PANES_BLACK = tag("glass_panes/black");
public static final ITag.INamedTag<Block> GLASS_PANES_BLUE = tag("glass_panes/blue");
public static final ITag.INamedTag<Block> GLASS_PANES_BROWN = tag("glass_panes/brown");
public static final ITag.INamedTag<Block> GLASS_PANES_COLORLESS = tag("glass_panes/colorless");
public static final ITag.INamedTag<Block> GLASS_PANES_CYAN = tag("glass_panes/cyan");
public static final ITag.INamedTag<Block> GLASS_PANES_GRAY = tag("glass_panes/gray");
public static final ITag.INamedTag<Block> GLASS_PANES_GREEN = tag("glass_panes/green");
public static final ITag.INamedTag<Block> GLASS_PANES_LIGHT_BLUE = tag("glass_panes/light_blue");
public static final ITag.INamedTag<Block> GLASS_PANES_LIGHT_GRAY = tag("glass_panes/light_gray");
public static final ITag.INamedTag<Block> GLASS_PANES_LIME = tag("glass_panes/lime");
public static final ITag.INamedTag<Block> GLASS_PANES_MAGENTA = tag("glass_panes/magenta");
public static final ITag.INamedTag<Block> GLASS_PANES_ORANGE = tag("glass_panes/orange");
public static final ITag.INamedTag<Block> GLASS_PANES_PINK = tag("glass_panes/pink");
public static final ITag.INamedTag<Block> GLASS_PANES_PURPLE = tag("glass_panes/purple");
public static final ITag.INamedTag<Block> GLASS_PANES_RED = tag("glass_panes/red");
public static final ITag.INamedTag<Block> GLASS_PANES_WHITE = tag("glass_panes/white");
public static final ITag.INamedTag<Block> GLASS_PANES_YELLOW = tag("glass_panes/yellow");
public static final Tag<Block> GRAVEL = tag("gravel");
public static final Tag<Block> NETHERRACK = tag("netherrack");
public static final Tag<Block> OBSIDIAN = tag("obsidian");
public static final Tag<Block> ORES = tag("ores");
public static final Tag<Block> ORES_COAL = tag("ores/coal");
public static final Tag<Block> ORES_DIAMOND = tag("ores/diamond");
public static final Tag<Block> ORES_EMERALD = tag("ores/emerald");
public static final Tag<Block> ORES_GOLD = tag("ores/gold");
public static final Tag<Block> ORES_IRON = tag("ores/iron");
public static final Tag<Block> ORES_LAPIS = tag("ores/lapis");
public static final Tag<Block> ORES_QUARTZ = tag("ores/quartz");
public static final Tag<Block> ORES_REDSTONE = tag("ores/redstone");
public static final ITag.INamedTag<Block> GRAVEL = tag("gravel");
public static final ITag.INamedTag<Block> NETHERRACK = tag("netherrack");
public static final ITag.INamedTag<Block> OBSIDIAN = tag("obsidian");
public static final ITag.INamedTag<Block> ORES = tag("ores");
public static final ITag.INamedTag<Block> ORES_COAL = tag("ores/coal");
public static final ITag.INamedTag<Block> ORES_DIAMOND = tag("ores/diamond");
public static final ITag.INamedTag<Block> ORES_EMERALD = tag("ores/emerald");
public static final ITag.INamedTag<Block> ORES_GOLD = tag("ores/gold");
public static final ITag.INamedTag<Block> ORES_IRON = tag("ores/iron");
public static final ITag.INamedTag<Block> ORES_LAPIS = tag("ores/lapis");
public static final ITag.INamedTag<Block> ORES_QUARTZ = tag("ores/quartz");
public static final ITag.INamedTag<Block> ORES_REDSTONE = tag("ores/redstone");
public static final Tag<Block> SAND = tag("sand");
public static final Tag<Block> SAND_COLORLESS = tag("sand/colorless");
public static final Tag<Block> SAND_RED = tag("sand/red");
public static final ITag.INamedTag<Block> SAND = tag("sand");
public static final ITag.INamedTag<Block> SAND_COLORLESS = tag("sand/colorless");
public static final ITag.INamedTag<Block> SAND_RED = tag("sand/red");
public static final Tag<Block> SANDSTONE = tag("sandstone");
public static final Tag<Block> STAINED_GLASS = tag("stained_glass");
public static final Tag<Block> STAINED_GLASS_PANES = tag("stained_glass_panes");
public static final Tag<Block> STONE = tag("stone");
public static final Tag<Block> STORAGE_BLOCKS = tag("storage_blocks");
public static final Tag<Block> STORAGE_BLOCKS_COAL = tag("storage_blocks/coal");
public static final Tag<Block> STORAGE_BLOCKS_DIAMOND = tag("storage_blocks/diamond");
public static final Tag<Block> STORAGE_BLOCKS_EMERALD = tag("storage_blocks/emerald");
public static final Tag<Block> STORAGE_BLOCKS_GOLD = tag("storage_blocks/gold");
public static final Tag<Block> STORAGE_BLOCKS_IRON = tag("storage_blocks/iron");
public static final Tag<Block> STORAGE_BLOCKS_LAPIS = tag("storage_blocks/lapis");
public static final Tag<Block> STORAGE_BLOCKS_QUARTZ = tag("storage_blocks/quartz");
public static final Tag<Block> STORAGE_BLOCKS_REDSTONE = tag("storage_blocks/redstone");
public static final ITag.INamedTag<Block> SANDSTONE = tag("sandstone");
public static final ITag.INamedTag<Block> STAINED_GLASS = tag("stained_glass");
public static final ITag.INamedTag<Block> STAINED_GLASS_PANES = tag("stained_glass_panes");
public static final ITag.INamedTag<Block> STONE = tag("stone");
public static final ITag.INamedTag<Block> STORAGE_BLOCKS = tag("storage_blocks");
public static final ITag.INamedTag<Block> STORAGE_BLOCKS_COAL = tag("storage_blocks/coal");
public static final ITag.INamedTag<Block> STORAGE_BLOCKS_DIAMOND = tag("storage_blocks/diamond");
public static final ITag.INamedTag<Block> STORAGE_BLOCKS_EMERALD = tag("storage_blocks/emerald");
public static final ITag.INamedTag<Block> STORAGE_BLOCKS_GOLD = tag("storage_blocks/gold");
public static final ITag.INamedTag<Block> STORAGE_BLOCKS_IRON = tag("storage_blocks/iron");
public static final ITag.INamedTag<Block> STORAGE_BLOCKS_LAPIS = tag("storage_blocks/lapis");
public static final ITag.INamedTag<Block> STORAGE_BLOCKS_QUARTZ = tag("storage_blocks/quartz");
public static final ITag.INamedTag<Block> STORAGE_BLOCKS_REDSTONE = tag("storage_blocks/redstone");
private static Tag<Block> tag(String name)
private static ITag.INamedTag<Block> tag(String name)
{
return new BlockTags.Wrapper(new ResourceLocation("forge", name));
return BlockTags.makeWrapperTag("forge:" + name);
}
}
public static class Items
{
public static final Tag<Item> ARROWS = tag("arrows");
public static final Tag<Item> BEACON_PAYMENT = tag("beacon_payment");
public static final Tag<Item> BONES = tag("bones");
public static final Tag<Item> BOOKSHELVES = tag("bookshelves");
public static final Tag<Item> CHESTS = tag("chests");
public static final Tag<Item> CHESTS_ENDER = tag("chests/ender");
public static final Tag<Item> CHESTS_TRAPPED = tag("chests/trapped");
public static final Tag<Item> CHESTS_WOODEN = tag("chests/wooden");
public static final Tag<Item> COBBLESTONE = tag("cobblestone");
public static final Tag<Item> CROPS = tag("crops");
public static final Tag<Item> CROPS_BEETROOT = tag("crops/beetroot");
public static final Tag<Item> CROPS_CARROT = tag("crops/carrot");
public static final Tag<Item> CROPS_NETHER_WART = tag("crops/nether_wart");
public static final Tag<Item> CROPS_POTATO = tag("crops/potato");
public static final Tag<Item> CROPS_WHEAT = tag("crops/wheat");
public static final Tag<Item> DUSTS = tag("dusts");
public static final Tag<Item> DUSTS_PRISMARINE = tag("dusts/prismarine");
public static final Tag<Item> DUSTS_REDSTONE = tag("dusts/redstone");
public static final Tag<Item> DUSTS_GLOWSTONE = tag("dusts/glowstone");
public static final ITag.INamedTag<Item> ARROWS = tag("arrows");
public static final ITag.INamedTag<Item> BEACON_PAYMENT = tag("beacon_payment");
public static final ITag.INamedTag<Item> BONES = tag("bones");
public static final ITag.INamedTag<Item> BOOKSHELVES = tag("bookshelves");
public static final ITag.INamedTag<Item> CHESTS = tag("chests");
public static final ITag.INamedTag<Item> CHESTS_ENDER = tag("chests/ender");
public static final ITag.INamedTag<Item> CHESTS_TRAPPED = tag("chests/trapped");
public static final ITag.INamedTag<Item> CHESTS_WOODEN = tag("chests/wooden");
public static final ITag.INamedTag<Item> COBBLESTONE = tag("cobblestone");
public static final ITag.INamedTag<Item> CROPS = tag("crops");
public static final ITag.INamedTag<Item> CROPS_BEETROOT = tag("crops/beetroot");
public static final ITag.INamedTag<Item> CROPS_CARROT = tag("crops/carrot");
public static final ITag.INamedTag<Item> CROPS_NETHER_WART = tag("crops/nether_wart");
public static final ITag.INamedTag<Item> CROPS_POTATO = tag("crops/potato");
public static final ITag.INamedTag<Item> CROPS_WHEAT = tag("crops/wheat");
public static final ITag.INamedTag<Item> DUSTS = tag("dusts");
public static final ITag.INamedTag<Item> DUSTS_PRISMARINE = tag("dusts/prismarine");
public static final ITag.INamedTag<Item> DUSTS_REDSTONE = tag("dusts/redstone");
public static final ITag.INamedTag<Item> DUSTS_GLOWSTONE = tag("dusts/glowstone");
public static final Tag<Item> DYES = tag("dyes");
public static final Tag<Item> DYES_BLACK = tag("dyes/black");
public static final Tag<Item> DYES_RED = tag("dyes/red");
public static final Tag<Item> DYES_GREEN = tag("dyes/green");
public static final Tag<Item> DYES_BROWN = tag("dyes/brown");
public static final Tag<Item> DYES_BLUE = tag("dyes/blue");
public static final Tag<Item> DYES_PURPLE = tag("dyes/purple");
public static final Tag<Item> DYES_CYAN = tag("dyes/cyan");
public static final Tag<Item> DYES_LIGHT_GRAY = tag("dyes/light_gray");
public static final Tag<Item> DYES_GRAY = tag("dyes/gray");
public static final Tag<Item> DYES_PINK = tag("dyes/pink");
public static final Tag<Item> DYES_LIME = tag("dyes/lime");
public static final Tag<Item> DYES_YELLOW = tag("dyes/yellow");
public static final Tag<Item> DYES_LIGHT_BLUE = tag("dyes/light_blue");
public static final Tag<Item> DYES_MAGENTA = tag("dyes/magenta");
public static final Tag<Item> DYES_ORANGE = tag("dyes/orange");
public static final Tag<Item> DYES_WHITE = tag("dyes/white");
public static final ITag.INamedTag<Item> DYES = tag("dyes");
public static final ITag.INamedTag<Item> DYES_BLACK = tag("dyes/black");
public static final ITag.INamedTag<Item> DYES_RED = tag("dyes/red");
public static final ITag.INamedTag<Item> DYES_GREEN = tag("dyes/green");
public static final ITag.INamedTag<Item> DYES_BROWN = tag("dyes/brown");
public static final ITag.INamedTag<Item> DYES_BLUE = tag("dyes/blue");
public static final ITag.INamedTag<Item> DYES_PURPLE = tag("dyes/purple");
public static final ITag.INamedTag<Item> DYES_CYAN = tag("dyes/cyan");
public static final ITag.INamedTag<Item> DYES_LIGHT_GRAY = tag("dyes/light_gray");
public static final ITag.INamedTag<Item> DYES_GRAY = tag("dyes/gray");
public static final ITag.INamedTag<Item> DYES_PINK = tag("dyes/pink");
public static final ITag.INamedTag<Item> DYES_LIME = tag("dyes/lime");
public static final ITag.INamedTag<Item> DYES_YELLOW = tag("dyes/yellow");
public static final ITag.INamedTag<Item> DYES_LIGHT_BLUE = tag("dyes/light_blue");
public static final ITag.INamedTag<Item> DYES_MAGENTA = tag("dyes/magenta");
public static final ITag.INamedTag<Item> DYES_ORANGE = tag("dyes/orange");
public static final ITag.INamedTag<Item> DYES_WHITE = tag("dyes/white");
public static final Tag<Item> EGGS = tag("eggs");
public static final Tag<Item> END_STONES = tag("end_stones");
public static final Tag<Item> ENDER_PEARLS = tag("ender_pearls");
public static final Tag<Item> FEATHERS = tag("feathers");
public static final Tag<Item> FENCE_GATES = tag("fence_gates");
public static final Tag<Item> FENCE_GATES_WOODEN = tag("fence_gates/wooden");
public static final Tag<Item> FENCES = tag("fences");
public static final Tag<Item> FENCES_NETHER_BRICK = tag("fences/nether_brick");
public static final Tag<Item> FENCES_WOODEN = tag("fences/wooden");
public static final Tag<Item> GEMS = tag("gems");
public static final Tag<Item> GEMS_DIAMOND = tag("gems/diamond");
public static final Tag<Item> GEMS_EMERALD = tag("gems/emerald");
public static final Tag<Item> GEMS_LAPIS = tag("gems/lapis");
public static final Tag<Item> GEMS_PRISMARINE = tag("gems/prismarine");
public static final Tag<Item> GEMS_QUARTZ = tag("gems/quartz");
public static final ITag.INamedTag<Item> EGGS = tag("eggs");
public static final ITag.INamedTag<Item> END_STONES = tag("end_stones");
public static final ITag.INamedTag<Item> ENDER_PEARLS = tag("ender_pearls");
public static final ITag.INamedTag<Item> FEATHERS = tag("feathers");
public static final ITag.INamedTag<Item> FENCE_GATES = tag("fence_gates");
public static final ITag.INamedTag<Item> FENCE_GATES_WOODEN = tag("fence_gates/wooden");
public static final ITag.INamedTag<Item> FENCES = tag("fences");
public static final ITag.INamedTag<Item> FENCES_NETHER_BRICK = tag("fences/nether_brick");
public static final ITag.INamedTag<Item> FENCES_WOODEN = tag("fences/wooden");
public static final ITag.INamedTag<Item> GEMS = tag("gems");
public static final ITag.INamedTag<Item> GEMS_DIAMOND = tag("gems/diamond");
public static final ITag.INamedTag<Item> GEMS_EMERALD = tag("gems/emerald");
public static final ITag.INamedTag<Item> GEMS_LAPIS = tag("gems/lapis");
public static final ITag.INamedTag<Item> GEMS_PRISMARINE = tag("gems/prismarine");
public static final ITag.INamedTag<Item> GEMS_QUARTZ = tag("gems/quartz");
public static final Tag<Item> GLASS = tag("glass");
public static final Tag<Item> GLASS_BLACK = tag("glass/black");
public static final Tag<Item> GLASS_BLUE = tag("glass/blue");
public static final Tag<Item> GLASS_BROWN = tag("glass/brown");
public static final Tag<Item> GLASS_COLORLESS = tag("glass/colorless");
public static final Tag<Item> GLASS_CYAN = tag("glass/cyan");
public static final Tag<Item> GLASS_GRAY = tag("glass/gray");
public static final Tag<Item> GLASS_GREEN = tag("glass/green");
public static final Tag<Item> GLASS_LIGHT_BLUE = tag("glass/light_blue");
public static final Tag<Item> GLASS_LIGHT_GRAY = tag("glass/light_gray");
public static final Tag<Item> GLASS_LIME = tag("glass/lime");
public static final Tag<Item> GLASS_MAGENTA = tag("glass/magenta");
public static final Tag<Item> GLASS_ORANGE = tag("glass/orange");
public static final Tag<Item> GLASS_PINK = tag("glass/pink");
public static final Tag<Item> GLASS_PURPLE = tag("glass/purple");
public static final Tag<Item> GLASS_RED = tag("glass/red");
public static final Tag<Item> GLASS_WHITE = tag("glass/white");
public static final Tag<Item> GLASS_YELLOW = tag("glass/yellow");
public static final ITag.INamedTag<Item> GLASS = tag("glass");
public static final ITag.INamedTag<Item> GLASS_BLACK = tag("glass/black");
public static final ITag.INamedTag<Item> GLASS_BLUE = tag("glass/blue");
public static final ITag.INamedTag<Item> GLASS_BROWN = tag("glass/brown");
public static final ITag.INamedTag<Item> GLASS_COLORLESS = tag("glass/colorless");
public static final ITag.INamedTag<Item> GLASS_CYAN = tag("glass/cyan");
public static final ITag.INamedTag<Item> GLASS_GRAY = tag("glass/gray");
public static final ITag.INamedTag<Item> GLASS_GREEN = tag("glass/green");
public static final ITag.INamedTag<Item> GLASS_LIGHT_BLUE = tag("glass/light_blue");
public static final ITag.INamedTag<Item> GLASS_LIGHT_GRAY = tag("glass/light_gray");
public static final ITag.INamedTag<Item> GLASS_LIME = tag("glass/lime");
public static final ITag.INamedTag<Item> GLASS_MAGENTA = tag("glass/magenta");
public static final ITag.INamedTag<Item> GLASS_ORANGE = tag("glass/orange");
public static final ITag.INamedTag<Item> GLASS_PINK = tag("glass/pink");
public static final ITag.INamedTag<Item> GLASS_PURPLE = tag("glass/purple");
public static final ITag.INamedTag<Item> GLASS_RED = tag("glass/red");
public static final ITag.INamedTag<Item> GLASS_WHITE = tag("glass/white");
public static final ITag.INamedTag<Item> GLASS_YELLOW = tag("glass/yellow");
public static final Tag<Item> GLASS_PANES = tag("glass_panes");
public static final Tag<Item> GLASS_PANES_BLACK = tag("glass_panes/black");
public static final Tag<Item> GLASS_PANES_BLUE = tag("glass_panes/blue");
public static final Tag<Item> GLASS_PANES_BROWN = tag("glass_panes/brown");
public static final Tag<Item> GLASS_PANES_COLORLESS = tag("glass_panes/colorless");
public static final Tag<Item> GLASS_PANES_CYAN = tag("glass_panes/cyan");
public static final Tag<Item> GLASS_PANES_GRAY = tag("glass_panes/gray");
public static final Tag<Item> GLASS_PANES_GREEN = tag("glass_panes/green");
public static final Tag<Item> GLASS_PANES_LIGHT_BLUE = tag("glass_panes/light_blue");
public static final Tag<Item> GLASS_PANES_LIGHT_GRAY = tag("glass_panes/light_gray");
public static final Tag<Item> GLASS_PANES_LIME = tag("glass_panes/lime");
public static final Tag<Item> GLASS_PANES_MAGENTA = tag("glass_panes/magenta");
public static final Tag<Item> GLASS_PANES_ORANGE = tag("glass_panes/orange");
public static final Tag<Item> GLASS_PANES_PINK = tag("glass_panes/pink");
public static final Tag<Item> GLASS_PANES_PURPLE = tag("glass_panes/purple");
public static final Tag<Item> GLASS_PANES_RED = tag("glass_panes/red");
public static final Tag<Item> GLASS_PANES_WHITE = tag("glass_panes/white");
public static final Tag<Item> GLASS_PANES_YELLOW = tag("glass_panes/yellow");
public static final ITag.INamedTag<Item> GLASS_PANES = tag("glass_panes");
public static final ITag.INamedTag<Item> GLASS_PANES_BLACK = tag("glass_panes/black");
public static final ITag.INamedTag<Item> GLASS_PANES_BLUE = tag("glass_panes/blue");
public static final ITag.INamedTag<Item> GLASS_PANES_BROWN = tag("glass_panes/brown");
public static final ITag.INamedTag<Item> GLASS_PANES_COLORLESS = tag("glass_panes/colorless");
public static final ITag.INamedTag<Item> GLASS_PANES_CYAN = tag("glass_panes/cyan");
public static final ITag.INamedTag<Item> GLASS_PANES_GRAY = tag("glass_panes/gray");
public static final ITag.INamedTag<Item> GLASS_PANES_GREEN = tag("glass_panes/green");
public static final ITag.INamedTag<Item> GLASS_PANES_LIGHT_BLUE = tag("glass_panes/light_blue");
public static final ITag.INamedTag<Item> GLASS_PANES_LIGHT_GRAY = tag("glass_panes/light_gray");
public static final ITag.INamedTag<Item> GLASS_PANES_LIME = tag("glass_panes/lime");
public static final ITag.INamedTag<Item> GLASS_PANES_MAGENTA = tag("glass_panes/magenta");
public static final ITag.INamedTag<Item> GLASS_PANES_ORANGE = tag("glass_panes/orange");
public static final ITag.INamedTag<Item> GLASS_PANES_PINK = tag("glass_panes/pink");
public static final ITag.INamedTag<Item> GLASS_PANES_PURPLE = tag("glass_panes/purple");
public static final ITag.INamedTag<Item> GLASS_PANES_RED = tag("glass_panes/red");
public static final ITag.INamedTag<Item> GLASS_PANES_WHITE = tag("glass_panes/white");
public static final ITag.INamedTag<Item> GLASS_PANES_YELLOW = tag("glass_panes/yellow");
public static final Tag<Item> GRAVEL = tag("gravel");
public static final Tag<Item> GUNPOWDER = tag("gunpowder");
public static final Tag<Item> HEADS = tag("heads");
public static final Tag<Item> INGOTS = tag("ingots");
public static final Tag<Item> INGOTS_BRICK = tag("ingots/brick");
public static final Tag<Item> INGOTS_GOLD = tag("ingots/gold");
public static final Tag<Item> INGOTS_IRON = tag("ingots/iron");
public static final Tag<Item> INGOTS_NETHER_BRICK = tag("ingots/nether_brick");
public static final Tag<Item> LEATHER = tag("leather");
public static final Tag<Item> MUSHROOMS = tag("mushrooms");
public static final Tag<Item> MUSIC_DISCS = tag("music_discs");
public static final Tag<Item> NETHER_STARS = tag("nether_stars");
public static final Tag<Item> NETHERRACK = tag("netherrack");
public static final Tag<Item> NUGGETS = tag("nuggets");
public static final Tag<Item> NUGGETS_GOLD = tag("nuggets/gold");
public static final Tag<Item> NUGGETS_IRON = tag("nuggets/iron");
public static final Tag<Item> OBSIDIAN = tag("obsidian");
public static final Tag<Item> ORES = tag("ores");
public static final Tag<Item> ORES_COAL = tag("ores/coal");
public static final Tag<Item> ORES_DIAMOND = tag("ores/diamond");
public static final Tag<Item> ORES_EMERALD = tag("ores/emerald");
public static final Tag<Item> ORES_GOLD = tag("ores/gold");
public static final Tag<Item> ORES_IRON = tag("ores/iron");
public static final Tag<Item> ORES_LAPIS = tag("ores/lapis");
public static final Tag<Item> ORES_QUARTZ = tag("ores/quartz");
public static final Tag<Item> ORES_REDSTONE = tag("ores/redstone");
public static final Tag<Item> RODS = tag("rods");
public static final Tag<Item> RODS_BLAZE = tag("rods/blaze");
public static final Tag<Item> RODS_WOODEN = tag("rods/wooden");
public static final ITag.INamedTag<Item> GRAVEL = tag("gravel");
public static final ITag.INamedTag<Item> GUNPOWDER = tag("gunpowder");
public static final ITag.INamedTag<Item> HEADS = tag("heads");
public static final ITag.INamedTag<Item> INGOTS = tag("ingots");
public static final ITag.INamedTag<Item> INGOTS_BRICK = tag("ingots/brick");
public static final ITag.INamedTag<Item> INGOTS_GOLD = tag("ingots/gold");
public static final ITag.INamedTag<Item> INGOTS_IRON = tag("ingots/iron");
public static final ITag.INamedTag<Item> INGOTS_NETHER_BRICK = tag("ingots/nether_brick");
public static final ITag.INamedTag<Item> LEATHER = tag("leather");
public static final ITag.INamedTag<Item> MUSHROOMS = tag("mushrooms");
public static final ITag.INamedTag<Item> MUSIC_DISCS = tag("music_discs");
public static final ITag.INamedTag<Item> NETHER_STARS = tag("nether_stars");
public static final ITag.INamedTag<Item> NETHERRACK = tag("netherrack");
public static final ITag.INamedTag<Item> NUGGETS = tag("nuggets");
public static final ITag.INamedTag<Item> NUGGETS_GOLD = tag("nuggets/gold");
public static final ITag.INamedTag<Item> NUGGETS_IRON = tag("nuggets/iron");
public static final ITag.INamedTag<Item> OBSIDIAN = tag("obsidian");
public static final ITag.INamedTag<Item> ORES = tag("ores");
public static final ITag.INamedTag<Item> ORES_COAL = tag("ores/coal");
public static final ITag.INamedTag<Item> ORES_DIAMOND = tag("ores/diamond");
public static final ITag.INamedTag<Item> ORES_EMERALD = tag("ores/emerald");
public static final ITag.INamedTag<Item> ORES_GOLD = tag("ores/gold");
public static final ITag.INamedTag<Item> ORES_IRON = tag("ores/iron");
public static final ITag.INamedTag<Item> ORES_LAPIS = tag("ores/lapis");
public static final ITag.INamedTag<Item> ORES_QUARTZ = tag("ores/quartz");
public static final ITag.INamedTag<Item> ORES_REDSTONE = tag("ores/redstone");
public static final ITag.INamedTag<Item> RODS = tag("rods");
public static final ITag.INamedTag<Item> RODS_BLAZE = tag("rods/blaze");
public static final ITag.INamedTag<Item> RODS_WOODEN = tag("rods/wooden");
public static final Tag<Item> SAND = tag("sand");
public static final Tag<Item> SAND_COLORLESS = tag("sand/colorless");
public static final Tag<Item> SAND_RED = tag("sand/red");
public static final ITag.INamedTag<Item> SAND = tag("sand");
public static final ITag.INamedTag<Item> SAND_COLORLESS = tag("sand/colorless");
public static final ITag.INamedTag<Item> SAND_RED = tag("sand/red");
public static final ITag.INamedTag<Item> SANDSTONE = tag("sandstone");
public static final ITag.INamedTag<Item> SEEDS = tag("seeds");
@@ -252,7 +251,6 @@ public class Tags
public static final ITag.INamedTag<Item> SEEDS_MELON = tag("seeds/melon");
public static final ITag.INamedTag<Item> SEEDS_PUMPKIN = tag("seeds/pumpkin");
public static final ITag.INamedTag<Item> SEEDS_WHEAT = tag("seeds/wheat");
public static final ITag.INamedTag<Item> SHEARS = tag("shears");
public static final ITag.INamedTag<Item> SLIMEBALLS = tag("slimeballs");
public static final ITag.INamedTag<Item> STAINED_GLASS = tag("stained_glass");
public static final ITag.INamedTag<Item> STAINED_GLASS_PANES = tag("stained_glass_panes");
@@ -268,9 +266,9 @@ public class Tags
public static final ITag.INamedTag<Item> STORAGE_BLOCKS_REDSTONE = tag("storage_blocks/redstone");
public static final ITag.INamedTag<Item> STRING = tag("string");
private static Tag<Item> tag(String name)
private static ITag.INamedTag<Item> tag(String name)
{
return new ItemTags.Wrapper(new ResourceLocation("forge", name));
return ItemTags.makeWrapperTag("forge:" + name);
}
}
}
@@ -53,7 +53,7 @@ public final class TimeValues
}
@Override
public String getName()
public String func_176610_l()
{
return "identity";
}
@@ -245,7 +245,7 @@ public final class TimeValues
}
@Override
public String getName()
public String func_176610_l()
{
return parameterName;
}
@@ -347,7 +347,7 @@ public final class TimeValues
}
else if(parameter instanceof IStringSerializable)
{
out.value("#" + ((IStringSerializable)parameter).getName());
out.value("#" + ((IStringSerializable)parameter).func_176610_l());
}
}
@@ -22,6 +22,7 @@ package net.minecraftforge.common.crafting.conditions;
import com.google.gson.JsonObject;
import net.minecraft.item.Item;
import net.minecraft.tags.ITag;
import net.minecraft.tags.ItemTags;
import net.minecraft.tags.Tag;
import net.minecraft.util.JSONUtils;
@@ -56,8 +57,8 @@ public class TagEmptyCondition implements ICondition
@Override
public boolean test()
{
Tag<Item> tag = ItemTags.getCollection().get(tag_name);
return tag == null || tag.getAllElements().isEmpty();
ITag<Item> tag = ItemTags.getCollection().get(tag_name);
return tag == null || tag.func_230236_b_().isEmpty();
}
@Override
@@ -21,6 +21,7 @@ package net.minecraftforge.common.data;
import net.minecraft.data.DataGenerator;
import net.minecraft.item.DyeColor;
import net.minecraft.tags.ITag;
import net.minecraft.tags.Tag;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.common.Tags;
@@ -50,76 +51,76 @@ public class ForgeBlockTagsProvider extends BlockTagsProvider
public void registerTags()
{
super.registerTags();
filter = this.tagToBuilder.entrySet().stream().map(e -> e.getKey().getId()).collect(Collectors.toSet());
filter = this.tagToBuilder.entrySet().stream().map(e -> e.getKey()).collect(Collectors.toSet());
getBuilder(CHESTS).add(CHESTS_ENDER, CHESTS_TRAPPED, CHESTS_WOODEN);
getBuilder(CHESTS_ENDER).add(Blocks.ENDER_CHEST);
getBuilder(CHESTS_TRAPPED).add(Blocks.TRAPPED_CHEST);
getBuilder(CHESTS_WOODEN).add(Blocks.CHEST, Blocks.TRAPPED_CHEST);
getBuilder(COBBLESTONE).add(Blocks.COBBLESTONE, Blocks.INFESTED_COBBLESTONE, Blocks.MOSSY_COBBLESTONE);
getBuilder(DIRT).add(Blocks.DIRT, Blocks.GRASS_BLOCK, Blocks.COARSE_DIRT, Blocks.PODZOL, Blocks.MYCELIUM);
getBuilder(END_STONES).add(Blocks.END_STONE);
getBuilder(FENCE_GATES).add(FENCE_GATES_WOODEN);
getBuilder(FENCE_GATES_WOODEN).add(Blocks.OAK_FENCE_GATE, Blocks.SPRUCE_FENCE_GATE, Blocks.BIRCH_FENCE_GATE, Blocks.JUNGLE_FENCE_GATE, Blocks.ACACIA_FENCE_GATE, Blocks.DARK_OAK_FENCE_GATE);
getBuilder(FENCES).add(FENCES_NETHER_BRICK, FENCES_WOODEN);
getBuilder(FENCES_NETHER_BRICK).add(Blocks.NETHER_BRICK_FENCE);
getBuilder(FENCES_WOODEN).add(Blocks.OAK_FENCE, Blocks.SPRUCE_FENCE, Blocks.BIRCH_FENCE, Blocks.JUNGLE_FENCE, Blocks.ACACIA_FENCE, Blocks.DARK_OAK_FENCE);
getBuilder(GLASS).add(GLASS_COLORLESS, STAINED_GLASS);
getBuilder(GLASS_COLORLESS).add(Blocks.GLASS);
addColored(getBuilder(STAINED_GLASS)::add, GLASS, "{color}_stained_glass");
getBuilder(GLASS_PANES).add(GLASS_PANES_COLORLESS, STAINED_GLASS_PANES);
getBuilder(GLASS_PANES_COLORLESS).add(Blocks.GLASS_PANE);
addColored(getBuilder(STAINED_GLASS_PANES)::add, GLASS_PANES, "{color}_stained_glass_pane");
getBuilder(GRAVEL).add(Blocks.GRAVEL);
getBuilder(NETHERRACK).add(Blocks.NETHERRACK);
getBuilder(OBSIDIAN).add(Blocks.OBSIDIAN);
getBuilder(ORES).add(ORES_COAL, ORES_DIAMOND, ORES_EMERALD, ORES_GOLD, ORES_IRON, ORES_LAPIS, ORES_REDSTONE, ORES_QUARTZ);
getBuilder(ORES_COAL).add(Blocks.COAL_ORE);
getBuilder(ORES_DIAMOND).add(Blocks.DIAMOND_ORE);
getBuilder(ORES_EMERALD).add(Blocks.EMERALD_ORE);
getBuilder(ORES_GOLD).add(Blocks.GOLD_ORE);
getBuilder(ORES_IRON).add(Blocks.IRON_ORE);
getBuilder(ORES_LAPIS).add(Blocks.LAPIS_ORE);
getBuilder(ORES_QUARTZ).add(Blocks.NETHER_QUARTZ_ORE);
getBuilder(ORES_REDSTONE).add(Blocks.REDSTONE_ORE);
getBuilder(SAND).add(SAND_COLORLESS, SAND_RED);
getBuilder(SAND_COLORLESS).add(Blocks.SAND);
getBuilder(SAND_RED).add(Blocks.RED_SAND);
getBuilder(SANDSTONE).add(Blocks.SANDSTONE, Blocks.CUT_SANDSTONE, Blocks.CHISELED_SANDSTONE, Blocks.SMOOTH_SANDSTONE, Blocks.RED_SANDSTONE, Blocks.CUT_RED_SANDSTONE, Blocks.CHISELED_RED_SANDSTONE, Blocks.SMOOTH_RED_SANDSTONE);
getBuilder(STONE).add(Blocks.ANDESITE, Blocks.DIORITE, Blocks.GRANITE, Blocks.INFESTED_STONE, Blocks.STONE, Blocks.POLISHED_ANDESITE, Blocks.POLISHED_DIORITE, Blocks.POLISHED_GRANITE);
getBuilder(STORAGE_BLOCKS).add(STORAGE_BLOCKS_COAL, STORAGE_BLOCKS_DIAMOND, STORAGE_BLOCKS_EMERALD, STORAGE_BLOCKS_GOLD, STORAGE_BLOCKS_IRON, STORAGE_BLOCKS_LAPIS, STORAGE_BLOCKS_QUARTZ, STORAGE_BLOCKS_REDSTONE);
getBuilder(STORAGE_BLOCKS_COAL).add(Blocks.COAL_BLOCK);
getBuilder(STORAGE_BLOCKS_DIAMOND).add(Blocks.DIAMOND_BLOCK);
getBuilder(STORAGE_BLOCKS_EMERALD).add(Blocks.EMERALD_BLOCK);
getBuilder(STORAGE_BLOCKS_GOLD).add(Blocks.GOLD_BLOCK);
getBuilder(STORAGE_BLOCKS_IRON).add(Blocks.IRON_BLOCK);
getBuilder(STORAGE_BLOCKS_LAPIS).add(Blocks.LAPIS_BLOCK);
getBuilder(STORAGE_BLOCKS_QUARTZ).add(Blocks.QUARTZ_BLOCK);
getBuilder(STORAGE_BLOCKS_REDSTONE).add(Blocks.REDSTONE_BLOCK);
func_240522_a_(CHESTS).addTags(CHESTS_ENDER, CHESTS_TRAPPED, CHESTS_WOODEN);
func_240522_a_(CHESTS_ENDER).func_240534_a_(Blocks.ENDER_CHEST);
func_240522_a_(CHESTS_TRAPPED).func_240534_a_(Blocks.TRAPPED_CHEST);
func_240522_a_(CHESTS_WOODEN).func_240534_a_(Blocks.CHEST, Blocks.TRAPPED_CHEST);
func_240522_a_(COBBLESTONE).func_240534_a_(Blocks.COBBLESTONE, Blocks.INFESTED_COBBLESTONE, Blocks.MOSSY_COBBLESTONE);
func_240522_a_(DIRT).func_240534_a_(Blocks.DIRT, Blocks.GRASS_BLOCK, Blocks.COARSE_DIRT, Blocks.PODZOL, Blocks.MYCELIUM);
func_240522_a_(END_STONES).func_240534_a_(Blocks.END_STONE);
func_240522_a_(FENCE_GATES).addTags(FENCE_GATES_WOODEN);
func_240522_a_(FENCE_GATES_WOODEN).func_240534_a_(Blocks.OAK_FENCE_GATE, Blocks.SPRUCE_FENCE_GATE, Blocks.BIRCH_FENCE_GATE, Blocks.JUNGLE_FENCE_GATE, Blocks.ACACIA_FENCE_GATE, Blocks.DARK_OAK_FENCE_GATE);
func_240522_a_(FENCES).addTags(FENCES_NETHER_BRICK, FENCES_WOODEN);
func_240522_a_(FENCES_NETHER_BRICK).func_240534_a_(Blocks.NETHER_BRICK_FENCE);
func_240522_a_(FENCES_WOODEN).func_240534_a_(Blocks.OAK_FENCE, Blocks.SPRUCE_FENCE, Blocks.BIRCH_FENCE, Blocks.JUNGLE_FENCE, Blocks.ACACIA_FENCE, Blocks.DARK_OAK_FENCE);
func_240522_a_(GLASS).addTags(GLASS_COLORLESS, STAINED_GLASS);
func_240522_a_(GLASS_COLORLESS).func_240534_a_(Blocks.GLASS);
addColored(func_240522_a_(STAINED_GLASS)::func_240534_a_, GLASS, "{color}_stained_glass");
func_240522_a_(GLASS_PANES).addTags(GLASS_PANES_COLORLESS, STAINED_GLASS_PANES);
func_240522_a_(GLASS_PANES_COLORLESS).func_240534_a_(Blocks.GLASS_PANE);
addColored(func_240522_a_(STAINED_GLASS_PANES)::func_240534_a_, GLASS_PANES, "{color}_stained_glass_pane");
func_240522_a_(GRAVEL).func_240534_a_(Blocks.GRAVEL);
func_240522_a_(NETHERRACK).func_240534_a_(Blocks.NETHERRACK);
func_240522_a_(OBSIDIAN).func_240534_a_(Blocks.OBSIDIAN);
func_240522_a_(ORES).addTags(ORES_COAL, ORES_DIAMOND, ORES_EMERALD, ORES_GOLD, ORES_IRON, ORES_LAPIS, ORES_REDSTONE, ORES_QUARTZ);
func_240522_a_(ORES_COAL).func_240534_a_(Blocks.COAL_ORE);
func_240522_a_(ORES_DIAMOND).func_240534_a_(Blocks.DIAMOND_ORE);
func_240522_a_(ORES_EMERALD).func_240534_a_(Blocks.EMERALD_ORE);
func_240522_a_(ORES_GOLD).func_240534_a_(Blocks.GOLD_ORE);
func_240522_a_(ORES_IRON).func_240534_a_(Blocks.IRON_ORE);
func_240522_a_(ORES_LAPIS).func_240534_a_(Blocks.LAPIS_ORE);
func_240522_a_(ORES_QUARTZ).func_240534_a_(Blocks.NETHER_QUARTZ_ORE);
func_240522_a_(ORES_REDSTONE).func_240534_a_(Blocks.REDSTONE_ORE);
func_240522_a_(SAND).addTags(SAND_COLORLESS, SAND_RED);
func_240522_a_(SAND_COLORLESS).func_240534_a_(Blocks.SAND);
func_240522_a_(SAND_RED).func_240534_a_(Blocks.RED_SAND);
func_240522_a_(SANDSTONE).func_240534_a_(Blocks.SANDSTONE, Blocks.CUT_SANDSTONE, Blocks.CHISELED_SANDSTONE, Blocks.SMOOTH_SANDSTONE, Blocks.RED_SANDSTONE, Blocks.CUT_RED_SANDSTONE, Blocks.CHISELED_RED_SANDSTONE, Blocks.SMOOTH_RED_SANDSTONE);
func_240522_a_(STONE).func_240534_a_(Blocks.ANDESITE, Blocks.DIORITE, Blocks.GRANITE, Blocks.INFESTED_STONE, Blocks.STONE, Blocks.POLISHED_ANDESITE, Blocks.POLISHED_DIORITE, Blocks.POLISHED_GRANITE);
func_240522_a_(STORAGE_BLOCKS).addTags(STORAGE_BLOCKS_COAL, STORAGE_BLOCKS_DIAMOND, STORAGE_BLOCKS_EMERALD, STORAGE_BLOCKS_GOLD, STORAGE_BLOCKS_IRON, STORAGE_BLOCKS_LAPIS, STORAGE_BLOCKS_QUARTZ, STORAGE_BLOCKS_REDSTONE);
func_240522_a_(STORAGE_BLOCKS_COAL).func_240534_a_(Blocks.COAL_BLOCK);
func_240522_a_(STORAGE_BLOCKS_DIAMOND).func_240534_a_(Blocks.DIAMOND_BLOCK);
func_240522_a_(STORAGE_BLOCKS_EMERALD).func_240534_a_(Blocks.EMERALD_BLOCK);
func_240522_a_(STORAGE_BLOCKS_GOLD).func_240534_a_(Blocks.GOLD_BLOCK);
func_240522_a_(STORAGE_BLOCKS_IRON).func_240534_a_(Blocks.IRON_BLOCK);
func_240522_a_(STORAGE_BLOCKS_LAPIS).func_240534_a_(Blocks.LAPIS_BLOCK);
func_240522_a_(STORAGE_BLOCKS_QUARTZ).func_240534_a_(Blocks.QUARTZ_BLOCK);
func_240522_a_(STORAGE_BLOCKS_REDSTONE).func_240534_a_(Blocks.REDSTONE_BLOCK);
}
private void addColored(Consumer<Block> consumer, Tag<Block> group, String pattern)
private void addColored(Consumer<Block> consumer, ITag.INamedTag<Block> group, String pattern)
{
String prefix = group.getId().getPath().toUpperCase(Locale.ENGLISH) + '_';
String prefix = group.func_230234_a_().getPath().toUpperCase(Locale.ENGLISH) + '_';
for (DyeColor color : DyeColor.values())
{
ResourceLocation key = new ResourceLocation("minecraft", pattern.replace("{color}", color.getTranslationKey()));
Tag<Block> tag = getForgeTag(prefix + color.getTranslationKey());
ITag.INamedTag<Block> tag = getForgeTag(prefix + color.getTranslationKey());
Block block = ForgeRegistries.BLOCKS.getValue(key);
if (block == null || block == Blocks.AIR)
throw new IllegalStateException("Unknown vanilla block: " + key.toString());
getBuilder(tag).add(block);
func_240522_a_(tag).func_240534_a_(block);
consumer.accept(block);
}
}
@SuppressWarnings("unchecked")
private Tag<Block> getForgeTag(String name)
private ITag.INamedTag<Block> getForgeTag(String name)
{
try
{
name = name.toUpperCase(Locale.ENGLISH);
return (Tag<Block>)Tags.Blocks.class.getDeclaredField(name).get(null);
return (ITag.INamedTag<Block>)Tags.Blocks.class.getDeclaredField(name).get(null);
}
catch (IllegalArgumentException | IllegalAccessException | NoSuchFieldException | SecurityException e)
{
@@ -1,6 +1,6 @@
/*
* Minecraft Forge
* Copyright (c) 2016-2019.
* func_240521_a_right (c) 2016-2019.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -12,7 +12,7 @@
* 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
* You should have received a func_240521_a_ 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
*/
@@ -26,11 +26,13 @@ import java.util.function.Consumer;
import java.util.stream.Collectors;
import net.minecraft.block.Block;
import net.minecraft.data.BlockTagsProvider;
import net.minecraft.data.DataGenerator;
import net.minecraft.data.ItemTagsProvider;
import net.minecraft.item.DyeColor;
import net.minecraft.item.Item;
import net.minecraft.item.Items;
import net.minecraft.tags.ITag;
import net.minecraft.tags.Tag;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.common.Tags;
@@ -40,16 +42,16 @@ public class ForgeItemTagsProvider extends ItemTagsProvider
{
private Set<ResourceLocation> filter = null;
public ForgeItemTagsProvider(DataGenerator gen)
public ForgeItemTagsProvider(DataGenerator gen, BlockTagsProvider blockTagProvider)
{
super(gen);
super(gen, blockTagProvider);
}
@Override
public void registerTags()
{
super.registerTags();
filter = this.tagToBuilder.entrySet().stream().map(e -> e.getKey().getId()).collect(Collectors.toSet());
filter = this.tagToBuilder.entrySet().stream().map(e -> e.getKey()).collect(Collectors.toSet());
func_240522_a_(Tags.Items.ARROWS).func_240534_a_(Items.ARROW, Items.TIPPED_ARROW, Items.SPECTRAL_ARROW);
func_240522_a_(Tags.Items.BEACON_PAYMENT).func_240534_a_(Items.EMERALD, Items.DIAMOND, Items.GOLD_INGOT, Items.IRON_INGOT);
@@ -128,7 +130,6 @@ public class ForgeItemTagsProvider extends ItemTagsProvider
func_240522_a_(Tags.Items.SEEDS_MELON).func_240534_a_(Items.MELON_SEEDS);
func_240522_a_(Tags.Items.SEEDS_PUMPKIN).func_240534_a_(Items.PUMPKIN_SEEDS);
func_240522_a_(Tags.Items.SEEDS_WHEAT).func_240534_a_(Items.WHEAT_SEEDS);
func_240522_a_(Tags.Items.SHEARS).func_240534_a_(Items.SHEARS);
func_240522_a_(Tags.Items.SLIMEBALLS).func_240534_a_(Items.SLIME_BALL);
func_240521_a_(Tags.Blocks.STAINED_GLASS, Tags.Items.STAINED_GLASS);
func_240521_a_(Tags.Blocks.STAINED_GLASS_PANES, Tags.Items.STAINED_GLASS_PANES);
@@ -145,41 +146,41 @@ public class ForgeItemTagsProvider extends ItemTagsProvider
func_240522_a_(Tags.Items.STRING).func_240534_a_(Items.STRING);
}
private void addColored(Consumer<Tag<Item>> consumer, Tag<Item> group, String pattern)
private void addColored(Consumer<ITag.INamedTag<Item>> consumer, ITag.INamedTag<Item> group, String pattern)
{
String prefix = group.getId().getPath().toUpperCase(Locale.ENGLISH) + '_';
String prefix = group.func_230234_a_().getPath().toUpperCase(Locale.ENGLISH) + '_';
for (DyeColor color : DyeColor.values())
{
ResourceLocation key = new ResourceLocation("minecraft", pattern.replace("{color}", color.getTranslationKey()));
Tag<Item> tag = getForgeItemTag(prefix + color.getTranslationKey());
ITag.INamedTag<Item> tag = getForgeItemTag(prefix + color.getTranslationKey());
Item item = ForgeRegistries.ITEMS.getValue(key);
if (item == null || item == Items.AIR)
throw new IllegalStateException("Unknown vanilla item: " + key.toString());
getBuilder(tag).add(item);
func_240522_a_(tag).func_240534_a_(item);
consumer.accept(tag);
}
}
private void copyColored(Tag<Block> blockGroup, Tag<Item> itemGroup)
private void func_240521_a_Colored(ITag.INamedTag<Block> blockGroup, ITag.INamedTag<Item> itemGroup)
{
String blockPre = blockGroup.getId().getPath().toUpperCase(Locale.ENGLISH) + '_';
String itemPre = itemGroup.getId().getPath().toUpperCase(Locale.ENGLISH) + '_';
String blockPre = blockGroup.func_230234_a_().getPath().toUpperCase(Locale.ENGLISH) + '_';
String itemPre = itemGroup.func_230234_a_().getPath().toUpperCase(Locale.ENGLISH) + '_';
for (DyeColor color : DyeColor.values())
{
Tag<Block> from = getForgeBlockTag(blockPre + color.getTranslationKey());
Tag<Item> to = getForgeItemTag(itemPre + color.getTranslationKey());
copy(from, to);
ITag.INamedTag<Block> from = getForgeBlockTag(blockPre + color.getTranslationKey());
ITag.INamedTag<Item> to = getForgeItemTag(itemPre + color.getTranslationKey());
func_240521_a_(from, to);
}
copy(getForgeBlockTag(blockPre + "colorless"), getForgeItemTag(itemPre + "colorless"));
func_240521_a_(getForgeBlockTag(blockPre + "colorless"), getForgeItemTag(itemPre + "colorless"));
}
@SuppressWarnings("unchecked")
private Tag<Block> getForgeBlockTag(String name)
private ITag.INamedTag<Block> getForgeBlockTag(String name)
{
try
{
name = name.toUpperCase(Locale.ENGLISH);
return (Tag<Block>)Tags.Blocks.class.getDeclaredField(name).get(null);
return (ITag.INamedTag<Block>)Tags.Blocks.class.getDeclaredField(name).get(null);
}
catch (IllegalArgumentException | IllegalAccessException | NoSuchFieldException | SecurityException e)
{
@@ -188,12 +189,12 @@ public class ForgeItemTagsProvider extends ItemTagsProvider
}
@SuppressWarnings("unchecked")
private Tag<Item> getForgeItemTag(String name)
private ITag.INamedTag<Item> getForgeItemTag(String name)
{
try
{
name = name.toUpperCase(Locale.ENGLISH);
return (Tag<Item>)Tags.Items.class.getDeclaredField(name).get(null);
return (ITag.INamedTag<Item>)Tags.Items.class.getDeclaredField(name).get(null);
}
catch (IllegalArgumentException | IllegalAccessException | NoSuchFieldException | SecurityException e)
{
@@ -45,6 +45,7 @@ import net.minecraft.item.crafting.Ingredient;
import net.minecraft.item.crafting.Ingredient.IItemList;
import net.minecraft.item.crafting.Ingredient.TagList;
import net.minecraft.item.crafting.Ingredient.SingleItemList;
import net.minecraft.tags.ITag;
import net.minecraft.tags.Tag;
import net.minecraft.util.IItemProvider;
import net.minecraft.util.ResourceLocation;
@@ -52,7 +53,7 @@ import net.minecraftforge.common.Tags;
public class ForgeRecipeProvider extends RecipeProvider
{
private Map<Item, Tag<Item>> replacements = new HashMap<>();
private Map<Item, ITag<Item>> replacements = new HashMap<>();
private Set<ResourceLocation> excludes = new HashSet<>();
public ForgeRecipeProvider(DataGenerator generatorIn)
@@ -65,7 +66,7 @@ public class ForgeRecipeProvider extends RecipeProvider
excludes.add(item.asItem().getRegistryName());
}
private void replace(IItemProvider item, Tag<Item> tag)
private void replace(IItemProvider item, ITag<Item> tag)
{
replacements.put(item.asItem(), tag);
}
@@ -158,7 +159,7 @@ public class ForgeRecipeProvider extends RecipeProvider
if (entry instanceof SingleItemList)
{
ItemStack stack = entry.getStacks().stream().findFirst().orElse(ItemStack.EMPTY);
Tag<Item> replacement = replacements.get(stack.getItem());
ITag<Item> replacement = replacements.get(stack.getItem());
if (replacement != null)
{
items.add(new TagList(replacement));
@@ -17,11 +17,11 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
package net.minecraftforge.common.data;
//package net.minecraftforge.common.data;
import net.minecraft.tags.Tag.ITagEntry;
//import net.minecraft.tags.Tag.ITagEntry;
/**
* Marker class used by Forge to make a tag entry optional at runtime
*/
public interface IOptionalTagEntry<T> extends ITagEntry<T> {}
//public interface IOptionalTagEntry<T> extends ITagEntry<T> {}
@@ -0,0 +1,76 @@
package net.minecraftforge.common.extensions;
import net.minecraft.block.AbstractBlock;
import net.minecraft.block.BlockState;
import net.minecraft.entity.item.minecart.AbstractMinecartEntity;
import net.minecraft.state.properties.RailShape;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.World;
import javax.annotation.Nullable;
public interface IAbstractRailBlock
{
default AbstractBlock getAbstractBlock()
{
return (AbstractBlock)this;
}
/**
* Return true if the rail can make corners.
* Used by placement logic.
* @param world The world.
* @param pos Block's position in world
* @return True if the rail can make corners.
*/
boolean isFlexibleRail(BlockState state, IBlockReader world, BlockPos pos);
/**
* Returns true if the rail can make up and down slopes.
* Used by placement logic.
* @param world The world.
* @param pos Block's position in world
* @return True if the rail can make slopes.
*/
default boolean canMakeSlopes(BlockState state, IBlockReader world, BlockPos pos)
{
return true;
}
/**
* Return the rail's direction.
* Can be used to make the cart think the rail is a different shape,
* for example when making diamond junctions or switches.
* The cart parameter will often be null unless it it called from EntityMinecart.
*
* @param world The world.
* @param pos Block's position in world
* @param state The BlockState
* @param cart The cart asking for the metadata, null if it is not called by EntityMinecart.
* @return The direction.
*/
RailShape getRailDirection(BlockState state, IBlockReader world, BlockPos pos, @Nullable AbstractMinecartEntity cart);
/**
* Returns the max speed of the rail at the specified position.
* @param world The world.
* @param cart The cart on the rail, may be null.
* @param pos Block's position in world
* @return The max speed of the current rail.
*/
default float getRailMaxSpeed(BlockState state, World world, BlockPos pos, net.minecraft.entity.item.minecart.AbstractMinecartEntity cart)
{
return 0.4f;
}
/**
* This function is called by any minecart that passes over this rail.
* It is called once per update tick that the minecart is on the rail.
* @param world The world.
* @param cart The cart on the rail.
* @param pos Block's position in world
*/
default void onMinecartPass(BlockState state, World world, BlockPos pos, net.minecraft.entity.item.minecart.AbstractMinecartEntity cart){}
}
@@ -26,18 +26,8 @@ import java.util.function.Predicate;
import javax.annotation.Nullable;
import net.minecraft.block.Block;
import net.minecraft.block.BedBlock;
import net.minecraft.block.FarmlandBlock;
import net.minecraft.block.FenceGateBlock;
import net.minecraft.block.FireBlock;
import net.minecraft.block.HorizontalBlock;
import net.minecraft.block.IBeaconBeamColorProvider;
import net.minecraft.block.ITileEntityProvider;
import net.minecraft.block.SoundType;
import net.minecraft.block.StainedGlassBlock;
import net.minecraft.block.*;
import net.minecraft.block.material.Material;
import net.minecraft.block.BlockState;
import net.minecraft.client.particle.ParticleManager;
import net.minecraft.client.renderer.ActiveRenderInfo;
import net.minecraft.enchantment.EnchantmentHelper;
@@ -50,13 +40,12 @@ import net.minecraft.entity.boss.dragon.EnderDragonEntity;
import net.minecraft.entity.boss.WitherEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.projectile.WitherSkullEntity;
import net.minecraft.fluid.IFluidState;
import net.minecraft.block.Blocks;
import net.minecraft.fluid.FluidState;
import net.minecraft.potion.Effects;
import net.minecraft.item.DyeColor;
import net.minecraft.item.ItemStack;
import net.minecraft.pathfinding.PathNodeType;
import net.minecraft.state.IProperty;
import net.minecraft.state.Property;
import net.minecraft.state.properties.BedPart;
import net.minecraft.tags.BlockTags;
import net.minecraft.tileentity.TileEntity;
@@ -66,20 +55,14 @@ import net.minecraft.util.ResourceLocation;
import net.minecraft.util.Rotation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.Explosion;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.ILightReader;
import net.minecraft.world.IWorld;
import net.minecraft.world.IWorldReader;
import net.minecraft.world.IWorldWriter;
import net.minecraft.world.World;
import net.minecraft.util.math.vector.Vector3d;
import net.minecraft.world.*;
import net.minecraft.world.server.ServerWorld;
import net.minecraft.world.dimension.EndDimension;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.common.ForgeHooks;
import net.minecraftforge.common.IPlantable;
import net.minecraftforge.common.Tags;
import net.minecraftforge.common.ToolType;
@SuppressWarnings("deprecation")
@@ -212,7 +195,7 @@ public interface IForgeBlock
* @param fluid The current fluid state at current position
* @return True if the block is actually destroyed.
*/
default boolean removedByPlayer(BlockState state, World world, BlockPos pos, PlayerEntity player, boolean willHarvest, IFluidState fluid)
default boolean removedByPlayer(BlockState state, World world, BlockPos pos, PlayerEntity player, boolean willHarvest, FluidState fluid)
{
getBlock().onBlockHarvested(world, pos, state, player);
return world.setBlockState(pos, fluid.getBlockState(), world.isRemote ? 11 : 3);
@@ -259,7 +242,7 @@ public interface IForgeBlock
* @param sleeper The sleeper or camera entity, null in some cases.
* @return The spawn position
*/
default Optional<Vec3d> getBedSpawnPosition(EntityType<?> entityType, BlockState state, IWorldReader world, BlockPos pos, @Nullable LivingEntity sleeper)
default Optional<Vector3d> getBedSpawnPosition(EntityType<?> entityType, BlockState state, IWorldReader world, BlockPos pos, @Nullable LivingEntity sleeper)
{
if (world instanceof World)
{
@@ -347,7 +330,7 @@ public interface IForgeBlock
*/
default boolean canBeReplacedByLeaves(BlockState state, IWorldReader world, BlockPos pos)
{
return isAir(state, world, pos) || state.isIn(BlockTags.LEAVES);
return isAir(state, world, pos) || state.func_235714_a_(BlockTags.LEAVES);
}
/**
@@ -360,7 +343,7 @@ public interface IForgeBlock
*/
default boolean canBeReplacedByLogs(BlockState state, IWorldReader world, BlockPos pos)
{
return (isAir(state, world, pos) || state.isIn(BlockTags.LEAVES)) || this == Blocks.GRASS_BLOCK || state.isIn(net.minecraftforge.common.Tags.Blocks.DIRT)
return (isAir(state, world, pos) || state.func_235714_a_(BlockTags.LEAVES)) || this == Blocks.GRASS_BLOCK || state.func_235714_a_(Tags.Blocks.DIRT)
|| getBlock().isIn(BlockTags.LOGS) || getBlock().isIn(BlockTags.SAPLINGS) || this == Blocks.VINE;
}
@@ -536,7 +519,7 @@ public interface IForgeBlock
*/
default void onPlantGrow(BlockState state, IWorld world, BlockPos pos, BlockPos source)
{
if (state.isIn(net.minecraftforge.common.Tags.Blocks.DIRT))
if (state.func_235714_a_(Tags.Blocks.DIRT))
world.setBlockState(pos, Blocks.DIRT.getDefaultState(), 2);
}
@@ -632,7 +615,7 @@ public interface IForgeBlock
@Nullable
default Direction[] getValidRotations(BlockState state, IBlockReader world, BlockPos pos)
{
for (IProperty<?> prop : state.getProperties())
for (Property<?> prop : state.func_235904_r_())
{
if ((prop.getName().equals("facing") || prop.getName().equals("rotation")) && prop.getValueClass() == Direction.class)
{
@@ -668,14 +651,14 @@ public interface IForgeBlock
@SuppressWarnings("unchecked")
default boolean recolorBlock(BlockState state, IWorld world, BlockPos pos, Direction facing, DyeColor color)
{
for (IProperty<?> prop : state.getProperties())
for (Property<?> prop : state.func_235904_r_())
{
if (prop.getName().equals("color") && prop.getValueClass() == DyeColor.class)
{
DyeColor current = (DyeColor)state.get(prop);
if (current != color && prop.getAllowedValues().contains(color))
{
world.setBlockState(pos, state.with(((IProperty<DyeColor>)prop), color), 3);
world.setBlockState(pos, state.with(((Property<DyeColor>)prop), color), 3);
return true;
}
}
@@ -801,7 +784,7 @@ public interface IForgeBlock
* @return The new fog color.
*/
@OnlyIn(Dist.CLIENT)
default Vec3d getFogColor(BlockState state, IWorldReader world, BlockPos pos, Entity entity, Vec3d originalColor, float partialTicks)
default Vector3d getFogColor(BlockState state, IWorldReader world, BlockPos pos, Entity entity, Vector3d originalColor, float partialTicks)
{
if (state.getMaterial() == Material.WATER)
{
@@ -817,11 +800,11 @@ public interface IForgeBlock
f12 = f12 * 0.3F + 0.6F;
}
}
return new Vec3d(0.02F + f12, 0.02F + f12, 0.2F + f12);
return new Vector3d(0.02F + f12, 0.02F + f12, 0.2F + f12);
}
else if (state.getMaterial() == Material.LAVA)
{
return new Vec3d(0.6F, 0.1F, 0.0F);
return new Vector3d(0.6F, 0.1F, 0.0F);
}
return originalColor;
}
@@ -837,7 +820,7 @@ public interface IForgeBlock
* @param viewpoint the viewpoint
* @return the block state that should be 'seen'
*/
default BlockState getStateAtViewpoint(BlockState state, IBlockReader world, BlockPos pos, Vec3d viewpoint)
default BlockState getStateAtViewpoint(BlockState state, IBlockReader world, BlockPos pos, Vector3d viewpoint)
{
return state;
}
@@ -983,15 +966,9 @@ public interface IForgeBlock
* @param side The face that the fire is coming from
* @return True if this block sustains fire, meaning it will never go out.
*/
default boolean isFireSource(BlockState state, IBlockReader world, BlockPos pos, Direction side)
default boolean isFireSource(BlockState state, IWorldReader world, BlockPos pos, Direction side)
{
if (side != Direction.UP)
return false;
if (getBlock() == Blocks.NETHERRACK || getBlock() == Blocks.MAGMA_BLOCK)
return true;
if (world instanceof IWorldReader && ((IWorldReader)world).getDimension() instanceof EndDimension && getBlock() == Blocks.BEDROCK)
return true;
return false;
return state.func_235714_a_(world.func_230315_m_().func_241515_q_());
}
/**
@@ -1006,7 +983,7 @@ public interface IForgeBlock
{
if (entity instanceof EnderDragonEntity)
{
return !BlockTags.DRAGON_IMMUNE.contains(this.getBlock());
return !BlockTags.DRAGON_IMMUNE.func_230235_a_(this.getBlock());
}
else if ((entity instanceof WitherEntity) ||
(entity instanceof WitherSkullEntity))
@@ -1029,7 +1006,7 @@ public interface IForgeBlock
* @return A result that suits your block
*/
@Nullable
default RayTraceResult getRayTraceResult(BlockState state, World world, BlockPos pos, Vec3d start, Vec3d end, RayTraceResult original)
default RayTraceResult getRayTraceResult(BlockState state, World world, BlockPos pos, Vector3d start, Vector3d end, RayTraceResult original)
{
return original;
}
@@ -1081,8 +1058,8 @@ public interface IForgeBlock
* @param fluidState The state of the fluid
* @return Whether the fluid overlay texture should be used
*/
default boolean shouldDisplayFluidOverlay(BlockState state, ILightReader world, BlockPos pos, IFluidState fluidState)
default boolean shouldDisplayFluidOverlay(BlockState state, IBlockDisplayReader world, BlockPos pos, FluidState fluidState)
{
return state.getBlock() == Blocks.GLASS || state.getBlock() instanceof StainedGlassBlock;
return state.getBlock() instanceof BreakableBlock || state.getBlock() instanceof StainedGlassBlock;
}
}
@@ -26,14 +26,13 @@ import javax.annotation.Nullable;
import net.minecraft.block.*;
import net.minecraft.client.particle.ParticleManager;
import net.minecraft.client.renderer.model.IBakedModel;
import net.minecraft.entity.Entity;
import net.minecraft.entity.MobEntity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.EntitySpawnPlacementRegistry.PlacementType;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.fluid.IFluidState;
import net.minecraft.fluid.FluidState;
import net.minecraft.item.DyeColor;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
@@ -42,13 +41,8 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.*;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.Explosion;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.ILightReader;
import net.minecraft.world.IWorld;
import net.minecraft.world.IWorldReader;
import net.minecraft.world.World;
import net.minecraft.util.math.vector.Vector3d;
import net.minecraft.world.*;
import net.minecraft.world.server.ServerWorld;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
@@ -162,7 +156,7 @@ public interface IForgeBlockState
* @param fluid The current fluid and block state for the position in the world.
* @return True if the block is actually destroyed.
*/
default boolean removedByPlayer(World world, BlockPos pos, PlayerEntity player, boolean willHarvest, IFluidState fluid)
default boolean removedByPlayer(World world, BlockPos pos, PlayerEntity player, boolean willHarvest, FluidState fluid)
{
return getBlockState().getBlock().removedByPlayer(getBlockState(), world, pos, player, willHarvest, fluid);
}
@@ -204,7 +198,7 @@ public interface IForgeBlockState
* @param sleeper The sleeper or camera entity, null in some cases.
* @return The spawn position
*/
default Optional<Vec3d> getBedSpawnPosition(EntityType<?> type, IWorldReader world, BlockPos pos, @Nullable LivingEntity sleeper)
default Optional<Vector3d> getBedSpawnPosition(EntityType<?> type, IWorldReader world, BlockPos pos, @Nullable LivingEntity sleeper)
{
return getBlockState().getBlock().getBedSpawnPosition(type, getBlockState(), world, pos, sleeper);
}
@@ -673,7 +667,7 @@ public interface IForgeBlockState
* @return The new fog color.
*/
@OnlyIn(Dist.CLIENT)
default Vec3d getFogColor(IWorldReader world, BlockPos pos, Entity entity, Vec3d originalColor, float partialTicks)
default Vector3d getFogColor(IWorldReader world, BlockPos pos, Entity entity, Vector3d originalColor, float partialTicks)
{
return getBlockState().getBlock().getFogColor(getBlockState(), world, pos, entity, originalColor, partialTicks);
}
@@ -688,7 +682,7 @@ public interface IForgeBlockState
* @param viewpoint the viewpoint
* @return the block state that should be 'seen'
*/
default BlockState getStateAtViewpoint(IBlockReader world, BlockPos pos, Vec3d viewpoint)
default BlockState getStateAtViewpoint(IBlockReader world, BlockPos pos, Vector3d viewpoint)
{
return getBlockState().getBlock().getStateAtViewpoint(getBlockState(), world, pos, viewpoint);
}
@@ -816,7 +810,7 @@ public interface IForgeBlockState
* @param side The face that the fire is coming from
* @return True if this block sustains fire, meaning it will never go out.
*/
default boolean isFireSource(IBlockReader world, BlockPos pos, Direction side)
default boolean isFireSource(IWorldReader world, BlockPos pos, Direction side)
{
return getBlockState().getBlock().isFireSource(getBlockState(), world, pos, side);
}
@@ -920,7 +914,7 @@ public interface IForgeBlockState
* @param fluidState The state of the fluid
* @return Whether the fluid overlay texture should be used
*/
default boolean shouldDisplayFluidOverlay(ILightReader world, BlockPos pos, IFluidState fluidState)
default boolean shouldDisplayFluidOverlay(IBlockDisplayReader world, BlockPos pos, FluidState fluidState)
{
return getBlockState().getBlock().shouldDisplayFluidOverlay(getBlockState(), world, pos, fluidState);
}
@@ -17,7 +17,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
package net.minecraftforge.common.extensions;
/*package net.minecraftforge.common.extensions;
import javax.annotation.Nullable;
@@ -59,7 +59,7 @@ public interface IForgeDimension
* always called before the world load event.
*
* @return initial holder for capabilities on the world
*/
* /
default net.minecraftforge.common.capabilities.ICapabilityProvider initCapabilities()
{
return null;
@@ -73,7 +73,7 @@ public interface IForgeDimension
* to nether multiplies coordinates by 1/8.
*
* @return The movement factor
*/
* /
default double getMovementFactor()
{
if (getDimension() instanceof NetherDimension)
@@ -115,7 +115,7 @@ public interface IForgeDimension
* @param colors The color values that will be used: [r, g, b].
*
* @see net.minecraft.client.renderer.GameRenderer#updateLightmap(float)
*/
* /
default void getLightmapColors(float partialTicks, float sunBrightness, float skyLight, float blockLight, Vector3f colors) {}
void resetRainAndThunder();
@@ -134,7 +134,7 @@ public interface IForgeDimension
* Called on the client to get the music type to play when in this world type.
* At the time of calling, the client player and world are guaranteed to be non-null
* @return null to use vanilla logic, otherwise a MusicType to play in this world
*/
* /
@Nullable
@OnlyIn(Dist.CLIENT)
default MusicTicker.MusicType getMusicType()
@@ -148,7 +148,7 @@ public interface IForgeDimension
* @param player The player that is attempting to sleep
* @param pos The location where the player tries to sleep at (the position of the clicked on bed for example)
* @return the result of a player trying to sleep at the given location
*/
* /
default SleepResult canSleepAt(net.minecraft.entity.player.PlayerEntity player, BlockPos pos)
{
return (getDimension().canRespawnHere() && getWorld().getBiome(pos) != Biomes.NETHER) ? SleepResult.ALLOW : SleepResult.BED_EXPLODES;
@@ -170,7 +170,7 @@ public interface IForgeDimension
* Calculates the current moon phase factor.
* This factor is effective for slimes.
* (This method do not affect the moon rendering)
* */
* * /
default float getCurrentMoonPhaseFactor(long time)
{
return Dimension.MOON_PHASE_FACTORS[this.getDimension().getMoonPhase(time)];
@@ -247,7 +247,7 @@ public interface IForgeDimension
* @param z Z Position
* @param rotation the regular rotation of the marker
* @return True to 'spin' the cursor
*/
* /
default boolean shouldMapSpin(String entity, double x, double z, double rotation)
{
return getDimension().getType() == DimensionType.THE_NETHER;
@@ -258,9 +258,9 @@ public interface IForgeDimension
*
* @param player The player that is respawning
* @return The dimension to respawn the player in
*/
* /
default DimensionType getRespawnDimension(ServerPlayerEntity player)
{
return player.getSpawnDimension();
}
}
}*/
@@ -22,6 +22,7 @@ package net.minecraftforge.common.extensions;
import java.util.ArrayList;
import java.util.List;
import com.mojang.blaze3d.matrix.MatrixStack;
import net.minecraft.client.gui.AbstractGui;
import net.minecraft.client.gui.DisplayEffectsScreen;
import net.minecraft.item.ItemStack;
@@ -64,25 +65,27 @@ public interface IForgeEffect {
*
* @param effect the active PotionEffect
* @param gui the gui instance
* @param mStack The MatrixStack
* @param x the x coordinate
* @param y the y coordinate
* @param z the z level
*/
@OnlyIn(Dist.CLIENT)
default void renderInventoryEffect(EffectInstance effect, DisplayEffectsScreen<?> gui, int x, int y, float z) { }
default void renderInventoryEffect(EffectInstance effect, DisplayEffectsScreen<?> gui, MatrixStack mStack, int x, int y, float z) { }
/**
* Called to draw the this Potion onto the player's ingame HUD when it's active.
* This can be used to e.g. render Potion icons from your own texture.
* @param effect the active PotionEffect
* @param gui the gui instance
* @param mStack The MatrixStack
* @param x the x coordinate
* @param y the y coordinate
* @param z the z level
* @param alpha the alpha value, blinks when the potion is about to run out
*/
@OnlyIn(Dist.CLIENT)
default void renderHUDEffect(EffectInstance effect, AbstractGui gui, int x, int y, float z, float alpha) { }
default void renderHUDEffect(EffectInstance effect, AbstractGui gui, MatrixStack mStack, int x, int y, float z, float alpha) { }
/**
* Get a fresh list of items that can cure this Potion.
@@ -21,6 +21,7 @@ package net.minecraftforge.common.extensions;
import java.util.List;
import com.mojang.blaze3d.matrix.MatrixStack;
import net.minecraft.client.gui.AbstractGui;
import net.minecraft.client.gui.DisplayEffectsScreen;
import net.minecraft.item.ItemStack;
@@ -66,13 +67,14 @@ public interface IForgeEffectInstance {
* This can be used to e.g. render Potion icons from your own texture.
*
* @param gui the gui instance
* @param mStack The MatrixStack
* @param x the x coordinate
* @param y the y coordinate
* @param z the z level
*/
@OnlyIn(Dist.CLIENT)
default void renderInventoryEffect(DisplayEffectsScreen<?> gui, int x, int y, float z) {
getEffectInstance().getPotion().renderInventoryEffect(getEffectInstance(), gui, x, y, z);
default void renderInventoryEffect(DisplayEffectsScreen<?> gui, MatrixStack mStack, int x, int y, float z) {
getEffectInstance().getPotion().renderInventoryEffect(getEffectInstance(), gui, mStack, x, y, z);
}
/**
@@ -80,14 +82,15 @@ public interface IForgeEffectInstance {
* This can be used to e.g. render Potion icons from your own texture.
*
* @param gui the gui instance
* @param mStack The MatrixStack
* @param x the x coordinate
* @param y the y coordinate
* @param z the z level
* @param alpha the alpha value, blinks when the potion is about to run out
*/
@OnlyIn(Dist.CLIENT)
default void renderHUDEffect(AbstractGui gui, int x, int y, float z, float alpha) {
getEffectInstance().getPotion().renderHUDEffect(getEffectInstance(), gui, x, y, z, alpha);
default void renderHUDEffect(AbstractGui gui, MatrixStack mStack, int x, int y, float z, float alpha) {
getEffectInstance().getPotion().renderHUDEffect(getEffectInstance(), gui, mStack, x, y, z, alpha);
}
/***
@@ -56,7 +56,7 @@ public interface IForgeEntityMinecart
int y = MathHelper.floor(getMinecart().getPosY());
int z = MathHelper.floor(getMinecart().getPosZ());
BlockPos pos = new BlockPos(x, y - 1, z);
if (getMinecart().world.getBlockState(pos).isIn(BlockTags.RAILS)) pos = pos.down();
if (getMinecart().world.getBlockState(pos).func_235714_a_(BlockTags.RAILS)) pos = pos.down();
return pos;
}
@@ -27,7 +27,7 @@ import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.model.IBakedModel;
import net.minecraft.entity.Entity;
import net.minecraft.fluid.Fluid;
import net.minecraft.fluid.IFluidState;
import net.minecraft.fluid.FluidState;
import net.minecraft.tags.Tag;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.AxisAlignedBB;
@@ -54,7 +54,7 @@ public interface IForgeFluid
* @param tag Fluid category
* @param testingHead when true, its testing the entities head for vision, breathing ect... otherwise its testing the body, for swimming and movement adjustment.
*/
default boolean isEntityInside(IFluidState state, IWorldReader world, BlockPos pos, Entity entity, double yToTest, Tag<Fluid> tag, boolean testingHead)
default boolean isEntityInside(FluidState state, IWorldReader world, BlockPos pos, Entity entity, double yToTest, Tag<Fluid> tag, boolean testingHead)
{
return state.isTagged(tag) && yToTest < (double)(pos.getY() + state.getActualHeight(world, pos) + 0.11111111F);
}
@@ -70,7 +70,7 @@ public interface IForgeFluid
* @return null for default behavior, true if the box is within the material, false if it was not.
*/
@Nullable
default Boolean isAABBInsideMaterial(IFluidState state, IWorldReader world, BlockPos pos, AxisAlignedBB boundingBox, Material materialIn)
default Boolean isAABBInsideMaterial(FluidState state, IWorldReader world, BlockPos pos, AxisAlignedBB boundingBox, Material materialIn)
{
return null;
}
@@ -84,7 +84,7 @@ public interface IForgeFluid
* @return null for default behavior, true if the box is within the material, false if it was not.
*/
@Nullable
default Boolean isAABBInsideLiquid(IFluidState state, IWorldReader world, BlockPos pos, AxisAlignedBB boundingBox)
default Boolean isAABBInsideLiquid(FluidState state, IWorldReader world, BlockPos pos, AxisAlignedBB boundingBox)
{
return null;
}
@@ -98,7 +98,7 @@ public interface IForgeFluid
* @param explosion The explosion
* @return The amount of the explosion absorbed.
*/
default float getExplosionResistance(IFluidState state, IWorldReader world, BlockPos pos, @Nullable Entity exploder, Explosion explosion)
default float getExplosionResistance(FluidState state, IWorldReader world, BlockPos pos, @Nullable Entity exploder, Explosion explosion)
{
return state.getExplosionResistance();
}
@@ -24,7 +24,7 @@ import javax.annotation.Nullable;
import net.minecraft.client.renderer.model.IBakedModel;
import net.minecraft.entity.Entity;
import net.minecraft.fluid.Fluid;
import net.minecraft.fluid.IFluidState;
import net.minecraft.fluid.FluidState;
import net.minecraft.tags.Tag;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.Explosion;
@@ -32,9 +32,9 @@ import net.minecraft.world.IWorldReader;
public interface IForgeFluidState
{
default IFluidState getFluidState()
default FluidState getFluidState()
{
return (IFluidState)this;
return (FluidState)this;
}
/**
@@ -45,7 +45,7 @@ public interface IForgeFluidState
* @param pos position thats being tested.
* @param entity that is being tested.
* @param yToTest, primarily for testingHead, which sends the the eye level of the entity, other wise it sends a y that can be tested vs liquid height.
* @param material to test for.
* @param tag to test for.
* @param testingHead when true, its testing the entities head for vision, breathing ect... otherwise its testing the body, for swimming and movement adjustment.
*/
default boolean isEntityInside(IWorldReader world, BlockPos pos, Entity entity, double yToTest, Tag<Fluid> tag, boolean testingHead)
@@ -33,6 +33,7 @@ import net.minecraft.client.renderer.tileentity.ItemStackTileEntityRenderer;
import net.minecraft.entity.Entity;
import net.minecraft.entity.MobEntity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.ai.attributes.Attribute;
import net.minecraft.entity.ai.attributes.AttributeModifier;
import net.minecraft.entity.item.ItemEntity;
import net.minecraft.entity.player.PlayerEntity;
@@ -48,6 +49,8 @@ import net.minecraft.util.ActionResultType;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.text.IFormattableTextComponent;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.world.World;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
@@ -68,7 +71,7 @@ public interface IForgeItem
* ItemStack sensitive version of getItemAttributeModifiers
*/
@SuppressWarnings("deprecation")
default Multimap<String, AttributeModifier> getAttributeModifiers(EquipmentSlotType slot, ItemStack stack)
default Multimap<Attribute, AttributeModifier> getAttributeModifiers(EquipmentSlotType slot, ItemStack stack)
{
return getItem().getAttributeModifiers(slot);
}
@@ -95,7 +98,7 @@ public interface IForgeItem
* @param displayName the name that will be displayed unless it is changed in
* this method.
*/
default String getHighlightTip(ItemStack item, String displayName)
default ITextComponent getHighlightTip(ItemStack item, ITextComponent displayName)
{
return displayName;
}
@@ -616,7 +619,7 @@ public interface IForgeItem
*/
default boolean isBeaconPayment(ItemStack stack)
{
return Tags.Items.BEACON_PAYMENT.contains(stack.getItem());
return Tags.Items.BEACON_PAYMENT.func_230235_a_(stack.getItem());
}
/**
@@ -703,12 +706,13 @@ public interface IForgeItem
return null;
}
default ImmutableMap<String, ITimeValue> getAnimationParameters(final ItemStack stack, final World world, final LivingEntity entity)
{
com.google.common.collect.ImmutableMap.Builder<String, ITimeValue> builder = ImmutableMap.builder();
getItem().properties.forEach((k,v) -> builder.put(k.toString(), input -> v.call(stack, world, entity)));
return builder.build();
}
//TODO, properties dont exist anymore
// default ImmutableMap<String, ITimeValue> getAnimationParameters(final ItemStack stack, final World world, final LivingEntity entity)
// {
// com.google.common.collect.ImmutableMap.Builder<String, ITimeValue> builder = ImmutableMap.builder();
// getItem().properties.forEach((k,v) -> builder.put(k.toString(), input -> v.call(stack, world, entity)));
// return builder.build();
// }
/**
* Can this Item disable a shield
@@ -39,6 +39,8 @@ import net.minecraft.nbt.CompoundNBT;
import net.minecraft.stats.Stats;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.IFormattableTextComponent;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.world.World;
import net.minecraftforge.common.ToolType;
import net.minecraftforge.common.capabilities.ICapabilitySerializable;
@@ -358,7 +360,7 @@ public interface IForgeItemStack extends ICapabilitySerializable<CompoundNBT>
* @param displayName the name that will be displayed unless it is changed in
* this method.
*/
default String getHighlightTip(String displayName)
default ITextComponent getHighlightTip(ITextComponent displayName)
{
return getStack().getItem().getHighlightTip(getStack(), displayName);
}
@@ -19,24 +19,25 @@
package net.minecraftforge.common.extensions;
import java.util.Arrays;
import java.util.Collection;
import java.util.Optional;
import java.util.function.Function;
import javax.annotation.Nonnull;
import com.google.gson.JsonArray;
import net.minecraft.tags.Tag;
import net.minecraft.tags.TagCollection;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.common.data.IOptionalTagEntry;
import net.minecraft.data.TagsProvider;
import net.minecraft.tags.ITag;
public interface IForgeTagBuilder<T>
{
default Tag.Builder<T> addOptional(final TagCollection<T> collection, final ResourceLocation... locations)
default TagsProvider.Builder<T> getBuilder() {
return (TagsProvider.Builder<T>) this;
}
default TagsProvider.Builder<T> addTags(ITag.INamedTag<T>... values) {
TagsProvider.Builder<T> builder = getBuilder();
for (ITag.INamedTag<T> value : values) {
builder.func_240531_a_(value);
}
return builder;
}
/*default Tag.Builder<T> addOptional(final TagCollection<T> collection, final ResourceLocation... locations)
{
return addOptional(collection, Arrays.asList(locations));
}
@@ -104,5 +105,5 @@ public interface IForgeTagBuilder<T>
};
return ((Tag.Builder<T>)this).add(new TagTarget<>(tag));
}
}*/
}
@@ -43,7 +43,14 @@ public interface IForgeTileEntity extends ICapabilitySerializable<CompoundNBT>
@Override
default void deserializeNBT(CompoundNBT nbt)
{
getTileEntity().read(nbt);
//TODO re-evaluate
deserializeNBT(null, nbt);
}
// @Override TODO re-evaluate
default void deserializeNBT(BlockState state, CompoundNBT nbt)
{
getTileEntity().func_230337_a_(state, nbt);
}
@Override
@@ -72,9 +79,9 @@ public interface IForgeTileEntity extends ICapabilitySerializable<CompoundNBT>
*
* @param tag The {@link NBTTagCompound} sent from {@link #getUpdateTag()}
*/
default void handleUpdateTag(CompoundNBT tag)
default void handleUpdateTag(BlockState state, CompoundNBT tag)
{
getTileEntity().read(tag);
getTileEntity().func_230337_a_(state, tag);
}
/**
@@ -17,7 +17,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
package net.minecraftforge.common.extensions;
/*package net.minecraftforge.common.extensions;
import java.util.function.LongFunction;
@@ -50,7 +50,7 @@ public interface IForgeWorldType
/**
* Called when 'Create New World' button is pressed before starting game
*/
* /
default void onGUICreateWorldPress()
{
}
@@ -60,7 +60,7 @@ public interface IForgeWorldType
*
* @param mc The Minecraft instance
* @param gui the createworld GUI
*/
* /
@OnlyIn(Dist.CLIENT)
default void onCustomizeButton(Minecraft mc, CreateWorldScreen gui)
{
@@ -89,7 +89,7 @@ public interface IForgeWorldType
* Get the height to render the clouds for this world type
*
* @return The height to render clouds at
*/
* /
default float getCloudHeight()
{
return 128.0F;
@@ -115,7 +115,7 @@ public interface IForgeWorldType
* the supplied size.
* @return An {@link IAreaFactory} that representing the Biomes to be generated.
* @see {@link GenLayerBiome}
*/
* /
default <T extends IArea, C extends IExtendedNoiseRandom<T>> IAreaFactory<T> getBiomeLayer(IAreaFactory<T> parentLayer,
OverworldGenSettings chunkSettings, LongFunction<C> contextFactory)
{
@@ -125,4 +125,4 @@ public interface IForgeWorldType
parentLayer = EdgeBiomeLayer.INSTANCE.apply(contextFactory.apply(1000L), parentLayer);
return parentLayer;
}
}
}*/
@@ -21,8 +21,8 @@ package net.minecraftforge.common.loot;
import com.google.gson.JsonObject;
import net.minecraft.loot.conditions.ILootCondition;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.storage.loot.conditions.ILootCondition;
import net.minecraftforge.registries.GameData;
import net.minecraftforge.registries.IForgeRegistryEntry;
@@ -24,7 +24,7 @@ import java.util.List;
import javax.annotation.Nonnull;
import net.minecraft.item.ItemStack;
import net.minecraft.world.storage.loot.LootContext;
import net.minecraft.loot.LootContext;
/**
* Implementation that defines what a global loot modifier must implement in order to be functional.
@@ -25,9 +25,9 @@ import java.util.function.Predicate;
import javax.annotation.Nonnull;
import net.minecraft.item.ItemStack;
import net.minecraft.world.storage.loot.LootContext;
import net.minecraft.world.storage.loot.conditions.ILootCondition;
import net.minecraft.world.storage.loot.conditions.LootConditionManager;
import net.minecraft.loot.LootContext;
import net.minecraft.loot.conditions.ILootCondition;
import net.minecraft.loot.conditions.LootConditionManager;
/**
* A base implementation of a Global Loot Modifier for modders to extend.
@@ -30,6 +30,10 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.Map;
import net.minecraft.loot.conditions.ILootCondition;
import net.minecraft.loot.conditions.LootConditionManager;
import net.minecraft.loot.functions.ILootFunction;
import net.minecraft.loot.functions.LootFunctionManager;
import org.apache.commons.io.IOUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -48,15 +52,11 @@ import net.minecraft.resources.IResource;
import net.minecraft.resources.IResourceManager;
import net.minecraft.util.JSONUtils;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.storage.loot.conditions.ILootCondition;
import net.minecraft.world.storage.loot.conditions.LootConditionManager;
import net.minecraft.world.storage.loot.functions.ILootFunction;
import net.minecraft.world.storage.loot.functions.LootFunctionManager;
import net.minecraftforge.registries.ForgeRegistries;
public class LootModifierManager extends JsonReloadListener {
public static final Logger LOGGER = LogManager.getLogger();
private static final Gson GSON_INSTANCE = (new GsonBuilder()).registerTypeHierarchyAdapter(ILootFunction.class, new LootFunctionManager.Serializer()).registerTypeHierarchyAdapter(ILootCondition.class, new LootConditionManager.Serializer()).create();
private static final Gson GSON_INSTANCE = (new GsonBuilder()).registerTypeHierarchyAdapter(ILootFunction.class, LootFunctionManager.func_237450_a_()).registerTypeHierarchyAdapter(ILootCondition.class, LootConditionManager.func_237474_a_()).create();
private Map<ResourceLocation, IGlobalLootModifier> registeredLootModifiers = ImmutableMap.of();
private static final String folder = "loot_modifiers";
@@ -66,7 +66,7 @@ public class LootModifierManager extends JsonReloadListener {
}
@Override
protected void apply(Map<ResourceLocation, JsonObject> resourceList, IResourceManager resourceManagerIn, IProfiler profilerIn) {
protected void apply(Map<ResourceLocation, JsonElement> resourceList, IResourceManager resourceManagerIn, IProfiler profilerIn) {
Builder<ResourceLocation, IGlobalLootModifier> builder = ImmutableMap.builder();
//old way (for reference)
/*Map<IGlobalLootModifier, ResourceLocation> toLocation = new HashMap<IGlobalLootModifier, ResourceLocation>();
@@ -116,7 +116,8 @@ public class LootModifierManager extends JsonReloadListener {
finalLocations.forEach(location -> {
try {
IGlobalLootModifier modifier = deserializeModifier(location, resourceList.get(location));
builder.put(location, modifier);
if(modifier != null)
builder.put(location, modifier);
} catch (Exception exception) {
LOGGER.error("Couldn't parse loot modifier {}", location, exception);
}
@@ -125,7 +126,9 @@ public class LootModifierManager extends JsonReloadListener {
this.registeredLootModifiers = immutablemap;
}
private IGlobalLootModifier deserializeModifier(ResourceLocation location, JsonObject object) {
private IGlobalLootModifier deserializeModifier(ResourceLocation location, JsonElement element) {
if (!element.isJsonObject()) return null;
JsonObject object = element.getAsJsonObject();
ILootCondition[] lootConditions = GSON_INSTANCE.fromJson(object.get("conditions"), ILootCondition[].class);
// For backward compatibility with the initial implementation, fall back to using the location as the type.
@@ -23,10 +23,10 @@ import java.lang.reflect.Type;
import java.util.Map;
import com.google.gson.*;
import net.minecraft.client.renderer.*;
import net.minecraft.util.math.MathHelper;
import net.minecraft.client.renderer.model.ItemTransformVec3f;
import net.minecraft.util.math.vector.*;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
@@ -21,7 +21,7 @@ package net.minecraftforge.common.model.animation;
import java.io.IOException;
import net.minecraft.client.renderer.TransformationMatrix;
import net.minecraft.util.math.vector.TransformationMatrix;
import net.minecraft.client.renderer.model.IModelTransform;
import net.minecraft.client.renderer.model.IUnbakedModel;
import net.minecraft.client.renderer.model.ModelResourceLocation;
@@ -61,7 +61,7 @@ import javax.annotation.Nullable;
public final class Clips
{
private static final Logger LOGGER = LogManager.getLogger();
/**
* Clip that does nothing.
*/
@@ -82,7 +82,7 @@ public final class Clips
}
@Override
public String getName()
public String func_176610_l()
{
return "identity";
}
@@ -416,7 +416,7 @@ public final class Clips
}
@Override
public String getName()
public String func_176610_l()
{
return clipName;
}
@@ -475,7 +475,7 @@ public final class Clips
// IdentityClip + ClipReference
if(clip instanceof IStringSerializable)
{
out.value("#" + ((IStringSerializable)clip).getName());
out.value("#" + ((IStringSerializable)clip).func_176610_l());
return;
}
else if(clip instanceof TimeClip)
@@ -19,9 +19,9 @@
package net.minecraftforge.common.model.animation;
import java.util.Optional;
import net.minecraft.util.math.vector.TransformationMatrix;
import net.minecraft.client.renderer.TransformationMatrix;
import java.util.Optional;
/**
* Model part that's a part of the hierarchical skeleton.
@@ -19,7 +19,7 @@
package net.minecraftforge.common.model.animation;
import net.minecraft.client.renderer.TransformationMatrix;
import net.minecraft.util.math.vector.TransformationMatrix;
/**
* Returns Local joint pose; animation clip for specific model part.
@@ -19,7 +19,7 @@
package net.minecraftforge.common.model.animation;
import net.minecraft.client.renderer.TransformationMatrix;
import net.minecraft.util.math.vector.TransformationMatrix;
/**
* Various implementations of IJointClip.
@@ -20,11 +20,11 @@
package net.minecraftforge.common.ticket;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.Vec3d;
import net.minecraft.util.math.vector.Vector3d;
import javax.annotation.Nonnull;
public class AABBTicket extends SimpleTicket<Vec3d>
public class AABBTicket extends SimpleTicket<Vector3d>
{
@Nonnull
public final AxisAlignedBB axisAlignedBB;
@@ -35,7 +35,7 @@ public class AABBTicket extends SimpleTicket<Vec3d>
}
@Override
public boolean matches(Vec3d toMatch)
public boolean matches(Vector3d toMatch)
{
return this.axisAlignedBB.contains(toMatch);
}
@@ -29,7 +29,6 @@ import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IWorld;
import net.minecraft.world.World;
import net.minecraft.world.dimension.DimensionType;
import net.minecraftforge.fml.server.ServerLifecycleHooks;
import net.minecraftforge.registries.ForgeRegistries;
@@ -66,7 +65,7 @@ public class BlockSnapshot
public BlockSnapshot(IWorld world, BlockPos pos, BlockState state, @Nullable CompoundNBT nbt)
{
this.setWorld(world);
this.dimId = world.getDimension().getType().getId();
this.dimId = 0; //world.getDimension().getType().getId(); //TODO
this.pos = pos.toImmutable();
this.setReplacedBlock(state);
this.registryName = state.getBlock().getRegistryName();
@@ -74,7 +73,7 @@ public class BlockSnapshot
this.nbt = nbt;
if (DEBUG)
{
System.out.printf("Created BlockSnapshot - [World: %s ][Location: %d,%d,%d ][Block: %s ][Meta: %d ]", world.getWorldInfo().getWorldName(), pos.getX(), pos.getY(), pos.getZ(), getRegistryName(), getMeta());
System.out.printf("Created BlockSnapshot - [World: %s ][Location: %d,%d,%d ][Block: %s ][Meta: %d ]", world.getWorldInfo()/*TODO .getWorldName()*/, pos.getX(), pos.getY(), pos.getZ(), getRegistryName(), getMeta());
}
}
@@ -136,7 +135,8 @@ public class BlockSnapshot
IWorld world = this.world != null ? this.world.get() : null;
if (world == null)
{
world = ServerLifecycleHooks.getCurrentServer().getWorld(DimensionType.getById(getDimId()));
//TODO
//world = ServerLifecycleHooks.getCurrentServer().getWorld(DimensionType.getById(getDimId()));
this.world = new WeakReference<IWorld>(world);
}
return world;
@@ -154,7 +154,7 @@ public class BlockSnapshot
@Nullable
public TileEntity getTileEntity()
{
return getNbt() != null ? TileEntity.create(getNbt()) : null;
return getNbt() != null ? TileEntity.func_235657_b_(getReplacedBlock(), getNbt()) : null;
}
public boolean restore()
@@ -201,14 +201,14 @@ public class BlockSnapshot
te = world.getTileEntity(pos);
if (te != null)
{
te.read(getNbt());
te.func_230337_a_(getReplacedBlock(), getNbt());
te.markDirty();
}
}
if (DEBUG)
{
System.out.printf("Restored BlockSnapshot with data [World: %s ][Location: %d,%d,%d ][State: %s ][Block: %s ][TileEntity: %s ][force: %s ][notifyNeighbors: %s]", world.getWorldInfo().getWorldName(), pos.getX(), pos.getY(), pos.getZ(), replaced, replaced.getBlock().delegate.name(), te, force, notifyNeighbors);
System.out.printf("Restored BlockSnapshot with data [World: %s ][Location: %d,%d,%d ][State: %s ][Block: %s ][TileEntity: %s ][force: %s ][notifyNeighbors: %s]", world.getWorldInfo()/*TODO .getWorldName()*/, pos.getX(), pos.getY(), pos.getZ(), replaced, replaced.getBlock().delegate.name(), te, force, notifyNeighbors);
}
return true;
}
@@ -31,12 +31,14 @@ import net.minecraft.server.MinecraftServer;
import net.minecraft.server.management.PlayerInteractionManager;
import net.minecraft.stats.Stat;
import net.minecraft.util.DamageSource;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.vector.Vector3d;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.server.ServerWorld;
import net.minecraft.world.dimension.DimensionType;
import net.minecraftforge.fml.server.ServerLifecycleHooks;
import java.util.UUID;
//Preliminary, simple Fake Player class
public class FakePlayer extends ServerPlayerEntity
{
@@ -45,9 +47,10 @@ public class FakePlayer extends ServerPlayerEntity
super(world.getServer(), world, name, new PlayerInteractionManager(world));
}
@Override public Vec3d getPositionVector(){ return new Vec3d(0, 0, 0); }
@Override public Vector3d getPositionVec(){ return new Vector3d(0, 0, 0); }
@Override public BlockPos func_233580_cy_(){ return BlockPos.ZERO; }
@Override public void sendStatusMessage(ITextComponent chatComponent, boolean actionBar){}
@Override public void sendMessage(ITextComponent component) {}
@Override public void sendMessage(ITextComponent component, UUID p_145747_2_) {}
@Override public void addStat(Stat par1StatBase, int par2){}
//@Override public void openGui(Object mod, int modGuiId, World world, int x, int y, int z){}
@Override public boolean isInvulnerableTo(DamageSource source){ return true; }
@@ -24,7 +24,6 @@ import java.util.function.Function;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.world.dimension.Dimension;
import net.minecraft.world.server.ServerWorld;
/**
@@ -21,35 +21,36 @@ package net.minecraftforge.common.util;
import java.util.Collections;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import java.util.function.IntSupplier;
import java.util.function.Supplier;
import net.minecraft.tags.ITag;
import net.minecraft.tags.TagCollection;
import net.minecraft.util.ResourceLocation;
public class ReverseTagWrapper<T>
{
private final T target;
private final IntSupplier genSupplier;
private final Supplier<TagCollection<T>> colSupplier;
private int generation = -1;
//This map is immutable we track its identity change.
private Map<ResourceLocation, ITag<T>> colCache;
private Set<ResourceLocation> cache = null;
public ReverseTagWrapper(T target, IntSupplier genSupplier, Supplier<TagCollection<T>> colSupplier)
public ReverseTagWrapper(T target, Supplier<TagCollection<T>> colSupplier)
{
this.target = target;
this.genSupplier = genSupplier;
this.colSupplier = colSupplier;
}
public Set<ResourceLocation> getTagNames()
{
if (cache == null || generation != genSupplier.getAsInt())
TagCollection<T> collection = colSupplier.get();
if (cache == null || colCache != collection.getTagMap()) // Identity equals.
{
this.cache = Collections.unmodifiableSet(new HashSet<>(colSupplier.get().getOwningTags(target)));
this.generation = genSupplier.getAsInt();
this.cache = Collections.unmodifiableSet(new HashSet<>(collection.getOwningTags(target)));
this.colCache = collection.getTagMap();
}
return this.cache;
}
@@ -22,7 +22,6 @@ package net.minecraftforge.common.util;
import javax.annotation.Nullable;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.world.dimension.Dimension;
import net.minecraft.world.storage.WorldSavedData;
public class WorldCapabilityData extends WorldSavedData
@@ -68,7 +67,7 @@ public class WorldCapabilityData extends WorldSavedData
return true;
}
public void setCapabilities(Dimension provider, INBTSerializable<CompoundNBT> capabilities)
public void setCapabilities(INBTSerializable<CompoundNBT> capabilities)
{
this.serializable = capabilities;
if (this.capNBT != null && serializable != null)
@@ -36,7 +36,6 @@ import net.minecraft.entity.SpawnReason;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.EntityClassification;
import net.minecraft.entity.effect.LightningBoltEntity;
import net.minecraft.entity.item.FireworkRocketEntity;
import net.minecraft.entity.item.ItemEntity;
import net.minecraft.entity.monster.ZombieEntity;
import net.minecraft.entity.passive.AnimalEntity;
@@ -45,10 +44,13 @@ import net.minecraft.entity.player.PlayerEntity.SleepResult;
import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.entity.projectile.AbstractArrowEntity;
import net.minecraft.entity.projectile.DamagingProjectileEntity;
import net.minecraft.entity.projectile.FireworkRocketEntity;
import net.minecraft.entity.projectile.ThrowableEntity;
import net.minecraft.block.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemUseContext;
import net.minecraft.loot.LootTable;
import net.minecraft.loot.LootTableManager;
import net.minecraft.world.spawner.AbstractSpawner;
import net.minecraft.util.ActionResult;
import net.minecraft.util.ActionResultType;
@@ -71,10 +73,7 @@ import net.minecraft.world.World;
import net.minecraft.world.server.ServerWorld;
import net.minecraft.world.WorldSettings;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.storage.IPlayerFileData;
import net.minecraft.world.storage.SaveHandler;
import net.minecraft.world.storage.loot.LootTable;
import net.minecraft.world.storage.loot.LootTableManager;
import net.minecraft.world.storage.PlayerData;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.client.event.ClientChatEvent;
@@ -324,9 +323,9 @@ public class ForgeEventFactory
MinecraftForge.EVENT_BUS.post(new PlayerEvent.SaveToFile(player, playerDirectory, uuidString));
}
public static void firePlayerLoadingEvent(PlayerEntity player, IPlayerFileData playerFileData, String uuidString)
public static void firePlayerLoadingEvent(PlayerEntity player, PlayerData playerFileData, String uuidString)
{
MinecraftForge.EVENT_BUS.post(new PlayerEvent.LoadFromFile(player, ((SaveHandler)playerFileData).getPlayerFolder(), uuidString));
MinecraftForge.EVENT_BUS.post(new PlayerEvent.LoadFromFile(player, playerFileData.getPlayerDataFolder(), uuidString));
}
@Nullable
@@ -531,13 +530,13 @@ public class ForgeEventFactory
@OnlyIn(Dist.CLIENT)
public static boolean renderFireOverlay(PlayerEntity player, MatrixStack mat)
{
return renderBlockOverlay(player, mat, OverlayType.FIRE, Blocks.FIRE.getDefaultState(), new BlockPos(player));
return renderBlockOverlay(player, mat, OverlayType.FIRE, Blocks.FIRE.getDefaultState(), player.func_233580_cy_());
}
@OnlyIn(Dist.CLIENT)
public static boolean renderWaterOverlay(PlayerEntity player, MatrixStack mat)
{
return renderBlockOverlay(player, mat, OverlayType.WATER, Blocks.WATER.getDefaultState(), new BlockPos(player));
return renderBlockOverlay(player, mat, OverlayType.WATER, Blocks.WATER.getDefaultState(), player.func_233580_cy_());
}
@OnlyIn(Dist.CLIENT)
Loaded 100 of 931 files, more files were not shown because too many files have changed in this diff. Show more