Implemented RitualDiviner

Finished fully implementing the Ritual Diviner item. Changed the `cycleDirection` method to occur when the player does not sneak + right clicks, because the method for when a player left clicks with an item seems to have dissapeared.
This commit is contained in:
WayofTime 2020-10-25 10:55:38 -04:00
parent 85e47dbfa8
commit e254287a5e
9 changed files with 78 additions and 50 deletions

View file

@ -17,7 +17,7 @@ e1a98bd53fca155e4bbb03c1e548341af0f84bd7 assets/bloodmagic/blockstates/masterrit
b03040d7a168653bf8df3600033b8fde2383db30 assets/bloodmagic/blockstates/selfsacrificerune.json
487ffdc02ab7b65aafcb932e3b5cf6ea0500b21d assets/bloodmagic/blockstates/speedrune.json
e6d9cf699667aaa47efff37b2b033895dee29c15 assets/bloodmagic/blockstates/waterritualstone.json
c2662c44f07cfb61b565f1918b4fee1d176ed6f7 assets/bloodmagic/lang/en_us.json
770d87c47f343107732e9191d216803419324608 assets/bloodmagic/lang/en_us.json
34445195b9f2459475cde53454bc8e37d32865d7 assets/bloodmagic/models/block/accelerationrune.json
bcdbccc49d4509571be6988762ab87126275a4c8 assets/bloodmagic/models/block/airritualstone.json
3c98a88c2283ad54f0efb9d7194361bbc3e93c17 assets/bloodmagic/models/block/altarcapacityrune.json
@ -88,6 +88,7 @@ baafdb5915c5fbc99b84a54670ed64a6f26cb0fe assets/bloodmagic/models/item/reagentma
fd1447d943ddc4540a51a72dcbb245d77d45da71 assets/bloodmagic/models/item/reagentwater.json
50bf796adbed412488df48ed9250fc9b0ecd851f assets/bloodmagic/models/item/reinforcedslate.json
8b727eee7b06ffa735e6ba49f0c13042b73c45c0 assets/bloodmagic/models/item/ritualdiviner.json
42b96a7c792d1672d798b52fa1c9c4ba58d2df71 assets/bloodmagic/models/item/ritualdivinerdusk.json
2722891c9c40b124d85bf9ff8eb885e175f5e6ff assets/bloodmagic/models/item/ritualstone.json
db73abb3bcb1731b6fc389e3577910b6aab87b10 assets/bloodmagic/models/item/sacrificerune.json
9403d6195d4d38d5876c2a42f4edfb9bdcd05210 assets/bloodmagic/models/item/sacrificialdagger.json

View file

@ -61,6 +61,8 @@
"item.bloodmagic.reagentvoid": "Void Reagent",
"item.bloodmagic.reagentwater": "Water Reagent",
"item.bloodmagic.reinforcedslate": "Reinforced Slate",
"item.bloodmagic.ritualdiviner": "Ritual Diviner",
"item.bloodmagic.ritualdivinerdusk": "Ritual Diviner [Dusk]",
"item.bloodmagic.sacrificialdagger": "Sacrificial Knife",
"item.bloodmagic.sigilofmagnetism": "Sigil of Magnetism",
"item.bloodmagic.soulgemcommon": "Common Tartaric Gem",
@ -137,6 +139,7 @@
"tooltip.bloodmagic.diviner.dawnRune": "Dawn Runes: %d",
"tooltip.bloodmagic.diviner.duskRune": "Dusk Runes: %d",
"tooltip.bloodmagic.diviner.earthRune": "Earth Runes: %d",
"tooltip.bloodmagic.diviner.extraExtraInfo": "-Hold shift + alt for augmentation info-",
"tooltip.bloodmagic.diviner.extraInfo": "Press shift for extra info",
"tooltip.bloodmagic.diviner.fireRune": "Fire Runes: %d",
"tooltip.bloodmagic.diviner.totalRune": "Total Runes: %d",

View file

@ -0,0 +1,6 @@
{
"parent": "minecraft:item/handheld",
"textures": {
"layer0": "bloodmagic:item/ritualdivinerdusk"
}
}

View file

@ -98,6 +98,7 @@ public class GeneratorLanguage extends LanguageProvider
add("tooltip.bloodmagic.diviner.dawnRune", "Dawn Runes: %d");
add("tooltip.bloodmagic.diviner.totalRune", "Total Runes: %d");
add("tooltip.bloodmagic.diviner.extraInfo", "Press shift for extra info");
add("tooltip.bloodmagic.diviner.extraExtraInfo", "-Hold shift + alt for augmentation info-");
add("tooltip.bloodmagic.diviner.currentDirection", "Current Direction: %s");
add("ritual.bloodmagic.testRitual", "Test Ritual");
@ -207,6 +208,9 @@ public class GeneratorLanguage extends LanguageProvider
addItem(BloodMagicItems.AIR_INSCRIPTION_TOOL, "Inscription Tool: Air");
addItem(BloodMagicItems.DUSK_INSCRIPTION_TOOL, "Inscription Tool: Dusk");
addItem(BloodMagicItems.BASE_RITUAL_DIVINER, "Ritual Diviner");
addItem(BloodMagicItems.DUSK_RITUAL_DIVINER, "Ritual Diviner [Dusk]");
// addItem(BloodMagicItems , "");
// JEI

View file

@ -109,6 +109,7 @@ public class BloodMagicItems
public static final RegistryObject<Item> DUSK_INSCRIPTION_TOOL = BASICITEMS.register("duskscribetool", () -> new ItemInscriptionTool(EnumRuneType.DUSK));
public static final RegistryObject<Item> BASE_RITUAL_DIVINER = BASICITEMS.register("ritualdiviner", () -> new ItemRitualDiviner(0));
public static final RegistryObject<Item> DUSK_RITUAL_DIVINER = BASICITEMS.register("ritualdivinerdusk", () -> new ItemRitualDiviner(1));
// Reagents used to make the Sigils
public static final RegistryObject<Item> REAGENT_WATER = BASICITEMS.register("reagentwater", () -> new ItemBase());

View file

@ -28,6 +28,7 @@ import net.minecraft.util.math.RayTraceContext;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.StringTextComponent;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.util.text.TranslationTextComponent;
import net.minecraft.world.World;
import net.minecraftforge.api.distmarker.Dist;
@ -232,7 +233,7 @@ public class ItemRitualDiviner extends Item
boolean sneaking = Screen.hasShiftDown();
// boolean extraInfo = sneaking && Keyboard.isKeyDown(Keyboard.KEY_M);
boolean extraInfo = Screen.hasAltDown();
boolean extraInfo = sneaking && Screen.hasAltDown();
if (extraInfo)
{
@ -315,8 +316,8 @@ public class ItemRitualDiviner extends Item
tooltip.add(new StringTextComponent(""));
}
tooltip.add(new TranslationTextComponent(tooltipBase + "extraInfo"));
tooltip.add(new TranslationTextComponent(tooltipBase + "extraExtraInfo"));
tooltip.add(new TranslationTextComponent(tooltipBase + "extraInfo").mergeStyle(TextFormatting.BLUE));
tooltip.add(new TranslationTextComponent(tooltipBase + "extraExtraInfo").mergeStyle(TextFormatting.BLUE));
}
}
}
@ -341,6 +342,12 @@ public class ItemRitualDiviner extends Item
}
return new ActionResult<>(ActionResultType.SUCCESS, stack);
} else
{
if (!world.isRemote)
{
cycleDirection(stack, player);
}
}
return new ActionResult<>(ActionResultType.PASS, stack);

View file

