Creation of 1.16.3 branch

Initial publishing of the 1.16.3 branch of the mod. A lot of systems are missing (such as Rituals and Living Armour), but enough is present for a decent Alpha release.
This commit is contained in:
WayofTime 2020-10-24 08:59:04 -04:00
parent 0e02b983f1
commit d617911d7a
1662 changed files with 18791 additions and 85075 deletions

View file

@ -0,0 +1,98 @@
package wayoftime.bloodmagic.client;
import net.minecraft.client.gui.ScreenManager;
import net.minecraft.client.world.ClientWorld;
import net.minecraft.entity.LivingEntity;
import net.minecraft.item.IItemPropertyGetter;
import net.minecraft.item.Item;
import net.minecraft.item.ItemModelsProperties;
import net.minecraft.item.ItemStack;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.client.event.ModelRegistryEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.client.registry.ClientRegistry;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
import wayoftime.bloodmagic.BloodMagic;
import wayoftime.bloodmagic.client.render.block.RenderAlchemyArray;
import wayoftime.bloodmagic.client.render.block.RenderAltar;
import wayoftime.bloodmagic.client.screens.ScreenSoulForge;
import wayoftime.bloodmagic.common.block.BloodMagicBlocks;
import wayoftime.bloodmagic.common.item.BloodMagicItems;
import wayoftime.bloodmagic.common.item.sigil.ItemSigilToggleable;
import wayoftime.bloodmagic.common.item.soul.ItemSentientSword;
import wayoftime.bloodmagic.iface.IMultiWillTool;
import wayoftime.bloodmagic.tile.TileAlchemyArray;
import wayoftime.bloodmagic.tile.TileAltar;
@Mod.EventBusSubscriber(value = Dist.CLIENT, modid = BloodMagic.MODID, bus = Mod.EventBusSubscriber.Bus.MOD)
public class ClientEvents
{
@SubscribeEvent
public static void registerModels(ModelRegistryEvent event)
{
ClientRegistry.bindTileEntityRenderer(TileAltar.TYPE, RenderAltar::new);
ClientRegistry.bindTileEntityRenderer(TileAlchemyArray.TYPE, RenderAlchemyArray::new);
// ClientRegistry.bindTileEntityRenderer(TileSoulForge.TYPE, RenderAlchemyArray::new);
}
public static void registerContainerScreens()
{
ScreenManager.registerFactory(BloodMagicBlocks.SOUL_FORGE_CONTAINER.get(), ScreenSoulForge::new);
}
public static void registerItemModelProperties(FMLClientSetupEvent event)
{
registerToggleableProperties(BloodMagicItems.GREEN_GROVE_SIGIL.get());
registerToggleableProperties(BloodMagicItems.FAST_MINER_SIGIL.get());
registerToggleableProperties(BloodMagicItems.MAGNETISM_SIGIL.get());
registerToggleableProperties(BloodMagicItems.ICE_SIGIL.get());
registerMultiWillTool(BloodMagicItems.SENTIENT_SWORD.get());
registerMultiWillTool(BloodMagicItems.PETTY_GEM.get());
registerMultiWillTool(BloodMagicItems.LESSER_GEM.get());
registerMultiWillTool(BloodMagicItems.COMMON_GEM.get());
ItemModelsProperties.registerProperty(BloodMagicItems.SENTIENT_SWORD.get(), BloodMagic.rl("active"), new IItemPropertyGetter()
{
@Override
public float call(ItemStack stack, ClientWorld world, LivingEntity entity)
{
return ((ItemSentientSword) stack.getItem()).getActivated(stack) ? 1 : 0;
}
});
}
public static void registerToggleableProperties(Item item)
{
ItemModelsProperties.registerProperty(item, BloodMagic.rl("active"), new IItemPropertyGetter()
{
@Override
public float call(ItemStack stack, ClientWorld world, LivingEntity entity)
{
Item item = stack.getItem();
if (item instanceof ItemSigilToggleable)
{
return ((ItemSigilToggleable) item).getActivated(stack) ? 1 : 0;
}
return 0;
}
});
}
public static void registerMultiWillTool(Item item)
{
ItemModelsProperties.registerProperty(item, BloodMagic.rl("type"), new IItemPropertyGetter()
{
@Override
public float call(ItemStack stack, ClientWorld world, LivingEntity entity)
{
Item item = stack.getItem();
if (item instanceof IMultiWillTool)
{
return ((IMultiWillTool) item).getCurrentType(stack).ordinal();
}
return 0;
}
});
}
}

View file

@ -0,0 +1,104 @@
package wayoftime.bloodmagic.client.render;
import java.util.Arrays;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.util.Direction;
import net.minecraft.util.ResourceLocation;
public class BloodMagicRenderer
{
public static float getRed(int color)
{
return (color >> 16 & 0xFF) / 255.0F;
}
public static float getGreen(int color)
{
return (color >> 8 & 0xFF) / 255.0F;
}
public static float getBlue(int color)
{
return (color & 0xFF) / 255.0F;
}
public static float getAlpha(int color)
{
return (color >> 24 & 0xFF) / 255.0F;
}
public static class Model3D
{
public double minX, minY, minZ;
public double maxX, maxY, maxZ;
public final TextureAtlasSprite[] textures = new TextureAtlasSprite[6];
public final boolean[] renderSides = new boolean[]
{ true, true, true, true, true, true, false };
public double sizeX()
{
return maxX - minX;
}
public double sizeY()
{
return maxY - minY;
}
public double sizeZ()
{
return maxZ - minZ;
}
public void setSideRender(Direction side, boolean value)
{
renderSides[side.ordinal()] = value;
}
public boolean shouldSideRender(Direction side)
{
return renderSides[side.ordinal()];
}
public void setTexture(TextureAtlasSprite tex)
{
Arrays.fill(textures, tex);
}
public void setTextures(TextureAtlasSprite down, TextureAtlasSprite up, TextureAtlasSprite north, TextureAtlasSprite south, TextureAtlasSprite west, TextureAtlasSprite east)
{
textures[0] = down;
textures[1] = up;
textures[2] = north;
textures[3] = south;
textures[4] = west;
textures[5] = east;
}
}
public static class Model2D
{
public double minX, minY;
public double maxX, maxY;
public ResourceLocation resource;
public double sizeX()
{
return maxX - minX;
}
public double sizeY()
{
return maxY - minY;
}
public void setTexture(ResourceLocation resource)
{
this.resource = resource;
}
}
}

View file

