mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-11-18 07:53:07 +01:00
Yet more porting work
This commit is contained in:
parent
748f8af229
commit
e52fa26fda
64 changed files with 435 additions and 384 deletions
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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<T extends SmartTileEntity> extends SafeTileEntityRenderer<T> {
|
||||
|
@ -13,9 +15,10 @@ public class SmartTileEntityRenderer<T extends SmartTileEntity> extends SafeTile
|
|||
}
|
||||
|
||||
@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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -15,7 +15,7 @@ public abstract class SafeTileEntityRenderer<T extends TileEntity> 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);
|
||||
|
|
|
@ -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<T extends TileEntity> 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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
@ -57,6 +60,16 @@ public class TessellatorHelper {
|
|||
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);
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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<Harveste
|
|||
|
||||
public static SuperByteBuffer renderHead(World world, BlockPos pos, BlockState state, float angle) {
|
||||
SuperByteBuffer buffer = AllBlockPartials.HARVESTER_BLADE.renderOnHorizontal(state);
|
||||
int lightMapCoords = state.getPackedLightmapCoords(world, pos);
|
||||
int lightMapCoords = WorldRenderer.getLightmapCoordinates(world, state, pos);
|
||||
Direction facing = state.get(HORIZONTAL_FACING);
|
||||
Axis axis = facing.rotateYCCW().getAxis();
|
||||
int axisDirection = -facing.getAxisDirection().getOffset();
|
||||
|
|
|
@ -9,6 +9,10 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import com.mojang.blaze3d.platform.GlStateManager.DestFactor;
|
||||
import com.mojang.blaze3d.platform.GlStateManager.SourceFactor;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.simibubi.create.AllItems;
|
||||
import com.simibubi.create.AllKeys;
|
||||
|
@ -16,6 +20,7 @@ import com.simibubi.create.foundation.utility.TessellatorHelper;
|
|||
import com.simibubi.create.modules.contraptions.components.contraptions.chassis.ChassisTileEntity;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
@ -172,7 +177,8 @@ public class ChassisRangeDisplay {
|
|||
}
|
||||
}
|
||||
|
||||
public static void renderOutlines(float partialTicks) {
|
||||
public static void renderOutlines(float partialTicks, MatrixStack ms, IRenderTypeBuffer buffer) {
|
||||
// TODO 1.15 buffered render
|
||||
RenderSystem.lineWidth(2);
|
||||
TessellatorHelper.prepareForDrawing();
|
||||
RenderSystem.disableTexture();
|
||||
|
|
|
@ -31,6 +31,7 @@ import net.minecraft.client.Minecraft;
|
|||
import net.minecraft.client.renderer.BufferBuilder;
|
||||
import net.minecraft.client.renderer.ItemRenderer;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
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;
|
||||
|
@ -157,7 +158,7 @@ public class DeployerTileEntityRenderer extends SafeTileEntityRenderer<DeployerT
|
|||
buffer.rotateCentered(Axis.Z, (float) ((zRotFirst) / 180 * Math.PI));
|
||||
buffer.rotateCentered(Axis.Y, (float) ((yRot) / 180 * Math.PI));
|
||||
buffer.rotateCentered(Axis.Z, (float) ((zRot) / 180 * Math.PI));
|
||||
buffer.light(deployerState.getPackedLightmapCoords(world, pos));
|
||||
buffer.light(WorldRenderer.getLightmapCoordinates(world, deployerState, pos));
|
||||
return buffer;
|
||||
}
|
||||
|
||||
|
|
|
@ -6,8 +6,14 @@ import com.simibubi.create.foundation.utility.SuperByteBuffer;
|
|||
import com.simibubi.create.modules.contraptions.base.KineticTileEntity;
|
||||
import com.simibubi.create.modules.contraptions.base.KineticTileEntityRenderer;
|
||||
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
|
||||
|
||||
public class MillstoneRenderer extends KineticTileEntityRenderer {
|
||||
|
||||
public MillstoneRenderer(TileEntityRendererDispatcher dispatcher) {
|
||||
super(dispatcher);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SuperByteBuffer getRotatedModel(KineticTileEntity te) {
|
||||
return CreateClient.bufferCache.renderPartial(AllBlockPartials.MILLSTONE_COG, te.getBlockState());
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
package com.simibubi.create.modules.contraptions.relays.advanced;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.simibubi.create.AllBlocks;
|
||||
import com.simibubi.create.CreateClient;
|
||||
import com.simibubi.create.foundation.behaviour.base.SmartTileEntityRenderer;
|
||||
import com.simibubi.create.foundation.utility.SuperByteBuffer;
|
||||
import com.simibubi.create.foundation.utility.TessellatorHelper;
|
||||
import com.simibubi.create.modules.contraptions.base.KineticTileEntityRenderer;
|
||||
import com.simibubi.create.modules.contraptions.relays.elementary.ShaftBlock;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
|
||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||
|
||||
public class SpeedControllerRenderer extends SmartTileEntityRenderer<SpeedControllerTileEntity> {
|
||||
|
||||
|
@ -20,15 +20,11 @@ public class SpeedControllerRenderer extends SmartTileEntityRenderer<SpeedContro
|
|||
}
|
||||
|
||||
@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) {
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
@ -44,17 +47,9 @@ public class BeltTileEntityRenderer extends SafeTileEntityRenderer<BeltTileEntit
|
|||
}
|
||||
|
||||
@Override
|
||||
public void renderWithGL(BeltTileEntity te, double x, double y, double z, float partialTicks, int destroyStage) {
|
||||
TessellatorHelper.prepareFastRender();
|
||||
TessellatorHelper.begin(DefaultVertexFormats.BLOCK);
|
||||
renderTileEntityFast(te, x, y, z, partialTicks, destroyStage, Tessellator.getInstance().getBuffer());
|
||||
TessellatorHelper.draw();
|
||||
renderItems(te, x, y, z, partialTicks);
|
||||
}
|
||||
protected void renderSafe(BeltTileEntity te, float partialTicks, MatrixStack ms, IRenderTypeBuffer buffer,
|
||||
int light, int overlay) {
|
||||
|
||||
@Override
|
||||
public void renderFast(BeltTileEntity te, double x, double y, double z, float partialTicks, int destroyStage,
|
||||
BufferBuilder buffer) {
|
||||
BlockState blockState = te.getBlockState();
|
||||
if (!AllBlocks.BELT.typeOf(blockState))
|
||||
return;
|
||||
|
@ -84,37 +79,42 @@ public class BeltTileEntityRenderer extends SafeTileEntityRenderer<BeltTileEntit
|
|||
beltBuffer.shiftUVtoSheet(animatedTexture.getOriginal(), animatedTexture.getTarget(), 0, 0);
|
||||
}
|
||||
|
||||
int packedLightmapCoords = blockState.getPackedLightmapCoords(getWorld(), te.getPos());
|
||||
beltBuffer.light(packedLightmapCoords).translate(x, y, z).renderInto(buffer);
|
||||
IVertexBuilder vb = buffer.getBuffer(RenderType.getSolid());
|
||||
|
||||
int packedLightmapCoords = WorldRenderer.getLightmapCoordinates(te.getWorld(), blockState, te.getPos());
|
||||
beltBuffer.light(packedLightmapCoords).renderInto(ms, vb);
|
||||
|
||||
if (te.hasPulley()) {
|
||||
SuperByteBuffer superBuffer = AllBlockPartials.BELT_PULLEY.renderOn(blockState);
|
||||
Axis axis = blockState.get(BeltBlock.HORIZONTAL_FACING).getAxis();
|
||||
superBuffer.rotateCentered(Axis.X, (float) (Math.PI / 2));
|
||||
superBuffer.rotateCentered(Axis.Y, (float) (axis == Axis.X ? 0 : Math.PI / 2));
|
||||
KineticTileEntityRenderer.standardKineticRotationTransform(superBuffer, te, getWorld()).translate(x, y, z)
|
||||
.renderInto(buffer);
|
||||
KineticTileEntityRenderer.standardKineticRotationTransform(superBuffer, te)
|
||||
.renderInto(ms, vb);
|
||||
}
|
||||
|
||||
renderItems(te, partialTicks, ms, buffer, light, overlay);
|
||||
}
|
||||
|
||||
protected void renderItems(BeltTileEntity te, double x, double y, double z, float partialTicks) {
|
||||
protected void renderItems(BeltTileEntity te, float partialTicks, MatrixStack ms, IRenderTypeBuffer buffer,
|
||||
int light, int overlay) {
|
||||
if (!te.isController())
|
||||
return;
|
||||
if (te.beltLength == 0)
|
||||
return;
|
||||
|
||||
RenderSystem.pushMatrix();
|
||||
ms.push();
|
||||
|
||||
Vec3i directionVec = te.getBeltFacing().getDirectionVec();
|
||||
Vec3d beltStartOffset = new Vec3d(directionVec).scale(-.5).add(.5, 13 / 16f + .125f, .5);
|
||||
RenderSystem.translated(x + beltStartOffset.x, y + beltStartOffset.y, z + beltStartOffset.z);
|
||||
ms.translate(beltStartOffset.x, beltStartOffset.y, beltStartOffset.z);
|
||||
Slope slope = te.getBlockState().get(BeltBlock.SLOPE);
|
||||
int verticality = slope == Slope.DOWNWARD ? -1 : slope == Slope.UPWARD ? 1 : 0;
|
||||
boolean slopeAlongX = te.getBeltFacing().getAxis() == Axis.X;
|
||||
|
||||
for (TransportedItemStack transported : te.getInventory().items) {
|
||||
RenderSystem.pushMatrix();
|
||||
TessellatorHelper.fightZFighting(transported.angle);
|
||||
ms.push();
|
||||
TessellatorHelper.fightZFighting(transported.angle, ms);
|
||||
float offset = MathHelper.lerp(partialTicks, transported.prevBeltPosition, transported.beltPosition);
|
||||
float sideOffset = MathHelper.lerp(partialTicks, transported.prevSideOffset, transported.sideOffset);
|
||||
float verticalMovement = verticality;
|
||||
|
@ -134,59 +134,55 @@ public class BeltTileEntityRenderer extends SafeTileEntityRenderer<BeltTileEntit
|
|||
.getBeltFacing().getAxis() == Axis.Z);
|
||||
float slopeAngle = onSlope ? tiltForward ? -45 : 45 : 0;
|
||||
|
||||
RenderSystem.translated(offsetVec.x, offsetVec.y, offsetVec.z);
|
||||
ms.translate(offsetVec.x, offsetVec.y, offsetVec.z);
|
||||
|
||||
boolean alongX = te.getBeltFacing().rotateY().getAxis() == Axis.X;
|
||||
if (!alongX)
|
||||
sideOffset *= -1;
|
||||
RenderSystem.translated(alongX ? sideOffset : 0, 0, alongX ? 0 : sideOffset);
|
||||
ms.translate(alongX ? sideOffset : 0, 0, alongX ? 0 : sideOffset);
|
||||
|
||||
ItemRenderer itemRenderer = Minecraft.getInstance().getItemRenderer();
|
||||
boolean blockItem = itemRenderer.getModelWithOverrides(transported.stack).isGui3d();
|
||||
boolean blockItem = itemRenderer.getItemModelWithOverrides(transported.stack, te.getWorld(), null).isGui3d();
|
||||
if (Minecraft.getInstance().gameSettings.fancyGraphics) {
|
||||
Vec3d shadowPos = new Vec3d(te.getPos()).add(beltStartOffset.scale(1).add(offsetVec)
|
||||
.add(alongX ? sideOffset : 0, .39, alongX ? 0 : sideOffset));
|
||||
IndependentShadowRenderer.renderShadow(shadowPos.x, shadowPos.y, shadowPos.z, .75f,
|
||||
blockItem ? .2f : .2f);
|
||||
IndependentShadowRenderer.renderShadow(ms, buffer, shadowPos, .75f, blockItem ? .2f : .2f);
|
||||
}
|
||||
|
||||
RenderHelper.enableStandardItemLighting();
|
||||
|
||||
int count = (int) (MathHelper.log2((int) (transported.stack.getCount()))) / 2;
|
||||
RenderSystem.rotatef(slopeAngle, slopeAlongX ? 0 : 1, 0, slopeAlongX ? 1 : 0);
|
||||
ms.multiply(new Vector3f(slopeAlongX ? 0 : 1, 0, slopeAlongX ? 1 : 0).getDegreesQuaternion(slopeAngle));
|
||||
if (onSlope)
|
||||
RenderSystem.translated(0, 1 / 8f, 0);
|
||||
ms.translate(0, 1 / 8f, 0);
|
||||
Random r = new Random(transported.angle);
|
||||
|
||||
for (int i = 0; i <= count; i++) {
|
||||
RenderSystem.pushMatrix();
|
||||
ms.push();
|
||||
|
||||
RenderSystem.rotatef(transported.angle, 0, 1, 0);
|
||||
ms.multiply(Vector3f.POSITIVE_Y.getDegreesQuaternion(transported.angle));
|
||||
if (!blockItem) {
|
||||
RenderSystem.translated(0, -.09375, 0);
|
||||
RenderSystem.rotatef(90, 1, 0, 0);
|
||||
ms.translate(0, -.09375, 0);
|
||||
ms.multiply(Vector3f.POSITIVE_X.getDegreesQuaternion(90));
|
||||
}
|
||||
|
||||
if (blockItem) {
|
||||
RenderSystem.translated(r.nextFloat() * .0625f * i, 0, r.nextFloat() * .0625f * i);
|
||||
ms.translate(r.nextFloat() * .0625f * i, 0, r.nextFloat() * .0625f * i);
|
||||
}
|
||||
|
||||
RenderSystem.scaled(.5, .5, .5);
|
||||
itemRenderer.renderItem(transported.stack, TransformType.FIXED);
|
||||
RenderSystem.popMatrix();
|
||||
ms.scale(.5f, .5f, .5f);
|
||||
itemRenderer.renderItem(transported.stack, TransformType.FIXED, light, overlay, ms, buffer);
|
||||
ms.pop();
|
||||
|
||||
if (!blockItem)
|
||||
RenderSystem.rotatef(10, 0, 1, 0);
|
||||
RenderSystem.translated(0, blockItem ? 1 / 64d : 1 / 16d, 0);
|
||||
ms.multiply(Vector3f.POSITIVE_Y.getDegreesQuaternion(10));
|
||||
ms.translate(0, blockItem ? 1 / 64d : 1 / 16d, 0);
|
||||
|
||||
}
|
||||
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
RenderSystem.popMatrix();
|
||||
ms.pop();
|
||||
}
|
||||
|
||||
RenderSystem.disableBlend();
|
||||
RenderSystem.popMatrix();
|
||||
ms.pop();
|
||||
}
|
||||
|
||||
protected BlockState getBeltState(KineticTileEntity te) {
|
||||
|
|
|
@ -10,6 +10,7 @@ import com.simibubi.create.foundation.utility.SuperByteBuffer;
|
|||
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;
|
||||
|
@ -60,14 +61,15 @@ public class BeltTunnelTileEntityRenderer extends SafeTileEntityRenderer<BeltTun
|
|||
int color = ColorHelper.mixColors(0x808080, 0xFFFFFF, lightIntensity);
|
||||
indicatorBuffer.rotateCentered(Axis.Y, (float) ((horizontalAngle + 90) / 180f * Math.PI))
|
||||
.color(color)
|
||||
// TODO 1.15 wtf is this doing?
|
||||
.light(world.getCombinedLight(pos, (int) (12 * lightIntensity))).renderInto(ms, vb);
|
||||
}
|
||||
|
||||
flapBuffer.translate(0, 0, -segment * 3 / 16f);
|
||||
flapBuffer.translate(flapPivotX, flapPivotY, flapPivotZ).rotate(Axis.Z, flapAngle)
|
||||
.translate(-flapPivotX, -flapPivotY, -flapPivotZ);
|
||||
flapBuffer.rotateCentered(Axis.Y, (float) (horizontalAngle / 180f * Math.PI));
|
||||
flapBuffer.light(te.getBlockState().getPackedLightmapCoords(world, pos)).renderInto(ms, vb);
|
||||
flapBuffer.rotateCentered(Direction.UP, (float) (horizontalAngle / 180f * Math.PI));
|
||||
flapBuffer.light(WorldRenderer.getLightmapCoordinates(world, te.getBlockState(), pos)).renderInto(ms, vb);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -11,9 +11,9 @@ import com.simibubi.create.modules.contraptions.base.KineticTileEntityRenderer;
|
|||
import com.simibubi.create.modules.contraptions.relays.gauge.GaugeBlock.Type;
|
||||
|
||||
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.state.properties.BlockStateProperties;
|
||||
import net.minecraft.util.Direction;
|
||||
|
@ -35,7 +35,7 @@ public class GaugeTileEntityRenderer extends KineticTileEntityRenderer {
|
|||
super.renderSafe(te, partialTicks, ms, buffer, light, overlay);
|
||||
BlockState gaugeState = te.getBlockState();
|
||||
GaugeTileEntity gaugeTE = (GaugeTileEntity) te;
|
||||
int lightCoords = gaugeState.getPackedLightmapCoords(te.getWorld(), te.getPos());
|
||||
int lightCoords = WorldRenderer.getLightmapCoordinates(te.getWorld(), gaugeState, te.getPos());
|
||||
|
||||
SuperByteBuffer headBuffer = (type == Type.SPEED ? AllBlockPartials.GAUGE_HEAD_SPEED
|
||||
: AllBlockPartials.GAUGE_HEAD_STRESS).renderOn(gaugeState);
|
||||
|
|
|
@ -27,7 +27,6 @@ import net.minecraft.tileentity.TileEntity;
|
|||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.BlockPos.MutableBlockPos;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.math.RayTraceContext;
|
||||
import net.minecraft.util.math.RayTraceContext.BlockMode;
|
||||
|
@ -92,7 +91,7 @@ public class ChromaticCompoundCubeItem extends Item implements IItemWithColorHan
|
|||
|
||||
@Override
|
||||
public boolean onEntityItemUpdate(ItemStack stack, ItemEntity entity) {
|
||||
double y = entity.posY;
|
||||
double y = entity.getY();
|
||||
double yMotion = entity.getMotion().y;
|
||||
World world = entity.world;
|
||||
CompoundNBT data = entity.getPersistentData();
|
||||
|
@ -124,7 +123,7 @@ public class ChromaticCompoundCubeItem extends Item implements IItemWithColorHan
|
|||
// Convert to Refined Radiance if eaten enough light sources
|
||||
if (itemData.getInt("CollectingLight") >= 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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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<Ingredient> repairMaterial;
|
||||
private final LazyValue<Ingredient> repairMaterial;
|
||||
|
||||
private AllToolTiers(int harvestLevelIn, int maxUsesIn, float efficiencyIn, float attackDamageIn,
|
||||
int enchantabilityIn, Supplier<Ingredient> 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() {
|
||||
|
|
|
@ -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<ItemStack> smeltDrops(Collection<ItemStack> drops, World worldIn, int enchantmentLevel) {
|
||||
helperFurnace.setWorld(worldIn);
|
||||
helperFurnace.setLocation(worldIn, BlockPos.ZERO);
|
||||
RecipeManager recipeManager = worldIn.getRecipeManager();
|
||||
List<ItemStack> smeltedStacks = new ArrayList<>();
|
||||
Iterator<ItemStack> dropper = drops.iterator();
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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;
|
||||
|
@ -27,9 +29,9 @@ import net.minecraft.util.math.MathHelper;
|
|||
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;
|
||||
|
||||
|
|
|
@ -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);
|
||||
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);
|
||||
// RenderSystem.enableTexture();
|
||||
// TessellatorHelper.cleanUpAfterDrawing();
|
||||
// RenderSystem.lineWidth(1);
|
||||
|
||||
ms.pop();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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<SmokingRecipe> 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> 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<FurnaceRecipe> 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> 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);
|
||||
}
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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<BeltObserverTileEntity>, 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);
|
||||
}
|
||||
|
|
|
@ -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<BeltO
|
|||
}
|
||||
|
||||
@Override
|
||||
public void renderWithGL(BeltObserverTileEntity tileEntityIn, double x, double y, double z, float partialTicks,
|
||||
int destroyStage) {
|
||||
int i = tileEntityIn.getWorld().getCombinedLight(tileEntityIn.getPos().up()
|
||||
.offset(tileEntityIn.getBlockState().get(BlockStateProperties.HORIZONTAL_FACING)), 0);
|
||||
int j = i % 65536;
|
||||
int k = i / 65536;
|
||||
GLX.glMultiTexCoord2f(GLX.GL_TEXTURE1, (float) j, (float) k);
|
||||
protected void renderSafe(BeltObserverTileEntity te, float partialTicks, MatrixStack ms, IRenderTypeBuffer buffer,
|
||||
int light, int overlay) {
|
||||
light = WorldRenderer.getLightmapCoordinates(te.getWorld(),
|
||||
te.getPos().up().offset(te.getBlockState().get(BlockStateProperties.HORIZONTAL_FACING)));
|
||||
|
||||
FilteringRenderer.renderOnTileEntity(tileEntityIn, x, y, z, partialTicks, destroyStage);
|
||||
FilteringRenderer.renderOnTileEntity(te, partialTicks, ms, buffer, light, overlay);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@ import net.minecraft.util.math.BlockPos;
|
|||
import net.minecraft.world.IBlockReader;
|
||||
import net.minecraft.world.TickPriority;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.server.ServerWorld;
|
||||
|
||||
public class PulseRepeaterBlock extends RedstoneDiodeBlock {
|
||||
|
||||
|
@ -36,7 +37,7 @@ public class PulseRepeaterBlock extends RedstoneDiodeBlock {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void tick(BlockState state, World worldIn, BlockPos pos, Random random) {
|
||||
public void scheduledTick(BlockState state, ServerWorld worldIn, BlockPos pos, Random random) {
|
||||
boolean powered = state.get(POWERED);
|
||||
boolean pulsing = state.get(PULSING);
|
||||
boolean shouldPower = shouldBePowered(worldIn, pos, state);
|
||||
|
|
|
@ -15,6 +15,7 @@ import net.minecraft.util.math.BlockPos;
|
|||
import net.minecraft.util.math.BlockRayTraceResult;
|
||||
import net.minecraft.world.IBlockReader;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.server.ServerWorld;
|
||||
|
||||
public class ToggleLatchBlock extends RedstoneDiodeBlock {
|
||||
|
||||
|
@ -56,9 +57,9 @@ public class ToggleLatchBlock extends RedstoneDiodeBlock {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void tick(BlockState state, World worldIn, BlockPos pos, Random random) {
|
||||
public void scheduledTick(BlockState state, ServerWorld worldIn, BlockPos pos, Random random) {
|
||||
boolean poweredPreviously = state.get(POWERED);
|
||||
super.tick(state, worldIn, pos, random);
|
||||
super.scheduledTick(state, worldIn, pos, random);
|
||||
BlockState newState = worldIn.getBlockState(pos);
|
||||
if (newState.get(POWERED) && !poweredPreviously)
|
||||
worldIn.setBlockState(pos, newState.cycle(POWERING), 2);
|
||||
|
|
|
@ -9,17 +9,16 @@ import com.simibubi.create.modules.logistics.block.belts.AttachedLogisticalBlock
|
|||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockRenderLayer;
|
||||
import net.minecraft.util.Direction.Axis;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.IBlockReader;
|
||||
|
||||
public class LinkedExtractorBlock extends ExtractorBlock {
|
||||
|
||||
@Override
|
||||
public BlockRenderLayer getRenderLayer() {
|
||||
return BlockRenderLayer.CUTOUT_MIPPED;
|
||||
}
|
||||
// @Override // TODO 1.15 register layer
|
||||
// public BlockRenderLayer getRenderLayer() {
|
||||
// return BlockRenderLayer.CUTOUT_MIPPED;
|
||||
// }
|
||||
|
||||
@Override
|
||||
protected BlockState getVerticalDefaultState() {
|
||||
|
|
|
@ -4,15 +4,14 @@ import com.simibubi.create.AllBlocks;
|
|||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockRenderLayer;
|
||||
import net.minecraft.world.IBlockReader;
|
||||
|
||||
public class LinkedTransposerBlock extends TransposerBlock {
|
||||
|
||||
@Override
|
||||
public BlockRenderLayer getRenderLayer() {
|
||||
return BlockRenderLayer.CUTOUT;
|
||||
}
|
||||
// @Override // TODO 1.15 register layer
|
||||
// public BlockRenderLayer getRenderLayer() {
|
||||
// return BlockRenderLayer.CUTOUT;
|
||||
// }
|
||||
|
||||
@Override
|
||||
protected BlockState getVerticalDefaultState() {
|
||||
|
|
|
@ -138,11 +138,11 @@ public class AttributeFilterScreen extends AbstractFilterScreen<AttributeFilterC
|
|||
ItemStack stack = container.filterInventory.getStackInSlot(1);
|
||||
RenderSystem.pushMatrix();
|
||||
RenderSystem.translatef(0.0F, 0.0F, 32.0F);
|
||||
this.blitOffset = 200;
|
||||
this.setBlitOffset(200);
|
||||
this.itemRenderer.zLevel = 200.0F;
|
||||
this.itemRenderer.renderItemOverlayIntoGUI(font, stack, guiLeft + 59, guiTop + 56,
|
||||
String.valueOf(selectedAttributes.size() - 1));
|
||||
this.blitOffset = 0;
|
||||
this.setBlitOffset(0);
|
||||
this.itemRenderer.zLevel = 0.0F;
|
||||
RenderSystem.popMatrix();
|
||||
|
||||
|
|
|
@ -122,9 +122,9 @@ public class FilterItem extends Item implements INamedContainerProvider {
|
|||
NetworkHooks.openGui((ServerPlayerEntity) player, this, buf -> {
|
||||
buf.writeItemStack(heldItem);
|
||||
});
|
||||
return ActionResult.newResult(ActionResultType.SUCCESS, heldItem);
|
||||
return ActionResult.success(heldItem);
|
||||
}
|
||||
return ActionResult.newResult(ActionResultType.PASS, heldItem);
|
||||
return ActionResult.pass(heldItem);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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<ItemStack> items) {
|
||||
}
|
||||
|
|
|
@ -34,11 +34,6 @@ public class SchematicTableBlock extends HorizontalBlock {
|
|||
super.fillStateContainer(builder);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSolid(BlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PushReaction getPushReaction(BlockState state) {
|
||||
return PushReaction.BLOCK;
|
||||
|
|
|
@ -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<SchematicTableContainer>
|
||||
implements IHasContainer<SchematicTableContainer> {
|
||||
|
@ -135,8 +139,9 @@ public class SchematicTableScreen extends AbstractSimiContainerScreen<SchematicT
|
|||
RenderSystem.scaled(50, -50, 50);
|
||||
|
||||
Minecraft.getInstance().getTextureManager().bindTexture(AtlasTexture.LOCATION_BLOCKS_TEXTURE);
|
||||
minecraft.getBlockRendererDispatcher().renderBlockBrightness(AllBlocks.SCHEMATIC_TABLE.get().getDefaultState(),
|
||||
1);
|
||||
minecraft.getBlockRendererDispatcher().renderBlock(AllBlocks.SCHEMATIC_TABLE.get().getDefaultState(),
|
||||
new MatrixStack(), getMinecraft().getBufferBuilders().getEntityVertexConsumers(), 0xF000F0,
|
||||
OverlayTexture.DEFAULT_UV, EmptyModelData.INSTANCE);
|
||||
|
||||
RenderSystem.disableAlphaTest();
|
||||
RenderSystem.disableRescaleNormal();
|
||||
|
|
|
@ -38,11 +38,6 @@ public class SchematicannonBlock extends Block {
|
|||
return new SchematicannonTileEntity();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSolid(BlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PushReaction getPushReaction(BlockState state) {
|
||||
return PushReaction.BLOCK;
|
||||
|
|
|
@ -3,25 +3,25 @@ package com.simibubi.create.modules.schematics.block;
|
|||
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.foundation.block.SafeTileEntityRenderer;
|
||||
import com.simibubi.create.foundation.utility.SuperByteBuffer;
|
||||
import com.simibubi.create.foundation.utility.TessellatorHelper;
|
||||
|
||||
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.Tessellator;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.client.renderer.Vector3f;
|
||||
import net.minecraft.client.renderer.WorldRenderer;
|
||||
import net.minecraft.client.renderer.texture.AtlasTexture;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
|
||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||
import net.minecraft.particles.ParticleTypes;
|
||||
import net.minecraft.util.Direction.Axis;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraftforge.client.model.data.EmptyModelData;
|
||||
|
||||
public class SchematicannonRenderer extends SafeTileEntityRenderer<SchematicannonTileEntity> {
|
||||
|
||||
|
@ -78,29 +78,28 @@ public class SchematicannonRenderer extends SafeTileEntityRenderer<Schematicanno
|
|||
Vec3d cannonOffset = distance.add(0, throwHeight, 0).normalize().scale(2);
|
||||
start = start.add(cannonOffset);
|
||||
|
||||
double progress = ((double) block.totalTicks - (block.ticksRemaining + 1 - partialTicks))
|
||||
float progress = ((float) block.totalTicks - (block.ticksRemaining + 1 - partialTicks))
|
||||
/ block.totalTicks;
|
||||
Vec3d blockLocationXZ = new Vec3d(x + .5, y + .5, z + .5)
|
||||
Vec3d blockLocationXZ = new Vec3d(.5, .5, .5)
|
||||
.add(target.subtract(start).scale(progress).mul(1, 0, 1));
|
||||
|
||||
// Height is determined through a bezier curve
|
||||
double t = progress;
|
||||
float t = progress;
|
||||
double yOffset = 2 * (1 - t) * t * throwHeight + t * t * targetY;
|
||||
Vec3d blockLocation = blockLocationXZ.add(0, yOffset + 1, 0).add(cannonOffset);
|
||||
|
||||
// TODO 1.15 remove RenderSystem use
|
||||
// Offset to position
|
||||
RenderSystem.pushMatrix();
|
||||
RenderSystem.translated(blockLocation.x, blockLocation.y, blockLocation.z);
|
||||
ms.push();
|
||||
ms.translate(blockLocation.x, blockLocation.y, blockLocation.z);
|
||||
|
||||
// Rotation and Scaling effects
|
||||
double scale = .3f;
|
||||
RenderSystem.rotatef(360 * t * 2, 1, 1, 0);
|
||||
RenderSystem.scaled(scale, scale, scale);
|
||||
float scale = .3f;
|
||||
ms.multiply(new Vector3f(1, 1, 0).getDegreesQuaternion(360 * t * 2));
|
||||
ms.scale(scale, scale, scale);
|
||||
|
||||
// Render the Block
|
||||
Minecraft.getInstance().getBlockRendererDispatcher().renderBlockBrightness(block.state, 1);
|
||||
RenderSystem.popMatrix();
|
||||
Minecraft.getInstance().getBlockRendererDispatcher().renderBlock(block.state, ms, buffer, light, overlay, EmptyModelData.INSTANCE);
|
||||
ms.pop();
|
||||
|
||||
// Apply Recoil if block was just launched
|
||||
if ((block.ticksRemaining + 1 - partialTicks) > block.totalTicks - 10) {
|
||||
|
@ -126,29 +125,27 @@ public class SchematicannonRenderer extends SafeTileEntityRenderer<Schematicanno
|
|||
}
|
||||
}
|
||||
|
||||
TessellatorHelper.prepareFastRender();
|
||||
TessellatorHelper.begin(DefaultVertexFormats.BLOCK);
|
||||
RenderSystem.pushMatrix();
|
||||
BufferBuilder buffer = Tessellator.getInstance().getBuffer();
|
||||
ms.push();
|
||||
BlockState state = tileEntityIn.getBlockState();
|
||||
int lightCoords = state.getPackedLightmapCoords(getWorld(), pos);
|
||||
int lightCoords = WorldRenderer.getLightmapCoordinates(tileEntityIn.getWorld(), pos);
|
||||
|
||||
IVertexBuilder vb = buffer.getBuffer(RenderType.getSolid());
|
||||
|
||||
SuperByteBuffer connector = AllBlockPartials.SCHEMATICANNON_CONNECTOR.renderOn(state);
|
||||
connector.translate(-.5f, 0, -.5f);
|
||||
connector.rotate(Axis.Y, (float) ((yaw + 90) / 180 * Math.PI));
|
||||
connector.rotate(Direction.UP, (float) ((yaw + 90) / 180 * Math.PI));
|
||||
connector.translate(.5f, 0, .5f);
|
||||
connector.translate(x, y, z).light(lightCoords).renderInto(buffer);
|
||||
connector.light(lightCoords).renderInto(ms, vb);
|
||||
|
||||
SuperByteBuffer pipe = AllBlockPartials.SCHEMATICANNON_PIPE.renderOn(state);
|
||||
pipe.translate(0, -recoil / 100, 0);
|
||||
pipe.translate(-.5f, -15 / 16f, -.5f);
|
||||
pipe.rotate(Axis.Z, (float) (pitch / 180 * Math.PI));
|
||||
pipe.rotate(Axis.Y, (float) ((yaw + 90) / 180 * Math.PI));
|
||||
pipe.rotate(Direction.SOUTH, (float) (pitch / 180 * Math.PI));
|
||||
pipe.rotate(Direction.UP, (float) ((yaw + 90) / 180 * Math.PI));
|
||||
pipe.translate(.5f, 15 / 16f, .5f);
|
||||
pipe.translate(x, y, z).light(lightCoords).renderInto(buffer);
|
||||
pipe.light(lightCoords).renderInto(ms, vb);
|
||||
|
||||
TessellatorHelper.draw();
|
||||
RenderSystem.popMatrix();
|
||||
ms.pop();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -25,6 +25,8 @@ import com.simibubi.create.foundation.utility.TessellatorHelper;
|
|||
import net.minecraft.block.Blocks;
|
||||
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.Tessellator;
|
||||
import net.minecraft.client.renderer.WorldRenderer;
|
||||
import net.minecraft.item.BlockItemUseContext;
|
||||
|
@ -162,10 +164,12 @@ public class SchematicAndQuillHandler {
|
|||
Lang.sendStatus(Minecraft.getInstance().player, "schematicAndQuill.saved", filepath);
|
||||
}
|
||||
|
||||
public void render(MatrixStack ms, IVertexBuilder buffer) {
|
||||
public void render(MatrixStack ms, IRenderTypeBuffer buffer) {
|
||||
if (!isActive())
|
||||
return;
|
||||
|
||||
IVertexBuilder vb = buffer.getBuffer(RenderType.getLines());
|
||||
|
||||
TessellatorHelper.prepareForDrawing();
|
||||
RenderSystem.lineWidth(2);
|
||||
RenderSystem.color4f(1, 1, 1, 1);
|
||||
|
@ -177,28 +181,28 @@ public class SchematicAndQuillHandler {
|
|||
MutableBoundingBox bb = new MutableBoundingBox(firstPos, firstPos.add(1, 1, 1));
|
||||
BlockPos min = new BlockPos(bb.minX, bb.minY, bb.minZ);
|
||||
BlockPos max = new BlockPos(bb.maxX, bb.maxY, bb.maxZ);
|
||||
drawBox(ms, buffer, min, max, true);
|
||||
drawBox(ms, vb, min, max, true);
|
||||
}
|
||||
|
||||
if (firstPos != null && selectedPos != null) {
|
||||
MutableBoundingBox bb = new MutableBoundingBox(firstPos, selectedPos);
|
||||
BlockPos min = new BlockPos(bb.minX, bb.minY, bb.minZ);
|
||||
BlockPos max = new BlockPos(bb.maxX + 1, bb.maxY + 1, bb.maxZ + 1);
|
||||
drawBox(ms, buffer, min, max, true);
|
||||
drawBox(ms, vb, min, max, true);
|
||||
}
|
||||
|
||||
if (firstPos == null && selectedPos != null) {
|
||||
MutableBoundingBox bb = new MutableBoundingBox(selectedPos, selectedPos.add(1, 1, 1));
|
||||
BlockPos min = new BlockPos(bb.minX, bb.minY, bb.minZ);
|
||||
BlockPos max = new BlockPos(bb.maxX, bb.maxY, bb.maxZ);
|
||||
drawBox(ms, buffer, min, max, true);
|
||||
drawBox(ms, vb, min, max, true);
|
||||
}
|
||||
} else {
|
||||
// 2nd Step
|
||||
MutableBoundingBox bb = new MutableBoundingBox(firstPos, secondPos);
|
||||
BlockPos min = new BlockPos(bb.minX, bb.minY, bb.minZ);
|
||||
BlockPos max = new BlockPos(bb.maxX + 1, bb.maxY + 1, bb.maxZ + 1);
|
||||
drawBox(ms, buffer, min, max, false);
|
||||
drawBox(ms, vb, min, max, false);
|
||||
|
||||
if (selectedFace != null) {
|
||||
Vec3d vec = new Vec3d(selectedFace.getDirectionVec());
|
||||
|
@ -210,6 +214,7 @@ public class SchematicAndQuillHandler {
|
|||
Vec3d faceMin = center.add(vec.mul(radii).add(onFaceOffset));
|
||||
Vec3d faceMax = center.add(vec.mul(radii).subtract(onFaceOffset));
|
||||
|
||||
// TODO 1.15 buffered render
|
||||
RenderSystem.enableTexture();
|
||||
TessellatorHelper.begin();
|
||||
AllSpecialTextures.SELECTION.bind();
|
||||
|
|
|
@ -5,6 +5,7 @@ import java.util.HashMap;
|
|||
import java.util.List;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.simibubi.create.AllItems;
|
||||
import com.simibubi.create.AllKeys;
|
||||
import com.simibubi.create.AllPackets;
|
||||
|
@ -21,6 +22,7 @@ import com.simibubi.create.modules.schematics.packet.SchematicPlacePacket;
|
|||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.entity.player.ClientPlayerEntity;
|
||||
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.entity.player.PlayerInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
@ -108,7 +110,8 @@ public class SchematicHandler {
|
|||
currentTool.getTool().updateSelection();
|
||||
}
|
||||
|
||||
public void render() {
|
||||
public void render(MatrixStack ms, IRenderTypeBuffer buffer) {
|
||||
// TODO 1.15 buffered render
|
||||
if (!active)
|
||||
return;
|
||||
if (Minecraft.getInstance().player.isSneaking())
|
||||
|
|
|
@ -12,7 +12,6 @@ import org.lwjgl.system.MemoryUtil;
|
|||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.mojang.datafixers.util.Pair;
|
||||
import com.simibubi.create.foundation.type.Cuboid;
|
||||
import com.simibubi.create.modules.schematics.SchematicWorld;
|
||||
|
@ -24,6 +23,7 @@ import net.minecraft.client.Minecraft;
|
|||
import net.minecraft.client.renderer.ActiveRenderInfo;
|
||||
import net.minecraft.client.renderer.BlockRendererDispatcher;
|
||||
import net.minecraft.client.renderer.BufferBuilder;
|
||||
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||
import net.minecraft.client.renderer.RegionRenderCacheBuilder;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.client.renderer.RenderTypeLookup;
|
||||
|
@ -140,7 +140,8 @@ public class SchematicHologram {
|
|||
}
|
||||
}
|
||||
|
||||
public void render() {
|
||||
public void render(MatrixStack ms, IRenderTypeBuffer buffer) {
|
||||
// TODO 1.15 buffered render
|
||||
if (active) {
|
||||
final Entity entity = Minecraft.getInstance().getRenderViewEntity();
|
||||
|
||||
|
|
Loading…
Reference in a new issue