Random stuffs

Updated commands
Added in a ritual hologram --Alex's code
Added a Total Stones tooltip to the ritual diviner
Gave the Alchemy Relay a null bounding box
Added localizations to the blocks that didn't have any
This commit is contained in:
Arcaratus 2015-04-18 19:49:09 -04:00
parent 003a65a51b
commit 31f552fe2d
87 changed files with 2513 additions and 682 deletions

View file

@ -7,8 +7,6 @@ import net.minecraftforge.client.event.sound.SoundEvent;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.ModBlocks;
import WayofTime.alchemicalWizardry.client.renderer.RenderHelper;
import WayofTime.alchemicalWizardry.common.ClientToServerPacketHandler;
import WayofTime.alchemicalWizardry.common.MessageKeyPressed;
import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.common.eventhandler.Event.Result;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
@ -23,12 +21,12 @@ public class ClientEventHandler
@SubscribeEvent
public void onKeyInput(InputEvent.KeyInputEvent event)
{
if(KeyBindings.omegaTest.isPressed())
{
System.out.println("ping");
// NewPacketHandler.INSTANCE.sendToServer(NewPacketHandler.getKeyboardPressPacket((byte)2));
ClientToServerPacketHandler.INSTANCE.sendToServer(new MessageKeyPressed(MessageKeyPressed.Key.OMEGA_ACTIVE));
}
// if(KeyBindings.omegaTest.isPressed())
// {
// System.out.println("ping");
//// NewPacketHandler.INSTANCE.sendToServer(NewPacketHandler.getKeyboardPressPacket((byte)2));
// ClientToServerPacketHandler.INSTANCE.sendToServer(new MessageKeyPressed(MessageKeyPressed.Key.OMEGA_ACTIVE));
// }
}
@SubscribeEvent

View file

@ -1,5 +1,6 @@
package WayofTime.alchemicalWizardry.client;
import WayofTime.alchemicalWizardry.client.renderer.RitualDivinerRender;
import net.minecraft.item.ItemBlock;
import net.minecraft.world.World;
import net.minecraftforge.client.MinecraftForgeClient;
@ -110,7 +111,7 @@ public class ClientProxy extends CommonProxy
public void registerPostSideObjects()
{
BUEntries entries = new BUEntries();
entries.postInit();
// entries.postInit();
}
@Override
@ -146,6 +147,7 @@ public class ClientProxy extends CommonProxy
RenderingRegistry.registerEntityRenderingHandler(EntityMinorDemonGruntGuardianEarth.class, new RenderMinorDemonGruntGuardian(new ModelMinorDemonGruntGuardian(), 0.5F));
RenderingRegistry.registerEntityRenderingHandler(EntityMinorDemonGruntGuardianWind.class, new RenderMinorDemonGruntGuardian(new ModelMinorDemonGruntGuardian(), 0.5F));
MinecraftForge.EVENT_BUS.register(new RitualDivinerRender());
ClientRegistry.bindTileEntitySpecialRenderer(TEAltar.class, new TEAltarRenderer());
ClientRegistry.bindTileEntitySpecialRenderer(TEPedestal.class, new RenderPedestal());

View file

@ -2,18 +2,14 @@ package WayofTime.alchemicalWizardry.client;
import net.minecraft.client.settings.KeyBinding;
import org.lwjgl.input.Keyboard;
import cpw.mods.fml.client.registry.ClientRegistry;
public class KeyBindings
{
public static KeyBinding omegaTest;
public static void init()
{
omegaTest = new KeyBinding("key.ping", Keyboard.KEY_O, "key.categories.alchemicalwizardry");
ClientRegistry.registerKeyBinding(omegaTest);
// omegaTest = new KeyBinding("key.ping", Keyboard.KEY_O, "key.categories.alchemicalwizardry");
//
// ClientRegistry.registerKeyBinding(omegaTest);
}
}

View file

@ -20,8 +20,7 @@ public class NEIBindingRitualHandler extends TemplateRecipeHandler
{
public class CachedBindingRecipe extends CachedRecipe
{
PositionedStack input;
PositionedStack output;
PositionedStack input, output;
public CachedBindingRecipe(BindingRecipe recipe)
{
@ -45,7 +44,7 @@ public class NEIBindingRitualHandler extends TemplateRecipeHandler
@Override
public void loadCraftingRecipes(String outputId, Object... results)
{
if (outputId.equals("alchemicalwizardry.binding") && getClass() == NEIBindingRitualHandler.class)
if (outputId.equals("alchemicalwizardry.bindingritual") && getClass() == NEIBindingRitualHandler.class)
{
for (BindingRecipe recipe : BindingRegistry.bindingRecipes)
{
@ -94,13 +93,13 @@ public class NEIBindingRitualHandler extends TemplateRecipeHandler
@Override
public String getOverlayIdentifier()
{
return "bindingritual";
return "alchemicalwizardry.bindingritual";
}
@Override
public void loadTransferRects()
{
transferRects.add(new RecipeTransferRect(new Rectangle(90, 32, 22, 16), "alchemicalwizardry.bindingritual"));
transferRects.add(new RecipeTransferRect(new Rectangle(68, 20, 22, 16), "alchemicalwizardry.bindingritual"));
}
@Override

View file

@ -0,0 +1,17 @@
package WayofTime.alchemicalWizardry.client.renderer;
import WayofTime.alchemicalWizardry.api.rituals.RitualEffect;
import WayofTime.alchemicalWizardry.api.rituals.Rituals;
public class Helper
{
public static RitualEffect getEffectFromString(String name)
{
Rituals ritual = Rituals.ritualMap.get(name);
if (ritual == null)
return null;
return ritual.effect;
}
}

View file

@ -0,0 +1,70 @@
package WayofTime.alchemicalWizardry.client.renderer
import net.minecraft.block.Block
import net.minecraft.client.renderer.Tessellator
import net.minecraft.world.World
object Render {
def drawFakeBlock(v:Vector3, b:Block, meta:Int, min:(Double, Double, Double), w: World): Unit = {
val (minX, minY, minZ) = min
val (maxX, maxY, maxZ) = (minX + 1, minY + 1, minZ + 1)
val tessellator = Tessellator.instance
tessellator.startDrawingQuads()
// tessellator.setBrightness(b.getMixedBrightnessForBlock(w, v.x, v.y, v.z))
tessellator.setColorRGBA(255, 255, 255, 26)
var tex: (Float, Float, Float, Float) = null
def textureMinU = tex._1
def textureMaxU = tex._2
def textureMinV = tex._3
def textureMaxV = tex._4
tex = g(b, meta, 0)
tessellator.addVertexWithUV(minX, minY, minZ, textureMinU, textureMinV)
tessellator.addVertexWithUV(maxX, minY, minZ, textureMaxU, textureMinV)
tessellator.addVertexWithUV(maxX, minY, maxZ, textureMaxU, textureMaxV)
tessellator.addVertexWithUV(minX, minY, maxZ, textureMinU, textureMaxV)
tex = g(b, meta, 1)
tessellator.addVertexWithUV(minX, maxY, maxZ, textureMinU, textureMaxV)
tessellator.addVertexWithUV(maxX, maxY, maxZ, textureMaxU, textureMaxV)
tessellator.addVertexWithUV(maxX, maxY, minZ, textureMaxU, textureMinV)
tessellator.addVertexWithUV(minX, maxY, minZ, textureMinU, textureMinV)
tex = g(b, meta, 2)
tessellator.addVertexWithUV(maxX, minY, minZ, textureMinU, textureMaxV)
tessellator.addVertexWithUV(minX, minY, minZ, textureMaxU, textureMaxV)
tessellator.addVertexWithUV(minX, maxY, minZ, textureMaxU, textureMinV)
tessellator.addVertexWithUV(maxX, maxY, minZ, textureMinU, textureMinV)
tex = g(b, meta, 3)
tessellator.addVertexWithUV(minX, minY, maxZ, textureMinU, textureMaxV)
tessellator.addVertexWithUV(maxX, minY, maxZ, textureMaxU, textureMaxV)
tessellator.addVertexWithUV(maxX, maxY, maxZ, textureMaxU, textureMinV)
tessellator.addVertexWithUV(minX, maxY, maxZ, textureMinU, textureMinV)
tex = g(b, meta, 4)
tessellator.addVertexWithUV(minX, minY, minZ, textureMinU, textureMaxV)
tessellator.addVertexWithUV(minX, minY, maxZ, textureMaxU, textureMaxV)
tessellator.addVertexWithUV(minX, maxY, maxZ, textureMaxU, textureMinV)
tessellator.addVertexWithUV(minX, maxY, minZ, textureMinU, textureMinV)
tex = g(b, meta, 5)
tessellator.addVertexWithUV(maxX, minY, maxZ, textureMinU, textureMaxV)
tessellator.addVertexWithUV(maxX, minY, minZ, textureMaxU, textureMaxV)
tessellator.addVertexWithUV(maxX, maxY, minZ, textureMaxU, textureMinV)
tessellator.addVertexWithUV(maxX, maxY, maxZ, textureMinU, textureMinV)
tessellator.draw
}
def g(b: Block, m: Int, s: Int): (Float, Float, Float, Float) = {
val i = b.getIcon(s, m)
(i.getMinU, i.getMaxU, i.getMinV, i.getMaxV)
}
}

View file

@ -0,0 +1,54 @@
package WayofTime.alchemicalWizardry.client.renderer
import WayofTime.alchemicalWizardry.ModBlocks
import WayofTime.alchemicalWizardry.api.rituals.{RitualComponent, IMasterRitualStone}
import WayofTime.alchemicalWizardry.common.items.ItemRitualDiviner
import cpw.mods.fml.common.eventhandler.SubscribeEvent
import net.minecraft.client.Minecraft
import net.minecraft.client.entity.EntityClientPlayerMP
import net.minecraft.tileentity.TileEntity
import net.minecraft.util.MovingObjectPosition
import net.minecraft.world.World
import net.minecraftforge.client.event.RenderWorldLastEvent
import scala.collection.JavaConversions
class RitualDivinerRender {
@SubscribeEvent
def render(e: RenderWorldLastEvent)
{
val mc: Minecraft = Minecraft.getMinecraft
val p: EntityClientPlayerMP = mc.thePlayer
val w: World = p.worldObj
if (mc.objectMouseOver == null || mc.objectMouseOver.typeOfHit != MovingObjectPosition.MovingObjectType.BLOCK)
return
val te: TileEntity = w.getTileEntity(mc.objectMouseOver.blockX, mc.objectMouseOver.blockY, mc.objectMouseOver.blockZ)
if (!te.isInstanceOf[IMasterRitualStone])
return
val v3 = new Vector3(mc.objectMouseOver.blockX, mc.objectMouseOver.blockY, mc.objectMouseOver.blockZ)
val (px, py, pz) = (p.lastTickPosX + (p.posX - p.lastTickPosX) * e.partialTicks, p.lastTickPosY + (p.posY - p.lastTickPosY) * e.partialTicks, p.lastTickPosZ + (p.posZ - p.lastTickPosZ) * e.partialTicks)
if (p.inventory.getCurrentItem != null && p.inventory.getCurrentItem.getItem.isInstanceOf[ItemRitualDiviner]) {
val d = p.inventory.getCurrentItem.getItem.asInstanceOf[ItemRitualDiviner]
val dir = d.getDirection(p.inventory.getCurrentItem)
val r = Helper.getEffectFromString(d.getCurrentRitual(p.inventory.getCurrentItem))
if (r == null)
return
for (x <- JavaConversions.asScalaBuffer[RitualComponent](r.getRitualComponentList))
{
val v: Vector3 = v3 + (x.getX(dir), x.getY, x.getZ(dir))
val min = (v.x - px, v.y - py, v.z - pz)
if (!w.getBlock(v.x, v.y, v.z).isOpaqueCube)
Render.drawFakeBlock(v, ModBlocks.ritualStone, x.getStoneType, min, w)
}
}
}
}

View file

@ -0,0 +1,24 @@
package WayofTime.alchemicalWizardry.client.renderer
class Vector3 (val x: Int, val y: Int, val z: Int) {
def +(w: (Int,Int,Int)): Vector3 = new Vector3(x + w._1, y+ w._2, z + w._3)
override def toString = s"V3(${x}},${y}},${z}})"
def canEqual(other: Any): Boolean = other.isInstanceOf[Vector3]
override def equals(other: Any): Boolean = other match {
case that: Vector3 =>
(that canEqual this) &&
x == that.x &&
y == that.y &&
z == that.z
case _ => false
}
override def hashCode(): Int = {
val state = Seq(x, y, z)
state.map(_.hashCode()).foldLeft(0)((a, b) => 31 * a + b)
}
}