diff --git a/changelog.txt b/changelog.txt index 459bd29d..66bed62f 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,13 @@ +------------------------------------------------------ +Version 3.0.4 +------------------------------------------------------ + +- Added new alchemy arrays: + - Two arrays, which changes the current daylight cycle to day and night. + +- Fixed the JEI so that it no longer ouputs an error when loading Alchemy Array recipes without a crafting output. + + ------------------------------------------------------ Version 3.0.3 ------------------------------------------------------ diff --git a/src/generated/resources/.cache/cache b/src/generated/resources/.cache/cache index db189f11..b4c21e0a 100644 --- a/src/generated/resources/.cache/cache +++ b/src/generated/resources/.cache/cache @@ -568,7 +568,7 @@ a7f51456052d0fd317164d400cdd595ae2687df8 data/bloodmagic/recipes/arc/reversion/m 1e5814caf63714b8e1ff2b2f413a86ba8c840ebb data/bloodmagic/recipes/arc/weakbloodshard.json e1285ec51100f2336c1ea1a1a3057e74a0dd84d1 data/bloodmagic/recipes/array/airsigil.json d1ac23080f72f21adb5908befefe965ffb4efd4f data/bloodmagic/recipes/array/bloodlightsigil.json -4ea1175f7ee2ce21685edb8906c28abba7207ed2 data/bloodmagic/recipes/array/day.json +7110895fe75e65404bc66d6c09087d9e58220a11 data/bloodmagic/recipes/array/day.json 1890706e5b93cd6df764b0419483c348e0d7f277 data/bloodmagic/recipes/array/divinationsigil.json 4bd220ced486f1d8fc4468ebd61dac755670d716 data/bloodmagic/recipes/array/fastminersigil.json f191a3c9982b827b0b2ba93164a81fc4f8cb0959 data/bloodmagic/recipes/array/growthsigil.json @@ -579,6 +579,7 @@ f191a3c9982b827b0b2ba93164a81fc4f8cb0959 data/bloodmagic/recipes/array/growthsig 5e3c6dd7bfcd16e79f17e963d8c1b59c0d1aebe9 data/bloodmagic/recipes/array/living_plate.json 8b1007de1b7fca5d27b54d7c9839cde9e47ab1c0 data/bloodmagic/recipes/array/magnetismsigil.json 7a674784e0d8d4f6f071a72d26ba677087976970 data/bloodmagic/recipes/array/movement.json +5c208259e33c3a56c5d6f6ab951ac0c4d5b60e26 data/bloodmagic/recipes/array/night.json 6fd91801759c6a7a018b9d18601fc3db4d3ee3b4 data/bloodmagic/recipes/array/seersigil.json 1921cc1cba3bcc36a6be6edd377dd44eb9b884a0 data/bloodmagic/recipes/array/spike.json 085bf564ec74060e5c0224155cefc6ba0635c2c8 data/bloodmagic/recipes/array/updraft.json diff --git a/src/generated/resources/data/bloodmagic/recipes/array/day.json b/src/generated/resources/data/bloodmagic/recipes/array/day.json index 938f644c..32c6212b 100644 --- a/src/generated/resources/data/bloodmagic/recipes/array/day.json +++ b/src/generated/resources/data/bloodmagic/recipes/array/day.json @@ -1,6 +1,6 @@ { "type": "bloodmagic:array", - "texture": "bloodmagic:textures/models/alchemyarrays/spikearray.png", + "texture": "bloodmagic:textures/models/alchemyarrays/sunarray.png", "baseinput": { "item": "minecraft:coal" }, diff --git a/src/generated/resources/data/bloodmagic/recipes/array/night.json b/src/generated/resources/data/bloodmagic/recipes/array/night.json new file mode 100644 index 00000000..c0130213 --- /dev/null +++ b/src/generated/resources/data/bloodmagic/recipes/array/night.json @@ -0,0 +1,13 @@ +{ + "type": "bloodmagic:array", + "texture": "bloodmagic:textures/models/alchemyarrays/moonarray.png", + "baseinput": { + "item": "minecraft:lapis_lazuli" + }, + "addedinput": { + "item": "minecraft:lapis_lazuli" + }, + "output": { + "item": "minecraft:air" + } +} \ No newline at end of file diff --git a/src/main/java/wayoftime/bloodmagic/client/ClientEvents.java b/src/main/java/wayoftime/bloodmagic/client/ClientEvents.java index e5eafdec..030ed5f9 100644 --- a/src/main/java/wayoftime/bloodmagic/client/ClientEvents.java +++ b/src/main/java/wayoftime/bloodmagic/client/ClientEvents.java @@ -22,7 +22,9 @@ import wayoftime.bloodmagic.BloodMagic; import wayoftime.bloodmagic.api.compat.IMultiWillTool; import wayoftime.bloodmagic.client.model.MimicColor; import wayoftime.bloodmagic.client.render.alchemyarray.BeaconAlchemyCircleRenderer; +import wayoftime.bloodmagic.client.render.alchemyarray.DayAlchemyCircleRenderer; import wayoftime.bloodmagic.client.render.alchemyarray.LowStaticAlchemyCircleRenderer; +import wayoftime.bloodmagic.client.render.alchemyarray.NightAlchemyCircleRenderer; import wayoftime.bloodmagic.client.render.alchemyarray.StaticAlchemyCircleRenderer; import wayoftime.bloodmagic.client.render.block.RenderAlchemyArray; import wayoftime.bloodmagic.client.render.block.RenderAltar; @@ -106,7 +108,8 @@ public class ClientEvents AlchemyArrayRendererRegistry.registerRenderer(BloodMagic.rl("array/movement"), new StaticAlchemyCircleRenderer(BloodMagic.rl("textures/models/alchemyarrays/movementarray.png"))); AlchemyArrayRendererRegistry.registerRenderer(BloodMagic.rl("array/updraft"), new BeaconAlchemyCircleRenderer(BloodMagic.rl("textures/models/alchemyarrays/updraftarray.png"))); AlchemyArrayRendererRegistry.registerRenderer(BloodMagic.rl("array/spike"), new LowStaticAlchemyCircleRenderer(BloodMagic.rl("textures/models/alchemyarrays/spikearray.png"))); - AlchemyArrayRendererRegistry.registerRenderer(BloodMagic.rl("array/day"), new LowStaticAlchemyCircleRenderer(BloodMagic.rl("textures/models/alchemyarrays/spikearray.png"))); + AlchemyArrayRendererRegistry.registerRenderer(BloodMagic.rl("array/day"), new DayAlchemyCircleRenderer(BloodMagic.rl("textures/models/alchemyarrays/sunarray.png"), BloodMagic.rl("textures/models/alchemyarrays/sunarrayspikes.png"), BloodMagic.rl("textures/models/alchemyarrays/sunarraycircle.png"))); + AlchemyArrayRendererRegistry.registerRenderer(BloodMagic.rl("array/night"), new NightAlchemyCircleRenderer(BloodMagic.rl("textures/models/alchemyarrays/moonarrayoutside.png"), BloodMagic.rl("textures/models/alchemyarrays/moonarraysymbols.png"), BloodMagic.rl("textures/models/alchemyarrays/moonarrayinside.png"))); } public static void registerItemModelProperties(FMLClientSetupEvent event) diff --git a/src/main/java/wayoftime/bloodmagic/client/render/alchemyarray/DayAlchemyCircleRenderer.java b/src/main/java/wayoftime/bloodmagic/client/render/alchemyarray/DayAlchemyCircleRenderer.java new file mode 100644 index 00000000..4a2d37ec --- /dev/null +++ b/src/main/java/wayoftime/bloodmagic/client/render/alchemyarray/DayAlchemyCircleRenderer.java @@ -0,0 +1,229 @@ +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 DayAlchemyCircleRenderer extends AlchemyArrayRenderer +{ + private final ResourceLocation spikesResource; + private final ResourceLocation circleResource; + + public DayAlchemyCircleRenderer(ResourceLocation arrayResource, ResourceLocation spikesResource, ResourceLocation circleResource) + { + super(arrayResource); + this.spikesResource = spikesResource; + this.circleResource = circleResource; + } + + @Override + public float getRotation(float craftTime) + { + return 0; + } + + public float getSecondaryRotation(float craftTime) + { + float offset = 2; + if (craftTime >= offset) + { + float modifier = (craftTime - offset) * (craftTime - offset) * 0.05f; + return modifier * 1f; + } + return 0; + } + + public float getVerticalOffset(float craftTime) + { + if (craftTime >= 40) + { + if (craftTime <= 100) + { + return (float) (-0.4 + (0.4) * Math.pow((craftTime - 40) / 60f, 3)); + } else + { + return 0; + } + } + return -0.4f; + } + + public float getSizeModifier(float craftTime) + { + return 1.0f; + } + + public float getSecondarySizeModifier(float craftTime) + { + if (craftTime >= 40) + { + if (craftTime <= 160) + { + return (float) ((2f) * Math.pow((craftTime - 40) / 120f, 3)); + } else + { + return 2; + } + } + + return 0; + } + + public float getTertiarySizeModifier(float craftTime) + { + if (craftTime >= 40) + { + if (craftTime <= 100) + { + return (float) ((1f) * Math.pow((craftTime - 40) / 60f, 3)); + } else + { + return 1; + } + } + + return 0; + } + + public float getSpikeVerticalOffset(float craftTime) + { + if (craftTime >= 40) + { + if (craftTime <= 100) + { + return (float) (-0.4 + (0.4) * Math.pow((craftTime - 40) / 60f, 3)); + } else if (craftTime <= 140) + { + return -0.01f * (craftTime - 100); + } else + { + return -0.4f; + } + } + return -0.4f; + } + + public float getCentralCircleOffset(float craftTime) + { + if (craftTime >= 40) + { + if (craftTime <= 100) + { + return (float) (-0.4 + (0.4) * Math.pow((craftTime - 40) / 60f, 3)); + } else if (craftTime <= 140) + { + return 0.01f * (craftTime - 100); + } else + { + return 0.4f; + } + } + 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.NORTH.toVector3f(), rot, true)); + matrixStack.rotate(new Quaternion(Direction.UP.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, 0x00F000F0, combinedOverlayIn); + + matrixStack.pop(); + matrixStack.pop(); + + matrixStack.push(); + matrixStack.translate(0, getSpikeVerticalOffset(craftTime), 0); + matrixStack.rotate(new Quaternion(Direction.UP.toVector3f(), -rotation.getHorizontalAngle(), true)); + + matrixStack.push(); + + matrixStack.rotate(new Quaternion(Direction.NORTH.toVector3f(), rot, true)); + matrixStack.rotate(new Quaternion(Direction.UP.toVector3f(), -secondaryRot, true)); +// matrixStack.rotate(new Quaternion(Direction.EAST.toVector3f(), secondaryRot * 0.45812f, true)); + + twoDBuffer = renderer.getBuffer(RenderType.getEntityTranslucent(spikesResource)); + arrayModel = new BloodMagicRenderer.Model2D(); + arrayModel.minX = -0.5; + arrayModel.maxX = +0.5; + arrayModel.minY = -0.5; + arrayModel.maxY = +0.5; + arrayModel.resource = spikesResource; + + float secondarySize = 1.0F * getSecondarySizeModifier(craftTime); + + matrixStack.scale(secondarySize, secondarySize, secondarySize); + + int colorWanted = 0xFFFFFFFF; + + RenderResizableQuadrilateral.INSTANCE.renderSquare(arrayModel, matrixStack, twoDBuffer, colorWanted, 0x00F000F0, combinedOverlayIn); + + matrixStack.pop(); + matrixStack.pop(); + + matrixStack.push(); + matrixStack.translate(0, getCentralCircleOffset(craftTime), 0); + matrixStack.rotate(new Quaternion(Direction.UP.toVector3f(), -rotation.getHorizontalAngle(), true)); + + matrixStack.push(); + + matrixStack.rotate(new Quaternion(Direction.NORTH.toVector3f(), rot, true)); + matrixStack.rotate(new Quaternion(Direction.UP.toVector3f(), -secondaryRot, true)); +// matrixStack.rotate(new Quaternion(Direction.EAST.toVector3f(), secondaryRot * 0.45812f, true)); + + twoDBuffer = renderer.getBuffer(RenderType.getEntityTranslucent(circleResource)); + arrayModel = new BloodMagicRenderer.Model2D(); + arrayModel.minX = -0.5; + arrayModel.maxX = +0.5; + arrayModel.minY = -0.5; + arrayModel.maxY = +0.5; + arrayModel.resource = circleResource; + + float tertiarySize = 1.0F * getTertiarySizeModifier(craftTime); + + matrixStack.scale(tertiarySize, tertiarySize, tertiarySize); + + colorWanted = 0xFFFFFFFF; + + RenderResizableQuadrilateral.INSTANCE.renderSquare(arrayModel, matrixStack, twoDBuffer, colorWanted, 0x00F000F0, combinedOverlayIn); + + matrixStack.pop(); + matrixStack.pop(); + matrixStack.pop(); + } +} diff --git a/src/main/java/wayoftime/bloodmagic/client/render/alchemyarray/NightAlchemyCircleRenderer.java b/src/main/java/wayoftime/bloodmagic/client/render/alchemyarray/NightAlchemyCircleRenderer.java new file mode 100644 index 00000000..64f59611 --- /dev/null +++ b/src/main/java/wayoftime/bloodmagic/client/render/alchemyarray/NightAlchemyCircleRenderer.java @@ -0,0 +1,327 @@ +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 NightAlchemyCircleRenderer extends AlchemyArrayRenderer +{ + private final ResourceLocation symbolResource; + private final ResourceLocation circleResource; + + public NightAlchemyCircleRenderer(ResourceLocation arrayResource, ResourceLocation symbolResource, ResourceLocation circleResource) + { + super(arrayResource); + this.symbolResource = symbolResource; + this.circleResource = circleResource; + } + + @Override + public float getRotation(float craftTime) + { + return 0; + } + + public float getSecondaryRotation(float craftTime) + { + float offset = 2; + if (craftTime >= offset) + { + float modifier = (craftTime - offset) * (craftTime - offset) * 0.05f; + return modifier * 1f; + } + return 0; + } + + public float getTertiaryRotation(float craftTime) + { + float offset = 60; + if (craftTime >= offset) + { + float modifier = (craftTime - offset) * (craftTime - offset) * 0.15f; + return modifier * 1f; + } + return 0; + } + + public float getVerticalOffset(float craftTime) + { +// if (craftTime >= 40) +// { +// if (craftTime <= 100) +// { +// return (float) (-0.4 + (0.4) * Math.pow((craftTime - 40) / 60f, 3)); +// } else +// { +// return 0; +// } +// } + return -0.4f; + } + + public float getSizeModifier(float craftTime) + { + return 1.0f; + } + + public float getSecondarySizeModifier(float craftTime) + { + if (craftTime >= 100) + { + if (craftTime <= 160) + { + return (float) ((1f) * Math.pow((craftTime - 100) / 60f, 3)) + 1f; + } else + { + return 2; + } + } + return 1.0f; + } + + public float getTertiarySizeModifier(float craftTime) + { + return 1; + } + + public float getSymbolVerticaloffset(float craftTime) + { + if (craftTime >= 40) + { + if (craftTime <= 100) + { + return (float) (-0.4 + (0.4) * Math.pow((craftTime - 40) / 60f, 3)); + } else if (craftTime <= 140) + { + return 0.01f * (craftTime - 100); + } else + { + return 0.4f; + } + } + + return -0.4f; + } + + public float getCentralCircleOffset(float craftTime) + { + if (craftTime >= 40) + { + if (craftTime <= 100) + { + return (float) (-0.4 + (0.4) * Math.pow((craftTime - 40) / 60f, 3)); + } else + { + return 0; + } + } + + return -0.4f; + } + + public float getSymbolPitch(float craftTime) + { + if (craftTime > 70) + { + if (craftTime <= 100) + { + return 90 * (craftTime - 70) / 30f; + } else + { + return 90; + } + } + return 0; + } + + public float getCentralCirclePitch(float craftTime) + { + if (craftTime > 70) + { + if (craftTime <= 150) + { + return 360 * (craftTime - 70) / 80f; + } else + { + return 360; + } + } + return 0; + } + + public float moonDisplacement(float craftTime) + { + if (craftTime > 40) + { + if (craftTime <= 100) + { + return (float) (2 * Math.pow((craftTime - 40) / 60f, 3)); + } else + { + return 2; + } + } + return 0; + } + + public float moonArc(float craftTime) + { + if (craftTime > 100) + { + if (craftTime <= 200) + { + return 180 * (craftTime - 100) / 100f; + } else + { + return 180; + } + } + + return 0; + } + + 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 tertiaryRot = getTertiaryRotation(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.NORTH.toVector3f(), rot, true)); + matrixStack.rotate(new Quaternion(Direction.UP.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, 0x00F000F0, combinedOverlayIn); + + matrixStack.pop(); + matrixStack.pop(); + +// matrixStack.push(); +// matrixStack.translate(0, getSymbolVerticaloffset(craftTime), 0); +// matrixStack.rotate(new Quaternion(Direction.UP.toVector3f(), -rotation.getHorizontalAngle(), true)); +// +// matrixStack.push(); +// + float pitch = getSymbolPitch(craftTime); +// matrixStack.rotate(new Quaternion(Direction.WEST.toVector3f(), pitch, true)); +// matrixStack.rotate(new Quaternion(Direction.NORTH.toVector3f(), tertiaryRot, true)); +//// matrixStack.rotate(new Quaternion(Direction.EAST.toVector3f(), secondaryRot * 0.45812f, true)); +// +// twoDBuffer = renderer.getBuffer(RenderType.getEntityTranslucent(symbolResource)); +// arrayModel = new BloodMagicRenderer.Model2D(); +// arrayModel.minX = -0.5; +// arrayModel.maxX = +0.5; +// arrayModel.minY = -0.5; +// arrayModel.maxY = +0.5; +// arrayModel.resource = symbolResource; +// + float secondarySize = 1.0F * getSecondarySizeModifier(craftTime); +// +// matrixStack.scale(secondarySize, secondarySize, secondarySize); +// + int colorWanted = 0xFFFFFFFF; +// +// RenderResizableQuadrilateral.INSTANCE.renderSquare(arrayModel, matrixStack, twoDBuffer, colorWanted, 0x00F000F0, combinedOverlayIn); +// +// matrixStack.pop(); +// matrixStack.pop(); + + matrixStack.push(); + matrixStack.translate(0, getCentralCircleOffset(craftTime), 0); + matrixStack.rotate(new Quaternion(Direction.UP.toVector3f(), -rotation.getHorizontalAngle(), true)); + + matrixStack.push(); + + pitch = getCentralCirclePitch(craftTime); + matrixStack.rotate(new Quaternion(Direction.WEST.toVector3f(), pitch, true)); + matrixStack.rotate(new Quaternion(Direction.UP.toVector3f(), -secondaryRot, true)); +// matrixStack.rotate(new Quaternion(Direction.EAST.toVector3f(), secondaryRot * 0.45812f, true)); + + twoDBuffer = renderer.getBuffer(RenderType.getEntityTranslucent(circleResource)); + arrayModel = new BloodMagicRenderer.Model2D(); + arrayModel.minX = -0.5; + arrayModel.maxX = +0.5; + arrayModel.minY = -0.5; + arrayModel.maxY = +0.5; + arrayModel.resource = circleResource; + + float tertiarySize = 1.0F * getTertiarySizeModifier(craftTime); + + matrixStack.scale(tertiarySize, tertiarySize, tertiarySize); + + colorWanted = 0xFFFFFFFF; + + RenderResizableQuadrilateral.INSTANCE.renderSquare(arrayModel, matrixStack, twoDBuffer, colorWanted, 0x00F000F0, combinedOverlayIn); + + matrixStack.pop(); + matrixStack.pop(); + + // Moon going over the array + + matrixStack.push(); + matrixStack.translate(0, getCentralCircleOffset(craftTime), 0); + matrixStack.rotate(new Quaternion(Direction.UP.toVector3f(), -rotation.getHorizontalAngle(), true)); + matrixStack.rotate(new Quaternion(Direction.SOUTH.toVector3f(), moonArc(craftTime), true)); + matrixStack.translate(moonDisplacement(craftTime), 0, 0); + + matrixStack.push(); + + pitch = getSymbolPitch(craftTime); + + matrixStack.rotate(new Quaternion(Direction.WEST.toVector3f(), pitch, true)); + matrixStack.rotate(new Quaternion(Direction.NORTH.toVector3f(), tertiaryRot, true)); +// matrixStack.rotate(new Quaternion(Direction.EAST.toVector3f(), secondaryRot * 0.45812f, true)); + + twoDBuffer = renderer.getBuffer(RenderType.getEntityTranslucent(symbolResource)); + arrayModel = new BloodMagicRenderer.Model2D(); + arrayModel.minX = -0.5; + arrayModel.maxX = +0.5; + arrayModel.minY = -0.5; + arrayModel.maxY = +0.5; + arrayModel.resource = symbolResource; + + secondarySize = 1.0F; + + matrixStack.scale(secondarySize, secondarySize, secondarySize); + + colorWanted = 0xFFFFFFFF; + + RenderResizableQuadrilateral.INSTANCE.renderSquare(arrayModel, matrixStack, twoDBuffer, colorWanted, 0x00F000F0, combinedOverlayIn); + + matrixStack.pop(); + matrixStack.pop(); + + matrixStack.pop(); + } +} diff --git a/src/main/java/wayoftime/bloodmagic/client/render/alchemyarray/SingleAlchemyCircleRenderer.java b/src/main/java/wayoftime/bloodmagic/client/render/alchemyarray/SingleAlchemyCircleRenderer.java index 9187253e..ff6ff63a 100644 --- a/src/main/java/wayoftime/bloodmagic/client/render/alchemyarray/SingleAlchemyCircleRenderer.java +++ b/src/main/java/wayoftime/bloodmagic/client/render/alchemyarray/SingleAlchemyCircleRenderer.java @@ -5,7 +5,6 @@ import com.mojang.blaze3d.vertex.IVertexBuilder; import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.client.renderer.RenderType; -import net.minecraft.client.renderer.texture.OverlayTexture; import net.minecraft.util.Direction; import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.vector.Quaternion; @@ -75,7 +74,7 @@ public class SingleAlchemyCircleRenderer extends AlchemyArrayRenderer matrixStack.scale(size, size, size); - RenderResizableQuadrilateral.INSTANCE.renderSquare(arrayModel, matrixStack, twoDBuffer, 0xFFFFFFFF, 0x00F000F0, OverlayTexture.NO_OVERLAY); + RenderResizableQuadrilateral.INSTANCE.renderSquare(arrayModel, matrixStack, twoDBuffer, 0xFFFFFFFF, 0x00F000F0, combinedOverlayIn); matrixStack.pop(); matrixStack.pop(); diff --git a/src/main/java/wayoftime/bloodmagic/common/alchemyarray/AlchemyArrayEffectDay.java b/src/main/java/wayoftime/bloodmagic/common/alchemyarray/AlchemyArrayEffectDay.java index 00328283..ea94e748 100644 --- a/src/main/java/wayoftime/bloodmagic/common/alchemyarray/AlchemyArrayEffectDay.java +++ b/src/main/java/wayoftime/bloodmagic/common/alchemyarray/AlchemyArrayEffectDay.java @@ -1,11 +1,18 @@ package wayoftime.bloodmagic.common.alchemyarray; +import net.minecraft.client.world.ClientWorld; +import net.minecraft.entity.EntityType; +import net.minecraft.entity.effect.LightningBoltEntity; import net.minecraft.nbt.CompoundNBT; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; import net.minecraft.world.server.ServerWorld; import wayoftime.bloodmagic.tile.TileAlchemyArray; public class AlchemyArrayEffectDay extends AlchemyArrayEffect { + private long startingTime = 0; + public AlchemyArrayEffectDay() { @@ -14,21 +21,58 @@ public class AlchemyArrayEffectDay extends AlchemyArrayEffect @Override public boolean update(TileAlchemyArray tile, int ticksActive) { - // TODO: Add recipe rechecking to verify nothing screwy is going on. - if (tile.getWorld().isRemote) +// if (ticksActive < 200) +// { +// return false; +// } + + World world = tile.getWorld(); + + if (ticksActive == 100) + { + startingTime = world.getDayTime(); + tile.doDropIngredients(false); + } + + if (ticksActive <= 100) { return false; } - if (tile.getWorld() instanceof ServerWorld) + // TODO: Add recipe rechecking to verify nothing screwy is going on. + if (world.isRemote && world instanceof ClientWorld) { - long time = (tile.getWorld().getGameTime() / 24000) * 24000; - for (ServerWorld serverworld : tile.getWorld().getServer().getWorlds()) + long finalTime = ((world.getDayTime() + 24000) / 24000) * 24000; + long time = (finalTime - startingTime) * (ticksActive - 100) / 100 + startingTime; + + ((ClientWorld) world).getWorldInfo().setDayTime(time); + + return false; + } + + if (world instanceof ServerWorld) + { +// world.getDayTime() + long finalTime = ((world.getDayTime() + 24000) / 24000) * 24000; + long time = (finalTime - startingTime) * (ticksActive - 100) / 100 + startingTime; + for (ServerWorld serverworld : world.getServer().getWorlds()) { serverworld.func_241114_a_((long) time); } - return true; + if (ticksActive >= 200) + { + BlockPos pos = tile.getPos(); + LightningBoltEntity lightningboltentity = EntityType.LIGHTNING_BOLT.create(world); +// LightningBoltEntity lightning = new LightningBoltEntity(world, pos.getX() + dispX, pos.getY(), pos.getZ() + dispZ); + lightningboltentity.setPosition(pos.getX() + 0.5, pos.getY(), pos.getZ() + 0.5); + lightningboltentity.setEffectOnly(true); + world.addEntity(lightningboltentity); + + return true; + } + + return false; } return false; } diff --git a/src/main/java/wayoftime/bloodmagic/common/alchemyarray/AlchemyArrayEffectNight.java b/src/main/java/wayoftime/bloodmagic/common/alchemyarray/AlchemyArrayEffectNight.java new file mode 100644 index 00000000..5d322081 --- /dev/null +++ b/src/main/java/wayoftime/bloodmagic/common/alchemyarray/AlchemyArrayEffectNight.java @@ -0,0 +1,97 @@ +package wayoftime.bloodmagic.common.alchemyarray; + +import net.minecraft.client.world.ClientWorld; +import net.minecraft.entity.EntityType; +import net.minecraft.entity.effect.LightningBoltEntity; +import net.minecraft.nbt.CompoundNBT; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; +import net.minecraft.world.server.ServerWorld; +import wayoftime.bloodmagic.tile.TileAlchemyArray; + +public class AlchemyArrayEffectNight extends AlchemyArrayEffect +{ + private long startingTime = 0; + + public AlchemyArrayEffectNight() + { + + } + + @Override + public boolean update(TileAlchemyArray tile, int ticksActive) + { +// if (ticksActive < 200) +// { +// return false; +// } + + World world = tile.getWorld(); + if (ticksActive == 100) + { + startingTime = world.getDayTime(); + tile.doDropIngredients(false); + } + + if (ticksActive <= 100) + { + return false; + } + + // TODO: Add recipe rechecking to verify nothing screwy is going on. + + if (world.isRemote && world instanceof ClientWorld) + { + long finalTime = ((world.getDayTime() + 11000) / 24000) * 24000 + 13000; + long time = (finalTime - startingTime) * (ticksActive - 100) / 100 + startingTime; + + ((ClientWorld) world).getWorldInfo().setDayTime(time); + + return false; + } + + if (world instanceof ServerWorld) + { +// world.getDayTime() + long finalTime = ((world.getDayTime() + 11000) / 24000) * 24000 + 13000; + long time = (finalTime - startingTime) * (ticksActive - 100) / 100 + startingTime; + for (ServerWorld serverworld : world.getServer().getWorlds()) + { + serverworld.func_241114_a_((long) time); + } + + if (ticksActive >= 200) + { + BlockPos pos = tile.getPos(); + LightningBoltEntity lightningboltentity = EntityType.LIGHTNING_BOLT.create(world); +// LightningBoltEntity lightning = new LightningBoltEntity(world, pos.getX() + dispX, pos.getY(), pos.getZ() + dispZ); + lightningboltentity.setPosition(pos.getX() + 0.5, pos.getY(), pos.getZ() + 0.5); + lightningboltentity.setEffectOnly(true); + world.addEntity(lightningboltentity); + + return true; + } + + return false; + } + return false; + } + + @Override + public void writeToNBT(CompoundNBT tag) + { + + } + + @Override + public void readFromNBT(CompoundNBT tag) + { + + } + + @Override + public AlchemyArrayEffect getNewCopy() + { + return new AlchemyArrayEffectNight(); + } +} diff --git a/src/main/java/wayoftime/bloodmagic/common/recipe/AlchemyArrayRecipeProvider.java b/src/main/java/wayoftime/bloodmagic/common/recipe/AlchemyArrayRecipeProvider.java index d17a9ee8..7f5f245c 100644 --- a/src/main/java/wayoftime/bloodmagic/common/recipe/AlchemyArrayRecipeProvider.java +++ b/src/main/java/wayoftime/bloodmagic/common/recipe/AlchemyArrayRecipeProvider.java @@ -39,7 +39,8 @@ public class AlchemyArrayRecipeProvider implements ISubRecipeProvider AlchemyArrayRecipeBuilder.array(BloodMagic.rl("textures/models/alchemyarrays/movementarray.png"), Ingredient.fromItems(Items.FEATHER), Ingredient.fromTag(Tags.Items.DUSTS_REDSTONE), ItemStack.EMPTY).build(consumer, BloodMagic.rl(basePath + "movement")); AlchemyArrayRecipeBuilder.array(BloodMagic.rl("textures/models/alchemyarrays/updraftarray.png"), Ingredient.fromItems(Items.FEATHER), Ingredient.fromTag(Tags.Items.DUSTS_GLOWSTONE), ItemStack.EMPTY).build(consumer, BloodMagic.rl(basePath + "updraft")); AlchemyArrayRecipeBuilder.array(BloodMagic.rl("textures/models/alchemyarrays/spikearray.png"), Ingredient.fromItems(Items.COBBLESTONE), Ingredient.fromTag(Tags.Items.INGOTS_IRON), ItemStack.EMPTY).build(consumer, BloodMagic.rl(basePath + "spike")); - AlchemyArrayRecipeBuilder.array(BloodMagic.rl("textures/models/alchemyarrays/spikearray.png"), Ingredient.fromItems(Items.COAL), Ingredient.fromItems(Items.COAL), ItemStack.EMPTY).build(consumer, BloodMagic.rl(basePath + "day")); + AlchemyArrayRecipeBuilder.array(BloodMagic.rl("textures/models/alchemyarrays/sunarray.png"), Ingredient.fromItems(Items.COAL), Ingredient.fromItems(Items.COAL), ItemStack.EMPTY).build(consumer, BloodMagic.rl(basePath + "day")); + AlchemyArrayRecipeBuilder.array(BloodMagic.rl("textures/models/alchemyarrays/moonarray.png"), Ingredient.fromItems(Items.LAPIS_LAZULI), Ingredient.fromItems(Items.LAPIS_LAZULI), ItemStack.EMPTY).build(consumer, BloodMagic.rl(basePath + "night")); // AlchemyArrayRecipeBuilder.array(BloodMagic.rl("textures/models/alchemyarrays/fastminersigil.png"), // Ingredient.fromItems(BloodMagicItems.REAGENT_FAST_MINER.get()), // Ingredient.fromItems(BloodMagicItems.REINFORCED_SLATE.get()), new diff --git a/src/main/java/wayoftime/bloodmagic/compat/jei/array/AlchemyArrayCraftingCategory.java b/src/main/java/wayoftime/bloodmagic/compat/jei/array/AlchemyArrayCraftingCategory.java index 101b7e3b..45d9d511 100644 --- a/src/main/java/wayoftime/bloodmagic/compat/jei/array/AlchemyArrayCraftingCategory.java +++ b/src/main/java/wayoftime/bloodmagic/compat/jei/array/AlchemyArrayCraftingCategory.java @@ -13,8 +13,8 @@ import mezz.jei.api.recipe.category.IRecipeCategory; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; import wayoftime.bloodmagic.BloodMagic; -import wayoftime.bloodmagic.recipe.RecipeAlchemyArray; import wayoftime.bloodmagic.common.item.BloodMagicItems; +import wayoftime.bloodmagic.recipe.RecipeAlchemyArray; import wayoftime.bloodmagic.util.Constants; import wayoftime.bloodmagic.util.helper.TextHelper; @@ -88,6 +88,14 @@ public class AlchemyArrayCraftingCategory implements IRecipeCategory