@ -0,0 +1,168 @@
package wayoftime.bloodmagic.client.render;
import java.util.Arrays;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.vertex.IVertexBuilder;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.entity.EntityRendererManager;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.util.Direction;
import net.minecraft.util.Direction.Axis;
import net.minecraft.util.Direction.AxisDirection;
import net.minecraft.util.math.vector.Matrix3f;
import net.minecraft.util.math.vector.Matrix4f;
import net.minecraft.util.math.vector.Vector3d;
import net.minecraft.util.math.vector.Vector3f;
import net.minecraft.util.math.vector.Vector3i;
import wayoftime.bloodmagic.client.render.BloodMagicRenderer.Model3D;
/**
* Adapted from BuildCraft
*/
public class RenderResizableCuboid
{
public static final RenderResizableCuboid INSTANCE = new RenderResizableCuboid();
private static final Vector3f VEC_ZERO = new Vector3f(0, 0, 0);
private static final int U_MIN = 0;
private static final int U_MAX = 1;
private static final int V_MIN = 2;
private static final int V_MAX = 3;
protected EntityRendererManager manager = Minecraft.getInstance().getRenderManager();
private static Vector3f withValue(Vector3f vector, Axis axis, float value)
{
if (axis == Axis.X)
{
return new Vector3f(value, vector.getY(), vector.getZ());
} else if (axis == Axis.Y)
{
return new Vector3f(vector.getX(), value, vector.getZ());
} else if (axis == Axis.Z)
{
return new Vector3f(vector.getX(), vector.getY(), value);
}
throw new RuntimeException("Was given a null axis! That was probably not intentional, consider this a bug! (Vector = "
+ vector + ")");
}
public static double getValue(Vector3d vector, Axis axis)
{
if (axis == Axis.X)
{
return vector.x;
} else if (axis == Axis.Y)
{
return vector.y;
} else if (axis == Axis.Z)
{
return vector.z;
}
throw new RuntimeException("Was given a null axis! That was probably not intentional, consider this a bug! (Vector = "
+ vector + ")");
}
public void renderCube(Model3D cube, MatrixStack matrix, IVertexBuilder buffer, int argb, int light, int overlay)
{
float red = BloodMagicRenderer.getRed(argb);
float green = BloodMagicRenderer.getGreen(argb);
float blue = BloodMagicRenderer.getBlue(argb);
float alpha = BloodMagicRenderer.getAlpha(argb);
Vector3d size = new Vector3d(cube.sizeX(), cube.sizeY(), cube.sizeZ());
matrix.push();
matrix.translate(cube.minX, cube.minY, cube.minZ);
MatrixStack.Entry lastMatrix = matrix.getLast();
Matrix4f matrix4f = lastMatrix.getMatrix();
Matrix3f normal = lastMatrix.getNormal();
for (Direction face : Direction.values())
{
if (cube.shouldSideRender(face))
{
int ordinal = face.ordinal();
TextureAtlasSprite sprite = cube.textures[ordinal];
if (sprite != null)
{
Axis u = face.getAxis() == Axis.X ? Axis.Z : Axis.X;
Axis v = face.getAxis() == Axis.Y ? Axis.Z : Axis.Y;
float other = face.getAxisDirection() == AxisDirection.POSITIVE
? (float) getValue(size, face.getAxis())
: 0;
// Swap the face if this is positive: the renderer returns indexes that ALWAYS
// are for the negative face, so light it properly this way
face = face.getAxisDirection() == AxisDirection.NEGATIVE ? face : face.getOpposite();
Direction opposite = face.getOpposite();
float minU = sprite.getMinU();
float maxU = sprite.getMaxU();
// Flip the v
float minV = sprite.getMaxV();
float maxV = sprite.getMinV();
double sizeU = getValue(size, u);
double sizeV = getValue(size, v);
// TODO: Look into this more, as it makes tiling of multiple objects not render
// properly if they don't fit the full texture.
// Example: Mechanical pipes rendering water or lava, makes it relatively easy
// to see the texture artifacts
for (int uIndex = 0; uIndex < sizeU; uIndex++)
{
float[] baseUV = new float[]
{ minU, maxU, minV, maxV };
double addU = 1;
// If the size of the texture is greater than the cuboid goes on for then make
// sure the texture positions are lowered
if (uIndex + addU > sizeU)
{
addU = sizeU - uIndex;
baseUV[U_MAX] = baseUV[U_MIN] + (baseUV[U_MAX] - baseUV[U_MIN]) * (float) addU;
}
for (int vIndex = 0; vIndex < sizeV; vIndex++)
{
float[] uv = Arrays.copyOf(baseUV, 4);
double addV = 1;
if (vIndex + addV > sizeV)
{
addV = sizeV - vIndex;
uv[V_MAX] = uv[V_MIN] + (uv[V_MAX] - uv[V_MIN]) * (float) addV;
}
float[] xyz = new float[]
{ uIndex, (float) (uIndex + addU), vIndex, (float) (vIndex + addV) };
renderPoint(matrix4f, normal, buffer, face, u, v, other, uv, xyz, true, false, red, green, blue, alpha, light, overlay);
renderPoint(matrix4f, normal, buffer, face, u, v, other, uv, xyz, true, true, red, green, blue, alpha, light, overlay);
renderPoint(matrix4f, normal, buffer, face, u, v, other, uv, xyz, false, true, red, green, blue, alpha, light, overlay);
renderPoint(matrix4f, normal, buffer, face, u, v, other, uv, xyz, false, false, red, green, blue, alpha, light, overlay);
renderPoint(matrix4f, normal, buffer, opposite, u, v, other, uv, xyz, false, false, red, green, blue, alpha, light, overlay);
renderPoint(matrix4f, normal, buffer, opposite, u, v, other, uv, xyz, false, true, red, green, blue, alpha, light, overlay);
renderPoint(matrix4f, normal, buffer, opposite, u, v, other, uv, xyz, true, true, red, green, blue, alpha, light, overlay);
renderPoint(matrix4f, normal, buffer, opposite, u, v, other, uv, xyz, true, false, red, green, blue, alpha, light, overlay);
}
}
}
}
}
matrix.pop();
}
private void renderPoint(Matrix4f matrix4f, Matrix3f normal, IVertexBuilder buffer, Direction face, Axis u, Axis v,
float other, float[] uv, float[] xyz, boolean minU, boolean minV, float red, float green, float blue,
float alpha, int light, int overlay)
{
int U_ARRAY = minU ? U_MIN : U_MAX;
int V_ARRAY = minV ? V_MIN : V_MAX;
Vector3f vertex = withValue(VEC_ZERO, u, xyz[U_ARRAY]);
vertex = withValue(vertex, v, xyz[V_ARRAY]);
vertex = withValue(vertex, face.getAxis(), other);
Vector3i normalForFace = face.getDirectionVec();
// TODO: Figure out how and why this works, it gives about the same brightness
// as we used to have but I don't understand why/how
float adjustment = 2.5F;
Vector3f norm = new Vector3f(normalForFace.getX() + adjustment, normalForFace.getY()
+ adjustment, normalForFace.getZ() + adjustment);
norm.normalize();
buffer.pos(matrix4f, vertex.getX(), vertex.getY(), vertex.getZ()).color(red, green, blue, alpha).tex(uv[U_ARRAY], uv[V_ARRAY]).overlay(overlay).lightmap(light).normal(normal, norm.getX(), norm.getY(), norm.getZ()).endVertex();
}
}

View file

@ -0,0 +1,167 @@
package wayoftime.bloodmagic.client.render;
import java.util.Arrays;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.vertex.IVertexBuilder;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.entity.EntityRendererManager;
import net.minecraft.util.Direction;
import net.minecraft.util.Direction.Axis;
import net.minecraft.util.Direction.AxisDirection;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.vector.Matrix3f;
import net.minecraft.util.math.vector.Matrix4f;
import net.minecraft.util.math.vector.Vector3d;
import net.minecraft.util.math.vector.Vector3f;
import net.minecraft.util.math.vector.Vector3i;
import wayoftime.bloodmagic.client.render.BloodMagicRenderer.Model2D;
public class RenderResizableQuadrilateral
{
public static final RenderResizableQuadrilateral INSTANCE = new RenderResizableQuadrilateral();
private static final Vector3f VEC_ZERO = new Vector3f(0, 0, 0);
private static final int U_MIN = 0;
private static final int U_MAX = 1;
private static final int V_MIN = 2;
private static final int V_MAX = 3;
protected EntityRendererManager manager = Minecraft.getInstance().getRenderManager();
private static Vector3f withValue(Vector3f vector, Axis axis, float value)
{
if (axis == Axis.X)
{
return new Vector3f(value, vector.getY(), vector.getZ());
} else if (axis == Axis.Y)
{
return new Vector3f(vector.getX(), value, vector.getZ());
} else if (axis == Axis.Z)
{
return new Vector3f(vector.getX(), vector.getY(), value);
}
throw new RuntimeException("Was given a null axis! That was probably not intentional, consider this a bug! (Vector = "
+ vector + ")");
}
public static double getValue(Vector3d vector, Axis axis)
{
if (axis == Axis.X)
{
return vector.x;
} else if (axis == Axis.Y)
{
return vector.y;
} else if (axis == Axis.Z)
{
return vector.z;
}
throw new RuntimeException("Was given a null axis! That was probably not intentional, consider this a bug! (Vector = "
+ vector + ")");
}
public void renderSquare(Model2D square, MatrixStack matrix, IVertexBuilder buffer, int argb, int light, int overlay)
{
float red = BloodMagicRenderer.getRed(argb);
float green = BloodMagicRenderer.getGreen(argb);
float blue = BloodMagicRenderer.getBlue(argb);
float alpha = BloodMagicRenderer.getAlpha(argb);
Vector3d size = new Vector3d(square.sizeX(), 0, square.sizeY());
matrix.push();
matrix.translate(square.minX, 0, square.minY);
MatrixStack.Entry lastMatrix = matrix.getLast();
Matrix4f matrix4f = lastMatrix.getMatrix();
Matrix3f normal = lastMatrix.getNormal();
Direction face = Direction.UP;
// for (Direction face : Direction.values())
int ordinal = face.ordinal();
// TextureAtlasSprite sprite = cube.textures[ordinal];
ResourceLocation rl = square.resource;
if (rl != null)
{
// Minecraft.getInstance().textureManager.bindTexture(rl);
Axis u = face.getAxis() == Axis.X ? Axis.Z : Axis.X;
Axis v = face.getAxis() == Axis.Y ? Axis.Z : Axis.Y;
float other = face.getAxisDirection() == AxisDirection.POSITIVE ? (float) getValue(size, face.getAxis())
: 0;
// Swap the face if this is positive: the renderer returns indexes that ALWAYS
// are for the negative face, so light it properly this way
face = face.getAxisDirection() == AxisDirection.NEGATIVE ? face : face.getOpposite();
// Direction opposite = face.getOpposite();
float minU = 0;
float maxU = 1;
// Flip the v
float minV = 1;
float maxV = 0;
// float minU = sprite.getMinU();
// float maxU = sprite.getMaxU();
// // Flip the v
// float minV = sprite.getMaxV();
// float maxV = sprite.getMinV();
double sizeU = getValue(size, u);
double sizeV = getValue(size, v);
// TODO: Look into this more, as it makes tiling of multiple objects not render
// properly if they don't fit the full texture.
// Example: Mechanical pipes rendering water or lava, makes it relatively easy
// to see the texture artifacts
for (int uIndex = 0; uIndex < sizeU; uIndex++)
{
float[] baseUV = new float[]
{ minU, maxU, minV, maxV };
double addU = 1;
// If the size of the texture is greater than the cuboid goes on for then make
// sure the texture positions are lowered
if (uIndex + addU > sizeU)
{
// addU = sizeU - uIndex;
baseUV[U_MAX] = baseUV[U_MIN] + (baseUV[U_MAX] - baseUV[U_MIN]) * (float) addU;
}
for (int vIndex = 0; vIndex < sizeV; vIndex++)
{
float[] uv = Arrays.copyOf(baseUV, 4);
double addV = 1;
if (vIndex + addV > sizeV)
{
// addV = sizeV - vIndex;
uv[V_MAX] = uv[V_MIN] + (uv[V_MAX] - uv[V_MIN]) * (float) addV;
}
float[] xyz = new float[]
{ uIndex, (float) (uIndex + addU), vIndex, (float) (vIndex + addV) };
renderPoint(matrix4f, normal, buffer, face, u, v, other, uv, xyz, true, false, red, green, blue, alpha, light, overlay);
renderPoint(matrix4f, normal, buffer, face, u, v, other, uv, xyz, true, true, red, green, blue, alpha, light, overlay);
renderPoint(matrix4f, normal, buffer, face, u, v, other, uv, xyz, false, true, red, green, blue, alpha, light, overlay);
renderPoint(matrix4f, normal, buffer, face, u, v, other, uv, xyz, false, false, red, green, blue, alpha, light, overlay);
// renderPoint(matrix4f, normal, buffer, opposite, u, v, other, uv, xyz, false, false, red, green, blue, alpha, light, overlay);
// renderPoint(matrix4f, normal, buffer, opposite, u, v, other, uv, xyz, false, true, red, green, blue, alpha, light, overlay);
// renderPoint(matrix4f, normal, buffer, opposite, u, v, other, uv, xyz, true, true, red, green, blue, alpha, light, overlay);
// renderPoint(matrix4f, normal, buffer, opposite, u, v, other, uv, xyz, true, false, red, green, blue, alpha, light, overlay);
}
}
}
matrix.pop();
}
private void renderPoint(Matrix4f matrix4f, Matrix3f normal, IVertexBuilder buffer, Direction face, Axis u, Axis v, float other, float[] uv, float[] xyz, boolean minU, boolean minV, float red, float green, float blue, float alpha, int light, int overlay)
{
int U_ARRAY = minU ? U_MIN : U_MAX;
int V_ARRAY = minV ? V_MIN : V_MAX;
Vector3f vertex = withValue(VEC_ZERO, u, xyz[U_ARRAY]);
vertex = withValue(vertex, v, xyz[V_ARRAY]);
vertex = withValue(vertex, face.getAxis(), other);
Vector3i normalForFace = face.getDirectionVec();
// TODO: Figure out how and why this works, it gives about the same brightness
// as we used to have but I don't understand why/how
float adjustment = 2.5F;
Vector3f norm = new Vector3f(normalForFace.getX() + adjustment, normalForFace.getY()
+ adjustment, normalForFace.getZ() + adjustment);
norm.normalize();
buffer.pos(matrix4f, vertex.getX(), vertex.getY(), vertex.getZ()).color(red, green, blue, alpha).tex(uv[U_ARRAY], uv[V_ARRAY]).overlay(overlay).lightmap(light).normal(normal, norm.getX(), norm.getY(), norm.getZ()).endVertex();
}
}

