mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-12-15 04:03:42 +01:00
Misc porting, mostly rendering. Mass rename RenderSystem/ILightReader
Under 500 errors!
This commit is contained in:
parent
501caa52b0
commit
85d0d5244a
101 changed files with 952 additions and 938 deletions
|
@ -2,7 +2,7 @@ package com.simibubi.create.compat.jei;
|
|||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
|
||||
import mezz.jei.api.gui.drawable.IDrawable;
|
||||
import net.minecraft.client.Minecraft;
|
||||
|
@ -39,23 +39,23 @@ public class DoubleItemIcon implements IDrawable {
|
|||
}
|
||||
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
GlStateManager.color4f(1, 1, 1, 1);
|
||||
GlStateManager.enableDepthTest();
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.translated(xOffset, yOffset, 0);
|
||||
RenderSystem.color4f(1, 1, 1, 1);
|
||||
RenderSystem.enableDepthTest();
|
||||
RenderSystem.pushMatrix();
|
||||
RenderSystem.translated(xOffset, yOffset, 0);
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.translated(1, 1, 0);
|
||||
RenderSystem.pushMatrix();
|
||||
RenderSystem.translated(1, 1, 0);
|
||||
Minecraft.getInstance().getItemRenderer().renderItemIntoGUI(primaryStack, 0, 0);
|
||||
GlStateManager.popMatrix();
|
||||
RenderSystem.popMatrix();
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.translated(10, 10, 100);
|
||||
GlStateManager.scaled(.5, .5, .5);
|
||||
RenderSystem.pushMatrix();
|
||||
RenderSystem.translated(10, 10, 100);
|
||||
RenderSystem.scaled(.5, .5, .5);
|
||||
Minecraft.getInstance().getItemRenderer().renderItemIntoGUI(secondaryStack, 0, 0);
|
||||
GlStateManager.popMatrix();
|
||||
RenderSystem.popMatrix();
|
||||
|
||||
GlStateManager.popMatrix();
|
||||
RenderSystem.popMatrix();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package com.simibubi.create.compat.jei.category;
|
||||
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.simibubi.create.AllItems;
|
||||
import com.simibubi.create.Create;
|
||||
import com.simibubi.create.compat.jei.DoubleItemIcon;
|
||||
|
@ -49,29 +49,29 @@ public class BlastingViaFanCategory extends ProcessingViaFanCategory<AbstractCoo
|
|||
@Override
|
||||
public void renderAttachedBlock() {
|
||||
BlockState state = Blocks.LAVA.getDefaultState().with(FlowingFluidBlock.LEVEL, 8);
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.translated(0, 0, 200);
|
||||
GlStateManager.enableRescaleNormal();
|
||||
RenderSystem.pushMatrix();
|
||||
RenderSystem.translated(0, 0, 200);
|
||||
RenderSystem.enableRescaleNormal();
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.translated(0, 200, 0);
|
||||
GlStateManager.rotated(90, 1, 0, 0);
|
||||
RenderSystem.pushMatrix();
|
||||
RenderSystem.translated(0, 200, 0);
|
||||
RenderSystem.rotated(90, 1, 0, 0);
|
||||
ScreenElementRenderer.renderBlock(() -> state);
|
||||
GlStateManager.popMatrix();
|
||||
RenderSystem.popMatrix();
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.translated(0, 200, 0);
|
||||
GlStateManager.rotated(90, 1, 0, 0);
|
||||
GlStateManager.rotated(270, 0, 0, 1);
|
||||
RenderSystem.pushMatrix();
|
||||
RenderSystem.translated(0, 200, 0);
|
||||
RenderSystem.rotated(90, 1, 0, 0);
|
||||
RenderSystem.rotated(270, 0, 0, 1);
|
||||
ScreenElementRenderer.renderBlock(() -> state);
|
||||
GlStateManager.popMatrix();
|
||||
RenderSystem.popMatrix();
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.translated(-103, -100, 0);
|
||||
RenderSystem.pushMatrix();
|
||||
RenderSystem.translated(-103, -100, 0);
|
||||
ScreenElementRenderer.renderBlock(() -> state);
|
||||
GlStateManager.popMatrix();
|
||||
RenderSystem.popMatrix();
|
||||
|
||||
GlStateManager.popMatrix();
|
||||
RenderSystem.popMatrix();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ import java.util.Arrays;
|
|||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.simibubi.create.AllItems;
|
||||
import com.simibubi.create.Create;
|
||||
import com.simibubi.create.compat.jei.DoubleItemIcon;
|
||||
|
@ -116,13 +116,13 @@ public class BlockzapperUpgradeCategory implements IRecipeCategory<BlockzapperUp
|
|||
font.drawStringWithShadow(text,
|
||||
(BLOCKZAPPER_UPGRADE_RECIPE.width - font.getStringWidth(text)) / 2, 57, 0x8B8B8B);
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.translated(126, 0, 0);
|
||||
GlStateManager.scaled(3.5, 3.5, 3.5);
|
||||
GlStateManager.translated(-10, 0, 0);
|
||||
GlStateManager.color3f(1, 1, 1);
|
||||
GlStateManager.enableDepthTest();
|
||||
RenderSystem.pushMatrix();
|
||||
RenderSystem.translated(126, 0, 0);
|
||||
RenderSystem.scaled(3.5, 3.5, 3.5);
|
||||
RenderSystem.translated(-10, 0, 0);
|
||||
RenderSystem.color3f(1, 1, 1);
|
||||
RenderSystem.enableDepthTest();
|
||||
ScreenElementRenderer.render3DItem(() -> recipe.getRecipeOutput());
|
||||
GlStateManager.popMatrix();
|
||||
RenderSystem.popMatrix();
|
||||
}
|
||||
}
|
|
@ -3,7 +3,7 @@ package com.simibubi.create.compat.jei.category;
|
|||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.simibubi.create.AllItems;
|
||||
import com.simibubi.create.Create;
|
||||
import com.simibubi.create.ScreenResources;
|
||||
|
@ -96,14 +96,14 @@ public class PolishingCategory implements IRecipeCategory<SandPaperPolishingReci
|
|||
if (matchingStacks.length == 0)
|
||||
return;
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
RenderSystem.pushMatrix();
|
||||
CompoundNBT tag = renderedSandpaper.getOrCreateTag();
|
||||
tag.put("Polishing", matchingStacks[0].serializeNBT());
|
||||
tag.putBoolean("JEI", true);
|
||||
ItemRenderer itemRenderer = Minecraft.getInstance().getItemRenderer();
|
||||
GlStateManager.scaled(2, 2, 2);
|
||||
RenderSystem.scaled(2, 2, 2);
|
||||
itemRenderer.renderItemIntoGUI(renderedSandpaper, getBackground().getWidth() / 4 - 8, 1);
|
||||
GlStateManager.popMatrix();
|
||||
RenderSystem.popMatrix();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@ package com.simibubi.create.compat.jei.category;
|
|||
|
||||
import java.util.Arrays;
|
||||
|
||||
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.ScreenResources;
|
||||
|
@ -59,35 +59,35 @@ public abstract class ProcessingViaFanCategory<T extends IRecipe<?>> implements
|
|||
public void draw(T recipe, double mouseX, double mouseY) {
|
||||
renderWidgets(recipe, mouseX, mouseY);
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.color3f(1, 1, 1);
|
||||
GlStateManager.enableDepthTest();
|
||||
RenderSystem.pushMatrix();
|
||||
RenderSystem.color3f(1, 1, 1);
|
||||
RenderSystem.enableDepthTest();
|
||||
|
||||
GlStateManager.translated(28, 18, 0);
|
||||
GlStateManager.rotated(10.5, -1f, 0, 0);
|
||||
GlStateManager.rotated(15.5, 0, 1, 0);
|
||||
GlStateManager.scaled(.6f, .6f, .6f);
|
||||
RenderSystem.translated(28, 18, 0);
|
||||
RenderSystem.rotated(10.5, -1f, 0, 0);
|
||||
RenderSystem.rotated(15.5, 0, 1, 0);
|
||||
RenderSystem.scaled(.6f, .6f, .6f);
|
||||
ScreenElementRenderer.renderBlock(this::renderFanCasing);
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
RenderSystem.pushMatrix();
|
||||
float angle = AnimatedKinetics.getCurrentAngle() * 12;
|
||||
float t = 25;
|
||||
GlStateManager.translatef(t, -t, t);
|
||||
GlStateManager.rotated(angle, 0, 0, 1);
|
||||
GlStateManager.translatef(-t, t, -t);
|
||||
RenderSystem.translatef(t, -t, t);
|
||||
RenderSystem.rotated(angle, 0, 0, 1);
|
||||
RenderSystem.translatef(-t, t, -t);
|
||||
|
||||
GlStateManager.translatef(t, 0, 175);
|
||||
GlStateManager.rotated(90, 0, 1, 0);
|
||||
GlStateManager.translatef(-t, 0, -175);
|
||||
RenderSystem.translatef(t, 0, 175);
|
||||
RenderSystem.rotated(90, 0, 1, 0);
|
||||
RenderSystem.translatef(-t, 0, -175);
|
||||
|
||||
ScreenElementRenderer.renderModel(this::renderFanInner);
|
||||
GlStateManager.popMatrix();
|
||||
RenderSystem.popMatrix();
|
||||
|
||||
GlStateManager.translated(-10, 0, 95);
|
||||
GlStateManager.rotated(7, 0, 1, 0);
|
||||
RenderSystem.translated(-10, 0, 95);
|
||||
RenderSystem.rotated(7, 0, 1, 0);
|
||||
renderAttachedBlock();
|
||||
|
||||
GlStateManager.popMatrix();
|
||||
RenderSystem.popMatrix();
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ package com.simibubi.create.compat.jei.category;
|
|||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.simibubi.create.AllItems;
|
||||
import com.simibubi.create.Create;
|
||||
import com.simibubi.create.ScreenResources;
|
||||
|
@ -111,28 +111,28 @@ public class SplashingCategory extends ProcessingViaFanCategory<SplashingRecipe>
|
|||
@Override
|
||||
public void renderAttachedBlock() {
|
||||
BlockState state = Blocks.WATER.getDefaultState().with(FlowingFluidBlock.LEVEL, 8);
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.translated(0, 0, 200);
|
||||
RenderSystem.pushMatrix();
|
||||
RenderSystem.translated(0, 0, 200);
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.translated(0, 200, 0);
|
||||
GlStateManager.rotated(90, 1, 0, 0);
|
||||
RenderSystem.pushMatrix();
|
||||
RenderSystem.translated(0, 200, 0);
|
||||
RenderSystem.rotated(90, 1, 0, 0);
|
||||
ScreenElementRenderer.renderBlock(() -> state);
|
||||
GlStateManager.popMatrix();
|
||||
RenderSystem.popMatrix();
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.translated(0, 200, 0);
|
||||
GlStateManager.rotated(90, 1, 0, 0);
|
||||
GlStateManager.rotated(270, 0, 0, 1);
|
||||
RenderSystem.pushMatrix();
|
||||
RenderSystem.translated(0, 200, 0);
|
||||
RenderSystem.rotated(90, 1, 0, 0);
|
||||
RenderSystem.rotated(270, 0, 0, 1);
|
||||
ScreenElementRenderer.renderBlock(() -> state);
|
||||
GlStateManager.popMatrix();
|
||||
RenderSystem.popMatrix();
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.translated(-103, -100, 0);
|
||||
RenderSystem.pushMatrix();
|
||||
RenderSystem.translated(-103, -100, 0);
|
||||
ScreenElementRenderer.renderBlock(() -> state);
|
||||
GlStateManager.popMatrix();
|
||||
RenderSystem.popMatrix();
|
||||
|
||||
GlStateManager.popMatrix();
|
||||
RenderSystem.popMatrix();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
@ -30,43 +30,43 @@ public class AnimatedCrafter extends AnimatedKinetics {
|
|||
|
||||
@Override
|
||||
public void draw(int xOffset, int yOffset) {
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.enableDepthTest();
|
||||
GlStateManager.rotatef(-15.5f, 1, 0, 0);
|
||||
GlStateManager.rotatef(-22.5f, 0, 1, 0);
|
||||
GlStateManager.translatef(xOffset, yOffset, 0);
|
||||
GlStateManager.translatef(-45, -5, 0);
|
||||
GlStateManager.scaled(.45f, .45f, .45f);
|
||||
RenderSystem.pushMatrix();
|
||||
RenderSystem.enableDepthTest();
|
||||
RenderSystem.rotatef(-15.5f, 1, 0, 0);
|
||||
RenderSystem.rotatef(-22.5f, 0, 1, 0);
|
||||
RenderSystem.translatef(xOffset, yOffset, 0);
|
||||
RenderSystem.translatef(-45, -5, 0);
|
||||
RenderSystem.scaled(.45f, .45f, .45f);
|
||||
|
||||
ScreenElementRenderer.renderModel(() -> cogwheel(true));
|
||||
ScreenElementRenderer.renderBlock(this::body);
|
||||
GlStateManager.translatef(0, 50, 0);
|
||||
RenderSystem.translatef(0, 50, 0);
|
||||
ScreenElementRenderer.renderModel(() -> cogwheel(false));
|
||||
ScreenElementRenderer.renderBlock(this::body);
|
||||
|
||||
if (four) {
|
||||
GlStateManager.translatef(50, -50, 0);
|
||||
RenderSystem.translatef(50, -50, 0);
|
||||
ScreenElementRenderer.renderModel(() -> cogwheel(false));
|
||||
ScreenElementRenderer.renderBlock(this::body);
|
||||
GlStateManager.translatef(0, 50, 0);
|
||||
RenderSystem.translatef(0, 50, 0);
|
||||
ScreenElementRenderer.renderModel(() -> cogwheel(true));
|
||||
ScreenElementRenderer.renderBlock(this::body);
|
||||
|
||||
} else {
|
||||
GlStateManager.translatef(0, 50, 0);
|
||||
RenderSystem.translatef(0, 50, 0);
|
||||
ScreenElementRenderer.renderModel(() -> cogwheel(true));
|
||||
ScreenElementRenderer.renderBlock(this::body);
|
||||
}
|
||||
|
||||
GlStateManager.popMatrix();
|
||||
RenderSystem.popMatrix();
|
||||
}
|
||||
|
||||
private IBakedModel cogwheel(boolean forward) {
|
||||
float t = 25;
|
||||
GlStateManager.translatef(t, -t, -t);
|
||||
GlStateManager.rotated(getCurrentAngle() * 2 * (forward ? 1 : -1), 0, 0, 1);
|
||||
GlStateManager.rotated(90, 1, 0, 0);
|
||||
GlStateManager.translatef(-t, t, t);
|
||||
RenderSystem.translatef(t, -t, -t);
|
||||
RenderSystem.rotated(getCurrentAngle() * 2 * (forward ? 1 : -1), 0, 0, 1);
|
||||
RenderSystem.rotated(90, 1, 0, 0);
|
||||
RenderSystem.translatef(-t, t, t);
|
||||
return AllBlockPartials.SHAFTLESS_COGWHEEL.get();
|
||||
}
|
||||
|
||||
|
|
|
@ -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.AllBlocks;
|
||||
import com.simibubi.create.foundation.gui.ScreenElementRenderer;
|
||||
|
||||
|
@ -22,35 +22,35 @@ public class AnimatedCrushingWheels extends AnimatedKinetics {
|
|||
|
||||
@Override
|
||||
public void draw(int xOffset, int yOffset) {
|
||||
GlStateManager.enableDepthTest();
|
||||
GlStateManager.translatef(xOffset, yOffset, 0);
|
||||
GlStateManager.translatef(-45, 10, 0);
|
||||
GlStateManager.rotatef(22.5f, 0, 1, 0);
|
||||
GlStateManager.scaled(.45f, .45f, .45f);
|
||||
RenderSystem.enableDepthTest();
|
||||
RenderSystem.translatef(xOffset, yOffset, 0);
|
||||
RenderSystem.translatef(-45, 10, 0);
|
||||
RenderSystem.rotatef(22.5f, 0, 1, 0);
|
||||
RenderSystem.scaled(.45f, .45f, .45f);
|
||||
ScreenElementRenderer.renderBlock(this::leftWheel);
|
||||
ScreenElementRenderer.renderBlock(this::rightWheel);
|
||||
}
|
||||
|
||||
private BlockState leftWheel() {
|
||||
float angle = getCurrentAngle();
|
||||
GlStateManager.translatef(-50, 0, 0);
|
||||
RenderSystem.translatef(-50, 0, 0);
|
||||
|
||||
float t = 25;
|
||||
GlStateManager.translatef(t, -t, t);
|
||||
GlStateManager.rotated(angle, 0, 0, 1);
|
||||
GlStateManager.translatef(-t, t, -t);
|
||||
RenderSystem.translatef(t, -t, t);
|
||||
RenderSystem.rotated(angle, 0, 0, 1);
|
||||
RenderSystem.translatef(-t, t, -t);
|
||||
|
||||
return AllBlocks.CRUSHING_WHEEL.get().getDefaultState().with(BlockStateProperties.AXIS, Axis.X);
|
||||
}
|
||||
|
||||
private BlockState rightWheel() {
|
||||
float angle = -getCurrentAngle();
|
||||
GlStateManager.translatef(50, 0, 0);
|
||||
RenderSystem.translatef(50, 0, 0);
|
||||
|
||||
float t = 25;
|
||||
GlStateManager.translatef(t, -t, t);
|
||||
GlStateManager.rotated(angle, 0, 0, 1);
|
||||
GlStateManager.translatef(-t, t, -t);
|
||||
RenderSystem.translatef(t, -t, t);
|
||||
RenderSystem.rotated(angle, 0, 0, 1);
|
||||
RenderSystem.translatef(-t, t, -t);
|
||||
|
||||
return AllBlocks.CRUSHING_WHEEL.get().getDefaultState().with(BlockStateProperties.AXIS, Axis.X);
|
||||
}
|
||||
|
|
|
@ -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,42 +22,42 @@ public class AnimatedMixer 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.pushMatrix();
|
||||
RenderSystem.pushMatrix();
|
||||
ScreenElementRenderer.renderModel(this::pole);
|
||||
GlStateManager.popMatrix();
|
||||
RenderSystem.popMatrix();
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
RenderSystem.pushMatrix();
|
||||
ScreenElementRenderer.renderModel(this::head);
|
||||
GlStateManager.popMatrix();
|
||||
RenderSystem.popMatrix();
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
RenderSystem.pushMatrix();
|
||||
ScreenElementRenderer.renderBlock(this::basin);
|
||||
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.rotated(getCurrentAngle() * 2, 0, 1, 0);
|
||||
RenderSystem.translatef(-t, t, t);
|
||||
return AllBlockPartials.SHAFTLESS_COGWHEEL.get();
|
||||
}
|
||||
|
||||
|
@ -66,21 +66,21 @@ public class AnimatedMixer extends AnimatedKinetics {
|
|||
}
|
||||
|
||||
private IBakedModel pole() {
|
||||
GlStateManager.translatef(0, 51, 0);
|
||||
RenderSystem.translatef(0, 51, 0);
|
||||
return AllBlockPartials.MECHANICAL_MIXER_POLE.get();
|
||||
}
|
||||
|
||||
private IBakedModel head() {
|
||||
float t = 25;
|
||||
GlStateManager.translatef(0, 51, 0);
|
||||
GlStateManager.translatef(t, -t, -t);
|
||||
GlStateManager.rotated(getCurrentAngle() * 4, 0, 1, 0);
|
||||
GlStateManager.translatef(-t, t, t);
|
||||
RenderSystem.translatef(0, 51, 0);
|
||||
RenderSystem.translatef(t, -t, -t);
|
||||
RenderSystem.rotated(getCurrentAngle() * 4, 0, 1, 0);
|
||||
RenderSystem.translatef(-t, t, t);
|
||||
return AllBlockPartials.MECHANICAL_MIXER_HEAD.get();
|
||||
}
|
||||
|
||||
private BlockState basin() {
|
||||
GlStateManager.translatef(0, 85, 0);
|
||||
RenderSystem.translatef(0, 85, 0);
|
||||
return AllBlocks.BASIN.get().getDefaultState();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@ package com.simibubi.create.compat.jei.category.animations;
|
|||
|
||||
import static com.simibubi.create.foundation.utility.AnimationTickHolder.ticks;
|
||||
|
||||
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;
|
||||
|
@ -34,40 +34,40 @@ public class AnimatedPress 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.renderBlock(this::shaft);
|
||||
GlStateManager.popMatrix();
|
||||
RenderSystem.popMatrix();
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
RenderSystem.pushMatrix();
|
||||
ScreenElementRenderer.renderBlock(this::body);
|
||||
GlStateManager.popMatrix();
|
||||
RenderSystem.popMatrix();
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
RenderSystem.pushMatrix();
|
||||
ScreenElementRenderer.renderModel(this::head);
|
||||
GlStateManager.popMatrix();
|
||||
RenderSystem.popMatrix();
|
||||
|
||||
if (basin) {
|
||||
GlStateManager.pushMatrix();
|
||||
RenderSystem.pushMatrix();
|
||||
ScreenElementRenderer.renderBlock(this::basin);
|
||||
GlStateManager.popMatrix();
|
||||
RenderSystem.popMatrix();
|
||||
}
|
||||
|
||||
GlStateManager.popMatrix();
|
||||
RenderSystem.popMatrix();
|
||||
}
|
||||
|
||||
private BlockState shaft() {
|
||||
float t = 25;
|
||||
GlStateManager.translatef(t, -t, -t);
|
||||
GlStateManager.rotated(getCurrentAngle() * 2, 1, 0, 0);
|
||||
GlStateManager.translatef(-t, t, t);
|
||||
RenderSystem.translatef(t, -t, -t);
|
||||
RenderSystem.rotated(getCurrentAngle() * 2, 1, 0, 0);
|
||||
RenderSystem.translatef(-t, t, t);
|
||||
return AllBlocks.SHAFT.get().getDefaultState().with(BlockStateProperties.AXIS, Axis.Z);
|
||||
}
|
||||
|
||||
|
@ -89,12 +89,12 @@ public class AnimatedPress extends AnimatedKinetics {
|
|||
} else {
|
||||
verticalOffset = 0;
|
||||
}
|
||||
GlStateManager.translated(0, -verticalOffset * 50, 0);
|
||||
RenderSystem.translated(0, -verticalOffset * 50, 0);
|
||||
return AllBlockPartials.MECHANICAL_PRESS_HEAD.get();
|
||||
}
|
||||
|
||||
private BlockState basin() {
|
||||
GlStateManager.translatef(0, 85, 0);
|
||||
RenderSystem.translatef(0, 85, 0);
|
||||
return AllBlocks.BASIN.get().getDefaultState();
|
||||
}
|
||||
|
||||
|
|
|
@ -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.AllBlocks;
|
||||
import com.simibubi.create.foundation.gui.ScreenElementRenderer;
|
||||
import com.simibubi.create.modules.contraptions.components.saw.SawBlock;
|
||||
|
@ -24,30 +24,30 @@ public class AnimatedSaw 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(.6f, .6f, .6f);
|
||||
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(.6f, .6f, .6f);
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
RenderSystem.pushMatrix();
|
||||
ScreenElementRenderer.renderBlock(this::shaft);
|
||||
GlStateManager.popMatrix();
|
||||
RenderSystem.popMatrix();
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
RenderSystem.pushMatrix();
|
||||
ScreenElementRenderer.renderBlock(this::block);
|
||||
GlStateManager.popMatrix();
|
||||
RenderSystem.popMatrix();
|
||||
|
||||
GlStateManager.popMatrix();
|
||||
RenderSystem.popMatrix();
|
||||
}
|
||||
|
||||
private BlockState shaft() {
|
||||
float t = 25;
|
||||
GlStateManager.translatef(t, -t, t);
|
||||
GlStateManager.rotated(-getCurrentAngle() * 2, 0, 0, 1);
|
||||
GlStateManager.translatef(-t, t, -t);
|
||||
RenderSystem.translatef(t, -t, t);
|
||||
RenderSystem.rotated(-getCurrentAngle() * 2, 0, 0, 1);
|
||||
RenderSystem.translatef(-t, t, -t);
|
||||
return AllBlocks.SHAFT.get().getDefaultState().with(BlockStateProperties.AXIS, Axis.X);
|
||||
}
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ public class AllConfigs {
|
|||
pair.getKey().onLoad();
|
||||
}
|
||||
|
||||
public static void onReload(ModConfig.ConfigReloading event) {
|
||||
public static void onReload(ModConfig.Reloading event) {
|
||||
for (Pair<ConfigBase, Type> pair : configs)
|
||||
if (pair.getKey().specification == event.getConfig().getSpec())
|
||||
pair.getKey().onReload();
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package com.simibubi.create.foundation.behaviour;
|
||||
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.simibubi.create.ScreenResources;
|
||||
import com.simibubi.create.foundation.behaviour.scrollvalue.INamedIconOptions;
|
||||
import com.simibubi.create.foundation.utility.Lang;
|
||||
|
@ -67,19 +67,19 @@ public class ValueBox {
|
|||
super.render(highlighted);
|
||||
FontRenderer font = Minecraft.getInstance().fontRenderer;
|
||||
String countString = count == 0 ? "*" : count + "";
|
||||
GlStateManager.translated(17.5f, -5f, 7f);
|
||||
RenderSystem.translated(17.5f, -5f, 7f);
|
||||
|
||||
boolean isFilter = stack.getItem() instanceof FilterItem;
|
||||
if (isFilter)
|
||||
GlStateManager.translated(3, 8, 7.25f);
|
||||
RenderSystem.translated(3, 8, 7.25f);
|
||||
else
|
||||
GlStateManager.translated(-7 - font.getStringWidth(countString), 10, 10 + 1 / 4f);
|
||||
RenderSystem.translated(-7 - font.getStringWidth(countString), 10, 10 + 1 / 4f);
|
||||
|
||||
double scale = 1.5;
|
||||
GlStateManager.rotated(0, 1, 0, 0);
|
||||
GlStateManager.scaled(scale, scale, scale);
|
||||
RenderSystem.rotated(0, 1, 0, 0);
|
||||
RenderSystem.scaled(scale, scale, scale);
|
||||
font.drawString(countString, 0, 0, isFilter ? 0xFFFFFF : 0xEDEDED);
|
||||
GlStateManager.translated(0, 0, -1 / 16f);
|
||||
RenderSystem.translated(0, 0, -1 / 16f);
|
||||
font.drawString(countString, 1 - 1 / 8f, 1 - 1 / 8f, 0x4F4F4F);
|
||||
}
|
||||
|
||||
|
@ -98,8 +98,8 @@ public class ValueBox {
|
|||
super.render(highlighted);
|
||||
FontRenderer font = Minecraft.getInstance().fontRenderer;
|
||||
double scale = 4;
|
||||
GlStateManager.scaled(scale, scale, 1);
|
||||
GlStateManager.translated(-4, -4, 5);
|
||||
RenderSystem.scaled(scale, scale, 1);
|
||||
RenderSystem.translated(-4, -4, 5);
|
||||
|
||||
int stringWidth = font.getStringWidth(text);
|
||||
float numberScale = (float) font.FONT_HEIGHT / stringWidth;
|
||||
|
@ -108,8 +108,8 @@ public class ValueBox {
|
|||
numberScale = numberScale / 2;
|
||||
float verticalMargin = (stringWidth - font.FONT_HEIGHT) / 2f;
|
||||
|
||||
GlStateManager.scaled(numberScale, numberScale, numberScale);
|
||||
GlStateManager.translated(singleDigit ? stringWidth / 2 : 0, singleDigit ? -verticalMargin : verticalMargin,
|
||||
RenderSystem.scaled(numberScale, numberScale, numberScale);
|
||||
RenderSystem.translated(singleDigit ? stringWidth / 2 : 0, singleDigit ? -verticalMargin : verticalMargin,
|
||||
0);
|
||||
|
||||
ValueBoxRenderer.renderText(font, text, 0xEDEDED, 0x4f4f4f);
|
||||
|
@ -130,13 +130,13 @@ public class ValueBox {
|
|||
public void render(boolean highlighted) {
|
||||
super.render(highlighted);
|
||||
double scale = 4;
|
||||
GlStateManager.scaled(scale, scale, 1);
|
||||
GlStateManager.translated(-8, -8, 3/2f);
|
||||
RenderSystem.scaled(scale, scale, 1);
|
||||
RenderSystem.translated(-8, -8, 3/2f);
|
||||
icon.draw(0, 0);
|
||||
GlStateManager.color4f(.25f, .25f, .25f, 1);
|
||||
GlStateManager.translated(.5f, .5f, -1);
|
||||
RenderSystem.color4f(.25f, .25f, .25f, 1);
|
||||
RenderSystem.translated(.5f, .5f, -1);
|
||||
icon.draw(0, 0);
|
||||
GlStateManager.color4f(1, 1, 1, 1);
|
||||
RenderSystem.color4f(1, 1, 1, 1);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package com.simibubi.create.foundation.behaviour;
|
||||
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.simibubi.create.foundation.utility.ColorHelper;
|
||||
import com.simibubi.create.foundation.utility.TessellatorHelper;
|
||||
import com.simibubi.create.modules.contraptions.relays.elementary.ShaftBlock;
|
||||
|
@ -29,45 +29,45 @@ import net.minecraft.util.math.Vec3d;
|
|||
public class ValueBoxRenderer {
|
||||
|
||||
public static void renderBox(ValueBox box, boolean highlighted) {
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.blendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA,
|
||||
GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE,
|
||||
GlStateManager.DestFactor.ZERO);
|
||||
GlStateManager.disableTexture();
|
||||
RenderSystem.enableBlend();
|
||||
RenderSystem.blendFuncSeparate(RenderSystem.SourceFactor.SRC_ALPHA,
|
||||
RenderSystem.DestFactor.ONE_MINUS_SRC_ALPHA, RenderSystem.SourceFactor.ONE,
|
||||
RenderSystem.DestFactor.ZERO);
|
||||
RenderSystem.disableTexture();
|
||||
|
||||
Tessellator tessellator = Tessellator.getInstance();
|
||||
BufferBuilder bufferbuilder = tessellator.getBuffer();
|
||||
bufferbuilder.begin(3, DefaultVertexFormats.POSITION_COLOR);
|
||||
|
||||
GlStateManager.lineWidth(highlighted ? 3 : 2);
|
||||
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,
|
||||
(float) color.x, (float) color.y, (float) color.z, 1f);
|
||||
GlStateManager.lineWidth(1);
|
||||
RenderSystem.lineWidth(1);
|
||||
|
||||
TessellatorHelper.draw();
|
||||
GlStateManager.enableTexture();
|
||||
RenderSystem.enableTexture();
|
||||
|
||||
float fontScale = -1 / 64f;
|
||||
Vec3d shift = box.labelOffset;
|
||||
FontRenderer font = Minecraft.getInstance().fontRenderer;
|
||||
GlStateManager.scaled(fontScale, fontScale, fontScale);
|
||||
RenderSystem.scaled(fontScale, fontScale, fontScale);
|
||||
|
||||
if (highlighted) {
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.translated(17.5f, -5f, 7f);
|
||||
GlStateManager.translated(shift.x, shift.y, shift.z);
|
||||
RenderSystem.pushMatrix();
|
||||
RenderSystem.translated(17.5f, -5f, 7f);
|
||||
RenderSystem.translated(shift.x, shift.y, shift.z);
|
||||
renderText(box, font, box.label);
|
||||
if (!box.sublabel.isEmpty()) {
|
||||
GlStateManager.translated(0, 10, 0);
|
||||
RenderSystem.translated(0, 10, 0);
|
||||
renderText(box, font, box.sublabel);
|
||||
}
|
||||
if (!box.scrollTooltip.isEmpty()) {
|
||||
GlStateManager.translated(0, 10, 0);
|
||||
RenderSystem.translated(0, 10, 0);
|
||||
renderText(font, box.scrollTooltip, 0x998899, 0x111111);
|
||||
}
|
||||
GlStateManager.popMatrix();
|
||||
RenderSystem.popMatrix();
|
||||
}
|
||||
|
||||
box.render(highlighted);
|
||||
|
@ -79,9 +79,9 @@ public class ValueBoxRenderer {
|
|||
|
||||
public static void renderText(FontRenderer font, String text, int color, int shadowColor) {
|
||||
font.drawString(text, 0, 0, color);
|
||||
GlStateManager.translated(0, 0, -1 / 4f);
|
||||
RenderSystem.translated(0, 0, -1 / 4f);
|
||||
font.drawString(text, 1, 1, shadowColor);
|
||||
GlStateManager.translated(0, 0, 1 / 4f);
|
||||
RenderSystem.translated(0, 0, 1 / 4f);
|
||||
}
|
||||
|
||||
public static void renderItemIntoValueBox(ItemStack filter) {
|
||||
|
@ -90,8 +90,8 @@ public class ValueBoxRenderer {
|
|||
boolean blockItem = modelWithOverrides.isGui3d();
|
||||
float scale = (!blockItem ? .5f : 1f) - 1 / 64f;
|
||||
float zOffset = (!blockItem ? -.225f : 0) + customZOffset(filter.getItem());
|
||||
GlStateManager.scaled(scale, scale, scale);
|
||||
GlStateManager.translated(0, 0, zOffset);
|
||||
RenderSystem.scaled(scale, scale, scale);
|
||||
RenderSystem.translated(0, 0, zOffset);
|
||||
itemRenderer.renderItem(filter, TransformType.FIXED);
|
||||
}
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ import net.minecraft.nbt.CompoundNBT;
|
|||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IEnviromentBlockReader;
|
||||
import net.minecraft.world.ILightReader;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public abstract class TileEntityBehaviour {
|
||||
|
@ -88,12 +88,12 @@ public abstract class TileEntityBehaviour {
|
|||
return tileEntity.getWorld();
|
||||
}
|
||||
|
||||
public static <T extends TileEntityBehaviour> T get(IEnviromentBlockReader reader, BlockPos pos,
|
||||
public static <T extends TileEntityBehaviour> T get(ILightReader reader, BlockPos pos,
|
||||
IBehaviourType<T> type) {
|
||||
return get(reader.getTileEntity(pos), type);
|
||||
}
|
||||
|
||||
public static <T extends TileEntityBehaviour> void destroy(IEnviromentBlockReader reader, BlockPos pos,
|
||||
public static <T extends TileEntityBehaviour> void destroy(ILightReader reader, BlockPos pos,
|
||||
IBehaviourType<T> type) {
|
||||
T behaviour = get(reader.getTileEntity(pos), type);
|
||||
if (behaviour != null)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package com.simibubi.create.foundation.behaviour.filtering;
|
||||
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.simibubi.create.foundation.behaviour.ValueBox;
|
||||
import com.simibubi.create.foundation.behaviour.ValueBox.ItemValueBox;
|
||||
import com.simibubi.create.foundation.behaviour.ValueBoxRenderer;
|
||||
|
@ -45,7 +45,7 @@ public class FilteringRenderer {
|
|||
return;
|
||||
|
||||
TessellatorHelper.prepareForDrawing();
|
||||
GlStateManager.translated(pos.getX(), pos.getY(), pos.getZ());
|
||||
RenderSystem.translated(pos.getX(), pos.getY(), pos.getZ());
|
||||
|
||||
behaviour.slotPositioning.renderTransformed(state, () -> {
|
||||
|
||||
|
@ -81,7 +81,7 @@ public class FilteringRenderer {
|
|||
BlockState state = tileEntityIn.getBlockState();
|
||||
TessellatorHelper.prepareForDrawing();
|
||||
BlockPos pos = tileEntityIn.getPos();
|
||||
GlStateManager.translated(pos.getX(), pos.getY(), pos.getZ());
|
||||
RenderSystem.translated(pos.getX(), pos.getY(), pos.getZ());
|
||||
|
||||
behaviour.slotPositioning.renderTransformed(state, () -> {
|
||||
ValueBoxRenderer.renderItemIntoValueBox(behaviour.getFilter());
|
||||
|
|
|
@ -12,11 +12,11 @@ import net.minecraft.block.ChestBlock;
|
|||
import net.minecraft.state.properties.ChestType;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IEnviromentBlockReader;
|
||||
import net.minecraft.world.ILightReader;
|
||||
|
||||
public class SynchronizedExtraction {
|
||||
|
||||
static boolean extractSynchronized(IEnviromentBlockReader reader, BlockPos inventoryPos) {
|
||||
static boolean extractSynchronized(ILightReader reader, BlockPos inventoryPos) {
|
||||
List<SingleTargetAutoExtractingBehaviour> actors = getAllSyncedExtractors(reader, inventoryPos);
|
||||
int startIndex = actors.size() - 1;
|
||||
boolean success = false;
|
||||
|
@ -35,7 +35,7 @@ public class SynchronizedExtraction {
|
|||
return success;
|
||||
}
|
||||
|
||||
private static List<SingleTargetAutoExtractingBehaviour> getAllSyncedExtractors(IEnviromentBlockReader reader,
|
||||
private static List<SingleTargetAutoExtractingBehaviour> getAllSyncedExtractors(ILightReader reader,
|
||||
BlockPos inventoryPos) {
|
||||
List<SingleTargetAutoExtractingBehaviour> list = new ArrayList<>();
|
||||
List<BlockPos> inventoryPositions = new ArrayList<>();
|
||||
|
|
|
@ -2,7 +2,7 @@ package com.simibubi.create.foundation.behaviour.linked;
|
|||
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.simibubi.create.foundation.behaviour.ValueBox;
|
||||
import com.simibubi.create.foundation.behaviour.ValueBoxRenderer;
|
||||
import com.simibubi.create.foundation.behaviour.base.SmartTileEntity;
|
||||
|
@ -42,7 +42,7 @@ public class LinkRenderer {
|
|||
return;
|
||||
|
||||
TessellatorHelper.prepareForDrawing();
|
||||
GlStateManager.translated(pos.getX(), pos.getY(), pos.getZ());
|
||||
RenderSystem.translated(pos.getX(), pos.getY(), pos.getZ());
|
||||
|
||||
String freq1 = Lang.translate("logistics.firstFrequency");
|
||||
String freq2 = Lang.translate("logistics.secondFrequency");
|
||||
|
@ -69,7 +69,7 @@ public class LinkRenderer {
|
|||
BlockState state = tileEntityIn.getBlockState();
|
||||
TessellatorHelper.prepareForDrawing();
|
||||
BlockPos pos = tileEntityIn.getPos();
|
||||
GlStateManager.translated(pos.getX(), pos.getY(), pos.getZ());
|
||||
RenderSystem.translated(pos.getX(), pos.getY(), pos.getZ());
|
||||
|
||||
renderEachSlot(state, behaviour, first -> {
|
||||
ValueBoxRenderer.renderItemIntoValueBox(
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package com.simibubi.create.foundation.behaviour.scrollvalue;
|
||||
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.simibubi.create.AllItems;
|
||||
import com.simibubi.create.AllKeys;
|
||||
import com.simibubi.create.foundation.behaviour.ValueBox;
|
||||
|
@ -52,11 +52,11 @@ public class ScrollValueRenderer {
|
|||
if (behaviour instanceof BulkScrollValueBehaviour && AllKeys.ctrlDown()) {
|
||||
BulkScrollValueBehaviour bulkScrolling = (BulkScrollValueBehaviour) behaviour;
|
||||
for (SmartTileEntity smartTileEntity : bulkScrolling.getBulk()) {
|
||||
GlStateManager.pushMatrix();
|
||||
RenderSystem.pushMatrix();
|
||||
ScrollValueBehaviour other = TileEntityBehaviour.get(smartTileEntity, ScrollValueBehaviour.TYPE);
|
||||
if (other != null)
|
||||
render(world, smartTileEntity.getPos(), face, other, highlight);
|
||||
GlStateManager.popMatrix();
|
||||
RenderSystem.popMatrix();
|
||||
}
|
||||
} else
|
||||
render(world, pos, face, behaviour, highlight);
|
||||
|
@ -65,7 +65,7 @@ public class ScrollValueRenderer {
|
|||
|
||||
protected static void render(ClientWorld world, BlockPos pos, Direction face, ScrollValueBehaviour behaviour,
|
||||
boolean highlight) {
|
||||
GlStateManager.translated(pos.getX(), pos.getY(), pos.getZ());
|
||||
RenderSystem.translated(pos.getX(), pos.getY(), pos.getZ());
|
||||
BlockState state = world.getBlockState(pos);
|
||||
if (behaviour.slotPositioning instanceof Sided)
|
||||
((Sided) behaviour.slotPositioning).fromSide(face);
|
||||
|
|
|
@ -11,10 +11,11 @@ import net.minecraft.block.Block;
|
|||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.client.renderer.model.BakedQuad;
|
||||
import net.minecraft.client.renderer.model.IBakedModel;
|
||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||
import net.minecraft.client.renderer.vertex.VertexFormat;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IEnviromentBlockReader;
|
||||
import net.minecraft.world.ILightReader;
|
||||
import net.minecraftforge.client.model.BakedModelWrapper;
|
||||
import net.minecraftforge.client.model.data.EmptyModelData;
|
||||
import net.minecraftforge.client.model.data.IModelData;
|
||||
|
@ -49,7 +50,7 @@ public class CTModel extends BakedModelWrapper<IBakedModel> {
|
|||
}
|
||||
|
||||
@Override
|
||||
public IModelData getModelData(IEnviromentBlockReader world, BlockPos pos, BlockState state, IModelData tileData) {
|
||||
public IModelData getModelData(ILightReader world, BlockPos pos, BlockState state, IModelData tileData) {
|
||||
if (!(state.getBlock() instanceof IHaveConnectedTextures))
|
||||
return EmptyModelData.INSTANCE;
|
||||
CTData data = new CTData();
|
||||
|
@ -90,12 +91,12 @@ public class CTModel extends BakedModelWrapper<IBakedModel> {
|
|||
|
||||
BakedQuad newQuad =
|
||||
new BakedQuad(Arrays.copyOf(quad.getVertexData(), quad.getVertexData().length), quad.getTintIndex(),
|
||||
quad.getFace(), quad.getSprite(), quad.shouldApplyDiffuseLighting(), quad.getFormat());
|
||||
VertexFormat format = quad.getFormat();
|
||||
quad.getFace(), quad.getSprite(), quad.shouldApplyDiffuseLighting());
|
||||
VertexFormat format = DefaultVertexFormats.BLOCK;
|
||||
int[] vertexData = newQuad.getVertexData();
|
||||
|
||||
for (int vertex = 0; vertex < vertexData.length; vertex += format.getIntegerSize()) {
|
||||
int uvOffset = format.getUvOffsetById(0) / 4;
|
||||
int uvOffset = 20 / 4; // TODO 1.15 is this the right offset?
|
||||
int uIndex = vertex + uvOffset;
|
||||
int vIndex = vertex + uvOffset + 1;
|
||||
float u = Float.intBitsToFloat(vertexData[uIndex]);
|
||||
|
|
|
@ -7,7 +7,7 @@ import net.minecraft.util.Direction;
|
|||
import net.minecraft.util.Direction.Axis;
|
||||
import net.minecraft.util.Direction.AxisDirection;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IEnviromentBlockReader;
|
||||
import net.minecraft.world.ILightReader;
|
||||
|
||||
public abstract class ConnectedTextureBehaviour {
|
||||
|
||||
|
@ -32,7 +32,7 @@ public abstract class ConnectedTextureBehaviour {
|
|||
return reverseUVs(state, face);
|
||||
}
|
||||
|
||||
public boolean connectsTo(BlockState state, BlockState other, IEnviromentBlockReader reader, BlockPos pos,
|
||||
public boolean connectsTo(BlockState state, BlockState other, ILightReader reader, BlockPos pos,
|
||||
BlockPos otherPos, Direction face) {
|
||||
|
||||
BlockPos blockingPos = otherPos.offset(face);
|
||||
|
@ -44,7 +44,7 @@ public abstract class ConnectedTextureBehaviour {
|
|||
return state.getBlock() == other.getBlock();
|
||||
}
|
||||
|
||||
CTContext buildContext(IEnviromentBlockReader reader, BlockPos pos, BlockState state, Direction face) {
|
||||
CTContext buildContext(ILightReader reader, BlockPos pos, BlockState state, Direction face) {
|
||||
Axis axis = face.getAxis();
|
||||
boolean positive = face.getAxisDirection() == AxisDirection.POSITIVE;
|
||||
Direction h = axis == Axis.X ? Direction.SOUTH : Direction.WEST;
|
||||
|
|
|
@ -1,22 +1,30 @@
|
|||
package com.simibubi.create.foundation.block.render;
|
||||
|
||||
import com.simibubi.create.foundation.block.SafeTileEntityRendererFast;
|
||||
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.BufferBuilder;
|
||||
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public abstract class ColoredOverlayTileEntityRenderer<T extends TileEntity> extends SafeTileEntityRendererFast<T> {
|
||||
public abstract class ColoredOverlayTileEntityRenderer<T extends TileEntity> extends SafeTileEntityRenderer<T> {
|
||||
|
||||
public ColoredOverlayTileEntityRenderer(TileEntityRendererDispatcher dispatcher) {
|
||||
super(dispatcher);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderFast(T te, double x, double y, double z, float partialTicks, int destroyStage,
|
||||
BufferBuilder buffer) {
|
||||
SuperByteBuffer render = render(getWorld(), te.getPos(), te.getBlockState(), getOverlayBuffer(te),
|
||||
protected void renderSafe(T te, float partialTicks, MatrixStack ms, IRenderTypeBuffer buffer,
|
||||
int light, int overlay) {
|
||||
SuperByteBuffer render = render(te.getWorld(), te.getPos(), te.getBlockState(), getOverlayBuffer(te),
|
||||
getColor(te, partialTicks));
|
||||
buffer.putBulkData(render.translate(x, y, z).build());
|
||||
render.renderInto(ms, buffer.getBuffer(RenderType.getSolid()));
|
||||
}
|
||||
|
||||
protected abstract int getColor(T te, float partialTicks);
|
||||
|
|
|
@ -10,10 +10,11 @@ import com.simibubi.create.foundation.block.IHaveColoredVertices;
|
|||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.client.renderer.model.BakedQuad;
|
||||
import net.minecraft.client.renderer.model.IBakedModel;
|
||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||
import net.minecraft.client.renderer.vertex.VertexFormat;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IEnviromentBlockReader;
|
||||
import net.minecraft.world.ILightReader;
|
||||
import net.minecraftforge.client.model.BakedModelWrapper;
|
||||
import net.minecraftforge.client.model.data.IModelData;
|
||||
import net.minecraftforge.client.model.data.ModelDataMap;
|
||||
|
@ -30,7 +31,7 @@ public class ColoredVertexModel extends BakedModelWrapper<IBakedModel> {
|
|||
}
|
||||
|
||||
@Override
|
||||
public IModelData getModelData(IEnviromentBlockReader world, BlockPos pos, BlockState state, IModelData tileData) {
|
||||
public IModelData getModelData(ILightReader world, BlockPos pos, BlockState state, IModelData tileData) {
|
||||
return new ModelDataMap.Builder().withInitial(POSITION_PROPERTY, pos).build();
|
||||
}
|
||||
|
||||
|
@ -45,10 +46,9 @@ public class ColoredVertexModel extends BakedModelWrapper<IBakedModel> {
|
|||
BakedQuad quad = quads.get(i);
|
||||
|
||||
BakedQuad newQuad = new BakedQuad(Arrays.copyOf(quad.getVertexData(), quad.getVertexData().length),
|
||||
quad.getTintIndex(), quad.getFace(), quad.getSprite(), quad.shouldApplyDiffuseLighting(),
|
||||
quad.getFormat());
|
||||
quad.getTintIndex(), quad.getFace(), quad.getSprite(), quad.shouldApplyDiffuseLighting());
|
||||
|
||||
VertexFormat format = quad.getFormat();
|
||||
VertexFormat format = DefaultVertexFormats.BLOCK;
|
||||
int[] vertexData = newQuad.getVertexData();
|
||||
BlockPos data = extraData.getData(POSITION_PROPERTY);
|
||||
|
||||
|
@ -57,7 +57,7 @@ public class ColoredVertexModel extends BakedModelWrapper<IBakedModel> {
|
|||
// continue;
|
||||
|
||||
for (int vertex = 0; vertex < vertexData.length; vertex += format.getIntegerSize()) {
|
||||
int colorOffset = format.getColorOffset() / 4;
|
||||
int colorOffset = 16 / 4; // TODO 1.15 is this the right offset
|
||||
float x = Float.intBitsToFloat(vertexData[vertex]);
|
||||
float y = Float.intBitsToFloat(vertexData[vertex + 1]);
|
||||
float z = Float.intBitsToFloat(vertexData[vertex + 2]);
|
||||
|
|
|
@ -5,10 +5,7 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.vecmath.Matrix4f;
|
||||
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.simibubi.create.Create;
|
||||
|
||||
import net.minecraft.client.renderer.model.IBakedModel;
|
||||
|
@ -48,9 +45,9 @@ public abstract class CustomRenderedItemModel extends WrappedBakedModel {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Pair<? extends IBakedModel, Matrix4f> handlePerspective(TransformType cameraTransformType) {
|
||||
public IBakedModel handlePerspective(TransformType cameraTransformType, MatrixStack mat) {
|
||||
currentPerspective = cameraTransformType;
|
||||
return super.handlePerspective(cameraTransformType);
|
||||
return super.handlePerspective(cameraTransformType, mat);
|
||||
}
|
||||
|
||||
protected void addPartials(String... partials) {
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package com.simibubi.create.foundation.block.render;
|
||||
|
||||
import java.util.function.Function;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.texture.AtlasTexture;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
|
@ -17,9 +19,9 @@ public class SpriteShiftEntry {
|
|||
}
|
||||
|
||||
protected void loadTextures() {
|
||||
AtlasTexture textureMap = Minecraft.getInstance().getTextureMap();
|
||||
original = textureMap.getSprite(originalTextureLocation);
|
||||
target = textureMap.getSprite(targetTextureLocation);
|
||||
Function<ResourceLocation, TextureAtlasSprite> textureMap = Minecraft.getInstance().getSpriteAtlas(AtlasTexture.LOCATION_BLOCKS_TEXTURE);
|
||||
original = textureMap.apply(originalTextureLocation);
|
||||
target = textureMap.apply(targetTextureLocation);
|
||||
}
|
||||
|
||||
public ResourceLocation getTargetResourceLocation() {
|
||||
|
|
|
@ -3,11 +3,12 @@ package com.simibubi.create.foundation.block.render;
|
|||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import javax.vecmath.Matrix4f;
|
||||
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.client.renderer.Matrix4f;
|
||||
import net.minecraft.client.renderer.model.BakedQuad;
|
||||
import net.minecraft.client.renderer.model.IBakedModel;
|
||||
import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType;
|
||||
|
@ -57,9 +58,9 @@ public class WrappedBakedModel implements IBakedModel {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Pair<? extends IBakedModel, Matrix4f> handlePerspective(TransformType cameraTransformType) {
|
||||
Pair<? extends IBakedModel, Matrix4f> pair = template.handlePerspective(cameraTransformType);
|
||||
return Pair.of(this, pair.getRight());
|
||||
public IBakedModel handlePerspective(TransformType cameraTransformType, MatrixStack mat) {
|
||||
template.handlePerspective(cameraTransformType, mat);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -77,4 +78,8 @@ public class WrappedBakedModel implements IBakedModel {
|
|||
return getParticleTexture(EmptyModelData.INSTANCE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSideLit() {
|
||||
return template.isSideLit();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ import java.util.List;
|
|||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.simibubi.create.foundation.gui.widgets.AbstractSimiWidget;
|
||||
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
|
@ -46,12 +46,12 @@ public abstract class AbstractSimiContainerScreen<T extends Container> extends C
|
|||
|
||||
super.render(mouseX, mouseY, partialTicks);
|
||||
|
||||
GlStateManager.enableAlphaTest();
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.disableRescaleNormal();
|
||||
RenderSystem.enableAlphaTest();
|
||||
RenderSystem.enableBlend();
|
||||
RenderSystem.disableRescaleNormal();
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
GlStateManager.disableLighting();
|
||||
GlStateManager.disableDepthTest();
|
||||
RenderSystem.disableLighting();
|
||||
RenderSystem.disableDepthTest();
|
||||
|
||||
for (Widget widget : widgets)
|
||||
widget.render(mouseX, mouseY, partialTicks);
|
||||
|
@ -141,11 +141,11 @@ public abstract class AbstractSimiContainerScreen<T extends Container> extends C
|
|||
@Nullable String text, int textColor) {
|
||||
if (!stack.isEmpty()) {
|
||||
if (stack.getItem().showDurabilityBar(stack)) {
|
||||
GlStateManager.disableLighting();
|
||||
GlStateManager.disableDepthTest();
|
||||
GlStateManager.disableTexture();
|
||||
GlStateManager.disableAlphaTest();
|
||||
GlStateManager.disableBlend();
|
||||
RenderSystem.disableLighting();
|
||||
RenderSystem.disableDepthTest();
|
||||
RenderSystem.disableTexture();
|
||||
RenderSystem.disableAlphaTest();
|
||||
RenderSystem.disableBlend();
|
||||
Tessellator tessellator = Tessellator.getInstance();
|
||||
BufferBuilder bufferbuilder = tessellator.getBuffer();
|
||||
double health = stack.getItem().getDurabilityForDisplay(stack);
|
||||
|
@ -154,40 +154,40 @@ public abstract class AbstractSimiContainerScreen<T extends Container> extends C
|
|||
this.draw(bufferbuilder, xPosition + 2, yPosition + 13, 13, 2, 0, 0, 0, 255);
|
||||
this.draw(bufferbuilder, xPosition + 2, yPosition + 13, i, 1, j >> 16 & 255, j >> 8 & 255, j & 255,
|
||||
255);
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.enableAlphaTest();
|
||||
GlStateManager.enableTexture();
|
||||
GlStateManager.enableLighting();
|
||||
GlStateManager.enableDepthTest();
|
||||
RenderSystem.enableBlend();
|
||||
RenderSystem.enableAlphaTest();
|
||||
RenderSystem.enableTexture();
|
||||
RenderSystem.enableLighting();
|
||||
RenderSystem.enableDepthTest();
|
||||
}
|
||||
|
||||
if (stack.getCount() != 1 || text != null) {
|
||||
String s = text == null ? String.valueOf(stack.getCount()) : text;
|
||||
GlStateManager.disableLighting();
|
||||
GlStateManager.disableDepthTest();
|
||||
GlStateManager.disableBlend();
|
||||
GlStateManager.pushMatrix();
|
||||
RenderSystem.disableLighting();
|
||||
RenderSystem.disableDepthTest();
|
||||
RenderSystem.disableBlend();
|
||||
RenderSystem.pushMatrix();
|
||||
|
||||
int guiScaleFactor = (int) minecraft.mainWindow.getGuiScaleFactor();
|
||||
GlStateManager.translated((float) (xPosition + 16.5f), (float) (yPosition + 16.5f), 0);
|
||||
int guiScaleFactor = (int) minecraft.getWindow().getGuiScaleFactor();
|
||||
RenderSystem.translated((float) (xPosition + 16.5f), (float) (yPosition + 16.5f), 0);
|
||||
double scale = getItemCountTextScale();
|
||||
|
||||
GlStateManager.scaled(scale, scale, 0);
|
||||
GlStateManager.translated(-fr.getStringWidth(s) - (guiScaleFactor > 1 ? 0 : -.5f),
|
||||
RenderSystem.scaled(scale, scale, 0);
|
||||
RenderSystem.translated(-fr.getStringWidth(s) - (guiScaleFactor > 1 ? 0 : -.5f),
|
||||
-font.FONT_HEIGHT + (guiScaleFactor > 1 ? 1 : 1.75f), 0);
|
||||
fr.drawStringWithShadow(s, 0, 0, textColor);
|
||||
|
||||
GlStateManager.popMatrix();
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.enableLighting();
|
||||
GlStateManager.enableDepthTest();
|
||||
GlStateManager.enableBlend();
|
||||
RenderSystem.popMatrix();
|
||||
RenderSystem.enableBlend();
|
||||
RenderSystem.enableLighting();
|
||||
RenderSystem.enableDepthTest();
|
||||
RenderSystem.enableBlend();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public double getItemCountTextScale() {
|
||||
int guiScaleFactor = (int) minecraft.mainWindow.getGuiScaleFactor();
|
||||
int guiScaleFactor = (int) minecraft.getWindow().getGuiScaleFactor();
|
||||
double scale = 1;
|
||||
switch (guiScaleFactor) {
|
||||
case 1:
|
||||
|
@ -211,10 +211,10 @@ public abstract class AbstractSimiContainerScreen<T extends Container> extends C
|
|||
private void draw(BufferBuilder renderer, int x, int y, int width, int height, int red, int green, int blue,
|
||||
int alpha) {
|
||||
renderer.begin(7, DefaultVertexFormats.POSITION_COLOR);
|
||||
renderer.pos((double) (x + 0), (double) (y + 0), 0.0D).color(red, green, blue, alpha).endVertex();
|
||||
renderer.pos((double) (x + 0), (double) (y + height), 0.0D).color(red, green, blue, alpha).endVertex();
|
||||
renderer.pos((double) (x + width), (double) (y + height), 0.0D).color(red, green, blue, alpha).endVertex();
|
||||
renderer.pos((double) (x + width), (double) (y + 0), 0.0D).color(red, green, blue, alpha).endVertex();
|
||||
renderer.vertex((double) (x + 0), (double) (y + 0), 0.0D).color(red, green, blue, alpha).endVertex();
|
||||
renderer.vertex((double) (x + 0), (double) (y + height), 0.0D).color(red, green, blue, alpha).endVertex();
|
||||
renderer.vertex((double) (x + width), (double) (y + height), 0.0D).color(red, green, blue, alpha).endVertex();
|
||||
renderer.vertex((double) (x + width), (double) (y + 0), 0.0D).color(red, green, blue, alpha).endVertex();
|
||||
Tessellator.getInstance().draw();
|
||||
}
|
||||
|
||||
|
|
|
@ -4,7 +4,9 @@ import java.util.function.Supplier;
|
|||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
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.foundation.utility.ColorHelper;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
|
@ -24,18 +26,18 @@ import net.minecraft.util.math.Vec3d;
|
|||
public class ScreenElementRenderer {
|
||||
|
||||
public static void render3DItem(Supplier<ItemStack> transformsAndStack) {
|
||||
GlStateManager.pushMatrix();
|
||||
RenderSystem.pushMatrix();
|
||||
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.enableRescaleNormal();
|
||||
GlStateManager.enableAlphaTest();
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
RenderSystem.enableBlend();
|
||||
RenderSystem.enableRescaleNormal();
|
||||
RenderSystem.enableAlphaTest();
|
||||
RenderHelper.enableGuiDepthLighting(); // TODO 1.15
|
||||
RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
|
||||
ItemStack stack = transformsAndStack.get();
|
||||
|
||||
Minecraft.getInstance().getItemRenderer().renderItemIntoGUI(stack, 0, 0);
|
||||
GlStateManager.popMatrix();
|
||||
RenderSystem.popMatrix();
|
||||
}
|
||||
|
||||
public static void renderBlock(Supplier<BlockState> transformsAndState) {
|
||||
|
@ -52,16 +54,16 @@ public class ScreenElementRenderer {
|
|||
|
||||
private static void render(Supplier<BlockState> transformsAndState, Supplier<IBakedModel> transformsAndModel,
|
||||
int color) {
|
||||
GlStateManager.pushMatrix();
|
||||
RenderSystem.pushMatrix();
|
||||
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.enableRescaleNormal();
|
||||
GlStateManager.enableAlphaTest();
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
GlStateManager.alphaFunc(516, 0.1F);
|
||||
GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA);
|
||||
GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
GlStateManager.translated(0, 0, 200);
|
||||
RenderSystem.enableBlend();
|
||||
RenderSystem.enableRescaleNormal();
|
||||
RenderSystem.enableAlphaTest();
|
||||
RenderHelper.enableGuiDepthLighting(); // TODO 1.15
|
||||
RenderSystem.alphaFunc(516, 0.1F);
|
||||
RenderSystem.blendFunc(SourceFactor.SRC_ALPHA, DestFactor.ONE_MINUS_SRC_ALPHA);
|
||||
RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
RenderSystem.translated(0, 0, 200);
|
||||
|
||||
Minecraft mc = Minecraft.getInstance();
|
||||
BlockRendererDispatcher blockRenderer = mc.getBlockRendererDispatcher();
|
||||
|
@ -78,15 +80,15 @@ public class ScreenElementRenderer {
|
|||
modelToRender = transformsAndModel.get();
|
||||
}
|
||||
|
||||
GlStateManager.scaled(50, -50, 50);
|
||||
RenderSystem.scaled(50, -50, 50);
|
||||
mc.getTextureManager().bindTexture(AtlasTexture.LOCATION_BLOCKS_TEXTURE);
|
||||
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
RenderSystem.pushMatrix();
|
||||
if (fire) {
|
||||
blockRenderer.renderBlockBrightness(blockToRender, 1);
|
||||
} else {
|
||||
GlStateManager.rotated(90, 0, 1, 0);
|
||||
RenderSystem.rotated(90, 0, 1, 0);
|
||||
if (color == -1) {
|
||||
blockRenderer.getBlockModelRenderer().renderModelBrightnessColor(modelToRender, 1, 1, 1, 1);
|
||||
} else {
|
||||
|
@ -95,7 +97,7 @@ public class ScreenElementRenderer {
|
|||
(float) rgb.y, (float) rgb.z);
|
||||
}
|
||||
}
|
||||
GlStateManager.popMatrix();
|
||||
RenderSystem.popMatrix();
|
||||
|
||||
if (stateMode && !blockToRender.getFluidState().isEmpty()) {
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
|
@ -108,10 +110,10 @@ public class ScreenElementRenderer {
|
|||
bufferbuilder.setTranslation(0, 0, 0);
|
||||
}
|
||||
|
||||
GlStateManager.disableAlphaTest();
|
||||
GlStateManager.disableRescaleNormal();
|
||||
RenderSystem.disableAlphaTest();
|
||||
RenderSystem.disableRescaleNormal();
|
||||
|
||||
GlStateManager.popMatrix();
|
||||
RenderSystem.popMatrix();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ package com.simibubi.create.foundation.gui;
|
|||
import java.util.List;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.simibubi.create.AllKeys;
|
||||
import com.simibubi.create.ScreenResources;
|
||||
import com.simibubi.create.foundation.utility.Lang;
|
||||
|
@ -56,17 +56,17 @@ public class ToolSelectionScreen extends Screen {
|
|||
}
|
||||
|
||||
private void draw(float partialTicks) {
|
||||
MainWindow mainWindow = Minecraft.getInstance().mainWindow;
|
||||
MainWindow mainWindow = Minecraft.getInstance().getWindow();
|
||||
|
||||
int x = (mainWindow.getScaledWidth() - w) / 2 + 15;
|
||||
int y = mainWindow.getScaledHeight() - h - 75;
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.translatef(0, -yOffset, focused ? 100 : 0);
|
||||
RenderSystem.pushMatrix();
|
||||
RenderSystem.translatef(0, -yOffset, focused ? 100 : 0);
|
||||
|
||||
ScreenResources gray = ScreenResources.GRAY;
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.color4f(1, 1, 1, focused ? 7 / 8f : 1 / 2f);
|
||||
RenderSystem.enableBlend();
|
||||
RenderSystem.color4f(1, 1, 1, focused ? 7 / 8f : 1 / 2f);
|
||||
|
||||
Minecraft.getInstance().getTextureManager().bindTexture(gray.location);
|
||||
blit(x - 15, y, gray.startX, gray.startY, w, h, gray.width, gray.height);
|
||||
|
@ -77,9 +77,9 @@ public class ToolSelectionScreen extends Screen {
|
|||
int stringAlphaComponent = ((int) (toolTipAlpha * 0xFF)) << 24;
|
||||
|
||||
if (toolTipAlpha > 0.25f) {
|
||||
GlStateManager.color4f(.7f, .7f, .8f, toolTipAlpha);
|
||||
RenderSystem.color4f(.7f, .7f, .8f, toolTipAlpha);
|
||||
blit(x - 15, y + 33, gray.startX, gray.startY, w, h + 22, gray.width, gray.height);
|
||||
GlStateManager.color4f(1, 1, 1, 1);
|
||||
RenderSystem.color4f(1, 1, 1, 1);
|
||||
|
||||
if (toolTip.size() > 0)
|
||||
drawString(font, toolTip.get(0), x - 10, y + 38, 0xEEEEEE + stringAlphaComponent);
|
||||
|
@ -91,10 +91,10 @@ public class ToolSelectionScreen extends Screen {
|
|||
drawString(font, toolTip.get(3), x - 10, y + 72, 0xCCCCDD + stringAlphaComponent);
|
||||
}
|
||||
|
||||
GlStateManager.color4f(1, 1, 1, 1);
|
||||
RenderSystem.color4f(1, 1, 1, 1);
|
||||
if (tools.size() > 1) {
|
||||
String keyName = AllKeys.TOOL_MENU.getBoundKey();
|
||||
int width = minecraft.mainWindow.getScaledWidth();
|
||||
int width = minecraft.getWindow().getScaledWidth();
|
||||
if (!focused)
|
||||
drawCenteredString(minecraft.fontRenderer, Lang.translate(holdToFocus, keyName), width / 2, y - 10,
|
||||
0xCCDDFF);
|
||||
|
@ -105,24 +105,24 @@ public class ToolSelectionScreen extends Screen {
|
|||
}
|
||||
|
||||
for (int i = 0; i < tools.size(); i++) {
|
||||
GlStateManager.pushMatrix();
|
||||
RenderSystem.pushMatrix();
|
||||
|
||||
float alpha = focused ? 1 : .2f;
|
||||
if (i == selection) {
|
||||
GlStateManager.translatef(0, -10, 0);
|
||||
RenderSystem.translatef(0, -10, 0);
|
||||
drawCenteredString(minecraft.fontRenderer, tools.get(i).getDisplayName(), x + i * 50 + 24, y + 28,
|
||||
0xCCDDFF);
|
||||
alpha = 1;
|
||||
}
|
||||
GlStateManager.color4f(0, 0, 0, alpha);
|
||||
RenderSystem.color4f(0, 0, 0, alpha);
|
||||
tools.get(i).getIcon().draw(this, x + i * 50 + 16, y + 12);
|
||||
GlStateManager.color4f(1, 1, 1, alpha);
|
||||
RenderSystem.color4f(1, 1, 1, alpha);
|
||||
tools.get(i).getIcon().draw(this, x + i * 50 + 16, y + 11);
|
||||
|
||||
GlStateManager.popMatrix();
|
||||
RenderSystem.popMatrix();
|
||||
}
|
||||
|
||||
GlStateManager.popMatrix();
|
||||
RenderSystem.popMatrix();
|
||||
}
|
||||
|
||||
public void update() {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package com.simibubi.create.foundation.gui.widgets;
|
||||
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.simibubi.create.ScreenResources;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
|
@ -28,7 +28,7 @@ public class IconButton extends AbstractSimiWidget {
|
|||
(isHovered) ? ScreenResources.BUTTON_HOVER :
|
||||
ScreenResources.BUTTON;
|
||||
|
||||
GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
Minecraft.getInstance().getTextureManager().bindTexture(buttonTextures);
|
||||
blit(x, y, button.startX, button.startY, button.width, button.height);
|
||||
Minecraft.getInstance().getTextureManager().bindTexture(iconTexture);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package com.simibubi.create.foundation.gui.widgets;
|
||||
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
|
@ -70,7 +70,7 @@ public class Label extends AbstractSimiWidget {
|
|||
if (text == null || text.isEmpty())
|
||||
return;
|
||||
|
||||
GlStateManager.color4f(1, 1, 1, 1);
|
||||
RenderSystem.color4f(1, 1, 1, 1);
|
||||
if (hasShadow)
|
||||
font.drawStringWithShadow(text + suffix, x, y, color);
|
||||
else
|
||||
|
|
|
@ -127,7 +127,7 @@ public abstract class AbstractToolItem extends ToolItem {
|
|||
|
||||
@Override
|
||||
public ActionResultType onItemUse(ItemUseContext context) {
|
||||
if (hasType(HOE) && !context.isPlacerSneaking())
|
||||
if (hasType(HOE) && !context.getPlayer().isSneaking())
|
||||
return Items.WOODEN_HOE.onItemUse(context);
|
||||
if (hasType(SHOVEL))
|
||||
return Items.WOODEN_SHOVEL.onItemUse(context);
|
||||
|
|
|
@ -2,7 +2,7 @@ package com.simibubi.create.foundation.utility;
|
|||
|
||||
import java.util.UUID;
|
||||
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
|
||||
|
@ -49,11 +49,11 @@ public class ColorHelper {
|
|||
int g = (color >> 8) & 0xFF;
|
||||
int b = color & 0xFF;
|
||||
|
||||
GlStateManager.color4f(r / 256f, g / 256f, b / 256f, 1);
|
||||
RenderSystem.color4f(r / 256f, g / 256f, b / 256f, 1);
|
||||
}
|
||||
|
||||
public static void glResetColor() {
|
||||
GlStateManager.color4f(1, 1, 1, 1);
|
||||
RenderSystem.color4f(1, 1, 1, 1);
|
||||
}
|
||||
|
||||
public static Vec3d getRGB(int color) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package com.simibubi.create.foundation.utility;
|
||||
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
|
||||
|
@ -10,14 +10,14 @@ public class GlHelper {
|
|||
if (position == null)
|
||||
return;
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.translated(position.x, position.y, position.z);
|
||||
GlStateManager.rotated(rotation.y, 0, 1, 0);
|
||||
GlStateManager.rotated(rotation.z, 1, 0, 0);
|
||||
GlStateManager.rotated(rotation.x, 0, 0, 1);
|
||||
GlStateManager.scaled(scale, scale, scale);
|
||||
RenderSystem.pushMatrix();
|
||||
RenderSystem.translated(position.x, position.y, position.z);
|
||||
RenderSystem.rotatef((float) rotation.y, 0, 1, 0);
|
||||
RenderSystem.rotatef((float) rotation.z, 1, 0, 0);
|
||||
RenderSystem.rotatef((float) rotation.x, 0, 0, 1);
|
||||
RenderSystem.scaled(scale, scale, scale);
|
||||
render.run();
|
||||
GlStateManager.popMatrix();
|
||||
RenderSystem.popMatrix();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package com.simibubi.create.foundation.utility;
|
||||
|
||||
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 net.minecraft.block.BlockRenderType;
|
||||
import net.minecraft.block.BlockState;
|
||||
|
@ -24,12 +26,12 @@ public class IndependentShadowRenderer {
|
|||
private static final ResourceLocation SHADOW_TEXTURES = new ResourceLocation("textures/misc/shadow.png");
|
||||
|
||||
public static void renderShadow(double x, double y, double z, float shadowAlpha, float size) {
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.enableAlphaTest();
|
||||
GlStateManager.blendFunc(GlStateManager.SourceFactor.DST_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA);
|
||||
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;
|
||||
GlStateManager.depthMask(false);
|
||||
RenderSystem.depthMask(false);
|
||||
int i = MathHelper.floor(x - size);
|
||||
int j = MathHelper.floor(x + size);
|
||||
int k = MathHelper.floor(y - size);
|
||||
|
@ -49,9 +51,9 @@ public class IndependentShadowRenderer {
|
|||
}
|
||||
|
||||
tessellator.draw();
|
||||
GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
GlStateManager.disableBlend();
|
||||
GlStateManager.depthMask(true);
|
||||
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_,
|
||||
|
@ -79,13 +81,13 @@ public class IndependentShadowRenderer {
|
|||
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.pos(d1, d3, d4).tex((double) f, (double) f2).color(1.0F, 1.0F, 1.0F, (float) d0)
|
||||
bufferbuilder.vertex(d1, d3, d4).texture(f, f2).color(1.0F, 1.0F, 1.0F, (float) d0)
|
||||
.endVertex();
|
||||
bufferbuilder.pos(d1, d3, d5).tex((double) f, (double) f3).color(1.0F, 1.0F, 1.0F, (float) d0)
|
||||
bufferbuilder.vertex(d1, d3, d5).texture(f, f3).color(1.0F, 1.0F, 1.0F, (float) d0)
|
||||
.endVertex();
|
||||
bufferbuilder.pos(d2, d3, d5).tex((double) f1, (double) f3).color(1.0F, 1.0F, 1.0F, (float) d0)
|
||||
bufferbuilder.vertex(d2, d3, d5).texture(f1, f3).color(1.0F, 1.0F, 1.0F, (float) d0)
|
||||
.endVertex();
|
||||
bufferbuilder.pos(d2, d3, d4).tex((double) f1, (double) f2).color(1.0F, 1.0F, 1.0F, (float) d0)
|
||||
bufferbuilder.vertex(d2, d3, d4).texture(f1, f2).color(1.0F, 1.0F, 1.0F, (float) d0)
|
||||
.endVertex();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -49,12 +49,12 @@ public class NBTHelper {
|
|||
|
||||
public static ListNBT writeAABB(AxisAlignedBB bb) {
|
||||
ListNBT bbtag = new ListNBT();
|
||||
bbtag.add(new FloatNBT((float) bb.minX));
|
||||
bbtag.add(new FloatNBT((float) bb.minY));
|
||||
bbtag.add(new FloatNBT((float) bb.minZ));
|
||||
bbtag.add(new FloatNBT((float) bb.maxX));
|
||||
bbtag.add(new FloatNBT((float) bb.maxY));
|
||||
bbtag.add(new FloatNBT((float) bb.maxZ));
|
||||
bbtag.add(FloatNBT.of((float) bb.minX));
|
||||
bbtag.add(FloatNBT.of((float) bb.minY));
|
||||
bbtag.add(FloatNBT.of((float) bb.minZ));
|
||||
bbtag.add(FloatNBT.of((float) bb.maxX));
|
||||
bbtag.add(FloatNBT.of((float) bb.maxY));
|
||||
bbtag.add(FloatNBT.of((float) bb.maxZ));
|
||||
return bbtag;
|
||||
}
|
||||
|
||||
|
|
|
@ -43,9 +43,9 @@ public class RaycastHelper {
|
|||
}
|
||||
|
||||
private static Vec3d getTraceOrigin(PlayerEntity playerIn) {
|
||||
double d0 = playerIn.posX;
|
||||
double d1 = playerIn.posY + (double) playerIn.getEyeHeight();
|
||||
double d2 = playerIn.posZ;
|
||||
double d0 = playerIn.getX();
|
||||
double d1 = playerIn.getY() + (double) playerIn.getEyeHeight();
|
||||
double d2 = playerIn.getZ();
|
||||
Vec3d vec3d = new Vec3d(d0, d1, d2);
|
||||
return vec3d;
|
||||
}
|
||||
|
|
|
@ -2,7 +2,9 @@ package com.simibubi.create.foundation.utility;
|
|||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
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 net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.ActiveRenderInfo;
|
||||
|
@ -20,30 +22,30 @@ public class TessellatorHelper {
|
|||
|
||||
public static void prepareForDrawing() {
|
||||
Minecraft mc = Minecraft.getInstance();
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.pushLightingAttributes();
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.enableAlphaTest();
|
||||
GlStateManager.color4f(1, 1, 1, 1);
|
||||
RenderSystem.pushMatrix();
|
||||
RenderSystem.pushLightingAttributes();
|
||||
RenderSystem.enableBlend();
|
||||
RenderSystem.enableAlphaTest();
|
||||
RenderSystem.color4f(1, 1, 1, 1);
|
||||
|
||||
ActiveRenderInfo renderInfo = mc.gameRenderer.getActiveRenderInfo();
|
||||
Vec3d view = renderInfo.getProjectedView();
|
||||
GlStateManager.translated(-view.x, -view.y, -view.z);
|
||||
RenderSystem.translated(-view.x, -view.y, -view.z);
|
||||
}
|
||||
|
||||
public static void prepareFastRender() {
|
||||
Minecraft.getInstance().textureManager.bindTexture(AtlasTexture.LOCATION_BLOCKS_TEXTURE);
|
||||
net.minecraft.client.renderer.RenderHelper.disableStandardItemLighting();
|
||||
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.disableCull();
|
||||
RenderSystem.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
RenderSystem.enableBlend();
|
||||
RenderSystem.disableCull();
|
||||
|
||||
if (net.minecraft.client.Minecraft.isAmbientOcclusionEnabled())
|
||||
GlStateManager.shadeModel(GL11.GL_SMOOTH);
|
||||
RenderSystem.shadeModel(GL11.GL_SMOOTH);
|
||||
else
|
||||
GlStateManager.shadeModel(GL11.GL_FLAT);
|
||||
RenderSystem.shadeModel(GL11.GL_FLAT);
|
||||
|
||||
GlStateManager.color3f(1, 1, 1);
|
||||
RenderSystem.color3f(1, 1, 1);
|
||||
}
|
||||
|
||||
public static void fightZFighting(int id) {
|
||||
|
@ -52,7 +54,7 @@ public class TessellatorHelper {
|
|||
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;
|
||||
GlStateManager.translatef(xNudge, yNudge, zNudge);
|
||||
RenderSystem.translatef(xNudge, yNudge, zNudge);
|
||||
}
|
||||
|
||||
public static void begin() {
|
||||
|
@ -68,66 +70,63 @@ public class TessellatorHelper {
|
|||
}
|
||||
|
||||
public static void cleanUpAfterDrawing() {
|
||||
GlStateManager.disableAlphaTest();
|
||||
GlStateManager.disableBlend();
|
||||
GlStateManager.popAttributes();
|
||||
GlStateManager.popMatrix();
|
||||
RenderSystem.disableAlphaTest();
|
||||
RenderSystem.disableBlend();
|
||||
RenderSystem.popAttributes();
|
||||
RenderSystem.popMatrix();
|
||||
}
|
||||
|
||||
public static void drawString(String str, float x, float y, float z, boolean scalesUp, boolean hasDepth) {
|
||||
Minecraft mc = Minecraft.getInstance();
|
||||
float pitch = mc.getRenderManager().playerViewX;
|
||||
float yaw = mc.getRenderManager().playerViewY;
|
||||
ActiveRenderInfo view = mc.gameRenderer.getActiveRenderInfo();
|
||||
float pitch = view.getPitch();
|
||||
float yaw = view.getYaw();
|
||||
boolean isThirdPersonFrontal = mc.gameSettings.thirdPersonView == 2;
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.pushLightingAttributes();
|
||||
GlStateManager.translatef(x, y, z);
|
||||
GlStateManager.normal3f(0.0F, 1.0F, 0.0F);
|
||||
GlStateManager.rotatef(-yaw, 0.0F, 1.0F, 0.0F);
|
||||
GlStateManager.rotatef((float) (isThirdPersonFrontal ? -1 : 1) * pitch, 1.0F, 0.0F, 0.0F);
|
||||
GlStateManager.scalef(-0.025F, -0.025F, 0.025F);
|
||||
GlStateManager.disableLighting();
|
||||
RenderSystem.pushMatrix();
|
||||
RenderSystem.pushLightingAttributes();
|
||||
RenderSystem.translatef(x, y, z);
|
||||
RenderSystem.normal3f(0.0F, 1.0F, 0.0F);
|
||||
RenderSystem.rotatef(-yaw, 0.0F, 1.0F, 0.0F);
|
||||
RenderSystem.rotatef((float) (isThirdPersonFrontal ? -1 : 1) * pitch, 1.0F, 0.0F, 0.0F);
|
||||
RenderSystem.scalef(-0.025F, -0.025F, 0.025F);
|
||||
RenderSystem.disableLighting();
|
||||
if (!hasDepth) {
|
||||
GlStateManager.depthMask(false);
|
||||
GlStateManager.disableDepthTest();
|
||||
RenderSystem.depthMask(false);
|
||||
RenderSystem.disableDepthTest();
|
||||
}
|
||||
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.blendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA,
|
||||
GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE,
|
||||
GlStateManager.DestFactor.ZERO);
|
||||
RenderSystem.enableBlend();
|
||||
RenderSystem.blendFuncSeparate(SourceFactor.SRC_ALPHA, DestFactor.ONE_MINUS_SRC_ALPHA, SourceFactor.ONE, DestFactor.ZERO);
|
||||
int i = mc.fontRenderer.getStringWidth(str) / 2;
|
||||
GlStateManager.disableTexture();
|
||||
RenderSystem.disableTexture();
|
||||
Tessellator tessellator = Tessellator.getInstance();
|
||||
BufferBuilder bufferbuilder = tessellator.getBuffer();
|
||||
bufferbuilder.begin(7, DefaultVertexFormats.POSITION_COLOR);
|
||||
bufferbuilder.pos((double) (-i - 3), (double) (-3), 0.0D).color(1F, 1F, 1F, .5F).endVertex();
|
||||
bufferbuilder.pos((double) (-i - 3), (double) (10), 0.0D).color(1F, 1F, 1F, .5F).endVertex();
|
||||
bufferbuilder.pos((double) (i + 3), (double) (10), 0.0D).color(1F, 1F, 1F, .5F).endVertex();
|
||||
bufferbuilder.pos((double) (i + 3), (double) (-3), 0.0D).color(1F, 1F, 1F, .5F).endVertex();
|
||||
bufferbuilder.vertex((double) (-i - 3), (double) (-3), 0.0D).color(1F, 1F, 1F, .5F).endVertex();
|
||||
bufferbuilder.vertex((double) (-i - 3), (double) (10), 0.0D).color(1F, 1F, 1F, .5F).endVertex();
|
||||
bufferbuilder.vertex((double) (i + 3), (double) (10), 0.0D).color(1F, 1F, 1F, .5F).endVertex();
|
||||
bufferbuilder.vertex((double) (i + 3), (double) (-3), 0.0D).color(1F, 1F, 1F, .5F).endVertex();
|
||||
|
||||
if (scalesUp) {
|
||||
double distance = mc.player.getEyePosition(mc.getRenderPartialTicks()).squareDistanceTo(x, y, z);
|
||||
double scale = distance * fontScale;
|
||||
GlStateManager.scaled(2 + scale, 2 + scale, 2 + scale);
|
||||
RenderSystem.scaled(2 + scale, 2 + scale, 2 + scale);
|
||||
}
|
||||
tessellator.draw();
|
||||
GlStateManager.enableTexture();
|
||||
RenderSystem.enableTexture();
|
||||
if (hasDepth) {
|
||||
GlStateManager.translatef(0, 0, -0.125f);
|
||||
RenderSystem.translatef(0, 0, -0.125f);
|
||||
}
|
||||
|
||||
mc.fontRenderer.drawString(str, -mc.fontRenderer.getStringWidth(str) / 2, 0, 0);
|
||||
GlStateManager.enableDepthTest();
|
||||
RenderSystem.enableDepthTest();
|
||||
|
||||
GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
GlStateManager.depthMask(true);
|
||||
GlStateManager.blendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA,
|
||||
GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.SRC_ALPHA,
|
||||
GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA);
|
||||
GlStateManager.popMatrix();
|
||||
GlStateManager.popAttributes();
|
||||
RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
RenderSystem.depthMask(true);
|
||||
RenderSystem.blendFuncSeparate(SourceFactor.SRC_ALPHA, DestFactor.ONE_MINUS_SRC_ALPHA, SourceFactor.SRC_ALPHA, DestFactor.ONE_MINUS_SRC_ALPHA);
|
||||
RenderSystem.popMatrix();
|
||||
RenderSystem.popAttributes();
|
||||
}
|
||||
|
||||
public static void cube(BufferBuilder bufferBuilder, BlockPos pos, BlockPos size, double scale,
|
||||
|
@ -246,7 +245,7 @@ public class TessellatorHelper {
|
|||
}
|
||||
|
||||
private static void posTexShift(BufferBuilder bufferBuilder, Vec3d shift, BlockPos pos, double u, double v) {
|
||||
bufferBuilder.pos(shift.x + pos.getX(), shift.y + pos.getY(), shift.z + pos.getZ()).tex(u, v).endVertex();
|
||||
bufferBuilder.vertex(shift.x + pos.getX(), shift.y + pos.getY(), shift.z + pos.getZ()).texture((float) u, (float) v).endVertex();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -62,9 +62,9 @@ public class VecHelper {
|
|||
|
||||
public static ListNBT writeNBT(Vec3d vec) {
|
||||
ListNBT listnbt = new ListNBT();
|
||||
listnbt.add(new DoubleNBT(vec.x));
|
||||
listnbt.add(new DoubleNBT(vec.y));
|
||||
listnbt.add(new DoubleNBT(vec.z));
|
||||
listnbt.add(DoubleNBT.of(vec.x));
|
||||
listnbt.add(DoubleNBT.of(vec.y));
|
||||
listnbt.add(DoubleNBT.of(vec.z));
|
||||
return listnbt;
|
||||
}
|
||||
|
||||
|
|
|
@ -16,6 +16,7 @@ import net.minecraft.util.SoundEvent;
|
|||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.ITickList;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
import net.minecraft.world.storage.MapData;
|
||||
|
||||
public class WrappedWorld extends World {
|
||||
|
@ -38,11 +39,6 @@ public class WrappedWorld extends World {
|
|||
return 15;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLightSubtracted(BlockPos pos, int amount) {
|
||||
return 15 - amount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void notifyBlockUpdate(BlockPos pos, BlockState oldState, BlockState newState, int flags) {
|
||||
world.notifyBlockUpdate(pos, oldState, newState, flags);
|
||||
|
@ -126,4 +122,9 @@ public class WrappedWorld extends World {
|
|||
return 256;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Biome getGeneratorStoredBiome(int p_225604_1_, int p_225604_2_, int p_225604_3_) {
|
||||
return world.getGeneratorStoredBiome(p_225604_1_, p_225604_2_, p_225604_3_);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ public enum AllWorldFeatures {
|
|||
;
|
||||
|
||||
public IFeature feature;
|
||||
private Map<Biome, ConfiguredFeature<?>> featureInstances;
|
||||
private Map<Biome, ConfiguredFeature<?, ?>> featureInstances;
|
||||
|
||||
AllWorldFeatures(IFeature feature) {
|
||||
this.feature = feature;
|
||||
|
@ -47,7 +47,7 @@ public enum AllWorldFeatures {
|
|||
if (entry.featureInstances.containsKey(biome))
|
||||
biome.getFeatures(entry.feature.getGenerationStage()).remove(entry.featureInstances.remove(biome));
|
||||
|
||||
Optional<ConfiguredFeature<?>> createFeature = entry.feature.createFeature(biome);
|
||||
Optional<ConfiguredFeature<?, ?>> createFeature = entry.feature.createFeature(biome);
|
||||
if (!createFeature.isPresent())
|
||||
continue;
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ public interface IFeature {
|
|||
|
||||
public void addToConfig(ForgeConfigSpec.Builder builder);
|
||||
|
||||
public Optional<ConfiguredFeature<?>> createFeature(Biome biome);
|
||||
public Optional<ConfiguredFeature<?, ?>> createFeature(Biome biome);
|
||||
|
||||
public Decoration getGenerationStage();
|
||||
|
||||
|
|
|
@ -57,17 +57,16 @@ public abstract class OreFeature<T extends IPlacementConfig> extends ConfigBase
|
|||
}
|
||||
|
||||
@Override
|
||||
public Optional<ConfiguredFeature<?>> createFeature(Biome biome) {
|
||||
public Optional<ConfiguredFeature<?, ?>> createFeature(Biome biome) {
|
||||
if (biomeWhitelist != null && biome.getCategory() == biomeWhitelist)
|
||||
return Optional.empty();
|
||||
if (!canGenerate())
|
||||
return Optional.empty();
|
||||
|
||||
Pair<Placement<T>, T> placement = getPlacement();
|
||||
ConfiguredFeature<?> createdFeature = Biome.createDecoratedFeature(Feature.ORE,
|
||||
new OreFeatureConfig(OreFeatureConfig.FillerBlockType.NATURAL_STONE, block.getDefaultState(),
|
||||
clusterSize.get()),
|
||||
placement.getKey(), placement.getValue());
|
||||
ConfiguredFeature<?, ?> createdFeature = Feature.ORE
|
||||
.configure(new OreFeatureConfig(OreFeatureConfig.FillerBlockType.NATURAL_STONE, block.getDefaultState(), clusterSize.get()))
|
||||
.createDecoratedFeature(placement.getKey().configure(placement.getValue()));
|
||||
|
||||
return Optional.of(createdFeature);
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ import net.minecraft.state.StateContainer.Builder;
|
|||
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 OxidizingBlock extends Block {
|
||||
|
||||
|
@ -35,7 +35,7 @@ public class OxidizingBlock extends Block {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void randomTick(BlockState state, World worldIn, BlockPos pos, Random random) {
|
||||
public void randomTick(BlockState state, ServerWorld worldIn, BlockPos pos, Random random) {
|
||||
if (worldIn.getRandom().nextFloat() <= chance) {
|
||||
int currentState = state.get(OXIDIZATION);
|
||||
boolean canIncrease = false;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package com.simibubi.create.modules.contraptions;
|
||||
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.simibubi.create.config.AllConfigs;
|
||||
import com.simibubi.create.foundation.utility.TessellatorHelper;
|
||||
import com.simibubi.create.modules.contraptions.base.KineticTileEntity;
|
||||
|
@ -29,18 +29,18 @@ public class KineticDebugger {
|
|||
VoxelShape shape = world.getBlockState(toOutline).getShape(world, toOutline);
|
||||
|
||||
TessellatorHelper.prepareForDrawing();
|
||||
GlStateManager.disableTexture();
|
||||
GlStateManager.lineWidth(3);
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.translated(toOutline.getX(), toOutline.getY(), toOutline.getZ());
|
||||
RenderSystem.disableTexture();
|
||||
RenderSystem.lineWidth(3);
|
||||
RenderSystem.pushMatrix();
|
||||
RenderSystem.translated(toOutline.getX(), toOutline.getY(), toOutline.getZ());
|
||||
float f = 1 + 1 / 128f;
|
||||
GlStateManager.scaled(f, f, f);
|
||||
RenderSystem.scaled(f, f, f);
|
||||
|
||||
WorldRenderer.drawShape(shape, 0, 0, 0, te.hasSource() ? .5f : 1, .75f, .75f, 1);
|
||||
|
||||
GlStateManager.popMatrix();
|
||||
GlStateManager.lineWidth(1);
|
||||
GlStateManager.enableTexture();
|
||||
RenderSystem.popMatrix();
|
||||
RenderSystem.lineWidth(1);
|
||||
RenderSystem.enableTexture();
|
||||
TessellatorHelper.cleanUpAfterDrawing();
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package com.simibubi.create.modules.contraptions;
|
||||
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.simibubi.create.foundation.utility.AnimationTickHolder;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
|
@ -17,21 +17,21 @@ public class WrenchItemRenderer extends ItemStackTileEntityRenderer {
|
|||
WrenchModel mainModel = (WrenchModel) itemRenderer.getModelWithOverrides(stack);
|
||||
float worldTime = AnimationTickHolder.getRenderTick();
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.translatef(0.5F, 0.5F, 0.5F);
|
||||
RenderSystem.pushMatrix();
|
||||
RenderSystem.translatef(0.5F, 0.5F, 0.5F);
|
||||
itemRenderer.renderItem(stack, mainModel.getBakedModel());
|
||||
|
||||
float angle = worldTime * -.5f % 360;
|
||||
|
||||
float xOffset = -1/32f;
|
||||
float zOffset = 0;
|
||||
GlStateManager.translatef(-xOffset, 0, -zOffset);
|
||||
GlStateManager.rotated(angle, 0, 1, 0);
|
||||
GlStateManager.translatef(xOffset, 0, zOffset);
|
||||
RenderSystem.translatef(-xOffset, 0, -zOffset);
|
||||
RenderSystem.rotated(angle, 0, 1, 0);
|
||||
RenderSystem.translatef(xOffset, 0, zOffset);
|
||||
|
||||
itemRenderer.renderItem(stack, mainModel.getPartial("gear"));
|
||||
|
||||
GlStateManager.popMatrix();
|
||||
RenderSystem.popMatrix();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ public abstract class DirectionalAxisKineticBlock extends DirectionalKineticBloc
|
|||
|
||||
protected Direction getFacingForPlacement(BlockItemUseContext context) {
|
||||
Direction facing = context.getNearestLookingDirection().getOpposite();
|
||||
if (context.isPlacerSneaking())
|
||||
if (context.getPlayer().isSneaking())
|
||||
facing = facing.getOpposite();
|
||||
return facing;
|
||||
}
|
||||
|
|
|
@ -66,10 +66,10 @@ public abstract class DirectionalKineticBlock extends KineticBlock {
|
|||
@Override
|
||||
public BlockState getStateForPlacement(BlockItemUseContext context) {
|
||||
Direction preferred = getPreferredFacing(context);
|
||||
if (preferred == null || context.isPlacerSneaking()) {
|
||||
if (preferred == null || context.getPlayer().isSneaking()) {
|
||||
Direction nearestLookingDirection = context.getNearestLookingDirection();
|
||||
return getDefaultState().with(FACING,
|
||||
context.isPlacerSneaking() ? nearestLookingDirection : nearestLookingDirection.getOpposite());
|
||||
context.getPlayer().isSneaking() ? nearestLookingDirection : nearestLookingDirection.getOpposite());
|
||||
}
|
||||
return getDefaultState().with(FACING, preferred.getOpposite());
|
||||
}
|
||||
|
|
|
@ -10,7 +10,6 @@ import net.minecraft.entity.LivingEntity;
|
|||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockRenderLayer;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.Direction.Axis;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
@ -105,18 +104,13 @@ public abstract class KineticBlock extends Block implements IRotate {
|
|||
RotationPropagator.handleAdded(worldIn.getWorld(), pos, tileEntity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canRenderInLayer(BlockState state, BlockRenderLayer layer) {
|
||||
return hasStaticPart() && layer == getRenderLayer();
|
||||
}
|
||||
// @Override // TODO register layer
|
||||
// public boolean canRenderInLayer(BlockState state, BlockRenderLayer layer) {
|
||||
// return hasStaticPart() && layer == getRenderLayer();
|
||||
// }
|
||||
|
||||
protected abstract boolean hasStaticPart();
|
||||
|
||||
@Override
|
||||
public boolean isSolid(BlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World worldIn, BlockPos pos, BlockState state, LivingEntity placer, ItemStack stack) {
|
||||
TileEntity tileEntity = worldIn.getTileEntity(pos);
|
||||
|
|
|
@ -66,9 +66,9 @@ public abstract class RotatedPillarKineticBlock extends KineticBlock {
|
|||
@Override
|
||||
public BlockState getStateForPlacement(BlockItemUseContext context) {
|
||||
Axis preferredAxis = getPreferredAxis(context);
|
||||
if (preferredAxis != null && !context.isPlacerSneaking())
|
||||
if (preferredAxis != null && !context.getPlayer().isSneaking())
|
||||
return this.getDefaultState().with(AXIS, preferredAxis);
|
||||
return this.getDefaultState().with(AXIS, context.isPlacerSneaking() ? context.getFace().getAxis()
|
||||
return this.getDefaultState().with(AXIS, context.getPlayer().isSneaking() ? context.getFace().getAxis()
|
||||
: context.getNearestLookingDirection().getAxis());
|
||||
}
|
||||
|
||||
|
|
|
@ -13,7 +13,6 @@ import net.minecraft.block.material.PushReaction;
|
|||
import net.minecraft.item.BlockItemUseContext;
|
||||
import net.minecraft.state.StateContainer.Builder;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockRenderLayer;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.shapes.ISelectionContext;
|
||||
|
@ -56,10 +55,10 @@ public class HarvesterBlock extends HorizontalBlock implements IPortableBlock {
|
|||
super.fillStateContainer(builder);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockRenderLayer getRenderLayer() {
|
||||
return BlockRenderLayer.CUTOUT;
|
||||
}
|
||||
// @Override // TOOD 1.15 register layer
|
||||
// public BlockRenderLayer getRenderLayer() {
|
||||
// return BlockRenderLayer.CUTOUT;
|
||||
// }
|
||||
|
||||
@Override
|
||||
public boolean isValidPosition(BlockState state, IWorldReader worldIn, BlockPos pos) {
|
||||
|
|
|
@ -2,8 +2,9 @@ package com.simibubi.create.modules.contraptions.components.actors;
|
|||
|
||||
import static net.minecraft.state.properties.BlockStateProperties.HORIZONTAL_FACING;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.simibubi.create.AllBlockPartials;
|
||||
import com.simibubi.create.foundation.block.SafeTileEntityRendererFast;
|
||||
import com.simibubi.create.foundation.block.SafeTileEntityRenderer;
|
||||
import com.simibubi.create.foundation.utility.AnimationTickHolder;
|
||||
import com.simibubi.create.foundation.utility.SuperByteBuffer;
|
||||
import com.simibubi.create.foundation.utility.VecHelper;
|
||||
|
@ -11,18 +12,25 @@ import com.simibubi.create.modules.contraptions.components.contraptions.Movement
|
|||
|
||||
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.tileentity.TileEntityRendererDispatcher;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.Direction.Axis;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class HarvesterTileEntityRenderer extends SafeTileEntityRendererFast<HarvesterTileEntity> {
|
||||
public class HarvesterTileEntityRenderer extends SafeTileEntityRenderer<HarvesterTileEntity> {
|
||||
|
||||
public HarvesterTileEntityRenderer(TileEntityRendererDispatcher dispatcher) {
|
||||
super(dispatcher);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderFast(HarvesterTileEntity te, double x, double y, double z, float partialTicks, int destroyStage,
|
||||
BufferBuilder buffer) {
|
||||
SuperByteBuffer superBuffer = renderHead(getWorld(), te.getPos(), te.getBlockState(), 0);
|
||||
superBuffer.translate(x, y, z).renderInto(buffer);
|
||||
protected void renderSafe(HarvesterTileEntity te, float partialTicks, MatrixStack ms, IRenderTypeBuffer buffer,
|
||||
int light, int overlay) {
|
||||
SuperByteBuffer superBuffer = renderHead(te.getWorld(), te.getPos(), te.getBlockState(), 0);
|
||||
superBuffer.renderInto(ms, buffer.getBuffer(RenderType.getSolid()));
|
||||
}
|
||||
|
||||
public static SuperByteBuffer renderInContraption(MovementContext context) {
|
||||
|
|
|
@ -10,10 +10,9 @@ import net.minecraft.item.BlockItemUseContext;
|
|||
import net.minecraft.item.ItemGroup;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockRenderLayer;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.Direction.Axis;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockReader;
|
||||
import net.minecraft.world.IWorldReader;
|
||||
|
@ -32,10 +31,10 @@ public class CuckooClockBlock extends HorizontalKineticBlock {
|
|||
return new CuckooClockTileEntity();
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockRenderLayer getRenderLayer() {
|
||||
return BlockRenderLayer.CUTOUT;
|
||||
}
|
||||
// @Override // TOOD 1.15 register layer
|
||||
// public BlockRenderLayer getRenderLayer() {
|
||||
// return BlockRenderLayer.CUTOUT;
|
||||
// }
|
||||
|
||||
@Override
|
||||
public void fillItemGroup(ItemGroup group, NonNullList<ItemStack> items) {
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.simibubi.create.modules.contraptions.components.clock;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.mojang.blaze3d.vertex.IVertexBuilder;
|
||||
import com.simibubi.create.AllBlockPartials;
|
||||
import com.simibubi.create.foundation.utility.AngleHelper;
|
||||
import com.simibubi.create.foundation.utility.SuperByteBuffer;
|
||||
|
@ -11,6 +12,7 @@ import com.simibubi.create.modules.contraptions.components.clock.CuckooClockTile
|
|||
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.tileentity.TileEntityRendererDispatcher;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.Direction.Axis;
|
||||
|
@ -31,16 +33,18 @@ public class CuckooClockRenderer extends KineticTileEntityRenderer {
|
|||
|
||||
CuckooClockTileEntity clock = (CuckooClockTileEntity) te;
|
||||
BlockState blockState = te.getBlockState();
|
||||
int light = blockState.getPackedLightmapCoords(getWorld(), te.getPos());
|
||||
int packedLightmapCoords = blockState.getPackedLightmapCoords(te.getWorld(), te.getPos());
|
||||
Direction direction = blockState.get(CuckooClockBlock.HORIZONTAL_FACING);
|
||||
|
||||
IVertexBuilder vb = buffer.getBuffer(RenderType.getSolid());
|
||||
|
||||
// Render Hands
|
||||
SuperByteBuffer hourHand = AllBlockPartials.CUCKOO_HOUR_HAND.renderOn(blockState);
|
||||
SuperByteBuffer minuteHand = AllBlockPartials.CUCKOO_MINUTE_HAND.renderOn(blockState);
|
||||
float hourAngle = clock.hourHand.get(partialTicks);
|
||||
float minuteAngle = clock.minuteHand.get(partialTicks);
|
||||
rotateHand(hourHand, hourAngle, direction).translate(x, y, z).light(light).renderInto(buffer);
|
||||
rotateHand(minuteHand, minuteAngle, direction).translate(x, y, z).light(light).renderInto(buffer);
|
||||
rotateHand(hourHand, hourAngle, direction).light(packedLightmapCoords).renderInto(ms, vb);
|
||||
rotateHand(minuteHand, minuteAngle, direction).light(packedLightmapCoords).renderInto(ms, vb);
|
||||
|
||||
// Doors
|
||||
SuperByteBuffer leftDoor = AllBlockPartials.CUCKOO_LEFT_DOOR.renderOn(blockState);
|
||||
|
@ -65,8 +69,8 @@ public class CuckooClockRenderer extends KineticTileEntityRenderer {
|
|||
}
|
||||
}
|
||||
|
||||
rotateDoor(leftDoor, angle, true, direction).translate(x, y, z).light(light).renderInto(buffer);
|
||||
rotateDoor(rightDoor, angle, false, direction).translate(x, y, z).light(light).renderInto(buffer);
|
||||
rotateDoor(leftDoor, angle, true, direction).light(packedLightmapCoords).renderInto(ms, vb);
|
||||
rotateDoor(rightDoor, angle, false, direction).light(packedLightmapCoords).renderInto(ms, vb);
|
||||
|
||||
// Figure
|
||||
if (clock.animationType != null) {
|
||||
|
@ -75,7 +79,7 @@ public class CuckooClockRenderer extends KineticTileEntityRenderer {
|
|||
: AllBlockPartials.CUCKOO_CREEPER).renderOn(blockState);
|
||||
figure.translate(offset, 0, 0);
|
||||
figure.rotateCentered(Axis.Y, AngleHelper.rad(AngleHelper.horizontalAngle(direction.rotateYCCW())));
|
||||
figure.translate(x, y, z).light(light).renderInto(buffer);
|
||||
figure.light(packedLightmapCoords).renderInto(ms, vb);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ public class CancelPlayerFallPacket extends SimplePacketBase {
|
|||
public void handle(Supplier<Context> context) {
|
||||
context.get().enqueueWork(() -> {
|
||||
ServerPlayerEntity sender = context.get().getSender();
|
||||
sender.fall(sender.fallDistance, 1.0F);
|
||||
sender.handleFallDamage(sender.fallDistance, 1.0F);
|
||||
sender.fallDistance = 0;
|
||||
sender.onGround = true;
|
||||
});
|
||||
|
|
|
@ -9,7 +9,7 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.simibubi.create.AllItems;
|
||||
import com.simibubi.create.AllKeys;
|
||||
import com.simibubi.create.foundation.utility.TessellatorHelper;
|
||||
|
@ -173,20 +173,20 @@ public class ChassisRangeDisplay {
|
|||
}
|
||||
|
||||
public static void renderOutlines(float partialTicks) {
|
||||
GlStateManager.lineWidth(2);
|
||||
RenderSystem.lineWidth(2);
|
||||
TessellatorHelper.prepareForDrawing();
|
||||
GlStateManager.disableTexture();
|
||||
GlStateManager.enableAlphaTest();
|
||||
RenderSystem.disableTexture();
|
||||
RenderSystem.enableAlphaTest();
|
||||
|
||||
for (Entry entry : entries.values())
|
||||
renderPositions(entry, partialTicks);
|
||||
for (Entry groupEntry : groupEntries)
|
||||
renderPositions(groupEntry, partialTicks);
|
||||
|
||||
GlStateManager.enableTexture();
|
||||
GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA);
|
||||
RenderSystem.enableTexture();
|
||||
RenderSystem.blendFunc(SourceFactor.SRC_ALPHA, DestFactor.ONE_MINUS_SRC_ALPHA);
|
||||
TessellatorHelper.cleanUpAfterDrawing();
|
||||
GlStateManager.lineWidth(1);
|
||||
RenderSystem.lineWidth(1);
|
||||
}
|
||||
|
||||
public static void renderPositions(Entry entry, float partialTicks) {
|
||||
|
@ -194,7 +194,7 @@ public class ChassisRangeDisplay {
|
|||
BlockPos size = new BlockPos(1, 1, 1);
|
||||
float timer = entry.timer - partialTicks;
|
||||
float alpha = timer > 20 ? .5f : timer / 40f;
|
||||
GlStateManager.color4f(1, .7f, 0, alpha);
|
||||
RenderSystem.color4f(1, .7f, 0, alpha);
|
||||
Set<BlockPos> includedPositions = entry.includedPositions;
|
||||
for (BlockPos pos : includedPositions)
|
||||
TessellatorHelper.cube(Tessellator.getInstance().getBuffer(), pos, size, 1 / 1024f, true, false);
|
||||
|
|
|
@ -73,7 +73,7 @@ public class ContraptionCollider {
|
|||
if (allowedMovement.equals(relativeMotion))
|
||||
continue;
|
||||
if (allowedMovement.y != relativeMotion.y) {
|
||||
entity.fall(entity.fallDistance, 1);
|
||||
entity.handleFallDamage(entity.fallDistance, 1);
|
||||
entity.fallDistance = 0;
|
||||
entity.onGround = true;
|
||||
DistExecutor.runWhenOn(Dist.CLIENT, () -> () -> checkForClientPlayerCollision(entity));
|
||||
|
@ -142,7 +142,7 @@ public class ContraptionCollider {
|
|||
if (bestSide == Direction.UP)
|
||||
clamped = shapeMotion.y;
|
||||
entity.setMotion(entityMotion.x, clamped, entityMotion.z);
|
||||
entity.fall(entity.fallDistance, 1);
|
||||
entity.handleFallDamage(entity.fallDistance, 1);
|
||||
entity.fallDistance = 0;
|
||||
entity.onGround = true;
|
||||
break;
|
||||
|
|
|
@ -133,7 +133,7 @@ public class ContraptionEntity extends Entity implements IEntityAdditionalSpawnD
|
|||
if (ContraptionCollider.collideBlocks(this))
|
||||
controllerTE.collided();
|
||||
|
||||
tickActors(new Vec3d(posX - prevPosX, posY - prevPosY, posZ - prevPosZ));
|
||||
tickActors(getPositionVec().subtract(prevPosX, prevPosY, prevPosZ));
|
||||
|
||||
prevYaw = yaw;
|
||||
prevPitch = pitch;
|
||||
|
@ -152,7 +152,7 @@ public class ContraptionEntity extends Entity implements IEntityAdditionalSpawnD
|
|||
riding = riding.getRidingEntity();
|
||||
Vec3d movementVector = riding.getMotion();
|
||||
if (riding instanceof BoatEntity)
|
||||
movementVector = new Vec3d(posX - prevPosX, posY - prevPosY, posZ - prevPosZ);
|
||||
movementVector = getPositionVec().subtract(prevPosX, prevPosY, prevPosZ);
|
||||
Vec3d motion = movementVector.normalize();
|
||||
|
||||
if (motion.length() > 0) {
|
||||
|
@ -201,7 +201,7 @@ public class ContraptionEntity extends Entity implements IEntityAdditionalSpawnD
|
|||
Vec3d actorPosition = new Vec3d(blockInfo.pos);
|
||||
actorPosition = actorPosition.add(actor.getActiveAreaOffset(context));
|
||||
actorPosition = VecHelper.rotate(actorPosition, angleRoll, angleYaw, anglePitch);
|
||||
actorPosition = actorPosition.add(rotationOffset).add(posX, posY, posZ);
|
||||
actorPosition = actorPosition.add(rotationOffset).add(getPositionVec());
|
||||
|
||||
boolean newPosVisited = false;
|
||||
BlockPos gridPosition = new BlockPos(actorPosition);
|
||||
|
@ -259,7 +259,7 @@ public class ContraptionEntity extends Entity implements IEntityAdditionalSpawnD
|
|||
if (controllerTE != null)
|
||||
controllerTE.onStall();
|
||||
AllPackets.channel.send(PacketDistributor.TRACKING_ENTITY.with(() -> this),
|
||||
new ContraptionStallPacket(getEntityId(), posX, posY, posZ, yaw, pitch, roll));
|
||||
new ContraptionStallPacket(getEntityId(), getX(), getY(), getZ(), yaw, pitch, roll));
|
||||
}
|
||||
dataManager.set(STALLED, contraption.stalled);
|
||||
} else {
|
||||
|
@ -268,7 +268,7 @@ public class ContraptionEntity extends Entity implements IEntityAdditionalSpawnD
|
|||
}
|
||||
|
||||
public void move(double x, double y, double z) {
|
||||
setPosition(posX + x, posY + y, posZ + z);
|
||||
setPosition(x + getX() + x, getY() + y, getZ() + z);
|
||||
}
|
||||
|
||||
public void rotateTo(double roll, double yaw, double pitch) {
|
||||
|
@ -294,13 +294,11 @@ public class ContraptionEntity extends Entity implements IEntityAdditionalSpawnD
|
|||
Entity riding = e;
|
||||
while (riding.getRidingEntity() != null)
|
||||
riding = riding.getRidingEntity();
|
||||
x = riding.posX - .5;
|
||||
z = riding.posZ - .5;
|
||||
x = riding.getX() - .5;
|
||||
z = riding.getZ() - .5;
|
||||
}
|
||||
|
||||
this.posX = x;
|
||||
this.posY = y;
|
||||
this.posZ = z;
|
||||
this.setPos(x, y, z);
|
||||
|
||||
if (this.isAddedToWorld() && !this.world.isRemote && world instanceof ServerWorld)
|
||||
((ServerWorld) this.world).chunkCheck(this); // Forge - Process chunk registration after moving.
|
||||
|
@ -382,7 +380,7 @@ public class ContraptionEntity extends Entity implements IEntityAdditionalSpawnD
|
|||
controllerTE.attach(this);
|
||||
|
||||
if (world.isRemote)
|
||||
setPosition(posX, posY, posZ);
|
||||
setPosition(getX(), getY(), getZ());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -471,7 +469,7 @@ public class ContraptionEntity extends Entity implements IEntityAdditionalSpawnD
|
|||
vec = vec3d.subtract(stuckTest);
|
||||
if (vec.equals(Vec3d.ZERO))
|
||||
continue;
|
||||
e.setPosition(e.posX + vec.x, e.posY + vec.y, e.posZ + vec.z);
|
||||
e.setPosition(e.getX() + vec.x, e.getY() + vec.y, e.getZ() + vec.z);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -501,9 +499,7 @@ public class ContraptionEntity extends Entity implements IEntityAdditionalSpawnD
|
|||
return;
|
||||
ContraptionEntity ce = (ContraptionEntity) entity;
|
||||
if (ce.getRidingEntity() == null) {
|
||||
ce.posX = packet.x;
|
||||
ce.posY = packet.y;
|
||||
ce.posZ = packet.z;
|
||||
ce.setPos(packet.x, packet.y, packet.z);
|
||||
}
|
||||
ce.yaw = packet.yaw;
|
||||
ce.pitch = packet.pitch;
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
package com.simibubi.create.modules.contraptions.components.contraptions;
|
||||
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.simibubi.create.foundation.utility.TessellatorHelper;
|
||||
import com.simibubi.create.foundation.utility.VecHelper;
|
||||
|
||||
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.entity.EntityRenderer;
|
||||
|
@ -24,24 +26,25 @@ public class ContraptionEntityRenderer extends EntityRenderer<ContraptionEntity>
|
|||
}
|
||||
|
||||
@Override
|
||||
protected ResourceLocation getEntityTexture(ContraptionEntity arg0) {
|
||||
public ResourceLocation getEntityTexture(ContraptionEntity arg0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doRender(ContraptionEntity entity, double x, double y, double z, float yaw, float partialTicks) {
|
||||
public void render(ContraptionEntity entity, float yaw, float partialTicks, MatrixStack ms,
|
||||
IRenderTypeBuffer buffers, int overlay) {
|
||||
if (!entity.isAlive())
|
||||
return;
|
||||
if (entity.getContraption() == null)
|
||||
return;
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
RenderSystem.pushMatrix();
|
||||
long randomBits = (long) entity.getEntityId() * 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;
|
||||
GlStateManager.translatef(xNudge, yNudge, zNudge);
|
||||
RenderSystem.translatef(xNudge, yNudge, zNudge);
|
||||
|
||||
float degYaw = entity.getYaw(partialTicks);
|
||||
float degPitch = entity.getPitch(partialTicks);
|
||||
|
@ -55,9 +58,9 @@ public class ContraptionEntityRenderer extends EntityRenderer<ContraptionEntity>
|
|||
if (ridingEntity != null && ridingEntity instanceof AbstractMinecartEntity) {
|
||||
AbstractMinecartEntity cart = (AbstractMinecartEntity) ridingEntity;
|
||||
|
||||
double cartX = MathHelper.lerp((double) partialTicks, cart.lastTickPosX, cart.posX);
|
||||
double cartY = MathHelper.lerp((double) partialTicks, cart.lastTickPosY, cart.posY);
|
||||
double cartZ = MathHelper.lerp((double) partialTicks, cart.lastTickPosZ, cart.posZ);
|
||||
double cartX = MathHelper.lerp((double) partialTicks, cart.lastTickPosX, cart.getX());
|
||||
double cartY = MathHelper.lerp((double) partialTicks, cart.lastTickPosY, cart.getY());
|
||||
double cartZ = MathHelper.lerp((double) partialTicks, cart.lastTickPosZ, cart.getZ());
|
||||
Vec3d cartPos = cart.getPos(cartX, cartY, cartZ);
|
||||
|
||||
if (cartPos != null) {
|
||||
|
@ -72,13 +75,13 @@ public class ContraptionEntityRenderer extends EntityRenderer<ContraptionEntity>
|
|||
cartY = (cartPosFront.y + cartPosBack.y) / 2.0D - cartY;
|
||||
cartZ = cartPos.z - cartZ;
|
||||
|
||||
GlStateManager.translatef((float) cartX, (float) cartY, (float) cartZ);
|
||||
RenderSystem.translatef((float) cartX, (float) cartY, (float) cartZ);
|
||||
}
|
||||
}
|
||||
|
||||
Vec3d rotationOffset = VecHelper.getCenterOf(BlockPos.ZERO);
|
||||
TessellatorHelper.prepareFastRender();
|
||||
GlStateManager.enableCull();
|
||||
RenderSystem.enableCull();
|
||||
TessellatorHelper.begin(DefaultVertexFormats.BLOCK);
|
||||
ContraptionRenderer.render(entity.world, entity.getContraption(), superByteBuffer -> {
|
||||
superByteBuffer.translate(-rotationOffset.x, -rotationOffset.y, -rotationOffset.z);
|
||||
|
@ -86,33 +89,30 @@ public class ContraptionEntityRenderer extends EntityRenderer<ContraptionEntity>
|
|||
superByteBuffer.rotate(Axis.Y, angleYaw);
|
||||
superByteBuffer.rotate(Axis.Z, anglePitch);
|
||||
superByteBuffer.translate(rotationOffset.x, rotationOffset.y, rotationOffset.z);
|
||||
superByteBuffer.translate(x, y, z);
|
||||
superByteBuffer.offsetLighting(-x + entity.posX, -y + entity.posY, -z + entity.posZ);
|
||||
|
||||
}, Tessellator.getInstance().getBuffer());
|
||||
}, ms, Tessellator.getInstance().getBuffer());
|
||||
TessellatorHelper.draw();
|
||||
|
||||
if (!entity.getContraption().customRenderTEs.isEmpty()) {
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.translated(x, y, z);
|
||||
GlStateManager.translated(rotationOffset.x, rotationOffset.y, rotationOffset.z);
|
||||
GlStateManager.rotated(degPitch, 0, 0, 1);
|
||||
GlStateManager.rotated(degYaw, 0, 1, 0);
|
||||
GlStateManager.rotated(degRoll, 1, 0, 0);
|
||||
GlStateManager.translated(-rotationOffset.x, -rotationOffset.y, -rotationOffset.z);
|
||||
RenderSystem.pushMatrix();
|
||||
RenderSystem.translated(x, y, z);
|
||||
RenderSystem.translated(rotationOffset.x, rotationOffset.y, rotationOffset.z);
|
||||
RenderSystem.rotated(degPitch, 0, 0, 1);
|
||||
RenderSystem.rotated(degYaw, 0, 1, 0);
|
||||
RenderSystem.rotated(degRoll, 1, 0, 0);
|
||||
RenderSystem.translated(-rotationOffset.x, -rotationOffset.y, -rotationOffset.z);
|
||||
ContraptionRenderer.renderTEsWithGL(entity.world, entity.getContraption(), entity.getPositionVec(),
|
||||
new Vec3d(degRoll, degYaw, degPitch));
|
||||
GlStateManager.popMatrix();
|
||||
new Vec3d(degRoll, degYaw, degPitch), ms, buffers);
|
||||
RenderSystem.popMatrix();
|
||||
}
|
||||
|
||||
GlStateManager.disableCull();
|
||||
GlStateManager.popMatrix();
|
||||
GlStateManager.shadeModel(7424);
|
||||
GlStateManager.alphaFunc(516, 0.1F);
|
||||
GlStateManager.matrixMode(5888);
|
||||
RenderSystem.disableCull();
|
||||
RenderSystem.popMatrix();
|
||||
RenderSystem.shadeModel(7424);
|
||||
RenderSystem.alphaFunc(516, 0.1F);
|
||||
RenderSystem.matrixMode(5888);
|
||||
RenderHelper.enableStandardItemLighting();
|
||||
|
||||
super.doRender(entity, x, y, z, yaw, partialTicks);
|
||||
super.render(entity, yaw, partialTicks, ms, buffers, overlay);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -7,15 +7,16 @@ import java.util.function.Consumer;
|
|||
import org.apache.commons.lang3.tuple.Pair;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.mojang.blaze3d.platform.GLX;
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.simibubi.create.Create;
|
||||
import com.simibubi.create.CreateClient;
|
||||
import com.simibubi.create.config.AllConfigs;
|
||||
import com.simibubi.create.foundation.utility.PlacementSimulationWorld;
|
||||
import com.simibubi.create.foundation.utility.SuperByteBuffer;
|
||||
import com.simibubi.create.foundation.utility.VecHelper;
|
||||
import com.simibubi.create.foundation.utility.SuperByteBufferCache.Compartment;
|
||||
import com.simibubi.create.foundation.utility.VecHelper;
|
||||
import com.simibubi.create.foundation.utility.WrappedWorld;
|
||||
|
||||
import net.minecraft.block.BlockRenderType;
|
||||
|
@ -24,14 +25,15 @@ import net.minecraft.client.Minecraft;
|
|||
import net.minecraft.client.renderer.BlockModelRenderer;
|
||||
import net.minecraft.client.renderer.BlockRendererDispatcher;
|
||||
import net.minecraft.client.renderer.BufferBuilder;
|
||||
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.client.renderer.model.IBakedModel;
|
||||
import net.minecraft.client.renderer.texture.OverlayTexture;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
|
||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||
import net.minecraft.crash.ReportedException;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.BlockPos.MutableBlockPos;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.LightType;
|
||||
import net.minecraft.world.World;
|
||||
|
@ -44,27 +46,24 @@ public class ContraptionRenderer {
|
|||
protected static PlacementSimulationWorld renderWorld;
|
||||
protected static LightingWorld lightingWorld;
|
||||
|
||||
public static void render(World world, Contraption c, Consumer<SuperByteBuffer> transform, BufferBuilder buffer) {
|
||||
public static void render(World world, Contraption c, Consumer<SuperByteBuffer> transform, MatrixStack ms, BufferBuilder buffer) {
|
||||
SuperByteBuffer contraptionBuffer = CreateClient.bufferCache.get(CONTRAPTION, c, () -> renderContraption(c));
|
||||
transform.accept(contraptionBuffer);
|
||||
contraptionBuffer.light((lx, ly, lz) -> getLight(world, lx, ly, lz)).renderInto(buffer);
|
||||
renderActors(world, c, transform, buffer);
|
||||
contraptionBuffer.light((lx, ly, lz) -> getLight(world, lx, ly, lz)).renderInto(ms, buffer);
|
||||
renderActors(world, c, transform, ms, buffer);
|
||||
}
|
||||
|
||||
public static void renderTEsWithGL(World world, Contraption c, Vec3d position, Vec3d rotation) {
|
||||
TileEntityRendererDispatcher dispatcher = TileEntityRendererDispatcher.instance;
|
||||
public static void renderTEsWithGL(World world, Contraption c, Vec3d position, Vec3d rotation, MatrixStack ms, IRenderTypeBuffer buffer) {
|
||||
float pt = Minecraft.getInstance().getRenderPartialTicks();
|
||||
World prevDispatcherWorld = dispatcher.world;
|
||||
|
||||
if (lightingWorld == null)
|
||||
lightingWorld = new LightingWorld(world);
|
||||
lightingWorld.setWorld(world);
|
||||
lightingWorld.setTransform(position, rotation);
|
||||
dispatcher.setWorld(lightingWorld);
|
||||
|
||||
for (Iterator<TileEntity> iterator = c.customRenderTEs.iterator(); iterator.hasNext();) {
|
||||
TileEntity tileEntity = iterator.next();
|
||||
if (dispatcher.getRenderer(tileEntity) == null) {
|
||||
if (TileEntityRendererDispatcher.instance.getRenderer(tileEntity) == null) {
|
||||
iterator.remove();
|
||||
continue;
|
||||
}
|
||||
|
@ -77,14 +76,14 @@ public class ContraptionRenderer {
|
|||
int i = lightingWorld.getCombinedLight(pos, 0);
|
||||
int j = i % 65536;
|
||||
int k = i / 65536;
|
||||
GLX.glMultiTexCoord2f(GLX.GL_TEXTURE1, (float) j, (float) k);
|
||||
GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
RenderSystem.glMultiTexCoord2f(GLX.GL_TEXTURE1, (float) j, (float) k);
|
||||
RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
}
|
||||
|
||||
World prevTileWorld = tileEntity.getWorld();
|
||||
tileEntity.setWorld(lightingWorld);
|
||||
dispatcher.render(tileEntity, pos.getX(), pos.getY(), pos.getZ(), pt, -1, true);
|
||||
tileEntity.setWorld(prevTileWorld);
|
||||
tileEntity.setLocation(lightingWorld, pos);
|
||||
TileEntityRendererDispatcher.instance.render(tileEntity, pt, ms, buffer);
|
||||
tileEntity.setLocation(prevTileWorld, pos);
|
||||
|
||||
} catch (ReportedException e) {
|
||||
if (AllConfigs.CLIENT.explainRenderErrors.get()) {
|
||||
|
@ -98,11 +97,9 @@ public class ContraptionRenderer {
|
|||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
dispatcher.setWorld(prevDispatcherWorld);
|
||||
}
|
||||
|
||||
private static SuperByteBuffer renderContraption(Contraption c) {
|
||||
private static SuperByteBuffer renderContraption(Contraption c, MatrixStack ms) {
|
||||
if (renderWorld == null || renderWorld.getWorld() != Minecraft.getInstance().world)
|
||||
renderWorld = new PlacementSimulationWorld(Minecraft.getInstance().world);
|
||||
|
||||
|
@ -122,8 +119,8 @@ public class ContraptionRenderer {
|
|||
continue;
|
||||
|
||||
IBakedModel originalModel = dispatcher.getModelForState(state);
|
||||
blockRenderer.renderModel(renderWorld, originalModel, state, info.pos, builder, true, random, 42,
|
||||
EmptyModelData.INSTANCE);
|
||||
blockRenderer.renderModel(renderWorld, originalModel, state, info.pos, ms, builder, true, random, 42,
|
||||
OverlayTexture.DEFAULT_UV, EmptyModelData.INSTANCE);
|
||||
}
|
||||
|
||||
builder.finishDrawing();
|
||||
|
@ -132,7 +129,7 @@ public class ContraptionRenderer {
|
|||
}
|
||||
|
||||
private static void renderActors(World world, Contraption c, Consumer<SuperByteBuffer> transform,
|
||||
BufferBuilder buffer) {
|
||||
MatrixStack ms, BufferBuilder buffer) {
|
||||
for (Pair<BlockInfo, MovementContext> actor : c.getActors()) {
|
||||
MovementContext context = actor.getRight();
|
||||
if (context == null)
|
||||
|
@ -151,7 +148,7 @@ public class ContraptionRenderer {
|
|||
|
||||
render.translate(posX, posY, posZ);
|
||||
transform.accept(render);
|
||||
render.light((lx, ly, lz) -> getLight(world, lx, ly, lz)).renderInto(buffer);
|
||||
render.light((lx, ly, lz) -> getLight(world, lx, ly, lz)).renderInto(ms, buffer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ import com.simibubi.create.foundation.block.IWithTileEntity;
|
|||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ActionResultType;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.BlockRayTraceResult;
|
||||
|
@ -19,12 +20,12 @@ public class ClockworkBearingBlock extends BearingBlock implements IWithTileEnti
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity player, Hand handIn,
|
||||
BlockRayTraceResult hit) {
|
||||
public ActionResultType onUse(BlockState state, World worldIn, BlockPos pos,
|
||||
PlayerEntity player, Hand handIn, BlockRayTraceResult hit) {
|
||||
if (!player.isAllowEdit())
|
||||
return false;
|
||||
return ActionResultType.FAIL;
|
||||
if (player.isSneaking())
|
||||
return false;
|
||||
return ActionResultType.FAIL;
|
||||
if (player.getHeldItem(handIn).isEmpty()) {
|
||||
if (!worldIn.isRemote) {
|
||||
withTileEntityDo(worldIn, pos, te -> {
|
||||
|
@ -35,9 +36,9 @@ public class ClockworkBearingBlock extends BearingBlock implements IWithTileEnti
|
|||
te.assembleNextTick = true;
|
||||
});
|
||||
}
|
||||
return true;
|
||||
return ActionResultType.SUCCESS;
|
||||
}
|
||||
return false;
|
||||
return ActionResultType.PASS;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ import net.minecraft.block.Block;
|
|||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ActionResultType;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.BlockRayTraceResult;
|
||||
|
@ -20,12 +21,12 @@ public class MechanicalBearingBlock extends BearingBlock implements IWithTileEnt
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity player, Hand handIn,
|
||||
BlockRayTraceResult hit) {
|
||||
public ActionResultType onUse(BlockState state, World worldIn, BlockPos pos,
|
||||
PlayerEntity player, Hand handIn, BlockRayTraceResult hit) {
|
||||
if (!player.isAllowEdit())
|
||||
return false;
|
||||
return ActionResultType.FAIL;
|
||||
if (player.isSneaking())
|
||||
return false;
|
||||
return ActionResultType.FAIL;
|
||||
if (player.getHeldItem(handIn).isEmpty()) {
|
||||
if (!worldIn.isRemote) {
|
||||
withTileEntityDo(worldIn, pos, te -> {
|
||||
|
@ -36,9 +37,9 @@ public class MechanicalBearingBlock extends BearingBlock implements IWithTileEnt
|
|||
te.assembleNextTick = true;
|
||||
});
|
||||
}
|
||||
return true;
|
||||
return ActionResultType.SUCCESS;
|
||||
}
|
||||
return false;
|
||||
return ActionResultType.PASS;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -18,7 +18,7 @@ import net.minecraft.state.StateContainer.Builder;
|
|||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.Direction.AxisDirection;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IEnviromentBlockReader;
|
||||
import net.minecraft.world.ILightReader;
|
||||
|
||||
public class LinearChassisBlock extends AbstractChassisBlock implements IHaveConnectedTextures {
|
||||
|
||||
|
@ -40,9 +40,9 @@ public class LinearChassisBlock extends AbstractChassisBlock implements IHaveCon
|
|||
public BlockState getStateForPlacement(BlockItemUseContext context) {
|
||||
BlockPos placedOnPos = context.getPos().offset(context.getFace().getOpposite());
|
||||
BlockState blockState = context.getWorld().getBlockState(placedOnPos);
|
||||
if (isChassis(blockState) && !context.isPlacerSneaking())
|
||||
if (isChassis(blockState) && !context.getPlayer().isSneaking())
|
||||
return getDefaultState().with(AXIS, blockState.get(AXIS));
|
||||
if (!context.isPlacerSneaking())
|
||||
if (!context.getPlayer().isSneaking())
|
||||
return getDefaultState().with(AXIS, context.getNearestLookingDirection().getAxis());
|
||||
return super.getStateForPlacement(context);
|
||||
}
|
||||
|
@ -104,7 +104,7 @@ public class LinearChassisBlock extends AbstractChassisBlock implements IHaveCon
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean connectsTo(BlockState state, BlockState other, IEnviromentBlockReader reader, BlockPos pos,
|
||||
public boolean connectsTo(BlockState state, BlockState other, ILightReader reader, BlockPos pos,
|
||||
BlockPos otherPos, Direction face) {
|
||||
return sameKind(state, other) && state.get(AXIS) == other.get(AXIS);
|
||||
}
|
||||
|
|
|
@ -137,12 +137,6 @@ public class CartAssemblerBlock extends AbstractRailBlock {
|
|||
builder.add(BlockStateProperties.HORIZONTAL_AXIS);
|
||||
super.fillStateContainer(builder);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSolid(BlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static BlockState createAnchor(BlockState state) {
|
||||
|
|
|
@ -2,7 +2,7 @@ package com.simibubi.create.modules.contraptions.components.crafter;
|
|||
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.simibubi.create.AllBlocks;
|
||||
import com.simibubi.create.AllItems;
|
||||
import com.simibubi.create.foundation.behaviour.ValueBox;
|
||||
|
@ -25,7 +25,7 @@ import net.minecraft.util.math.RayTraceResult;
|
|||
import net.minecraft.util.math.RayTraceResult.Type;
|
||||
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;
|
||||
|
||||
|
@ -33,7 +33,7 @@ import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
|
|||
public class ConnectedInputRenderer {
|
||||
|
||||
@SubscribeEvent
|
||||
public static void renderBlockHighlight(DrawBlockHighlightEvent event) {
|
||||
public static void renderHighlight(DrawHighlightEvent event) {
|
||||
RayTraceResult target = event.getTarget();
|
||||
if (!(target instanceof BlockRayTraceResult))
|
||||
return;
|
||||
|
@ -58,7 +58,7 @@ public class ConnectedInputRenderer {
|
|||
return;
|
||||
|
||||
TessellatorHelper.prepareForDrawing();
|
||||
GlStateManager.translated(pos.getX(), pos.getY(), pos.getZ());
|
||||
RenderSystem.translated(pos.getX(), pos.getY(), pos.getZ());
|
||||
Direction activatedDirection = ConnectedInputHandler.getActivatedDirection(world, pos, face,
|
||||
result.getHitVec());
|
||||
|
||||
|
|
|
@ -2,18 +2,18 @@ package com.simibubi.create.modules.contraptions.components.crafter;
|
|||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IEnviromentBlockReader;
|
||||
import net.minecraft.world.ILightReader;
|
||||
|
||||
public class CrafterHelper {
|
||||
|
||||
public static MechanicalCrafterTileEntity getCrafter(IEnviromentBlockReader reader, BlockPos pos) {
|
||||
public static MechanicalCrafterTileEntity getCrafter(ILightReader reader, BlockPos pos) {
|
||||
TileEntity te = reader.getTileEntity(pos);
|
||||
if (!(te instanceof MechanicalCrafterTileEntity))
|
||||
return null;
|
||||
return (MechanicalCrafterTileEntity) te;
|
||||
}
|
||||
|
||||
public static ConnectedInputHandler.ConnectedInput getInput(IEnviromentBlockReader reader, BlockPos pos) {
|
||||
public static ConnectedInputHandler.ConnectedInput getInput(ILightReader reader, BlockPos pos) {
|
||||
MechanicalCrafterTileEntity crafter = getCrafter(reader, pos);
|
||||
return crafter == null ? null : crafter.input;
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ import net.minecraft.util.Direction;
|
|||
import net.minecraft.util.Direction.Axis;
|
||||
import net.minecraft.util.Direction.AxisDirection;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IEnviromentBlockReader;
|
||||
import net.minecraft.world.ILightReader;
|
||||
|
||||
public class InputCTBehaviour extends ConnectedTextureBehaviour {
|
||||
|
||||
|
@ -24,7 +24,7 @@ public class InputCTBehaviour extends ConnectedTextureBehaviour {
|
|||
static final CTSpriteShiftEntry otherSide = CTSpriteShifter.get(CTType.HORIZONTAL, "crafter_side");
|
||||
|
||||
@Override
|
||||
public boolean connectsTo(BlockState state, BlockState other, IEnviromentBlockReader reader, BlockPos pos,
|
||||
public boolean connectsTo(BlockState state, BlockState other, ILightReader reader, BlockPos pos,
|
||||
BlockPos otherPos, Direction face) {
|
||||
if (state.getBlock() != other.getBlock())
|
||||
return false;
|
||||
|
|
|
@ -82,7 +82,7 @@ public class MechanicalCrafterBlock extends HorizontalKineticBlock
|
|||
BlockPos placedOnPos = context.getPos().offset(face.getOpposite());
|
||||
BlockState blockState = context.getWorld().getBlockState(placedOnPos);
|
||||
|
||||
if ((blockState.getBlock() != this) || context.isPlacerSneaking()) {
|
||||
if ((blockState.getBlock() != this) || context.getPlayer().isSneaking()) {
|
||||
BlockState stateForPlacement = super.getStateForPlacement(context);
|
||||
Direction direction = stateForPlacement.get(HORIZONTAL_FACING);
|
||||
if (direction != face)
|
||||
|
@ -230,10 +230,10 @@ public class MechanicalCrafterBlock extends HorizontalKineticBlock
|
|||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockRenderLayer getRenderLayer() {
|
||||
return BlockRenderLayer.CUTOUT_MIPPED;
|
||||
}
|
||||
// @Override // TODO 1.15 register layer
|
||||
// public BlockRenderLayer getRenderLayer() {
|
||||
// return BlockRenderLayer.CUTOUT_MIPPED;
|
||||
// }
|
||||
|
||||
@Override
|
||||
public float getParticleTargetRadius() {
|
||||
|
|
|
@ -3,7 +3,9 @@ package com.simibubi.create.modules.contraptions.components.crafter;
|
|||
import static com.simibubi.create.modules.contraptions.base.HorizontalKineticBlock.HORIZONTAL_FACING;
|
||||
import static com.simibubi.create.modules.contraptions.base.KineticTileEntityRenderer.standardKineticRotationTransform;
|
||||
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
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.block.render.SpriteShiftEntry;
|
||||
|
@ -17,11 +19,12 @@ import com.simibubi.create.modules.contraptions.components.crafter.RecipeGridHan
|
|||
|
||||
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.RenderHelper;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.client.renderer.Vector3f;
|
||||
import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType;
|
||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.Direction.Axis;
|
||||
|
@ -34,11 +37,15 @@ public class MechanicalCrafterTileEntityRenderer extends SafeTileEntityRenderer<
|
|||
|
||||
public static SpriteShiftEntry animatedTexture = SpriteShifter.get("block/crafter_thingies",
|
||||
"block/crafter_thingies");
|
||||
|
||||
public MechanicalCrafterTileEntityRenderer(TileEntityRendererDispatcher dispatcher) {
|
||||
super(dispatcher);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderWithGL(MechanicalCrafterTileEntity te, double x, double y, double z, float partialTicks,
|
||||
int destroyStage) {
|
||||
GlStateManager.pushMatrix();
|
||||
protected void renderSafe(MechanicalCrafterTileEntity te, float partialTicks, MatrixStack ms,
|
||||
IRenderTypeBuffer buffer, int light, int overlay) {
|
||||
ms.push();
|
||||
Direction facing = te.getBlockState().get(HORIZONTAL_FACING);
|
||||
Vec3d vec = new Vec3d(facing.getDirectionVec()).scale(.58).add(.5, .5, .5);
|
||||
|
||||
|
@ -49,36 +56,34 @@ public class MechanicalCrafterTileEntityRenderer extends SafeTileEntityRenderer<
|
|||
vec = vec.add(new Vec3d(targetDirection.getDirectionVec()).scale(progress * .75f));
|
||||
}
|
||||
|
||||
GlStateManager.translated(x + vec.x, y + vec.y, z + vec.z);
|
||||
GlStateManager.scalef(1 / 2f, 1 / 2f, 1 / 2f);
|
||||
ms.translate(vec.x, vec.y, vec.z);
|
||||
ms.scale(1 / 2f, 1 / 2f, 1 / 2f);
|
||||
float yRot = AngleHelper.horizontalAngle(facing);
|
||||
GlStateManager.rotated(yRot, 0, 1, 0);
|
||||
renderItems(te, partialTicks);
|
||||
GlStateManager.popMatrix();
|
||||
ms.multiply(Vector3f.POSITIVE_Y.getDegreesQuaternion(yRot));
|
||||
renderItems(te, partialTicks, ms, buffer, light, overlay);
|
||||
ms.pop();
|
||||
|
||||
TessellatorHelper.prepareFastRender();
|
||||
TessellatorHelper.begin(DefaultVertexFormats.BLOCK);
|
||||
renderTileEntityFast(te, x, y, z, partialTicks, destroyStage, Tessellator.getInstance().getBuffer());
|
||||
renderFast(te, partialTicks, ms, buffer);
|
||||
TessellatorHelper.draw();
|
||||
}
|
||||
|
||||
public void renderItems(MechanicalCrafterTileEntity te, float partialTicks) {
|
||||
public void renderItems(MechanicalCrafterTileEntity te, float partialTicks, MatrixStack ms, IRenderTypeBuffer buffer, int light, int overlay) {
|
||||
RenderHelper.enableStandardItemLighting();
|
||||
|
||||
if (te.phase == Phase.IDLE) {
|
||||
ItemStack stack = te.inventory.getStackInSlot(0);
|
||||
if (!stack.isEmpty()) {
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.translatef(0, 0, -1 / 256f);
|
||||
Minecraft.getInstance().getItemRenderer().renderItem(stack, TransformType.FIXED);
|
||||
GlStateManager.popMatrix();
|
||||
ms.push();
|
||||
ms.translate(0, 0, -1 / 256f);
|
||||
Minecraft.getInstance().getItemRenderer().renderItem(stack, TransformType.FIXED, light, overlay, ms, buffer);
|
||||
ms.pop();
|
||||
}
|
||||
} else {
|
||||
// render grouped items
|
||||
GroupedItems items = te.groupedItems;
|
||||
float distance = .5f;
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
ms.push();
|
||||
|
||||
if (te.phase == Phase.CRAFTING) {
|
||||
items = te.groupedItemsBeforeCraft;
|
||||
|
@ -88,26 +93,26 @@ public class MechanicalCrafterTileEntityRenderer extends SafeTileEntityRenderer<
|
|||
float earlyProgress = MathHelper.clamp(progress * 2, 0, 1);
|
||||
float lateProgress = MathHelper.clamp(progress * 2 - 1, 0, 1);
|
||||
|
||||
// GlStateManager.rotated(lateProgress * 360, 0, 0, 1);
|
||||
GlStateManager.scaled(1 - lateProgress, 1 - lateProgress, 1 - lateProgress);
|
||||
// RenderSystem.rotated(lateProgress * 360, 0, 0, 1);
|
||||
ms.scale(1 - lateProgress, 1 - lateProgress, 1 - lateProgress);
|
||||
|
||||
Vec3d centering = new Vec3d(-items.minX + (-items.width + 1) / 2f,
|
||||
-items.minY + (-items.height + 1) / 2f, 0).scale(earlyProgress);
|
||||
GlStateManager.translated(centering.x * .5f, centering.y * .5f, 0);
|
||||
ms.translate(centering.x * .5f, centering.y * .5f, 0);
|
||||
|
||||
distance += (-4 * (progress - .5f) * (progress - .5f) + 1) * .25f;
|
||||
}
|
||||
|
||||
final float spacing = distance;
|
||||
items.grid.forEach((pair, stack) -> {
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.translatef(pair.getKey() * spacing, pair.getValue() * spacing, 0);
|
||||
TessellatorHelper.fightZFighting(pair.hashCode() + te.getPos().hashCode());
|
||||
Minecraft.getInstance().getItemRenderer().renderItem(stack, TransformType.FIXED);
|
||||
GlStateManager.popMatrix();
|
||||
ms.push();
|
||||
ms.translate(pair.getKey() * spacing, pair.getValue() * spacing, 0);
|
||||
TessellatorHelper.fightZFighting(pair.hashCode() + te.getPos().hashCode()); // FIXME 1.15
|
||||
Minecraft.getInstance().getItemRenderer().renderItem(stack, TransformType.FIXED, light, overlay, ms, buffer);
|
||||
ms.pop();
|
||||
});
|
||||
|
||||
GlStateManager.popMatrix();
|
||||
ms.pop();
|
||||
|
||||
if (te.phase == Phase.CRAFTING) {
|
||||
items = te.groupedItems;
|
||||
|
@ -116,14 +121,14 @@ public class MechanicalCrafterTileEntityRenderer extends SafeTileEntityRenderer<
|
|||
float earlyProgress = MathHelper.clamp(progress * 2, 0, 1);
|
||||
float lateProgress = MathHelper.clamp(progress * 2 - 1, 0, 1);
|
||||
|
||||
GlStateManager.rotated(earlyProgress * 2 * 360, 0, 0, 1);
|
||||
ms.multiply(Vector3f.POSITIVE_Z.getDegreesQuaternion(earlyProgress * 2 * 360));
|
||||
float upScaling = earlyProgress * 1.125f;
|
||||
float downScaling = 1 + (1 - lateProgress) * .125f;
|
||||
GlStateManager.scaled(upScaling, upScaling, upScaling);
|
||||
GlStateManager.scaled(downScaling, downScaling, downScaling);
|
||||
ms.scale(upScaling, upScaling, upScaling);
|
||||
ms.scale(downScaling, downScaling, downScaling);
|
||||
|
||||
items.grid.forEach((pair, stack) -> {
|
||||
Minecraft.getInstance().getItemRenderer().renderItem(stack, TransformType.FIXED);
|
||||
Minecraft.getInstance().getItemRenderer().renderItem(stack, TransformType.FIXED, light, overlay, ms, buffer);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -132,28 +137,28 @@ public class MechanicalCrafterTileEntityRenderer extends SafeTileEntityRenderer<
|
|||
RenderHelper.disableStandardItemLighting();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderFast(MechanicalCrafterTileEntity te, double x, double y, double z, float partialTicks,
|
||||
int destroyStage, BufferBuilder buffer) {
|
||||
public void renderFast(MechanicalCrafterTileEntity te, float partialTicks, MatrixStack ms, IRenderTypeBuffer buffer) {
|
||||
BlockState blockState = te.getBlockState();
|
||||
|
||||
IVertexBuilder vb = buffer.getBuffer(RenderType.getSolid());
|
||||
|
||||
SuperByteBuffer superBuffer = AllBlockPartials.SHAFTLESS_COGWHEEL.renderOn(blockState);
|
||||
superBuffer.rotateCentered(Axis.X, (float) (Math.PI / 2));
|
||||
superBuffer.rotateCentered(Axis.Y,
|
||||
(float) (blockState.get(HORIZONTAL_FACING).getAxis() != Axis.X ? 0 : Math.PI / 2));
|
||||
standardKineticRotationTransform(superBuffer, te, getWorld()).translate(x, y, z).renderInto(buffer);
|
||||
standardKineticRotationTransform(superBuffer, te).renderInto(ms, vb);
|
||||
|
||||
Direction targetDirection = MechanicalCrafterBlock.getTargetDirection(blockState);
|
||||
BlockPos pos = te.getPos();
|
||||
|
||||
if ((te.covered || te.phase != Phase.IDLE) && te.phase != Phase.CRAFTING && te.phase != Phase.INSERTING) {
|
||||
SuperByteBuffer lidBuffer = renderAndTransform(AllBlockPartials.MECHANICAL_CRAFTER_LID, blockState, pos);
|
||||
lidBuffer.translate(x, y, z).renderInto(buffer);
|
||||
SuperByteBuffer lidBuffer = renderAndTransform(te, AllBlockPartials.MECHANICAL_CRAFTER_LID, blockState, pos);
|
||||
lidBuffer.renderInto(ms, vb);
|
||||
}
|
||||
|
||||
if (MechanicalCrafterBlock.isValidTarget(getWorld(), pos.offset(targetDirection), blockState)) {
|
||||
SuperByteBuffer beltBuffer = renderAndTransform(AllBlockPartials.MECHANICAL_CRAFTER_BELT, blockState, pos);
|
||||
SuperByteBuffer beltFrameBuffer = renderAndTransform(AllBlockPartials.MECHANICAL_CRAFTER_BELT_FRAME, blockState,
|
||||
if (MechanicalCrafterBlock.isValidTarget(te.getWorld(), pos.offset(targetDirection), blockState)) {
|
||||
SuperByteBuffer beltBuffer = renderAndTransform(te, AllBlockPartials.MECHANICAL_CRAFTER_BELT, blockState, pos);
|
||||
SuperByteBuffer beltFrameBuffer = renderAndTransform(te, AllBlockPartials.MECHANICAL_CRAFTER_BELT_FRAME, blockState,
|
||||
pos);
|
||||
|
||||
if (te.phase == Phase.EXPORTING) {
|
||||
|
@ -164,23 +169,23 @@ public class MechanicalCrafterTileEntityRenderer extends SafeTileEntityRenderer<
|
|||
beltBuffer.shiftUVtoSheet(animatedTexture.getOriginal(), animatedTexture.getTarget(), 0, 0);
|
||||
}
|
||||
|
||||
beltBuffer.translate(x, y, z).renderInto(buffer);
|
||||
beltFrameBuffer.translate(x, y, z).renderInto(buffer);
|
||||
beltBuffer.renderInto(ms, vb);
|
||||
beltFrameBuffer.renderInto(ms, vb);
|
||||
|
||||
} else {
|
||||
SuperByteBuffer arrowBuffer = renderAndTransform(AllBlockPartials.MECHANICAL_CRAFTER_ARROW, blockState, pos);
|
||||
arrowBuffer.translate(x, y, z).renderInto(buffer);
|
||||
SuperByteBuffer arrowBuffer = renderAndTransform(te, AllBlockPartials.MECHANICAL_CRAFTER_ARROW, blockState, pos);
|
||||
arrowBuffer.renderInto(ms, vb);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private SuperByteBuffer renderAndTransform(AllBlockPartials renderBlock, BlockState crafterState, BlockPos pos) {
|
||||
private SuperByteBuffer renderAndTransform(MechanicalCrafterTileEntity te, AllBlockPartials renderBlock, BlockState crafterState, BlockPos pos) {
|
||||
SuperByteBuffer buffer = renderBlock.renderOn(crafterState);
|
||||
float xRot = crafterState.get(MechanicalCrafterBlock.POINTING).getXRotation();
|
||||
float yRot = AngleHelper.horizontalAngle(crafterState.get(HORIZONTAL_FACING));
|
||||
buffer.rotateCentered(Axis.X, (float) ((xRot) / 180 * Math.PI));
|
||||
buffer.rotateCentered(Axis.Y, (float) ((yRot + 90) / 180 * Math.PI));
|
||||
buffer.light(crafterState.getPackedLightmapCoords(getWorld(), pos));
|
||||
buffer.light(crafterState.getPackedLightmapCoords(te.getWorld(), pos));
|
||||
return buffer;
|
||||
}
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ import static net.minecraft.state.properties.BlockStateProperties.AXIS;
|
|||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
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.behaviour.filtering.FilteringRenderer;
|
||||
|
@ -55,8 +55,8 @@ public class DeployerTileEntityRenderer extends SafeTileEntityRenderer<DeployerT
|
|||
protected void renderItem(DeployerTileEntity te, double x, double y, double z, float partialTicks) {
|
||||
BlockState deployerState = te.getBlockState();
|
||||
Vec3d offset = getHandOffset(te, partialTicks, deployerState).add(VecHelper.getCenterOf(BlockPos.ZERO));
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.translated(offset.x + x, offset.y + y, offset.z + z);
|
||||
RenderSystem.pushMatrix();
|
||||
RenderSystem.translated(offset.x + x, offset.y + y, offset.z + z);
|
||||
|
||||
Direction facing = deployerState.get(FACING);
|
||||
boolean punching = te.mode == Mode.PUNCH;
|
||||
|
@ -65,14 +65,14 @@ public class DeployerTileEntityRenderer extends SafeTileEntityRenderer<DeployerT
|
|||
float zRot = facing == Direction.UP ? 90 : facing == Direction.DOWN ? 270 : 0;
|
||||
boolean displayMode = facing == Direction.UP && te.getSpeed() == 0 && !punching;
|
||||
|
||||
GlStateManager.rotatef(yRot, 0, 1, 0);
|
||||
RenderSystem.rotatef(yRot, 0, 1, 0);
|
||||
if (!displayMode) {
|
||||
GlStateManager.rotatef(zRot, 1, 0, 0);
|
||||
GlStateManager.translated(0, 0, -11 / 16f);
|
||||
RenderSystem.rotatef(zRot, 1, 0, 0);
|
||||
RenderSystem.translated(0, 0, -11 / 16f);
|
||||
}
|
||||
|
||||
if (punching)
|
||||
GlStateManager.translatef(0, 1 / 8f, -1 / 16f);
|
||||
RenderSystem.translatef(0, 1 / 8f, -1 / 16f);
|
||||
|
||||
ItemRenderer itemRenderer = Minecraft.getInstance().getItemRenderer();
|
||||
|
||||
|
@ -82,19 +82,19 @@ public class DeployerTileEntityRenderer extends SafeTileEntityRenderer<DeployerT
|
|||
|
||||
if (displayMode) {
|
||||
float scale = isBlockItem ? 1.25f : 1;
|
||||
GlStateManager.translated(0, isBlockItem ? 9 / 16f : 11 / 16f, 0);
|
||||
GlStateManager.scaled(scale, scale, scale);
|
||||
RenderSystem.translated(0, isBlockItem ? 9 / 16f : 11 / 16f, 0);
|
||||
RenderSystem.scaled(scale, scale, scale);
|
||||
transform = TransformType.GROUND;
|
||||
GlStateManager.rotatef(AnimationTickHolder.getRenderTick(), 0, 1, 0);
|
||||
RenderSystem.rotatef(AnimationTickHolder.getRenderTick(), 0, 1, 0);
|
||||
|
||||
} else {
|
||||
float scale = punching ? .75f : isBlockItem ? .75f - 1 / 64f : .5f;
|
||||
GlStateManager.scaled(scale, scale, scale);
|
||||
RenderSystem.scaled(scale, scale, scale);
|
||||
transform = punching ? TransformType.THIRD_PERSON_RIGHT_HAND : TransformType.FIXED;
|
||||
}
|
||||
|
||||
itemRenderer.renderItem(te.heldItem, transform);
|
||||
GlStateManager.popMatrix();
|
||||
RenderSystem.popMatrix();
|
||||
}
|
||||
|
||||
protected void renderComponents(DeployerTileEntity te, double x, double y, double z, float partialTicks) {
|
||||
|
|
|
@ -3,7 +3,7 @@ package com.simibubi.create.modules.contraptions.components.saw;
|
|||
import static net.minecraft.state.properties.BlockStateProperties.AXIS;
|
||||
import static net.minecraft.state.properties.BlockStateProperties.FACING;
|
||||
|
||||
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.CreateClient;
|
||||
|
@ -49,7 +49,7 @@ public class SawTileEntityRenderer extends SafeTileEntityRenderer<SawTileEntity>
|
|||
boolean processingMode = te.getBlockState().get(SawBlock.FACING) == Direction.UP;
|
||||
if (processingMode && !te.inventory.isEmpty()) {
|
||||
boolean alongZ = !te.getBlockState().get(SawBlock.AXIS_ALONG_FIRST_COORDINATE);
|
||||
GlStateManager.pushMatrix();
|
||||
RenderSystem.pushMatrix();
|
||||
|
||||
boolean moving = te.inventory.recipeDuration != 0;
|
||||
float offset = moving ? (float) (te.inventory.remainingTime) / te.inventory.recipeDuration : 0;
|
||||
|
@ -66,15 +66,15 @@ public class SawTileEntityRenderer extends SafeTileEntityRenderer<SawTileEntity>
|
|||
IBakedModel modelWithOverrides = itemRenderer.getModelWithOverrides(stack);
|
||||
boolean blockItem = modelWithOverrides.isGui3d();
|
||||
|
||||
GlStateManager.translated(x + (alongZ ? offset : .5), y + (blockItem ? .925f : 13f / 16f),
|
||||
RenderSystem.translated(x + (alongZ ? offset : .5), y + (blockItem ? .925f : 13f / 16f),
|
||||
z + (alongZ ? .5 : offset));
|
||||
|
||||
GlStateManager.scaled(.5, .5, .5);
|
||||
RenderSystem.scaled(.5, .5, .5);
|
||||
if (alongZ)
|
||||
GlStateManager.rotated(90, 0, 1, 0);
|
||||
GlStateManager.rotated(90, 1, 0, 0);
|
||||
RenderSystem.rotated(90, 0, 1, 0);
|
||||
RenderSystem.rotated(90, 1, 0, 0);
|
||||
itemRenderer.renderItem(stack, ItemCameraTransforms.TransformType.FIXED);
|
||||
GlStateManager.popMatrix();
|
||||
RenderSystem.popMatrix();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ package com.simibubi.create.modules.contraptions.processing;
|
|||
|
||||
import java.util.Random;
|
||||
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.simibubi.create.foundation.block.SafeTileEntityRenderer;
|
||||
import com.simibubi.create.foundation.utility.VecHelper;
|
||||
|
||||
|
@ -19,9 +19,9 @@ public class BasinTileEntityRenderer extends SafeTileEntityRenderer<BasinTileEnt
|
|||
|
||||
@Override
|
||||
public void renderWithGL(BasinTileEntity basin, double x, double y, double z, float partialTicks, int destroyStage) {
|
||||
GlStateManager.pushMatrix();
|
||||
RenderSystem.pushMatrix();
|
||||
BlockPos pos = basin.getPos();
|
||||
GlStateManager.translated(x + .5, y + .2f, z + .5);
|
||||
RenderSystem.translated(x + .5, y + .2f, z + .5);
|
||||
Random r = new Random(pos.hashCode());
|
||||
|
||||
IItemHandlerModifiable inv = basin.inventory.orElse(new ItemStackHandler());
|
||||
|
@ -31,18 +31,18 @@ public class BasinTileEntityRenderer extends SafeTileEntityRenderer<BasinTileEnt
|
|||
continue;
|
||||
|
||||
for (int i = 0; i <= stack.getCount() / 8; i++) {
|
||||
GlStateManager.pushMatrix();
|
||||
RenderSystem.pushMatrix();
|
||||
Vec3d vec = VecHelper.offsetRandomly(Vec3d.ZERO, r, .25f);
|
||||
Vec3d vec2 = VecHelper.offsetRandomly(Vec3d.ZERO, r, .5f);
|
||||
GlStateManager.translated(vec.x, vec.y, vec.z);
|
||||
GlStateManager.rotated(vec2.x * 180, vec2.z, vec2.y, 0);
|
||||
RenderSystem.translated(vec.x, vec.y, vec.z);
|
||||
RenderSystem.rotated(vec2.x * 180, vec2.z, vec2.y, 0);
|
||||
|
||||
Minecraft.getInstance().getItemRenderer().renderItem(stack, TransformType.GROUND);
|
||||
GlStateManager.popMatrix();
|
||||
RenderSystem.popMatrix();
|
||||
}
|
||||
GlStateManager.translated(0, 1 / 64f, 0);
|
||||
RenderSystem.translated(0, 1 / 64f, 0);
|
||||
}
|
||||
GlStateManager.popMatrix();
|
||||
RenderSystem.popMatrix();
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ package com.simibubi.create.modules.contraptions.relays.advanced.sequencer;
|
|||
|
||||
import java.util.Vector;
|
||||
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.simibubi.create.AllBlocks;
|
||||
import com.simibubi.create.AllPackets;
|
||||
import com.simibubi.create.ScreenResources;
|
||||
|
@ -159,8 +159,8 @@ public class SequencedGearshiftScreen extends AbstractSimiScreen {
|
|||
}
|
||||
|
||||
public ItemStack getRenderedBlock() {
|
||||
GlStateManager.translated(guiLeft + background.width + 20, guiTop + 50, 0);
|
||||
GlStateManager.scaled(5, 5, 5);
|
||||
RenderSystem.translated(guiLeft + background.width + 20, guiTop + 50, 0);
|
||||
RenderSystem.scaled(5, 5, 5);
|
||||
return renderedItem;
|
||||
}
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ import net.minecraft.block.BlockState;
|
|||
import net.minecraft.client.renderer.color.IBlockColor;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IEnviromentBlockReader;
|
||||
import net.minecraft.world.ILightReader;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
|
@ -12,7 +12,7 @@ import net.minecraftforge.api.distmarker.OnlyIn;
|
|||
class BeltColor implements IBlockColor {
|
||||
|
||||
@Override
|
||||
public int getColor(BlockState state, IEnviromentBlockReader reader, BlockPos pos, int layer) {
|
||||
public int getColor(BlockState state, ILightReader reader, BlockPos pos, int layer) {
|
||||
TileEntity tileEntity = reader.getTileEntity(pos);
|
||||
if (tileEntity instanceof BeltTileEntity) {
|
||||
BeltTileEntity te = (BeltTileEntity) tileEntity;
|
||||
|
|
|
@ -4,7 +4,7 @@ import static net.minecraft.state.properties.BlockStateProperties.HORIZONTAL_FAC
|
|||
|
||||
import java.util.Random;
|
||||
|
||||
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.CreateClient;
|
||||
|
@ -98,17 +98,17 @@ public class BeltTileEntityRenderer extends SafeTileEntityRenderer<BeltTileEntit
|
|||
if (te.beltLength == 0)
|
||||
return;
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
RenderSystem.pushMatrix();
|
||||
|
||||
Vec3i directionVec = te.getBeltFacing().getDirectionVec();
|
||||
Vec3d beltStartOffset = new Vec3d(directionVec).scale(-.5).add(.5, 13 / 16f + .125f, .5);
|
||||
GlStateManager.translated(x + beltStartOffset.x, y + beltStartOffset.y, z + beltStartOffset.z);
|
||||
RenderSystem.translated(x + beltStartOffset.x, y + beltStartOffset.y, z + 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) {
|
||||
GlStateManager.pushMatrix();
|
||||
RenderSystem.pushMatrix();
|
||||
TessellatorHelper.fightZFighting(transported.angle);
|
||||
float offset = MathHelper.lerp(partialTicks, transported.prevBeltPosition, transported.beltPosition);
|
||||
float sideOffset = MathHelper.lerp(partialTicks, transported.prevSideOffset, transported.sideOffset);
|
||||
|
@ -129,12 +129,12 @@ public class BeltTileEntityRenderer extends SafeTileEntityRenderer<BeltTileEntit
|
|||
.getBeltFacing().getAxis() == Axis.Z);
|
||||
float slopeAngle = onSlope ? tiltForward ? -45 : 45 : 0;
|
||||
|
||||
GlStateManager.translated(offsetVec.x, offsetVec.y, offsetVec.z);
|
||||
RenderSystem.translated(offsetVec.x, offsetVec.y, offsetVec.z);
|
||||
|
||||
boolean alongX = te.getBeltFacing().rotateY().getAxis() == Axis.X;
|
||||
if (!alongX)
|
||||
sideOffset *= -1;
|
||||
GlStateManager.translated(alongX ? sideOffset : 0, 0, alongX ? 0 : sideOffset);
|
||||
RenderSystem.translated(alongX ? sideOffset : 0, 0, alongX ? 0 : sideOffset);
|
||||
|
||||
ItemRenderer itemRenderer = Minecraft.getInstance().getItemRenderer();
|
||||
boolean blockItem = itemRenderer.getModelWithOverrides(transported.stack).isGui3d();
|
||||
|
@ -148,40 +148,40 @@ public class BeltTileEntityRenderer extends SafeTileEntityRenderer<BeltTileEntit
|
|||
RenderHelper.enableStandardItemLighting();
|
||||
|
||||
int count = (int) (MathHelper.log2((int) (transported.stack.getCount()))) / 2;
|
||||
GlStateManager.rotated(slopeAngle, slopeAlongX ? 0 : 1, 0, slopeAlongX ? 1 : 0);
|
||||
RenderSystem.rotated(slopeAngle, slopeAlongX ? 0 : 1, 0, slopeAlongX ? 1 : 0);
|
||||
if (onSlope)
|
||||
GlStateManager.translated(0, 1 / 8f, 0);
|
||||
RenderSystem.translated(0, 1 / 8f, 0);
|
||||
Random r = new Random(transported.angle);
|
||||
|
||||
for (int i = 0; i <= count; i++) {
|
||||
GlStateManager.pushMatrix();
|
||||
RenderSystem.pushMatrix();
|
||||
|
||||
GlStateManager.rotated(transported.angle, 0, 1, 0);
|
||||
RenderSystem.rotated(transported.angle, 0, 1, 0);
|
||||
if (!blockItem) {
|
||||
GlStateManager.translated(0, -.09375, 0);
|
||||
GlStateManager.rotated(90, 1, 0, 0);
|
||||
RenderSystem.translated(0, -.09375, 0);
|
||||
RenderSystem.rotated(90, 1, 0, 0);
|
||||
}
|
||||
|
||||
if (blockItem) {
|
||||
GlStateManager.translated(r.nextFloat() * .0625f * i, 0, r.nextFloat() * .0625f * i);
|
||||
RenderSystem.translated(r.nextFloat() * .0625f * i, 0, r.nextFloat() * .0625f * i);
|
||||
}
|
||||
|
||||
GlStateManager.scaled(.5, .5, .5);
|
||||
RenderSystem.scaled(.5, .5, .5);
|
||||
itemRenderer.renderItem(transported.stack, TransformType.FIXED);
|
||||
GlStateManager.popMatrix();
|
||||
RenderSystem.popMatrix();
|
||||
|
||||
if (!blockItem)
|
||||
GlStateManager.rotated(10, 0, 1, 0);
|
||||
GlStateManager.translated(0, blockItem ? 1 / 64d : 1 / 16d, 0);
|
||||
RenderSystem.rotated(10, 0, 1, 0);
|
||||
RenderSystem.translated(0, blockItem ? 1 / 64d : 1 / 16d, 0);
|
||||
|
||||
}
|
||||
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
GlStateManager.popMatrix();
|
||||
RenderSystem.popMatrix();
|
||||
}
|
||||
|
||||
GlStateManager.disableBlend();
|
||||
GlStateManager.popMatrix();
|
||||
RenderSystem.disableBlend();
|
||||
RenderSystem.popMatrix();
|
||||
}
|
||||
|
||||
protected BlockState getBeltState(KineticTileEntity te) {
|
||||
|
|
|
@ -8,7 +8,7 @@ import java.text.DecimalFormat;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.simibubi.create.AllBlocks;
|
||||
import com.simibubi.create.AllItems;
|
||||
import com.simibubi.create.foundation.gui.ScreenElementRenderer;
|
||||
|
@ -88,7 +88,7 @@ public class GaugeInformationRenderer {
|
|||
if (tooltip.isEmpty())
|
||||
return;
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
RenderSystem.pushMatrix();
|
||||
Screen tooltipScreen = new Screen(null) {
|
||||
|
||||
@Override
|
||||
|
@ -106,10 +106,10 @@ public class GaugeInformationRenderer {
|
|||
tooltipScreen.renderTooltip(tooltip, tooltipScreen.width / 2, tooltipScreen.height / 2);
|
||||
ItemStack item = goggles;
|
||||
ScreenElementRenderer.render3DItem(() -> {
|
||||
GlStateManager.translated(tooltipScreen.width / 2 + 10, tooltipScreen.height / 2 - 16, 0);
|
||||
RenderSystem.translated(tooltipScreen.width / 2 + 10, tooltipScreen.height / 2 - 16, 0);
|
||||
return item;
|
||||
});
|
||||
GlStateManager.popMatrix();
|
||||
RenderSystem.popMatrix();
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package com.simibubi.create.modules.curiosities.deforester;
|
||||
|
||||
import com.mojang.blaze3d.platform.GLX;
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.simibubi.create.foundation.utility.AnimationTickHolder;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
|
@ -20,28 +20,28 @@ public class DeforesterItemRenderer extends ItemStackTileEntityRenderer {
|
|||
float lastCoordx = GLX.lastBrightnessX;
|
||||
float lastCoordy = GLX.lastBrightnessY;
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.translatef(0.5F, 0.5F, 0.5F);
|
||||
RenderSystem.pushMatrix();
|
||||
RenderSystem.translatef(0.5F, 0.5F, 0.5F);
|
||||
itemRenderer.renderItem(stack, mainModel.getBakedModel());
|
||||
|
||||
GlStateManager.disableLighting();
|
||||
RenderSystem.disableLighting();
|
||||
GLX.glMultiTexCoord2f(GLX.GL_TEXTURE1, 240, 120);
|
||||
itemRenderer.renderItem(stack, mainModel.getPartial("light"));
|
||||
itemRenderer.renderItem(stack, mainModel.getPartial("blade"));
|
||||
GLX.glMultiTexCoord2f(GLX.GL_TEXTURE1, lastCoordx, lastCoordy);
|
||||
GlStateManager.enableLighting();
|
||||
RenderSystem.enableLighting();
|
||||
|
||||
float angle = worldTime * -.5f % 360;
|
||||
float xOffset = 0;
|
||||
float zOffset = 0;
|
||||
GlStateManager.translatef(-xOffset, 0, -zOffset);
|
||||
GlStateManager.rotated(angle, 0, 1, 0);
|
||||
GlStateManager.translatef(xOffset, 0, zOffset);
|
||||
RenderSystem.translatef(-xOffset, 0, -zOffset);
|
||||
RenderSystem.rotated(angle, 0, 1, 0);
|
||||
RenderSystem.translatef(xOffset, 0, zOffset);
|
||||
|
||||
itemRenderer.renderItem(stack, mainModel.getPartial("gear"));
|
||||
|
||||
|
||||
GlStateManager.popMatrix();
|
||||
RenderSystem.popMatrix();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@ import java.util.Random;
|
|||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.simibubi.create.AllItems;
|
||||
import com.simibubi.create.foundation.utility.TessellatorHelper;
|
||||
import com.simibubi.create.modules.curiosities.symmetry.mirror.EmptyMirror;
|
||||
|
@ -97,12 +97,12 @@ public class SymmetryHandler {
|
|||
|
||||
BufferBuilder buffer = Tessellator.getInstance().getBuffer();
|
||||
buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.BLOCK);
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.translated(0, yShift + .2f, 0);
|
||||
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();
|
||||
GlStateManager.popMatrix();
|
||||
RenderSystem.popMatrix();
|
||||
TessellatorHelper.cleanUpAfterDrawing();
|
||||
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@ package com.simibubi.create.modules.curiosities.symmetry;
|
|||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.simibubi.create.AllPackets;
|
||||
import com.simibubi.create.ScreenResources;
|
||||
import com.simibubi.create.foundation.gui.AbstractSimiScreen;
|
||||
|
@ -126,48 +126,48 @@ public class SymmetryWandScreen extends AbstractSimiScreen {
|
|||
font.drawString(orientation, x - 5, y + 20, ScreenResources.FONT_COLOR);
|
||||
|
||||
minecraft.getTextureManager().bindTexture(AtlasTexture.LOCATION_BLOCKS_TEXTURE);
|
||||
GlStateManager.enableBlend();
|
||||
RenderSystem.enableBlend();
|
||||
|
||||
renderBlock();
|
||||
renderBlock();
|
||||
|
||||
GlStateManager.pushLightingAttributes();
|
||||
GlStateManager.pushMatrix();
|
||||
RenderSystem.pushLightingAttributes();
|
||||
RenderSystem.pushMatrix();
|
||||
|
||||
RenderHelper.enableStandardItemLighting();
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.enableRescaleNormal();
|
||||
GlStateManager.enableAlphaTest();
|
||||
GlStateManager.alphaFunc(516, 0.1F);
|
||||
GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA);
|
||||
GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
RenderSystem.enableBlend();
|
||||
RenderSystem.enableRescaleNormal();
|
||||
RenderSystem.enableAlphaTest();
|
||||
RenderSystem.alphaFunc(516, 0.1F);
|
||||
RenderSystem.blendFunc(RenderSystem.SourceFactor.SRC_ALPHA, RenderSystem.DestFactor.ONE_MINUS_SRC_ALPHA);
|
||||
RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
|
||||
GlStateManager.translated((this.width - this.sWidth) / 2 + 250, this.height / 2 + this.sHeight / 2, 100);
|
||||
GlStateManager.rotatef(-30, .4f, 0, -.2f);
|
||||
GlStateManager.rotatef(90 + 0.2f * animationProgress, 0, 1, 0);
|
||||
GlStateManager.scaled(100, -100, 100);
|
||||
RenderSystem.translated((this.width - this.sWidth) / 2 + 250, this.height / 2 + this.sHeight / 2, 100);
|
||||
RenderSystem.rotatef(-30, .4f, 0, -.2f);
|
||||
RenderSystem.rotatef(90 + 0.2f * animationProgress, 0, 1, 0);
|
||||
RenderSystem.scaled(100, -100, 100);
|
||||
itemRenderer.renderItem(wand, itemRenderer.getModelWithOverrides(wand));
|
||||
|
||||
GlStateManager.disableAlphaTest();
|
||||
GlStateManager.disableRescaleNormal();
|
||||
GlStateManager.disableLighting();
|
||||
RenderSystem.disableAlphaTest();
|
||||
RenderSystem.disableRescaleNormal();
|
||||
RenderSystem.disableLighting();
|
||||
|
||||
GlStateManager.popMatrix();
|
||||
GlStateManager.popAttributes();
|
||||
RenderSystem.popMatrix();
|
||||
RenderSystem.popAttributes();
|
||||
}
|
||||
|
||||
protected void renderBlock() {
|
||||
GlStateManager.pushMatrix();
|
||||
RenderSystem.pushMatrix();
|
||||
BufferBuilder buffer = Tessellator.getInstance().getBuffer();
|
||||
buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.BLOCK);
|
||||
GlStateManager.translated(guiLeft + 15, guiTop - 117, 20);
|
||||
GlStateManager.rotatef(-22.5f, .3f, 1f, 0f);
|
||||
GlStateManager.scaled(32, -32, 32);
|
||||
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);
|
||||
|
||||
Tessellator.getInstance().draw();
|
||||
GlStateManager.popMatrix();
|
||||
RenderSystem.popMatrix();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package com.simibubi.create.modules.curiosities.symmetry.client;
|
||||
|
||||
import com.mojang.blaze3d.platform.GLX;
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.simibubi.create.foundation.utility.AnimationTickHolder;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
|
@ -19,14 +19,14 @@ public class SymmetryWandItemRenderer extends ItemStackTileEntityRenderer {
|
|||
SymmetryWandModel mainModel = (SymmetryWandModel) itemRenderer.getModelWithOverrides(stack);
|
||||
float worldTime = AnimationTickHolder.getRenderTick() / 20;
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.translatef(0.5F, 0.5F, 0.5F);
|
||||
RenderSystem.pushMatrix();
|
||||
RenderSystem.translatef(0.5F, 0.5F, 0.5F);
|
||||
itemRenderer.renderItem(stack, mainModel.getBakedModel());
|
||||
|
||||
float lastCoordx = 0;
|
||||
float lastCoordy = 0;
|
||||
|
||||
GlStateManager.disableLighting();
|
||||
RenderSystem.disableLighting();
|
||||
lastCoordx = GLX.lastBrightnessX;
|
||||
lastCoordy = GLX.lastBrightnessY;
|
||||
GLX.glMultiTexCoord2f(GLX.GL_TEXTURE1, 240, 240);
|
||||
|
@ -34,15 +34,15 @@ public class SymmetryWandItemRenderer extends ItemStackTileEntityRenderer {
|
|||
itemRenderer.renderItem(stack, mainModel.getPartial("core"));
|
||||
|
||||
float floating = MathHelper.sin(worldTime) * .05f;
|
||||
GlStateManager.translated(0, floating, 0);
|
||||
RenderSystem.translated(0, floating, 0);
|
||||
float angle = worldTime * -10 % 360;
|
||||
GlStateManager.rotated(angle, 0, 1, 0);
|
||||
RenderSystem.rotated(angle, 0, 1, 0);
|
||||
itemRenderer.renderItem(stack, mainModel.getPartial("bits"));
|
||||
|
||||
GLX.glMultiTexCoord2f(GLX.GL_TEXTURE1, lastCoordx, lastCoordy);
|
||||
GlStateManager.enableLighting();
|
||||
RenderSystem.enableLighting();
|
||||
|
||||
GlStateManager.popMatrix();
|
||||
RenderSystem.popMatrix();
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package com.simibubi.create.modules.curiosities.tools;
|
||||
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.simibubi.create.foundation.block.render.CustomRenderedItemModel;
|
||||
import com.simibubi.create.foundation.utility.AnimationTickHolder;
|
||||
|
||||
|
@ -28,21 +28,21 @@ public class SandPaperItemRenderer extends ItemStackTileEntityRenderer {
|
|||
boolean leftHand = perspective == TransformType.FIRST_PERSON_LEFT_HAND;
|
||||
boolean firstPerson = leftHand || perspective == TransformType.FIRST_PERSON_RIGHT_HAND;
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.translatef(.5f, .5f, .5f);
|
||||
RenderSystem.pushMatrix();
|
||||
RenderSystem.translatef(.5f, .5f, .5f);
|
||||
|
||||
CompoundNBT tag = stack.getOrCreateTag();
|
||||
boolean jeiMode = tag.contains("JEI");
|
||||
|
||||
if (tag.contains("Polishing")) {
|
||||
GlStateManager.pushMatrix();
|
||||
RenderSystem.pushMatrix();
|
||||
|
||||
if (perspective == TransformType.GUI) {
|
||||
GlStateManager.translatef(0.0F, .2f, 1.0F);
|
||||
GlStateManager.scalef(.75f, .75f, .75f);
|
||||
RenderSystem.translatef(0.0F, .2f, 1.0F);
|
||||
RenderSystem.scalef(.75f, .75f, .75f);
|
||||
} else {
|
||||
int modifier = leftHand ? -1 : 1;
|
||||
GlStateManager.rotatef(modifier * 40, 0, 1, 0);
|
||||
RenderSystem.rotatef(modifier * 40, 0, 1, 0);
|
||||
}
|
||||
|
||||
// Reverse bobbing
|
||||
|
@ -52,31 +52,31 @@ public class SandPaperItemRenderer extends ItemStackTileEntityRenderer {
|
|||
float bobbing = -MathHelper.abs(MathHelper.cos(time / 4.0F * (float) Math.PI) * 0.1F);
|
||||
|
||||
if (perspective == TransformType.GUI)
|
||||
GlStateManager.translatef(bobbing, bobbing, 0.0F);
|
||||
RenderSystem.translatef(bobbing, bobbing, 0.0F);
|
||||
else
|
||||
GlStateManager.translatef(0.0f, bobbing, 0.0F);
|
||||
RenderSystem.translatef(0.0f, bobbing, 0.0F);
|
||||
}
|
||||
|
||||
ItemStack toPolish = ItemStack.read(tag.getCompound("Polishing"));
|
||||
itemRenderer.renderItem(toPolish, itemRenderer.getModelWithOverrides(toPolish).getBakedModel());
|
||||
|
||||
GlStateManager.popMatrix();
|
||||
RenderSystem.popMatrix();
|
||||
}
|
||||
|
||||
if (firstPerson) {
|
||||
int itemInUseCount = player.getItemInUseCount();
|
||||
if (itemInUseCount > 0) {
|
||||
int modifier = leftHand ? -1 : 1;
|
||||
GlStateManager.translatef(modifier * .5f, 0, -.25f);
|
||||
GlStateManager.rotatef(modifier * 40, 0, 0, 1);
|
||||
GlStateManager.rotatef(modifier * 10, 1, 0, 0);
|
||||
GlStateManager.rotatef(modifier * 90, 0, 1, 0);
|
||||
RenderSystem.translatef(modifier * .5f, 0, -.25f);
|
||||
RenderSystem.rotatef(modifier * 40, 0, 0, 1);
|
||||
RenderSystem.rotatef(modifier * 10, 1, 0, 0);
|
||||
RenderSystem.rotatef(modifier * 90, 0, 1, 0);
|
||||
}
|
||||
}
|
||||
|
||||
itemRenderer.renderItem(stack, mainModel.getBakedModel());
|
||||
|
||||
GlStateManager.popMatrix();
|
||||
RenderSystem.popMatrix();
|
||||
}
|
||||
|
||||
public static class SandPaperModel extends CustomRenderedItemModel {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package com.simibubi.create.modules.curiosities.zapper;
|
||||
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.FourWayBlock;
|
||||
|
@ -16,9 +16,9 @@ public abstract class ZapperItemRenderer extends ItemStackTileEntityRenderer {
|
|||
protected void renderBlockUsed(ItemStack stack, ItemRenderer itemRenderer) {
|
||||
BlockState state = NBTUtil.readBlockState(stack.getTag().getCompound("BlockUsed"));
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.translatef(-0.3F, -0.45F, -0.0F);
|
||||
GlStateManager.scalef(0.25F, 0.25F, 0.25F);
|
||||
RenderSystem.pushMatrix();
|
||||
RenderSystem.translatef(-0.3F, -0.45F, -0.0F);
|
||||
RenderSystem.scalef(0.25F, 0.25F, 0.25F);
|
||||
IBakedModel modelForState = Minecraft.getInstance().getBlockRendererDispatcher().getModelForState(state);
|
||||
|
||||
if (state.getBlock() instanceof FourWayBlock)
|
||||
|
@ -26,7 +26,7 @@ public abstract class ZapperItemRenderer extends ItemStackTileEntityRenderer {
|
|||
.getModelWithOverrides(new ItemStack(state.getBlock()));
|
||||
|
||||
itemRenderer.renderItem(new ItemStack(state.getBlock()), modelForState);
|
||||
GlStateManager.popMatrix();
|
||||
RenderSystem.popMatrix();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ import java.util.function.Supplier;
|
|||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.simibubi.create.AllSoundEvents;
|
||||
import com.simibubi.create.foundation.utility.TessellatorHelper;
|
||||
|
||||
|
@ -117,8 +117,8 @@ public class ZapperRenderHandler {
|
|||
|
||||
cachedBeams.forEach(beam -> {
|
||||
TessellatorHelper.prepareForDrawing();
|
||||
GlStateManager.disableTexture();
|
||||
GlStateManager.lineWidth(beam.itensity * 40);
|
||||
RenderSystem.disableTexture();
|
||||
RenderSystem.lineWidth(beam.itensity * 40);
|
||||
|
||||
BufferBuilder bufferBuilder = Tessellator.getInstance().getBuffer();
|
||||
bufferBuilder.begin(GL11.GL_LINE_STRIP, DefaultVertexFormats.POSITION);
|
||||
|
@ -126,8 +126,8 @@ public class ZapperRenderHandler {
|
|||
bufferBuilder.pos(beam.end.x, beam.end.y, beam.end.z).endVertex();
|
||||
Tessellator.getInstance().draw();
|
||||
|
||||
GlStateManager.lineWidth(1);
|
||||
GlStateManager.enableTexture();
|
||||
RenderSystem.lineWidth(1);
|
||||
RenderSystem.enableTexture();
|
||||
TessellatorHelper.cleanUpAfterDrawing();
|
||||
});
|
||||
}
|
||||
|
@ -176,7 +176,7 @@ public class ZapperRenderHandler {
|
|||
Minecraft mc = Minecraft.getInstance();
|
||||
boolean rightHand = event.getHand() == Hand.MAIN_HAND ^ mc.player.getPrimaryHand() == HandSide.LEFT;
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
RenderSystem.pushMatrix();
|
||||
|
||||
float recoil = rightHand ? MathHelper.lerp(event.getPartialTicks(), lastRightHandAnimation, rightHandAnimation)
|
||||
: MathHelper.lerp(event.getPartialTicks(), lastLeftHandAnimation, leftHandAnimation);
|
||||
|
@ -194,47 +194,47 @@ public class ZapperRenderHandler {
|
|||
float f2 = -0.3F * MathHelper.sin(f1 * (float) Math.PI);
|
||||
float f3 = 0.4F * MathHelper.sin(f1 * ((float) Math.PI * 2F));
|
||||
float f4 = -0.4F * MathHelper.sin(event.getSwingProgress() * (float) Math.PI);
|
||||
GlStateManager.translatef(f * (f2 + 0.64000005F - .1f), f3 + -0.4F + equipProgress * -0.6F,
|
||||
RenderSystem.translatef(f * (f2 + 0.64000005F - .1f), f3 + -0.4F + equipProgress * -0.6F,
|
||||
f4 + -0.71999997F + .3f + recoil);
|
||||
GlStateManager.rotatef(f * 75.0F, 0.0F, 1.0F, 0.0F);
|
||||
RenderSystem.rotatef(f * 75.0F, 0.0F, 1.0F, 0.0F);
|
||||
float f5 = MathHelper.sin(event.getSwingProgress() * event.getSwingProgress() * (float) Math.PI);
|
||||
float f6 = MathHelper.sin(f1 * (float) Math.PI);
|
||||
GlStateManager.rotatef(f * f6 * 70.0F, 0.0F, 1.0F, 0.0F);
|
||||
GlStateManager.rotatef(f * f5 * -20.0F, 0.0F, 0.0F, 1.0F);
|
||||
RenderSystem.rotatef(f * f6 * 70.0F, 0.0F, 1.0F, 0.0F);
|
||||
RenderSystem.rotatef(f * f5 * -20.0F, 0.0F, 0.0F, 1.0F);
|
||||
AbstractClientPlayerEntity abstractclientplayerentity = mc.player;
|
||||
mc.getTextureManager().bindTexture(abstractclientplayerentity.getLocationSkin());
|
||||
GlStateManager.translatef(f * -1.0F, 3.6F, 3.5F);
|
||||
GlStateManager.rotatef(f * 120.0F, 0.0F, 0.0F, 1.0F);
|
||||
GlStateManager.rotatef(200.0F, 1.0F, 0.0F, 0.0F);
|
||||
GlStateManager.rotatef(f * -135.0F, 0.0F, 1.0F, 0.0F);
|
||||
GlStateManager.translatef(f * 5.6F, 0.0F, 0.0F);
|
||||
GlStateManager.rotatef(f * 40.0F, 0.0F, 1.0F, 0.0F);
|
||||
RenderSystem.translatef(f * -1.0F, 3.6F, 3.5F);
|
||||
RenderSystem.rotatef(f * 120.0F, 0.0F, 0.0F, 1.0F);
|
||||
RenderSystem.rotatef(200.0F, 1.0F, 0.0F, 0.0F);
|
||||
RenderSystem.rotatef(f * -135.0F, 0.0F, 1.0F, 0.0F);
|
||||
RenderSystem.translatef(f * 5.6F, 0.0F, 0.0F);
|
||||
RenderSystem.rotatef(f * 40.0F, 0.0F, 1.0F, 0.0F);
|
||||
PlayerRenderer playerrenderer = mc.getRenderManager().getRenderer(abstractclientplayerentity);
|
||||
GlStateManager.disableCull();
|
||||
RenderSystem.disableCull();
|
||||
if (rightHand) {
|
||||
playerrenderer.renderRightArm(abstractclientplayerentity);
|
||||
} else {
|
||||
playerrenderer.renderLeftArm(abstractclientplayerentity);
|
||||
}
|
||||
GlStateManager.enableCull();
|
||||
GlStateManager.popMatrix();
|
||||
RenderSystem.enableCull();
|
||||
RenderSystem.popMatrix();
|
||||
|
||||
// Render gun
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.translatef(f * (f2 + 0.64000005F - .1f), f3 + -0.4F + equipProgress * -0.6F,
|
||||
RenderSystem.pushMatrix();
|
||||
RenderSystem.translatef(f * (f2 + 0.64000005F - .1f), f3 + -0.4F + equipProgress * -0.6F,
|
||||
f4 + -0.71999997F - 0.1f + recoil);
|
||||
GlStateManager.rotatef(f * f6 * 70.0F, 0.0F, 1.0F, 0.0F);
|
||||
GlStateManager.rotatef(f * f5 * -20.0F, 0.0F, 0.0F, 1.0F);
|
||||
RenderSystem.rotatef(f * f6 * 70.0F, 0.0F, 1.0F, 0.0F);
|
||||
RenderSystem.rotatef(f * f5 * -20.0F, 0.0F, 0.0F, 1.0F);
|
||||
|
||||
GlStateManager.translatef(f * -0.1f, 0.1f, -0.4f);
|
||||
GlStateManager.rotatef(f * 5.0F, 0.0F, 1.0F, 0.0F);
|
||||
RenderSystem.translatef(f * -0.1f, 0.1f, -0.4f);
|
||||
RenderSystem.rotatef(f * 5.0F, 0.0F, 1.0F, 0.0F);
|
||||
|
||||
FirstPersonRenderer firstPersonRenderer = mc.getFirstPersonRenderer();
|
||||
firstPersonRenderer.renderItemSide(mc.player, heldItem,
|
||||
rightHand ? ItemCameraTransforms.TransformType.FIRST_PERSON_RIGHT_HAND
|
||||
: ItemCameraTransforms.TransformType.FIRST_PERSON_LEFT_HAND,
|
||||
!rightHand);
|
||||
GlStateManager.popMatrix();
|
||||
RenderSystem.popMatrix();
|
||||
|
||||
event.setCanceled(true);
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@ import java.util.Vector;
|
|||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.simibubi.create.AllPackets;
|
||||
import com.simibubi.create.ScreenResources;
|
||||
import com.simibubi.create.foundation.gui.AbstractSimiScreen;
|
||||
|
@ -90,7 +90,7 @@ public class ZapperScreen extends AbstractSimiScreen {
|
|||
drawOnBackground(i, j);
|
||||
|
||||
minecraft.getTextureManager().bindTexture(AtlasTexture.LOCATION_BLOCKS_TEXTURE);
|
||||
GlStateManager.enableBlend();
|
||||
RenderSystem.enableBlend();
|
||||
|
||||
renderBlock();
|
||||
renderZapper();
|
||||
|
@ -132,41 +132,41 @@ public class ZapperScreen extends AbstractSimiScreen {
|
|||
}
|
||||
|
||||
protected void renderZapper() {
|
||||
GlStateManager.pushLightingAttributes();
|
||||
GlStateManager.pushMatrix();
|
||||
RenderSystem.pushLightingAttributes();
|
||||
RenderSystem.pushMatrix();
|
||||
|
||||
RenderHelper.enableStandardItemLighting();
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.enableRescaleNormal();
|
||||
GlStateManager.enableAlphaTest();
|
||||
GlStateManager.alphaFunc(516, 0.1F);
|
||||
GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA);
|
||||
GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
RenderSystem.enableBlend();
|
||||
RenderSystem.enableRescaleNormal();
|
||||
RenderSystem.enableAlphaTest();
|
||||
RenderSystem.alphaFunc(516, 0.1F);
|
||||
RenderSystem.blendFunc(RenderSystem.SourceFactor.SRC_ALPHA, RenderSystem.DestFactor.ONE_MINUS_SRC_ALPHA);
|
||||
RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
|
||||
GlStateManager.translated((this.width - this.sWidth) / 2 + 260, this.height / 2 - this.sHeight / 4, 100);
|
||||
GlStateManager.rotatef(90 + 0.2f * animationProgress, 0, 1, 0);
|
||||
GlStateManager.rotatef(-40, .8f, 0, -.0f);
|
||||
GlStateManager.scaled(100, -100, 100);
|
||||
RenderSystem.translated((this.width - this.sWidth) / 2 + 260, this.height / 2 - this.sHeight / 4, 100);
|
||||
RenderSystem.rotatef(90 + 0.2f * animationProgress, 0, 1, 0);
|
||||
RenderSystem.rotatef(-40, .8f, 0, -.0f);
|
||||
RenderSystem.scaled(100, -100, 100);
|
||||
|
||||
IBakedModel model = itemRenderer.getModelWithOverrides(zapper);
|
||||
model.handlePerspective(TransformType.FIXED);
|
||||
itemRenderer.renderItem(zapper, model);
|
||||
|
||||
GlStateManager.disableAlphaTest();
|
||||
GlStateManager.disableRescaleNormal();
|
||||
GlStateManager.disableLighting();
|
||||
RenderSystem.disableAlphaTest();
|
||||
RenderSystem.disableRescaleNormal();
|
||||
RenderSystem.disableLighting();
|
||||
|
||||
GlStateManager.popMatrix();
|
||||
GlStateManager.popAttributes();
|
||||
RenderSystem.popMatrix();
|
||||
RenderSystem.popAttributes();
|
||||
}
|
||||
|
||||
protected void renderBlock() {
|
||||
GlStateManager.pushMatrix();
|
||||
RenderSystem.pushMatrix();
|
||||
BufferBuilder buffer = Tessellator.getInstance().getBuffer();
|
||||
buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.BLOCK);
|
||||
GlStateManager.translated(guiLeft + 1.7f, guiTop - 49, 120);
|
||||
GlStateManager.rotatef(-30f, .5f, .9f, -.1f);
|
||||
GlStateManager.scaled(20, -20, 20);
|
||||
RenderSystem.translated(guiLeft + 1.7f, guiTop - 49, 120);
|
||||
RenderSystem.rotatef(-30f, .5f, .9f, -.1f);
|
||||
RenderSystem.scaled(20, -20, 20);
|
||||
|
||||
BlockState state = Blocks.AIR.getDefaultState();
|
||||
if (zapper.hasTag() && zapper.getTag().contains("BlockUsed"))
|
||||
|
@ -176,7 +176,7 @@ public class ZapperScreen extends AbstractSimiScreen {
|
|||
minecraft.world.rand, EmptyModelData.INSTANCE);
|
||||
|
||||
Tessellator.getInstance().draw();
|
||||
GlStateManager.popMatrix();
|
||||
RenderSystem.popMatrix();
|
||||
}
|
||||
|
||||
protected void writeAdditionalOptions(CompoundNBT nbt) {
|
||||
|
|
|
@ -7,7 +7,7 @@ import static com.simibubi.create.modules.curiosities.zapper.blockzapper.Blockza
|
|||
import static com.simibubi.create.modules.curiosities.zapper.blockzapper.BlockzapperItem.Components.Scope;
|
||||
|
||||
import com.mojang.blaze3d.platform.GLX;
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.simibubi.create.foundation.utility.AnimationTickHolder;
|
||||
import com.simibubi.create.modules.curiosities.zapper.ZapperRenderHandler;
|
||||
import com.simibubi.create.modules.curiosities.zapper.ZapperItemRenderer;
|
||||
|
@ -33,8 +33,8 @@ public class BlockzapperItemRenderer extends ZapperItemRenderer {
|
|||
float pt = Minecraft.getInstance().getRenderPartialTicks();
|
||||
float worldTime = AnimationTickHolder.getRenderTick() / 20;
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.translatef(0.5F, 0.5F, 0.5F);
|
||||
RenderSystem.pushMatrix();
|
||||
RenderSystem.translatef(0.5F, 0.5F, 0.5F);
|
||||
float lastCoordx = GLX.lastBrightnessX;
|
||||
float lastCoordy = GLX.lastBrightnessY;
|
||||
GLX.glMultiTexCoord2f(GLX.GL_TEXTURE1, Math.min(lastCoordx + 60, 240), Math.min(lastCoordy + 120, 240));
|
||||
|
@ -61,7 +61,7 @@ public class BlockzapperItemRenderer extends ZapperItemRenderer {
|
|||
float animation = MathHelper.clamp(MathHelper.lerp(pt, last, current) * 5, 0, 1);
|
||||
|
||||
// Core glows
|
||||
GlStateManager.disableLighting();
|
||||
RenderSystem.disableLighting();
|
||||
float multiplier = MathHelper.sin(worldTime * 5);
|
||||
if (mainHand || offHand) {
|
||||
multiplier = animation;
|
||||
|
@ -71,7 +71,7 @@ public class BlockzapperItemRenderer extends ZapperItemRenderer {
|
|||
if (BlockzapperItem.getTier(Amplifier, stack) != ComponentTier.None)
|
||||
itemRenderer.renderItem(stack, mainModel.getPartial("amplifier_core"));
|
||||
GLX.glMultiTexCoord2f(GLX.GL_TEXTURE1, lastCoordx, lastCoordy);
|
||||
GlStateManager.enableLighting();
|
||||
RenderSystem.enableLighting();
|
||||
|
||||
// Accelerator spins
|
||||
float angle = worldTime * -25;
|
||||
|
@ -80,12 +80,12 @@ public class BlockzapperItemRenderer extends ZapperItemRenderer {
|
|||
|
||||
angle %= 360;
|
||||
float offset = -.155f;
|
||||
GlStateManager.translatef(0, offset, 0);
|
||||
GlStateManager.rotatef(angle, 0, 0, 1);
|
||||
GlStateManager.translatef(0, -offset, 0);
|
||||
RenderSystem.translatef(0, offset, 0);
|
||||
RenderSystem.rotatef(angle, 0, 0, 1);
|
||||
RenderSystem.translatef(0, -offset, 0);
|
||||
renderComponent(stack, mainModel, Accelerator, itemRenderer);
|
||||
|
||||
GlStateManager.popMatrix();
|
||||
RenderSystem.popMatrix();
|
||||
}
|
||||
|
||||
public void renderComponent(ItemStack stack, BlockzapperModel model, Components component,
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package com.simibubi.create.modules.curiosities.zapper.terrainzapper;
|
||||
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.simibubi.create.AllItems;
|
||||
import com.simibubi.create.foundation.utility.NBTHelper;
|
||||
import com.simibubi.create.foundation.utility.TessellatorHelper;
|
||||
|
@ -78,16 +78,16 @@ public class TerrainZapperRenderHandler {
|
|||
if (renderedPosition == null)
|
||||
return;
|
||||
|
||||
GlStateManager.lineWidth(2);
|
||||
RenderSystem.lineWidth(2);
|
||||
TessellatorHelper.prepareForDrawing();
|
||||
GlStateManager.disableTexture();
|
||||
RenderSystem.disableTexture();
|
||||
|
||||
GlStateManager.translated(renderedPosition.getX(), renderedPosition.getY(), renderedPosition.getZ());
|
||||
RenderSystem.translated(renderedPosition.getX(), renderedPosition.getY(), renderedPosition.getZ());
|
||||
WorldRenderer.drawShape(renderedShape, 0, 0, 0, 0f, 0f, 0f, 0.5f);
|
||||
|
||||
GlStateManager.enableTexture();
|
||||
RenderSystem.enableTexture();
|
||||
TessellatorHelper.cleanUpAfterDrawing();
|
||||
GlStateManager.lineWidth(1);
|
||||
RenderSystem.lineWidth(1);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package com.simibubi.create.modules.curiosities.zapper.terrainzapper;
|
||||
|
||||
import com.mojang.blaze3d.platform.GLX;
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.simibubi.create.foundation.utility.AnimationTickHolder;
|
||||
import com.simibubi.create.modules.curiosities.zapper.ZapperRenderHandler;
|
||||
import com.simibubi.create.modules.curiosities.zapper.ZapperItemRenderer;
|
||||
|
@ -24,8 +24,8 @@ public class TerrainzapperItemRenderer extends ZapperItemRenderer {
|
|||
float pt = Minecraft.getInstance().getRenderPartialTicks();
|
||||
float worldTime = AnimationTickHolder.getRenderTick() / 20;
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.translatef(0.5F, 0.5F, 0.5F);
|
||||
RenderSystem.pushMatrix();
|
||||
RenderSystem.translatef(0.5F, 0.5F, 0.5F);
|
||||
float lastCoordx = GLX.lastBrightnessX;
|
||||
float lastCoordy = GLX.lastBrightnessY;
|
||||
GLX.glMultiTexCoord2f(GLX.GL_TEXTURE1, Math.min(lastCoordx + 60, 240), Math.min(lastCoordy + 120, 240));
|
||||
|
@ -47,7 +47,7 @@ public class TerrainzapperItemRenderer extends ZapperItemRenderer {
|
|||
float animation = MathHelper.clamp(MathHelper.lerp(pt, last, current) * 5, 0, 1);
|
||||
|
||||
// Core glows
|
||||
GlStateManager.disableLighting();
|
||||
RenderSystem.disableLighting();
|
||||
float multiplier = MathHelper.sin(worldTime * 5);
|
||||
if (mainHand || offHand) {
|
||||
multiplier = animation;
|
||||
|
@ -56,7 +56,7 @@ public class TerrainzapperItemRenderer extends ZapperItemRenderer {
|
|||
GLX.glMultiTexCoord2f(GLX.GL_TEXTURE1, multiplier * 240, 120);
|
||||
itemRenderer.renderItem(stack, mainModel.getPartial("terrain_core"));
|
||||
GLX.glMultiTexCoord2f(GLX.GL_TEXTURE1, lastCoordx, lastCoordy);
|
||||
GlStateManager.enableLighting();
|
||||
RenderSystem.enableLighting();
|
||||
|
||||
// Accelerator spins
|
||||
float angle = worldTime * -25;
|
||||
|
@ -65,12 +65,12 @@ public class TerrainzapperItemRenderer extends ZapperItemRenderer {
|
|||
|
||||
angle %= 360;
|
||||
float offset = -.155f;
|
||||
GlStateManager.translatef(0, offset, 0);
|
||||
GlStateManager.rotatef(angle, 0, 0, 1);
|
||||
GlStateManager.translatef(0, -offset, 0);
|
||||
RenderSystem.translatef(0, offset, 0);
|
||||
RenderSystem.rotatef(angle, 0, 0, 1);
|
||||
RenderSystem.translatef(0, -offset, 0);
|
||||
itemRenderer.renderItem(stack, mainModel.getPartial("terrain_accelerator"));
|
||||
|
||||
GlStateManager.popMatrix();
|
||||
RenderSystem.popMatrix();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@ import static com.simibubi.create.ScreenResources.STOCKSWITCH;
|
|||
|
||||
import java.util.Arrays;
|
||||
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.simibubi.create.AllBlocks;
|
||||
import com.simibubi.create.AllPackets;
|
||||
import com.simibubi.create.ScreenResources;
|
||||
|
@ -103,10 +103,10 @@ public class StockswitchScreen extends AbstractSimiScreen {
|
|||
|
||||
ScreenResources cursor = te.powered ? ScreenResources.STOCKSWITCH_CURSOR_ON
|
||||
: ScreenResources.STOCKSWITCH_CURSOR_OFF;
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.translatef((cursorPos * (sprite.width - 20) + 10), 0, 0);
|
||||
RenderSystem.pushMatrix();
|
||||
RenderSystem.translatef((cursorPos * (sprite.width - 20) + 10), 0, 0);
|
||||
cursor.draw(this, guiLeft - 4, guiTop + 24);
|
||||
GlStateManager.popMatrix();
|
||||
RenderSystem.popMatrix();
|
||||
|
||||
ScreenElementRenderer.renderBlock(this::getRenderedBlock);
|
||||
}
|
||||
|
@ -137,8 +137,8 @@ public class StockswitchScreen extends AbstractSimiScreen {
|
|||
}
|
||||
|
||||
public BlockState getRenderedBlock() {
|
||||
GlStateManager.translated(guiLeft + STOCKSWITCH.width + 50, guiTop + 100, 0);
|
||||
GlStateManager.rotatef(50, -.5f, 1, -.2f);
|
||||
RenderSystem.translated(guiLeft + STOCKSWITCH.width + 50, guiTop + 100, 0);
|
||||
RenderSystem.rotatef(50, -.5f, 1, -.2f);
|
||||
return AllBlocks.STOCKSWITCH.get().getDefaultState();
|
||||
}
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ import static com.simibubi.create.ScreenResources.PLAYER_INVENTORY;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.simibubi.create.AllBlocks;
|
||||
import com.simibubi.create.AllPackets;
|
||||
import com.simibubi.create.ScreenResources;
|
||||
|
@ -120,8 +120,8 @@ public class FlexcrateScreen extends AbstractSimiContainerScreen<FlexcrateContai
|
|||
}
|
||||
|
||||
public BlockState getRenderedBlock() {
|
||||
GlStateManager.translated(guiLeft + FLEXCRATE.width + 145, guiTop + 115, 0);
|
||||
GlStateManager.rotatef(50, -.5f, 1, -.2f);
|
||||
RenderSystem.translated(guiLeft + FLEXCRATE.width + 145, guiTop + 115, 0);
|
||||
RenderSystem.rotatef(50, -.5f, 1, -.2f);
|
||||
return AllBlocks.FLEXCRATE.get().getDefaultState();
|
||||
}
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ import static net.minecraft.util.text.TextFormatting.GRAY;
|
|||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.simibubi.create.AllPackets;
|
||||
import com.simibubi.create.ScreenResources;
|
||||
import com.simibubi.create.foundation.gui.AbstractSimiContainerScreen;
|
||||
|
@ -62,11 +62,11 @@ public abstract class AbstractFilterScreen<F extends AbstractFilterContainer> ex
|
|||
font.drawString(I18n.format(container.filterItem.getTranslationKey()), x + 15, y + 9, 0x5B5037);
|
||||
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.translated(guiLeft + background.width + 0, guiTop + background.height - 60, 0);
|
||||
GlStateManager.scaled(5, 5, 5);
|
||||
RenderSystem.pushMatrix();
|
||||
RenderSystem.translated(guiLeft + background.width + 0, guiTop + background.height - 60, 0);
|
||||
RenderSystem.scaled(5, 5, 5);
|
||||
itemRenderer.renderItemIntoGUI(container.filterItem, 0, 0);
|
||||
GlStateManager.popMatrix();
|
||||
RenderSystem.popMatrix();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -5,7 +5,7 @@ import java.util.Arrays;
|
|||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.simibubi.create.AllPackets;
|
||||
import com.simibubi.create.ScreenResources;
|
||||
import com.simibubi.create.foundation.gui.widgets.IconButton;
|
||||
|
@ -136,15 +136,15 @@ public class AttributeFilterScreen extends AbstractFilterScreen<AttributeFilterC
|
|||
@Override
|
||||
public void renderWindowForeground(int mouseX, int mouseY, float partialTicks) {
|
||||
ItemStack stack = container.filterInventory.getStackInSlot(1);
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.translatef(0.0F, 0.0F, 32.0F);
|
||||
RenderSystem.pushMatrix();
|
||||
RenderSystem.translatef(0.0F, 0.0F, 32.0F);
|
||||
this.blitOffset = 200;
|
||||
this.itemRenderer.zLevel = 200.0F;
|
||||
this.itemRenderer.renderItemOverlayIntoGUI(font, stack, guiLeft + 59, guiTop + 56,
|
||||
String.valueOf(selectedAttributes.size() - 1));
|
||||
this.blitOffset = 0;
|
||||
this.itemRenderer.zLevel = 0.0F;
|
||||
GlStateManager.popMatrix();
|
||||
RenderSystem.popMatrix();
|
||||
|
||||
super.renderWindowForeground(mouseX, mouseY, partialTicks);
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ import net.minecraft.util.BlockRenderLayer;
|
|||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.Direction.AxisDirection;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IEnviromentBlockReader;
|
||||
import net.minecraft.world.ILightReader;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
|
@ -41,7 +41,7 @@ public class CTGlassPaneBlock extends GlassPaneBlock implements IHaveConnectedTe
|
|||
for (CTSpriteShiftEntry ctSpriteShiftEntry : ctGlass.getBehaviour().getAllCTShifts()) {
|
||||
return new StandardCTBehaviour(ctSpriteShiftEntry) {
|
||||
@Override
|
||||
public boolean connectsTo(BlockState state, BlockState other, IEnviromentBlockReader reader,
|
||||
public boolean connectsTo(BlockState state, BlockState other, ILightReader reader,
|
||||
BlockPos pos, BlockPos otherPos, Direction face) {
|
||||
return state.getBlock() == other.getBlock();
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ import static com.simibubi.create.ScreenResources.SCHEMATIC_TABLE_PROGRESS;
|
|||
import java.nio.file.Paths;
|
||||
import java.util.List;
|
||||
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.simibubi.create.AllBlocks;
|
||||
import com.simibubi.create.CreateClient;
|
||||
import com.simibubi.create.ScreenResources;
|
||||
|
@ -114,32 +114,32 @@ public class SchematicTableScreen extends AbstractSimiContainerScreen<SchematicT
|
|||
int width = (int) (SCHEMATIC_TABLE_PROGRESS.width
|
||||
* MathHelper.lerp(partialTicks, lastChasingProgress, chasingProgress));
|
||||
int height = SCHEMATIC_TABLE_PROGRESS.height;
|
||||
GlStateManager.disableLighting();
|
||||
RenderSystem.disableLighting();
|
||||
blit(mainLeft + 94, mainTop + 56, SCHEMATIC_TABLE_PROGRESS.startX, SCHEMATIC_TABLE_PROGRESS.startY, width,
|
||||
height);
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
RenderSystem.pushMatrix();
|
||||
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.enableRescaleNormal();
|
||||
GlStateManager.enableAlphaTest();
|
||||
RenderSystem.enableBlend();
|
||||
RenderSystem.enableRescaleNormal();
|
||||
RenderSystem.enableAlphaTest();
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
GlStateManager.alphaFunc(516, 0.1F);
|
||||
GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA);
|
||||
GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
RenderSystem.alphaFunc(516, 0.1F);
|
||||
RenderSystem.blendFunc(RenderSystem.SourceFactor.SRC_ALPHA, RenderSystem.DestFactor.ONE_MINUS_SRC_ALPHA);
|
||||
RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
|
||||
GlStateManager.translated(mainLeft + 270, mainTop + 100, 200);
|
||||
GlStateManager.rotatef(50, -.5f, 1, -.2f);
|
||||
GlStateManager.scaled(50, -50, 50);
|
||||
RenderSystem.translated(mainLeft + 270, mainTop + 100, 200);
|
||||
RenderSystem.rotatef(50, -.5f, 1, -.2f);
|
||||
RenderSystem.scaled(50, -50, 50);
|
||||
|
||||
Minecraft.getInstance().getTextureManager().bindTexture(AtlasTexture.LOCATION_BLOCKS_TEXTURE);
|
||||
minecraft.getBlockRendererDispatcher().renderBlockBrightness(AllBlocks.SCHEMATIC_TABLE.get().getDefaultState(),
|
||||
1);
|
||||
|
||||
GlStateManager.disableAlphaTest();
|
||||
GlStateManager.disableRescaleNormal();
|
||||
RenderSystem.disableAlphaTest();
|
||||
RenderSystem.disableRescaleNormal();
|
||||
|
||||
GlStateManager.popMatrix();
|
||||
RenderSystem.popMatrix();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -2,7 +2,7 @@ package com.simibubi.create.modules.schematics.block;
|
|||
|
||||
import java.util.Random;
|
||||
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.simibubi.create.AllBlockPartials;
|
||||
import com.simibubi.create.foundation.block.SafeTileEntityRenderer;
|
||||
import com.simibubi.create.foundation.utility.SuperByteBuffer;
|
||||
|
@ -82,17 +82,17 @@ public class SchematicannonRenderer extends SafeTileEntityRenderer<Schematicanno
|
|||
Vec3d blockLocation = blockLocationXZ.add(0, yOffset + 1, 0).add(cannonOffset);
|
||||
|
||||
// Offset to position
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.translated(blockLocation.x, blockLocation.y, blockLocation.z);
|
||||
RenderSystem.pushMatrix();
|
||||
RenderSystem.translated(blockLocation.x, blockLocation.y, blockLocation.z);
|
||||
|
||||
// Rotation and Scaling effects
|
||||
double scale = .3f;
|
||||
GlStateManager.rotated(360 * t * 2, 1, 1, 0);
|
||||
GlStateManager.scaled(scale, scale, scale);
|
||||
RenderSystem.rotated(360 * t * 2, 1, 1, 0);
|
||||
RenderSystem.scaled(scale, scale, scale);
|
||||
|
||||
// Render the Block
|
||||
Minecraft.getInstance().getBlockRendererDispatcher().renderBlockBrightness(block.state, 1);
|
||||
GlStateManager.popMatrix();
|
||||
RenderSystem.popMatrix();
|
||||
|
||||
// Apply Recoil if block was just launched
|
||||
if ((block.ticksRemaining + 1 - partialTicks) > block.totalTicks - 10) {
|
||||
|
@ -120,7 +120,7 @@ public class SchematicannonRenderer extends SafeTileEntityRenderer<Schematicanno
|
|||
|
||||
TessellatorHelper.prepareFastRender();
|
||||
TessellatorHelper.begin(DefaultVertexFormats.BLOCK);
|
||||
GlStateManager.pushMatrix();
|
||||
RenderSystem.pushMatrix();
|
||||
BufferBuilder buffer = Tessellator.getInstance().getBuffer();
|
||||
BlockState state = tileEntityIn.getBlockState();
|
||||
int lightCoords = state.getPackedLightmapCoords(getWorld(), pos);
|
||||
|
@ -140,7 +140,7 @@ public class SchematicannonRenderer extends SafeTileEntityRenderer<Schematicanno
|
|||
pipe.translate(x, y, z).light(lightCoords).renderInto(buffer);
|
||||
|
||||
TessellatorHelper.draw();
|
||||
GlStateManager.popMatrix();
|
||||
RenderSystem.popMatrix();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ import java.util.List;
|
|||
import java.util.Vector;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.simibubi.create.AllBlocks;
|
||||
import com.simibubi.create.AllPackets;
|
||||
import com.simibubi.create.ScreenResources;
|
||||
|
@ -233,20 +233,20 @@ public class SchematicannonScreen extends AbstractSimiContainerScreen<Schematica
|
|||
}
|
||||
|
||||
protected void renderCannon() {
|
||||
GlStateManager.pushMatrix();
|
||||
RenderSystem.pushMatrix();
|
||||
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.enableRescaleNormal();
|
||||
GlStateManager.enableAlphaTest();
|
||||
RenderSystem.enableBlend();
|
||||
RenderSystem.enableRescaleNormal();
|
||||
RenderSystem.enableAlphaTest();
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
|
||||
GlStateManager.translated(guiLeft + 240, guiTop + 120, 200);
|
||||
GlStateManager.scaled(5, 5, 5);
|
||||
RenderSystem.translated(guiLeft + 240, guiTop + 120, 200);
|
||||
RenderSystem.scaled(5, 5, 5);
|
||||
|
||||
itemRenderer.renderItemIntoGUI(new ItemStack(AllBlocks.SCHEMATICANNON.block), 0, 0);
|
||||
|
||||
GlStateManager.popMatrix();
|
||||
RenderSystem.popMatrix();
|
||||
}
|
||||
|
||||
protected void renderBlueprintHighlight() {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package com.simibubi.create.modules.schematics.client;
|
||||
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.simibubi.create.ScreenResources;
|
||||
|
||||
import net.minecraft.client.MainWindow;
|
||||
|
@ -13,9 +13,9 @@ public class BlueprintHotbarOverlay extends AbstractGui {
|
|||
MainWindow mainWindow = Minecraft.getInstance().mainWindow;
|
||||
int x = mainWindow.getScaledWidth() / 2 - 92;
|
||||
int y = mainWindow.getScaledHeight() - 23;
|
||||
GlStateManager.enableAlphaTest();
|
||||
RenderSystem.enableAlphaTest();
|
||||
ScreenResources.BLUEPRINT_SLOT.draw(this, x + 20 * slot, y);
|
||||
GlStateManager.disableAlphaTest();
|
||||
RenderSystem.disableAlphaTest();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ import java.nio.file.StandardOpenOption;
|
|||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.simibubi.create.AllItems;
|
||||
import com.simibubi.create.AllKeys;
|
||||
import com.simibubi.create.AllSpecialTextures;
|
||||
|
@ -165,9 +165,9 @@ public class SchematicAndQuillHandler {
|
|||
return;
|
||||
|
||||
TessellatorHelper.prepareForDrawing();
|
||||
GlStateManager.lineWidth(2);
|
||||
GlStateManager.color4f(1, 1, 1, 1);
|
||||
GlStateManager.disableTexture();
|
||||
RenderSystem.lineWidth(2);
|
||||
RenderSystem.color4f(1, 1, 1, 1);
|
||||
RenderSystem.disableTexture();
|
||||
|
||||
if (secondPos == null) {
|
||||
// 1st Step
|
||||
|
@ -208,21 +208,21 @@ public class SchematicAndQuillHandler {
|
|||
Vec3d faceMin = center.add(vec.mul(radii).add(onFaceOffset));
|
||||
Vec3d faceMax = center.add(vec.mul(radii).subtract(onFaceOffset));
|
||||
|
||||
GlStateManager.enableTexture();
|
||||
RenderSystem.enableTexture();
|
||||
TessellatorHelper.begin();
|
||||
AllSpecialTextures.SELECTION.bind();
|
||||
TessellatorHelper.doubleFace(Tessellator.getInstance().getBuffer(), new BlockPos(faceMin),
|
||||
new BlockPos(faceMax.subtract(faceMin)), 1 / 16f * selectedFace.getAxisDirection().getOffset(),
|
||||
false, false, false);
|
||||
TessellatorHelper.draw();
|
||||
GlStateManager.disableTexture();
|
||||
RenderSystem.disableTexture();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
GlStateManager.lineWidth(1);
|
||||
GlStateManager.enableTexture();
|
||||
RenderSystem.lineWidth(1);
|
||||
RenderSystem.enableTexture();
|
||||
TessellatorHelper.cleanUpAfterDrawing();
|
||||
}
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ package com.simibubi.create.modules.schematics.client;
|
|||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.simibubi.create.AllItems;
|
||||
import com.simibubi.create.CreateClient;
|
||||
import com.simibubi.create.ScreenResources;
|
||||
|
@ -134,11 +134,11 @@ public class SchematicEditScreen extends AbstractSimiScreen {
|
|||
font.drawString(rotationLabel, x + 10, y + 52, ScreenResources.FONT_COLOR);
|
||||
font.drawString(mirrorLabel, x + 10, y + 72, ScreenResources.FONT_COLOR);
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.translated(guiLeft + 220, guiTop + 20, 0);
|
||||
GlStateManager.scaled(3, 3, 3);
|
||||
RenderSystem.pushMatrix();
|
||||
RenderSystem.translated(guiLeft + 220, guiTop + 20, 0);
|
||||
RenderSystem.scaled(3, 3, 3);
|
||||
itemRenderer.renderItemIntoGUI(new ItemStack(AllItems.BLUEPRINT.get()), 0, 0);
|
||||
GlStateManager.popMatrix();
|
||||
RenderSystem.popMatrix();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -11,7 +11,7 @@ import org.lwjgl.opengl.GL11;
|
|||
import org.lwjgl.system.MemoryUtil;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
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;
|
||||
|
@ -181,7 +181,7 @@ public class SchematicHologram {
|
|||
|
||||
if (state.getCount() > 0) {
|
||||
state.getVertexFormat().startDrawing(MemoryUtil.memAddress(pair.getSecond()));
|
||||
GlStateManager.drawArrays(state.getMode(), 0, state.getCount());
|
||||
RenderSystem.drawArrays(state.getMode(), 0, state.getCount());
|
||||
state.getVertexFormat().endDrawing();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package com.simibubi.create.modules.schematics.client.tools;
|
||||
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.simibubi.create.AllKeys;
|
||||
|
||||
import net.minecraft.client.renderer.WorldRenderer;
|
||||
|
@ -44,15 +44,15 @@ public class DeployTool extends PlacementToolBase {
|
|||
max = new BlockPos(bb.maxX, bb.maxY, bb.maxZ);
|
||||
}
|
||||
|
||||
GlStateManager.lineWidth(2);
|
||||
GlStateManager.color4f(.5f, .8f, 1, 1);
|
||||
GlStateManager.disableTexture();
|
||||
RenderSystem.lineWidth(2);
|
||||
RenderSystem.color4f(.5f, .8f, 1, 1);
|
||||
RenderSystem.disableTexture();
|
||||
|
||||
WorldRenderer.drawBoundingBox(min.getX() - 1 / 8d, min.getY() + 1 / 16d, min.getZ() - 1 / 8d,
|
||||
max.getX() + 1 / 8d, max.getY() + 1 / 8d, max.getZ() + 1 / 8d, .8f, .9f, 1, 1);
|
||||
|
||||
GlStateManager.lineWidth(1);
|
||||
GlStateManager.enableTexture();
|
||||
RenderSystem.lineWidth(1);
|
||||
RenderSystem.enableTexture();
|
||||
|
||||
}
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue