diff --git a/src/main/java/com/simibubi/create/ClientEvents.java b/src/main/java/com/simibubi/create/ClientEvents.java index d6c7cdd55..7f962fce6 100644 --- a/src/main/java/com/simibubi/create/ClientEvents.java +++ b/src/main/java/com/simibubi/create/ClientEvents.java @@ -3,6 +3,7 @@ package com.simibubi.create; import java.util.ArrayList; import java.util.List; +import com.mojang.blaze3d.matrix.MatrixStack; import com.simibubi.create.config.AllConfigs; import com.simibubi.create.foundation.behaviour.filtering.FilteringHandler; import com.simibubi.create.foundation.behaviour.scrollvalue.ScrollValueHandler; @@ -17,6 +18,7 @@ import com.simibubi.create.modules.contraptions.relays.belt.BeltConnectorItemHan import com.simibubi.create.modules.curiosities.zapper.terrainzapper.TerrainZapperRenderHandler; import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.item.ItemStack; import net.minecraft.util.text.ITextComponent; import net.minecraftforge.api.distmarker.Dist; @@ -66,12 +68,14 @@ public class ClientEvents { @SubscribeEvent public static void onRenderWorld(RenderWorldLastEvent event) { - CreateClient.schematicHandler.render(); - CreateClient.schematicAndQuillHandler.render(); - CreateClient.schematicHologram.render(); - KineticDebugger.renderSourceOutline(); - ChassisRangeDisplay.renderOutlines(event.getPartialTicks()); - TerrainZapperRenderHandler.render(); + MatrixStack ms = event.getMatrixStack(); + IRenderTypeBuffer buffer = Minecraft.getInstance().getBufferBuilders().getEntityVertexConsumers(); + CreateClient.schematicHandler.render(ms, buffer); + CreateClient.schematicAndQuillHandler.render(ms, buffer); + CreateClient.schematicHologram.render(ms, buffer); + KineticDebugger.renderSourceOutline(ms, buffer); + ChassisRangeDisplay.renderOutlines(event.getPartialTicks(), ms, buffer); + TerrainZapperRenderHandler.render(ms, buffer); } @SubscribeEvent diff --git a/src/main/java/com/simibubi/create/CreateItemGroup.java b/src/main/java/com/simibubi/create/CreateItemGroup.java index 179ab1f85..5fd92d08c 100644 --- a/src/main/java/com/simibubi/create/CreateItemGroup.java +++ b/src/main/java/com/simibubi/create/CreateItemGroup.java @@ -60,7 +60,7 @@ public final class CreateItemGroup extends ItemGroup { continue; if (!item.module.isEnabled()) continue; - IBakedModel model = itemRenderer.getItemModelWithOverrides(item.asStack(), Minecraft.getInstance().world, Minecraft.getInstance().player); + IBakedModel model = itemRenderer.getItemModelWithOverrides(item.asStack(), Minecraft.getInstance().world, null); if (model.isGui3d() != specialItems) continue; if (item.get() instanceof IAddedByOther) diff --git a/src/main/java/com/simibubi/create/compat/jei/category/animations/AnimatedMillstone.java b/src/main/java/com/simibubi/create/compat/jei/category/animations/AnimatedMillstone.java index 0d186c50c..9df7715aa 100644 --- a/src/main/java/com/simibubi/create/compat/jei/category/animations/AnimatedMillstone.java +++ b/src/main/java/com/simibubi/create/compat/jei/category/animations/AnimatedMillstone.java @@ -1,6 +1,6 @@ package com.simibubi.create.compat.jei.category.animations; -import com.mojang.blaze3d.platform.GlStateManager; +import com.mojang.blaze3d.systems.RenderSystem; import com.simibubi.create.AllBlockPartials; import com.simibubi.create.AllBlocks; import com.simibubi.create.foundation.gui.ScreenElementRenderer; @@ -22,30 +22,30 @@ public class AnimatedMillstone extends AnimatedKinetics { @Override public void draw(int xOffset, int yOffset) { - GlStateManager.pushMatrix(); - GlStateManager.enableDepthTest(); - GlStateManager.translatef(xOffset, yOffset, 0); - GlStateManager.rotatef(-15.5f, 1, 0, 0); - GlStateManager.rotatef(22.5f, 0, 1, 0); - GlStateManager.translatef(-45, -5, 0); - GlStateManager.scaled(.45f, .45f, .45f); + RenderSystem.pushMatrix(); + RenderSystem.enableDepthTest(); + RenderSystem.translatef(xOffset, yOffset, 0); + RenderSystem.rotatef(-15.5f, 1, 0, 0); + RenderSystem.rotatef(22.5f, 0, 1, 0); + RenderSystem.translatef(-45, -5, 0); + RenderSystem.scaled(.45f, .45f, .45f); - GlStateManager.pushMatrix(); + RenderSystem.pushMatrix(); ScreenElementRenderer.renderModel(this::cogwheel); - GlStateManager.popMatrix(); + RenderSystem.popMatrix(); - GlStateManager.pushMatrix(); + RenderSystem.pushMatrix(); ScreenElementRenderer.renderBlock(this::body); - GlStateManager.popMatrix(); + RenderSystem.popMatrix(); - GlStateManager.popMatrix(); + RenderSystem.popMatrix(); } private IBakedModel cogwheel() { float t = 25; - GlStateManager.translatef(t, -t, -t); - GlStateManager.rotated(getCurrentAngle() * 2, 0, 1, 0); - GlStateManager.translatef(-t, t, t); + RenderSystem.translatef(t, -t, -t); + RenderSystem.rotatef(getCurrentAngle() * 2, 0, 1, 0); + RenderSystem.translatef(-t, t, t); return AllBlockPartials.MILLSTONE_COG.get(); } diff --git a/src/main/java/com/simibubi/create/foundation/behaviour/ValueBoxRenderer.java b/src/main/java/com/simibubi/create/foundation/behaviour/ValueBoxRenderer.java index 8386e1119..b7057e27f 100644 --- a/src/main/java/com/simibubi/create/foundation/behaviour/ValueBoxRenderer.java +++ b/src/main/java/com/simibubi/create/foundation/behaviour/ValueBoxRenderer.java @@ -1,5 +1,8 @@ package com.simibubi.create.foundation.behaviour; +import com.mojang.blaze3d.matrix.MatrixStack; +import com.mojang.blaze3d.platform.GlStateManager.DestFactor; +import com.mojang.blaze3d.platform.GlStateManager.SourceFactor; import com.mojang.blaze3d.systems.RenderSystem; import com.simibubi.create.foundation.utility.ColorHelper; import com.simibubi.create.foundation.utility.TessellatorHelper; @@ -12,6 +15,7 @@ import net.minecraft.block.FenceBlock; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.renderer.BufferBuilder; +import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.client.renderer.ItemRenderer; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.WorldRenderer; @@ -28,11 +32,11 @@ import net.minecraft.util.math.Vec3d; @SuppressWarnings("deprecation") public class ValueBoxRenderer { + @Deprecated // TODO 1.15 buffered rendering public static void renderBox(ValueBox box, boolean highlighted) { RenderSystem.enableBlend(); - RenderSystem.blendFuncSeparate(RenderSystem.SourceFactor.SRC_ALPHA, - RenderSystem.DestFactor.ONE_MINUS_SRC_ALPHA, RenderSystem.SourceFactor.ONE, - RenderSystem.DestFactor.ZERO); + RenderSystem.blendFuncSeparate(SourceFactor.SRC_ALPHA, DestFactor.ONE_MINUS_SRC_ALPHA, SourceFactor.ONE, + DestFactor.ZERO); RenderSystem.disableTexture(); Tessellator tessellator = Tessellator.getInstance(); @@ -42,7 +46,7 @@ public class ValueBoxRenderer { RenderSystem.lineWidth(highlighted ? 3 : 2); Vec3d color = highlighted ? ColorHelper.getRGB(box.highlightColor) : ColorHelper.getRGB(box.passiveColor); AxisAlignedBB bb = box.bb; - WorldRenderer.drawBoundingBox(bufferbuilder, bb.minX, bb.minY, bb.minZ, bb.maxX, bb.maxY, bb.maxZ, + WorldRenderer.drawBox(bufferbuilder, bb.minX, bb.minY, bb.minZ, bb.maxX, bb.maxY, bb.maxZ, (float) color.x, (float) color.y, (float) color.z, 1f); RenderSystem.lineWidth(1); @@ -84,15 +88,15 @@ public class ValueBoxRenderer { RenderSystem.translated(0, 0, 1 / 4f); } - public static void renderItemIntoValueBox(ItemStack filter) { + public static void renderItemIntoValueBox(ItemStack filter, MatrixStack ms, IRenderTypeBuffer buffer, int light, int overlay) { ItemRenderer itemRenderer = Minecraft.getInstance().getItemRenderer(); - IBakedModel modelWithOverrides = itemRenderer.getModelWithOverrides(filter); + IBakedModel modelWithOverrides = itemRenderer.getItemModelWithOverrides(filter, Minecraft.getInstance().world, null); boolean blockItem = modelWithOverrides.isGui3d(); float scale = (!blockItem ? .5f : 1f) - 1 / 64f; float zOffset = (!blockItem ? -.225f : 0) + customZOffset(filter.getItem()); RenderSystem.scaled(scale, scale, scale); RenderSystem.translated(0, 0, zOffset); - itemRenderer.renderItem(filter, TransformType.FIXED); + itemRenderer.renderItem(filter, TransformType.FIXED, light, overlay, ms, buffer); } private static float customZOffset(Item item) { diff --git a/src/main/java/com/simibubi/create/foundation/behaviour/base/SmartTileEntityRenderer.java b/src/main/java/com/simibubi/create/foundation/behaviour/base/SmartTileEntityRenderer.java index 13edf9f77..da30d9de7 100644 --- a/src/main/java/com/simibubi/create/foundation/behaviour/base/SmartTileEntityRenderer.java +++ b/src/main/java/com/simibubi/create/foundation/behaviour/base/SmartTileEntityRenderer.java @@ -1,9 +1,11 @@ package com.simibubi.create.foundation.behaviour.base; +import com.mojang.blaze3d.matrix.MatrixStack; import com.simibubi.create.foundation.behaviour.filtering.FilteringRenderer; import com.simibubi.create.foundation.behaviour.linked.LinkRenderer; import com.simibubi.create.foundation.block.SafeTileEntityRenderer; +import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; public class SmartTileEntityRenderer extends SafeTileEntityRenderer { @@ -11,11 +13,12 @@ public class SmartTileEntityRenderer extends SafeTile public SmartTileEntityRenderer(TileEntityRendererDispatcher dispatcher) { super(dispatcher); } - + @Override - public void renderWithGL(T tileEntityIn, double x, double y, double z, float partialTicks, int destroyStage) { - FilteringRenderer.renderOnTileEntity(tileEntityIn, x, y, z, partialTicks, destroyStage); - LinkRenderer.renderOnTileEntity(tileEntityIn, x, y, z, partialTicks, destroyStage); + protected void renderSafe(T tileEntityIn, float partialTicks, MatrixStack ms, IRenderTypeBuffer buffer, int light, + int overlay) { + FilteringRenderer.renderOnTileEntity(tileEntityIn, partialTicks, ms, buffer, light, overlay); + LinkRenderer.renderOnTileEntity(tileEntityIn, partialTicks, ms, buffer, light, overlay); } } diff --git a/src/main/java/com/simibubi/create/foundation/behaviour/filtering/FilteringRenderer.java b/src/main/java/com/simibubi/create/foundation/behaviour/filtering/FilteringRenderer.java index e3c5506e8..ce284ff06 100644 --- a/src/main/java/com/simibubi/create/foundation/behaviour/filtering/FilteringRenderer.java +++ b/src/main/java/com/simibubi/create/foundation/behaviour/filtering/FilteringRenderer.java @@ -1,5 +1,6 @@ package com.simibubi.create.foundation.behaviour.filtering; +import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.systems.RenderSystem; import com.simibubi.create.foundation.behaviour.ValueBox; import com.simibubi.create.foundation.behaviour.ValueBox.ItemValueBox; @@ -12,6 +13,7 @@ import com.simibubi.create.modules.logistics.item.filter.FilterItem; import net.minecraft.block.BlockState; import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.client.world.ClientWorld; import net.minecraft.item.ItemStack; import net.minecraft.util.math.AxisAlignedBB; @@ -20,7 +22,7 @@ import net.minecraft.util.math.BlockRayTraceResult; import net.minecraft.util.math.RayTraceResult; import net.minecraft.util.math.Vec3d; import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.client.event.DrawBlockHighlightEvent; +import net.minecraftforge.client.event.DrawHighlightEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod.EventBusSubscriber; @@ -28,7 +30,7 @@ import net.minecraftforge.fml.common.Mod.EventBusSubscriber; public class FilteringRenderer { @SubscribeEvent - public static void renderBlockHighlight(DrawBlockHighlightEvent event) { + public static void renderBlockHighlight(DrawHighlightEvent event) { RayTraceResult target = event.getTarget(); if (target == null || !(target instanceof BlockRayTraceResult)) return; @@ -67,8 +69,8 @@ public class FilteringRenderer { TessellatorHelper.cleanUpAfterDrawing(); } - public static void renderOnTileEntity(SmartTileEntity tileEntityIn, double x, double y, double z, - float partialTicks, int destroyStage) { + public static void renderOnTileEntity(SmartTileEntity tileEntityIn, float partialTicks, MatrixStack ms, + IRenderTypeBuffer buffer, int light, int overlay) { if (tileEntityIn == null || tileEntityIn.isRemoved()) return; @@ -84,7 +86,7 @@ public class FilteringRenderer { RenderSystem.translated(pos.getX(), pos.getY(), pos.getZ()); behaviour.slotPositioning.renderTransformed(state, () -> { - ValueBoxRenderer.renderItemIntoValueBox(behaviour.getFilter()); + ValueBoxRenderer.renderItemIntoValueBox(behaviour.getFilter(), ms, buffer, light, overlay); }); TessellatorHelper.cleanUpAfterDrawing(); diff --git a/src/main/java/com/simibubi/create/foundation/behaviour/linked/LinkRenderer.java b/src/main/java/com/simibubi/create/foundation/behaviour/linked/LinkRenderer.java index d721e13f6..8bb2e233d 100644 --- a/src/main/java/com/simibubi/create/foundation/behaviour/linked/LinkRenderer.java +++ b/src/main/java/com/simibubi/create/foundation/behaviour/linked/LinkRenderer.java @@ -2,6 +2,7 @@ package com.simibubi.create.foundation.behaviour.linked; import java.util.function.Consumer; +import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.systems.RenderSystem; import com.simibubi.create.foundation.behaviour.ValueBox; import com.simibubi.create.foundation.behaviour.ValueBoxRenderer; @@ -12,6 +13,7 @@ import com.simibubi.create.foundation.utility.TessellatorHelper; import net.minecraft.block.BlockState; import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.client.world.ClientWorld; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; @@ -19,7 +21,7 @@ import net.minecraft.util.math.BlockRayTraceResult; import net.minecraft.util.math.RayTraceResult; import net.minecraft.util.math.Vec3d; import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.client.event.DrawBlockHighlightEvent; +import net.minecraftforge.client.event.DrawHighlightEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod.EventBusSubscriber; @@ -27,7 +29,7 @@ import net.minecraftforge.fml.common.Mod.EventBusSubscriber; public class LinkRenderer { @SubscribeEvent - public static void renderBlockHighlight(DrawBlockHighlightEvent event) { + public static void renderBlockHighlight(DrawHighlightEvent event) { RayTraceResult target = event.getTarget(); if (target == null || !(target instanceof BlockRayTraceResult)) return; @@ -57,8 +59,8 @@ public class LinkRenderer { TessellatorHelper.cleanUpAfterDrawing(); } - public static void renderOnTileEntity(SmartTileEntity tileEntityIn, double x, double y, double z, - float partialTicks, int destroyStage) { + public static void renderOnTileEntity(SmartTileEntity tileEntityIn, float partialTicks, MatrixStack ms, + IRenderTypeBuffer buffer, int light, int overlay) { if (tileEntityIn == null || tileEntityIn.isRemoved()) return; @@ -73,7 +75,8 @@ public class LinkRenderer { renderEachSlot(state, behaviour, first -> { ValueBoxRenderer.renderItemIntoValueBox( - first ? behaviour.frequencyFirst.getStack() : behaviour.frequencyLast.getStack()); + first ? behaviour.frequencyFirst.getStack() : behaviour.frequencyLast.getStack(), + ms, buffer, light, overlay); }); TessellatorHelper.cleanUpAfterDrawing(); diff --git a/src/main/java/com/simibubi/create/foundation/behaviour/scrollvalue/ScrollValueRenderer.java b/src/main/java/com/simibubi/create/foundation/behaviour/scrollvalue/ScrollValueRenderer.java index 3489f8208..e8f5af13e 100644 --- a/src/main/java/com/simibubi/create/foundation/behaviour/scrollvalue/ScrollValueRenderer.java +++ b/src/main/java/com/simibubi/create/foundation/behaviour/scrollvalue/ScrollValueRenderer.java @@ -23,7 +23,7 @@ import net.minecraft.util.math.BlockRayTraceResult; import net.minecraft.util.math.RayTraceResult; import net.minecraft.util.math.Vec3d; import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.client.event.DrawBlockHighlightEvent; +import net.minecraftforge.client.event.DrawHighlightEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod.EventBusSubscriber; @@ -31,7 +31,7 @@ import net.minecraftforge.fml.common.Mod.EventBusSubscriber; public class ScrollValueRenderer { @SubscribeEvent - public static void renderBlockHighlight(DrawBlockHighlightEvent event) { + public static void renderBlockHighlight(DrawHighlightEvent event) { RayTraceResult target = event.getTarget(); if (target == null || !(target instanceof BlockRayTraceResult)) return; diff --git a/src/main/java/com/simibubi/create/foundation/block/SafeTileEntityRenderer.java b/src/main/java/com/simibubi/create/foundation/block/SafeTileEntityRenderer.java index 6056df8c5..3dc646f49 100644 --- a/src/main/java/com/simibubi/create/foundation/block/SafeTileEntityRenderer.java +++ b/src/main/java/com/simibubi/create/foundation/block/SafeTileEntityRenderer.java @@ -15,7 +15,7 @@ public abstract class SafeTileEntityRenderer extends TileE } @Override - public void render(T te, float partialTicks, MatrixStack ms, IRenderTypeBuffer buffer, int light, int overlay) { + public final void render(T te, float partialTicks, MatrixStack ms, IRenderTypeBuffer buffer, int light, int overlay) { if (isInvalid(te)) return; renderSafe(te, partialTicks, ms, buffer, light, overlay); diff --git a/src/main/java/com/simibubi/create/foundation/block/render/ColoredOverlayTileEntityRenderer.java b/src/main/java/com/simibubi/create/foundation/block/render/ColoredOverlayTileEntityRenderer.java index 3d966d83d..b3b1bb92e 100644 --- a/src/main/java/com/simibubi/create/foundation/block/render/ColoredOverlayTileEntityRenderer.java +++ b/src/main/java/com/simibubi/create/foundation/block/render/ColoredOverlayTileEntityRenderer.java @@ -3,11 +3,11 @@ package com.simibubi.create.foundation.block.render; import com.mojang.blaze3d.matrix.MatrixStack; import com.simibubi.create.foundation.block.SafeTileEntityRenderer; import com.simibubi.create.foundation.utility.SuperByteBuffer; -import com.simibubi.create.modules.contraptions.base.KineticTileEntity; import net.minecraft.block.BlockState; import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.client.renderer.RenderType; +import net.minecraft.client.renderer.WorldRenderer; import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.math.BlockPos; @@ -33,7 +33,7 @@ public abstract class ColoredOverlayTileEntityRenderer ext public static SuperByteBuffer render(World world, BlockPos pos, BlockState state, SuperByteBuffer buffer, int color) { - int packedLightmapCoords = state.getPackedLightmapCoords(world, pos); + int packedLightmapCoords = WorldRenderer.getLightmapCoordinates(world, state, pos); return buffer.color(color).light(packedLightmapCoords); } diff --git a/src/main/java/com/simibubi/create/foundation/utility/IndependentShadowRenderer.java b/src/main/java/com/simibubi/create/foundation/utility/IndependentShadowRenderer.java index 64039e94d..df906964c 100644 --- a/src/main/java/com/simibubi/create/foundation/utility/IndependentShadowRenderer.java +++ b/src/main/java/com/simibubi/create/foundation/utility/IndependentShadowRenderer.java @@ -1,96 +1,99 @@ package com.simibubi.create.foundation.utility; -import com.mojang.blaze3d.platform.GlStateManager.DestFactor; -import com.mojang.blaze3d.platform.GlStateManager.SourceFactor; -import com.mojang.blaze3d.systems.RenderSystem; +import com.mojang.blaze3d.matrix.MatrixStack; +import com.mojang.blaze3d.vertex.IVertexBuilder; import net.minecraft.block.BlockRenderType; import net.minecraft.block.BlockState; import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.BufferBuilder; -import net.minecraft.client.renderer.Tessellator; -import net.minecraft.client.renderer.vertex.DefaultVertexFormats; -import net.minecraft.client.world.ClientWorld; +import net.minecraft.client.renderer.IRenderTypeBuffer; +import net.minecraft.client.renderer.RenderType; +import net.minecraft.client.renderer.texture.OverlayTexture; +import net.minecraft.entity.MobEntity; 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.Vec3d; import net.minecraft.util.math.shapes.VoxelShape; import net.minecraft.world.IWorldReader; /** - * Stolen from EntityRenderer + * Stolen from EntityRendererManager */ public class IndependentShadowRenderer { - private static final ResourceLocation SHADOW_TEXTURES = new ResourceLocation("textures/misc/shadow.png"); + private static final RenderType SHADOW_LAYER = RenderType.getEntityNoOutline(new ResourceLocation("textures/misc/shadow.png")); - public static void renderShadow(double x, double y, double z, float shadowAlpha, float size) { - RenderSystem.enableBlend(); - RenderSystem.enableAlphaTest(); - RenderSystem.blendFunc(SourceFactor.DST_ALPHA, DestFactor.ONE_MINUS_SRC_ALPHA); - Minecraft.getInstance().getTextureManager().bindTexture(SHADOW_TEXTURES); - IWorldReader iworldreader = Minecraft.getInstance().world; - RenderSystem.depthMask(false); - int i = MathHelper.floor(x - size); - int j = MathHelper.floor(x + size); - int k = MathHelper.floor(y - size); - int l = MathHelper.floor(y); - int i1 = MathHelper.floor(z - size); - int j1 = MathHelper.floor(z + size); - Tessellator tessellator = Tessellator.getInstance(); - BufferBuilder bufferbuilder = tessellator.getBuffer(); - bufferbuilder.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR); + public static void renderShadow(MatrixStack p_229096_0_, IRenderTypeBuffer p_229096_1_, Vec3d pos, + float p_229096_3_, float p_229096_6_) { + float f = p_229096_6_; + + double d2 = pos.getX(); + double d0 = pos.getY(); + double d1 = pos.getZ(); + int i = MathHelper.floor(d2 - (double) f); + int j = MathHelper.floor(d2 + (double) f); + int k = MathHelper.floor(d0 - (double) f); + int l = MathHelper.floor(d0); + int i1 = MathHelper.floor(d1 - (double) f); + int j1 = MathHelper.floor(d1 + (double) f); + MatrixStack.Entry matrixstack$entry = p_229096_0_.peek(); + IVertexBuilder ivertexbuilder = p_229096_1_.getBuffer(SHADOW_LAYER); for (BlockPos blockpos : BlockPos.getAllInBoxMutable(new BlockPos(i, k, i1), new BlockPos(j, l, j1))) { - BlockPos blockpos1 = blockpos.down(); - BlockState blockstate = iworldreader.getBlockState(blockpos1); - if (blockstate.getRenderType() != BlockRenderType.INVISIBLE && iworldreader.getLight(blockpos) > 3) { - func_217759_a(blockstate, iworldreader, blockpos1, 0, 0, 0, blockpos, shadowAlpha, size, -x, -y, -z); - } + renderShadowPart(matrixstack$entry, ivertexbuilder, Minecraft.getInstance().world, blockpos, d2, d0, d1, f, p_229096_3_); } - tessellator.draw(); - RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); - RenderSystem.disableBlend(); - RenderSystem.depthMask(true); } - private static void func_217759_a(BlockState p_217759_1_, IWorldReader p_217759_2_, BlockPos p_217759_3_, - double p_217759_4_, double p_217759_6_, double p_217759_8_, BlockPos p_217759_10_, float p_217759_11_, - float p_217759_12_, double p_217759_13_, double p_217759_15_, double p_217759_17_) { - ClientWorld world = Minecraft.getInstance().world; - VoxelShape voxelshape = p_217759_1_.getShape(world, p_217759_10_.down()); - if (!voxelshape.isEmpty()) { - Tessellator tessellator = Tessellator.getInstance(); - BufferBuilder bufferbuilder = tessellator.getBuffer(); - double d0 = ((double) p_217759_11_ - (p_217759_6_ - ((double) p_217759_10_.getY() + p_217759_15_)) / 2.0D) - * 0.5D * (double) world.getBrightness(p_217759_10_); - if (!(d0 < 0.0D)) { - if (d0 > 1.0D) { - d0 = 1.0D; + private static void renderShadowPart(MatrixStack.Entry p_229092_0_, IVertexBuilder p_229092_1_, + IWorldReader p_229092_2_, BlockPos p_229092_3_, double p_229092_4_, double p_229092_6_, double p_229092_8_, + float p_229092_10_, float p_229092_11_) { + BlockPos blockpos = p_229092_3_.down(); + BlockState blockstate = p_229092_2_.getBlockState(blockpos); + if (blockstate.getRenderType() != BlockRenderType.INVISIBLE && p_229092_2_.getLight(p_229092_3_) > 3) { + if (blockstate.isFullCube(p_229092_2_, blockpos)) { + VoxelShape voxelshape = blockstate.getShape(p_229092_2_, p_229092_3_.down()); + if (!voxelshape.isEmpty()) { + float f = (float) (((double) p_229092_11_ - (p_229092_6_ - (double) p_229092_3_.getY()) / 2.0D) + * 0.5D * (double) p_229092_2_.getBrightness(p_229092_3_)); + if (f >= 0.0F) { + if (f > 1.0F) { + f = 1.0F; + } + + AxisAlignedBB axisalignedbb = voxelshape.getBoundingBox(); + double d0 = (double) p_229092_3_.getX() + axisalignedbb.minX; + double d1 = (double) p_229092_3_.getX() + axisalignedbb.maxX; + double d2 = (double) p_229092_3_.getY() + axisalignedbb.minY; + double d3 = (double) p_229092_3_.getZ() + axisalignedbb.minZ; + double d4 = (double) p_229092_3_.getZ() + axisalignedbb.maxZ; + float f1 = (float) (d0 - p_229092_4_); + float f2 = (float) (d1 - p_229092_4_); + float f3 = (float) (d2 - p_229092_6_ + 0.015625D); + float f4 = (float) (d3 - p_229092_8_); + float f5 = (float) (d4 - p_229092_8_); + float f6 = -f1 / 2.0F / p_229092_10_ + 0.5F; + float f7 = -f2 / 2.0F / p_229092_10_ + 0.5F; + float f8 = -f4 / 2.0F / p_229092_10_ + 0.5F; + float f9 = -f5 / 2.0F / p_229092_10_ + 0.5F; + shadowVertex(p_229092_0_, p_229092_1_, f, f1, f3, f4, f6, f8); + shadowVertex(p_229092_0_, p_229092_1_, f, f1, f3, f5, f6, f9); + shadowVertex(p_229092_0_, p_229092_1_, f, f2, f3, f5, f7, f9); + shadowVertex(p_229092_0_, p_229092_1_, f, f2, f3, f4, f7, f8); + } + } - - AxisAlignedBB axisalignedbb = voxelshape.getBoundingBox(); - double d1 = (double) p_217759_10_.getX() + axisalignedbb.minX + p_217759_13_; - double d2 = (double) p_217759_10_.getX() + axisalignedbb.maxX + p_217759_13_; - double d3 = (double) p_217759_10_.getY() + axisalignedbb.minY + p_217759_15_ + 0.015625D; - double d4 = (double) p_217759_10_.getZ() + axisalignedbb.minZ + p_217759_17_; - double d5 = (double) p_217759_10_.getZ() + axisalignedbb.maxZ + p_217759_17_; - float f = (float) ((p_217759_4_ - d1) / 2.0D / (double) p_217759_12_ + 0.5D); - float f1 = (float) ((p_217759_4_ - d2) / 2.0D / (double) p_217759_12_ + 0.5D); - float f2 = (float) ((p_217759_8_ - d4) / 2.0D / (double) p_217759_12_ + 0.5D); - float f3 = (float) ((p_217759_8_ - d5) / 2.0D / (double) p_217759_12_ + 0.5D); - bufferbuilder.vertex(d1, d3, d4).texture(f, f2).color(1.0F, 1.0F, 1.0F, (float) d0) - .endVertex(); - bufferbuilder.vertex(d1, d3, d5).texture(f, f3).color(1.0F, 1.0F, 1.0F, (float) d0) - .endVertex(); - bufferbuilder.vertex(d2, d3, d5).texture(f1, f3).color(1.0F, 1.0F, 1.0F, (float) d0) - .endVertex(); - bufferbuilder.vertex(d2, d3, d4).texture(f1, f2).color(1.0F, 1.0F, 1.0F, (float) d0) - .endVertex(); } } } + private static void shadowVertex(MatrixStack.Entry p_229091_0_, IVertexBuilder p_229091_1_, float p_229091_2_, + float p_229091_3_, float p_229091_4_, float p_229091_5_, float p_229091_6_, float p_229091_7_) { + p_229091_1_.vertex(p_229091_0_.getModel(), p_229091_3_, p_229091_4_, p_229091_5_) + .color(1.0F, 1.0F, 1.0F, p_229091_2_).texture(p_229091_6_, p_229091_7_) + .overlay(OverlayTexture.DEFAULT_UV).light(15728880).normal(p_229091_0_.getNormal(), 0.0F, 1.0F, 0.0F) + .endVertex(); + } } diff --git a/src/main/java/com/simibubi/create/foundation/utility/TessellatorHelper.java b/src/main/java/com/simibubi/create/foundation/utility/TessellatorHelper.java index 4c2996c84..0bf54a2ba 100644 --- a/src/main/java/com/simibubi/create/foundation/utility/TessellatorHelper.java +++ b/src/main/java/com/simibubi/create/foundation/utility/TessellatorHelper.java @@ -2,6 +2,7 @@ package com.simibubi.create.foundation.utility; import org.lwjgl.opengl.GL11; +import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.platform.GlStateManager.DestFactor; import com.mojang.blaze3d.platform.GlStateManager.SourceFactor; import com.mojang.blaze3d.systems.RenderSystem; @@ -16,6 +17,7 @@ import net.minecraft.client.renderer.vertex.VertexFormat; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3d; +@Deprecated public class TessellatorHelper { public static final float fontScale = 1 / 512f; @@ -48,6 +50,7 @@ public class TessellatorHelper { RenderSystem.color3f(1, 1, 1); } + @Deprecated public static void fightZFighting(int id) { long randomBits = (long) id * 493286711L; randomBits = randomBits * randomBits * 4392167121L + randomBits * 98761L; @@ -56,6 +59,16 @@ public class TessellatorHelper { float zNudge = (((float) (randomBits >> 24 & 7L) + 0.5F) / 8.0F - 0.5F) * 0.004F; RenderSystem.translatef(xNudge, yNudge, zNudge); } + + // TODO 1.15 move this one somewhere else or rename class + public static void fightZFighting(int id, MatrixStack ms) { + long randomBits = (long) id * 493286711L; + randomBits = randomBits * randomBits * 4392167121L + randomBits * 98761L; + float xNudge = (((float) (randomBits >> 16 & 7L) + 0.5F) / 8.0F - 0.5F) * 0.004F; + float yNudge = (((float) (randomBits >> 20 & 7L) + 0.5F) / 8.0F - 0.5F) * 0.004F; + float zNudge = (((float) (randomBits >> 24 & 7L) + 0.5F) / 8.0F - 0.5F) * 0.004F; + ms.translate(xNudge, yNudge, zNudge); + } public static void begin() { begin(DefaultVertexFormats.POSITION_TEX); diff --git a/src/main/java/com/simibubi/create/foundation/utility/WrappedWorld.java b/src/main/java/com/simibubi/create/foundation/utility/WrappedWorld.java index 89029ea96..0facf4751 100644 --- a/src/main/java/com/simibubi/create/foundation/utility/WrappedWorld.java +++ b/src/main/java/com/simibubi/create/foundation/utility/WrappedWorld.java @@ -19,6 +19,7 @@ import net.minecraft.world.World; import net.minecraft.world.biome.Biome; import net.minecraft.world.storage.MapData; +//TODO 1.15 this needs to extend ServerWorld public class WrappedWorld extends World { protected World world; diff --git a/src/main/java/com/simibubi/create/modules/contraptions/components/actors/HarvesterTileEntityRenderer.java b/src/main/java/com/simibubi/create/modules/contraptions/components/actors/HarvesterTileEntityRenderer.java index afbe7986e..9d160e132 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/components/actors/HarvesterTileEntityRenderer.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/components/actors/HarvesterTileEntityRenderer.java @@ -11,9 +11,9 @@ import com.simibubi.create.foundation.utility.VecHelper; import com.simibubi.create.modules.contraptions.components.contraptions.MovementContext; import net.minecraft.block.BlockState; -import net.minecraft.client.renderer.BufferBuilder; import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.client.renderer.RenderType; +import net.minecraft.client.renderer.WorldRenderer; import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; import net.minecraft.util.Direction; import net.minecraft.util.Direction.Axis; @@ -50,7 +50,7 @@ public class HarvesterTileEntityRenderer extends SafeTileEntityRenderer { public SpeedControllerRenderer(TileEntityRendererDispatcher dispatcher) { super(dispatcher); } - + @Override - public void renderWithGL(SpeedControllerTileEntity tileEntityIn, double x, double y, double z, float partialTicks, - int destroyStage) { - super.renderWithGL(tileEntityIn, x, y, z, partialTicks, destroyStage); + protected void renderSafe(SpeedControllerTileEntity tileEntityIn, float partialTicks, MatrixStack ms, + IRenderTypeBuffer buffer, int light, int overlay) { + super.renderSafe(tileEntityIn, partialTicks, ms, buffer, light, overlay); - TessellatorHelper.prepareFastRender(); - TessellatorHelper.begin(DefaultVertexFormats.BLOCK); - KineticTileEntityRenderer.renderRotatingBuffer(tileEntityIn, getWorld(), getRotatedModel(tileEntityIn), x, y, z, - Tessellator.getInstance().getBuffer()); - TessellatorHelper.draw(); + KineticTileEntityRenderer.renderRotatingBuffer(tileEntityIn, getRotatedModel(tileEntityIn), ms, buffer.getBuffer(RenderType.getSolid())); } private SuperByteBuffer getRotatedModel(SpeedControllerTileEntity te) { diff --git a/src/main/java/com/simibubi/create/modules/contraptions/relays/belt/BeltBlock.java b/src/main/java/com/simibubi/create/modules/contraptions/relays/belt/BeltBlock.java index d5f76c08d..d83496a52 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/relays/belt/BeltBlock.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/relays/belt/BeltBlock.java @@ -39,7 +39,6 @@ import net.minecraft.state.StateContainer.Builder; import net.minecraft.state.properties.BlockStateProperties; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ActionResultType; -import net.minecraft.util.BlockRenderLayer; import net.minecraft.util.Direction; import net.minecraft.util.Direction.Axis; import net.minecraft.util.Direction.AxisDirection; diff --git a/src/main/java/com/simibubi/create/modules/contraptions/relays/belt/BeltTileEntityRenderer.java b/src/main/java/com/simibubi/create/modules/contraptions/relays/belt/BeltTileEntityRenderer.java index adb60db43..ad871f046 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/relays/belt/BeltTileEntityRenderer.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/relays/belt/BeltTileEntityRenderer.java @@ -4,7 +4,9 @@ import static net.minecraft.state.properties.BlockStateProperties.HORIZONTAL_FAC import java.util.Random; +import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.systems.RenderSystem; +import com.mojang.blaze3d.vertex.IVertexBuilder; import com.simibubi.create.AllBlockPartials; import com.simibubi.create.AllBlocks; import com.simibubi.create.CreateClient; @@ -21,13 +23,14 @@ import com.simibubi.create.modules.contraptions.relays.belt.BeltBlock.Slope; import net.minecraft.block.BlockState; import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.BufferBuilder; +import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.client.renderer.ItemRenderer; import net.minecraft.client.renderer.RenderHelper; -import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.RenderType; +import net.minecraft.client.renderer.Vector3f; +import net.minecraft.client.renderer.WorldRenderer; import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType; import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; -import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import net.minecraft.util.Direction.Axis; import net.minecraft.util.Direction.AxisDirection; import net.minecraft.util.math.MathHelper; @@ -42,19 +45,11 @@ public class BeltTileEntityRenderer extends SafeTileEntityRenderer= config.lightSourceCountForRefinedRadiance.get()) { ItemStack newStack = AllItems.REFINED_RADIANCE.asStack(); - ItemEntity newEntity = new ItemEntity(world, entity.posX, entity.posY, entity.posZ, newStack); + ItemEntity newEntity = new ItemEntity(world, entity.getX(), entity.getY(), entity.getZ(), newStack); newEntity.setMotion(entity.getMotion()); newEntity.getPersistentData().putBoolean("FromLight", true); itemData.remove("CollectingLight"); @@ -139,7 +138,7 @@ public class ChromaticCompoundCubeItem extends Item implements IItemWithColorHan // Is inside beacon beam? boolean isOverBeacon = false; - MutableBlockPos testPos = new MutableBlockPos(entity.getPosition()); + BlockPos.Mutable testPos = new BlockPos.Mutable(entity.getPosition()); while (testPos.getY() > 0) { testPos.move(Direction.DOWN); BlockState state = world.getBlockState(testPos); @@ -193,7 +192,7 @@ public class ChromaticCompoundCubeItem extends Item implements IItemWithColorHan ItemStack newStack = stack.split(1); newStack.getOrCreateTag().putInt("CollectingLight", itemData.getInt("CollectingLight") + 1); - ItemEntity newEntity = new ItemEntity(world, entity.posX, entity.posY, entity.posZ, newStack); + ItemEntity newEntity = new ItemEntity(world, entity.getX(), entity.getY(), entity.getZ(), newStack); newEntity.setMotion(entity.getMotion()); newEntity.setDefaultPickupDelay(); world.addEntity(newEntity); diff --git a/src/main/java/com/simibubi/create/modules/curiosities/deforester/DeforesterItemRenderer.java b/src/main/java/com/simibubi/create/modules/curiosities/deforester/DeforesterItemRenderer.java index a2e6bd3d9..301f912ca 100644 --- a/src/main/java/com/simibubi/create/modules/curiosities/deforester/DeforesterItemRenderer.java +++ b/src/main/java/com/simibubi/create/modules/curiosities/deforester/DeforesterItemRenderer.java @@ -1,10 +1,14 @@ package com.simibubi.create.modules.curiosities.deforester; +import org.lwjgl.opengl.GL13; + +import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.platform.GLX; import com.mojang.blaze3d.systems.RenderSystem; import com.simibubi.create.foundation.utility.AnimationTickHolder; import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.client.renderer.ItemRenderer; import net.minecraft.client.renderer.tileentity.ItemStackTileEntityRenderer; import net.minecraft.item.ItemStack; @@ -12,10 +16,10 @@ import net.minecraft.item.ItemStack; public class DeforesterItemRenderer extends ItemStackTileEntityRenderer { @Override - public void renderByItem(ItemStack stack) { + public void render(ItemStack stack, MatrixStack ms, IRenderTypeBuffer buffer, int light, int overlay) { ItemRenderer itemRenderer = Minecraft.getInstance().getItemRenderer(); - DeforesterModel mainModel = (DeforesterModel) itemRenderer.getModelWithOverrides(stack); + DeforesterModel mainModel = (DeforesterModel) itemRenderer.getItemModelWithOverrides(stack, Minecraft.getInstance().world, Minecraft.getInstance().player); float worldTime = AnimationTickHolder.getRenderTick(); float lastCoordx = GLX.lastBrightnessX; float lastCoordy = GLX.lastBrightnessY; @@ -25,10 +29,10 @@ public class DeforesterItemRenderer extends ItemStackTileEntityRenderer { itemRenderer.renderItem(stack, mainModel.getBakedModel()); RenderSystem.disableLighting(); - GLX.glMultiTexCoord2f(GLX.GL_TEXTURE1, 240, 120); + GLX.glMultiTexCoord2f(GL13.GL_TEXTURE1, 240, 120); itemRenderer.renderItem(stack, mainModel.getPartial("light")); itemRenderer.renderItem(stack, mainModel.getPartial("blade")); - GLX.glMultiTexCoord2f(GLX.GL_TEXTURE1, lastCoordx, lastCoordy); + GLX.glMultiTexCoord2f(GL13.GL_TEXTURE1, lastCoordx, lastCoordy); RenderSystem.enableLighting(); float angle = worldTime * -.5f % 360; diff --git a/src/main/java/com/simibubi/create/modules/curiosities/partialWindows/WindowInABlockBlock.java b/src/main/java/com/simibubi/create/modules/curiosities/partialWindows/WindowInABlockBlock.java index da13e810e..04b525503 100644 --- a/src/main/java/com/simibubi/create/modules/curiosities/partialWindows/WindowInABlockBlock.java +++ b/src/main/java/com/simibubi/create/modules/curiosities/partialWindows/WindowInABlockBlock.java @@ -22,7 +22,6 @@ import net.minecraft.item.BlockItemUseContext; import net.minecraft.item.ItemStack; import net.minecraft.state.BooleanProperty; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockRenderLayer; import net.minecraft.util.Direction; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; @@ -100,10 +99,10 @@ public class WindowInABlockBlock extends PaneBlock return super.removedByPlayer(state, world, pos, player, willHarvest, fluid); } - @Override - public boolean canRenderInLayer(BlockState state, BlockRenderLayer layer) { - return true; - } +// @Override // TODO 1.15 register layer +// public boolean canRenderInLayer(BlockState state, BlockRenderLayer layer) { +// return true; +// } @Override public boolean isReplaceable(BlockState state, BlockItemUseContext useContext) { diff --git a/src/main/java/com/simibubi/create/modules/curiosities/partialWindows/WindowInABlockModel.java b/src/main/java/com/simibubi/create/modules/curiosities/partialWindows/WindowInABlockModel.java index bc0e65a5d..24a55a9b9 100644 --- a/src/main/java/com/simibubi/create/modules/curiosities/partialWindows/WindowInABlockModel.java +++ b/src/main/java/com/simibubi/create/modules/curiosities/partialWindows/WindowInABlockModel.java @@ -16,12 +16,14 @@ import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.BlockRendererDispatcher; +import net.minecraft.client.renderer.RenderType; +import net.minecraft.client.renderer.RenderTypeLookup; import net.minecraft.client.renderer.model.BakedQuad; import net.minecraft.client.renderer.model.IBakedModel; import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import net.minecraft.client.renderer.vertex.VertexFormat; import net.minecraft.client.world.ClientWorld; -import net.minecraft.util.BlockRenderLayer; import net.minecraft.util.Direction; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3i; @@ -46,11 +48,11 @@ public class WindowInABlockModel extends WrappedBakedModel { if (partialState == null || windowState == null) return dispatcher.getModelForState(Blocks.DIRT.getDefaultState()).getQuads(state, side, rand, data); - BlockRenderLayer renderLayer = MinecraftForgeClient.getRenderLayer(); - if (partialState.canRenderInLayer(renderLayer) && partialState != null) { + RenderType renderLayer = MinecraftForgeClient.getRenderLayer(); + if (RenderTypeLookup.canRenderInLayer(partialState, renderLayer) && partialState != null) { quads.addAll(dispatcher.getModelForState(partialState).getQuads(partialState, side, rand, data)); } - if (windowState.canRenderInLayer(renderLayer) && windowState != null) { + if (RenderTypeLookup.canRenderInLayer(windowState, renderLayer) && windowState != null) { quads.addAll(dispatcher.getModelForState(windowState).getQuads(windowState, side, rand, data).stream() .filter(q -> { Direction face = q.getFace(); @@ -68,7 +70,7 @@ public class WindowInABlockModel extends WrappedBakedModel { } protected void fightZfighting(BakedQuad q) { - VertexFormat format = q.getFormat(); + VertexFormat format = DefaultVertexFormats.BLOCK; int[] data = q.getVertexData(); Vec3i vec = q.getFace().getDirectionVec(); int dirX = vec.getX(); @@ -102,8 +104,7 @@ public class WindowInABlockModel extends WrappedBakedModel { @Override public boolean isAmbientOcclusion() { - BlockRenderLayer renderLayer = MinecraftForgeClient.getRenderLayer(); - return renderLayer == BlockRenderLayer.SOLID; + return MinecraftForgeClient.getRenderLayer() == RenderType.getSolid(); } } diff --git a/src/main/java/com/simibubi/create/modules/curiosities/symmetry/SymmetryHandler.java b/src/main/java/com/simibubi/create/modules/curiosities/symmetry/SymmetryHandler.java index ad85ac458..6dfec9cc5 100644 --- a/src/main/java/com/simibubi/create/modules/curiosities/symmetry/SymmetryHandler.java +++ b/src/main/java/com/simibubi/create/modules/curiosities/symmetry/SymmetryHandler.java @@ -4,17 +4,14 @@ import java.util.Random; import org.lwjgl.opengl.GL11; -import com.mojang.blaze3d.systems.RenderSystem; +import com.mojang.blaze3d.matrix.MatrixStack; import com.simibubi.create.AllItems; -import com.simibubi.create.foundation.utility.TessellatorHelper; import com.simibubi.create.modules.curiosities.symmetry.mirror.EmptyMirror; import com.simibubi.create.modules.curiosities.symmetry.mirror.SymmetryMirror; import net.minecraft.client.Minecraft; import net.minecraft.client.entity.player.ClientPlayerEntity; -import net.minecraft.client.renderer.BufferBuilder; -import net.minecraft.client.renderer.Tessellator; -import net.minecraft.client.renderer.vertex.DefaultVertexFormats; +import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerInventory; import net.minecraft.item.ItemStack; @@ -88,23 +85,21 @@ public class SymmetryHandler { if (mirror instanceof EmptyMirror) continue; - TessellatorHelper.prepareForDrawing(); BlockPos pos = new BlockPos(mirror.getPosition()); float yShift = 0; double speed = 1 / 16d; yShift = MathHelper.sin((float) ((tickCounter + event.getPartialTicks()) * speed)) / 5f; - BufferBuilder buffer = Tessellator.getInstance().getBuffer(); - buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.BLOCK); - RenderSystem.pushMatrix(); - RenderSystem.translated(0, yShift + .2f, 0); - mc.getBlockRendererDispatcher().renderBlock(mirror.getModel(), pos, player.world, buffer, - player.world.getRandom(), EmptyModelData.INSTANCE); - Tessellator.getInstance().draw(); - RenderSystem.popMatrix(); - TessellatorHelper.cleanUpAfterDrawing(); - + IRenderTypeBuffer buffer = Minecraft.getInstance().getBufferBuilders().getEntityVertexConsumers(); + + MatrixStack ms = event.getMatrixStack(); + ms.push(); + ms.translate(0, yShift + .2f, 0); + mc.getBlockRendererDispatcher().renderBlock(mirror.getModel(), pos, player.world, ms, buffer, + false, player.world.getRandom(), EmptyModelData.INSTANCE); + + ms.pop(); } } diff --git a/src/main/java/com/simibubi/create/modules/curiosities/symmetry/SymmetryWandItem.java b/src/main/java/com/simibubi/create/modules/curiosities/symmetry/SymmetryWandItem.java index 0bfa46d21..dd465e22f 100644 --- a/src/main/java/com/simibubi/create/modules/curiosities/symmetry/SymmetryWandItem.java +++ b/src/main/java/com/simibubi/create/modules/curiosities/symmetry/SymmetryWandItem.java @@ -188,7 +188,7 @@ public class SymmetryWandItem extends Item implements IHaveCustomItemModel { if (position.equals(pos)) continue; - if (world.func_217350_a(block, position, ISelectionContext.forEntity(player))) { + if (world.canPlace(block, position, ISelectionContext.forEntity(player))) { BlockState blockState = blockSet.get(position); for (Direction face : Direction.values()) blockState = blockState.updatePostPlacement(face, world.getBlockState(position.offset(face)), world, diff --git a/src/main/java/com/simibubi/create/modules/curiosities/symmetry/SymmetryWandScreen.java b/src/main/java/com/simibubi/create/modules/curiosities/symmetry/SymmetryWandScreen.java index 0b0fe91e3..728b5a9ce 100644 --- a/src/main/java/com/simibubi/create/modules/curiosities/symmetry/SymmetryWandScreen.java +++ b/src/main/java/com/simibubi/create/modules/curiosities/symmetry/SymmetryWandScreen.java @@ -1,7 +1,8 @@ package com.simibubi.create.modules.curiosities.symmetry; -import org.lwjgl.opengl.GL11; - +import com.mojang.blaze3d.matrix.MatrixStack; +import com.mojang.blaze3d.platform.GlStateManager.DestFactor; +import com.mojang.blaze3d.platform.GlStateManager.SourceFactor; import com.mojang.blaze3d.systems.RenderSystem; import com.simibubi.create.AllPackets; import com.simibubi.create.ScreenResources; @@ -17,11 +18,13 @@ import com.simibubi.create.modules.curiosities.symmetry.mirror.PlaneMirror; import com.simibubi.create.modules.curiosities.symmetry.mirror.SymmetryMirror; import com.simibubi.create.modules.curiosities.symmetry.mirror.TriplePlaneMirror; -import net.minecraft.client.renderer.BufferBuilder; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.client.renderer.RenderHelper; import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.Vector3f; import net.minecraft.client.renderer.texture.AtlasTexture; -import net.minecraft.client.renderer.vertex.DefaultVertexFormats; +import net.minecraft.client.renderer.texture.OverlayTexture; import net.minecraft.item.ItemStack; import net.minecraft.nbt.CompoundNBT; import net.minecraft.util.Hand; @@ -139,7 +142,7 @@ public class SymmetryWandScreen extends AbstractSimiScreen { RenderSystem.enableRescaleNormal(); RenderSystem.enableAlphaTest(); RenderSystem.alphaFunc(516, 0.1F); - RenderSystem.blendFunc(RenderSystem.SourceFactor.SRC_ALPHA, RenderSystem.DestFactor.ONE_MINUS_SRC_ALPHA); + RenderSystem.blendFunc(SourceFactor.SRC_ALPHA, DestFactor.ONE_MINUS_SRC_ALPHA); RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); RenderSystem.translated((this.width - this.sWidth) / 2 + 250, this.height / 2 + this.sHeight / 2, 100); @@ -157,14 +160,15 @@ public class SymmetryWandScreen extends AbstractSimiScreen { } protected void renderBlock() { - RenderSystem.pushMatrix(); - BufferBuilder buffer = Tessellator.getInstance().getBuffer(); - buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.BLOCK); - RenderSystem.translated(guiLeft + 15, guiTop - 117, 20); - RenderSystem.rotatef(-22.5f, .3f, 1f, 0f); - RenderSystem.scaled(32, -32, 32); - minecraft.getBlockRendererDispatcher().renderBlock(currentElement.getModel(), new BlockPos(0, -5, 0), - minecraft.world, buffer, minecraft.world.rand, EmptyModelData.INSTANCE); + MatrixStack ms = new MatrixStack(); + IRenderTypeBuffer buffer = Minecraft.getInstance().getBufferBuilders().getEntityVertexConsumers(); + + ms.translate(guiLeft + 15, guiTop - 117, 20); + ms.multiply(new Vector3f(.3f, 1f, 0f).getDegreesQuaternion(-22.5f)); + ms.scale(32, -32, 32); + ms.translate(0, -5, 0); + minecraft.getBlockRendererDispatcher().renderBlock(currentElement.getModel(), ms, buffer, 0xF000F0, + OverlayTexture.DEFAULT_UV, EmptyModelData.INSTANCE); Tessellator.getInstance().draw(); RenderSystem.popMatrix(); diff --git a/src/main/java/com/simibubi/create/modules/curiosities/symmetry/client/SymmetryWandItemRenderer.java b/src/main/java/com/simibubi/create/modules/curiosities/symmetry/client/SymmetryWandItemRenderer.java index 4d49da98e..5348e37f9 100644 --- a/src/main/java/com/simibubi/create/modules/curiosities/symmetry/client/SymmetryWandItemRenderer.java +++ b/src/main/java/com/simibubi/create/modules/curiosities/symmetry/client/SymmetryWandItemRenderer.java @@ -1,10 +1,12 @@ package com.simibubi.create.modules.curiosities.symmetry.client; +import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.platform.GLX; import com.mojang.blaze3d.systems.RenderSystem; import com.simibubi.create.foundation.utility.AnimationTickHolder; import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.client.renderer.ItemRenderer; import net.minecraft.client.renderer.tileentity.ItemStackTileEntityRenderer; import net.minecraft.item.ItemStack; @@ -13,7 +15,7 @@ import net.minecraft.util.math.MathHelper; public class SymmetryWandItemRenderer extends ItemStackTileEntityRenderer { @Override - public void renderByItem(ItemStack stack) { + public void render(ItemStack stack, MatrixStack ms, IRenderTypeBuffer buffer, int light, int overlay) { ItemRenderer itemRenderer = Minecraft.getInstance().getItemRenderer(); SymmetryWandModel mainModel = (SymmetryWandModel) itemRenderer.getModelWithOverrides(stack); diff --git a/src/main/java/com/simibubi/create/modules/curiosities/symmetry/mirror/SymmetryMirror.java b/src/main/java/com/simibubi/create/modules/curiosities/symmetry/mirror/SymmetryMirror.java index dba22ce68..aa8f4aabf 100644 --- a/src/main/java/com/simibubi/create/modules/curiosities/symmetry/mirror/SymmetryMirror.java +++ b/src/main/java/com/simibubi/create/modules/curiosities/symmetry/mirror/SymmetryMirror.java @@ -89,9 +89,9 @@ public abstract class SymmetryMirror { nbt.putInt($ORIENTATION, orientationIndex); ListNBT floatList = new ListNBT(); - floatList.add(new FloatNBT((float) position.x)); - floatList.add(new FloatNBT((float) position.y)); - floatList.add(new FloatNBT((float) position.z)); + floatList.add(FloatNBT.of((float) position.x)); + floatList.add(FloatNBT.of((float) position.y)); + floatList.add(FloatNBT.of((float) position.z)); nbt.put($POSITION, floatList); nbt.putString($TYPE, typeName()); nbt.putBoolean($ENABLE, enable); diff --git a/src/main/java/com/simibubi/create/modules/curiosities/tools/AllToolTiers.java b/src/main/java/com/simibubi/create/modules/curiosities/tools/AllToolTiers.java index e3b58ed86..ded204697 100644 --- a/src/main/java/com/simibubi/create/modules/curiosities/tools/AllToolTiers.java +++ b/src/main/java/com/simibubi/create/modules/curiosities/tools/AllToolTiers.java @@ -7,7 +7,7 @@ import com.simibubi.create.AllItems; import net.minecraft.item.IItemTier; import net.minecraft.item.Items; import net.minecraft.item.crafting.Ingredient; -import net.minecraft.util.LazyLoadBase; +import net.minecraft.util.LazyValue; public enum AllToolTiers implements IItemTier { @@ -34,7 +34,7 @@ public enum AllToolTiers implements IItemTier { private final float efficiency; private final float attackDamage; private final int enchantability; - private final LazyLoadBase repairMaterial; + private final LazyValue repairMaterial; private AllToolTiers(int harvestLevelIn, int maxUsesIn, float efficiencyIn, float attackDamageIn, int enchantabilityIn, Supplier repairMaterialIn) { @@ -43,7 +43,7 @@ public enum AllToolTiers implements IItemTier { this.efficiency = efficiencyIn; this.attackDamage = attackDamageIn; this.enchantability = enchantabilityIn; - this.repairMaterial = new LazyLoadBase<>(repairMaterialIn); + this.repairMaterial = new LazyValue<>(repairMaterialIn); } public int getMaxUses() { diff --git a/src/main/java/com/simibubi/create/modules/curiosities/tools/BlazingToolItem.java b/src/main/java/com/simibubi/create/modules/curiosities/tools/BlazingToolItem.java index 7c24a302f..3d04a038e 100644 --- a/src/main/java/com/simibubi/create/modules/curiosities/tools/BlazingToolItem.java +++ b/src/main/java/com/simibubi/create/modules/curiosities/tools/BlazingToolItem.java @@ -30,6 +30,7 @@ import net.minecraft.world.dimension.DimensionType; public class BlazingToolItem extends AbstractToolItem { + // FIXME this does not need to be a TE static FurnaceTileEntity helperFurnace = new FurnaceTileEntity(); public BlazingToolItem(float attackDamageIn, float attackSpeedIn, Properties builder, AllToolTypes... types) { @@ -75,7 +76,7 @@ public class BlazingToolItem extends AbstractToolItem { } public static List smeltDrops(Collection drops, World worldIn, int enchantmentLevel) { - helperFurnace.setWorld(worldIn); + helperFurnace.setLocation(worldIn, BlockPos.ZERO); RecipeManager recipeManager = worldIn.getRecipeManager(); List smeltedStacks = new ArrayList<>(); Iterator dropper = drops.iterator(); diff --git a/src/main/java/com/simibubi/create/modules/curiosities/tools/SandPaperItemRenderer.java b/src/main/java/com/simibubi/create/modules/curiosities/tools/SandPaperItemRenderer.java index aaf65572f..27862713c 100644 --- a/src/main/java/com/simibubi/create/modules/curiosities/tools/SandPaperItemRenderer.java +++ b/src/main/java/com/simibubi/create/modules/curiosities/tools/SandPaperItemRenderer.java @@ -1,11 +1,13 @@ package com.simibubi.create.modules.curiosities.tools; +import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.systems.RenderSystem; import com.simibubi.create.foundation.block.render.CustomRenderedItemModel; import com.simibubi.create.foundation.utility.AnimationTickHolder; import net.minecraft.client.Minecraft; import net.minecraft.client.entity.player.ClientPlayerEntity; +import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.client.renderer.ItemRenderer; import net.minecraft.client.renderer.model.IBakedModel; import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType; @@ -18,10 +20,10 @@ import net.minecraft.util.math.MathHelper; public class SandPaperItemRenderer extends ItemStackTileEntityRenderer { @Override - public void renderByItem(ItemStack stack) { + public void render(ItemStack stack, MatrixStack ms, IRenderTypeBuffer buffer, int light, int overlay) { ItemRenderer itemRenderer = Minecraft.getInstance().getItemRenderer(); ClientPlayerEntity player = Minecraft.getInstance().player; - SandPaperModel mainModel = (SandPaperModel) itemRenderer.getModelWithOverrides(stack); + SandPaperModel mainModel = (SandPaperModel) itemRenderer.getItemModelWithOverrides(stack, Minecraft.getInstance().world, null); TransformType perspective = mainModel.getCurrentPerspective(); float partialTicks = Minecraft.getInstance().getRenderPartialTicks(); @@ -58,7 +60,7 @@ public class SandPaperItemRenderer extends ItemStackTileEntityRenderer { } ItemStack toPolish = ItemStack.read(tag.getCompound("Polishing")); - itemRenderer.renderItem(toPolish, itemRenderer.getModelWithOverrides(toPolish).getBakedModel()); + itemRenderer.renderItem(toPolish, itemRenderer.getItemModelWithOverrides(toPolish, Minecraft.getInstance().world, null).getBakedModel()); RenderSystem.popMatrix(); } diff --git a/src/main/java/com/simibubi/create/modules/curiosities/tools/ToolEvents.java b/src/main/java/com/simibubi/create/modules/curiosities/tools/ToolEvents.java index 5b10dc99a..5660d3501 100644 --- a/src/main/java/com/simibubi/create/modules/curiosities/tools/ToolEvents.java +++ b/src/main/java/com/simibubi/create/modules/curiosities/tools/ToolEvents.java @@ -148,7 +148,7 @@ public class ToolEvents { event.getDrops().clear(); drops.stream().map(stack -> { - ItemEntity entity = new ItemEntity(world, target.posX, target.posY, target.posZ, stack); + ItemEntity entity = new ItemEntity(world, target.getX(), target.getY(), target.getZ(), stack); world.addEntity(entity); return entity; }).forEach(event.getDrops()::add); diff --git a/src/main/java/com/simibubi/create/modules/curiosities/zapper/ZapperItemRenderer.java b/src/main/java/com/simibubi/create/modules/curiosities/zapper/ZapperItemRenderer.java index 8e0d97619..7b59838b3 100644 --- a/src/main/java/com/simibubi/create/modules/curiosities/zapper/ZapperItemRenderer.java +++ b/src/main/java/com/simibubi/create/modules/curiosities/zapper/ZapperItemRenderer.java @@ -23,7 +23,7 @@ public abstract class ZapperItemRenderer extends ItemStackTileEntityRenderer { if (state.getBlock() instanceof FourWayBlock) modelForState = Minecraft.getInstance().getItemRenderer() - .getModelWithOverrides(new ItemStack(state.getBlock())); + .getItemModelWithOverrides(new ItemStack(state.getBlock()), Minecraft.getInstance().world, null); itemRenderer.renderItem(new ItemStack(state.getBlock()), modelForState); RenderSystem.popMatrix(); diff --git a/src/main/java/com/simibubi/create/modules/curiosities/zapper/ZapperRenderHandler.java b/src/main/java/com/simibubi/create/modules/curiosities/zapper/ZapperRenderHandler.java index ac36a5e41..be84de562 100644 --- a/src/main/java/com/simibubi/create/modules/curiosities/zapper/ZapperRenderHandler.java +++ b/src/main/java/com/simibubi/create/modules/curiosities/zapper/ZapperRenderHandler.java @@ -30,7 +30,7 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.Vec3d; import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.client.event.RenderSpecificHandEvent; +import net.minecraftforge.client.event.RenderHandEvent; import net.minecraftforge.client.event.RenderWorldLastEvent; import net.minecraftforge.event.TickEvent.ClientTickEvent; import net.minecraftforge.event.TickEvent.Phase; @@ -116,14 +116,15 @@ public class ZapperRenderHandler { return; cachedBeams.forEach(beam -> { + // TODO 1.15 buffered render TessellatorHelper.prepareForDrawing(); RenderSystem.disableTexture(); RenderSystem.lineWidth(beam.itensity * 40); BufferBuilder bufferBuilder = Tessellator.getInstance().getBuffer(); bufferBuilder.begin(GL11.GL_LINE_STRIP, DefaultVertexFormats.POSITION); - bufferBuilder.pos(beam.getStart().x, beam.getStart().y, beam.getStart().z).endVertex(); - bufferBuilder.pos(beam.end.x, beam.end.y, beam.end.z).endVertex(); + bufferBuilder.vertex(beam.getStart().x, beam.getStart().y, beam.getStart().z).endVertex(); + bufferBuilder.vertex(beam.end.x, beam.end.y, beam.end.z).endVertex(); Tessellator.getInstance().draw(); RenderSystem.lineWidth(1); @@ -168,7 +169,7 @@ public class ZapperRenderHandler { } @SubscribeEvent - public static void onRenderPlayerHand(RenderSpecificHandEvent event) { + public static void onRenderPlayerHand(RenderHandEvent event) { ItemStack heldItem = event.getItemStack(); if (!(heldItem.getItem() instanceof ZapperItem)) return; diff --git a/src/main/java/com/simibubi/create/modules/curiosities/zapper/ZapperScreen.java b/src/main/java/com/simibubi/create/modules/curiosities/zapper/ZapperScreen.java index 708a498a3..87efa12f4 100644 --- a/src/main/java/com/simibubi/create/modules/curiosities/zapper/ZapperScreen.java +++ b/src/main/java/com/simibubi/create/modules/curiosities/zapper/ZapperScreen.java @@ -4,6 +4,9 @@ import java.util.Vector; import org.lwjgl.opengl.GL11; +import com.mojang.blaze3d.matrix.MatrixStack; +import com.mojang.blaze3d.platform.GlStateManager.DestFactor; +import com.mojang.blaze3d.platform.GlStateManager.SourceFactor; import com.mojang.blaze3d.systems.RenderSystem; import com.simibubi.create.AllPackets; import com.simibubi.create.ScreenResources; @@ -18,9 +21,9 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.BufferBuilder; import net.minecraft.client.renderer.RenderHelper; import net.minecraft.client.renderer.Tessellator; -import net.minecraft.client.renderer.model.IBakedModel; import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType; import net.minecraft.client.renderer.texture.AtlasTexture; +import net.minecraft.client.renderer.texture.OverlayTexture; import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import net.minecraft.item.ItemStack; import net.minecraft.nbt.CompoundNBT; @@ -140,7 +143,7 @@ public class ZapperScreen extends AbstractSimiScreen { RenderSystem.enableRescaleNormal(); RenderSystem.enableAlphaTest(); RenderSystem.alphaFunc(516, 0.1F); - RenderSystem.blendFunc(RenderSystem.SourceFactor.SRC_ALPHA, RenderSystem.DestFactor.ONE_MINUS_SRC_ALPHA); + RenderSystem.blendFunc(SourceFactor.SRC_ALPHA, DestFactor.ONE_MINUS_SRC_ALPHA); RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); RenderSystem.translated((this.width - this.sWidth) / 2 + 260, this.height / 2 - this.sHeight / 4, 100); @@ -148,9 +151,7 @@ public class ZapperScreen extends AbstractSimiScreen { RenderSystem.rotatef(-40, .8f, 0, -.0f); RenderSystem.scaled(100, -100, 100); - IBakedModel model = itemRenderer.getModelWithOverrides(zapper); - model.handlePerspective(TransformType.FIXED); - itemRenderer.renderItem(zapper, model); + itemRenderer.renderItem(zapper, TransformType.FIXED, 0xF000F0, OverlayTexture.DEFAULT_UV, new MatrixStack(), getMinecraft().getBufferBuilders().getEntityVertexConsumers()); RenderSystem.disableAlphaTest(); RenderSystem.disableRescaleNormal(); diff --git a/src/main/java/com/simibubi/create/modules/curiosities/zapper/blockzapper/BlockzapperItemRenderer.java b/src/main/java/com/simibubi/create/modules/curiosities/zapper/blockzapper/BlockzapperItemRenderer.java index a49b73ad2..bb00b49b2 100644 --- a/src/main/java/com/simibubi/create/modules/curiosities/zapper/blockzapper/BlockzapperItemRenderer.java +++ b/src/main/java/com/simibubi/create/modules/curiosities/zapper/blockzapper/BlockzapperItemRenderer.java @@ -6,6 +6,7 @@ import static com.simibubi.create.modules.curiosities.zapper.blockzapper.Blockza import static com.simibubi.create.modules.curiosities.zapper.blockzapper.BlockzapperItem.Components.Retriever; import static com.simibubi.create.modules.curiosities.zapper.blockzapper.BlockzapperItem.Components.Scope; +import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.platform.GLX; import com.mojang.blaze3d.systems.RenderSystem; import com.simibubi.create.foundation.utility.AnimationTickHolder; @@ -16,6 +17,7 @@ import com.simibubi.create.modules.curiosities.zapper.blockzapper.BlockzapperIte import net.minecraft.client.Minecraft; import net.minecraft.client.entity.player.ClientPlayerEntity; +import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.client.renderer.ItemRenderer; import net.minecraft.client.renderer.model.IBakedModel; import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType; @@ -25,11 +27,11 @@ import net.minecraft.util.math.MathHelper; @SuppressWarnings("deprecation") public class BlockzapperItemRenderer extends ZapperItemRenderer { - + @Override - public void renderByItem(ItemStack stack) { + public void render(ItemStack stack, MatrixStack ms, IRenderTypeBuffer buffer, int light, int overlay) { ItemRenderer itemRenderer = Minecraft.getInstance().getItemRenderer(); - BlockzapperModel mainModel = (BlockzapperModel) itemRenderer.getModelWithOverrides(stack); + BlockzapperModel mainModel = (BlockzapperModel) itemRenderer.getItemModelWithOverrides(stack, Minecraft.getInstance().world, null); float pt = Minecraft.getInstance().getRenderPartialTicks(); float worldTime = AnimationTickHolder.getRenderTick() / 20; diff --git a/src/main/java/com/simibubi/create/modules/curiosities/zapper/terrainzapper/TerrainZapperRenderHandler.java b/src/main/java/com/simibubi/create/modules/curiosities/zapper/terrainzapper/TerrainZapperRenderHandler.java index 4749ee10a..a64711186 100644 --- a/src/main/java/com/simibubi/create/modules/curiosities/zapper/terrainzapper/TerrainZapperRenderHandler.java +++ b/src/main/java/com/simibubi/create/modules/curiosities/zapper/terrainzapper/TerrainZapperRenderHandler.java @@ -1,12 +1,13 @@ package com.simibubi.create.modules.curiosities.zapper.terrainzapper; -import com.mojang.blaze3d.systems.RenderSystem; +import com.mojang.blaze3d.matrix.MatrixStack; import com.simibubi.create.AllItems; import com.simibubi.create.foundation.utility.NBTHelper; -import com.simibubi.create.foundation.utility.TessellatorHelper; import net.minecraft.client.Minecraft; import net.minecraft.client.entity.player.ClientPlayerEntity; +import net.minecraft.client.renderer.IRenderTypeBuffer; +import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.WorldRenderer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.CompoundNBT; @@ -74,21 +75,24 @@ public class TerrainZapperRenderHandler { renderedPosition = pos.add(brush.getOffset(player.getLookVec(), raytrace.getFace(), placement)); } - public static void render() { + public static void render(MatrixStack ms, IRenderTypeBuffer buffer) { if (renderedPosition == null) return; - RenderSystem.lineWidth(2); - TessellatorHelper.prepareForDrawing(); - RenderSystem.disableTexture(); + // TODO 1.15 buffered render +// RenderSystem.lineWidth(2); +// TessellatorHelper.prepareForDrawing(); +// RenderSystem.disableTexture(); - RenderSystem.translated(renderedPosition.getX(), renderedPosition.getY(), renderedPosition.getZ()); - WorldRenderer.drawShape(renderedShape, 0, 0, 0, 0f, 0f, 0f, 0.5f); - - RenderSystem.enableTexture(); - TessellatorHelper.cleanUpAfterDrawing(); - RenderSystem.lineWidth(1); + ms.push(); + ms.translate(renderedPosition.getX(), renderedPosition.getY(), renderedPosition.getZ()); + WorldRenderer.func_228431_a_(ms, buffer.getBuffer(RenderType.getLines()), renderedShape, 0, 0, 0, 0f, 0f, 0f, 0.5f); +// RenderSystem.enableTexture(); +// TessellatorHelper.cleanUpAfterDrawing(); +// RenderSystem.lineWidth(1); + + ms.pop(); } } diff --git a/src/main/java/com/simibubi/create/modules/curiosities/zapper/terrainzapper/TerrainzapperItemRenderer.java b/src/main/java/com/simibubi/create/modules/curiosities/zapper/terrainzapper/TerrainzapperItemRenderer.java index 627f889ac..478e49585 100644 --- a/src/main/java/com/simibubi/create/modules/curiosities/zapper/terrainzapper/TerrainzapperItemRenderer.java +++ b/src/main/java/com/simibubi/create/modules/curiosities/zapper/terrainzapper/TerrainzapperItemRenderer.java @@ -1,5 +1,6 @@ package com.simibubi.create.modules.curiosities.zapper.terrainzapper; +import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.platform.GLX; import com.mojang.blaze3d.systems.RenderSystem; import com.simibubi.create.foundation.utility.AnimationTickHolder; @@ -8,6 +9,7 @@ import com.simibubi.create.modules.curiosities.zapper.ZapperRenderHandler; import net.minecraft.client.Minecraft; import net.minecraft.client.entity.player.ClientPlayerEntity; +import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.client.renderer.ItemRenderer; import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType; import net.minecraft.item.ItemStack; @@ -18,9 +20,9 @@ import net.minecraft.util.math.MathHelper; public class TerrainzapperItemRenderer extends ZapperItemRenderer { @Override - public void renderByItem(ItemStack stack) { + public void render(ItemStack stack, MatrixStack ms, IRenderTypeBuffer buffer, int light, int overlay) { ItemRenderer itemRenderer = Minecraft.getInstance().getItemRenderer(); - TerrainzapperModel mainModel = (TerrainzapperModel) itemRenderer.getModelWithOverrides(stack); + TerrainzapperModel mainModel = (TerrainzapperModel) itemRenderer.getItemModelWithOverrides(stack, Minecraft.getInstance().world, null); float pt = Minecraft.getInstance().getRenderPartialTicks(); float worldTime = AnimationTickHolder.getRenderTick() / 20; diff --git a/src/main/java/com/simibubi/create/modules/gardens/CocoaLogBlock.java b/src/main/java/com/simibubi/create/modules/gardens/CocoaLogBlock.java index e2edf3efd..f4eaf9406 100644 --- a/src/main/java/com/simibubi/create/modules/gardens/CocoaLogBlock.java +++ b/src/main/java/com/simibubi/create/modules/gardens/CocoaLogBlock.java @@ -19,6 +19,7 @@ import net.minecraft.util.Direction; import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockReader; import net.minecraft.world.World; +import net.minecraft.world.server.ServerWorld; public class CocoaLogBlock extends RotatedPillarBlock implements IGrowable { @@ -34,7 +35,7 @@ public class CocoaLogBlock extends RotatedPillarBlock implements IGrowable { } @Override - public void tick(BlockState state, World worldIn, BlockPos pos, Random random) { + public void randomTick(BlockState state, ServerWorld worldIn, BlockPos pos, Random random) { if (!worldIn.isAreaLoaded(pos, 1)) return; // Forge: prevent loading unloaded chunks when checking neighbor's light grow(worldIn, random, pos, state); @@ -52,7 +53,7 @@ public class CocoaLogBlock extends RotatedPillarBlock implements IGrowable { } @Override - public void grow(World world, Random random, BlockPos pos, BlockState state) { + public void grow(ServerWorld world, Random random, BlockPos pos, BlockState state) { if (random.nextDouble() > AllConfigs.SERVER.curiosities.cocoaLogGrowthSpeed.get() / 100D) return; diff --git a/src/main/java/com/simibubi/create/modules/logistics/InWorldProcessing.java b/src/main/java/com/simibubi/create/modules/logistics/InWorldProcessing.java index 7153180af..bb2e95de9 100644 --- a/src/main/java/com/simibubi/create/modules/logistics/InWorldProcessing.java +++ b/src/main/java/com/simibubi/create/modules/logistics/InWorldProcessing.java @@ -96,8 +96,9 @@ public class InWorldProcessing { } if (type == Type.SMOKING) { + // FIXME this does not need to be a TE SmokerTileEntity smoker = new SmokerTileEntity(); - smoker.setWorld(world); + smoker.setLocation(world, BlockPos.ZERO); smoker.setInventorySlotContents(0, stack); Optional recipe = world.getRecipeManager().getRecipe(IRecipeType.SMOKING, smoker, world); return recipe.isPresent(); @@ -128,7 +129,7 @@ public class InWorldProcessing { } entity.setItem(stacks.remove(0)); for (ItemStack additional : stacks) { - ItemEntity entityIn = new ItemEntity(entity.world, entity.posX, entity.posY, entity.posZ, additional); + ItemEntity entityIn = new ItemEntity(entity.world, entity.getX(), entity.getY(), entity.getZ(), additional); entityIn.setMotion(entity.getMotion()); entity.world.addEntity(entityIn); } @@ -173,14 +174,16 @@ public class InWorldProcessing { return null; } + // FIXME this does not need to be a TE SmokerTileEntity smoker = new SmokerTileEntity(); - smoker.setWorld(world); + smoker.setLocation(world, BlockPos.ZERO); smoker.setInventorySlotContents(0, stack); Optional smokingRecipe = world.getRecipeManager().getRecipe(IRecipeType.SMOKING, smoker, world); if (type == Type.BLASTING) { + // FIXME this does not need to be a TE FurnaceTileEntity furnace = new FurnaceTileEntity(); - furnace.setWorld(world); + furnace.setLocation(world, BlockPos.ZERO); furnace.setInventorySlotContents(0, stack); Optional smeltingRecipe = world.getRecipeManager().getRecipe(IRecipeType.SMELTING, furnace, world); @@ -189,8 +192,9 @@ public class InWorldProcessing { if (smeltingRecipe.isPresent()) return applyRecipeOn(stack, smeltingRecipe.get()); + // FIXME this does not need to be a TE BlastFurnaceTileEntity blastFurnace = new BlastFurnaceTileEntity(); - blastFurnace.setWorld(world); + blastFurnace.setLocation(world, BlockPos.ZERO); blastFurnace.setInventorySlotContents(0, stack); Optional blastingRecipe = world.getRecipeManager().getRecipe(IRecipeType.BLASTING, blastFurnace, world); @@ -242,7 +246,7 @@ public class InWorldProcessing { } entity.setItem(stacks.remove(0)); for (ItemStack additional : stacks) { - ItemEntity entityIn = new ItemEntity(entity.world, entity.posX, entity.posY, entity.posZ, additional); + ItemEntity entityIn = new ItemEntity(entity.world, entity.getX(), entity.getY(), entity.getZ(), additional); entityIn.setMotion(entity.getMotion()); entity.world.addEntity(entityIn); } diff --git a/src/main/java/com/simibubi/create/modules/logistics/block/RedstoneLinkBlock.java b/src/main/java/com/simibubi/create/modules/logistics/block/RedstoneLinkBlock.java index 09fc35705..8f3951788 100644 --- a/src/main/java/com/simibubi/create/modules/logistics/block/RedstoneLinkBlock.java +++ b/src/main/java/com/simibubi/create/modules/logistics/block/RedstoneLinkBlock.java @@ -14,7 +14,6 @@ import net.minecraft.state.BooleanProperty; import net.minecraft.state.StateContainer.Builder; import net.minecraft.state.properties.BlockStateProperties; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockRenderLayer; import net.minecraft.util.Direction; import net.minecraft.util.Hand; import net.minecraft.util.math.BlockPos; @@ -144,10 +143,10 @@ public class RedstoneLinkBlock extends ProperDirectionalBlock { return side != null; } - @Override - public BlockRenderLayer getRenderLayer() { - return BlockRenderLayer.CUTOUT; - } +// @Override // TODO 1.15 register layer +// public BlockRenderLayer getRenderLayer() { +// return BlockRenderLayer.CUTOUT; +// } @Override public boolean isValidPosition(BlockState state, IWorldReader worldIn, BlockPos pos) { diff --git a/src/main/java/com/simibubi/create/modules/logistics/block/StockswitchBlock.java b/src/main/java/com/simibubi/create/modules/logistics/block/StockswitchBlock.java index 74cc0feeb..85c7eec40 100644 --- a/src/main/java/com/simibubi/create/modules/logistics/block/StockswitchBlock.java +++ b/src/main/java/com/simibubi/create/modules/logistics/block/StockswitchBlock.java @@ -12,6 +12,7 @@ import net.minecraft.item.BlockItemUseContext; import net.minecraft.state.IntegerProperty; import net.minecraft.state.StateContainer.Builder; import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.ActionResultType; import net.minecraft.util.Direction; import net.minecraft.util.Hand; import net.minecraft.util.math.BlockPos; @@ -32,11 +33,6 @@ public class StockswitchBlock extends HorizontalBlock { super(Properties.from(Blocks.ANDESITE)); } - @Override - public boolean isSolid(BlockState state) { - return false; - } - @Override public void onBlockAdded(BlockState state, World worldIn, BlockPos pos, BlockState oldState, boolean isMoving) { updateObservedInventory(state, worldIn, pos); @@ -85,12 +81,12 @@ public class StockswitchBlock extends HorizontalBlock { } @Override - public boolean onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity player, Hand handIn, + public ActionResultType onUse(BlockState state, World worldIn, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) { DistExecutor.runWhenOn(Dist.CLIENT, () -> () -> { displayScreen((StockswitchTileEntity) worldIn.getTileEntity(pos)); }); - return true; + return ActionResultType.SUCCESS; } @OnlyIn(value = Dist.CLIENT) diff --git a/src/main/java/com/simibubi/create/modules/logistics/block/belts/BeltObserverBlock.java b/src/main/java/com/simibubi/create/modules/logistics/block/belts/BeltObserverBlock.java index e2c8df2e7..e787ab24b 100644 --- a/src/main/java/com/simibubi/create/modules/logistics/block/belts/BeltObserverBlock.java +++ b/src/main/java/com/simibubi/create/modules/logistics/block/belts/BeltObserverBlock.java @@ -45,6 +45,7 @@ import net.minecraft.util.math.Vec3d; import net.minecraft.world.IBlockReader; import net.minecraft.world.IWorld; import net.minecraft.world.World; +import net.minecraft.world.server.ServerWorld; public class BeltObserverBlock extends HorizontalBlock implements IWithTileEntity, IBeltAttachment, IWrenchable { @@ -278,7 +279,7 @@ public class BeltObserverBlock extends HorizontalBlock } @Override - public void tick(BlockState state, World worldIn, BlockPos pos, Random random) { + public void scheduledTick(BlockState state, ServerWorld worldIn, BlockPos pos, Random random) { worldIn.setBlockState(pos, state.with(POWERED, false), 2); worldIn.notifyNeighborsOfStateChange(pos, this); } diff --git a/src/main/java/com/simibubi/create/modules/logistics/block/belts/BeltObserverTileEntityRenderer.java b/src/main/java/com/simibubi/create/modules/logistics/block/belts/BeltObserverTileEntityRenderer.java index f1a5aeba2..d2d44197f 100644 --- a/src/main/java/com/simibubi/create/modules/logistics/block/belts/BeltObserverTileEntityRenderer.java +++ b/src/main/java/com/simibubi/create/modules/logistics/block/belts/BeltObserverTileEntityRenderer.java @@ -1,9 +1,11 @@ package com.simibubi.create.modules.logistics.block.belts; -import com.mojang.blaze3d.platform.GLX; +import com.mojang.blaze3d.matrix.MatrixStack; import com.simibubi.create.foundation.behaviour.filtering.FilteringRenderer; import com.simibubi.create.foundation.block.SafeTileEntityRenderer; +import net.minecraft.client.renderer.IRenderTypeBuffer; +import net.minecraft.client.renderer.WorldRenderer; import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; import net.minecraft.state.properties.BlockStateProperties; @@ -14,15 +16,12 @@ public class BeltObserverTileEntityRenderer extends SafeTileEntityRenderer { buf.writeItemStack(heldItem); }); - return ActionResult.newResult(ActionResultType.SUCCESS, heldItem); + return ActionResult.success(heldItem); } - return ActionResult.newResult(ActionResultType.PASS, heldItem); + return ActionResult.pass(heldItem); } @Override diff --git a/src/main/java/com/simibubi/create/modules/palettes/CTGlassBlock.java b/src/main/java/com/simibubi/create/modules/palettes/CTGlassBlock.java index 5970ff60f..74d433557 100644 --- a/src/main/java/com/simibubi/create/modules/palettes/CTGlassBlock.java +++ b/src/main/java/com/simibubi/create/modules/palettes/CTGlassBlock.java @@ -9,7 +9,6 @@ import com.simibubi.create.foundation.block.connected.StandardCTBehaviour; import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; import net.minecraft.block.GlassBlock; -import net.minecraft.util.BlockRenderLayer; import net.minecraft.util.Direction; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; @@ -36,10 +35,10 @@ public class CTGlassBlock extends GlassBlock implements IHaveConnectedTextures { return new StandardCTBehaviour(spriteShift); } - @Override - public BlockRenderLayer getRenderLayer() { - return hasAlpha ? BlockRenderLayer.TRANSLUCENT : super.getRenderLayer(); - } +// @Override // TODO 1.15 register layer +// public BlockRenderLayer getRenderLayer() { +// return hasAlpha ? BlockRenderLayer.TRANSLUCENT : super.getRenderLayer(); +// } @Override public ConnectedTextureBehaviour getBehaviour() { diff --git a/src/main/java/com/simibubi/create/modules/palettes/CTGlassPaneBlock.java b/src/main/java/com/simibubi/create/modules/palettes/CTGlassPaneBlock.java index 7795d9865..9144d60ec 100644 --- a/src/main/java/com/simibubi/create/modules/palettes/CTGlassPaneBlock.java +++ b/src/main/java/com/simibubi/create/modules/palettes/CTGlassPaneBlock.java @@ -8,7 +8,6 @@ import com.simibubi.create.foundation.block.connected.StandardCTBehaviour; import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; -import net.minecraft.util.BlockRenderLayer; import net.minecraft.util.Direction; import net.minecraft.util.Direction.AxisDirection; import net.minecraft.util.math.BlockPos; @@ -57,10 +56,10 @@ public class CTGlassPaneBlock extends GlassPaneBlock implements IHaveConnectedTe return null; } - @Override - public BlockRenderLayer getRenderLayer() { - return ctGlass.getRenderLayer(); - } +// @Override // TODO 1.15 register layer +// public BlockRenderLayer getRenderLayer() { +// return ctGlass.getRenderLayer(); +// } @Override public ConnectedTextureBehaviour getBehaviour() { diff --git a/src/main/java/com/simibubi/create/modules/palettes/CTWindowBlock.java b/src/main/java/com/simibubi/create/modules/palettes/CTWindowBlock.java index 3884fd3aa..ccb7b51f0 100644 --- a/src/main/java/com/simibubi/create/modules/palettes/CTWindowBlock.java +++ b/src/main/java/com/simibubi/create/modules/palettes/CTWindowBlock.java @@ -3,7 +3,8 @@ package com.simibubi.create.modules.palettes; import com.simibubi.create.AllCTs; import net.minecraft.block.BlockState; -import net.minecraft.util.BlockRenderLayer; +import net.minecraft.client.renderer.RenderType; +import net.minecraft.client.renderer.RenderTypeLookup; import net.minecraft.util.Direction; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; @@ -18,7 +19,7 @@ public class CTWindowBlock extends VerticalCTGlassBlock { @Override public boolean isSideInvisible(BlockState state, BlockState adjacentBlockState, Direction side) { return adjacentBlockState.getBlock() instanceof CTGlassBlock - ? (!state.canRenderInLayer(BlockRenderLayer.TRANSLUCENT) && side.getAxis().isHorizontal() + ? (!RenderTypeLookup.canRenderInLayer(state, RenderType.getTranslucent()) && side.getAxis().isHorizontal() || state.getBlock() == adjacentBlockState.getBlock()) : super.isSideInvisible(state, adjacentBlockState, side); } diff --git a/src/main/java/com/simibubi/create/modules/schematics/block/CreativeCrateBlock.java b/src/main/java/com/simibubi/create/modules/schematics/block/CreativeCrateBlock.java index b8a328bfe..ce88646cc 100644 --- a/src/main/java/com/simibubi/create/modules/schematics/block/CreativeCrateBlock.java +++ b/src/main/java/com/simibubi/create/modules/schematics/block/CreativeCrateBlock.java @@ -19,11 +19,6 @@ public class CreativeCrateBlock extends Block { super(Properties.create(Material.WOOD)); } - @Override - public boolean isSolid(BlockState state) { - return false; - } - @Override public void fillItemGroup(ItemGroup group, NonNullList items) { } diff --git a/src/main/java/com/simibubi/create/modules/schematics/block/SchematicTableBlock.java b/src/main/java/com/simibubi/create/modules/schematics/block/SchematicTableBlock.java index 3b93a76e6..e8c05aafd 100644 --- a/src/main/java/com/simibubi/create/modules/schematics/block/SchematicTableBlock.java +++ b/src/main/java/com/simibubi/create/modules/schematics/block/SchematicTableBlock.java @@ -33,11 +33,6 @@ public class SchematicTableBlock extends HorizontalBlock { builder.add(HORIZONTAL_FACING); super.fillStateContainer(builder); } - - @Override - public boolean isSolid(BlockState state) { - return false; - } @Override public PushReaction getPushReaction(BlockState state) { diff --git a/src/main/java/com/simibubi/create/modules/schematics/block/SchematicTableScreen.java b/src/main/java/com/simibubi/create/modules/schematics/block/SchematicTableScreen.java index f718a1846..7eb9830d7 100644 --- a/src/main/java/com/simibubi/create/modules/schematics/block/SchematicTableScreen.java +++ b/src/main/java/com/simibubi/create/modules/schematics/block/SchematicTableScreen.java @@ -6,6 +6,7 @@ import static com.simibubi.create.ScreenResources.SCHEMATIC_TABLE_PROGRESS; import java.nio.file.Paths; import java.util.List; +import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.platform.GlStateManager.DestFactor; import com.mojang.blaze3d.platform.GlStateManager.SourceFactor; import com.mojang.blaze3d.systems.RenderSystem; @@ -23,11 +24,14 @@ import com.simibubi.create.modules.schematics.ClientSchematicLoader; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.IHasContainer; import net.minecraft.client.renderer.RenderHelper; +import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.texture.AtlasTexture; +import net.minecraft.client.renderer.texture.OverlayTexture; import net.minecraft.entity.player.PlayerInventory; import net.minecraft.util.Util; import net.minecraft.util.math.MathHelper; import net.minecraft.util.text.ITextComponent; +import net.minecraftforge.client.model.data.EmptyModelData; public class SchematicTableScreen extends AbstractSimiContainerScreen implements IHasContainer { @@ -135,8 +139,9 @@ public class SchematicTableScreen extends AbstractSimiContainerScreen { @@ -78,29 +78,28 @@ public class SchematicannonRenderer extends SafeTileEntityRenderer block.totalTicks - 10) { @@ -126,29 +125,27 @@ public class SchematicannonRenderer extends SafeTileEntityRenderer