mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-19 03:39:17 +00:00
more work
This commit is contained in:
1 parent
fb8808168a
commit
551104fc63
15 files changed
+370
-339
No files matched your search
@@ -10,17 +10,24 @@
|
||||
*/
|
||||
package vazkii.botania.client.core.handler;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.mojang.blaze3d.platform.GLX;
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.Atlases;
|
||||
import net.minecraft.client.renderer.BlockRendererDispatcher;
|
||||
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||
import net.minecraft.client.renderer.RenderTypeLookup;
|
||||
import net.minecraft.client.renderer.model.IBakedModel;
|
||||
import net.minecraft.client.renderer.texture.AtlasTexture;
|
||||
import net.minecraft.client.renderer.texture.OverlayTexture;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.ILightReader;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.client.event.RenderWorldLastEvent;
|
||||
@@ -38,6 +45,8 @@ public final class AstrolabePreviewHandler {
|
||||
@SubscribeEvent
|
||||
public static void onWorldRenderLast(RenderWorldLastEvent event) {
|
||||
World world = Minecraft.getInstance().world;
|
||||
MatrixStack ms = event.getMatrixStack();
|
||||
IRenderTypeBuffer.Impl buffers = Minecraft.getInstance().getBufferBuilders().getEntityVertexConsumers();
|
||||
for (PlayerEntity player : world.getPlayers()) {
|
||||
ItemStack currentStack = player.getHeldItemMainhand();
|
||||
if(currentStack.isEmpty() || !(currentStack.getItem() instanceof ItemAstrolabe))
|
||||
@@ -46,58 +55,50 @@ public final class AstrolabePreviewHandler {
|
||||
if(!currentStack.isEmpty() && currentStack.getItem() instanceof ItemAstrolabe) {
|
||||
Block block = ItemAstrolabe.getBlock(currentStack);
|
||||
if(block != Blocks.AIR)
|
||||
renderPlayerLook(player, currentStack);
|
||||
renderPlayerLook(ms, buffers, player, currentStack);
|
||||
}
|
||||
}
|
||||
|
||||
ShaderHelper.useShader(ShaderHelper.alpha, shader -> {
|
||||
int alpha = GlStateManager.getUniformLocation(shader, "alpha");
|
||||
ShaderHelper.FLOAT_BUF.position(0);
|
||||
ShaderHelper.FLOAT_BUF.put(0, 0.4F);
|
||||
GlStateManager.uniform1(alpha, ShaderHelper.FLOAT_BUF);
|
||||
});
|
||||
// todo 1.15 need to disable depth test
|
||||
buffers.draw();
|
||||
ShaderHelper.releaseShader();
|
||||
}
|
||||
|
||||
private static void renderPlayerLook(PlayerEntity player, ItemStack stack) {
|
||||
private static void renderPlayerLook(MatrixStack ms, IRenderTypeBuffer buffers, PlayerEntity player, ItemStack stack) {
|
||||
List<BlockPos> coords = ItemAstrolabe.getBlocksToPlace(stack, player);
|
||||
if (ItemAstrolabe.hasBlocks(stack, player, coords)) {
|
||||
BlockState state = ItemAstrolabe.getBlockState(stack);
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
ShaderHelper.useShader(ShaderHelper.alpha, shader -> {
|
||||
int alpha = GlStateManager.getUniformLocation(shader, "alpha");
|
||||
ShaderHelper.FLOAT_BUF.position(0);
|
||||
ShaderHelper.FLOAT_BUF.put(0, 0.4F);
|
||||
GlStateManager.uniform1(alpha, ShaderHelper.FLOAT_BUF);
|
||||
});
|
||||
|
||||
for(BlockPos coord : coords)
|
||||
renderBlockAt(state, coord);
|
||||
|
||||
ShaderHelper.releaseShader();
|
||||
GL11.glPopMatrix();
|
||||
renderBlockAt(ms, buffers, state, coord);
|
||||
}
|
||||
}
|
||||
|
||||
private static void renderBlockAt(BlockState state, BlockPos pos) {
|
||||
double renderPosX = Minecraft.getInstance().getRenderManager().renderPosX;
|
||||
double renderPosY = Minecraft.getInstance().getRenderManager().renderPosY;
|
||||
double renderPosZ = Minecraft.getInstance().getRenderManager().renderPosZ;
|
||||
private static void renderBlockAt(MatrixStack ms, IRenderTypeBuffer buffers, BlockState state, BlockPos pos) {
|
||||
double renderPosX = Minecraft.getInstance().getRenderManager().info.getProjectedView().getX();
|
||||
double renderPosY = Minecraft.getInstance().getRenderManager().info.getProjectedView().getY();
|
||||
double renderPosZ = Minecraft.getInstance().getRenderManager().info.getProjectedView().getZ();
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.translated(-renderPosX, -renderPosY, -renderPosZ);
|
||||
GlStateManager.disableDepthTest();
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
ms.push();
|
||||
ms.translate(-renderPosX, -renderPosY, -renderPosZ);
|
||||
|
||||
Minecraft.getInstance().textureManager.bindTexture(AtlasTexture.LOCATION_BLOCKS_TEXTURE);
|
||||
BlockRendererDispatcher brd = Minecraft.getInstance().getBlockRendererDispatcher();
|
||||
GlStateManager.translatef(pos.getX(), pos.getY(), pos.getZ() + 1);
|
||||
GlStateManager.color4f(1, 1, 1, 1);
|
||||
brd.renderBlockBrightness(state, 1.0F);
|
||||
ms.translate(pos.getX(), pos.getY(), pos.getZ() + 1);
|
||||
IBakedModel model = brd.getModelForState(state);
|
||||
int color = Minecraft.getInstance().getBlockColors().getColor(state, null, null, 0);
|
||||
float r = (float)(color >> 16 & 255) / 255.0F;
|
||||
float g = (float)(color >> 8 & 255) / 255.0F;
|
||||
float b = (float)(color & 255) / 255.0F;
|
||||
// always use entity translucent layer so blending is turned on
|
||||
brd.getBlockModelRenderer().render(ms.peek(), buffers.getBuffer(Atlases.getEntityTranslucent()), state, model, r, g, b, 0xF000F0, OverlayTexture.DEFAULT_UV);
|
||||
|
||||
GlStateManager.color4f(1F, 1F, 1F, 1F);
|
||||
GlStateManager.enableDepthTest();
|
||||
GlStateManager.popMatrix();
|
||||
GlStateManager.popMatrix();
|
||||
ms.pop();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -10,25 +10,31 @@
|
||||
*/
|
||||
package vazkii.botania.client.core.handler;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.mojang.blaze3d.platform.GLX;
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.entity.player.AbstractClientPlayerEntity;
|
||||
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||
import net.minecraft.client.renderer.Vector3f;
|
||||
import net.minecraft.client.renderer.entity.IEntityRenderer;
|
||||
import net.minecraft.client.renderer.entity.layers.LayerRenderer;
|
||||
import net.minecraft.client.renderer.entity.model.PlayerModel;
|
||||
import net.minecraft.client.renderer.model.ItemCameraTransforms;
|
||||
import net.minecraft.client.renderer.texture.AtlasTexture;
|
||||
import net.minecraft.client.renderer.texture.OverlayTexture;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.inventory.EquipmentSlotType;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.potion.Effects;
|
||||
import top.theillusivec4.curios.api.CuriosAPI;
|
||||
import top.theillusivec4.curios.api.capability.CuriosCapability;
|
||||
import top.theillusivec4.curios.api.inventory.CurioStackHandler;
|
||||
import vazkii.botania.api.item.AccessoryRenderHelper;
|
||||
import vazkii.botania.api.item.ICosmeticAttachable;
|
||||
import vazkii.botania.api.item.IPhantomInkable;
|
||||
import vazkii.botania.common.core.handler.ConfigHandler;
|
||||
import vazkii.botania.common.item.ModItems;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
@@ -41,24 +47,19 @@ public final class BaubleRenderHandler extends LayerRenderer<AbstractClientPlaye
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(@Nonnull AbstractClientPlayerEntity player, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
|
||||
dispatchRenders(player, limbSwing, limbSwingAmount, partialTicks, ageInTicks, netHeadYaw, headPitch, scale);
|
||||
public void render(MatrixStack ms, IRenderTypeBuffer buffers, int light, @Nonnull AbstractClientPlayerEntity player, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch) {
|
||||
dispatchRenders(ms, buffers, light, player, limbSwing, limbSwingAmount, partialTicks, ageInTicks, netHeadYaw, headPitch);
|
||||
|
||||
// todo 1.13 recheck what this was checking for (make sure to account for config+invis)
|
||||
/*
|
||||
if(!h.getStackInSlot(3).isEmpty())
|
||||
renderManaTablet(player);
|
||||
*/
|
||||
if (ConfigHandler.CLIENT.renderAccessories.get() && player.getActivePotionEffect(Effects.INVISIBILITY) == null) {
|
||||
renderManaTablet(ms, buffers, player);
|
||||
}
|
||||
}
|
||||
|
||||
// Like LayerCurios, but with Botania-specific logic
|
||||
private void dispatchRenders(PlayerEntity player, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
|
||||
GlStateManager.pushMatrix();
|
||||
private void dispatchRenders(MatrixStack ms, IRenderTypeBuffer buffers, int light, PlayerEntity player, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch) {
|
||||
ms.push();
|
||||
CuriosAPI.getCuriosHandler(player).ifPresent(handler -> {
|
||||
Map<String, CurioStackHandler> curios = handler.getCurioMap();
|
||||
if(player.isSneaking()) {
|
||||
GlStateManager.translatef(0, 0.2F, 0);
|
||||
}
|
||||
|
||||
for(Map.Entry<String, CurioStackHandler> e : curios.entrySet()) {
|
||||
for(int i = 0; i < e.getValue().getSlots(); i++) {
|
||||
@@ -77,10 +78,9 @@ public final class BaubleRenderHandler extends LayerRenderer<AbstractClientPlaye
|
||||
ItemStack cosmetic = attachable.getCosmeticItem(stack);
|
||||
cosmetic.getCapability(CuriosCapability.ITEM).ifPresent(c -> {
|
||||
if(c.hasRender(e.getKey(), player)) {
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.color4f(1F, 1F, 1F, 1F);
|
||||
c.doRender(e.getKey(), player, limbSwing, limbSwingAmount, partialTicks, ageInTicks, netHeadYaw, headPitch, scale);
|
||||
GlStateManager.popMatrix();
|
||||
ms.push();
|
||||
c.render(e.getKey(), ms, buffers, light, player, limbSwing, limbSwingAmount, partialTicks, ageInTicks, netHeadYaw, headPitch);
|
||||
ms.pop();
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -88,38 +88,31 @@ public final class BaubleRenderHandler extends LayerRenderer<AbstractClientPlaye
|
||||
}
|
||||
}
|
||||
});
|
||||
GlStateManager.popMatrix();
|
||||
ms.pop();
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
private void renderManaTablet(PlayerEntity player) {
|
||||
private void renderManaTablet(MatrixStack ms, IRenderTypeBuffer buffers, PlayerEntity player) {
|
||||
boolean renderedOne = false;
|
||||
for(int i = 0; i < player.inventory.getSizeInventory(); i++) {
|
||||
ItemStack stack = player.inventory.getStackInSlot(i);
|
||||
if(!stack.isEmpty() && stack.getItem() == ModItems.manaTablet) {
|
||||
GlStateManager.pushMatrix();
|
||||
Minecraft.getInstance().textureManager.bindTexture(AtlasTexture.LOCATION_BLOCKS_TEXTURE);
|
||||
ms.push();
|
||||
AccessoryRenderHelper.rotateIfSneaking(player);
|
||||
boolean armor = !player.getItemStackFromSlot(EquipmentSlotType.LEGS).isEmpty();
|
||||
GlStateManager.rotatef(90, 0, 1, 0);
|
||||
GlStateManager.rotatef(180, 0, 0, 1);
|
||||
GlStateManager.translated(0, -0.6, 0);
|
||||
GlStateManager.scaled(0.55, 0.55, 0.55);
|
||||
ms.multiply(Vector3f.POSITIVE_Y.getDegreesQuaternion(90));
|
||||
ms.multiply(Vector3f.POSITIVE_Z.getDegreesQuaternion(180));
|
||||
ms.translate(0, -0.6, 0);
|
||||
ms.scale(0.55F, 0.55F, 0.55F);
|
||||
|
||||
if (renderedOne)
|
||||
GlStateManager.translatef(0F, 0F, armor ? 0.55F : 0.5F);
|
||||
ms.translate(0F, 0F, armor ? 0.55F : 0.5F);
|
||||
else
|
||||
GlStateManager.translatef(0F, 0F, armor ? -0.55F : -0.5F);
|
||||
ms.translate(0F, 0F, armor ? -0.55F : -0.5F);
|
||||
|
||||
GlStateManager.scalef(0.75F, 0.75F, 0.75F);
|
||||
ms.scale(0.75F, 0.75F, 0.75F);
|
||||
|
||||
GlStateManager.color3f(1F, 1F, 1F);
|
||||
int light = 15728880;
|
||||
int lightmapX = light % 65536;
|
||||
int lightmapY = light / 65536;
|
||||
GLX.glMultiTexCoord2f(GLX.GL_TEXTURE1, lightmapX, lightmapY);
|
||||
Minecraft.getInstance().getItemRenderer().renderItem(stack, ItemCameraTransforms.TransformType.NONE);
|
||||
GlStateManager.popMatrix();
|
||||
Minecraft.getInstance().getItemRenderer().renderItem(stack, ItemCameraTransforms.TransformType.NONE, 0xF000F0, OverlayTexture.DEFAULT_UV, ms, buffers);
|
||||
ms.pop();
|
||||
|
||||
if(renderedOne)
|
||||
return;
|
||||
@@ -127,9 +120,4 @@ public final class BaubleRenderHandler extends LayerRenderer<AbstractClientPlaye
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldCombineTextures() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -10,8 +10,14 @@
|
||||
*/
|
||||
package vazkii.botania.client.core.handler;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import com.mojang.blaze3d.vertex.IVertexBuilder;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||
import net.minecraft.client.renderer.Matrix4f;
|
||||
import net.minecraft.client.renderer.RenderState;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||
import net.minecraft.entity.Entity;
|
||||
@@ -25,6 +31,7 @@ import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.client.event.RenderWorldLastEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.common.ObfuscationReflectionHelper;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import vazkii.botania.api.subtile.RadiusDescriptor;
|
||||
import vazkii.botania.api.subtile.TileEntitySpecialFlower;
|
||||
@@ -35,11 +42,22 @@ import vazkii.botania.common.item.ItemTwigWand;
|
||||
import vazkii.botania.common.item.ModItems;
|
||||
import vazkii.botania.common.lib.LibMisc;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.awt.*;
|
||||
import java.util.Optional;
|
||||
|
||||
@Mod.EventBusSubscriber(value = Dist.CLIENT, modid = LibMisc.MOD_ID)
|
||||
public final class BlockHighlightRenderHandler {
|
||||
private static final RenderType RECTANGLE;
|
||||
private static final RenderType CIRCLE;
|
||||
static {
|
||||
// todo 1.15 check GL state, AT's for the fields
|
||||
RenderState.TransparencyState translucentTransparency = ObfuscationReflectionHelper.getPrivateValue(RenderState.class, null, "field_228515_g_");
|
||||
RenderState.CullState disableCull = ObfuscationReflectionHelper.getPrivateValue(RenderState.class, null, "field_228491_A_");
|
||||
RenderType.State glState = RenderType.State.builder().transparency(translucentTransparency).cull(disableCull).build(false);
|
||||
RECTANGLE = RenderType.of("botania:rectangle_highlight", DefaultVertexFormats.POSITION_COLOR, GL11.GL_QUADS, 256, false, true, glState);
|
||||
CIRCLE = RenderType.of("botania:circle_highlight", DefaultVertexFormats.POSITION_COLOR, GL11.GL_TRIANGLE_FAN, 256, false, true, glState);
|
||||
}
|
||||
|
||||
private BlockHighlightRenderHandler() {}
|
||||
|
||||
@@ -47,13 +65,10 @@ public final class BlockHighlightRenderHandler {
|
||||
public static void onWorldRenderLast(RenderWorldLastEvent event) {
|
||||
Minecraft mc = Minecraft.getInstance();
|
||||
RayTraceResult pos = mc.objectMouseOver;
|
||||
MatrixStack ms = event.getMatrixStack();
|
||||
IRenderTypeBuffer.Impl buffers = IRenderTypeBuffer.immediate(Tessellator.getInstance().getBuffer());
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.disableTexture();
|
||||
GL11.glPushAttrib(GL11.GL_LIGHTING_BIT);
|
||||
GlStateManager.disableLighting();
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
ms.push();
|
||||
|
||||
if (Botania.proxy.isClientPlayerWearingMonocle() && pos != null && pos.getType() == RayTraceResult.Type.BLOCK) {
|
||||
BlockPos bPos = ((BlockRayTraceResult) pos).getPos();
|
||||
@@ -71,8 +86,8 @@ public final class BlockHighlightRenderHandler {
|
||||
RadiusDescriptor descriptor = subtile.getRadius();
|
||||
if (descriptor != null) {
|
||||
if (descriptor.isCircle())
|
||||
renderCircle(descriptor.getSubtileCoords(), descriptor.getCircleRadius());
|
||||
else renderRectangle(descriptor.getAABB(), true, null, (byte) 32);
|
||||
renderCircle(ms, buffers, descriptor.getSubtileCoords(), descriptor.getCircleRadius());
|
||||
else renderRectangle(ms, buffers, descriptor.getAABB(), true, null, (byte) 32);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -95,110 +110,94 @@ public final class BlockHighlightRenderHandler {
|
||||
else if(e.ticksExisted > 47)
|
||||
alpha *= Math.min(1F - (e.ticksExisted - 47 + event.getPartialTicks()) / 8F, 1F);
|
||||
|
||||
renderRectangle(aabb, false, color, (byte) alpha);
|
||||
renderRectangle(ms, buffers, aabb, false, color, (byte) alpha);
|
||||
offY += 0.001;
|
||||
}
|
||||
|
||||
GlStateManager.enableTexture();
|
||||
GlStateManager.disableBlend();
|
||||
GL11.glPopAttrib();
|
||||
GlStateManager.popMatrix();
|
||||
ms.pop();
|
||||
buffers.draw();
|
||||
}
|
||||
|
||||
private static void renderRectangle(AxisAlignedBB aabb, boolean inner, Color color, byte alpha) {
|
||||
double renderPosX = Minecraft.getInstance().getRenderManager().renderPosX;
|
||||
double renderPosY = Minecraft.getInstance().getRenderManager().renderPosY;
|
||||
double renderPosZ = Minecraft.getInstance().getRenderManager().renderPosZ;
|
||||
private static void renderRectangle(MatrixStack ms, IRenderTypeBuffer buffers, AxisAlignedBB aabb, boolean inner, @Nullable Color color, byte alpha) {
|
||||
double renderPosX = Minecraft.getInstance().getRenderManager().info.getProjectedView().getX();
|
||||
double renderPosY = Minecraft.getInstance().getRenderManager().info.getProjectedView().getY();
|
||||
double renderPosZ = Minecraft.getInstance().getRenderManager().info.getProjectedView().getZ();
|
||||
|
||||
GlStateManager.disableCull();
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.translated(aabb.minX - renderPosX, aabb.minY - renderPosY, aabb.minZ - renderPosZ);
|
||||
ms.push();
|
||||
ms.translate(aabb.minX - renderPosX, aabb.minY - renderPosY, aabb.minZ - renderPosZ);
|
||||
|
||||
if(color == null)
|
||||
color = Color.getHSBColor(ClientTickHandler.ticksInGame % 200 / 200F, 0.6F, 1F);
|
||||
GlStateManager.color4f(color.getRed() / 255F, color.getGreen() / 255F, color.getBlue() / 255F, alpha / 255F);
|
||||
|
||||
double f = 1F / 16F;
|
||||
double x = aabb.maxX - aabb.minX - f;
|
||||
double z = aabb.maxZ - aabb.minZ - f;
|
||||
float f = 1F / 16F;
|
||||
float x = (float) (aabb.maxX - aabb.minX - f);
|
||||
float z = (float) (aabb.maxZ - aabb.minZ - f);
|
||||
|
||||
Tessellator tessellator = Tessellator.getInstance();
|
||||
tessellator.getBuffer().begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION);
|
||||
tessellator.getBuffer().pos(x, f, f).endVertex();
|
||||
tessellator.getBuffer().pos(f, f, f).endVertex();
|
||||
tessellator.getBuffer().pos(f, f, z).endVertex();
|
||||
tessellator.getBuffer().pos(x, f, z).endVertex();
|
||||
tessellator.draw();
|
||||
IVertexBuilder buffer = buffers.getBuffer(RECTANGLE);
|
||||
Matrix4f mat = ms.peek().getModel();
|
||||
buffer.vertex(mat, x, f, f).color(color.getRed(), color.getGreen(), color.getBlue(), alpha).endVertex();
|
||||
buffer.vertex(mat, f, f, f).color(color.getRed(), color.getGreen(), color.getBlue(), alpha).endVertex();
|
||||
buffer.vertex(mat, f, f, z).color(color.getRed(), color.getGreen(), color.getBlue(), alpha).endVertex();
|
||||
buffer.vertex(mat, x, f, z).color(color.getRed(), color.getGreen(), color.getBlue(), alpha).endVertex();
|
||||
|
||||
if(inner) {
|
||||
x += f;
|
||||
z += f;
|
||||
double f1 = f + f / 4F;
|
||||
GlStateManager.color4f(color.getRed() / 255F, color.getGreen() / 255F, color.getBlue() / 255F, (alpha * 2) / 255F);
|
||||
tessellator.getBuffer().begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION);
|
||||
tessellator.getBuffer().pos(x, f1, 0).endVertex();
|
||||
tessellator.getBuffer().pos(0, f1, 0).endVertex();
|
||||
tessellator.getBuffer().pos(0, f1, z).endVertex();
|
||||
tessellator.getBuffer().pos(x, f1, z).endVertex();
|
||||
tessellator.draw();
|
||||
float f1 = f + f / 4F;
|
||||
alpha *= 2;
|
||||
buffer.vertex(mat, x, f1, 0).color(color.getRed(), color.getGreen(), color.getBlue(), alpha).endVertex();
|
||||
buffer.vertex(mat, 0, f1, 0).color(color.getRed(), color.getGreen(), color.getBlue(), alpha).endVertex();
|
||||
buffer.vertex(mat, 0, f1, z).color(color.getRed(), color.getGreen(), color.getBlue(), alpha).endVertex();
|
||||
buffer.vertex(mat, x, f1, z).color(color.getRed(), color.getGreen(), color.getBlue(), alpha).endVertex();
|
||||
}
|
||||
|
||||
GlStateManager.color4f(1, 1, 1, 1);
|
||||
GlStateManager.popMatrix();
|
||||
GlStateManager.enableCull();
|
||||
ms.pop();
|
||||
}
|
||||
|
||||
private static void renderCircle(BlockPos center, double radius) {
|
||||
double renderPosX = Minecraft.getInstance().getRenderManager().renderPosX;
|
||||
double renderPosY = Minecraft.getInstance().getRenderManager().renderPosY;
|
||||
double renderPosZ = Minecraft.getInstance().getRenderManager().renderPosZ;
|
||||
private static void renderCircle(MatrixStack ms, IRenderTypeBuffer buffers, BlockPos center, double radius) {
|
||||
double renderPosX = Minecraft.getInstance().getRenderManager().info.getProjectedView().getX();
|
||||
double renderPosY = Minecraft.getInstance().getRenderManager().info.getProjectedView().getY();
|
||||
double renderPosZ = Minecraft.getInstance().getRenderManager().info.getProjectedView().getZ();
|
||||
|
||||
GlStateManager.disableCull();
|
||||
GlStateManager.pushMatrix();
|
||||
ms.push();
|
||||
double x = center.getX() + 0.5;
|
||||
double y = center.getY();
|
||||
double z = center.getZ() + 0.5;
|
||||
GlStateManager.translated(x - renderPosX, y - renderPosY, z - renderPosZ);
|
||||
ms.translate(x - renderPosX, y - renderPosY, z - renderPosZ);
|
||||
int color = Color.HSBtoRGB(ClientTickHandler.ticksInGame % 200 / 200F, 0.6F, 1F);
|
||||
|
||||
Color colorRGB = new Color(color);
|
||||
GlStateManager.color4f(colorRGB.getRed() / 255F, colorRGB.getGreen() / 255F, colorRGB.getBlue() / 255F, 0.125F);
|
||||
|
||||
double f = 1F / 16F;
|
||||
int alpha = 32;
|
||||
float f = 1F / 16F;
|
||||
|
||||
int totalAngles = 360;
|
||||
int drawAngles = 360;
|
||||
int step = totalAngles / drawAngles;
|
||||
|
||||
radius -= f;
|
||||
Tessellator tessellator = Tessellator.getInstance();
|
||||
tessellator.getBuffer().begin(GL11.GL_TRIANGLE_FAN, DefaultVertexFormats.POSITION);
|
||||
tessellator.getBuffer().pos(0, f, 0).endVertex();
|
||||
IVertexBuilder buffer = buffers.getBuffer(CIRCLE);
|
||||
Matrix4f mat = ms.peek().getModel();
|
||||
buffer.vertex(mat, 0, f, 0).color(colorRGB.getRed(), colorRGB.getGreen(), colorRGB.getBlue(), alpha).endVertex();
|
||||
for(int i = 0; i < totalAngles + 1; i += step) {
|
||||
double rad = (totalAngles - i) * Math.PI / 180.0;
|
||||
double xp = Math.cos(rad) * radius;
|
||||
double zp = Math.sin(rad) * radius;
|
||||
tessellator.getBuffer().pos(xp, f, zp).endVertex();
|
||||
float xp = (float) (Math.cos(rad) * radius);
|
||||
float zp = (float) (Math.sin(rad) * radius);
|
||||
buffer.vertex(mat, xp, f, zp).color(colorRGB.getRed(), colorRGB.getGreen(), colorRGB.getBlue(), alpha).endVertex();
|
||||
}
|
||||
tessellator.getBuffer().pos(0, f, 0).endVertex();
|
||||
tessellator.draw();
|
||||
buffer.vertex(mat, 0, f, 0).color(colorRGB.getRed(), colorRGB.getGreen(), colorRGB.getBlue(), alpha).endVertex();
|
||||
|
||||
radius += f;
|
||||
double f1 = f + f / 4F;
|
||||
GlStateManager.color4f(colorRGB.getRed() / 255F, colorRGB.getGreen() / 255F, colorRGB.getBlue() / 255F, 0.25F);
|
||||
tessellator.getBuffer().begin(GL11.GL_TRIANGLE_FAN, DefaultVertexFormats.POSITION);
|
||||
tessellator.getBuffer().pos(0, f1, 0).endVertex();
|
||||
float f1 = f + f / 4F;
|
||||
alpha = 64;
|
||||
buffer.vertex(mat, 0, f1, 0).color(colorRGB.getRed(), colorRGB.getGreen(), colorRGB.getBlue(), alpha).endVertex();
|
||||
for(int i = 0; i < totalAngles + 1; i += step) {
|
||||
double rad = (totalAngles - i) * Math.PI / 180.0;
|
||||
double xp = Math.cos(rad) * radius;
|
||||
double zp = Math.sin(rad) * radius;
|
||||
tessellator.getBuffer().pos(xp, f1, zp).endVertex();
|
||||
float xp = (float) (Math.cos(rad) * radius);
|
||||
float zp = (float) (Math.sin(rad) * radius);
|
||||
buffer.vertex(mat, xp, f1, zp).color(colorRGB.getRed(), colorRGB.getGreen(), colorRGB.getBlue(), alpha).endVertex();
|
||||
}
|
||||
tessellator.getBuffer().pos(0, f1, 0).endVertex();
|
||||
tessellator.draw();
|
||||
GlStateManager.color4f(1, 1, 1, 1);
|
||||
GlStateManager.popMatrix();
|
||||
GlStateManager.enableCull();
|
||||
buffer.vertex(mat, 0, f1, 0).color(colorRGB.getRed(), colorRGB.getGreen(), colorRGB.getBlue(), alpha).endVertex();
|
||||
ms.pop();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -10,10 +10,15 @@
|
||||
*/
|
||||
package vazkii.botania.client.core.handler;
|
||||
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.mojang.blaze3d.vertex.IVertexBuilder;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||
import net.minecraft.client.renderer.Matrix4f;
|
||||
import net.minecraft.client.renderer.RenderState;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
@@ -26,6 +31,7 @@ import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.event.RenderWorldLastEvent;
|
||||
import net.minecraftforge.common.util.LazyOptional;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.ObfuscationReflectionHelper;
|
||||
import net.minecraftforge.items.CapabilityItemHandler;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
import net.minecraftforge.items.IItemHandlerModifiable;
|
||||
@@ -39,19 +45,26 @@ import vazkii.botania.api.wand.IWireframeAABBProvider;
|
||||
import java.awt.*;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.OptionalDouble;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public final class BoundTileRenderer {
|
||||
private static RenderType lineWidth(double width) {
|
||||
// todo 1.15 AT for these once confirmed working, also make static final cached rendertypes
|
||||
RenderState.LayerState projectionLayering = ObfuscationReflectionHelper.getPrivateValue(RenderState.class, null, "field_228500_J_");
|
||||
RenderState.TransparencyState translucentTransparency = ObfuscationReflectionHelper.getPrivateValue(RenderState.class, null, "field_228515_g_");
|
||||
RenderState.WriteMaskState colorMask = ObfuscationReflectionHelper.getPrivateValue(RenderState.class, null, "field_228496_F_");
|
||||
|
||||
return RenderType.of("lines", DefaultVertexFormats.POSITION_COLOR, GL11.GL_LINES, 256, RenderType.State.builder().lineWidth(new RenderState.LineState(OptionalDouble.of(width))).layering(projectionLayering).transparency(translucentTransparency).writeMaskState(colorMask).build(false));
|
||||
}
|
||||
|
||||
private BoundTileRenderer() {}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onWorldRenderLast(RenderWorldLastEvent event) {
|
||||
GlStateManager.pushMatrix();
|
||||
GL11.glPushAttrib(GL11.GL_LIGHTING_BIT);
|
||||
GlStateManager.disableDepthTest();
|
||||
GlStateManager.disableTexture();
|
||||
GlStateManager.enableBlend();
|
||||
MatrixStack ms = event.getMatrixStack();
|
||||
IRenderTypeBuffer.Impl buffers = IRenderTypeBuffer.immediate(Tessellator.getInstance().getBuffer());
|
||||
ms.push();
|
||||
|
||||
PlayerEntity player = Minecraft.getInstance().player;
|
||||
int color = Color.HSBtoRGB(ClientTickHandler.ticksInGame % 200 / 200F, 0.6F, 1F);
|
||||
@@ -59,13 +72,13 @@ public final class BoundTileRenderer {
|
||||
if(!player.getHeldItemMainhand().isEmpty() && player.getHeldItemMainhand().getItem() instanceof ICoordBoundItem) {
|
||||
BlockPos coords = ((ICoordBoundItem) player.getHeldItemMainhand().getItem()).getBinding(player.getHeldItemMainhand());
|
||||
if(coords != null)
|
||||
renderBlockOutlineAt(coords, color);
|
||||
renderBlockOutlineAt(ms, buffers, coords, color);
|
||||
}
|
||||
|
||||
if(!player.getHeldItemOffhand().isEmpty() && player.getHeldItemOffhand().getItem() instanceof ICoordBoundItem) {
|
||||
BlockPos coords = ((ICoordBoundItem) player.getHeldItemOffhand().getItem()).getBinding(player.getHeldItemOffhand());
|
||||
if(coords != null)
|
||||
renderBlockOutlineAt(coords, color);
|
||||
renderBlockOutlineAt(ms, buffers, coords, color);
|
||||
}
|
||||
|
||||
LazyOptional<IItemHandler> mainInvCap = player.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, Direction.UP);
|
||||
@@ -80,36 +93,30 @@ public final class BoundTileRenderer {
|
||||
IWireframeCoordinateListProvider provider = (IWireframeCoordinateListProvider) stackInSlot.getItem();
|
||||
List<BlockPos> coordsList = provider.getWireframesToDraw(player, stackInSlot);
|
||||
for (BlockPos coords : coordsList)
|
||||
renderBlockOutlineAt(coords, color);
|
||||
renderBlockOutlineAt(ms, buffers, coords, color);
|
||||
|
||||
BlockPos coords = provider.getSourceWireframe(player, stackInSlot);
|
||||
if (coords != null && coords.getY() > -1)
|
||||
renderBlockOutlineAt(coords, color, 5F);
|
||||
renderBlockOutlineAt(ms, buffers, coords, color, 5F);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
GlStateManager.enableDepthTest();
|
||||
GlStateManager.enableTexture();
|
||||
GlStateManager.disableBlend();
|
||||
GL11.glPopAttrib();
|
||||
GlStateManager.popMatrix();
|
||||
ms.pop();
|
||||
buffers.draw();
|
||||
}
|
||||
|
||||
private static void renderBlockOutlineAt(BlockPos pos, int color) {
|
||||
renderBlockOutlineAt(pos, color, 1F);
|
||||
private static void renderBlockOutlineAt(MatrixStack ms, IRenderTypeBuffer buffers, BlockPos pos, int color) {
|
||||
renderBlockOutlineAt(ms, buffers, pos, color, 1F);
|
||||
}
|
||||
|
||||
private static void renderBlockOutlineAt(BlockPos pos, int color, float thickness) {
|
||||
double renderPosX = Minecraft.getInstance().getRenderManager().renderPosX;
|
||||
double renderPosY = Minecraft.getInstance().getRenderManager().renderPosY;
|
||||
double renderPosZ = Minecraft.getInstance().getRenderManager().renderPosZ;
|
||||
private static void renderBlockOutlineAt(MatrixStack ms, IRenderTypeBuffer buffers, BlockPos pos, int color, float thickness) {
|
||||
double renderPosX = Minecraft.getInstance().getRenderManager().info.getProjectedView().getX();
|
||||
double renderPosY = Minecraft.getInstance().getRenderManager().info.getProjectedView().getY();
|
||||
double renderPosZ = Minecraft.getInstance().getRenderManager().info.getProjectedView().getZ();
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.translated(pos.getX() - renderPosX, pos.getY() - renderPosY, pos.getZ() - renderPosZ + 1);
|
||||
Color colorRGB = new Color(color);
|
||||
GlStateManager.color4f(colorRGB.getRed() / 255F, colorRGB.getGreen() / 255F, colorRGB.getBlue() / 255F, 1);
|
||||
ms.push();
|
||||
ms.translate(pos.getX() - renderPosX, pos.getY() - renderPosY, pos.getZ() - renderPosZ + 1);
|
||||
|
||||
World world = Minecraft.getInstance().world;
|
||||
BlockState state = world.getBlockState(pos);
|
||||
@@ -129,73 +136,72 @@ public final class BoundTileRenderer {
|
||||
if(list == null)
|
||||
break drawWireframe;
|
||||
|
||||
GlStateManager.scalef(1F, 1F, 1F);
|
||||
ms.scale(1F, 1F, 1F);
|
||||
|
||||
GlStateManager.lineWidth(thickness);
|
||||
IVertexBuilder buffer = buffers.getBuffer(lineWidth(thickness));
|
||||
for(AxisAlignedBB axis : list) {
|
||||
axis = axis.offset(-pos.getX(), -pos.getY(), -(pos.getZ() + 1));
|
||||
renderBlockOutline(axis);
|
||||
renderBlockOutline(ms.peek().getModel(), buffer, axis, color);
|
||||
}
|
||||
|
||||
GlStateManager.lineWidth(thickness + 3F);
|
||||
GlStateManager.color4f(colorRGB.getRed() / 255F, colorRGB.getGreen() / 255F, colorRGB.getBlue() / 255F, 0.25F);
|
||||
buffer = buffers.getBuffer(lineWidth(thickness + 3));
|
||||
int alpha = 64;
|
||||
color = (color & ~0xff000000) | (alpha << 24);
|
||||
for(AxisAlignedBB axis : list) {
|
||||
axis = axis.offset(-pos.getX(), -pos.getY(), -(pos.getZ() + 1));
|
||||
renderBlockOutline(axis);
|
||||
renderBlockOutline(ms.peek().getModel(), buffer, axis, color);
|
||||
}
|
||||
}
|
||||
|
||||
GlStateManager.color4f(1, 1, 1, 1);
|
||||
GlStateManager.popMatrix();
|
||||
ms.pop();
|
||||
}
|
||||
|
||||
private static void renderBlockOutline(AxisAlignedBB aabb) {
|
||||
Tessellator tessellator = Tessellator.getInstance();
|
||||
private static void renderBlockOutline(Matrix4f mat, IVertexBuilder buffer, AxisAlignedBB aabb, int color) {
|
||||
float ix = (float) aabb.minX;
|
||||
float iy = (float) aabb.minY;
|
||||
float iz = (float) aabb.minZ;
|
||||
float ax = (float) aabb.maxX;
|
||||
float ay = (float) aabb.maxY;
|
||||
float az = (float) aabb.maxZ;
|
||||
int a = (color >> 24) & 0xFF;
|
||||
int r = (color >> 16) & 0xFF;
|
||||
int g = (color >> 8) & 0xFF;
|
||||
int b = color & 0xFF;
|
||||
|
||||
double ix = aabb.minX;
|
||||
double iy = aabb.minY;
|
||||
double iz = aabb.minZ;
|
||||
double ax = aabb.maxX;
|
||||
double ay = aabb.maxY;
|
||||
double az = aabb.maxZ;
|
||||
buffer.vertex(mat, ix, iy, iz).color(r, g, b, a).endVertex();
|
||||
buffer.vertex(mat, ix, ay, iz).color(r, g, b, a).endVertex();
|
||||
|
||||
tessellator.getBuffer().begin(GL11.GL_LINES, DefaultVertexFormats.POSITION);
|
||||
tessellator.getBuffer().pos(ix, iy, iz).endVertex();
|
||||
tessellator.getBuffer().pos(ix, ay, iz).endVertex();
|
||||
buffer.vertex(mat, ix, ay, iz).color(r, g, b, a).endVertex();
|
||||
buffer.vertex(mat, ax, ay, iz).color(r, g, b, a).endVertex();
|
||||
|
||||
tessellator.getBuffer().pos(ix, ay, iz).endVertex();
|
||||
tessellator.getBuffer().pos(ax, ay, iz).endVertex();
|
||||
buffer.vertex(mat, ax, ay, iz).color(r, g, b, a).endVertex();
|
||||
buffer.vertex(mat, ax, iy, iz).color(r, g, b, a).endVertex();
|
||||
|
||||
tessellator.getBuffer().pos(ax, ay, iz).endVertex();
|
||||
tessellator.getBuffer().pos(ax, iy, iz).endVertex();
|
||||
buffer.vertex(mat, ax, iy, iz).color(r, g, b, a).endVertex();
|
||||
buffer.vertex(mat, ix, iy, iz).color(r, g, b, a).endVertex();
|
||||
|
||||
tessellator.getBuffer().pos(ax, iy, iz).endVertex();
|
||||
tessellator.getBuffer().pos(ix, iy, iz).endVertex();
|
||||
buffer.vertex(mat, ix, iy, az).color(r, g, b, a).endVertex();
|
||||
buffer.vertex(mat, ix, ay, az).color(r, g, b, a).endVertex();
|
||||
|
||||
tessellator.getBuffer().pos(ix, iy, az).endVertex();
|
||||
tessellator.getBuffer().pos(ix, ay, az).endVertex();
|
||||
buffer.vertex(mat, ix, iy, az).color(r, g, b, a).endVertex();
|
||||
buffer.vertex(mat, ax, iy, az).color(r, g, b, a).endVertex();
|
||||
|
||||
tessellator.getBuffer().pos(ix, iy, az).endVertex();
|
||||
tessellator.getBuffer().pos(ax, iy, az).endVertex();
|
||||
buffer.vertex(mat, ax, iy, az).color(r, g, b, a).endVertex();
|
||||
buffer.vertex(mat, ax, ay, az).color(r, g, b, a).endVertex();
|
||||
|
||||
tessellator.getBuffer().pos(ax, iy, az).endVertex();
|
||||
tessellator.getBuffer().pos(ax, ay, az).endVertex();
|
||||
buffer.vertex(mat, ix, ay, az).color(r, g, b, a).endVertex();
|
||||
buffer.vertex(mat, ax, ay, az).color(r, g, b, a).endVertex();
|
||||
|
||||
tessellator.getBuffer().pos(ix, ay, az).endVertex();
|
||||
tessellator.getBuffer().pos(ax, ay, az).endVertex();
|
||||
buffer.vertex(mat, ix, iy, iz).color(r, g, b, a).endVertex();
|
||||
buffer.vertex(mat, ix, iy, az).color(r, g, b, a).endVertex();
|
||||
|
||||
tessellator.getBuffer().pos(ix, iy, iz).endVertex();
|
||||
tessellator.getBuffer().pos(ix, iy, az).endVertex();
|
||||
buffer.vertex(mat, ix, ay, iz).color(r, g, b, a).endVertex();
|
||||
buffer.vertex(mat, ix, ay, az).color(r, g, b, a).endVertex();
|
||||
|
||||
tessellator.getBuffer().pos(ix, ay, iz).endVertex();
|
||||
tessellator.getBuffer().pos(ix, ay, az).endVertex();
|
||||
buffer.vertex(mat, ax, iy, iz).color(r, g, b, a).endVertex();
|
||||
buffer.vertex(mat, ax, iy, az).color(r, g, b, a).endVertex();
|
||||
|
||||
tessellator.getBuffer().pos(ax, iy, iz).endVertex();
|
||||
tessellator.getBuffer().pos(ax, iy, az).endVertex();
|
||||
|
||||
tessellator.getBuffer().pos(ax, ay, iz).endVertex();
|
||||
tessellator.getBuffer().pos(ax, ay, az).endVertex();
|
||||
|
||||
tessellator.draw();
|
||||
buffer.vertex(mat, ax, ay, iz).color(r, g, b, a).endVertex();
|
||||
buffer.vertex(mat, ax, ay, az).color(r, g, b, a).endVertex();
|
||||
}
|
||||
}
|
||||
@@ -95,12 +95,11 @@ public final class ModelHandler {
|
||||
registerSubtiles();
|
||||
|
||||
RenderTileFloatingFlower renderTileFloatingFlower = new RenderTileFloatingFlower();
|
||||
RenderTilePylon renderTilePylon = new RenderTilePylon();
|
||||
ClientRegistry.bindTileEntityRenderer(TileAltar.TYPE, RenderTileAltar::new);
|
||||
ClientRegistry.bindTileEntityRenderer(TileSpreader.TYPE, RenderTileSpreader::new);
|
||||
ClientRegistry.bindTileEntityRenderer(TilePool.TYPE, new RenderTilePool());
|
||||
ClientRegistry.bindTileEntityRenderer(TileRuneAltar.TYPE, new RenderTileRuneAltar());
|
||||
ClientRegistry.bindTileEntityRenderer(TilePylon.TYPE, renderTilePylon);
|
||||
ClientRegistry.bindTileEntityRenderer(TilePool.TYPE, RenderTilePool::new);
|
||||
ClientRegistry.bindTileEntityRenderer(TileRuneAltar.TYPE, RenderTileRuneAltar::new);
|
||||
ClientRegistry.bindTileEntityRenderer(TilePylon.TYPE, RenderTilePylon::new);
|
||||
ClientRegistry.bindTileEntityRenderer(TileEnchanter.TYPE, new RenderTileEnchanter());
|
||||
ClientRegistry.bindTileEntityRenderer(TileAlfPortal.TYPE, RenderTileAlfPortal::new);
|
||||
ClientRegistry.bindTileEntityRenderer(TileFloatingFlower.TYPE, renderTileFloatingFlower);
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
package vazkii.botania.client.model;
|
||||
|
||||
public interface IPylonModel {
|
||||
void renderRing();
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.mojang.blaze3d.vertex.IVertexBuilder;
|
||||
|
||||
void renderCrystal();
|
||||
public interface IPylonModel {
|
||||
void renderRing(MatrixStack ms, IVertexBuilder buffer, int light, int overlay);
|
||||
|
||||
void renderCrystal(MatrixStack ms, IVertexBuilder buffer, int light, int overlay);
|
||||
}
|
||||
@@ -1,5 +1,8 @@
|
||||
package vazkii.botania.client.model;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.mojang.blaze3d.vertex.IVertexBuilder;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.client.renderer.model.Model;
|
||||
import net.minecraft.client.renderer.model.ModelRenderer;
|
||||
|
||||
@@ -14,7 +17,8 @@ public class ModelCloak extends Model {
|
||||
public ModelRenderer sideR;
|
||||
|
||||
public ModelCloak() {
|
||||
|
||||
super(RenderType::getEntityCutout);
|
||||
|
||||
textureWidth = 64;
|
||||
textureHeight = 64;
|
||||
float s = 0.01F;
|
||||
@@ -35,10 +39,11 @@ public class ModelCloak extends Model {
|
||||
|
||||
}
|
||||
|
||||
public void render(float f5) {
|
||||
collar.render(f5);
|
||||
sideL.render(f5);
|
||||
sideR.render(f5);
|
||||
@Override
|
||||
public void render(MatrixStack ms, IVertexBuilder buffer, int light, int overlay, float r, float g, float b, float a) {
|
||||
collar.render(ms, buffer, light, overlay, r, g, b, a);
|
||||
sideL.render(ms, buffer, light, overlay, r, g, b, a);
|
||||
sideR.render(ms, buffer, light, overlay, r, g, b, a);
|
||||
}
|
||||
|
||||
public void setRotateAngle(ModelRenderer modelRenderer, float x, float y, float z) {
|
||||
|
||||
@@ -10,6 +10,9 @@
|
||||
*/
|
||||
package vazkii.botania.client.model;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.mojang.blaze3d.vertex.IVertexBuilder;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.client.renderer.model.Model;
|
||||
import net.minecraft.client.renderer.model.ModelRenderer;
|
||||
|
||||
@@ -31,6 +34,7 @@ public class ModelPylonGaia extends Model implements IPylonModel {
|
||||
private final ModelRenderer shardrfb;
|
||||
|
||||
public ModelPylonGaia() {
|
||||
super(RenderType::getEntityTranslucent);
|
||||
|
||||
textureWidth = 64;
|
||||
textureHeight = 64;
|
||||
@@ -81,28 +85,24 @@ public class ModelPylonGaia extends Model implements IPylonModel {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderCrystal() {
|
||||
float f = 1F / 16F;
|
||||
|
||||
shardrft.render(f);
|
||||
shardlbt.render(f);
|
||||
shardrbt.render(f);
|
||||
shardlft.render(f);
|
||||
public void renderCrystal(MatrixStack ms, IVertexBuilder buffer, int light, int overlay) {
|
||||
shardrft.render(ms, buffer, light, overlay);
|
||||
shardlbt.render(ms, buffer, light, overlay);
|
||||
shardrbt.render(ms, buffer, light, overlay);
|
||||
shardlft.render(ms, buffer, light, overlay);
|
||||
|
||||
shardrfb.render(f);
|
||||
shardlbb.render(f);
|
||||
shardrbb.render(f);
|
||||
shardlfb.render(f);
|
||||
shardrfb.render(ms, buffer, light, overlay);
|
||||
shardlbb.render(ms, buffer, light, overlay);
|
||||
shardrbb.render(ms, buffer, light, overlay);
|
||||
shardlfb.render(ms, buffer, light, overlay);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderRing() {
|
||||
float f = 1F / 16F;
|
||||
|
||||
platef.render(f);
|
||||
plateb.render(f);
|
||||
platel.render(f);
|
||||
plater.render(f);
|
||||
public void renderRing(MatrixStack ms, IVertexBuilder buffer, int light, int overlay) {
|
||||
platef.render(ms, buffer, light, overlay);
|
||||
plateb.render(ms, buffer, light, overlay);
|
||||
platel.render(ms, buffer, light, overlay);
|
||||
plater.render(ms, buffer, light, overlay);
|
||||
}
|
||||
|
||||
private void setRotation(ModelRenderer model, float x, float y, float z) {
|
||||
@@ -111,4 +111,9 @@ public class ModelPylonGaia extends Model implements IPylonModel {
|
||||
model.rotateAngleY = y;
|
||||
model.rotateAngleZ = z;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(MatrixStack ms, IVertexBuilder buffer, int light, int overlay, float r, float g, float b, float a) {
|
||||
throw new UnsupportedOperationException("unimplemented");
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,9 @@
|
||||
*/
|
||||
package vazkii.botania.client.model;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.mojang.blaze3d.vertex.IVertexBuilder;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.client.renderer.model.Model;
|
||||
import net.minecraft.client.renderer.model.ModelRenderer;
|
||||
|
||||
@@ -26,7 +29,8 @@ public class ModelPylonMana extends Model implements IPylonModel {
|
||||
private final ModelRenderer shardrb;
|
||||
|
||||
public ModelPylonMana() {
|
||||
|
||||
super(RenderType::getEntityTranslucent);
|
||||
|
||||
textureWidth = 64;
|
||||
textureHeight = 64;
|
||||
|
||||
@@ -63,23 +67,19 @@ public class ModelPylonMana extends Model implements IPylonModel {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderCrystal() {
|
||||
float f = 1F / 16F;
|
||||
|
||||
shardlf.render(f);
|
||||
shardrf.render(f);
|
||||
shardlb.render(f);
|
||||
shardrb.render(f);
|
||||
public void renderCrystal(MatrixStack ms, IVertexBuilder buffer, int light, int overlay) {
|
||||
shardlf.render(ms, buffer, light, overlay);
|
||||
shardrf.render(ms, buffer, light, overlay);
|
||||
shardlb.render(ms, buffer, light, overlay);
|
||||
shardrb.render(ms, buffer, light, overlay);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderRing() {
|
||||
float f = 1F / 16F;
|
||||
|
||||
platef.render(f);
|
||||
plateb.render(f);
|
||||
platel.render(f);
|
||||
plater.render(f);
|
||||
public void renderRing(MatrixStack ms, IVertexBuilder buffer, int light, int overlay) {
|
||||
platef.render(ms, buffer, light, overlay);
|
||||
plateb.render(ms, buffer, light, overlay);
|
||||
platel.render(ms, buffer, light, overlay);
|
||||
plater.render(ms, buffer, light, overlay);
|
||||
}
|
||||
|
||||
private void setRotation(ModelRenderer model, float x, float y, float z) {
|
||||
@@ -87,4 +87,9 @@ public class ModelPylonMana extends Model implements IPylonModel {
|
||||
model.rotateAngleY = y;
|
||||
model.rotateAngleZ = z;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(MatrixStack ms, IVertexBuilder buffer, int light, int overlay, float r, float g, float b, float a) {
|
||||
throw new UnsupportedOperationException("unimplemented");
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,9 @@
|
||||
*/
|
||||
package vazkii.botania.client.model;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.mojang.blaze3d.vertex.IVertexBuilder;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.client.renderer.model.Model;
|
||||
import net.minecraft.client.renderer.model.ModelRenderer;
|
||||
|
||||
@@ -31,6 +34,7 @@ public class ModelPylonNatura extends Model implements IPylonModel {
|
||||
private final ModelRenderer shardrfb;
|
||||
|
||||
public ModelPylonNatura() {
|
||||
super(RenderType::getEntityTranslucent);
|
||||
|
||||
textureWidth = 64;
|
||||
textureHeight = 64;
|
||||
@@ -81,28 +85,24 @@ public class ModelPylonNatura extends Model implements IPylonModel {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderCrystal() {
|
||||
float f = 1F / 16F;
|
||||
|
||||
shardrft.render(f);
|
||||
shardlbt.render(f);
|
||||
shardrbt.render(f);
|
||||
shardlft.render(f);
|
||||
public void renderCrystal(MatrixStack ms, IVertexBuilder buffer, int light, int overlay) {
|
||||
shardrft.render(ms, buffer, light, overlay);
|
||||
shardlbt.render(ms, buffer, light, overlay);
|
||||
shardrbt.render(ms, buffer, light, overlay);
|
||||
shardlft.render(ms, buffer, light, overlay);
|
||||
|
||||
shardrfb.render(f);
|
||||
shardlbb.render(f);
|
||||
shardrbb.render(f);
|
||||
shardlfb.render(f);
|
||||
shardrfb.render(ms, buffer, light, overlay);
|
||||
shardlbb.render(ms, buffer, light, overlay);
|
||||
shardrbb.render(ms, buffer, light, overlay);
|
||||
shardlfb.render(ms, buffer, light, overlay);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderRing() {
|
||||
float f = 1F / 16F;
|
||||
|
||||
platef.render(f);
|
||||
plateb.render(f);
|
||||
platel.render(f);
|
||||
plater.render(f);
|
||||
public void renderRing(MatrixStack ms, IVertexBuilder buffer, int light, int overlay) {
|
||||
platef.render(ms, buffer, light, overlay);
|
||||
plateb.render(ms, buffer, light, overlay);
|
||||
platel.render(ms, buffer, light, overlay);
|
||||
plater.render(ms, buffer, light, overlay);
|
||||
}
|
||||
|
||||
private void setRotation(ModelRenderer model, float x, float y, float z) {
|
||||
@@ -111,4 +111,9 @@ public class ModelPylonNatura extends Model implements IPylonModel {
|
||||
model.rotateAngleY = y;
|
||||
model.rotateAngleZ = z;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(MatrixStack ms, IVertexBuilder buffer, int light, int overlay, float r, float g, float b, float a) {
|
||||
throw new UnsupportedOperationException("unimplemented");
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,9 @@
|
||||
*/
|
||||
package vazkii.botania.client.model;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.mojang.blaze3d.vertex.IVertexBuilder;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.client.renderer.model.Model;
|
||||
import net.minecraft.client.renderer.model.ModelRenderer;
|
||||
|
||||
@@ -18,6 +21,7 @@ public class ModelTinyPotato extends Model {
|
||||
final ModelRenderer potato;
|
||||
|
||||
public ModelTinyPotato() {
|
||||
super(RenderType::getEntitySolid);
|
||||
textureWidth = 16;
|
||||
textureHeight = 16;
|
||||
|
||||
@@ -27,8 +31,8 @@ public class ModelTinyPotato extends Model {
|
||||
potato.setTextureSize(64, 32);
|
||||
}
|
||||
|
||||
public void render() {
|
||||
potato.render(1F / 16F);
|
||||
@Override
|
||||
public void render(MatrixStack ms, IVertexBuilder buffer, int light, int overlay, float r, float g, float b, float a) {
|
||||
potato.render(ms, buffer, light, overlay, r, g, b, a);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -10,15 +10,20 @@
|
||||
*/
|
||||
package vazkii.botania.client.render.tile;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import com.mojang.blaze3d.vertex.IVertexBuilder;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||
import net.minecraft.client.renderer.RenderTypeLookup;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.model.IBakedModel;
|
||||
import net.minecraft.client.renderer.texture.AtlasTexture;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRenderer;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import vazkii.botania.api.mana.IPoolOverlayProvider;
|
||||
import vazkii.botania.client.core.handler.ClientTickHandler;
|
||||
@@ -38,28 +43,24 @@ public class RenderTilePool extends TileEntityRenderer<TilePool> {
|
||||
// Overrides for when we call this TESR from a cart
|
||||
public static int cartMana = -1;
|
||||
|
||||
public RenderTilePool(TileEntityRendererDispatcher manager) {
|
||||
super(manager);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(@Nullable TilePool pool, double d0, double d1, double d2, float f, int digProgress) {
|
||||
public void render(@Nullable TilePool pool, float f, MatrixStack ms, IRenderTypeBuffer buffers, int light, int overlay) {
|
||||
if(pool != null && (!pool.getWorld().isBlockLoaded(pool.getPos())
|
||||
|| !(pool.getBlockState().getBlock() instanceof BlockPool)))
|
||||
return;
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
GlStateManager.enableRescaleNormal();
|
||||
ms.push();
|
||||
|
||||
GlStateManager.color4f(1F, 1F, 1F, 1F);
|
||||
if (pool == null) { // A null pool means we are calling the TESR without a pool (on a minecart). Adjust accordingly
|
||||
GlStateManager.translatef(0, 0, -1);
|
||||
} else {
|
||||
GlStateManager.translated(d0, d1, d2);
|
||||
ms.translate(0, 0, -1);
|
||||
}
|
||||
|
||||
boolean fab = pool != null && ((BlockPool) pool.getBlockState().getBlock()).variant == BlockPool.Variant.FABULOUS;
|
||||
|
||||
Minecraft.getInstance().textureManager.bindTexture(AtlasTexture.LOCATION_BLOCKS_TEXTURE);
|
||||
|
||||
if (fab) {
|
||||
float time = ClientTickHandler.ticksInGame + ClientTickHandler.partialTicks;
|
||||
time += new Random(pool.getPos().getX() ^ pool.getPos().getY() ^ pool.getPos().getZ()).nextInt(100000);
|
||||
@@ -68,13 +69,14 @@ public class RenderTilePool extends TileEntityRenderer<TilePool> {
|
||||
int red = (color & 0xFF0000) >> 16;
|
||||
int green = (color & 0xFF00) >> 8;
|
||||
int blue = color & 0xFF;
|
||||
IBakedModel model = Minecraft.getInstance().getBlockRendererDispatcher().getBlockModelShapes().getModel(pool.getWorld().getBlockState(pool.getPos()));
|
||||
Minecraft.getInstance().getBlockRendererDispatcher().getBlockModelRenderer().renderModelBrightnessColor(model, 1.0F, red / 255F, green / 255F, blue / 255F);
|
||||
BlockState state = pool.getBlockState();
|
||||
IBakedModel model = Minecraft.getInstance().getBlockRendererDispatcher().getBlockModelShapes().getModel(state);
|
||||
IVertexBuilder buffer = buffers.getBuffer(RenderTypeLookup.getBlockLayer(state));
|
||||
Minecraft.getInstance().getBlockRendererDispatcher().getBlockModelRenderer()
|
||||
.render(ms.peek(), buffer, state, model, red / 255F, green / 255F, blue / 255F, light, overlay);
|
||||
}
|
||||
|
||||
GlStateManager.translatef(0.5F, 1.5F, 0.5F);
|
||||
GlStateManager.color4f(1, 1, 1, 1);
|
||||
GlStateManager.enableRescaleNormal();
|
||||
ms.translate(0.5F, 1.5F, 0.5F);
|
||||
|
||||
int mana = pool == null ? cartMana : pool.getCurrentMana();
|
||||
int cap = pool == null ? -1 : pool.manaCap;
|
||||
@@ -129,7 +131,7 @@ public class RenderTilePool extends TileEntityRenderer<TilePool> {
|
||||
GlStateManager.disableBlend();
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
GlStateManager.popMatrix();
|
||||
ms.pop();
|
||||
|
||||
cartMana = -1;
|
||||
}
|
||||
|
||||
@@ -12,9 +12,12 @@ package vazkii.botania.client.render.tile;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import com.mojang.blaze3d.vertex.IVertexBuilder;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.client.renderer.Vector3f;
|
||||
import net.minecraft.client.renderer.tileentity.ItemStackTileEntityRenderer;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRenderer;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
|
||||
@@ -48,83 +51,88 @@ public class RenderTilePylon extends TileEntityRenderer<TilePylon> {
|
||||
// Overrides for when we call this TESR without an actual pylon
|
||||
private static BlockPylon.Variant forceVariant = BlockPylon.Variant.MANA;
|
||||
|
||||
public RenderTilePylon(TileEntityRendererDispatcher manager) {
|
||||
super(manager);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(@Nonnull TilePylon pylon, double d0, double d1, double d2, float pticks, int digProgress) {
|
||||
public void render(@Nonnull TilePylon pylon, float pticks, MatrixStack ms, IRenderTypeBuffer buffers, int light, int overlay) {
|
||||
if(!pylon.getWorld().isBlockLoaded(pylon.getPos()) || !(pylon.getBlockState().getBlock() instanceof BlockPylon))
|
||||
return;
|
||||
|
||||
renderPylon(pylon, d0, d1, d2, pticks);
|
||||
renderPylon(pylon, pticks, ms, buffers, light, overlay);
|
||||
}
|
||||
|
||||
private void renderPylon(@Nullable TilePylon pylon, double d0, double d1, double d2, float pticks) {
|
||||
private void renderPylon(@Nullable TilePylon pylon, float pticks, MatrixStack ms, IRenderTypeBuffer buffers, int light, int overlay) {
|
||||
BlockPylon.Variant type = pylon == null ? forceVariant : ((BlockPylon) pylon.getBlockState().getBlock()).variant;
|
||||
IPylonModel model;
|
||||
ResourceLocation texture;
|
||||
switch(type) {
|
||||
default:
|
||||
case MANA: {
|
||||
model = manaModel;
|
||||
Minecraft.getInstance().textureManager.bindTexture(MANA_TEXTURE);
|
||||
texture = MANA_TEXTURE;
|
||||
break;
|
||||
}
|
||||
case NATURA: {
|
||||
model = naturaModel;
|
||||
Minecraft.getInstance().textureManager.bindTexture(NATURA_TEXTURE);
|
||||
texture = NATURA_TEXTURE;
|
||||
break;
|
||||
}
|
||||
case GAIA: {
|
||||
model = gaiaModel;
|
||||
Minecraft.getInstance().textureManager.bindTexture(GAIA_TEXTURE);
|
||||
texture = GAIA_TEXTURE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
ms.push();
|
||||
GlStateManager.enableRescaleNormal();
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
GlStateManager.color4f(1F, 1F, 1F, 1F);
|
||||
|
||||
double worldTime = (double) (ClientTickHandler.ticksInGame + pticks);
|
||||
float worldTime = ClientTickHandler.ticksInGame + pticks;
|
||||
|
||||
worldTime += pylon == null ? 0 : new Random(pylon.getPos().hashCode()).nextInt(360);
|
||||
|
||||
GlStateManager.translated(d0, d1 + (pylon == null ? 1.35 : 1.5), d2);
|
||||
GlStateManager.scalef(1.0F, -1.0F, -1.0F);
|
||||
ms.translate(0, pylon == null ? 1.35 : 1.5, 0);
|
||||
ms.scale(1.0F, -1.0F, -1.0F);
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.translatef(0.5F, 0F, -0.5F);
|
||||
ms.push();
|
||||
ms.translate(0.5F, 0F, -0.5F);
|
||||
if(pylon != null)
|
||||
GlStateManager.rotatef((float) worldTime * 1.5F, 0F, 1F, 0F);
|
||||
ms.multiply(Vector3f.POSITIVE_Y.getDegreesQuaternion(worldTime * 1.5F));
|
||||
|
||||
model.renderRing();
|
||||
IVertexBuilder buffer = buffers.getBuffer(RenderType.getEntityTranslucent(texture));
|
||||
model.renderRing(ms, buffer, light, overlay);
|
||||
if(pylon != null)
|
||||
GlStateManager.translated(0D, Math.sin(worldTime / 20D) / 20 - 0.025, 0D);
|
||||
GlStateManager.popMatrix();
|
||||
ms.translate(0D, Math.sin(worldTime / 20D) / 20 - 0.025, 0D);
|
||||
ms.pop();
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
ms.push();
|
||||
if(pylon != null)
|
||||
GlStateManager.translated(0D, Math.sin(worldTime / 20D) / 17.5, 0D);
|
||||
ms.translate(0D, Math.sin(worldTime / 20D) / 17.5, 0D);
|
||||
|
||||
GlStateManager.translatef(0.5F, 0F, -0.5F);
|
||||
ms.translate(0.5F, 0F, -0.5F);
|
||||
if(pylon != null)
|
||||
GlStateManager.rotatef((float) -worldTime, 0F, 1F, 0F);
|
||||
ms.multiply(Vector3f.POSITIVE_Y.getDegreesQuaternion(-worldTime));
|
||||
|
||||
GlStateManager.disableCull();
|
||||
GlStateManager.disableAlphaTest();
|
||||
|
||||
if(pylon != null)
|
||||
ShaderHelper.useShader(ShaderHelper.pylonGlow);
|
||||
model.renderCrystal();
|
||||
// todo 1.15 custom render layer
|
||||
model.renderCrystal(ms, buffer, light, overlay);
|
||||
if(pylon != null)
|
||||
ShaderHelper.releaseShader();
|
||||
|
||||
GlStateManager.enableAlphaTest();
|
||||
GlStateManager.enableCull();
|
||||
GlStateManager.popMatrix();
|
||||
ms.pop();
|
||||
|
||||
GlStateManager.disableBlend();
|
||||
GlStateManager.enableRescaleNormal();
|
||||
GlStateManager.popMatrix();
|
||||
ms.pop();
|
||||
}
|
||||
|
||||
public static class TEISR extends ItemStackTileEntityRenderer {
|
||||
@@ -135,7 +143,7 @@ public class RenderTilePylon extends TileEntityRenderer<TilePylon> {
|
||||
if(Block.getBlockFromItem(stack.getItem()) instanceof BlockPylon) {
|
||||
RenderTilePylon.forceVariant = ((BlockPylon) Block.getBlockFromItem(stack.getItem())).variant;
|
||||
TileEntityRenderer r = TileEntityRendererDispatcher.instance.getRenderer(DUMMY);
|
||||
((RenderTilePylon) r).renderPylon(null, 0, 0, 0, 0);
|
||||
((RenderTilePylon) r).renderPylon(null, 0, ms, buffers, light, overlay);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ import net.minecraft.client.renderer.Vector3f;
|
||||
import net.minecraft.client.renderer.model.ItemCameraTransforms;
|
||||
import net.minecraft.client.renderer.texture.AtlasTexture;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRenderer;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import vazkii.botania.client.core.handler.ClientTickHandler;
|
||||
import vazkii.botania.client.core.helper.RenderHelper;
|
||||
@@ -30,6 +31,10 @@ public class RenderTileRuneAltar extends TileEntityRenderer<TileRuneAltar> {
|
||||
|
||||
private final ModelSpinningCubes cubes = new ModelSpinningCubes();
|
||||
|
||||
public RenderTileRuneAltar(TileEntityRendererDispatcher manager) {
|
||||
super(manager);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(@Nonnull TileRuneAltar altar, float partticks, MatrixStack ms, IRenderTypeBuffer buffers, int light, int overlay) {
|
||||
ms.push();
|
||||
|
||||
@@ -13,8 +13,10 @@ package vazkii.botania.common.item.equipment.bauble;
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.mojang.blaze3d.platform.GLX;
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import com.mojang.blaze3d.vertex.IVertexBuilder;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||
import net.minecraft.client.renderer.texture.OverlayTexture;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.inventory.EquipmentSlotType;
|
||||
@@ -80,25 +82,19 @@ public class ItemHolyCloak extends ItemBauble {
|
||||
ItemHolyCloak item = ((ItemHolyCloak) stack.getItem());
|
||||
AccessoryRenderHelper.rotateIfSneaking(player);
|
||||
boolean armor = !player.getItemStackFromSlot(EquipmentSlotType.CHEST).isEmpty();
|
||||
GlStateManager.translatef(0F, armor ? -0.07F : -0.01F, 0F);
|
||||
ms.translate(0F, armor ? -0.07F : -0.01F, 0F);
|
||||
|
||||
float s = 1F / 16F;
|
||||
GlStateManager.scalef(s, s, s);
|
||||
ms.scale(s, s, s);
|
||||
if(model == null)
|
||||
model = new ModelCloak();
|
||||
|
||||
GlStateManager.enableLighting();
|
||||
GlStateManager.enableRescaleNormal();
|
||||
|
||||
Minecraft.getInstance().textureManager.bindTexture(item.getCloakTexture());
|
||||
model.render(1F);
|
||||
IVertexBuilder buffer = buffers.getBuffer(model.getLayer(item.getCloakTexture()));
|
||||
model.render(ms, buffer, light, OverlayTexture.DEFAULT_UV, 1, 1, 1, 1);
|
||||
|
||||
int light = 15728880;
|
||||
int lightmapX = light % 65536;
|
||||
int lightmapY = light / 65536;
|
||||
GLX.glMultiTexCoord2f(GLX.GL_TEXTURE1, lightmapX, lightmapY);
|
||||
Minecraft.getInstance().textureManager.bindTexture(item.getCloakGlowTexture());
|
||||
model.render(1F);
|
||||
buffer = buffers.getBuffer(model.getLayer(item.getCloakGlowTexture()));
|
||||
model.render(ms, buffer, 0xF000F0, OverlayTexture.DEFAULT_UV, 1, 1, 1, 1);
|
||||
}
|
||||
|
||||
public boolean effectOnDamage(LivingHurtEvent event, PlayerEntity player, ItemStack stack) {
|
||||
|
||||
Reference in new issue
Block a user