View file

@ -0,0 +1,114 @@
package wayoftime.bloodmagic.client.render.alchemyarray;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.vertex.IVertexBuilder;
import net.minecraft.client.renderer.IRenderTypeBuffer;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.util.Direction;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.vector.Quaternion;
import wayoftime.bloodmagic.client.render.BloodMagicRenderer;
import wayoftime.bloodmagic.client.render.BloodMagicRenderer.Model2D;
import wayoftime.bloodmagic.client.render.RenderResizableQuadrilateral;
import wayoftime.bloodmagic.tile.TileAlchemyArray;
public class AlchemyArrayRenderer
{
public final ResourceLocation arrayResource;
public AlchemyArrayRenderer()
{
this(new ResourceLocation("bloodmagic", "textures/models/alchemyarrays/sightsigil.png"));
}
public AlchemyArrayRenderer(ResourceLocation arrayResource)
{
this.arrayResource = arrayResource;
}
public float getRotation(float craftTime)
{
float offset = 2;
if (craftTime >= offset)
{
float modifier = (float) Math.pow(craftTime - offset, 1.5);
return modifier * 1f;
}
return 0;
}
public float getSecondaryRotation(float craftTime)
{
float offset = 50;
if (craftTime >= offset)
{
float modifier = (float) Math.pow(craftTime - offset, 1.7);
return modifier * 0.5f;
}
return 0;
}
public float getSizeModifier(float craftTime)
{
if (craftTime >= 150 && craftTime <= 250)
{
return (200 - craftTime) / 50f;
}
return 1.0f;
}
public float getVerticalOffset(float craftTime)
{
if (craftTime >= 5)
{
if (craftTime <= 40)
{
return (float) (-0.4 + (0.4) * Math.pow((craftTime - 5) / 35f, 3));
} else
{
return 0;
}
}
return -0.4f;
}
public void renderAt(TileAlchemyArray tileArray, double x, double y, double z, float craftTime, MatrixStack matrixStack, IRenderTypeBuffer renderer, int combinedLightIn, int combinedOverlayIn)
{
matrixStack.push();
matrixStack.translate(0.5, 0.5, 0.5);
float rot = getRotation(craftTime);
float secondaryRot = getSecondaryRotation(craftTime);
float size = 1.0F * getSizeModifier(craftTime);
Direction rotation = tileArray.getRotation();
matrixStack.push();
matrixStack.translate(0, getVerticalOffset(craftTime), 0);
matrixStack.rotate(new Quaternion(Direction.UP.toVector3f(), -rotation.getHorizontalAngle(), true));
matrixStack.push();
matrixStack.rotate(new Quaternion(Direction.UP.toVector3f(), rot, true));
matrixStack.rotate(new Quaternion(Direction.NORTH.toVector3f(), secondaryRot, true));
matrixStack.rotate(new Quaternion(Direction.EAST.toVector3f(), secondaryRot * 0.45812f, true));
IVertexBuilder twoDBuffer = renderer.getBuffer(RenderType.getEntityTranslucent(arrayResource));
Model2D arrayModel = new BloodMagicRenderer.Model2D();
arrayModel.minX = -0.5;
arrayModel.maxX = +0.5;
arrayModel.minY = -0.5;
arrayModel.maxY = +0.5;
arrayModel.resource = arrayResource;
matrixStack.scale(size, size, size);
RenderResizableQuadrilateral.INSTANCE.renderSquare(arrayModel, matrixStack, twoDBuffer, 0xFFFFFFFF, combinedLightIn, combinedOverlayIn);
matrixStack.pop();
matrixStack.pop();
matrixStack.pop();
}
}

View file

@ -0,0 +1,24 @@
package wayoftime.bloodmagic.client.render.entity;
import com.mojang.blaze3d.matrix.MatrixStack;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.IRenderTypeBuffer;
import net.minecraft.client.renderer.entity.EntityRendererManager;
import net.minecraft.client.renderer.entity.SpriteRenderer;
import net.minecraft.entity.Entity;
import net.minecraft.entity.IRendersAsItem;
public class BloodLightRenderer<T extends Entity & IRendersAsItem> extends SpriteRenderer<T>
{
public BloodLightRenderer(EntityRendererManager renderManagerIn)
{
super(renderManagerIn, Minecraft.getInstance().getItemRenderer());
}
@Override
public void render(T entityIn, float entityYaw, float partialTicks, MatrixStack matrixStackIn, IRenderTypeBuffer bufferIn, int packedLightIn)
{
super.render(entityIn, entityYaw, partialTicks, matrixStackIn, bufferIn, packedLightIn);
}
}

View file

@ -0,0 +1,24 @@
package wayoftime.bloodmagic.client.render.entity;
import com.mojang.blaze3d.matrix.MatrixStack;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.IRenderTypeBuffer;
import net.minecraft.client.renderer.entity.EntityRendererManager;
import net.minecraft.client.renderer.entity.SpriteRenderer;
import net.minecraft.entity.Entity;
import net.minecraft.entity.IRendersAsItem;
public class SoulSnareRenderer<T extends Entity & IRendersAsItem> extends SpriteRenderer<T>
{
public SoulSnareRenderer(EntityRendererManager renderManagerIn)
{
super(renderManagerIn, Minecraft.getInstance().getItemRenderer());
}
@Override
public void render(T entityIn, float entityYaw, float partialTicks, MatrixStack matrixStackIn, IRenderTypeBuffer bufferIn, int packedLightIn)
{
super.render(entityIn, entityYaw, partialTicks, matrixStackIn, bufferIn, packedLightIn);
}
}