@ -4,7 +4,6 @@ import java.util.List;
import com.google.common.collect.Lists;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.platform.GlStateManager;
import com.mojang.blaze3d.systems.RenderSystem;
import com.mojang.blaze3d.vertex.IVertexBuilder;
@ -33,7 +32,6 @@ import wayoftime.bloodmagic.BloodMagic;
import wayoftime.bloodmagic.client.render.BloodMagicRenderer;
import wayoftime.bloodmagic.client.render.BloodMagicRenderer.Model3D;
import wayoftime.bloodmagic.client.render.RenderResizableCuboid;
import wayoftime.bloodmagic.client.render.block.RenderFakeBlocks;
import wayoftime.bloodmagic.common.item.ItemRitualDiviner;
import wayoftime.bloodmagic.ritual.Ritual;
import wayoftime.bloodmagic.ritual.RitualComponent;
@ -117,7 +115,13 @@ public class ClientHandler
if (tileEntity instanceof TileMasterRitualStone && !player.getHeldItemMainhand().isEmpty()
&& player.getHeldItemMainhand().getItem() instanceof ItemRitualDiviner)
renderRitualStones(player, event.getPartialTicks());
{
IRenderTypeBuffer.Impl buffers = Minecraft.getInstance().getRenderTypeBuffers().getBufferSource();
MatrixStack stack = event.getMatrixStack();
renderRitualStones(stack, buffers, player, event.getPartialTicks());
RenderSystem.disableDepthTest();
buffers.finish();
}
}
private static TextureAtlasSprite forName(AtlasTexture textureMap, String name, String dir)
@ -125,8 +129,9 @@ public class ClientHandler
return textureMap.getSprite(new ResourceLocation(BloodMagic.MODID + dir + "/" + name));
}
private static void renderRitualStones(ClientPlayerEntity player, float partialTicks)
private static void renderRitualStones(MatrixStack stack, IRenderTypeBuffer renderer, ClientPlayerEntity player, float partialTicks)
{
IVertexBuilder buffer = renderer.getBuffer(Atlases.getTranslucentCullBlockType());
World world = player.getEntityWorld();
ItemRitualDiviner ritualDiviner = (ItemRitualDiviner) player.inventory.getCurrentItem().getItem();
Direction direction = ritualDiviner.getDirection(player.inventory.getCurrentItem());
@ -135,11 +140,6 @@ public class ClientHandler
if (ritual == null)
return;
GlStateManager.pushMatrix();
GlStateManager.enableBlend();
// GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
// GlStateManager.color4f(1F, 1F, 1F, 0.6125F);
BlockPos vec3, vX;
vec3 = ((BlockRayTraceResult) minecraft.objectMouseOver).getPos();
double posX = player.lastTickPosX + (player.getPosX() - player.lastTickPosX) * partialTicks;
@ -150,51 +150,58 @@ public class ClientHandler
ritual.gatherComponents(components::add);
for (RitualComponent ritualComponent : components)
{
stack.push();
vX = vec3.add(ritualComponent.getOffset(direction));
double minX = vX.getX() - posX;
double minY = vX.getY() - posY;
double minZ = vX.getZ() - posZ;
Vector3d eyePos = player.getEyePosition(partialTicks);
double minX = vX.getX() - eyePos.x;
double minY = vX.getY() - eyePos.y;
double minZ = vX.getZ() - eyePos.z;
// double minX = vX.getX() - posX;
// double minY = vX.getY() - posY;
// double minZ = vX.getZ() - posZ;
stack.translate(minX, minY, minZ);
if (!world.getBlockState(vX).isOpaqueCube(world, vX))
{
TextureAtlasSprite texture = null;
ResourceLocation rl = null;
// switch (ritualComponent.getRuneType())
// {
// case BLANK:
// texture = ritualStoneBlank;
// break;
// case WATER:
// texture = ritualStoneWater;
// break;
// case FIRE:
// texture = ritualStoneFire;
// break;
// case EARTH:
// texture = ritualStoneEarth;
// break;
// case AIR:
// texture = ritualStoneAir;
// break;
// case DAWN:
// texture = ritualStoneDawn;
// break;
// case DUSK:
// texture = ritualStoneDusk;
// break;
// }
switch (ritualComponent.getRuneType())
{
case BLANK:
rl = ritualStoneBlank;
break;
case WATER:
rl = ritualStoneWater;
break;
case FIRE:
rl = ritualStoneFire;
break;
case EARTH:
rl = ritualStoneEarth;
break;
case AIR:
rl = ritualStoneAir;
break;
case DAWN:
rl = ritualStoneDawn;
break;
case DUSK:
rl = ritualStoneDusk;
break;
}
RenderFakeBlocks.drawFakeBlock(texture, minX, minY, minZ);
Model3D model = getBlockModel(rl);
RenderResizableCuboid.INSTANCE.renderCube(model, stack, buffer, 0xDDFFFFFF, 0x00F000F0, OverlayTexture.NO_OVERLAY);
}
stack.pop();
}
GlStateManager.popMatrix();
}
public static void renderRitualStones(MatrixStack stack, IRenderTypeBuffer renderer, TileMasterRitualStone masterRitualStone, float partialTicks)
{
IVertexBuilder buffer = renderer.getBuffer(Atlases.getTranslucentCullBlockType());
System.out.println("Attempting to render stones");
ClientPlayerEntity player = minecraft.player;
World world = player.getEntityWorld();
Direction direction = mrsHoloDirection;
@ -204,10 +211,6 @@ public class ClientHandler
{
return;
}
// GlStateManager.pushMatrix();
// GlStateManager.enableBlend();
// GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
// GlStateManager.color4f(1F, 1F, 1F, 0.5F);
BlockPos vec3, vX;
vec3 = masterRitualStone.getPos();
@ -226,11 +229,14 @@ public class ClientHandler
double minY = vX.getY() - eyePos.y;
double minZ = vX.getZ() - eyePos.z;
// double minX = vX.getX() - posX;
// double minY = vX.getY() - posY;
// double minZ = vX.getZ() - posZ;
stack.translate(minX, minY, minZ);
if (!world.getBlockState(vX).isOpaqueCube(world, vX))
{
ResourceLocation rl = null;
switch (ritualComponent.getRuneType())

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB