Made the source wireframe of the Ring of Loki thicker.

This commit is contained in:
Lizbeth Rika committed 2015-04-30 14:10:35 +01:00
1 parent 2e81845446
commit a7780b60c3
4 files changed
+50 -7

No files matched your search

@@ -0,0 +1,28 @@
/**
* This class was created by <Vazkii>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*
* File Created @ [Apr 30, 2015, 1:43:17 PM (GMT)]
*/
package vazkii.botania.api.item;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ChunkCoordinates;
/**
* An extension of IWireframeCoordinateListProvider that allows for
* rendering a single thicker wireframe.
*/
public interface IExtendedWireframeCoordinateListProvider extends IWireframeCoordinateListProvider {
/**
* Gets the source wireframe to draw, this one will be drawn thicker.
*/
public ChunkCoordinates getSourceWireframe(EntityPlayer player, ItemStack stack);
}
@@ -1,4 +1,4 @@
@API(owner = "Botania", apiVersion = "44", provides = "BotaniaAPI")
@API(owner = "Botania", apiVersion = "45", provides = "BotaniaAPI")
package vazkii.botania.api;
import cpw.mods.fml.common.API;
@@ -28,6 +28,7 @@ import net.minecraftforge.client.event.RenderWorldLastEvent;
import org.lwjgl.opengl.GL11;
import vazkii.botania.api.BotaniaAPI;
import vazkii.botania.api.item.IExtendedWireframeCoordinateListProvider;
import vazkii.botania.api.item.IWireframeCoordinateListProvider;
import vazkii.botania.api.wand.ICoordBoundItem;
import vazkii.botania.api.wand.IWireframeAABBProvider;
@@ -72,6 +73,12 @@ public final class BoundTileRenderer {
if(coordsList != null)
for(ChunkCoordinates coords : coordsList)
renderBlockOutlineAt(coords, color);
if(stackInSlot.getItem() instanceof IExtendedWireframeCoordinateListProvider) {
ChunkCoordinates coords = ((IExtendedWireframeCoordinateListProvider) stackInSlot.getItem()).getSourceWireframe(player, stackInSlot);
if(coords != null)
renderBlockOutlineAt(coords, color, 5F);
}
}
}
@@ -82,6 +89,10 @@ public final class BoundTileRenderer {
}
private void renderBlockOutlineAt(ChunkCoordinates pos, int color) {
renderBlockOutlineAt(pos, color, 1F);
}
private void renderBlockOutlineAt(ChunkCoordinates pos, int color, float thickness) {
GL11.glPushMatrix();
GL11.glTranslated(pos.posX - RenderManager.renderPosX, pos.posY - RenderManager.renderPosY, pos.posZ - RenderManager.renderPosZ + 1);
Color colorRGB = new Color(color);
@@ -109,10 +120,10 @@ public final class BoundTileRenderer {
GL11.glScalef(1F, 1F, 1F);
GL11.glLineWidth(1F);
GL11.glLineWidth(thickness);
renderBlockOutline(axis);
GL11.glLineWidth(4F);
GL11.glLineWidth(thickness + 3F);
GL11.glColor4ub((byte) colorRGB.getRed(), (byte) colorRGB.getGreen(), (byte) colorRGB.getBlue(), (byte) 64);
renderBlockOutline(axis);
}
@@ -30,8 +30,8 @@ import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
import net.minecraftforge.event.entity.player.PlayerInteractEvent.Action;
import vazkii.botania.api.item.IExtendedWireframeCoordinateListProvider;
import vazkii.botania.api.item.ISequentialBreaker;
import vazkii.botania.api.item.IWireframeCoordinateListProvider;
import vazkii.botania.common.core.helper.ItemNBTHelper;
import vazkii.botania.common.item.ModItems;
import vazkii.botania.common.item.equipment.tool.ToolCommons;
@@ -45,7 +45,7 @@ import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class ItemLokiRing extends ItemRelicBauble implements IWireframeCoordinateListProvider {
public class ItemLokiRing extends ItemRelicBauble implements IExtendedWireframeCoordinateListProvider {
private static final String TAG_CURSOR_LIST = "cursorList";
private static final String TAG_CURSOR_PREFIX = "cursor";
@@ -116,7 +116,7 @@ public class ItemLokiRing extends ItemRelicBauble implements IWireframeCoordinat
}
}
}
} else if(heldItemStack != null && event.action == Action.RIGHT_CLICK_BLOCK && lookPos != null) {
} else if(originCoords.posY == -1 && heldItemStack != null && event.action == Action.RIGHT_CLICK_BLOCK && lookPos != null && player.isSneaking()) {
List<ChunkCoordinates> cursors = getCursorList(lokiRing);
for(ChunkCoordinates cursor : cursors) {
int x = lookPos.blockX + cursor.posX;
@@ -185,7 +185,6 @@ public class ItemLokiRing extends ItemRelicBauble implements IWireframeCoordinat
coords.posY += origin.posY;
coords.posZ += origin.posZ;
}
list.add(origin);
} else for(ChunkCoordinates coords : list) {
coords.posX += lookPos.blockX;
coords.posY += lookPos.blockY;
@@ -197,6 +196,11 @@ public class ItemLokiRing extends ItemRelicBauble implements IWireframeCoordinat
return null;
}
@Override
public ChunkCoordinates getSourceWireframe(EntityPlayer player, ItemStack stack) {
return getOriginPos(stack);
}
private static ItemStack getLokiRing(EntityPlayer player) {
InventoryBaubles baubles = PlayerHandler.getPlayerBaubles(player);