View file

@ -0,0 +1,68 @@
package wayoftime.bloodmagic.client.screens;
import com.mojang.blaze3d.matrix.MatrixStack;
import net.minecraft.client.gui.screen.inventory.ContainerScreen;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.container.Container;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TranslationTextComponent;
import wayoftime.bloodmagic.BloodMagic;
public abstract class ScreenBase<T extends Container> extends ContainerScreen<T>
{
private static final ResourceLocation background = new ResourceLocation(BloodMagic.MODID, "textures/gui/soulforge.png");
protected final T container;
public ScreenBase(T container, PlayerInventory playerInventory, ITextComponent title)
{
super(container, playerInventory, title);
this.container = container;
}
public ResourceLocation getBackground()
{
return background;
}
@Override
public void render(MatrixStack stack, int mouseX, int mouseY, float partialTicks)
{
this.renderBackground(stack);
super.render(stack, mouseX, mouseY, partialTicks);
this.renderHoveredTooltip(stack, mouseX, mouseY); // @mcp: func_230459_a_ = renderHoveredToolTip
// if (mouseX > (guiLeft + 7) && mouseX < (guiLeft + 7) + 18 && mouseY > (guiTop + 7)
// && mouseY < (guiTop + 7) + 73)
// this.renderTooltip(stack, LanguageMap.getInstance().func_244260_a(Arrays.asList(new TranslationTextComponent("screen.diregoo.energy", MagicHelpers.withSuffix(this.container.getEnergy()), MagicHelpers.withSuffix(this.container.getMaxPower())))), mouseX, mouseY);
}
@Override
public void init()
{
super.init();
}
@Override
protected void drawGuiContainerBackgroundLayer(MatrixStack stack, float partialTicks, int mouseX, int mouseY)
{
// RenderSystem.color4f(1, 1, 1, 1);
// getMinecraft().getTextureManager().bindTexture(getBackground());
// this.blit(stack, guiLeft, guiTop, 0, 0, xSize, ySize);
// int maxEnergy = this.container.getMaxPower(), height = 70;
// if (maxEnergy > 0)
// {
// int remaining = (this.container.getEnergy() * height) / maxEnergy;
// this.blit(stack, guiLeft + 8, guiTop + 78 - remaining, 176, 84 - remaining, 16, remaining + 1);
// }
}
//
protected static TranslationTextComponent getTrans(String key, Object... args)
{
return new TranslationTextComponent(BloodMagic.MODID + "." + key, args);
}
}

View file

@ -0,0 +1,85 @@
package wayoftime.bloodmagic.client.screens;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.systems.RenderSystem;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.IInventory;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TranslationTextComponent;
import wayoftime.bloodmagic.BloodMagic;
import wayoftime.bloodmagic.tile.TileSoulForge;
import wayoftime.bloodmagic.tile.contailer.ContainerSoulForge;
public class ScreenSoulForge extends ScreenBase<ContainerSoulForge>
{
private static final ResourceLocation background = new ResourceLocation(BloodMagic.MODID, "textures/gui/soulforge.png");
public IInventory tileSoulForge;
public ScreenSoulForge(ContainerSoulForge container, PlayerInventory playerInventory, ITextComponent title)
{
super(container, playerInventory, title);
tileSoulForge = container.tileForge;
this.xSize = 176;
this.ySize = 205;
}
@Override
public ResourceLocation getBackground()
{
return background;
}
// public
// public ScreenSoulForge(InventoryPlayer playerInventory, IInventory tileSoulForge)
// {
// super(new ContainerSoulForge(playerInventory, tileSoulForge));
// this.tileSoulForge = tileSoulForge;
// this.xSize = 176;
// this.ySize = 205;
// }
//
// @Override
// public void render(MatrixStack stack, int mouseX, int mouseY, float partialTicks)
// {
// this.drawDefaultBackground();
// super.drawScreen(mouseX, mouseY, partialTicks);
// this.renderHoveredToolTip(mouseX, mouseY);
// }
//
@Override
protected void drawGuiContainerForegroundLayer(MatrixStack stack, int mouseX, int mouseY)
{
this.font.func_243248_b(stack, new TranslationTextComponent("tile.bloodmagic.soulforge.name"), 8, 5, 4210752);
this.font.func_243248_b(stack, new TranslationTextComponent("container.inventory"), 8, 111, 4210752);
}
//
@Override
protected void drawGuiContainerBackgroundLayer(MatrixStack stack, float partialTicks, int mouseX, int mouseY)
{
RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
getMinecraft().getTextureManager().bindTexture(background);
int i = (this.width - this.xSize) / 2;
int j = (this.height - this.ySize) / 2;
this.blit(stack, i, j, 0, 0, this.xSize, this.ySize);
int l = this.getCookProgressScaled(90);
this.blit(stack, i + 115, j + 14 + 90 - l, 176, 90 - l, 18, l);
}
//
public int getCookProgressScaled(int scale)
{
double progress = ((TileSoulForge) tileSoulForge).getProgressForGui();
// if (tileSoulForge != null)
// {
// System.out.println("Tile is NOT null");
// }
// double progress = ((float) this.container.data.get(0)) / ((float) this.container.data.get(1));
// System.out.println(this.container.data.get(0));
return (int) (progress * scale);
}
}