mirror of
https://github.com/GTNewHorizons/ThaumicTinkerer.git
synced 2026-11-28 16:06:07 +00:00
Cleaned up some stuff ((accidentally) fixed up textures, started on focii, and cleaned gradle a bit
This commit is contained in:
1 parent
6622892f0e
commit
f42f3d3685
304 files changed
+15312
-15463
No files matched your search
@@ -4,5 +4,5 @@ package thaumic.tinkerer.api;
|
||||
* Created by Katrina on 16/04/14.
|
||||
*/
|
||||
public class InterModCommsOperations {
|
||||
public static final String ADD_RESEARCH_BLACKLIST = "AddResearchBlacklist";
|
||||
public static final String ADD_RESEARCH_BLACKLIST = "AddResearchBlacklist";
|
||||
}
|
||||
@@ -27,22 +27,22 @@ import thaumic.tinkerer.common.lib.LibResearch;
|
||||
|
||||
public class ClientTickHandler {
|
||||
|
||||
public static int elapsedTicks;
|
||||
public static int elapsedTicks;
|
||||
|
||||
@SubscribeEvent
|
||||
public void tickEnd(TickEvent event) {
|
||||
if (event.phase == TickEvent.Phase.END) {
|
||||
Minecraft mc = ClientHelper.minecraft();
|
||||
if (mc.currentScreen != null && mc.currentScreen instanceof GuiResearchRecipe && !(mc.currentScreen instanceof GuiResearchPeripheral)) {
|
||||
ResearchItem research = ReflectionHelper.getPrivateValue(GuiResearchRecipe.class, (GuiResearchRecipe) mc.currentScreen, 9);
|
||||
if (research.key.equals(LibResearch.KEY_PERIPHERALS) || research.key.equals(LibResearch.KEY_GOLEMCONNECTOR))
|
||||
mc.displayGuiScreen(new GuiResearchPeripheral(research));
|
||||
}
|
||||
@SubscribeEvent
|
||||
public void tickEnd(TickEvent event) {
|
||||
if (event.phase == TickEvent.Phase.END) {
|
||||
Minecraft mc = ClientHelper.minecraft();
|
||||
if (mc.currentScreen != null && mc.currentScreen instanceof GuiResearchRecipe && !(mc.currentScreen instanceof GuiResearchPeripheral)) {
|
||||
ResearchItem research = ReflectionHelper.getPrivateValue(GuiResearchRecipe.class, (GuiResearchRecipe) mc.currentScreen, 9);
|
||||
if (research.key.equals(LibResearch.KEY_PERIPHERALS) || research.key.equals(LibResearch.KEY_GOLEMCONNECTOR))
|
||||
mc.displayGuiScreen(new GuiResearchPeripheral(research));
|
||||
}
|
||||
|
||||
ToolModeHUDHandler.clientTick();
|
||||
ToolModeHUDHandler.clientTick();
|
||||
|
||||
++elapsedTicks;
|
||||
}
|
||||
}
|
||||
++elapsedTicks;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -19,20 +19,20 @@ import thaumic.tinkerer.common.item.kami.armor.ItemIchorclothArmorAdv;
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class GemArmorKeyHandler {
|
||||
|
||||
static KeyBinding SpecialAbility = new KeyBinding("ttmisc.toggleArmor", Keyboard.KEY_U, "ttmisc.keyCategory");
|
||||
static KeyBinding SpecialAbility = new KeyBinding("ttmisc.toggleArmor", Keyboard.KEY_U, "ttmisc.keyCategory");
|
||||
|
||||
public GemArmorKeyHandler() {
|
||||
FMLCommonHandler.instance().bus().register(this);
|
||||
ClientRegistry.registerKeyBinding(SpecialAbility);
|
||||
}
|
||||
public GemArmorKeyHandler() {
|
||||
FMLCommonHandler.instance().bus().register(this);
|
||||
ClientRegistry.registerKeyBinding(SpecialAbility);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void keyUp(InputEvent.KeyInputEvent event) {
|
||||
if (SpecialAbility.isPressed()) {
|
||||
if ((Minecraft.getMinecraft().thePlayer.getCurrentArmor(0) != null && Minecraft.getMinecraft().thePlayer.getCurrentArmor(0).getItem() instanceof ItemIchorclothArmorAdv) || (Minecraft.getMinecraft().thePlayer.getCurrentArmor(1) != null && Minecraft.getMinecraft().thePlayer.getCurrentArmor(1).getItem() instanceof ItemIchorclothArmorAdv) || (Minecraft.getMinecraft().thePlayer.getCurrentArmor(2) != null && Minecraft.getMinecraft().thePlayer.getCurrentArmor(2).getItem() instanceof ItemIchorclothArmorAdv) || (Minecraft.getMinecraft().thePlayer.getCurrentArmor(3) != null && Minecraft.getMinecraft().thePlayer.getCurrentArmor(3).getItem() instanceof ItemIchorclothArmorAdv)) {
|
||||
KamiArmorClientHandler.SetStatus(!ThaumicTinkerer.proxy.armorStatus(ThaumicTinkerer.proxy.getClientPlayer()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@SubscribeEvent
|
||||
public void keyUp(InputEvent.KeyInputEvent event) {
|
||||
if (SpecialAbility.isPressed()) {
|
||||
if ((Minecraft.getMinecraft().thePlayer.getCurrentArmor(0) != null && Minecraft.getMinecraft().thePlayer.getCurrentArmor(0).getItem() instanceof ItemIchorclothArmorAdv) || (Minecraft.getMinecraft().thePlayer.getCurrentArmor(1) != null && Minecraft.getMinecraft().thePlayer.getCurrentArmor(1).getItem() instanceof ItemIchorclothArmorAdv) || (Minecraft.getMinecraft().thePlayer.getCurrentArmor(2) != null && Minecraft.getMinecraft().thePlayer.getCurrentArmor(2).getItem() instanceof ItemIchorclothArmorAdv) || (Minecraft.getMinecraft().thePlayer.getCurrentArmor(3) != null && Minecraft.getMinecraft().thePlayer.getCurrentArmor(3).getItem() instanceof ItemIchorclothArmorAdv)) {
|
||||
KamiArmorClientHandler.SetStatus(!ThaumicTinkerer.proxy.armorStatus(ThaumicTinkerer.proxy.getClientPlayer()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -26,7 +26,6 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraftforge.client.event.RenderGameOverlayEvent;
|
||||
import net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType;
|
||||
import thaumcraft.api.wands.IWandFocus;
|
||||
import thaumcraft.api.wands.ItemFocusBasic;
|
||||
import thaumcraft.common.config.Config;
|
||||
import thaumcraft.common.items.wands.ItemWandCasting;
|
||||
@@ -35,55 +34,55 @@ import thaumic.tinkerer.common.item.foci.ItemFocusDislocation;
|
||||
|
||||
public final class HUDHandler {
|
||||
|
||||
RenderItem renderItem = new RenderItem();
|
||||
RenderItem renderItem = new RenderItem();
|
||||
|
||||
@SubscribeEvent
|
||||
public void drawDislocationFocusHUD(RenderGameOverlayEvent.Post event) {
|
||||
if (event.type == ElementType.HOTBAR && ClientHelper.minecraft().currentScreen == null) {
|
||||
boolean up = !Config.dialBottom;
|
||||
int xpos = 4;
|
||||
int ypos = up ? 50 : event.resolution.getScaledHeight() - 70;
|
||||
@SubscribeEvent
|
||||
public void drawDislocationFocusHUD(RenderGameOverlayEvent.Post event) {
|
||||
if (event.type == ElementType.HOTBAR && ClientHelper.minecraft().currentScreen == null) {
|
||||
boolean up = !Config.dialBottom;
|
||||
int xpos = 4;
|
||||
int ypos = up ? 50 : event.resolution.getScaledHeight() - 70;
|
||||
|
||||
ItemStack item = ClientHelper.clientPlayer().getCurrentEquippedItem();
|
||||
if (item != null && item.getItem() instanceof ItemWandCasting) {
|
||||
ItemWandCasting wand = (ItemWandCasting) item.getItem();
|
||||
wand.getFocusItem(item);
|
||||
ItemFocusBasic focus = wand.getFocus(item);
|
||||
ItemStack item = ClientHelper.clientPlayer().getCurrentEquippedItem();
|
||||
if (item != null && item.getItem() instanceof ItemWandCasting) {
|
||||
ItemWandCasting wand = (ItemWandCasting) item.getItem();
|
||||
wand.getFocusItem(item);
|
||||
ItemFocusBasic focus = wand.getFocus(item);
|
||||
|
||||
if (focus != null && focus instanceof ItemFocusDislocation) {
|
||||
ItemStack pickedBlock = ((ItemFocusDislocation) focus).getPickedBlock(item);
|
||||
if (pickedBlock != null) {
|
||||
Gui.drawRect(xpos - 1, ypos - 1, xpos + 18, ypos + 18, 0x66000000);
|
||||
if (focus != null && focus instanceof ItemFocusDislocation) {
|
||||
ItemStack pickedBlock = ((ItemFocusDislocation) focus).getPickedBlock(item);
|
||||
if (pickedBlock != null) {
|
||||
Gui.drawRect(xpos - 1, ypos - 1, xpos + 18, ypos + 18, 0x66000000);
|
||||
|
||||
FontRenderer font = ClientHelper.fontRenderer();
|
||||
boolean unicode = font.getUnicodeFlag();
|
||||
font.setUnicodeFlag(true);
|
||||
String name = StatCollector.translateToLocal("ttmisc.focusDislocation.tooltip");
|
||||
int strLength = font.getStringWidth(name);
|
||||
FontRenderer font = ClientHelper.fontRenderer();
|
||||
boolean unicode = font.getUnicodeFlag();
|
||||
font.setUnicodeFlag(true);
|
||||
String name = StatCollector.translateToLocal("ttmisc.focusDislocation.tooltip");
|
||||
int strLength = font.getStringWidth(name);
|
||||
|
||||
Gui.drawRect(xpos + 18, ypos, xpos + 18 + strLength + 4, ypos + 9, 0x66000000);
|
||||
font.drawStringWithShadow(name, xpos + 20, ypos, 0xFFAA00);
|
||||
Gui.drawRect(xpos + 18, ypos, xpos + 18 + strLength + 4, ypos + 9, 0x66000000);
|
||||
font.drawStringWithShadow(name, xpos + 20, ypos, 0xFFAA00);
|
||||
|
||||
NBTTagCompound cmp = ((ItemFocusDislocation) focus).getStackTileEntity(item);
|
||||
if (cmp != null && !cmp.hasNoTags()) {
|
||||
String content = StatCollector.translateToLocal("ttmisc.focusDislocation.tooltipExtra");
|
||||
font.getStringWidth(content);
|
||||
NBTTagCompound cmp = ((ItemFocusDislocation) focus).getStackTileEntity(item);
|
||||
if (cmp != null && !cmp.hasNoTags()) {
|
||||
String content = StatCollector.translateToLocal("ttmisc.focusDislocation.tooltipExtra");
|
||||
font.getStringWidth(content);
|
||||
|
||||
Gui.drawRect(xpos + 18, ypos + 9, xpos + 18 + strLength + 4, ypos + 18, 0x66000000);
|
||||
font.drawStringWithShadow(content, xpos + 20, ypos + 9, 0xFFAA00);
|
||||
}
|
||||
Gui.drawRect(xpos + 18, ypos + 9, xpos + 18 + strLength + 4, ypos + 18, 0x66000000);
|
||||
font.drawStringWithShadow(content, xpos + 20, ypos + 9, 0xFFAA00);
|
||||
}
|
||||
|
||||
if (new ItemStack(((ItemBlock) pickedBlock.getItem()).field_150939_a).getItem() != null)
|
||||
renderItem.renderItemIntoGUI(font, ClientHelper.minecraft().renderEngine, new ItemStack(((ItemBlock) pickedBlock.getItem()).field_150939_a), xpos, ypos);
|
||||
else {
|
||||
if (((ItemBlock) pickedBlock.getItem()).field_150939_a == Blocks.reeds)
|
||||
renderItem.renderItemIntoGUI(font, ClientHelper.minecraft().renderEngine, new ItemStack(Items.reeds), xpos, ypos);
|
||||
}
|
||||
font.setUnicodeFlag(unicode);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (new ItemStack(((ItemBlock) pickedBlock.getItem()).field_150939_a).getItem() != null)
|
||||
renderItem.renderItemIntoGUI(font, ClientHelper.minecraft().renderEngine, new ItemStack(((ItemBlock) pickedBlock.getItem()).field_150939_a), xpos, ypos);
|
||||
else {
|
||||
if (((ItemBlock) pickedBlock.getItem()).field_150939_a == Blocks.reeds)
|
||||
renderItem.renderItemIntoGUI(font, ClientHelper.minecraft().renderEngine, new ItemStack(Items.reeds), xpos, ypos);
|
||||
}
|
||||
font.setUnicodeFlag(unicode);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -19,9 +19,9 @@ import thaumic.tinkerer.client.lib.LibResources;
|
||||
|
||||
public final class LocalizationHandler {
|
||||
|
||||
public static void loadLocalizations() {
|
||||
for (String locale : LibResources.LANGS)
|
||||
LanguageRegistry.instance().loadLocalization(LibResources.PREFIX_LANG + locale + ".lang", locale, false);
|
||||
}
|
||||
public static void loadLocalizations() {
|
||||
for (String locale : LibResources.LANGS)
|
||||
LanguageRegistry.instance().loadLocalization(LibResources.PREFIX_LANG + locale + ".lang", locale, false);
|
||||
}
|
||||
|
||||
}
|
||||
+11
-11
@@ -10,16 +10,16 @@ import thaumic.tinkerer.common.network.packet.kami.PacketToggleArmor;
|
||||
*/
|
||||
public class KamiArmorClientHandler {
|
||||
|
||||
public static boolean ArmorEnabled = true;
|
||||
public static boolean ArmorEnabled = true;
|
||||
|
||||
public static void SetStatus(boolean status) {
|
||||
if (FMLClientHandler.instance().getClient().currentScreen == null) {
|
||||
if (status)
|
||||
ToolModeHUDHandler.setTooltip(StatCollector.translateToLocal("ttmisc.enableAllArmor"));
|
||||
else
|
||||
ToolModeHUDHandler.setTooltip(StatCollector.translateToLocal("ttmisc.disableAllArmor"));
|
||||
ArmorEnabled = status;
|
||||
ThaumicTinkerer.netHandler.sendToServer(new PacketToggleArmor(status));
|
||||
}
|
||||
}
|
||||
public static void SetStatus(boolean status) {
|
||||
if (FMLClientHandler.instance().getClient().currentScreen == null) {
|
||||
if (status)
|
||||
ToolModeHUDHandler.setTooltip(StatCollector.translateToLocal("ttmisc.enableAllArmor"));
|
||||
else
|
||||
ToolModeHUDHandler.setTooltip(StatCollector.translateToLocal("ttmisc.disableAllArmor"));
|
||||
ArmorEnabled = status;
|
||||
ThaumicTinkerer.netHandler.sendToServer(new PacketToggleArmor(status));
|
||||
}
|
||||
}
|
||||
}
|
||||
+38
-38
@@ -20,51 +20,51 @@ import java.util.List;
|
||||
|
||||
public final class PlacementMirrorPredictionRenderer {
|
||||
|
||||
RenderBlocks blockRender = new RenderBlocks();
|
||||
RenderBlocks blockRender = new RenderBlocks();
|
||||
|
||||
@SubscribeEvent
|
||||
public void onWorldRenderLast(RenderWorldLastEvent event) {
|
||||
@SubscribeEvent
|
||||
public void onWorldRenderLast(RenderWorldLastEvent event) {
|
||||
|
||||
World world = Minecraft.getMinecraft().theWorld;
|
||||
List<EntityPlayer> playerEntities = world.playerEntities;
|
||||
for (EntityPlayer player : playerEntities) {
|
||||
ItemStack currentStack = player.getCurrentEquippedItem();
|
||||
if (currentStack != null && currentStack.getItem() == ThaumicTinkerer.registry.getFirstItemFromClass(ItemPlacementMirror.class) && ItemPlacementMirror.getBlock(currentStack) != Blocks.air) {
|
||||
renderPlayerLook(player, currentStack);
|
||||
}
|
||||
}
|
||||
}
|
||||
World world = Minecraft.getMinecraft().theWorld;
|
||||
List<EntityPlayer> playerEntities = world.playerEntities;
|
||||
for (EntityPlayer player : playerEntities) {
|
||||
ItemStack currentStack = player.getCurrentEquippedItem();
|
||||
if (currentStack != null && currentStack.getItem() == ThaumicTinkerer.registry.getFirstItemFromClass(ItemPlacementMirror.class) && ItemPlacementMirror.getBlock(currentStack) != Blocks.air) {
|
||||
renderPlayerLook(player, currentStack);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void renderPlayerLook(EntityPlayer player, ItemStack stack) {
|
||||
ChunkCoordinates[] coords = ItemPlacementMirror.getBlocksToPlace(stack, player);
|
||||
if (ItemPlacementMirror.hasBlocks(stack, player, coords)) {
|
||||
ItemStack block = new ItemStack(ItemPlacementMirror.getBlock(stack), 1, ItemPlacementMirror.getBlockMeta(stack));
|
||||
ChunkCoordinates lastCoords = new ChunkCoordinates(0, 0, 0);
|
||||
private void renderPlayerLook(EntityPlayer player, ItemStack stack) {
|
||||
ChunkCoordinates[] coords = ItemPlacementMirror.getBlocksToPlace(stack, player);
|
||||
if (ItemPlacementMirror.hasBlocks(stack, player, coords)) {
|
||||
ItemStack block = new ItemStack(ItemPlacementMirror.getBlock(stack), 1, ItemPlacementMirror.getBlockMeta(stack));
|
||||
ChunkCoordinates lastCoords = new ChunkCoordinates(0, 0, 0);
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
GL11.glPushMatrix();
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
for (ChunkCoordinates coord : coords) {
|
||||
renderBlockAt(block, coord, lastCoords);
|
||||
lastCoords = coord;
|
||||
}
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
for (ChunkCoordinates coord : coords) {
|
||||
renderBlockAt(block, coord, lastCoords);
|
||||
lastCoords = coord;
|
||||
}
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
|
||||
private void renderBlockAt(ItemStack block, ChunkCoordinates pos, ChunkCoordinates last) {
|
||||
if (block.getItem() == null)
|
||||
return;
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(pos.posX + 0.5 - RenderManager.renderPosX, pos.posY + 0.5 - RenderManager.renderPosY, pos.posZ + 0.5 - RenderManager.renderPosZ);
|
||||
private void renderBlockAt(ItemStack block, ChunkCoordinates pos, ChunkCoordinates last) {
|
||||
if (block.getItem() == null)
|
||||
return;
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(pos.posX + 0.5 - RenderManager.renderPosX, pos.posY + 0.5 - RenderManager.renderPosY, pos.posZ + 0.5 - RenderManager.renderPosZ);
|
||||
|
||||
GL11.glColor4f(1F, 1F, 1F, 0.6F);
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture);
|
||||
blockRender.useInventoryTint = false;
|
||||
blockRender.renderBlockAsItem(Block.getBlockFromItem(block.getItem()), block.getItemDamage(), 1F);
|
||||
GL11.glColor4f(1F, 1F, 1F, 0.6F);
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture);
|
||||
blockRender.useInventoryTint = false;
|
||||
blockRender.renderBlockAsItem(Block.getBlockFromItem(block.getItem()), block.getItemDamage(), 1F);
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
}
|
||||
+44
-44
@@ -27,59 +27,59 @@ import thaumic.tinkerer.client.lib.LibResources;
|
||||
|
||||
public final class SoulHeartClientHandler {
|
||||
|
||||
private static final ResourceLocation iconsResource = new ResourceLocation("textures/gui/icons.png");
|
||||
private static final ResourceLocation heartsResource = new ResourceLocation(LibResources.GUI_SOUL_HEARTS);
|
||||
private static final ResourceLocation iconsResource = new ResourceLocation("textures/gui/icons.png");
|
||||
private static final ResourceLocation heartsResource = new ResourceLocation(LibResources.GUI_SOUL_HEARTS);
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public static int clientPlayerHP = 0;
|
||||
@SideOnly(Side.CLIENT)
|
||||
public static int clientPlayerHP = 0;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@SubscribeEvent
|
||||
public void renderHealthBar(RenderGameOverlayEvent event) {
|
||||
if (event.type == ElementType.FOOD && clientPlayerHP > 0) {
|
||||
if (event instanceof RenderGameOverlayEvent.Post) {
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static void renderHeart(int x, int y, boolean full) {
|
||||
Tessellator tess = Tessellator.instance;
|
||||
float size = 1 / 16F;
|
||||
|
||||
int x = event.resolution.getScaledWidth() / 2 + 10;
|
||||
int y = event.resolution.getScaledHeight() - 39;
|
||||
float startX = full ? 0 : 9 * size;
|
||||
float endX = full ? 9 * size : 1;
|
||||
float startY = 0;
|
||||
float endY = 9 * size;
|
||||
|
||||
GL11.glTranslatef(0F, 10F, 0F);
|
||||
mc.renderEngine.bindTexture(heartsResource);
|
||||
int it = 0;
|
||||
for (int i = 0; i < clientPlayerHP; i++) {
|
||||
boolean half = i == clientPlayerHP - 1 && clientPlayerHP % 2 != 0;
|
||||
if (half || i % 2 == 0) {
|
||||
renderHeart(x + it * 8, y, !half);
|
||||
it++;
|
||||
}
|
||||
}
|
||||
tess.startDrawingQuads();
|
||||
tess.addVertexWithUV(x, y + 9, 0, startX, endY);
|
||||
tess.addVertexWithUV(x + (full ? 9 : 7), y + 9, 0, endX, endY);
|
||||
tess.addVertexWithUV(x + (full ? 9 : 7), y, 0, endX, startY);
|
||||
tess.addVertexWithUV(x, y, 0, startX, startY);
|
||||
tess.draw();
|
||||
}
|
||||
|
||||
mc.renderEngine.bindTexture(iconsResource);
|
||||
}
|
||||
@SideOnly(Side.CLIENT)
|
||||
@SubscribeEvent
|
||||
public void renderHealthBar(RenderGameOverlayEvent event) {
|
||||
if (event.type == ElementType.FOOD && clientPlayerHP > 0) {
|
||||
if (event instanceof RenderGameOverlayEvent.Post) {
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
|
||||
GL11.glTranslatef(0F, -10F, 0F);
|
||||
}
|
||||
int x = event.resolution.getScaledWidth() / 2 + 10;
|
||||
int y = event.resolution.getScaledHeight() - 39;
|
||||
|
||||
if (event.type == ElementType.AIR && event instanceof RenderGameOverlayEvent.Post && clientPlayerHP > 0)
|
||||
GL11.glTranslatef(0F, 10F, 0F);
|
||||
}
|
||||
GL11.glTranslatef(0F, 10F, 0F);
|
||||
mc.renderEngine.bindTexture(heartsResource);
|
||||
int it = 0;
|
||||
for (int i = 0; i < clientPlayerHP; i++) {
|
||||
boolean half = i == clientPlayerHP - 1 && clientPlayerHP % 2 != 0;
|
||||
if (half || i % 2 == 0) {
|
||||
renderHeart(x + it * 8, y, !half);
|
||||
it++;
|
||||
}
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static void renderHeart(int x, int y, boolean full) {
|
||||
Tessellator tess = Tessellator.instance;
|
||||
float size = 1 / 16F;
|
||||
mc.renderEngine.bindTexture(iconsResource);
|
||||
}
|
||||
|
||||
float startX = full ? 0 : 9 * size;
|
||||
float endX = full ? 9 * size : 1;
|
||||
float startY = 0;
|
||||
float endY = 9 * size;
|
||||
GL11.glTranslatef(0F, -10F, 0F);
|
||||
}
|
||||
|
||||
tess.startDrawingQuads();
|
||||
tess.addVertexWithUV(x, y + 9, 0, startX, endY);
|
||||
tess.addVertexWithUV(x + (full ? 9 : 7), y + 9, 0, endX, endY);
|
||||
tess.addVertexWithUV(x + (full ? 9 : 7), y, 0, endX, startY);
|
||||
tess.addVertexWithUV(x, y, 0, startX, startY);
|
||||
tess.draw();
|
||||
}
|
||||
if (event.type == ElementType.AIR && event instanceof RenderGameOverlayEvent.Post && clientPlayerHP > 0)
|
||||
GL11.glTranslatef(0F, 10F, 0F);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -30,50 +30,50 @@ import java.awt.*;
|
||||
|
||||
public final class ToolModeHUDHandler {
|
||||
|
||||
private static String currentTooltip;
|
||||
private static int tooltipDisplayTicks;
|
||||
private static String currentTooltip;
|
||||
private static int tooltipDisplayTicks;
|
||||
|
||||
@SubscribeEvent
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void drawDislocationFocusHUD(RenderGameOverlayEvent.Post event) {
|
||||
if (event.type == ElementType.ALL && tooltipDisplayTicks > 0 && !MathHelper.stringNullOrLengthZero(currentTooltip)) {
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
ScaledResolution var5 = new ScaledResolution(mc, mc.displayWidth, mc.displayHeight);
|
||||
int var6 = var5.getScaledWidth();
|
||||
int var7 = var5.getScaledHeight();
|
||||
FontRenderer var8 = mc.fontRenderer;
|
||||
public static void setTooltip(String tooltip) {
|
||||
if (!tooltip.equals(currentTooltip)) {
|
||||
currentTooltip = tooltip;
|
||||
tooltipDisplayTicks = 400;
|
||||
}
|
||||
}
|
||||
|
||||
int tooltipStartX = (var6 - var8.getStringWidth(currentTooltip)) / 2;
|
||||
int tooltipStartY = var7 - 72;
|
||||
@SideOnly(Side.CLIENT)
|
||||
public static void clientTick() {
|
||||
if (tooltipDisplayTicks > 0)
|
||||
--tooltipDisplayTicks;
|
||||
}
|
||||
|
||||
int opacity = (int) (tooltipDisplayTicks * 256.0F / 10.0F);
|
||||
@SubscribeEvent
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void drawDislocationFocusHUD(RenderGameOverlayEvent.Post event) {
|
||||
if (event.type == ElementType.ALL && tooltipDisplayTicks > 0 && !MathHelper.stringNullOrLengthZero(currentTooltip)) {
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
ScaledResolution var5 = new ScaledResolution(mc, mc.displayWidth, mc.displayHeight);
|
||||
int var6 = var5.getScaledWidth();
|
||||
int var7 = var5.getScaledHeight();
|
||||
FontRenderer var8 = mc.fontRenderer;
|
||||
|
||||
if (opacity > 160)
|
||||
opacity = 160;
|
||||
int tooltipStartX = (var6 - var8.getStringWidth(currentTooltip)) / 2;
|
||||
int tooltipStartY = var7 - 72;
|
||||
|
||||
if (opacity > 0) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
int color = Color.getHSBColor((float) Math.cos(ClientTickHandler.elapsedTicks / 250D), 0.6F, 1F).getRGB();
|
||||
var8.drawStringWithShadow(currentTooltip, tooltipStartX, tooltipStartY, color + (opacity << 24));
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
}
|
||||
int opacity = (int) (tooltipDisplayTicks * 256.0F / 10.0F);
|
||||
|
||||
public static void setTooltip(String tooltip) {
|
||||
if (!tooltip.equals(currentTooltip)) {
|
||||
currentTooltip = tooltip;
|
||||
tooltipDisplayTicks = 400;
|
||||
}
|
||||
}
|
||||
if (opacity > 160)
|
||||
opacity = 160;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public static void clientTick() {
|
||||
if (tooltipDisplayTicks > 0)
|
||||
--tooltipDisplayTicks;
|
||||
}
|
||||
if (opacity > 0) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
int color = Color.getHSBColor((float) Math.cos(ClientTickHandler.elapsedTicks / 250D), 0.6F, 1F).getRGB();
|
||||
var8.drawStringWithShadow(currentTooltip, tooltipStartX, tooltipStartY, color + (opacity << 24));
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -25,90 +25,90 @@ import java.util.List;
|
||||
|
||||
public final class ClientHelper {
|
||||
|
||||
public static Minecraft minecraft() {
|
||||
return Minecraft.getMinecraft();
|
||||
}
|
||||
public static Minecraft minecraft() {
|
||||
return Minecraft.getMinecraft();
|
||||
}
|
||||
|
||||
public static FontRenderer fontRenderer() {
|
||||
return minecraft().fontRenderer;
|
||||
}
|
||||
public static FontRenderer fontRenderer() {
|
||||
return minecraft().fontRenderer;
|
||||
}
|
||||
|
||||
public static EntityClientPlayerMP clientPlayer() {
|
||||
return minecraft().thePlayer;
|
||||
}
|
||||
public static EntityClientPlayerMP clientPlayer() {
|
||||
return minecraft().thePlayer;
|
||||
}
|
||||
|
||||
public static void renderTooltip(int x, int y, List<String> tooltipData) {
|
||||
int color = 0x505000ff;
|
||||
int color2 = 0xf0100010;
|
||||
public static void renderTooltip(int x, int y, List<String> tooltipData) {
|
||||
int color = 0x505000ff;
|
||||
int color2 = 0xf0100010;
|
||||
|
||||
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
|
||||
net.minecraft.client.renderer.RenderHelper.disableStandardItemLighting();
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_DEPTH_TEST);
|
||||
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
|
||||
net.minecraft.client.renderer.RenderHelper.disableStandardItemLighting();
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_DEPTH_TEST);
|
||||
|
||||
if (!tooltipData.isEmpty()) {
|
||||
int var5 = 0;
|
||||
int var6;
|
||||
int var7;
|
||||
FontRenderer fontRenderer = Minecraft.getMinecraft().fontRenderer;
|
||||
for (var6 = 0; var6 < tooltipData.size(); ++var6) {
|
||||
var7 = fontRenderer.getStringWidth(tooltipData.get(var6));
|
||||
if (var7 > var5)
|
||||
var5 = var7;
|
||||
}
|
||||
var6 = x + 12;
|
||||
var7 = y - 12;
|
||||
int var9 = 8;
|
||||
if (tooltipData.size() > 1)
|
||||
var9 += 2 + (tooltipData.size() - 1) * 10;
|
||||
float z = 300.0F;
|
||||
drawGradientRect(var6 - 3, var7 - 4, z, var6 + var5 + 3, var7 - 3, color2, color2);
|
||||
drawGradientRect(var6 - 3, var7 + var9 + 3, z, var6 + var5 + 3, var7 + var9 + 4, color2, color2);
|
||||
drawGradientRect(var6 - 3, var7 - 3, z, var6 + var5 + 3, var7 + var9 + 3, color2, color2);
|
||||
drawGradientRect(var6 - 4, var7 - 3, z, var6 - 3, var7 + var9 + 3, color2, color2);
|
||||
drawGradientRect(var6 + var5 + 3, var7 - 3, z, var6 + var5 + 4, var7 + var9 + 3, color2, color2);
|
||||
int var12 = (color & 0xFFFFFF) >> 1 | color & -16777216;
|
||||
drawGradientRect(var6 - 3, var7 - 3 + 1, z, var6 - 3 + 1, var7 + var9 + 3 - 1, color, var12);
|
||||
drawGradientRect(var6 + var5 + 2, var7 - 3 + 1, z, var6 + var5 + 3, var7 + var9 + 3 - 1, color, var12);
|
||||
drawGradientRect(var6 - 3, var7 - 3, z, var6 + var5 + 3, var7 - 3 + 1, color, color);
|
||||
drawGradientRect(var6 - 3, var7 + var9 + 2, z, var6 + var5 + 3, var7 + var9 + 3, var12, var12);
|
||||
for (int var13 = 0; var13 < tooltipData.size(); ++var13) {
|
||||
String var14 = tooltipData.get(var13);
|
||||
fontRenderer.drawStringWithShadow(var14, var6, var7, -1);
|
||||
if (var13 == 0)
|
||||
var7 += 2;
|
||||
var7 += 10;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!tooltipData.isEmpty()) {
|
||||
int var5 = 0;
|
||||
int var6;
|
||||
int var7;
|
||||
FontRenderer fontRenderer = Minecraft.getMinecraft().fontRenderer;
|
||||
for (var6 = 0; var6 < tooltipData.size(); ++var6) {
|
||||
var7 = fontRenderer.getStringWidth(tooltipData.get(var6));
|
||||
if (var7 > var5)
|
||||
var5 = var7;
|
||||
}
|
||||
var6 = x + 12;
|
||||
var7 = y - 12;
|
||||
int var9 = 8;
|
||||
if (tooltipData.size() > 1)
|
||||
var9 += 2 + (tooltipData.size() - 1) * 10;
|
||||
float z = 300.0F;
|
||||
drawGradientRect(var6 - 3, var7 - 4, z, var6 + var5 + 3, var7 - 3, color2, color2);
|
||||
drawGradientRect(var6 - 3, var7 + var9 + 3, z, var6 + var5 + 3, var7 + var9 + 4, color2, color2);
|
||||
drawGradientRect(var6 - 3, var7 - 3, z, var6 + var5 + 3, var7 + var9 + 3, color2, color2);
|
||||
drawGradientRect(var6 - 4, var7 - 3, z, var6 - 3, var7 + var9 + 3, color2, color2);
|
||||
drawGradientRect(var6 + var5 + 3, var7 - 3, z, var6 + var5 + 4, var7 + var9 + 3, color2, color2);
|
||||
int var12 = (color & 0xFFFFFF) >> 1 | color & -16777216;
|
||||
drawGradientRect(var6 - 3, var7 - 3 + 1, z, var6 - 3 + 1, var7 + var9 + 3 - 1, color, var12);
|
||||
drawGradientRect(var6 + var5 + 2, var7 - 3 + 1, z, var6 + var5 + 3, var7 + var9 + 3 - 1, color, var12);
|
||||
drawGradientRect(var6 - 3, var7 - 3, z, var6 + var5 + 3, var7 - 3 + 1, color, color);
|
||||
drawGradientRect(var6 - 3, var7 + var9 + 2, z, var6 + var5 + 3, var7 + var9 + 3, var12, var12);
|
||||
for (int var13 = 0; var13 < tooltipData.size(); ++var13) {
|
||||
String var14 = tooltipData.get(var13);
|
||||
fontRenderer.drawStringWithShadow(var14, var6, var7, -1);
|
||||
if (var13 == 0)
|
||||
var7 += 2;
|
||||
var7 += 10;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void drawGradientRect(int par1, int par2, float z, int par3, int par4, int par5, int par6) {
|
||||
float var7 = (par5 >> 24 & 255) / 255.0F;
|
||||
float var8 = (par5 >> 16 & 255) / 255.0F;
|
||||
float var9 = (par5 >> 8 & 255) / 255.0F;
|
||||
float var10 = (par5 & 255) / 255.0F;
|
||||
float var11 = (par6 >> 24 & 255) / 255.0F;
|
||||
float var12 = (par6 >> 16 & 255) / 255.0F;
|
||||
float var13 = (par6 >> 8 & 255) / 255.0F;
|
||||
float var14 = (par6 & 255) / 255.0F;
|
||||
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glDisable(GL11.GL_ALPHA_TEST);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
GL11.glShadeModel(GL11.GL_SMOOTH);
|
||||
Tessellator var15 = Tessellator.instance;
|
||||
var15.startDrawingQuads();
|
||||
var15.setColorRGBA_F(var8, var9, var10, var7);
|
||||
var15.addVertex(par3, par2, z);
|
||||
var15.addVertex(par1, par2, z);
|
||||
var15.setColorRGBA_F(var12, var13, var14, var11);
|
||||
var15.addVertex(par1, par4, z);
|
||||
var15.addVertex(par3, par4, z);
|
||||
var15.draw();
|
||||
GL11.glShadeModel(GL11.GL_FLAT);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
GL11.glEnable(GL11.GL_ALPHA_TEST);
|
||||
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||
}
|
||||
public static void drawGradientRect(int par1, int par2, float z, int par3, int par4, int par5, int par6) {
|
||||
float var7 = (par5 >> 24 & 255) / 255.0F;
|
||||
float var8 = (par5 >> 16 & 255) / 255.0F;
|
||||
float var9 = (par5 >> 8 & 255) / 255.0F;
|
||||
float var10 = (par5 & 255) / 255.0F;
|
||||
float var11 = (par6 >> 24 & 255) / 255.0F;
|
||||
float var12 = (par6 >> 16 & 255) / 255.0F;
|
||||
float var13 = (par6 >> 8 & 255) / 255.0F;
|
||||
float var14 = (par6 & 255) / 255.0F;
|
||||
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glDisable(GL11.GL_ALPHA_TEST);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
GL11.glShadeModel(GL11.GL_SMOOTH);
|
||||
Tessellator var15 = Tessellator.instance;
|
||||
var15.startDrawingQuads();
|
||||
var15.setColorRGBA_F(var8, var9, var10, var7);
|
||||
var15.addVertex(par3, par2, z);
|
||||
var15.addVertex(par1, par2, z);
|
||||
var15.setColorRGBA_F(var12, var13, var14, var11);
|
||||
var15.addVertex(par1, par4, z);
|
||||
var15.addVertex(par3, par4, z);
|
||||
var15.draw();
|
||||
GL11.glShadeModel(GL11.GL_FLAT);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
GL11.glEnable(GL11.GL_ALPHA_TEST);
|
||||
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -22,38 +22,38 @@ import thaumic.tinkerer.client.lib.LibResources;
|
||||
|
||||
public class IconHelper {
|
||||
|
||||
private static IIcon emptyTexture;
|
||||
private static IIcon emptyTexture;
|
||||
|
||||
public static IIcon forName(IIconRegister ir, String name) {
|
||||
return ir.registerIcon(LibResources.PREFIX_MOD + name);
|
||||
}
|
||||
public static IIcon forName(IIconRegister ir, String name) {
|
||||
return ir.registerIcon(LibResources.PREFIX_MOD + name);
|
||||
}
|
||||
|
||||
public static IIcon emptyTexture(IIconRegister ir) {
|
||||
return emptyTexture == null ? (emptyTexture = forName(ir, LibResources.EMTPY_TEXTURE)) : emptyTexture;
|
||||
}
|
||||
public static IIcon emptyTexture(IIconRegister ir) {
|
||||
return emptyTexture == null ? (emptyTexture = forName(ir, LibResources.EMTPY_TEXTURE)) : emptyTexture;
|
||||
}
|
||||
|
||||
public static IIcon forBlock(IIconRegister ir, Block block) {
|
||||
return forName(ir, block.getUnlocalizedName().replaceAll("tile.", ""));
|
||||
}
|
||||
public static IIcon forBlock(IIconRegister ir, Block block) {
|
||||
return forName(ir, block.getUnlocalizedName().replaceAll("tile.", ""));
|
||||
}
|
||||
|
||||
public static IIcon forBlock(IIconRegister ir, Block block, int i) {
|
||||
return forBlock(ir, block, Integer.toString(i));
|
||||
}
|
||||
public static IIcon forBlock(IIconRegister ir, Block block, int i) {
|
||||
return forBlock(ir, block, Integer.toString(i));
|
||||
}
|
||||
|
||||
public static IIcon forBlock(IIconRegister ir, Block block, String s) {
|
||||
return forName(ir, block.getUnlocalizedName().replaceAll("tile.", "") + s);
|
||||
}
|
||||
public static IIcon forBlock(IIconRegister ir, Block block, String s) {
|
||||
return forName(ir, block.getUnlocalizedName().replaceAll("tile.", "") + s);
|
||||
}
|
||||
|
||||
public static IIcon forItem(IIconRegister ir, Item item) {
|
||||
return forName(ir, item.getUnlocalizedName().replaceAll("item.", ""));
|
||||
}
|
||||
public static IIcon forItem(IIconRegister ir, Item item) {
|
||||
return forName(ir, item.getUnlocalizedName().replaceAll("item.", ""));
|
||||
}
|
||||
|
||||
public static IIcon forItem(IIconRegister ir, Item item, int i) {
|
||||
return forItem(ir, item, Integer.toString(i));
|
||||
}
|
||||
public static IIcon forItem(IIconRegister ir, Item item, int i) {
|
||||
return forItem(ir, item, Integer.toString(i));
|
||||
}
|
||||
|
||||
public static IIcon forItem(IIconRegister ir, Item item, String s) {
|
||||
return forName(ir, item.getUnlocalizedName().replaceAll("item.", "") + s);
|
||||
}
|
||||
public static IIcon forItem(IIconRegister ir, Item item, String s) {
|
||||
return forName(ir, item.getUnlocalizedName().replaceAll("item.", "") + s);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -48,7 +48,10 @@ import thaumic.tinkerer.client.render.item.kami.RenderPlacementMirror;
|
||||
import thaumic.tinkerer.client.render.tile.*;
|
||||
import thaumic.tinkerer.client.render.tile.kami.RenderTileWarpGate;
|
||||
import thaumic.tinkerer.common.ThaumicTinkerer;
|
||||
import thaumic.tinkerer.common.block.tile.*;
|
||||
import thaumic.tinkerer.common.block.tile.TileEnchanter;
|
||||
import thaumic.tinkerer.common.block.tile.TileFunnel;
|
||||
import thaumic.tinkerer.common.block.tile.TileMagnet;
|
||||
import thaumic.tinkerer.common.block.tile.TileRepairer;
|
||||
import thaumic.tinkerer.common.block.tile.kami.TileWarpGate;
|
||||
import thaumic.tinkerer.common.block.tile.tablet.TileAnimationTablet;
|
||||
import thaumic.tinkerer.common.core.handler.ConfigHandler;
|
||||
@@ -60,6 +63,10 @@ import thaumic.tinkerer.common.item.kami.foci.ItemFocusShadowbeam;
|
||||
|
||||
public class TTClientProxy extends TTCommonProxy {
|
||||
|
||||
public static EntityPlayer getPlayer() {
|
||||
return Minecraft.getMinecraft().thePlayer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preInit(FMLPreInitializationEvent event) {
|
||||
super.preInit(event);
|
||||
@@ -70,10 +77,6 @@ public class TTClientProxy extends TTCommonProxy {
|
||||
kamiRarity = EnumHelperClient.addEnum(new Class[][]{{EnumRarity.class, EnumChatFormatting.class, String.class}}, EnumRarity.class, "KAMI", EnumChatFormatting.LIGHT_PURPLE, "Kami");
|
||||
}
|
||||
|
||||
public static EntityPlayer getPlayer() {
|
||||
return Minecraft.getMinecraft().thePlayer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(FMLInitializationEvent event) {
|
||||
super.init(event);
|
||||
@@ -96,7 +99,6 @@ public class TTClientProxy extends TTCommonProxy {
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void registerTiles() {
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileAnimationTablet.class, new RenderTileAnimationTablet());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileMagnet.class, new RenderTileMagnet());
|
||||
|
||||
@@ -34,61 +34,61 @@ import java.util.List;
|
||||
|
||||
public class GuiAnimationTablet extends GuiContainer {
|
||||
|
||||
private static final ResourceLocation gui = new ResourceLocation(LibResources.GUI_ANIMATION_TABLET);
|
||||
private static final ResourceLocation gui = new ResourceLocation(LibResources.GUI_ANIMATION_TABLET);
|
||||
|
||||
int x, y;
|
||||
int x, y;
|
||||
|
||||
TileAnimationTablet tablet;
|
||||
List<GuiButtonAT> buttonListAT = new ArrayList();
|
||||
List<IRadioButton> radioButtons = new ArrayList();
|
||||
TileAnimationTablet tablet;
|
||||
List<GuiButtonAT> buttonListAT = new ArrayList();
|
||||
List<IRadioButton> radioButtons = new ArrayList();
|
||||
|
||||
public GuiAnimationTablet(TileAnimationTablet tablet, InventoryPlayer playerInv) {
|
||||
super(new ContainerAnimationTablet(tablet, playerInv));
|
||||
this.tablet = tablet;
|
||||
}
|
||||
public GuiAnimationTablet(TileAnimationTablet tablet, InventoryPlayer playerInv) {
|
||||
super(new ContainerAnimationTablet(tablet, playerInv));
|
||||
this.tablet = tablet;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
x = (width - xSize) / 2;
|
||||
y = (height - ySize) / 2;
|
||||
buttonListAT.clear();
|
||||
addButton(new GuiButtonAT(0, x + xSize / 2 - 7, y + 60, tablet.redstone));
|
||||
addButton(new GuiButtonATRadio(1, x + 52, y + 15, tablet.leftClick, radioButtons));
|
||||
addButton(new GuiButtonATRadio(2, x + 111, y + 15, !tablet.leftClick, radioButtons));
|
||||
buttonList = buttonListAT;
|
||||
}
|
||||
@Override
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
x = (width - xSize) / 2;
|
||||
y = (height - ySize) / 2;
|
||||
buttonListAT.clear();
|
||||
addButton(new GuiButtonAT(0, x + xSize / 2 - 7, y + 60, tablet.redstone));
|
||||
addButton(new GuiButtonATRadio(1, x + 52, y + 15, tablet.leftClick, radioButtons));
|
||||
addButton(new GuiButtonATRadio(2, x + 111, y + 15, !tablet.leftClick, radioButtons));
|
||||
buttonList = buttonListAT;
|
||||
}
|
||||
|
||||
private void addButton(GuiButtonAT button) {
|
||||
buttonListAT.add(button);
|
||||
if (button instanceof IRadioButton)
|
||||
radioButtons.add((IRadioButton) button);
|
||||
}
|
||||
private void addButton(GuiButtonAT button) {
|
||||
buttonListAT.add(button);
|
||||
if (button instanceof IRadioButton)
|
||||
radioButtons.add((IRadioButton) button);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton par1GuiButton) {
|
||||
if (par1GuiButton instanceof IRadioButton)
|
||||
((IRadioButton) par1GuiButton).enableFromClick();
|
||||
else buttonListAT.get(0).buttonEnabled = !buttonListAT.get(0).buttonEnabled;
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton par1GuiButton) {
|
||||
if (par1GuiButton instanceof IRadioButton)
|
||||
((IRadioButton) par1GuiButton).enableFromClick();
|
||||
else buttonListAT.get(0).buttonEnabled = !buttonListAT.get(0).buttonEnabled;
|
||||
|
||||
tablet.leftClick = buttonListAT.get(1).buttonEnabled;
|
||||
tablet.redstone = buttonListAT.get(0).buttonEnabled;
|
||||
tablet.leftClick = buttonListAT.get(1).buttonEnabled;
|
||||
tablet.redstone = buttonListAT.get(0).buttonEnabled;
|
||||
|
||||
ThaumicTinkerer.netHandler.sendToServer(new PacketTabletButton(tablet));
|
||||
}
|
||||
ThaumicTinkerer.netHandler.sendToServer(new PacketTabletButton(tablet));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float f, int i, int j) {
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
mc.renderEngine.bindTexture(gui);
|
||||
drawTexturedModalRect(x, y, 0, 0, xSize, ySize);
|
||||
String left = StatCollector.translateToLocal("ttmisc.leftClick");
|
||||
String right = StatCollector.translateToLocal("ttmisc.rightClick");
|
||||
String redstone = StatCollector.translateToLocal("ttmisc.redstoneControl");
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float f, int i, int j) {
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
mc.renderEngine.bindTexture(gui);
|
||||
drawTexturedModalRect(x, y, 0, 0, xSize, ySize);
|
||||
String left = StatCollector.translateToLocal("ttmisc.leftClick");
|
||||
String right = StatCollector.translateToLocal("ttmisc.rightClick");
|
||||
String redstone = StatCollector.translateToLocal("ttmisc.redstoneControl");
|
||||
|
||||
fontRendererObj.drawString(left, x + 48 - fontRendererObj.getStringWidth(left), y + 18, 0x999999);
|
||||
fontRendererObj.drawString(right, x + 128, y + 18, 0x999999);
|
||||
fontRendererObj.drawString(redstone, x + xSize / 2 - fontRendererObj.getStringWidth(redstone) / 2, y + 50, 0x999999);
|
||||
GL11.glColor3f(1F, 1F, 1F);
|
||||
}
|
||||
fontRendererObj.drawString(left, x + 48 - fontRendererObj.getStringWidth(left), y + 18, 0x999999);
|
||||
fontRendererObj.drawString(right, x + 128, y + 18, 0x999999);
|
||||
fontRendererObj.drawString(redstone, x + xSize / 2 - fontRendererObj.getStringWidth(redstone) / 2, y + 50, 0x999999);
|
||||
GL11.glColor3f(1F, 1F, 1F);
|
||||
}
|
||||
}
|
||||
@@ -36,63 +36,63 @@ import java.util.List;
|
||||
|
||||
public class GuiAspectAnalyzer extends GuiContainer {
|
||||
|
||||
private static final ResourceLocation gui = new ResourceLocation(LibResources.GUI_ASPECT_ANALYZER);
|
||||
private static final ResourceLocation gui = new ResourceLocation(LibResources.GUI_ASPECT_ANALYZER);
|
||||
|
||||
int x, y;
|
||||
TileAspectAnalyzer analyzer;
|
||||
Aspect aspectHovered = null;
|
||||
int x, y;
|
||||
TileAspectAnalyzer analyzer;
|
||||
Aspect aspectHovered = null;
|
||||
|
||||
public GuiAspectAnalyzer(TileAspectAnalyzer analyzer, InventoryPlayer inv) {
|
||||
super(new ContainerAspectAnalyzer(analyzer, inv));
|
||||
this.analyzer = analyzer;
|
||||
}
|
||||
public GuiAspectAnalyzer(TileAspectAnalyzer analyzer, InventoryPlayer inv) {
|
||||
super(new ContainerAspectAnalyzer(analyzer, inv));
|
||||
this.analyzer = analyzer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
x = (width - xSize) / 2;
|
||||
y = (height - ySize) / 2;
|
||||
}
|
||||
@Override
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
x = (width - xSize) / 2;
|
||||
y = (height - ySize) / 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float f, int mx, int my) {
|
||||
aspectHovered = null;
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float f, int mx, int my) {
|
||||
aspectHovered = null;
|
||||
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
mc.renderEngine.bindTexture(gui);
|
||||
drawTexturedModalRect(x, y, 0, 0, xSize, ySize);
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
mc.renderEngine.bindTexture(gui);
|
||||
drawTexturedModalRect(x, y, 0, 0, xSize, ySize);
|
||||
|
||||
ItemStack stack = analyzer.getStackInSlot(0);
|
||||
if (stack != null) {
|
||||
int h = ScanManager.generateItemHash(stack.getItem(), stack.getItemDamage());
|
||||
ItemStack stack = analyzer.getStackInSlot(0);
|
||||
if (stack != null) {
|
||||
int h = ScanManager.generateItemHash(stack.getItem(), stack.getItemDamage());
|
||||
|
||||
List<String> list = Thaumcraft.proxy.getScannedObjects().get(ClientHelper.clientPlayer().getGameProfile().getName());
|
||||
if (list != null && (list.contains("@" + h) || list.contains("#" + h))) {
|
||||
AspectList tags = ThaumcraftCraftingManager.getObjectTags(stack);
|
||||
tags = ThaumcraftCraftingManager.getBonusTags(stack, tags);
|
||||
if (tags != null) {
|
||||
int i = 0;
|
||||
for (Aspect aspect : tags.getAspectsSortedAmount()) {
|
||||
int x = this.x + 20 + i * 18;
|
||||
int y = this.y + 58;
|
||||
UtilsFX.drawTag(x, y, aspect, tags.getAmount(aspect), 0, zLevel);
|
||||
List<String> list = Thaumcraft.proxy.getScannedObjects().get(ClientHelper.clientPlayer().getGameProfile().getName());
|
||||
if (list != null && (list.contains("@" + h) || list.contains("#" + h))) {
|
||||
AspectList tags = ThaumcraftCraftingManager.getObjectTags(stack);
|
||||
tags = ThaumcraftCraftingManager.getBonusTags(stack, tags);
|
||||
if (tags != null) {
|
||||
int i = 0;
|
||||
for (Aspect aspect : tags.getAspectsSortedAmount()) {
|
||||
int x = this.x + 20 + i * 18;
|
||||
int y = this.y + 58;
|
||||
UtilsFX.drawTag(x, y, aspect, tags.getAmount(aspect), 0, zLevel);
|
||||
|
||||
if (mx > x && mx < x + 16 && my > y && my < y + 16)
|
||||
aspectHovered = aspect;
|
||||
if (mx > x && mx < x + 16 && my > y && my < y + 16)
|
||||
aspectHovered = aspect;
|
||||
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int mx, int my) {
|
||||
if (aspectHovered != null)
|
||||
ClientHelper.renderTooltip(mx - x, my - y, Arrays.asList(EnumChatFormatting.AQUA + aspectHovered.getName(), EnumChatFormatting.GRAY + aspectHovered.getLocalizedDescription()));
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int mx, int my) {
|
||||
if (aspectHovered != null)
|
||||
ClientHelper.renderTooltip(mx - x, my - y, Arrays.asList(EnumChatFormatting.AQUA + aspectHovered.getName(), EnumChatFormatting.GRAY + aspectHovered.getLocalizedDescription()));
|
||||
|
||||
super.drawGuiContainerForegroundLayer(mx, my);
|
||||
}
|
||||
super.drawGuiContainerForegroundLayer(mx, my);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -42,203 +42,198 @@ import java.util.List;
|
||||
|
||||
public class GuiEnchanting extends GuiContainer {
|
||||
|
||||
private static final ResourceLocation gui = new ResourceLocation(LibResources.GUI_ENCHANTER);
|
||||
private static final ResourceLocation gui = new ResourceLocation(LibResources.GUI_ENCHANTER);
|
||||
public TileEnchanter enchanter;
|
||||
public List<String> tooltip = new ArrayList();
|
||||
int x, y;
|
||||
GuiButtonEnchantment[] enchantButtons = new GuiButtonEnchantment[16];
|
||||
List<Integer> lastTickEnchants;
|
||||
List<Integer> lastTickLevels;
|
||||
ItemStack lastTickStack;
|
||||
ItemStack currentStack;
|
||||
|
||||
int x, y;
|
||||
public GuiEnchanting(TileEnchanter enchanter, InventoryPlayer inv) {
|
||||
super(new ContainerEnchanter(enchanter, inv));
|
||||
this.enchanter = enchanter;
|
||||
lastTickStack = enchanter.getStackInSlot(0);
|
||||
currentStack = enchanter.getStackInSlot(0);
|
||||
lastTickEnchants = new ArrayList(enchanter.enchantments);
|
||||
lastTickLevels = new ArrayList(enchanter.levels);
|
||||
}
|
||||
|
||||
public TileEnchanter enchanter;
|
||||
@Override
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
|
||||
GuiButtonEnchantment[] enchantButtons = new GuiButtonEnchantment[16];
|
||||
x = (width - xSize) / 2;
|
||||
y = (height - ySize) / 2;
|
||||
|
||||
public List<String> tooltip = new ArrayList();
|
||||
buildButtonList();
|
||||
}
|
||||
|
||||
List<Integer> lastTickEnchants;
|
||||
List<Integer> lastTickLevels;
|
||||
ItemStack lastTickStack;
|
||||
ItemStack currentStack;
|
||||
public void buildButtonList() {
|
||||
buttonList.clear();
|
||||
GuiButton enchantButton = new GuiButtonEnchant(this, enchanter, 0, x + 151, y + 33);
|
||||
buttonList.add(enchantButton);
|
||||
enchantButton.enabled = !enchanter.enchantments.isEmpty();
|
||||
|
||||
public GuiEnchanting(TileEnchanter enchanter, InventoryPlayer inv) {
|
||||
super(new ContainerEnchanter(enchanter, inv));
|
||||
this.enchanter = enchanter;
|
||||
lastTickStack = enchanter.getStackInSlot(0);
|
||||
currentStack = enchanter.getStackInSlot(0);
|
||||
lastTickEnchants = new ArrayList(enchanter.enchantments);
|
||||
lastTickLevels = new ArrayList(enchanter.levels);
|
||||
}
|
||||
for (int i = 0; i < 16; i++) {
|
||||
int z = -24;
|
||||
if (i > 7 || (enchantButtons[8] == null || !enchantButtons[8].enabled)) {
|
||||
z = 0;
|
||||
}
|
||||
GuiButtonEnchantment button = new GuiButtonEnchantment(this, 1 + i, x + 34 + ((i) % 8) * 16, y + 54 + z);
|
||||
enchantButtons[i] = button;
|
||||
buttonList.add(button);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
asignEnchantButtons();
|
||||
|
||||
x = (width - xSize) / 2;
|
||||
y = (height - ySize) / 2;
|
||||
int i = 0;
|
||||
for (Integer enchant : enchanter.enchantments) {
|
||||
GuiButtonEnchantment button = new GuiButtonFramedEnchantment(this, 17 + i * 3, x + xSize + 4, y + i * 26);
|
||||
button.enchant = Enchantment.enchantmentsList[enchant];
|
||||
buttonList.add(button);
|
||||
buttonList.add(new GuiButtonEnchanterLevel(17 + i * 3 + 1, x + xSize + 24, y + i * 26 - 4, false));
|
||||
buttonList.add(new GuiButtonEnchanterLevel(17 + i * 3 + 2, x + xSize + 31, y + i * 26 - 4, true));
|
||||
++i;
|
||||
}
|
||||
}
|
||||
|
||||
buildButtonList();
|
||||
}
|
||||
public void asignEnchantButtons() {
|
||||
for (int i = 0; i < 16; i++) {
|
||||
enchantButtons[i].enchant = null;
|
||||
enchantButtons[i].enabled = false;
|
||||
}
|
||||
|
||||
public void buildButtonList() {
|
||||
buttonList.clear();
|
||||
GuiButton enchantButton = new GuiButtonEnchant(this, enchanter, 0, x + 151, y + 33);
|
||||
buttonList.add(enchantButton);
|
||||
enchantButton.enabled = !enchanter.enchantments.isEmpty();
|
||||
if (currentStack == null || currentStack.isItemEnchanted())
|
||||
return;
|
||||
|
||||
for (int i = 0; i < 16; i++) {
|
||||
int z = -24;
|
||||
if (i > 7 || (enchantButtons[8] == null || !enchantButtons[8].enabled)) {
|
||||
z = 0;
|
||||
}
|
||||
GuiButtonEnchantment button = new GuiButtonEnchantment(this, 1 + i, x + 34 + ((i) % 8) * 16, y + 54 + z);
|
||||
enchantButtons[i] = button;
|
||||
buttonList.add(button);
|
||||
}
|
||||
int it = 0;
|
||||
|
||||
asignEnchantButtons();
|
||||
for (int enchant : EnchantmentManager.enchantmentData.keySet()) {
|
||||
if (currentStack.getItem().getItemEnchantability() != 0 && EnchantmentManager.canApply(currentStack, Enchantment.enchantmentsList[enchant], enchanter.enchantments) && EnchantmentManager.canEnchantmentBeUsed(ClientHelper.clientPlayer().getGameProfile().getName(), Enchantment.enchantmentsList[enchant])) {
|
||||
enchantButtons[it].enchant = Enchantment.enchantmentsList[enchant];
|
||||
enchantButtons[it].enabled = true;
|
||||
it++;
|
||||
if (it >= 16)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
int i = 0;
|
||||
for (Integer enchant : enchanter.enchantments) {
|
||||
GuiButtonEnchantment button = new GuiButtonFramedEnchantment(this, 17 + i * 3, x + xSize + 4, y + i * 26);
|
||||
button.enchant = Enchantment.enchantmentsList[enchant];
|
||||
buttonList.add(button);
|
||||
buttonList.add(new GuiButtonEnchanterLevel(17 + i * 3 + 1, x + xSize + 24, y + i * 26 - 4, false));
|
||||
buttonList.add(new GuiButtonEnchanterLevel(17 + i * 3 + 2, x + xSize + 31, y + i * 26 - 4, true));
|
||||
++i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void asignEnchantButtons() {
|
||||
for (int i = 0; i < 16; i++) {
|
||||
enchantButtons[i].enchant = null;
|
||||
enchantButtons[i].enabled = false;
|
||||
}
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton par1GuiButton) {
|
||||
if (par1GuiButton.id == 0) {
|
||||
ThaumicTinkerer.netHandler.sendToServer(new PacketEnchanterStartWorking(enchanter));
|
||||
} else if (par1GuiButton.id <= 16) {
|
||||
GuiButtonEnchantment button = enchantButtons[par1GuiButton.id - 1];
|
||||
if (button != null && button.enchant != null)
|
||||
ThaumicTinkerer.netHandler.sendToServer(new PacketEnchanterAddEnchant(enchanter, button.enchant.effectId, 0));
|
||||
} else {
|
||||
int type = (par1GuiButton.id - 17) % 3;
|
||||
int index = (par1GuiButton.id - 17) / 3;
|
||||
|
||||
if (currentStack == null || currentStack.isItemEnchanted())
|
||||
return;
|
||||
if (index >= enchanter.enchantments.size() || index >= enchanter.levels.size())
|
||||
return;
|
||||
|
||||
int it = 0;
|
||||
int level = enchanter.levels.get(index);
|
||||
|
||||
for (int enchant : EnchantmentManager.enchantmentData.keySet()) {
|
||||
if (currentStack.getItem().getItemEnchantability() != 0 && EnchantmentManager.canApply(currentStack, Enchantment.enchantmentsList[enchant], enchanter.enchantments) && EnchantmentManager.canEnchantmentBeUsed(ClientHelper.clientPlayer().getGameProfile().getName(), Enchantment.enchantmentsList[enchant])) {
|
||||
enchantButtons[it].enchant = Enchantment.enchantmentsList[enchant];
|
||||
enchantButtons[it].enabled = true;
|
||||
it++;
|
||||
if (it >= 16)
|
||||
break;
|
||||
}
|
||||
}
|
||||
Enchantment enchant = Enchantment.enchantmentsList[enchanter.enchantments.get(index)];
|
||||
|
||||
}
|
||||
switch (type) {
|
||||
case 0: {
|
||||
ThaumicTinkerer.netHandler.sendToServer(new PacketEnchanterAddEnchant(enchanter, enchant.effectId, -1));
|
||||
break;
|
||||
}
|
||||
case 1: {
|
||||
ThaumicTinkerer.netHandler.sendToServer(new PacketEnchanterAddEnchant(enchanter, enchant.effectId, level == 1 ? -1 : level - 1));
|
||||
break;
|
||||
}
|
||||
case 2: {
|
||||
ThaumicTinkerer.netHandler.sendToServer(new PacketEnchanterAddEnchant(enchanter, enchant.effectId, level + 1));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton par1GuiButton) {
|
||||
if (par1GuiButton.id == 0) {
|
||||
ThaumicTinkerer.netHandler.sendToServer(new PacketEnchanterStartWorking(enchanter));
|
||||
} else if (par1GuiButton.id <= 16) {
|
||||
GuiButtonEnchantment button = enchantButtons[par1GuiButton.id - 1];
|
||||
if (button != null && button.enchant != null)
|
||||
ThaumicTinkerer.netHandler.sendToServer(new PacketEnchanterAddEnchant(enchanter, button.enchant.effectId, 0));
|
||||
} else {
|
||||
int type = (par1GuiButton.id - 17) % 3;
|
||||
int index = (par1GuiButton.id - 17) / 3;
|
||||
buildButtonList();
|
||||
}
|
||||
|
||||
if (index >= enchanter.enchantments.size() || index >= enchanter.levels.size())
|
||||
return;
|
||||
@Override
|
||||
public void updateScreen() {
|
||||
currentStack = enchanter.getStackInSlot(0);
|
||||
buildButtonList();
|
||||
if (currentStack != lastTickStack || !lastTickEnchants.equals(enchanter.enchantments) || !lastTickLevels.equals(enchanter.levels))
|
||||
buildButtonList();
|
||||
|
||||
int level = enchanter.levels.get(index);
|
||||
lastTickStack = currentStack;
|
||||
lastTickEnchants = new ArrayList(enchanter.enchantments);
|
||||
lastTickLevels = new ArrayList(enchanter.enchantments);
|
||||
}
|
||||
|
||||
Enchantment enchant = Enchantment.enchantmentsList[enchanter.enchantments.get(index)];
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float f, int i, int j) {
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
mc.renderEngine.bindTexture(gui);
|
||||
drawTexturedModalRect(x, y, 0, 0, xSize, ySize);
|
||||
|
||||
switch (type) {
|
||||
case 0: {
|
||||
ThaumicTinkerer.netHandler.sendToServer(new PacketEnchanterAddEnchant(enchanter, enchant.effectId, -1));
|
||||
break;
|
||||
}
|
||||
case 1: {
|
||||
ThaumicTinkerer.netHandler.sendToServer(new PacketEnchanterAddEnchant(enchanter, enchant.effectId, level == 1 ? -1 : level - 1));
|
||||
break;
|
||||
}
|
||||
case 2: {
|
||||
ThaumicTinkerer.netHandler.sendToServer(new PacketEnchanterAddEnchant(enchanter, enchant.effectId, level + 1));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
ItemStack itemToEnchant = enchanter.getStackInSlot(0);
|
||||
if (enchantButtons[8].enabled) {
|
||||
if (itemToEnchant != null && !itemToEnchant.isItemEnchanted())
|
||||
drawTexturedModalRect(x + 30, y + 26, 0, ySize, 147, 24);
|
||||
}
|
||||
|
||||
buildButtonList();
|
||||
}
|
||||
if (itemToEnchant != null && !itemToEnchant.isItemEnchanted())
|
||||
drawTexturedModalRect(x + 30, y + 50, 0, ySize, 147, 24);
|
||||
|
||||
@Override
|
||||
public void updateScreen() {
|
||||
currentStack = enchanter.getStackInSlot(0);
|
||||
buildButtonList();
|
||||
if (currentStack != lastTickStack || !lastTickEnchants.equals(enchanter.enchantments) || !lastTickLevels.equals(enchanter.levels))
|
||||
buildButtonList();
|
||||
if (!enchanter.enchantments.isEmpty()) {
|
||||
int x = this.x + 40;
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
int xo = 15;
|
||||
int z = 50;
|
||||
if (enchantButtons[8].enabled)
|
||||
z = 26;
|
||||
for (Aspect aspect : LibFeatures.PRIMAL_ASPECTS) {
|
||||
drawAspectBar(aspect, x + xo, y + z, i, j);
|
||||
xo += 15;
|
||||
}
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
}
|
||||
}
|
||||
|
||||
lastTickStack = currentStack;
|
||||
lastTickEnchants = new ArrayList(enchanter.enchantments);
|
||||
lastTickLevels = new ArrayList(enchanter.enchantments);
|
||||
}
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int par1, int par2) {
|
||||
if (!tooltip.isEmpty())
|
||||
ClientHelper.renderTooltip(par1 - x, par2 - y, tooltip);
|
||||
tooltip.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float f, int i, int j) {
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
mc.renderEngine.bindTexture(gui);
|
||||
drawTexturedModalRect(x, y, 0, 0, xSize, ySize);
|
||||
private void drawAspectBar(Aspect aspect, int x, int y, int mx, int my) {
|
||||
int totalCost = enchanter.totalAspects.getAmount(aspect);
|
||||
int current = enchanter.currentAspects.getAmount(aspect);
|
||||
|
||||
ItemStack itemToEnchant = enchanter.getStackInSlot(0);
|
||||
if (enchantButtons[8].enabled) {
|
||||
if (itemToEnchant != null && !itemToEnchant.isItemEnchanted())
|
||||
drawTexturedModalRect(x + 30, y + 26, 0, ySize, 147, 24);
|
||||
}
|
||||
int size = totalCost == 0 ? 11 : 59;
|
||||
|
||||
if (itemToEnchant != null && !itemToEnchant.isItemEnchanted())
|
||||
drawTexturedModalRect(x + 30, y + 50, 0, ySize, 147, 24);
|
||||
if (totalCost == 0) {
|
||||
drawTexturedModalRect(x, y - size, 200, 0, 10, 4);
|
||||
drawTexturedModalRect(x, y - size + 4, 200, 52, 10, 10);
|
||||
} else {
|
||||
int pixels = (int) (48D * ((double) current / (double) totalCost));
|
||||
Color color = new Color(aspect.getColor());
|
||||
GL11.glColor3ub((byte) color.getRed(), (byte) color.getGreen(), (byte) color.getBlue());
|
||||
drawTexturedModalRect(x + 1, y - size + 4 + 48 - pixels, 210, 48 - pixels, 8, pixels);
|
||||
GL11.glColor3f(1F, 1F, 1F);
|
||||
drawTexturedModalRect(x, y - size, 200, 0, 10, size);
|
||||
}
|
||||
|
||||
if (!enchanter.enchantments.isEmpty()) {
|
||||
int x = this.x + 40;
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
int xo = 15;
|
||||
int z = 50;
|
||||
if (enchantButtons[8].enabled)
|
||||
z = 26;
|
||||
for (Aspect aspect : LibFeatures.PRIMAL_ASPECTS) {
|
||||
drawAspectBar(aspect, x + xo, y + z, i, j);
|
||||
xo += 15;
|
||||
}
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int par1, int par2) {
|
||||
if (!tooltip.isEmpty())
|
||||
ClientHelper.renderTooltip(par1 - x, par2 - y, tooltip);
|
||||
tooltip.clear();
|
||||
}
|
||||
|
||||
private void drawAspectBar(Aspect aspect, int x, int y, int mx, int my) {
|
||||
int totalCost = enchanter.totalAspects.getAmount(aspect);
|
||||
int current = enchanter.currentAspects.getAmount(aspect);
|
||||
|
||||
int size = totalCost == 0 ? 11 : 59;
|
||||
|
||||
if (totalCost == 0) {
|
||||
drawTexturedModalRect(x, y - size, 200, 0, 10, 4);
|
||||
drawTexturedModalRect(x, y - size + 4, 200, 52, 10, 10);
|
||||
} else {
|
||||
int pixels = (int) (48D * ((double) current / (double) totalCost));
|
||||
Color color = new Color(aspect.getColor());
|
||||
GL11.glColor3ub((byte) color.getRed(), (byte) color.getGreen(), (byte) color.getBlue());
|
||||
drawTexturedModalRect(x + 1, y - size + 4 + 48 - pixels, 210, 48 - pixels, 8, pixels);
|
||||
GL11.glColor3f(1F, 1F, 1F);
|
||||
drawTexturedModalRect(x, y - size, 200, 0, 10, size);
|
||||
}
|
||||
|
||||
if (mx > x && mx <= x + 10 && my > y - size && my <= y) {
|
||||
List<String> tooltip = new ArrayList();
|
||||
tooltip.add('\u00a7' + aspect.getChatcolor() + aspect.getName());
|
||||
tooltip.add(current + "/" + totalCost);
|
||||
this.tooltip = tooltip;
|
||||
}
|
||||
}
|
||||
if (mx > x && mx <= x + 10 && my > y - size && my <= y) {
|
||||
List<String> tooltip = new ArrayList();
|
||||
tooltip.add('\u00a7' + aspect.getChatcolor() + aspect.getName());
|
||||
tooltip.add(current + "/" + totalCost);
|
||||
this.tooltip = tooltip;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -36,71 +36,71 @@ import java.util.List;
|
||||
|
||||
public class GuiMobMagnet extends GuiContainer {
|
||||
|
||||
private static final ResourceLocation gui = new ResourceLocation(LibResources.GUI_MOB_MAGNET);
|
||||
private static final ResourceLocation gui = new ResourceLocation(LibResources.GUI_MOB_MAGNET);
|
||||
|
||||
int x, y;
|
||||
int x, y;
|
||||
|
||||
ItemStack stack = null;
|
||||
TileMobMagnet mobMagnet;
|
||||
ItemStack stack = null;
|
||||
TileMobMagnet mobMagnet;
|
||||
|
||||
List<GuiButtonMM> buttonListMM = new ArrayList();
|
||||
List<IRadioButton> radioButtons = new ArrayList();
|
||||
List<GuiButtonMM> buttonListMM = new ArrayList();
|
||||
List<IRadioButton> radioButtons = new ArrayList();
|
||||
|
||||
public GuiMobMagnet(TileMobMagnet tile, InventoryPlayer playerInv) {
|
||||
super(new ContainerMobMagnet(tile, playerInv));
|
||||
mobMagnet = tile;
|
||||
}
|
||||
public GuiMobMagnet(TileMobMagnet tile, InventoryPlayer playerInv) {
|
||||
super(new ContainerMobMagnet(tile, playerInv));
|
||||
mobMagnet = tile;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
x = (width - xSize) / 2;
|
||||
y = (height - ySize) / 2;
|
||||
buttonListMM.clear();
|
||||
addButton(new GuiButtonMMRadio(0, x + 100, y + 28, mobMagnet.adult, radioButtons));
|
||||
addButton(new GuiButtonMMRadio(1, x + 100, y + 48, !mobMagnet.adult, radioButtons));
|
||||
buttonList = buttonListMM;
|
||||
}
|
||||
@Override
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
x = (width - xSize) / 2;
|
||||
y = (height - ySize) / 2;
|
||||
buttonListMM.clear();
|
||||
addButton(new GuiButtonMMRadio(0, x + 100, y + 28, mobMagnet.adult, radioButtons));
|
||||
addButton(new GuiButtonMMRadio(1, x + 100, y + 48, !mobMagnet.adult, radioButtons));
|
||||
buttonList = buttonListMM;
|
||||
}
|
||||
|
||||
private void addButton(GuiButtonMM button) {
|
||||
buttonListMM.add(button);
|
||||
if (button instanceof IRadioButton)
|
||||
radioButtons.add((IRadioButton) button);
|
||||
}
|
||||
private void addButton(GuiButtonMM button) {
|
||||
buttonListMM.add(button);
|
||||
if (button instanceof IRadioButton)
|
||||
radioButtons.add((IRadioButton) button);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton par1GuiButton) {
|
||||
if (par1GuiButton instanceof IRadioButton)
|
||||
((IRadioButton) par1GuiButton).enableFromClick();
|
||||
else buttonListMM.get(0).enabled = !buttonListMM.get(0).enabled;
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton par1GuiButton) {
|
||||
if (par1GuiButton instanceof IRadioButton)
|
||||
((IRadioButton) par1GuiButton).enableFromClick();
|
||||
else buttonListMM.get(0).enabled = !buttonListMM.get(0).enabled;
|
||||
|
||||
mobMagnet.adult = buttonListMM.get(0).enabled;
|
||||
mobMagnet.adult = buttonListMM.get(0).enabled;
|
||||
|
||||
ThaumicTinkerer.netHandler.sendToServer(new PacketMobMagnetButton(mobMagnet));
|
||||
}
|
||||
ThaumicTinkerer.netHandler.sendToServer(new PacketMobMagnetButton(mobMagnet));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float f, int i, int j) {
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
mc.renderEngine.bindTexture(gui);
|
||||
drawTexturedModalRect(x, y, 0, 0, xSize, ySize);
|
||||
String adult = StatCollector.translateToLocal("ttmisc.adult");
|
||||
String child = StatCollector.translateToLocal("ttmisc.child");
|
||||
stack = mobMagnet.getStackInSlot(0);
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float f, int i, int j) {
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
mc.renderEngine.bindTexture(gui);
|
||||
drawTexturedModalRect(x, y, 0, 0, xSize, ySize);
|
||||
String adult = StatCollector.translateToLocal("ttmisc.adult");
|
||||
String child = StatCollector.translateToLocal("ttmisc.child");
|
||||
stack = mobMagnet.getStackInSlot(0);
|
||||
|
||||
String filter;
|
||||
String filter;
|
||||
|
||||
if (stack != null) {
|
||||
String name = ItemSoulMould.getPatternName(stack);
|
||||
if (name.isEmpty())
|
||||
filter = StatCollector.translateToLocal("ttmisc.none");
|
||||
else filter = StatCollector.translateToLocal("entity." + name + ".name");
|
||||
} else filter = StatCollector.translateToLocal("ttmisc.all");
|
||||
if (stack != null) {
|
||||
String name = ItemSoulMould.getPatternName(stack);
|
||||
if (name.isEmpty())
|
||||
filter = StatCollector.translateToLocal("ttmisc.none");
|
||||
else filter = StatCollector.translateToLocal("entity." + name + ".name");
|
||||
} else filter = StatCollector.translateToLocal("ttmisc.all");
|
||||
|
||||
fontRendererObj.drawString(filter, x + xSize / 2 - fontRendererObj.getStringWidth(filter) / 2 - 26, y + 16, 0x999999);
|
||||
fontRendererObj.drawString(adult, x + 120, y + 30, 0x999999);
|
||||
fontRendererObj.drawString(child, x + 120, y + 50, 0x999999);
|
||||
GL11.glColor3f(1F, 1F, 1F);
|
||||
}
|
||||
fontRendererObj.drawString(filter, x + xSize / 2 - fontRendererObj.getStringWidth(filter) / 2 - 26, y + 16, 0x999999);
|
||||
fontRendererObj.drawString(adult, x + 120, y + 30, 0x999999);
|
||||
fontRendererObj.drawString(child, x + 120, y + 50, 0x999999);
|
||||
GL11.glColor3f(1F, 1F, 1F);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -6,7 +6,9 @@ import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
import thaumic.tinkerer.client.gui.button.*;
|
||||
import thaumic.tinkerer.client.gui.button.GuiButtonRP;
|
||||
import thaumic.tinkerer.client.gui.button.GuiButtonRPRadio;
|
||||
import thaumic.tinkerer.client.gui.button.IRadioButton;
|
||||
import thaumic.tinkerer.client.lib.LibResources;
|
||||
import thaumic.tinkerer.common.ThaumicTinkerer;
|
||||
import thaumic.tinkerer.common.block.tile.TileRPlacer;
|
||||
@@ -39,13 +41,14 @@ public class GuiRemotePlacer extends GuiContainer {
|
||||
x = (width - xSize) / 2;
|
||||
y = (height - ySize) / 2;
|
||||
buttonListRP.clear();
|
||||
addButton(new GuiButtonRPRadio(0, x + 100, y + 0, placer.blocks==1, radioButtons));
|
||||
addButton(new GuiButtonRPRadio(1, x + 100, y + 13, placer.blocks==2, radioButtons));
|
||||
addButton(new GuiButtonRPRadio(2, x + 100, y + 26, placer.blocks==3, radioButtons));
|
||||
addButton(new GuiButtonRPRadio(3, x + 100, y + 39, placer.blocks==4, radioButtons));
|
||||
addButton(new GuiButtonRPRadio(0, x + 100, y + 0, placer.blocks == 1, radioButtons));
|
||||
addButton(new GuiButtonRPRadio(1, x + 100, y + 13, placer.blocks == 2, radioButtons));
|
||||
addButton(new GuiButtonRPRadio(2, x + 100, y + 26, placer.blocks == 3, radioButtons));
|
||||
addButton(new GuiButtonRPRadio(3, x + 100, y + 39, placer.blocks == 4, radioButtons));
|
||||
buttonList = buttonListRP;
|
||||
|
||||
}
|
||||
|
||||
private void addButton(GuiButtonRP button) {
|
||||
buttonListRP.add(button);
|
||||
if (button instanceof IRadioButton)
|
||||
@@ -58,10 +61,11 @@ public class GuiRemotePlacer extends GuiContainer {
|
||||
((IRadioButton) par1GuiButton).enableFromClick();
|
||||
else buttonListRP.get(0).buttonEnabled = !buttonListRP.get(0).buttonEnabled;
|
||||
|
||||
placer.blocks= par1GuiButton.id+1;
|
||||
placer.blocks = par1GuiButton.id + 1;
|
||||
|
||||
ThaumicTinkerer.netHandler.sendToServer(new PacketPlacerButton(placer));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float var1, int var2, int var3) {
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
|
||||
@@ -23,20 +23,20 @@ import java.net.URI;
|
||||
|
||||
public class GuiResearchPeripheral extends GuiResearchRecipe {
|
||||
|
||||
public GuiResearchPeripheral(ResearchItem research) {
|
||||
super(research, 0, -100, -75);
|
||||
}
|
||||
public GuiResearchPeripheral(ResearchItem research) {
|
||||
super(research, 0, -100, -75);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void keyTyped(char par1, int par2) {
|
||||
if (par2 == 28) {
|
||||
String url = StatCollector.translateToLocal("ttresearch.webpage.peripherals");
|
||||
try {
|
||||
Desktop.getDesktop().browse(new URI(url));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else super.keyTyped(par1, par2);
|
||||
}
|
||||
@Override
|
||||
protected void keyTyped(char par1, int par2) {
|
||||
if (par2 == 28) {
|
||||
String url = StatCollector.translateToLocal("ttresearch.webpage.peripherals");
|
||||
try {
|
||||
Desktop.getDesktop().browse(new URI(url));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else super.keyTyped(par1, par2);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -21,21 +21,21 @@ import thaumic.tinkerer.client.lib.LibResources;
|
||||
|
||||
public class GuiButtonAT extends GuiButton {
|
||||
|
||||
private static final ResourceLocation gui = new ResourceLocation(LibResources.GUI_ANIMATION_TABLET);
|
||||
private static final ResourceLocation gui = new ResourceLocation(LibResources.GUI_ANIMATION_TABLET);
|
||||
|
||||
public boolean buttonEnabled = false;
|
||||
public boolean buttonEnabled = false;
|
||||
|
||||
public GuiButtonAT(int par1, int par2, int par3, boolean buttonEnabled) {
|
||||
super(par1, par2, par3, 13, 13, "");
|
||||
this.buttonEnabled = buttonEnabled;
|
||||
}
|
||||
public GuiButtonAT(int par1, int par2, int par3, boolean buttonEnabled) {
|
||||
super(par1, par2, par3, 13, 13, "");
|
||||
this.buttonEnabled = buttonEnabled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawButton(Minecraft par1Minecraft, int par2, int par3) {
|
||||
if (enabled) {
|
||||
par1Minecraft.renderEngine.bindTexture(gui);
|
||||
int y = buttonEnabled ? 13 : 0;
|
||||
drawTexturedModalRect(xPosition, yPosition, 176, y, width, height);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void drawButton(Minecraft par1Minecraft, int par2, int par3) {
|
||||
if (enabled) {
|
||||
par1Minecraft.renderEngine.bindTexture(gui);
|
||||
int y = buttonEnabled ? 13 : 0;
|
||||
drawTexturedModalRect(xPosition, yPosition, 176, y, width, height);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -18,34 +18,34 @@ import java.util.List;
|
||||
|
||||
public class GuiButtonATRadio extends GuiButtonAT implements IRadioButton {
|
||||
|
||||
List<IRadioButton> linkedButtons;
|
||||
List<IRadioButton> linkedButtons;
|
||||
|
||||
public GuiButtonATRadio(int par1, int par2, int par3, boolean enabled, List<IRadioButton> linkedButtons) {
|
||||
super(par1, par2, par3, enabled);
|
||||
this.linkedButtons = linkedButtons;
|
||||
}
|
||||
public GuiButtonATRadio(int par1, int par2, int par3, boolean enabled, List<IRadioButton> linkedButtons) {
|
||||
super(par1, par2, par3, enabled);
|
||||
this.linkedButtons = linkedButtons;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enableFromClick() {
|
||||
setEnabled(true);
|
||||
for (IRadioButton button : linkedButtons)
|
||||
if (button != this)
|
||||
button.updateStatus(this);
|
||||
}
|
||||
@Override
|
||||
public void enableFromClick() {
|
||||
setEnabled(true);
|
||||
for (IRadioButton button : linkedButtons)
|
||||
if (button != this)
|
||||
button.updateStatus(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateStatus(IRadioButton otherButton) {
|
||||
if (otherButton.isEnabled())
|
||||
setEnabled(false);
|
||||
}
|
||||
@Override
|
||||
public void updateStatus(IRadioButton otherButton) {
|
||||
if (otherButton.isEnabled())
|
||||
setEnabled(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEnabled() {
|
||||
return buttonEnabled;
|
||||
}
|
||||
@Override
|
||||
public boolean isEnabled() {
|
||||
return buttonEnabled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setEnabled(boolean enabled) {
|
||||
this.buttonEnabled = enabled;
|
||||
}
|
||||
@Override
|
||||
public void setEnabled(boolean enabled) {
|
||||
this.buttonEnabled = enabled;
|
||||
}
|
||||
}
|
||||
@@ -29,32 +29,32 @@ import java.util.List;
|
||||
|
||||
public class GuiButtonEnchant extends GuiButton {
|
||||
|
||||
private static final ResourceLocation gui = new ResourceLocation(LibResources.GUI_ENCHANTER);
|
||||
TileEnchanter enchanter;
|
||||
GuiEnchanting parent;
|
||||
private static final ResourceLocation gui = new ResourceLocation(LibResources.GUI_ENCHANTER);
|
||||
TileEnchanter enchanter;
|
||||
GuiEnchanting parent;
|
||||
|
||||
public GuiButtonEnchant(GuiEnchanting parent, TileEnchanter enchanter, int par1, int par2, int par3) {
|
||||
super(par1, par2, par3, 15, 15, "");
|
||||
this.enchanter = enchanter;
|
||||
this.parent = parent;
|
||||
}
|
||||
public GuiButtonEnchant(GuiEnchanting parent, TileEnchanter enchanter, int par1, int par2, int par3) {
|
||||
super(par1, par2, par3, 15, 15, "");
|
||||
this.enchanter = enchanter;
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawButton(Minecraft par1Minecraft, int par2, int par3) {
|
||||
if (!enabled)
|
||||
return;
|
||||
@Override
|
||||
public void drawButton(Minecraft par1Minecraft, int par2, int par3) {
|
||||
if (!enabled)
|
||||
return;
|
||||
|
||||
final int x = 176;
|
||||
final int y = enchanter.working ? 39 : 24;
|
||||
final int x = 176;
|
||||
final int y = enchanter.working ? 39 : 24;
|
||||
|
||||
ClientHelper.minecraft().renderEngine.bindTexture(gui);
|
||||
drawTexturedModalRect(xPosition, yPosition, x, y, 15, 15);
|
||||
ClientHelper.minecraft().renderEngine.bindTexture(gui);
|
||||
drawTexturedModalRect(xPosition, yPosition, x, y, 15, 15);
|
||||
|
||||
if (par2 >= xPosition && par2 < xPosition + 15 && par3 >= yPosition && par3 < yPosition + 15 && !enchanter.working) {
|
||||
List<String> tooltip = new ArrayList();
|
||||
tooltip.add(EnumChatFormatting.AQUA + StatCollector.translateToLocal("ttmisc.startEnchant"));
|
||||
parent.tooltip = tooltip;
|
||||
}
|
||||
}
|
||||
if (par2 >= xPosition && par2 < xPosition + 15 && par3 >= yPosition && par3 < yPosition + 15 && !enchanter.working) {
|
||||
List<String> tooltip = new ArrayList();
|
||||
tooltip.add(EnumChatFormatting.AQUA + StatCollector.translateToLocal("ttmisc.startEnchant"));
|
||||
parent.tooltip = tooltip;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -21,24 +21,24 @@ import thaumic.tinkerer.client.lib.LibResources;
|
||||
|
||||
public class GuiButtonEnchanterLevel extends GuiButton {
|
||||
|
||||
private static final ResourceLocation gui = new ResourceLocation(LibResources.GUI_ENCHANTER);
|
||||
private static final ResourceLocation gui = new ResourceLocation(LibResources.GUI_ENCHANTER);
|
||||
|
||||
boolean plus;
|
||||
boolean plus;
|
||||
|
||||
public GuiButtonEnchanterLevel(int par1, int par2, int par3, boolean plus) {
|
||||
super(par1, par2, par3, 7, 7, "");
|
||||
this.plus = plus;
|
||||
}
|
||||
public GuiButtonEnchanterLevel(int par1, int par2, int par3, boolean plus) {
|
||||
super(par1, par2, par3, 7, 7, "");
|
||||
this.plus = plus;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawButton(Minecraft par1Minecraft, int par2, int par3) {
|
||||
if (!enabled)
|
||||
return;
|
||||
@Override
|
||||
public void drawButton(Minecraft par1Minecraft, int par2, int par3) {
|
||||
if (!enabled)
|
||||
return;
|
||||
|
||||
int x = 218 + (plus ? 7 : 0);
|
||||
int x = 218 + (plus ? 7 : 0);
|
||||
|
||||
par1Minecraft.renderEngine.bindTexture(gui);
|
||||
drawTexturedModalRect(xPosition, yPosition, x, 0, 7, 7);
|
||||
}
|
||||
par1Minecraft.renderEngine.bindTexture(gui);
|
||||
drawTexturedModalRect(xPosition, yPosition, x, 0, 7, 7);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -32,51 +32,51 @@ import java.util.List;
|
||||
|
||||
public class GuiButtonEnchantment extends GuiButton {
|
||||
|
||||
public Enchantment enchant;
|
||||
GuiEnchanting parent;
|
||||
public Enchantment enchant;
|
||||
GuiEnchanting parent;
|
||||
|
||||
public GuiButtonEnchantment(GuiEnchanting parent, int par1, int par2, int par3) {
|
||||
super(par1, par2, par3, 16, 16, "");
|
||||
this.parent = parent;
|
||||
}
|
||||
public GuiButtonEnchantment(GuiEnchanting parent, int par1, int par2, int par3) {
|
||||
super(par1, par2, par3, 16, 16, "");
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
boolean dontRender() {
|
||||
return enchant == null || !enabled || !EnchantmentManager.enchantmentData.containsKey(enchant.effectId);
|
||||
}
|
||||
boolean dontRender() {
|
||||
return enchant == null || !enabled || !EnchantmentManager.enchantmentData.containsKey(enchant.effectId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawButton(Minecraft par1Minecraft, int par2, int par3) {
|
||||
if (dontRender())
|
||||
return;
|
||||
@Override
|
||||
public void drawButton(Minecraft par1Minecraft, int par2, int par3) {
|
||||
if (dontRender())
|
||||
return;
|
||||
|
||||
EnchantmentData data = EnchantmentManager.enchantmentData.get(enchant.effectId).get(1);
|
||||
ClientHelper.minecraft().renderEngine.bindTexture(data.texture);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
drawTexturedModalRect16(xPosition, yPosition, 0, 0, 16, 16);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
EnchantmentData data = EnchantmentManager.enchantmentData.get(enchant.effectId).get(1);
|
||||
ClientHelper.minecraft().renderEngine.bindTexture(data.texture);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
drawTexturedModalRect16(xPosition, yPosition, 0, 0, 16, 16);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
|
||||
if (par2 >= xPosition && par2 < xPosition + 16 && par3 >= yPosition && par3 < yPosition + 16) {
|
||||
List<String> tooltip = new ArrayList();
|
||||
tooltip.add(EnumChatFormatting.AQUA + StatCollector.translateToLocal(enchant.getName()));
|
||||
for (Aspect aspect : data.aspects.getAspectsSorted())
|
||||
tooltip.add(" \u00a7" + aspect.getChatcolor() + aspect.getName() + '\u00a7' + "r x " + data.aspects.getAmount(aspect) + " " + StatCollector.translateToLocal("ttmisc.baseCost"));
|
||||
if (this instanceof GuiButtonFramedEnchantment && !parent.enchanter.working)
|
||||
tooltip.add(EnumChatFormatting.GRAY + "" + EnumChatFormatting.ITALIC + " " + StatCollector.translateToLocal("ttmisc.clickToRemove"));
|
||||
if (par2 >= xPosition && par2 < xPosition + 16 && par3 >= yPosition && par3 < yPosition + 16) {
|
||||
List<String> tooltip = new ArrayList();
|
||||
tooltip.add(EnumChatFormatting.AQUA + StatCollector.translateToLocal(enchant.getName()));
|
||||
for (Aspect aspect : data.aspects.getAspectsSorted())
|
||||
tooltip.add(" \u00a7" + aspect.getChatcolor() + aspect.getName() + '\u00a7' + "r x " + data.aspects.getAmount(aspect) + " " + StatCollector.translateToLocal("ttmisc.baseCost"));
|
||||
if (this instanceof GuiButtonFramedEnchantment && !parent.enchanter.working)
|
||||
tooltip.add(EnumChatFormatting.GRAY + "" + EnumChatFormatting.ITALIC + " " + StatCollector.translateToLocal("ttmisc.clickToRemove"));
|
||||
|
||||
parent.tooltip = tooltip;
|
||||
}
|
||||
}
|
||||
parent.tooltip = tooltip;
|
||||
}
|
||||
}
|
||||
|
||||
public void drawTexturedModalRect16(int par1, int par2, int par3, int par4, int par5, int par6) {
|
||||
float f = 1F / 16F;
|
||||
float f1 = 1F / 16F;
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.addVertexWithUV(par1, par2 + par6, zLevel, (par3) * f, (par4 + par6) * f1);
|
||||
tessellator.addVertexWithUV(par1 + par5, par2 + par6, zLevel, (par3 + par5) * f, (par4 + par6) * f1);
|
||||
tessellator.addVertexWithUV(par1 + par5, par2, zLevel, (par3 + par5) * f, (par4) * f1);
|
||||
tessellator.addVertexWithUV(par1, par2, zLevel, (par3) * f, (par4) * f1);
|
||||
tessellator.draw();
|
||||
}
|
||||
public void drawTexturedModalRect16(int par1, int par2, int par3, int par4, int par5, int par6) {
|
||||
float f = 1F / 16F;
|
||||
float f1 = 1F / 16F;
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.addVertexWithUV(par1, par2 + par6, zLevel, (par3) * f, (par4 + par6) * f1);
|
||||
tessellator.addVertexWithUV(par1 + par5, par2 + par6, zLevel, (par3 + par5) * f, (par4 + par6) * f1);
|
||||
tessellator.addVertexWithUV(par1 + par5, par2, zLevel, (par3 + par5) * f, (par4) * f1);
|
||||
tessellator.addVertexWithUV(par1, par2, zLevel, (par3) * f, (par4) * f1);
|
||||
tessellator.draw();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -23,27 +23,27 @@ import thaumic.tinkerer.client.lib.LibResources;
|
||||
|
||||
public class GuiButtonFramedEnchantment extends GuiButtonEnchantment {
|
||||
|
||||
private static final ResourceLocation gui = new ResourceLocation(LibResources.GUI_ENCHANTER);
|
||||
private static final ResourceLocation gui = new ResourceLocation(LibResources.GUI_ENCHANTER);
|
||||
|
||||
public GuiButtonFramedEnchantment(GuiEnchanting parent, int par1, int par2, int par3) {
|
||||
super(parent, par1, par2, par3);
|
||||
}
|
||||
public GuiButtonFramedEnchantment(GuiEnchanting parent, int par1, int par2, int par3) {
|
||||
super(parent, par1, par2, par3);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawButton(Minecraft par1Minecraft, int par2, int par3) {
|
||||
if (dontRender() || parent.enchanter.enchantments.isEmpty() || parent.enchanter.levels.isEmpty())
|
||||
return;
|
||||
@Override
|
||||
public void drawButton(Minecraft par1Minecraft, int par2, int par3) {
|
||||
if (dontRender() || parent.enchanter.enchantments.isEmpty() || parent.enchanter.levels.isEmpty())
|
||||
return;
|
||||
|
||||
ClientHelper.minecraft().renderEngine.bindTexture(gui);
|
||||
drawTexturedModalRect(xPosition - 4, yPosition - 4, 176, 0, 24, 24);
|
||||
ClientHelper.minecraft().renderEngine.bindTexture(gui);
|
||||
drawTexturedModalRect(xPosition - 4, yPosition - 4, 176, 0, 24, 24);
|
||||
|
||||
int index = parent.enchanter.enchantments.indexOf(enchant.effectId);
|
||||
if (index != -1) {
|
||||
int level = parent.enchanter.levels.get(index);
|
||||
par1Minecraft.fontRenderer.drawStringWithShadow(StatCollector.translateToLocal("enchantment.level." + level), xPosition + 26, yPosition + 8, 0xFFFFFF);
|
||||
}
|
||||
int index = parent.enchanter.enchantments.indexOf(enchant.effectId);
|
||||
if (index != -1) {
|
||||
int level = parent.enchanter.levels.get(index);
|
||||
par1Minecraft.fontRenderer.drawStringWithShadow(StatCollector.translateToLocal("enchantment.level." + level), xPosition + 26, yPosition + 8, 0xFFFFFF);
|
||||
}
|
||||
|
||||
super.drawButton(par1Minecraft, par2, par3);
|
||||
}
|
||||
super.drawButton(par1Minecraft, par2, par3);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -21,21 +21,21 @@ import thaumic.tinkerer.client.lib.LibResources;
|
||||
|
||||
public class GuiButtonMM extends GuiButton {
|
||||
|
||||
private static final ResourceLocation gui = new ResourceLocation(LibResources.GUI_MOB_MAGNET);
|
||||
private static final ResourceLocation gui = new ResourceLocation(LibResources.GUI_MOB_MAGNET);
|
||||
|
||||
public boolean enabled = false;
|
||||
public boolean enabled = false;
|
||||
|
||||
public GuiButtonMM(int par1, int par2, int par3, boolean enabled) {
|
||||
super(par1, par2, par3, 13, 13, "");
|
||||
this.enabled = enabled;
|
||||
}
|
||||
public GuiButtonMM(int par1, int par2, int par3, boolean enabled) {
|
||||
super(par1, par2, par3, 13, 13, "");
|
||||
this.enabled = enabled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawButton(Minecraft par1Minecraft, int par2, int par3) {
|
||||
if (enabled) {
|
||||
par1Minecraft.renderEngine.bindTexture(gui);
|
||||
int y = enabled ? 13 : 0;
|
||||
drawTexturedModalRect(xPosition, yPosition, 176, y, width, height);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void drawButton(Minecraft par1Minecraft, int par2, int par3) {
|
||||
if (enabled) {
|
||||
par1Minecraft.renderEngine.bindTexture(gui);
|
||||
int y = enabled ? 13 : 0;
|
||||
drawTexturedModalRect(xPosition, yPosition, 176, y, width, height);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -18,34 +18,34 @@ import java.util.List;
|
||||
|
||||
public class GuiButtonMMRadio extends GuiButtonMM implements IRadioButton {
|
||||
|
||||
List<IRadioButton> linkedButtons;
|
||||
List<IRadioButton> linkedButtons;
|
||||
|
||||
public GuiButtonMMRadio(int par1, int par2, int par3, boolean enabled, List<IRadioButton> linkedButtons) {
|
||||
super(par1, par2, par3, enabled);
|
||||
this.linkedButtons = linkedButtons;
|
||||
}
|
||||
public GuiButtonMMRadio(int par1, int par2, int par3, boolean enabled, List<IRadioButton> linkedButtons) {
|
||||
super(par1, par2, par3, enabled);
|
||||
this.linkedButtons = linkedButtons;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enableFromClick() {
|
||||
setEnabled(true);
|
||||
for (IRadioButton button : linkedButtons)
|
||||
if (button != this)
|
||||
button.updateStatus(this);
|
||||
}
|
||||
@Override
|
||||
public void enableFromClick() {
|
||||
setEnabled(true);
|
||||
for (IRadioButton button : linkedButtons)
|
||||
if (button != this)
|
||||
button.updateStatus(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateStatus(IRadioButton otherButton) {
|
||||
if (otherButton.isEnabled())
|
||||
setEnabled(false);
|
||||
}
|
||||
@Override
|
||||
public void updateStatus(IRadioButton otherButton) {
|
||||
if (otherButton.isEnabled())
|
||||
setEnabled(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEnabled() {
|
||||
return enabled;
|
||||
}
|
||||
@Override
|
||||
public boolean isEnabled() {
|
||||
return enabled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setEnabled(boolean enabled) {
|
||||
this.enabled = enabled;
|
||||
}
|
||||
@Override
|
||||
public void setEnabled(boolean enabled) {
|
||||
this.enabled = enabled;
|
||||
}
|
||||
}
|
||||
@@ -16,12 +16,12 @@ package thaumic.tinkerer.client.gui.button;
|
||||
|
||||
public interface IRadioButton {
|
||||
|
||||
public void enableFromClick();
|
||||
public void enableFromClick();
|
||||
|
||||
public void updateStatus(IRadioButton otherButton);
|
||||
public void updateStatus(IRadioButton otherButton);
|
||||
|
||||
public boolean isEnabled();
|
||||
public boolean isEnabled();
|
||||
|
||||
public void setEnabled(boolean enabled);
|
||||
public void setEnabled(boolean enabled);
|
||||
|
||||
}
|
||||
@@ -21,21 +21,21 @@ import thaumic.tinkerer.client.lib.LibResources;
|
||||
|
||||
public class GuiButtonWG extends GuiButton {
|
||||
|
||||
private static final ResourceLocation gui = new ResourceLocation(LibResources.GUI_WARP_GATE);
|
||||
private static final ResourceLocation gui = new ResourceLocation(LibResources.GUI_WARP_GATE);
|
||||
|
||||
public boolean enabled = false;
|
||||
public boolean enabled = false;
|
||||
|
||||
public GuiButtonWG(int par1, int par2, int par3, boolean enabled) {
|
||||
super(par1, par2, par3, 13, 13, "");
|
||||
this.enabled = enabled;
|
||||
}
|
||||
public GuiButtonWG(int par1, int par2, int par3, boolean enabled) {
|
||||
super(par1, par2, par3, 13, 13, "");
|
||||
this.enabled = enabled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawButton(Minecraft par1Minecraft, int par2, int par3) {
|
||||
if (enabled) {
|
||||
par1Minecraft.renderEngine.bindTexture(gui);
|
||||
int y = !enabled ? 13 : 0;
|
||||
drawTexturedModalRect(xPosition, yPosition, 176, y, width, height);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void drawButton(Minecraft par1Minecraft, int par2, int par3) {
|
||||
if (enabled) {
|
||||
par1Minecraft.renderEngine.bindTexture(gui);
|
||||
int y = !enabled ? 13 : 0;
|
||||
drawTexturedModalRect(xPosition, yPosition, 176, y, width, height);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -22,40 +22,40 @@ import thaumic.tinkerer.client.lib.LibResources;
|
||||
|
||||
public class GuiIchorPouch extends GuiContainer {
|
||||
|
||||
private static final ResourceLocation gui = new ResourceLocation(LibResources.GUI_ICHOR_POUCH);
|
||||
private static final ResourceLocation gui = new ResourceLocation(LibResources.GUI_ICHOR_POUCH);
|
||||
|
||||
int x, y;
|
||||
int x, y;
|
||||
|
||||
public GuiIchorPouch(Container par1Container) {
|
||||
super(par1Container);
|
||||
}
|
||||
public GuiIchorPouch(Container par1Container) {
|
||||
super(par1Container);
|
||||
}
|
||||
|
||||
//Overridden to prevent a dupe
|
||||
//See issue 367
|
||||
protected boolean checkHotbarKeys(int slot) {
|
||||
if (this.mc.gameSettings.keyBindsHotbar[this.mc.thePlayer.inventory.currentItem].getKeyCode() != slot) {
|
||||
super.checkHotbarKeys(slot);
|
||||
}
|
||||
//Overridden to prevent a dupe
|
||||
//See issue 367
|
||||
protected boolean checkHotbarKeys(int slot) {
|
||||
if (this.mc.gameSettings.keyBindsHotbar[this.mc.thePlayer.inventory.currentItem].getKeyCode() != slot) {
|
||||
super.checkHotbarKeys(slot);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
xSize = ySize = 256;
|
||||
@Override
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
xSize = ySize = 256;
|
||||
|
||||
guiLeft = x = (width - xSize) / 2;
|
||||
guiTop = y = (height - ySize) / 2;
|
||||
}
|
||||
guiLeft = x = (width - xSize) / 2;
|
||||
guiTop = y = (height - ySize) / 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float f, int i, int j) {
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
mc.renderEngine.bindTexture(gui);
|
||||
drawTexturedModalRect(x, y, 0, 0, xSize, ySize);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
}
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float f, int i, int j) {
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
mc.renderEngine.bindTexture(gui);
|
||||
drawTexturedModalRect(x, y, 0, 0, xSize, ySize);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -29,40 +29,40 @@ import thaumic.tinkerer.common.network.packet.kami.PacketWarpGateButton;
|
||||
|
||||
public class GuiWarpGate extends GuiContainer {
|
||||
|
||||
private static final ResourceLocation gui = new ResourceLocation(LibResources.GUI_WARP_GATE);
|
||||
private static final ResourceLocation gui = new ResourceLocation(LibResources.GUI_WARP_GATE);
|
||||
|
||||
TileWarpGate warpGate;
|
||||
int x, y;
|
||||
TileWarpGate warpGate;
|
||||
int x, y;
|
||||
|
||||
public GuiWarpGate(TileWarpGate warpGate, InventoryPlayer inv) {
|
||||
super(new ContainerWarpGate(warpGate, inv));
|
||||
this.warpGate = warpGate;
|
||||
}
|
||||
public GuiWarpGate(TileWarpGate warpGate, InventoryPlayer inv) {
|
||||
super(new ContainerWarpGate(warpGate, inv));
|
||||
this.warpGate = warpGate;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton par1GuiButton) {
|
||||
((GuiButtonWG) par1GuiButton).enabled = !((GuiButtonWG) par1GuiButton).enabled;
|
||||
warpGate.locked = ((GuiButtonWG) par1GuiButton).enabled;
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton par1GuiButton) {
|
||||
((GuiButtonWG) par1GuiButton).enabled = !((GuiButtonWG) par1GuiButton).enabled;
|
||||
warpGate.locked = ((GuiButtonWG) par1GuiButton).enabled;
|
||||
|
||||
ThaumicTinkerer.netHandler.sendToServer(new PacketWarpGateButton(warpGate));
|
||||
}
|
||||
ThaumicTinkerer.netHandler.sendToServer(new PacketWarpGateButton(warpGate));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
x = (width - xSize) / 2;
|
||||
y = (height - ySize) / 2;
|
||||
@Override
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
x = (width - xSize) / 2;
|
||||
y = (height - ySize) / 2;
|
||||
|
||||
buttonList.clear();
|
||||
buttonList.add(new GuiButtonWG(0, x + 5, y + 5, warpGate.locked));
|
||||
}
|
||||
buttonList.clear();
|
||||
buttonList.add(new GuiButtonWG(0, x + 5, y + 5, warpGate.locked));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float f, int i, int j) {
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
mc.renderEngine.bindTexture(gui);
|
||||
drawTexturedModalRect(x, y, 0, 0, xSize, ySize);
|
||||
fontRendererObj.drawStringWithShadow(StatCollector.translateToLocal("ttmisc.lockedGate"), x + 20, y + 7, 0x999999);
|
||||
}
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float f, int i, int j) {
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
mc.renderEngine.bindTexture(gui);
|
||||
drawTexturedModalRect(x, y, 0, 0, xSize, ySize);
|
||||
fontRendererObj.drawStringWithShadow(StatCollector.translateToLocal("ttmisc.lockedGate"), x + 20, y + 7, 0x999999);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -38,186 +38,185 @@ import java.util.List;
|
||||
|
||||
public class GuiWarpGateDestinations extends GuiScreen {
|
||||
|
||||
private static ResourceLocation enderField = new ResourceLocation("textures/entity/end_portal.png");
|
||||
TileWarpGate warpGate;
|
||||
RenderItem render = new RenderItem();
|
||||
private static ResourceLocation enderField = new ResourceLocation("textures/entity/end_portal.png");
|
||||
TileWarpGate warpGate;
|
||||
RenderItem render = new RenderItem();
|
||||
|
||||
int lastMouseX, lastMouseY;
|
||||
int x, y;
|
||||
int ticks;
|
||||
int lastMouseX, lastMouseY;
|
||||
int x, y;
|
||||
int ticks;
|
||||
List<String> tooltip = new ArrayList();
|
||||
|
||||
public GuiWarpGateDestinations(TileWarpGate warpGate) {
|
||||
this.warpGate = warpGate;
|
||||
}
|
||||
public GuiWarpGateDestinations(TileWarpGate warpGate) {
|
||||
this.warpGate = warpGate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
@Override
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
|
||||
x = warpGate.xCoord - width / 2;
|
||||
y = warpGate.zCoord - height / 2;
|
||||
}
|
||||
x = warpGate.xCoord - width / 2;
|
||||
y = warpGate.zCoord - height / 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateScreen() {
|
||||
++ticks;
|
||||
@Override
|
||||
public void updateScreen() {
|
||||
++ticks;
|
||||
|
||||
ScaledResolution res = new ScaledResolution(mc, mc.displayWidth, mc.displayHeight);
|
||||
int i = res.getScaledWidth();
|
||||
int j = res.getScaledHeight();
|
||||
int mx = Mouse.getX() * i / mc.displayWidth;
|
||||
int my = j - Mouse.getY() * j / mc.displayHeight - 1;
|
||||
ScaledResolution res = new ScaledResolution(mc, mc.displayWidth, mc.displayHeight);
|
||||
int i = res.getScaledWidth();
|
||||
int j = res.getScaledHeight();
|
||||
int mx = Mouse.getX() * i / mc.displayWidth;
|
||||
int my = j - Mouse.getY() * j / mc.displayHeight - 1;
|
||||
|
||||
if (Mouse.isButtonDown(0)) {
|
||||
int deltaX = mx - lastMouseX;
|
||||
int deltaY = my - lastMouseY;
|
||||
x -= deltaX;
|
||||
y -= deltaY;
|
||||
}
|
||||
if (Mouse.isButtonDown(0)) {
|
||||
int deltaX = mx - lastMouseX;
|
||||
int deltaY = my - lastMouseY;
|
||||
x -= deltaX;
|
||||
y -= deltaY;
|
||||
}
|
||||
|
||||
lastMouseX = mx;
|
||||
lastMouseY = my;
|
||||
}
|
||||
lastMouseX = mx;
|
||||
lastMouseY = my;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void keyTyped(char par1, int par2) {
|
||||
super.keyTyped(par1, par2);
|
||||
@Override
|
||||
protected void keyTyped(char par1, int par2) {
|
||||
super.keyTyped(par1, par2);
|
||||
|
||||
if (par2 == 57) { // space
|
||||
x = warpGate.xCoord - width / 2;
|
||||
y = warpGate.zCoord - height / 2;
|
||||
return;
|
||||
}
|
||||
if (par2 >= 2 && par2 < 12) {
|
||||
int num = par2 - 2;
|
||||
ItemStack stack = warpGate.getStackInSlot(num);
|
||||
if (stack != null && ItemSkyPearl.isAttuned(stack) && ItemSkyPearl.getDim(stack) == warpGate.getWorldObj().provider.dimensionId) {
|
||||
int x = ItemSkyPearl.getX(stack);
|
||||
int z = ItemSkyPearl.getZ(stack);
|
||||
if (par2 == 57) { // space
|
||||
x = warpGate.xCoord - width / 2;
|
||||
y = warpGate.zCoord - height / 2;
|
||||
return;
|
||||
}
|
||||
if (par2 >= 2 && par2 < 12) {
|
||||
int num = par2 - 2;
|
||||
ItemStack stack = warpGate.getStackInSlot(num);
|
||||
if (stack != null && ItemSkyPearl.isAttuned(stack) && ItemSkyPearl.getDim(stack) == warpGate.getWorldObj().provider.dimensionId) {
|
||||
int x = ItemSkyPearl.getX(stack);
|
||||
int z = ItemSkyPearl.getZ(stack);
|
||||
|
||||
this.x = x - width / 2;
|
||||
y = z - height / 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
this.x = x - width / 2;
|
||||
y = z - height / 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
List<String> tooltip = new ArrayList();
|
||||
@Override
|
||||
public void drawScreen(int par1, int par2, float par3) {
|
||||
drawDefaultBackground();
|
||||
super.drawScreen(par1, par2, par3);
|
||||
|
||||
@Override
|
||||
public void drawScreen(int par1, int par2, float par3) {
|
||||
drawDefaultBackground();
|
||||
super.drawScreen(par1, par2, par3);
|
||||
tooltip.clear();
|
||||
|
||||
tooltip.clear();
|
||||
int gateX = warpGate.xCoord - x;
|
||||
int gateY = warpGate.zCoord - y;
|
||||
mc.renderEngine.bindTexture(TextureMap.locationItemsTexture);
|
||||
|
||||
int gateX = warpGate.xCoord - x;
|
||||
int gateY = warpGate.zCoord - y;
|
||||
mc.renderEngine.bindTexture(TextureMap.locationItemsTexture);
|
||||
List<Object[]> coords = new ArrayList();
|
||||
|
||||
List<Object[]> coords = new ArrayList();
|
||||
for (int i = 0; i < warpGate.getSizeInventory(); i++) {
|
||||
ItemStack stack = warpGate.getStackInSlot(i);
|
||||
if (stack != null && ItemSkyPearl.isAttuned(stack)) {
|
||||
int dim = ItemSkyPearl.getDim(stack);
|
||||
if (warpGate.getWorldObj().provider.dimensionId != dim)
|
||||
continue;
|
||||
|
||||
for (int i = 0; i < warpGate.getSizeInventory(); i++) {
|
||||
ItemStack stack = warpGate.getStackInSlot(i);
|
||||
if (stack != null && ItemSkyPearl.isAttuned(stack)) {
|
||||
int dim = ItemSkyPearl.getDim(stack);
|
||||
if (warpGate.getWorldObj().provider.dimensionId != dim)
|
||||
continue;
|
||||
int x = ItemSkyPearl.getX(stack);
|
||||
int y = ItemSkyPearl.getY(stack);
|
||||
int z = ItemSkyPearl.getZ(stack);
|
||||
|
||||
int x = ItemSkyPearl.getX(stack);
|
||||
int y = ItemSkyPearl.getY(stack);
|
||||
int z = ItemSkyPearl.getZ(stack);
|
||||
if (y != -1)
|
||||
coords.add(new Object[]{x - this.x, z - this.y, stack, i});
|
||||
}
|
||||
}
|
||||
|
||||
if (y != -1)
|
||||
coords.add(new Object[]{ x - this.x, z - this.y, stack, i });
|
||||
}
|
||||
}
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
GL11.glColor4f(1F, 1F, 1F, (float) ((Math.sin(ticks / 10D) + 1F) / 4F + 0.25F));
|
||||
GL11.glLineWidth(2F);
|
||||
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||
for (Object[] coords_ : coords) {
|
||||
int x = (Integer) coords_[0];
|
||||
int y = (Integer) coords_[1];
|
||||
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
GL11.glColor4f(1F, 1F, 1F, (float) ((Math.sin(ticks / 10D) + 1F) / 4F + 0.25F));
|
||||
GL11.glLineWidth(2F);
|
||||
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||
for (Object[] coords_ : coords) {
|
||||
int x = (Integer) coords_[0];
|
||||
int y = (Integer) coords_[1];
|
||||
GL11.glBegin(GL11.GL_LINES);
|
||||
GL11.glVertex2i(gateX, gateY);
|
||||
GL11.glVertex2i(x, y);
|
||||
GL11.glEnd();
|
||||
}
|
||||
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
|
||||
GL11.glBegin(GL11.GL_LINES);
|
||||
GL11.glVertex2i(gateX, gateY);
|
||||
GL11.glVertex2i(x, y);
|
||||
GL11.glEnd();
|
||||
}
|
||||
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
fontRendererObj.drawStringWithShadow(EnumChatFormatting.UNDERLINE + StatCollector.translateToLocal("ttmisc.destinations"), 3, 40, 0xFFFFFF);
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
drawPearlAt(0, null, gateX, gateY, par1, par2);
|
||||
for (Object[] coords_ : coords)
|
||||
drawPearlAt((Integer) coords_[3], (ItemStack) coords_[2], (Integer) coords_[0], (Integer) coords_[1], par1, par2);
|
||||
|
||||
fontRendererObj.drawStringWithShadow(EnumChatFormatting.UNDERLINE + StatCollector.translateToLocal("ttmisc.destinations"), 3, 40, 0xFFFFFF);
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
drawPearlAt(0, null, gateX, gateY, par1, par2);
|
||||
for (Object[] coords_ : coords)
|
||||
drawPearlAt((Integer) coords_[3], (ItemStack) coords_[2], (Integer) coords_[0], (Integer) coords_[1], par1, par2);
|
||||
if (!tooltip.isEmpty())
|
||||
ClientHelper.renderTooltip(par1, par2, tooltip);
|
||||
|
||||
if (!tooltip.isEmpty())
|
||||
ClientHelper.renderTooltip(par1, par2, tooltip);
|
||||
drawCenteredString(fontRendererObj, StatCollector.translateToLocal("ttmisc.numberKeys"), width / 2, 5, 0xFFFFFF);
|
||||
drawCenteredString(fontRendererObj, StatCollector.translateToLocal("ttmisc.spaceToReset"), width / 2, 16, 0xFFFFFF);
|
||||
}
|
||||
|
||||
drawCenteredString(fontRendererObj, StatCollector.translateToLocal("ttmisc.numberKeys"), width / 2, 5, 0xFFFFFF);
|
||||
drawCenteredString(fontRendererObj, StatCollector.translateToLocal("ttmisc.spaceToReset"), width / 2, 16, 0xFFFFFF);
|
||||
}
|
||||
public void drawPearlAt(int index, ItemStack stack, int xp, int yp, int mx, int my) {
|
||||
int x = xp + this.x;
|
||||
int y = yp + this.y;
|
||||
|
||||
public void drawPearlAt(int index, ItemStack stack, int xp, int yp, int mx, int my) {
|
||||
int x = xp + this.x;
|
||||
int y = yp + this.y;
|
||||
String destName;
|
||||
|
||||
String destName;
|
||||
mc.renderEngine.bindTexture(TextureMap.locationItemsTexture);
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(xp, yp, 0);
|
||||
GL11.glScalef(0.5F, 0.5F, 1F);
|
||||
render.renderIcon(-8, -8, ThaumicTinkerer.registry.getFirstItemFromClass(ItemSkyPearl.class).getIconFromDamage(0), 16, 16);
|
||||
GL11.glPopMatrix();
|
||||
|
||||
mc.renderEngine.bindTexture(TextureMap.locationItemsTexture);
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(xp, yp, 0);
|
||||
GL11.glScalef(0.5F, 0.5F, 1F);
|
||||
render.renderIcon(-8, -8, ThaumicTinkerer.registry.getFirstItemFromClass(ItemSkyPearl.class).getIconFromDamage(0), 16, 16);
|
||||
GL11.glPopMatrix();
|
||||
String destNum = " " + EnumChatFormatting.ITALIC + String.format(StatCollector.translateToLocal("ttmisc.destinationInd"), index + 1);
|
||||
if (stack != null && stack.hasDisplayName())
|
||||
destName = stack.getDisplayName();
|
||||
else destName = StatCollector.translateToLocal(stack == null ? "ttmisc.entrancePoint" : "ttmisc.destination");
|
||||
|
||||
String destNum = " " + EnumChatFormatting.ITALIC + String.format(StatCollector.translateToLocal("ttmisc.destinationInd"), index + 1);
|
||||
if (stack != null && stack.hasDisplayName())
|
||||
destName = stack.getDisplayName();
|
||||
else destName = StatCollector.translateToLocal(stack == null ? "ttmisc.entrancePoint" : "ttmisc.destination");
|
||||
if (stack != null)
|
||||
fontRendererObj.drawString((index + 1) + ": " + destName, 5, 54 + index * 11, 0xFFFFFF);
|
||||
|
||||
if (stack != null)
|
||||
fontRendererObj.drawString((index + 1) + ": " + destName, 5, 54 + index * 11, 0xFFFFFF);
|
||||
if (mx >= xp - 4 && mx <= xp + 4 && my >= yp - 4 && my < yp + 4) {
|
||||
tooltip.add(EnumChatFormatting.AQUA + destName + destNum);
|
||||
|
||||
if (mx >= xp - 4 && mx <= xp + 4 && my >= yp - 4 && my < yp + 4) {
|
||||
tooltip.add(EnumChatFormatting.AQUA + destName + destNum);
|
||||
if (stack != null) {
|
||||
ItemSkyPearl.addInfo(stack, warpGate.getWorldObj().provider.dimensionId, Vector3.fromTileEntity(warpGate), tooltip, true);
|
||||
tooltip.add(StatCollector.translateToLocal("ttmisc.clickToTeleport"));
|
||||
} else {
|
||||
tooltip.add("X: " + x);
|
||||
tooltip.add("Z: " + y);
|
||||
}
|
||||
|
||||
if (stack != null) {
|
||||
ItemSkyPearl.addInfo(stack, warpGate.getWorldObj().provider.dimensionId, Vector3.fromTileEntity(warpGate), tooltip, true);
|
||||
tooltip.add(StatCollector.translateToLocal("ttmisc.clickToTeleport"));
|
||||
} else {
|
||||
tooltip.add("X: " + x);
|
||||
tooltip.add("Z: " + y);
|
||||
}
|
||||
if (Mouse.isButtonDown(0) && isShiftKeyDown() && stack != null) {
|
||||
ThaumicTinkerer.netHandler.sendToServer(new PacketWarpGateTeleport(warpGate, index));
|
||||
mc.displayGuiScreen(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (Mouse.isButtonDown(0) && isShiftKeyDown() && stack != null) {
|
||||
ThaumicTinkerer.netHandler.sendToServer(new PacketWarpGateTeleport(warpGate, index));
|
||||
mc.displayGuiScreen(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawDefaultBackground() {
|
||||
int par1 = 0;
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_FOG);
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
mc.getTextureManager().bindTexture(enderField);
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
float f = 256.0F;
|
||||
tessellator.startDrawingQuads();
|
||||
float hue = (float) (Math.sin(ticks / 150D) + 1F / 2F);
|
||||
tessellator.setColorOpaque_I(Color.HSBtoRGB(hue, 0.5F, 0.4F));
|
||||
tessellator.addVertexWithUV(0.0D, height, 0.0D, 0.0D, height / f + par1);
|
||||
tessellator.addVertexWithUV(width, height, 0.0D, width / f, height / f + par1);
|
||||
tessellator.addVertexWithUV(width, 0.0D, 0.0D, width / f, par1);
|
||||
tessellator.addVertexWithUV(0.0D, 0.0D, 0.0D, 0.0D, par1);
|
||||
tessellator.draw();
|
||||
}
|
||||
@Override
|
||||
public void drawDefaultBackground() {
|
||||
int par1 = 0;
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_FOG);
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
mc.getTextureManager().bindTexture(enderField);
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
float f = 256.0F;
|
||||
tessellator.startDrawingQuads();
|
||||
float hue = (float) (Math.sin(ticks / 150D) + 1F / 2F);
|
||||
tessellator.setColorOpaque_I(Color.HSBtoRGB(hue, 0.5F, 0.4F));
|
||||
tessellator.addVertexWithUV(0.0D, height, 0.0D, 0.0D, height / f + par1);
|
||||
tessellator.addVertexWithUV(width, height, 0.0D, width / f, height / f + par1);
|
||||
tessellator.addVertexWithUV(width, 0.0D, 0.0D, width / f, par1);
|
||||
tessellator.addVertexWithUV(0.0D, 0.0D, 0.0D, 0.0D, par1);
|
||||
tessellator.draw();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -16,12 +16,12 @@ package thaumic.tinkerer.client.lib;
|
||||
|
||||
public final class LibRenderIDs {
|
||||
|
||||
public static int idMagnet = -1;
|
||||
public static int idRepairer = -1;
|
||||
public static int idMagnet = -1;
|
||||
public static int idRepairer = -1;
|
||||
|
||||
public static int idWarpGate = -1;
|
||||
public static int idWarpGate = -1;
|
||||
|
||||
public static int idFire = -1;
|
||||
public static int idFire = -1;
|
||||
|
||||
|
||||
public static int idGrain = -1;
|
||||
|
||||
@@ -16,96 +16,96 @@ package thaumic.tinkerer.client.lib;
|
||||
|
||||
public final class LibResources {
|
||||
|
||||
public static final String PREFIX_MOD = "ttinkerer:";
|
||||
public static final String PREFIX_MOD = "ttinkerer:";
|
||||
|
||||
public static final String PREFIX_LANG = "/assets/ttinkerer/lang/";
|
||||
public static final String PREFIX_LANG = "/assets/ttinkerer/lang/";
|
||||
|
||||
public static final String PREFIX_GUI = PREFIX_MOD + "textures/gui/";
|
||||
public static final String PREFIX_MISC = PREFIX_MOD + "textures/misc/";
|
||||
public static final String PREFIX_MODEL = PREFIX_MOD + "textures/model/";
|
||||
public static final String PREFIX_ENCHANTS = PREFIX_MOD + "textures/enchants/";
|
||||
public static final String PREFIX_GUI = PREFIX_MOD + "textures/gui/";
|
||||
public static final String PREFIX_MISC = PREFIX_MOD + "textures/misc/";
|
||||
public static final String PREFIX_MODEL = PREFIX_MOD + "textures/model/";
|
||||
public static final String PREFIX_ENCHANTS = PREFIX_MOD + "textures/enchants/";
|
||||
|
||||
public static final String EMTPY_TEXTURE = "emptyTexture";
|
||||
public static final String EMTPY_TEXTURE = "emptyTexture";
|
||||
|
||||
public static final String GUI_ANIMATION_TABLET = PREFIX_GUI + "animationTablet.png";
|
||||
public static final String GUI_MOB_MAGNET = PREFIX_GUI + "mobMagnet.png";
|
||||
public static final String GUI_ENCHANTER = PREFIX_GUI + "enchanter.png";
|
||||
public static final String GUI_ASPECT_ANALYZER = PREFIX_GUI + "aspectAnalyzer.png";
|
||||
public static final String GUI_SOUL_HEARTS = PREFIX_GUI + "soulHearts.png";
|
||||
public static final String GUI_ICHOR_POUCH = PREFIX_GUI + "ichorPouch.png";
|
||||
public static final String GUI_WARP_GATE = PREFIX_GUI + "warpGate.png";
|
||||
public static final String GUI_ANIMATION_TABLET = PREFIX_GUI + "animationTablet.png";
|
||||
public static final String GUI_MOB_MAGNET = PREFIX_GUI + "mobMagnet.png";
|
||||
public static final String GUI_ENCHANTER = PREFIX_GUI + "enchanter.png";
|
||||
public static final String GUI_ASPECT_ANALYZER = PREFIX_GUI + "aspectAnalyzer.png";
|
||||
public static final String GUI_SOUL_HEARTS = PREFIX_GUI + "soulHearts.png";
|
||||
public static final String GUI_ICHOR_POUCH = PREFIX_GUI + "ichorPouch.png";
|
||||
public static final String GUI_WARP_GATE = PREFIX_GUI + "warpGate.png";
|
||||
public static final String GUI_REMOTE_PLACER = PREFIX_GUI + "remotePlacer.png";
|
||||
|
||||
public static final String MISC_R_ENCHANTING = PREFIX_MISC + "r_enchanting.png";
|
||||
public static final String MISC_AT_CENTER = PREFIX_MISC + "atCenter.png";
|
||||
public static final String MISC_AT_LEFT = PREFIX_MISC + "atLeft.png";
|
||||
public static final String MISC_AT_RIGHT = PREFIX_MISC + "atRight.png";
|
||||
public static final String MISC_AT_INDENT = PREFIX_MISC + "atFacingIndent.png";
|
||||
public static final String MISC_REPAIR = PREFIX_MISC + "repair.png";
|
||||
public static final String MISC_REPAIR_OFF = PREFIX_MISC + "repairOff.png";
|
||||
public static final String MISC_R_ENCHANTING = PREFIX_MISC + "r_enchanting.png";
|
||||
public static final String MISC_AT_CENTER = PREFIX_MISC + "atCenter.png";
|
||||
public static final String MISC_AT_LEFT = PREFIX_MISC + "atLeft.png";
|
||||
public static final String MISC_AT_RIGHT = PREFIX_MISC + "atRight.png";
|
||||
public static final String MISC_AT_INDENT = PREFIX_MISC + "atFacingIndent.png";
|
||||
public static final String MISC_REPAIR = PREFIX_MISC + "repair.png";
|
||||
public static final String MISC_REPAIR_OFF = PREFIX_MISC + "repairOff.png";
|
||||
|
||||
public static final String MODEL_RELAY_TEXTURE = PREFIX_MODEL + "relay.png";
|
||||
public static final String MODEL_MAGNET_N = PREFIX_MODEL + "magnetN.png";
|
||||
public static final String MODEL_MAGNET_S = PREFIX_MODEL + "magnetS.png";
|
||||
public static final String MODEL_MOB_MAGNET_N = PREFIX_MODEL + "mobMagnetN.png";
|
||||
public static final String MODEL_MOB_MAGNET_S = PREFIX_MODEL + "mobMagnetS.png";
|
||||
public static final String MODEL_REVEALING_HELM = PREFIX_MODEL + "revealing.png";
|
||||
public static final String MODEL_REPAIRER = PREFIX_MODEL + "repairer.png";
|
||||
public static final String MODEL_CAP_ICHOR = PREFIX_MODEL + "capIchor.png";
|
||||
public static final String MODEL_ROD_ICHORCLOTH = PREFIX_MODEL + "rodIchorcloth.png";
|
||||
public static final String MODEL_ARMOR_ICHOR_1 = PREFIX_MODEL + "ichor1.png";
|
||||
public static final String MODEL_ARMOR_ICHOR_2 = PREFIX_MODEL + "ichor2.png";
|
||||
public static final String MODEL_ARMOR_ICHOR_GEM_1 = PREFIX_MODEL + "ichorGem1.png";
|
||||
public static final String MODEL_ARMOR_ICHOR_GEM_2 = PREFIX_MODEL + "ichorGem2.png";
|
||||
public static final String MODEL_RELAY_TEXTURE = PREFIX_MODEL + "relay.png";
|
||||
public static final String MODEL_MAGNET_N = PREFIX_MODEL + "magnetN.png";
|
||||
public static final String MODEL_MAGNET_S = PREFIX_MODEL + "magnetS.png";
|
||||
public static final String MODEL_MOB_MAGNET_N = PREFIX_MODEL + "mobMagnetN.png";
|
||||
public static final String MODEL_MOB_MAGNET_S = PREFIX_MODEL + "mobMagnetS.png";
|
||||
public static final String MODEL_REVEALING_HELM = PREFIX_MODEL + "revealing.png";
|
||||
public static final String MODEL_REPAIRER = PREFIX_MODEL + "repairer.png";
|
||||
public static final String MODEL_CAP_ICHOR = PREFIX_MODEL + "capIchor.png";
|
||||
public static final String MODEL_ROD_ICHORCLOTH = PREFIX_MODEL + "rodIchorcloth.png";
|
||||
public static final String MODEL_ARMOR_ICHOR_1 = PREFIX_MODEL + "ichor1.png";
|
||||
public static final String MODEL_ARMOR_ICHOR_2 = PREFIX_MODEL + "ichor2.png";
|
||||
public static final String MODEL_ARMOR_ICHOR_GEM_1 = PREFIX_MODEL + "ichorGem1.png";
|
||||
public static final String MODEL_ARMOR_ICHOR_GEM_2 = PREFIX_MODEL + "ichorGem2.png";
|
||||
|
||||
public static final String ENCHANT_PROTECTION = PREFIX_ENCHANTS + "protection.png";
|
||||
public static final String ENCHANT_FIRE_PROTECTION = PREFIX_ENCHANTS + "fireProtection.png";
|
||||
public static final String ENCHANT_FEATHER_FALLING = PREFIX_ENCHANTS + "featherFalling.png";
|
||||
public static final String ENCHANT_BLAST_PROTECTION = PREFIX_ENCHANTS + "blastProtection.png";
|
||||
public static final String ENCHANT_PROJECTILE_PROTECTION = PREFIX_ENCHANTS + "projectileProtection.png";
|
||||
public static final String ENCHANT_RESPIRATION = PREFIX_ENCHANTS + "respiration.png";
|
||||
public static final String ENCHANT_AQUA_AFFINITY = PREFIX_ENCHANTS + "aquaAffinity.png";
|
||||
public static final String ENCHANT_THORNS = PREFIX_ENCHANTS + "thorns.png";
|
||||
public static final String ENCHANT_SHARPNESS = PREFIX_ENCHANTS + "sharpness.png";
|
||||
public static final String ENCHANT_SMITE = PREFIX_ENCHANTS + "smite.png";
|
||||
public static final String ENCHANT_BANE_OF_ARTHROPODS = PREFIX_ENCHANTS + "baneOfAwfulTurds.png";
|
||||
public static final String ENCHANT_KNOCKBACK = PREFIX_ENCHANTS + "knockback.png";
|
||||
public static final String ENCHANT_FIRE_ASPECT = PREFIX_ENCHANTS + "fireAspect.png";
|
||||
public static final String ENCHANT_LOOTING = PREFIX_ENCHANTS + "looting.png";
|
||||
public static final String ENCHANT_EFFICIENCY = PREFIX_ENCHANTS + "efficiency.png";
|
||||
public static final String ENCHANT_SILK_TOUCH = PREFIX_ENCHANTS + "silkTouch.png";
|
||||
public static final String ENCHANT_UNBREAKING = PREFIX_ENCHANTS + "unbreaking.png";
|
||||
public static final String ENCHANT_FORTUNE = PREFIX_ENCHANTS + "fortune.png";
|
||||
public static final String ENCHANT_POWER = PREFIX_ENCHANTS + "power.png";
|
||||
public static final String ENCHANT_PUNCH = PREFIX_ENCHANTS + "punch.png";
|
||||
public static final String ENCHANT_FLAME = PREFIX_ENCHANTS + "flame.png";
|
||||
public static final String ENCHANT_INFINITY = PREFIX_ENCHANTS + "infinity.png";
|
||||
public static final String ENCHANT_LUCK_OF_THE_SEA = PREFIX_ENCHANTS + "luckOfTheSea.png";
|
||||
public static final String ENCHANT_LURE = PREFIX_ENCHANTS + "lure.png";
|
||||
public static final String ENCHANT_POTENCY = PREFIX_ENCHANTS + "potency.png";
|
||||
public static final String ENCHANT_FRUGAL = PREFIX_ENCHANTS + "frugal.png";
|
||||
public static final String ENCHANT_TREASURE = PREFIX_ENCHANTS + "treasure.png";
|
||||
public static final String ENCHANT_HASTE = PREFIX_ENCHANTS + "haste.png";
|
||||
public static final String ENCHANT_REPAIR = PREFIX_ENCHANTS + "repair.png";
|
||||
public static final String ENCHANT_PROTECTION = PREFIX_ENCHANTS + "protection.png";
|
||||
public static final String ENCHANT_FIRE_PROTECTION = PREFIX_ENCHANTS + "fireProtection.png";
|
||||
public static final String ENCHANT_FEATHER_FALLING = PREFIX_ENCHANTS + "featherFalling.png";
|
||||
public static final String ENCHANT_BLAST_PROTECTION = PREFIX_ENCHANTS + "blastProtection.png";
|
||||
public static final String ENCHANT_PROJECTILE_PROTECTION = PREFIX_ENCHANTS + "projectileProtection.png";
|
||||
public static final String ENCHANT_RESPIRATION = PREFIX_ENCHANTS + "respiration.png";
|
||||
public static final String ENCHANT_AQUA_AFFINITY = PREFIX_ENCHANTS + "aquaAffinity.png";
|
||||
public static final String ENCHANT_THORNS = PREFIX_ENCHANTS + "thorns.png";
|
||||
public static final String ENCHANT_SHARPNESS = PREFIX_ENCHANTS + "sharpness.png";
|
||||
public static final String ENCHANT_SMITE = PREFIX_ENCHANTS + "smite.png";
|
||||
public static final String ENCHANT_BANE_OF_ARTHROPODS = PREFIX_ENCHANTS + "baneOfAwfulTurds.png";
|
||||
public static final String ENCHANT_KNOCKBACK = PREFIX_ENCHANTS + "knockback.png";
|
||||
public static final String ENCHANT_FIRE_ASPECT = PREFIX_ENCHANTS + "fireAspect.png";
|
||||
public static final String ENCHANT_LOOTING = PREFIX_ENCHANTS + "looting.png";
|
||||
public static final String ENCHANT_EFFICIENCY = PREFIX_ENCHANTS + "efficiency.png";
|
||||
public static final String ENCHANT_SILK_TOUCH = PREFIX_ENCHANTS + "silkTouch.png";
|
||||
public static final String ENCHANT_UNBREAKING = PREFIX_ENCHANTS + "unbreaking.png";
|
||||
public static final String ENCHANT_FORTUNE = PREFIX_ENCHANTS + "fortune.png";
|
||||
public static final String ENCHANT_POWER = PREFIX_ENCHANTS + "power.png";
|
||||
public static final String ENCHANT_PUNCH = PREFIX_ENCHANTS + "punch.png";
|
||||
public static final String ENCHANT_FLAME = PREFIX_ENCHANTS + "flame.png";
|
||||
public static final String ENCHANT_INFINITY = PREFIX_ENCHANTS + "infinity.png";
|
||||
public static final String ENCHANT_LUCK_OF_THE_SEA = PREFIX_ENCHANTS + "luckOfTheSea.png";
|
||||
public static final String ENCHANT_LURE = PREFIX_ENCHANTS + "lure.png";
|
||||
public static final String ENCHANT_POTENCY = PREFIX_ENCHANTS + "potency.png";
|
||||
public static final String ENCHANT_FRUGAL = PREFIX_ENCHANTS + "frugal.png";
|
||||
public static final String ENCHANT_TREASURE = PREFIX_ENCHANTS + "treasure.png";
|
||||
public static final String ENCHANT_HASTE = PREFIX_ENCHANTS + "haste.png";
|
||||
public static final String ENCHANT_REPAIR = PREFIX_ENCHANTS + "repair.png";
|
||||
|
||||
public static final String ENCHANT_SLOW_FALL = PREFIX_ENCHANTS + "slowFall.png";
|
||||
public static final String ENCHANT_ASCENT_BOOST = PREFIX_ENCHANTS + "ascentBoost.png";
|
||||
public static final String ENCHANT_AUTO_SMELT = PREFIX_ENCHANTS + "autoSmelt.png";
|
||||
public static final String ENCHANT_DESINTEGRATE = PREFIX_ENCHANTS + "desintegrate.png";
|
||||
public static final String ENCHANT_VAMPIRISM = PREFIX_ENCHANTS + "vamprisim.png";
|
||||
public static final String ENCHANT_QUICK_DRAW = PREFIX_ENCHANTS + "quickDraw.png";
|
||||
public static final String ENCHANT_SLOW_FALL = PREFIX_ENCHANTS + "slowFall.png";
|
||||
public static final String ENCHANT_ASCENT_BOOST = PREFIX_ENCHANTS + "ascentBoost.png";
|
||||
public static final String ENCHANT_AUTO_SMELT = PREFIX_ENCHANTS + "autoSmelt.png";
|
||||
public static final String ENCHANT_DESINTEGRATE = PREFIX_ENCHANTS + "desintegrate.png";
|
||||
public static final String ENCHANT_VAMPIRISM = PREFIX_ENCHANTS + "vamprisim.png";
|
||||
public static final String ENCHANT_QUICK_DRAW = PREFIX_ENCHANTS + "quickDraw.png";
|
||||
|
||||
public static final String[] LANGS = {
|
||||
"en_US", "de_DE", "zh_CN", "ru_RU", "ko_KR"
|
||||
};
|
||||
public static final String[] LANGS = {
|
||||
"en_US", "de_DE", "zh_CN", "ru_RU", "ko_KR"
|
||||
};
|
||||
|
||||
public static final String ENCHANT_FOCUSED_STRIKE = PREFIX_ENCHANTS + "focusedStrikes.png";
|
||||
public static final String ENCHANT_DISPERSED_STRIKE = PREFIX_ENCHANTS + "dispersedStrikes.png";
|
||||
public static final String ENCHANT_VALIANCE = PREFIX_ENCHANTS + "valiance.png";
|
||||
public static final String ENCHANT_FINAL_STRIKE = PREFIX_ENCHANTS + "finalStrike.png";
|
||||
public static final String ENCHANT_TUNNEL = PREFIX_ENCHANTS + "tunnel.png";
|
||||
public static final String ENCHANT_FOCUSED_STRIKE = PREFIX_ENCHANTS + "focusedStrikes.png";
|
||||
public static final String ENCHANT_DISPERSED_STRIKE = PREFIX_ENCHANTS + "dispersedStrikes.png";
|
||||
public static final String ENCHANT_VALIANCE = PREFIX_ENCHANTS + "valiance.png";
|
||||
public static final String ENCHANT_FINAL_STRIKE = PREFIX_ENCHANTS + "finalStrike.png";
|
||||
public static final String ENCHANT_TUNNEL = PREFIX_ENCHANTS + "tunnel.png";
|
||||
|
||||
public static final String ENCHANT_SHATTER = PREFIX_ENCHANTS + "shatter.png";
|
||||
public static final String ENCHANT_SHOCKWAVE = PREFIX_ENCHANTS + "shockwave.png";
|
||||
public static final String ENCHANT_POUNCE = PREFIX_ENCHANTS + "pounce.png";
|
||||
public static final String ENCHANT_SHATTER = PREFIX_ENCHANTS + "shatter.png";
|
||||
public static final String ENCHANT_SHOCKWAVE = PREFIX_ENCHANTS + "shockwave.png";
|
||||
public static final String ENCHANT_POUNCE = PREFIX_ENCHANTS + "pounce.png";
|
||||
}
|
||||
@@ -19,70 +19,70 @@ import net.minecraft.client.model.ModelRenderer;
|
||||
|
||||
public class ModelMagnet extends ModelBase {
|
||||
|
||||
ModelRenderer panel;
|
||||
ModelRenderer magnet;
|
||||
ModelRenderer box1;
|
||||
ModelRenderer box2;
|
||||
ModelRenderer box3;
|
||||
ModelRenderer box4;
|
||||
ModelRenderer box5;
|
||||
ModelRenderer panel;
|
||||
ModelRenderer magnet;
|
||||
ModelRenderer box1;
|
||||
ModelRenderer box2;
|
||||
ModelRenderer box3;
|
||||
ModelRenderer box4;
|
||||
ModelRenderer box5;
|
||||
|
||||
public ModelMagnet() {
|
||||
textureWidth = 64;
|
||||
textureHeight = 64;
|
||||
public ModelMagnet() {
|
||||
textureWidth = 64;
|
||||
textureHeight = 64;
|
||||
|
||||
panel = new ModelRenderer(this, 0, 0);
|
||||
panel.addBox(0F, 0F, 0F, 14, 2, 14);
|
||||
panel.setRotationPoint(-7F, 22F, -7F);
|
||||
panel.setTextureSize(64, 64);
|
||||
setRotation(panel, 0F, 0F, 0F);
|
||||
magnet = new ModelRenderer(this, 0, 16);
|
||||
magnet.addBox(0F, 0F, 0F, 4, 13, 4);
|
||||
magnet.setRotationPoint(-2F, 9F, -2F);
|
||||
magnet.setTextureSize(64, 64);
|
||||
setRotation(magnet, 0F, 0F, 0F);
|
||||
box1 = new ModelRenderer(this, 28, 19);
|
||||
box1.addBox(0F, -2F, 0F, 6, 14, 0);
|
||||
box1.setRotationPoint(3F, 10F, -3F);
|
||||
box1.setTextureSize(64, 64);
|
||||
setRotation(box1, 0F, -1.570796F, 0F);
|
||||
box2 = new ModelRenderer(this, 28, 33);
|
||||
box2.addBox(0F, 0F, 0F, 6, 14, 0);
|
||||
box2.setRotationPoint(-3F, 8F, 3F);
|
||||
box2.setTextureSize(64, 64);
|
||||
setRotation(box2, 0F, 1.570796F, 0F);
|
||||
box3 = new ModelRenderer(this, 40, 19);
|
||||
box3.addBox(0F, 0F, 0F, 6, 14, 0);
|
||||
box3.setRotationPoint(3F, 8F, 3F);
|
||||
box3.setTextureSize(64, 64);
|
||||
setRotation(box3, 0F, 3.141593F, 0F);
|
||||
box4 = new ModelRenderer(this, 40, 33);
|
||||
box4.addBox(0F, 0F, 0F, 6, 14, 0);
|
||||
box4.setRotationPoint(-3F, 8F, -3F);
|
||||
box4.setTextureSize(64, 64);
|
||||
setRotation(box4, 0F, 0F, 0F);
|
||||
box5 = new ModelRenderer(this, 28, 49);
|
||||
box5.addBox(0F, 0F, 0F, 6, 0, 6);
|
||||
box5.setRotationPoint(-3F, 8F, -3F);
|
||||
box5.setTextureSize(64, 64);
|
||||
setRotation(box5, 0F, 0F, 0F);
|
||||
}
|
||||
panel = new ModelRenderer(this, 0, 0);
|
||||
panel.addBox(0F, 0F, 0F, 14, 2, 14);
|
||||
panel.setRotationPoint(-7F, 22F, -7F);
|
||||
panel.setTextureSize(64, 64);
|
||||
setRotation(panel, 0F, 0F, 0F);
|
||||
magnet = new ModelRenderer(this, 0, 16);
|
||||
magnet.addBox(0F, 0F, 0F, 4, 13, 4);
|
||||
magnet.setRotationPoint(-2F, 9F, -2F);
|
||||
magnet.setTextureSize(64, 64);
|
||||
setRotation(magnet, 0F, 0F, 0F);
|
||||
box1 = new ModelRenderer(this, 28, 19);
|
||||
box1.addBox(0F, -2F, 0F, 6, 14, 0);
|
||||
box1.setRotationPoint(3F, 10F, -3F);
|
||||
box1.setTextureSize(64, 64);
|
||||
setRotation(box1, 0F, -1.570796F, 0F);
|
||||
box2 = new ModelRenderer(this, 28, 33);
|
||||
box2.addBox(0F, 0F, 0F, 6, 14, 0);
|
||||
box2.setRotationPoint(-3F, 8F, 3F);
|
||||
box2.setTextureSize(64, 64);
|
||||
setRotation(box2, 0F, 1.570796F, 0F);
|
||||
box3 = new ModelRenderer(this, 40, 19);
|
||||
box3.addBox(0F, 0F, 0F, 6, 14, 0);
|
||||
box3.setRotationPoint(3F, 8F, 3F);
|
||||
box3.setTextureSize(64, 64);
|
||||
setRotation(box3, 0F, 3.141593F, 0F);
|
||||
box4 = new ModelRenderer(this, 40, 33);
|
||||
box4.addBox(0F, 0F, 0F, 6, 14, 0);
|
||||
box4.setRotationPoint(-3F, 8F, -3F);
|
||||
box4.setTextureSize(64, 64);
|
||||
setRotation(box4, 0F, 0F, 0F);
|
||||
box5 = new ModelRenderer(this, 28, 49);
|
||||
box5.addBox(0F, 0F, 0F, 6, 0, 6);
|
||||
box5.setRotationPoint(-3F, 8F, -3F);
|
||||
box5.setTextureSize(64, 64);
|
||||
setRotation(box5, 0F, 0F, 0F);
|
||||
}
|
||||
|
||||
public void render() {
|
||||
final float scale = 1F / 16F;
|
||||
public void render() {
|
||||
final float scale = 1F / 16F;
|
||||
|
||||
panel.render(scale);
|
||||
magnet.render(scale);
|
||||
box1.render(scale);
|
||||
box2.render(scale);
|
||||
box3.render(scale);
|
||||
box4.render(scale);
|
||||
box5.render(scale);
|
||||
}
|
||||
panel.render(scale);
|
||||
magnet.render(scale);
|
||||
box1.render(scale);
|
||||
box2.render(scale);
|
||||
box3.render(scale);
|
||||
box4.render(scale);
|
||||
box5.render(scale);
|
||||
}
|
||||
|
||||
private void setRotation(ModelRenderer model, float x, float y, float z) {
|
||||
model.rotateAngleX = x;
|
||||
model.rotateAngleY = y;
|
||||
model.rotateAngleZ = z;
|
||||
}
|
||||
private void setRotation(ModelRenderer model, float x, float y, float z) {
|
||||
model.rotateAngleX = x;
|
||||
model.rotateAngleY = y;
|
||||
model.rotateAngleZ = z;
|
||||
}
|
||||
}
|
||||
@@ -19,70 +19,70 @@ import net.minecraft.client.model.ModelRenderer;
|
||||
|
||||
public class ModelRelay extends ModelBase {
|
||||
|
||||
ModelRenderer panel;
|
||||
ModelRenderer magnet;
|
||||
ModelRenderer box1;
|
||||
ModelRenderer box2;
|
||||
ModelRenderer box3;
|
||||
ModelRenderer box4;
|
||||
ModelRenderer box5;
|
||||
ModelRenderer panel;
|
||||
ModelRenderer magnet;
|
||||
ModelRenderer box1;
|
||||
ModelRenderer box2;
|
||||
ModelRenderer box3;
|
||||
ModelRenderer box4;
|
||||
ModelRenderer box5;
|
||||
|
||||
public ModelRelay() {
|
||||
textureWidth = 64;
|
||||
textureHeight = 64;
|
||||
public ModelRelay() {
|
||||
textureWidth = 64;
|
||||
textureHeight = 64;
|
||||
|
||||
panel = new ModelRenderer(this, 0, 0);
|
||||
panel.addBox(0F, 0F, 0F, 14, 2, 14);
|
||||
panel.setRotationPoint(-7F, 22F, -7F);
|
||||
panel.setTextureSize(64, 64);
|
||||
setRotation(panel, 0F, 0F, 0F);
|
||||
magnet = new ModelRenderer(this, 0, 16);
|
||||
magnet.addBox(0F, 0F, 0F, 4, 13, 4);
|
||||
magnet.setRotationPoint(-2F, 9F, -2F);
|
||||
magnet.setTextureSize(64, 64);
|
||||
setRotation(magnet, 0F, 0F, 0F);
|
||||
box1 = new ModelRenderer(this, 28, 19);
|
||||
box1.addBox(0F, -2F, 0F, 6, 14, 0);
|
||||
box1.setRotationPoint(3F, 10F, -3F);
|
||||
box1.setTextureSize(64, 64);
|
||||
setRotation(box1, 0F, -1.570796F, 0F);
|
||||
box2 = new ModelRenderer(this, 28, 33);
|
||||
box2.addBox(0F, 0F, 0F, 6, 14, 0);
|
||||
box2.setRotationPoint(-3F, 8F, 3F);
|
||||
box2.setTextureSize(64, 64);
|
||||
setRotation(box2, 0F, 1.570796F, 0F);
|
||||
box3 = new ModelRenderer(this, 40, 19);
|
||||
box3.addBox(0F, 0F, 0F, 6, 14, 0);
|
||||
box3.setRotationPoint(3F, 8F, 3F);
|
||||
box3.setTextureSize(64, 64);
|
||||
setRotation(box3, 0F, 3.141593F, 0F);
|
||||
box4 = new ModelRenderer(this, 40, 33);
|
||||
box4.addBox(0F, 0F, 0F, 6, 14, 0);
|
||||
box4.setRotationPoint(-3F, 8F, -3F);
|
||||
box4.setTextureSize(64, 64);
|
||||
setRotation(box4, 0F, 0F, 0F);
|
||||
box5 = new ModelRenderer(this, 28, 49);
|
||||
box5.addBox(0F, 0F, 0F, 6, 0, 6);
|
||||
box5.setRotationPoint(-3F, 8F, -3F);
|
||||
box5.setTextureSize(64, 64);
|
||||
setRotation(box5, 0F, 0F, 0F);
|
||||
}
|
||||
panel = new ModelRenderer(this, 0, 0);
|
||||
panel.addBox(0F, 0F, 0F, 14, 2, 14);
|
||||
panel.setRotationPoint(-7F, 22F, -7F);
|
||||
panel.setTextureSize(64, 64);
|
||||
setRotation(panel, 0F, 0F, 0F);
|
||||
magnet = new ModelRenderer(this, 0, 16);
|
||||
magnet.addBox(0F, 0F, 0F, 4, 13, 4);
|
||||
magnet.setRotationPoint(-2F, 9F, -2F);
|
||||
magnet.setTextureSize(64, 64);
|
||||
setRotation(magnet, 0F, 0F, 0F);
|
||||
box1 = new ModelRenderer(this, 28, 19);
|
||||
box1.addBox(0F, -2F, 0F, 6, 14, 0);
|
||||
box1.setRotationPoint(3F, 10F, -3F);
|
||||
box1.setTextureSize(64, 64);
|
||||
setRotation(box1, 0F, -1.570796F, 0F);
|
||||
box2 = new ModelRenderer(this, 28, 33);
|
||||
box2.addBox(0F, 0F, 0F, 6, 14, 0);
|
||||
box2.setRotationPoint(-3F, 8F, 3F);
|
||||
box2.setTextureSize(64, 64);
|
||||
setRotation(box2, 0F, 1.570796F, 0F);
|
||||
box3 = new ModelRenderer(this, 40, 19);
|
||||
box3.addBox(0F, 0F, 0F, 6, 14, 0);
|
||||
box3.setRotationPoint(3F, 8F, 3F);
|
||||
box3.setTextureSize(64, 64);
|
||||
setRotation(box3, 0F, 3.141593F, 0F);
|
||||
box4 = new ModelRenderer(this, 40, 33);
|
||||
box4.addBox(0F, 0F, 0F, 6, 14, 0);
|
||||
box4.setRotationPoint(-3F, 8F, -3F);
|
||||
box4.setTextureSize(64, 64);
|
||||
setRotation(box4, 0F, 0F, 0F);
|
||||
box5 = new ModelRenderer(this, 28, 49);
|
||||
box5.addBox(0F, 0F, 0F, 6, 0, 6);
|
||||
box5.setRotationPoint(-3F, 8F, -3F);
|
||||
box5.setTextureSize(64, 64);
|
||||
setRotation(box5, 0F, 0F, 0F);
|
||||
}
|
||||
|
||||
public void render() {
|
||||
final float scale = 1F / 16F;
|
||||
public void render() {
|
||||
final float scale = 1F / 16F;
|
||||
|
||||
panel.render(scale);
|
||||
magnet.render(scale);
|
||||
box1.render(scale);
|
||||
box2.render(scale);
|
||||
box3.render(scale);
|
||||
box4.render(scale);
|
||||
box5.render(scale);
|
||||
}
|
||||
panel.render(scale);
|
||||
magnet.render(scale);
|
||||
box1.render(scale);
|
||||
box2.render(scale);
|
||||
box3.render(scale);
|
||||
box4.render(scale);
|
||||
box5.render(scale);
|
||||
}
|
||||
|
||||
private void setRotation(ModelRenderer model, float x, float y, float z) {
|
||||
model.rotateAngleX = x;
|
||||
model.rotateAngleY = y;
|
||||
model.rotateAngleZ = z;
|
||||
}
|
||||
private void setRotation(ModelRenderer model, float x, float y, float z) {
|
||||
model.rotateAngleX = x;
|
||||
model.rotateAngleY = y;
|
||||
model.rotateAngleZ = z;
|
||||
}
|
||||
}
|
||||
@@ -19,154 +19,154 @@ import net.minecraft.client.model.ModelRenderer;
|
||||
|
||||
public class ModelRepairer extends ModelBase {
|
||||
|
||||
ModelRenderer Base;
|
||||
ModelRenderer Support1;
|
||||
ModelRenderer Support2;
|
||||
ModelRenderer Support3;
|
||||
ModelRenderer Support4;
|
||||
ModelRenderer Top1;
|
||||
ModelRenderer Top2;
|
||||
ModelRenderer Top3;
|
||||
ModelRenderer Top4;
|
||||
ModelRenderer Opening1;
|
||||
ModelRenderer Opening2;
|
||||
ModelRenderer Opening3;
|
||||
ModelRenderer Opening4;
|
||||
ModelRenderer Glass1;
|
||||
ModelRenderer Glass2;
|
||||
ModelRenderer Glass3;
|
||||
ModelRenderer Glass4;
|
||||
ModelRenderer Glass5;
|
||||
ModelRenderer Base;
|
||||
ModelRenderer Support1;
|
||||
ModelRenderer Support2;
|
||||
ModelRenderer Support3;
|
||||
ModelRenderer Support4;
|
||||
ModelRenderer Top1;
|
||||
ModelRenderer Top2;
|
||||
ModelRenderer Top3;
|
||||
ModelRenderer Top4;
|
||||
ModelRenderer Opening1;
|
||||
ModelRenderer Opening2;
|
||||
ModelRenderer Opening3;
|
||||
ModelRenderer Opening4;
|
||||
ModelRenderer Glass1;
|
||||
ModelRenderer Glass2;
|
||||
ModelRenderer Glass3;
|
||||
ModelRenderer Glass4;
|
||||
ModelRenderer Glass5;
|
||||
|
||||
public ModelRepairer() {
|
||||
textureWidth = 64;
|
||||
textureHeight = 64;
|
||||
public ModelRepairer() {
|
||||
textureWidth = 64;
|
||||
textureHeight = 64;
|
||||
|
||||
Base = new ModelRenderer(this, 0, 0);
|
||||
Base.addBox(0F, 0F, 0F, 16, 1, 16);
|
||||
Base.setRotationPoint(-8F, 23F, -8F);
|
||||
Base.setTextureSize(64, 64);
|
||||
setRotation(Base, 0F, 0F, 0F);
|
||||
Support1 = new ModelRenderer(this, 0, 17);
|
||||
Support1.addBox(0F, 0F, 0F, 2, 14, 2);
|
||||
Support1.setRotationPoint(-8F, 9F, 6F);
|
||||
Support1.setTextureSize(64, 64);
|
||||
setRotation(Support1, 0F, 0F, 0F);
|
||||
Support2 = new ModelRenderer(this, 0, 17);
|
||||
Support2.addBox(0F, 0F, 0F, 2, 14, 2);
|
||||
Support2.setRotationPoint(6F, 9F, 6F);
|
||||
Support2.setTextureSize(64, 64);
|
||||
setRotation(Support2, 0F, 0F, 0F);
|
||||
Support3 = new ModelRenderer(this, 0, 17);
|
||||
Support3.addBox(0F, 0F, 0F, 2, 14, 2);
|
||||
Support3.setRotationPoint(-8F, 9F, -8F);
|
||||
Support3.setTextureSize(64, 64);
|
||||
setRotation(Support3, 0F, 0F, 0F);
|
||||
Support4 = new ModelRenderer(this, 0, 17);
|
||||
Support4.addBox(0F, 0F, 0F, 2, 14, 2);
|
||||
Support4.setRotationPoint(6F, 9F, -8F);
|
||||
Support4.setTextureSize(64, 64);
|
||||
setRotation(Support4, 0F, 0F, 0F);
|
||||
Top1 = new ModelRenderer(this, 11, 19);
|
||||
Top1.addBox(0F, 0F, 0F, 16, 1, 2);
|
||||
Top1.setRotationPoint(-8F, 8F, -8F);
|
||||
Top1.setTextureSize(64, 64);
|
||||
setRotation(Top1, 0F, 0F, 0F);
|
||||
Top2 = new ModelRenderer(this, 11, 19);
|
||||
Top2.addBox(0F, 0F, 0F, 16, 1, 2);
|
||||
Top2.setRotationPoint(-8F, 8F, 6F);
|
||||
Top2.setTextureSize(64, 64);
|
||||
setRotation(Top2, 0F, 0F, 0F);
|
||||
Top3 = new ModelRenderer(this, 11, 23);
|
||||
Top3.addBox(0F, 0F, 0F, 2, 1, 12);
|
||||
Top3.setRotationPoint(6F, 8F, -6F);
|
||||
Top3.setTextureSize(64, 64);
|
||||
setRotation(Top3, 0F, 0F, 0F);
|
||||
Top4 = new ModelRenderer(this, 11, 23);
|
||||
Top4.addBox(0F, 0F, 0F, 2, 1, 12);
|
||||
Top4.setRotationPoint(-8F, 8F, -6F);
|
||||
Top4.setTextureSize(64, 64);
|
||||
setRotation(Top4, 0F, 0F, 0F);
|
||||
Opening1 = new ModelRenderer(this, 48, 30);
|
||||
Opening1.addBox(0F, 0F, 0F, 5, 1, 1);
|
||||
Opening1.setRotationPoint(-2.5F, 14F, 7F);
|
||||
Opening1.setTextureSize(64, 64);
|
||||
setRotation(Opening1, 0F, 0F, 0F);
|
||||
Opening2 = new ModelRenderer(this, 48, 30);
|
||||
Opening2.addBox(0F, 0F, 0F, 5, 1, 1);
|
||||
Opening2.setRotationPoint(-2.5F, 17F, 7F);
|
||||
Opening2.setTextureSize(64, 64);
|
||||
setRotation(Opening2, 0F, 0F, 0F);
|
||||
Opening3 = new ModelRenderer(this, 48, 24);
|
||||
Opening3.addBox(0F, 0F, 0F, 1, 3, 1);
|
||||
Opening3.setRotationPoint(-2F, 14.5F, 7F);
|
||||
Opening3.setTextureSize(64, 64);
|
||||
setRotation(Opening3, 0F, 0F, 0F);
|
||||
Opening4 = new ModelRenderer(this, 48, 24);
|
||||
Opening4.addBox(0F, 0F, 0F, 1, 3, 1);
|
||||
Opening4.setRotationPoint(1F, 14.5F, 7F);
|
||||
Opening4.setTextureSize(64, 64);
|
||||
setRotation(Opening4, 0F, 0F, 0F);
|
||||
Glass1 = new ModelRenderer(this, -11, 37);
|
||||
Glass1.addBox(0F, 0F, 0F, 12, 0, 12);
|
||||
Glass1.setRotationPoint(-6F, 8.5F, -6F);
|
||||
Glass1.setTextureSize(64, 64);
|
||||
setRotation(Glass1, 0F, 0F, 0F);
|
||||
Glass2 = new ModelRenderer(this, 1, 38);
|
||||
Glass2.addBox(0F, 0F, 0F, 0, 14, 12);
|
||||
Glass2.setRotationPoint(7.5F, 9F, -6F);
|
||||
Glass2.setTextureSize(64, 64);
|
||||
setRotation(Glass2, 0F, 0F, 0F);
|
||||
Glass3 = new ModelRenderer(this, 1, 38);
|
||||
Glass3.addBox(0F, 0F, 0F, 0, 14, 12);
|
||||
Glass3.setRotationPoint(-7.5F, 9F, 6F);
|
||||
Glass3.setTextureSize(64, 64);
|
||||
setRotation(Glass3, 0F, 3.141593F, 0F);
|
||||
Glass4 = new ModelRenderer(this, 40, 34);
|
||||
Glass4.addBox(0F, 0F, 0F, 12, 14, 0);
|
||||
Glass4.setRotationPoint(-6F, 9F, -7.5F);
|
||||
Glass4.setTextureSize(64, 64);
|
||||
setRotation(Glass4, 0F, 0F, 0F);
|
||||
Glass5 = new ModelRenderer(this, 33, 50);
|
||||
Glass5.addBox(0F, 0F, 0F, 12, 14, 0);
|
||||
Glass5.setRotationPoint(6F, 9F, 7.5F);
|
||||
Glass5.setTextureSize(64, 64);
|
||||
setRotation(Glass5, 0F, 3.141593F, 0F);
|
||||
}
|
||||
Base = new ModelRenderer(this, 0, 0);
|
||||
Base.addBox(0F, 0F, 0F, 16, 1, 16);
|
||||
Base.setRotationPoint(-8F, 23F, -8F);
|
||||
Base.setTextureSize(64, 64);
|
||||
setRotation(Base, 0F, 0F, 0F);
|
||||
Support1 = new ModelRenderer(this, 0, 17);
|
||||
Support1.addBox(0F, 0F, 0F, 2, 14, 2);
|
||||
Support1.setRotationPoint(-8F, 9F, 6F);
|
||||
Support1.setTextureSize(64, 64);
|
||||
setRotation(Support1, 0F, 0F, 0F);
|
||||
Support2 = new ModelRenderer(this, 0, 17);
|
||||
Support2.addBox(0F, 0F, 0F, 2, 14, 2);
|
||||
Support2.setRotationPoint(6F, 9F, 6F);
|
||||
Support2.setTextureSize(64, 64);
|
||||
setRotation(Support2, 0F, 0F, 0F);
|
||||
Support3 = new ModelRenderer(this, 0, 17);
|
||||
Support3.addBox(0F, 0F, 0F, 2, 14, 2);
|
||||
Support3.setRotationPoint(-8F, 9F, -8F);
|
||||
Support3.setTextureSize(64, 64);
|
||||
setRotation(Support3, 0F, 0F, 0F);
|
||||
Support4 = new ModelRenderer(this, 0, 17);
|
||||
Support4.addBox(0F, 0F, 0F, 2, 14, 2);
|
||||
Support4.setRotationPoint(6F, 9F, -8F);
|
||||
Support4.setTextureSize(64, 64);
|
||||
setRotation(Support4, 0F, 0F, 0F);
|
||||
Top1 = new ModelRenderer(this, 11, 19);
|
||||
Top1.addBox(0F, 0F, 0F, 16, 1, 2);
|
||||
Top1.setRotationPoint(-8F, 8F, -8F);
|
||||
Top1.setTextureSize(64, 64);
|
||||
setRotation(Top1, 0F, 0F, 0F);
|
||||
Top2 = new ModelRenderer(this, 11, 19);
|
||||
Top2.addBox(0F, 0F, 0F, 16, 1, 2);
|
||||
Top2.setRotationPoint(-8F, 8F, 6F);
|
||||
Top2.setTextureSize(64, 64);
|
||||
setRotation(Top2, 0F, 0F, 0F);
|
||||
Top3 = new ModelRenderer(this, 11, 23);
|
||||
Top3.addBox(0F, 0F, 0F, 2, 1, 12);
|
||||
Top3.setRotationPoint(6F, 8F, -6F);
|
||||
Top3.setTextureSize(64, 64);
|
||||
setRotation(Top3, 0F, 0F, 0F);
|
||||
Top4 = new ModelRenderer(this, 11, 23);
|
||||
Top4.addBox(0F, 0F, 0F, 2, 1, 12);
|
||||
Top4.setRotationPoint(-8F, 8F, -6F);
|
||||
Top4.setTextureSize(64, 64);
|
||||
setRotation(Top4, 0F, 0F, 0F);
|
||||
Opening1 = new ModelRenderer(this, 48, 30);
|
||||
Opening1.addBox(0F, 0F, 0F, 5, 1, 1);
|
||||
Opening1.setRotationPoint(-2.5F, 14F, 7F);
|
||||
Opening1.setTextureSize(64, 64);
|
||||
setRotation(Opening1, 0F, 0F, 0F);
|
||||
Opening2 = new ModelRenderer(this, 48, 30);
|
||||
Opening2.addBox(0F, 0F, 0F, 5, 1, 1);
|
||||
Opening2.setRotationPoint(-2.5F, 17F, 7F);
|
||||
Opening2.setTextureSize(64, 64);
|
||||
setRotation(Opening2, 0F, 0F, 0F);
|
||||
Opening3 = new ModelRenderer(this, 48, 24);
|
||||
Opening3.addBox(0F, 0F, 0F, 1, 3, 1);
|
||||
Opening3.setRotationPoint(-2F, 14.5F, 7F);
|
||||
Opening3.setTextureSize(64, 64);
|
||||
setRotation(Opening3, 0F, 0F, 0F);
|
||||
Opening4 = new ModelRenderer(this, 48, 24);
|
||||
Opening4.addBox(0F, 0F, 0F, 1, 3, 1);
|
||||
Opening4.setRotationPoint(1F, 14.5F, 7F);
|
||||
Opening4.setTextureSize(64, 64);
|
||||
setRotation(Opening4, 0F, 0F, 0F);
|
||||
Glass1 = new ModelRenderer(this, -11, 37);
|
||||
Glass1.addBox(0F, 0F, 0F, 12, 0, 12);
|
||||
Glass1.setRotationPoint(-6F, 8.5F, -6F);
|
||||
Glass1.setTextureSize(64, 64);
|
||||
setRotation(Glass1, 0F, 0F, 0F);
|
||||
Glass2 = new ModelRenderer(this, 1, 38);
|
||||
Glass2.addBox(0F, 0F, 0F, 0, 14, 12);
|
||||
Glass2.setRotationPoint(7.5F, 9F, -6F);
|
||||
Glass2.setTextureSize(64, 64);
|
||||
setRotation(Glass2, 0F, 0F, 0F);
|
||||
Glass3 = new ModelRenderer(this, 1, 38);
|
||||
Glass3.addBox(0F, 0F, 0F, 0, 14, 12);
|
||||
Glass3.setRotationPoint(-7.5F, 9F, 6F);
|
||||
Glass3.setTextureSize(64, 64);
|
||||
setRotation(Glass3, 0F, 3.141593F, 0F);
|
||||
Glass4 = new ModelRenderer(this, 40, 34);
|
||||
Glass4.addBox(0F, 0F, 0F, 12, 14, 0);
|
||||
Glass4.setRotationPoint(-6F, 9F, -7.5F);
|
||||
Glass4.setTextureSize(64, 64);
|
||||
setRotation(Glass4, 0F, 0F, 0F);
|
||||
Glass5 = new ModelRenderer(this, 33, 50);
|
||||
Glass5.addBox(0F, 0F, 0F, 12, 14, 0);
|
||||
Glass5.setRotationPoint(6F, 9F, 7.5F);
|
||||
Glass5.setTextureSize(64, 64);
|
||||
setRotation(Glass5, 0F, 3.141593F, 0F);
|
||||
}
|
||||
|
||||
public void render() {
|
||||
final float scale = 1F / 16F;
|
||||
public void render() {
|
||||
final float scale = 1F / 16F;
|
||||
|
||||
Base.render(scale);
|
||||
Support1.render(scale);
|
||||
Support2.render(scale);
|
||||
Support3.render(scale);
|
||||
Support4.render(scale);
|
||||
Top1.render(scale);
|
||||
Top2.render(scale);
|
||||
Top3.render(scale);
|
||||
Top4.render(scale);
|
||||
Opening1.render(scale);
|
||||
Opening2.render(scale);
|
||||
Opening3.render(scale);
|
||||
Opening4.render(scale);
|
||||
Base.render(scale);
|
||||
Support1.render(scale);
|
||||
Support2.render(scale);
|
||||
Support3.render(scale);
|
||||
Support4.render(scale);
|
||||
Top1.render(scale);
|
||||
Top2.render(scale);
|
||||
Top3.render(scale);
|
||||
Top4.render(scale);
|
||||
Opening1.render(scale);
|
||||
Opening2.render(scale);
|
||||
Opening3.render(scale);
|
||||
Opening4.render(scale);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void renderGlass() {
|
||||
final float scale = 1F / 16F;
|
||||
public void renderGlass() {
|
||||
final float scale = 1F / 16F;
|
||||
|
||||
Glass1.render(scale);
|
||||
Glass2.render(scale);
|
||||
Glass3.render(scale);
|
||||
Glass4.render(scale);
|
||||
Glass5.render(scale);
|
||||
}
|
||||
Glass1.render(scale);
|
||||
Glass2.render(scale);
|
||||
Glass3.render(scale);
|
||||
Glass4.render(scale);
|
||||
Glass5.render(scale);
|
||||
}
|
||||
|
||||
private void setRotation(ModelRenderer model, float x, float y, float z) {
|
||||
model.rotateAngleX = x;
|
||||
model.rotateAngleY = y;
|
||||
model.rotateAngleZ = z;
|
||||
}
|
||||
private void setRotation(ModelRenderer model, float x, float y, float z) {
|
||||
model.rotateAngleX = x;
|
||||
model.rotateAngleY = y;
|
||||
model.rotateAngleZ = z;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -22,74 +22,74 @@ import thaumic.tinkerer.client.core.helper.ClientHelper;
|
||||
|
||||
public class ModelSpinningCubes extends ModelBase {
|
||||
|
||||
ModelRenderer spinningCube;
|
||||
ModelRenderer spinningCube;
|
||||
|
||||
public ModelSpinningCubes() {
|
||||
spinningCube = new ModelRenderer(this, 42, 0);
|
||||
spinningCube.addBox(0F, 0F, 0F, 1, 1, 1);
|
||||
spinningCube.setRotationPoint(0F, 0F, 0F);
|
||||
spinningCube.setTextureSize(64, 64);
|
||||
spinningCube.mirror = true;
|
||||
}
|
||||
public ModelSpinningCubes() {
|
||||
spinningCube = new ModelRenderer(this, 42, 0);
|
||||
spinningCube.addBox(0F, 0F, 0F, 1, 1, 1);
|
||||
spinningCube.setRotationPoint(0F, 0F, 0F);
|
||||
spinningCube.setTextureSize(64, 64);
|
||||
spinningCube.mirror = true;
|
||||
}
|
||||
|
||||
public void render() {
|
||||
// NO-OP
|
||||
}
|
||||
public void render() {
|
||||
// NO-OP
|
||||
}
|
||||
|
||||
public void renderSpinningCubes(int cubes, int repeat, int origRepeat) {
|
||||
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||
public void renderSpinningCubes(int cubes, int repeat, int origRepeat) {
|
||||
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||
|
||||
final float modifier = 6F;
|
||||
final float rotationModifier = 0.25F;
|
||||
final float radiusBase = 0.7F;
|
||||
final float radiusMod = 0.1F;
|
||||
final float modifier = 6F;
|
||||
final float rotationModifier = 0.25F;
|
||||
final float radiusBase = 0.7F;
|
||||
final float radiusMod = 0.1F;
|
||||
|
||||
double ticks = ClientHelper.clientPlayer().ticksExisted - 0.75 * (origRepeat - repeat);
|
||||
float offsetPerCube = 360 / cubes;
|
||||
double ticks = ClientHelper.clientPlayer().ticksExisted - 0.75 * (origRepeat - repeat);
|
||||
float offsetPerCube = 360 / cubes;
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(-0.025F, 0.85F, -0.025F);
|
||||
for (int i = 0; i < cubes; i++) {
|
||||
float offset = offsetPerCube * i;
|
||||
float deg = (int) (ticks / rotationModifier % 360F + offset);
|
||||
float rad = deg * (float) Math.PI / 180F;
|
||||
float radiusX = (float) (radiusBase + radiusMod * Math.sin(ticks / modifier));
|
||||
float radiusZ = (float) (radiusBase + radiusMod * Math.cos(ticks / modifier));
|
||||
float x = (float) (radiusX * Math.cos(rad));
|
||||
float z = (float) (radiusZ * Math.sin(rad));
|
||||
float y = (float) Math.cos((ticks + 50 * i) / 5F) / 10F;
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(-0.025F, 0.85F, -0.025F);
|
||||
for (int i = 0; i < cubes; i++) {
|
||||
float offset = offsetPerCube * i;
|
||||
float deg = (int) (ticks / rotationModifier % 360F + offset);
|
||||
float rad = deg * (float) Math.PI / 180F;
|
||||
float radiusX = (float) (radiusBase + radiusMod * Math.sin(ticks / modifier));
|
||||
float radiusZ = (float) (radiusBase + radiusMod * Math.cos(ticks / modifier));
|
||||
float x = (float) (radiusX * Math.cos(rad));
|
||||
float z = (float) (radiusZ * Math.sin(rad));
|
||||
float y = (float) Math.cos((ticks + 50 * i) / 5F) / 10F;
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(x, y, z);
|
||||
float xRotate = (float) Math.sin(ticks * rotationModifier) / 2F;
|
||||
float yRotate = (float) Math.max(0.6F, Math.sin(ticks * 0.1F) / 2F + 0.5F);
|
||||
float zRotate = (float) Math.cos(ticks * rotationModifier) / 2F;
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(x, y, z);
|
||||
float xRotate = (float) Math.sin(ticks * rotationModifier) / 2F;
|
||||
float yRotate = (float) Math.max(0.6F, Math.sin(ticks * 0.1F) / 2F + 0.5F);
|
||||
float zRotate = (float) Math.cos(ticks * rotationModifier) / 2F;
|
||||
|
||||
GL11.glRotatef(deg, xRotate, yRotate, zRotate);
|
||||
if (repeat < origRepeat) {
|
||||
GL11.glColor4f(1F, 1F, 1F, 0.2F);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
} else GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
GL11.glRotatef(deg, xRotate, yRotate, zRotate);
|
||||
if (repeat < origRepeat) {
|
||||
GL11.glColor4f(1F, 1F, 1F, 0.2F);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
} else GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
|
||||
int light = 15728880;
|
||||
int lightmapX = light % 65536;
|
||||
int lightmapY = light / 65536;
|
||||
int light = 15728880;
|
||||
int lightmapX = light % 65536;
|
||||
int lightmapY = light / 65536;
|
||||
|
||||
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, lightmapX, lightmapY);
|
||||
spinningCube.render(1F / 16F);
|
||||
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, lightmapX, lightmapY);
|
||||
spinningCube.render(1F / 16F);
|
||||
|
||||
if (repeat < origRepeat)
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
if (repeat < origRepeat)
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
GL11.glPopMatrix();
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
GL11.glPopMatrix();
|
||||
|
||||
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||
|
||||
if (repeat != 0)
|
||||
renderSpinningCubes(cubes, repeat - 1, origRepeat);
|
||||
}
|
||||
if (repeat != 0)
|
||||
renderSpinningCubes(cubes, repeat - 1, origRepeat);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -24,71 +24,71 @@ import net.minecraft.item.ItemStack;
|
||||
|
||||
public class ModelWings extends ModelBiped {
|
||||
|
||||
ModelRenderer Wing1;
|
||||
ModelRenderer Wing2;
|
||||
ModelRenderer Wing1;
|
||||
ModelRenderer Wing2;
|
||||
|
||||
public ModelWings() {
|
||||
super(1F);
|
||||
textureWidth = 64;
|
||||
textureHeight = 32;
|
||||
public ModelWings() {
|
||||
super(1F);
|
||||
textureWidth = 64;
|
||||
textureHeight = 32;
|
||||
|
||||
Wing1 = new ModelRenderer(this, 16, -12);
|
||||
Wing1.addBox(0F, 0F, 0F, 0, 7, 12);
|
||||
Wing1.setRotationPoint(-2F, 1F, 2F);
|
||||
setRotation(Wing1, 0F, -0.6108652F, 0F);
|
||||
bipedBody.addChild(Wing1);
|
||||
Wing1 = new ModelRenderer(this, 16, -12);
|
||||
Wing1.addBox(0F, 0F, 0F, 0, 7, 12);
|
||||
Wing1.setRotationPoint(-2F, 1F, 2F);
|
||||
setRotation(Wing1, 0F, -0.6108652F, 0F);
|
||||
bipedBody.addChild(Wing1);
|
||||
|
||||
Wing2 = new ModelRenderer(this, 16, -12);
|
||||
Wing2.addBox(0.1F, 0F, 0F, 0, 7, 12);
|
||||
Wing2.setRotationPoint(2F, 1F, 2F);
|
||||
setRotation(Wing2, 0F, 0.4468043F, 0F);
|
||||
bipedBody.addChild(Wing2);
|
||||
}
|
||||
Wing2 = new ModelRenderer(this, 16, -12);
|
||||
Wing2.addBox(0.1F, 0F, 0F, 0, 7, 12);
|
||||
Wing2.setRotationPoint(2F, 1F, 2F);
|
||||
setRotation(Wing2, 0F, 0.4468043F, 0F);
|
||||
bipedBody.addChild(Wing2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(Entity entity, float v1, float v2, float v3, float v4, float v5, float v6) {
|
||||
setRotationAngles(v1, v2, v3, v4, v5, v6, entity);
|
||||
@Override
|
||||
public void render(Entity entity, float v1, float v2, float v3, float v4, float v5, float v6) {
|
||||
setRotationAngles(v1, v2, v3, v4, v5, v6, entity);
|
||||
|
||||
bipedHead.showModel = false;
|
||||
bipedHeadwear.showModel = false;
|
||||
bipedLeftLeg.showModel = false;
|
||||
bipedRightLeg.showModel = false;
|
||||
bipedHead.showModel = false;
|
||||
bipedHeadwear.showModel = false;
|
||||
bipedLeftLeg.showModel = false;
|
||||
bipedRightLeg.showModel = false;
|
||||
|
||||
super.render(entity, v1, v2, v3, v4, v5, v6);
|
||||
}
|
||||
super.render(entity, v1, v2, v3, v4, v5, v6);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRotationAngles(float v1, float v2, float v3, float v4, float v5, float v6, Entity entity) {
|
||||
EntityLivingBase living = (EntityLivingBase) entity;
|
||||
isSneak = living != null && living.isSneaking();
|
||||
if (living != null && living instanceof EntityPlayer) {
|
||||
EntityPlayer player = (EntityPlayer) living;
|
||||
@Override
|
||||
public void setRotationAngles(float v1, float v2, float v3, float v4, float v5, float v6, Entity entity) {
|
||||
EntityLivingBase living = (EntityLivingBase) entity;
|
||||
isSneak = living != null && living.isSneaking();
|
||||
if (living != null && living instanceof EntityPlayer) {
|
||||
EntityPlayer player = (EntityPlayer) living;
|
||||
|
||||
ItemStack itemstack = player.inventory.getCurrentItem();
|
||||
heldItemRight = itemstack != null ? 1 : 0;
|
||||
ItemStack itemstack = player.inventory.getCurrentItem();
|
||||
heldItemRight = itemstack != null ? 1 : 0;
|
||||
|
||||
if (itemstack != null && player.getItemInUseCount() > 0) {
|
||||
EnumAction enumaction = itemstack.getItemUseAction();
|
||||
if (itemstack != null && player.getItemInUseCount() > 0) {
|
||||
EnumAction enumaction = itemstack.getItemUseAction();
|
||||
|
||||
if (enumaction == EnumAction.block)
|
||||
heldItemRight = 3;
|
||||
else if (enumaction == EnumAction.bow)
|
||||
aimedBow = true;
|
||||
}
|
||||
if (enumaction == EnumAction.block)
|
||||
heldItemRight = 3;
|
||||
else if (enumaction == EnumAction.bow)
|
||||
aimedBow = true;
|
||||
}
|
||||
|
||||
if (player.capabilities.isFlying) {
|
||||
Wing1.rotateAngleY = (float) ((Math.sin(entity.ticksExisted) + 1) * (Math.PI / 180F) * 15 - 0.6108652F);
|
||||
Wing2.rotateAngleY = -Wing1.rotateAngleY;
|
||||
}
|
||||
}
|
||||
if (player.capabilities.isFlying) {
|
||||
Wing1.rotateAngleY = (float) ((Math.sin(entity.ticksExisted) + 1) * (Math.PI / 180F) * 15 - 0.6108652F);
|
||||
Wing2.rotateAngleY = -Wing1.rotateAngleY;
|
||||
}
|
||||
}
|
||||
|
||||
super.setRotationAngles(v1, v2, v3, v4, v5, v6, entity);
|
||||
}
|
||||
super.setRotationAngles(v1, v2, v3, v4, v5, v6, entity);
|
||||
}
|
||||
|
||||
private void setRotation(ModelRenderer model, float x, float y, float z) {
|
||||
model.rotateAngleX = x;
|
||||
model.rotateAngleY = y;
|
||||
model.rotateAngleZ = z;
|
||||
}
|
||||
private void setRotation(ModelRenderer model, float x, float y, float z) {
|
||||
model.rotateAngleX = x;
|
||||
model.rotateAngleY = y;
|
||||
model.rotateAngleZ = z;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -4,16 +4,11 @@ import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
import thaumic.tinkerer.client.core.proxy.TTClientProxy;
|
||||
import thaumic.tinkerer.client.lib.LibRenderIDs;
|
||||
import thaumic.tinkerer.common.block.BlockInfusedGrain;
|
||||
import thaumic.tinkerer.common.item.ItemInfusedSeeds;
|
||||
|
||||
/**
|
||||
* Created by pixlepix on 8/4/14.
|
||||
|
||||
@@ -26,29 +26,29 @@ import thaumic.tinkerer.common.block.tile.TileMagnet;
|
||||
|
||||
public class RenderMagnet implements ISimpleBlockRenderingHandler {
|
||||
|
||||
@Override
|
||||
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) {
|
||||
RenderTileMagnet.mob = metadata == 1;
|
||||
@Override
|
||||
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) {
|
||||
RenderTileMagnet.mob = metadata == 1;
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
|
||||
TileEntityRendererDispatcher.instance.renderTileEntityAt(new TileMagnet(), 0.0D, 0.0D, 0.0D, 0.0F);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
|
||||
TileEntityRendererDispatcher.instance.renderTileEntityAt(new TileMagnet(), 0.0D, 0.0D, 0.0D, 0.0F);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRender3DInInventory(int modelId) {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean shouldRender3DInInventory(int modelId) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderId() {
|
||||
return LibRenderIDs.idMagnet;
|
||||
}
|
||||
@Override
|
||||
public int getRenderId() {
|
||||
return LibRenderIDs.idMagnet;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -25,27 +25,27 @@ import thaumic.tinkerer.common.block.tile.TileRepairer;
|
||||
|
||||
public class RenderRepairer implements ISimpleBlockRenderingHandler {
|
||||
|
||||
@Override
|
||||
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
|
||||
TileEntityRendererDispatcher.instance.renderTileEntityAt(new TileRepairer(), 0.0D, 0.0D, 0.0D, 0.0F);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
@Override
|
||||
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
|
||||
TileEntityRendererDispatcher.instance.renderTileEntityAt(new TileRepairer(), 0.0D, 0.0D, 0.0D, 0.0F);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRender3DInInventory(int modelId) {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean shouldRender3DInInventory(int modelId) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderId() {
|
||||
return LibRenderIDs.idRepairer;
|
||||
}
|
||||
@Override
|
||||
public int getRenderId() {
|
||||
return LibRenderIDs.idRepairer;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -27,51 +27,51 @@ import thaumic.tinkerer.common.block.kami.BlockWarpGate;
|
||||
|
||||
public class RenderWarpGate extends BlockRenderer implements ISimpleBlockRenderingHandler {
|
||||
|
||||
@Override
|
||||
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) {
|
||||
block.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
|
||||
IIcon topIcon = BlockWarpGate.icons[0];
|
||||
IIcon sideIcon = BlockWarpGate.icons[1];
|
||||
@Override
|
||||
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) {
|
||||
block.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
|
||||
IIcon topIcon = BlockWarpGate.icons[0];
|
||||
IIcon sideIcon = BlockWarpGate.icons[1];
|
||||
|
||||
drawFaces(renderer, block, sideIcon, topIcon, sideIcon, sideIcon, sideIcon, sideIcon, false);
|
||||
GL11.glColor3f(1F, 1F, 1F);
|
||||
drawFaces(renderer, block, sideIcon, topIcon, sideIcon, sideIcon, sideIcon, sideIcon, false);
|
||||
GL11.glColor3f(1F, 1F, 1F);
|
||||
|
||||
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
|
||||
Tessellator t = Tessellator.instance;
|
||||
t.startDrawingQuads();
|
||||
t.setBrightness(255);
|
||||
t.setNormal(0, 1, 0);
|
||||
renderer.renderFaceYPos(block, 0, 0, 0, BlockWarpGate.icons[2]);
|
||||
t.draw();
|
||||
GL11.glTranslatef(0.5F, 0.5F, 0.5F);
|
||||
}
|
||||
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
|
||||
Tessellator t = Tessellator.instance;
|
||||
t.startDrawingQuads();
|
||||
t.setBrightness(255);
|
||||
t.setNormal(0, 1, 0);
|
||||
renderer.renderFaceYPos(block, 0, 0, 0, BlockWarpGate.icons[2]);
|
||||
t.draw();
|
||||
GL11.glTranslatef(0.5F, 0.5F, 0.5F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
|
||||
block.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
|
||||
renderer.setRenderBoundsFromBlock(block);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
@Override
|
||||
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
|
||||
block.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
|
||||
renderer.setRenderBoundsFromBlock(block);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
|
||||
Tessellator t = Tessellator.instance;
|
||||
t.setColorOpaque_I(0xFFFFFF);
|
||||
t.setBrightness(255);
|
||||
renderer.renderFaceYPos(block, x, y, z, BlockWarpGate.icons[2]);
|
||||
Tessellator t = Tessellator.instance;
|
||||
t.setColorOpaque_I(0xFFFFFF);
|
||||
t.setBrightness(255);
|
||||
renderer.renderFaceYPos(block, x, y, z, BlockWarpGate.icons[2]);
|
||||
|
||||
renderer.clearOverrideBlockTexture();
|
||||
block.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
renderer.clearOverrideBlockTexture();
|
||||
block.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRender3DInInventory(int modelId) {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean shouldRender3DInInventory(int modelId) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderId() {
|
||||
return LibRenderIDs.idWarpGate;
|
||||
}
|
||||
@Override
|
||||
public int getRenderId() {
|
||||
return LibRenderIDs.idWarpGate;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
package thaumic.tinkerer.client.render.item;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.renderer.ItemRenderer;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.entity.RenderItem;
|
||||
@@ -11,11 +10,8 @@ import net.minecraft.util.IIcon;
|
||||
import net.minecraftforge.client.IItemRenderer;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
import thaumic.tinkerer.common.ThaumicTinkerer;
|
||||
import thaumic.tinkerer.common.item.ItemInfusedSeeds;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
/**
|
||||
* Created by pixlepix on 8/6/14.
|
||||
*/
|
||||
|
||||
@@ -14,85 +14,85 @@ import thaumic.tinkerer.common.item.ItemMobDisplay;
|
||||
|
||||
public class RenderMobDisplay implements IItemRenderer {
|
||||
|
||||
@Override
|
||||
public boolean handleRenderType(ItemStack itemStack, ItemRenderType itemRenderType) {
|
||||
return true;
|
||||
}
|
||||
private static RenderItem renderItem = new RenderItem();
|
||||
|
||||
@Override
|
||||
public boolean shouldUseRenderHelper(ItemRenderType itemRenderType, ItemStack itemStack, ItemRendererHelper itemRendererHelper) {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean handleRenderType(ItemStack itemStack, ItemRenderType itemRenderType) {
|
||||
return true;
|
||||
}
|
||||
|
||||
private static RenderItem renderItem = new RenderItem();
|
||||
@Override
|
||||
public boolean shouldUseRenderHelper(ItemRenderType itemRenderType, ItemStack itemStack, ItemRendererHelper itemRendererHelper) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderItem(ItemRenderType itemRenderType, ItemStack itemStack, Object... objects) {
|
||||
ItemMobDisplay item = (ItemMobDisplay) itemStack.getItem();
|
||||
EnumMobAspect aspect = item.getEntityType(itemStack);
|
||||
Entity entity = null;
|
||||
float f1 = 0.4f;
|
||||
float verticalOffset = 0.0f;
|
||||
if (aspect != null) {
|
||||
entity = EnumMobAspect.getEntityFromCache(aspect, null);
|
||||
f1 = aspect.getScale();
|
||||
verticalOffset = aspect.getVerticalOffset();
|
||||
}
|
||||
switch (itemRenderType) {
|
||||
@Override
|
||||
public void renderItem(ItemRenderType itemRenderType, ItemStack itemStack, Object... objects) {
|
||||
ItemMobDisplay item = (ItemMobDisplay) itemStack.getItem();
|
||||
EnumMobAspect aspect = item.getEntityType(itemStack);
|
||||
Entity entity = null;
|
||||
float f1 = 0.4f;
|
||||
float verticalOffset = 0.0f;
|
||||
if (aspect != null) {
|
||||
entity = EnumMobAspect.getEntityFromCache(aspect, null);
|
||||
f1 = aspect.getScale();
|
||||
verticalOffset = aspect.getVerticalOffset();
|
||||
}
|
||||
switch (itemRenderType) {
|
||||
|
||||
case ENTITY:
|
||||
case ENTITY:
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(0.5, 0.2 + verticalOffset, 0.5);
|
||||
GL11.glRotatef(-30.0F, 1.0F, 0.0F, 0.0F);
|
||||
GL11.glTranslatef(0.0F, -0.4F, 0.0F);
|
||||
GL11.glScalef(f1, f1, f1);
|
||||
EntityItem eItem = (EntityItem) objects[1];
|
||||
if (entity != null) {
|
||||
entity.worldObj = (Minecraft.getMinecraft() != null) ? Minecraft.getMinecraft().theWorld : null;
|
||||
if (entity.worldObj != null) {
|
||||
Render renderer = RenderManager.instance.getEntityRenderObject(entity);
|
||||
entity.setWorld(eItem.worldObj);
|
||||
entity.copyLocationAndAnglesFrom(eItem);
|
||||
if (renderer != null && renderer.getFontRendererFromRenderManager() != null) {
|
||||
GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
|
||||
//if (renderWithLighting) RenderUtils.enableLightmap();
|
||||
renderer.doRender(entity, 0, 0, 0, 0, 0);
|
||||
GL11.glPopAttrib();
|
||||
}
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(0.5, 0.2 + verticalOffset, 0.5);
|
||||
GL11.glRotatef(-30.0F, 1.0F, 0.0F, 0.0F);
|
||||
GL11.glTranslatef(0.0F, -0.4F, 0.0F);
|
||||
GL11.glScalef(f1, f1, f1);
|
||||
EntityItem eItem = (EntityItem) objects[1];
|
||||
if (entity != null) {
|
||||
entity.worldObj = (Minecraft.getMinecraft() != null) ? Minecraft.getMinecraft().theWorld : null;
|
||||
if (entity.worldObj != null) {
|
||||
Render renderer = RenderManager.instance.getEntityRenderObject(entity);
|
||||
entity.setWorld(eItem.worldObj);
|
||||
entity.copyLocationAndAnglesFrom(eItem);
|
||||
if (renderer != null && renderer.getFontRendererFromRenderManager() != null) {
|
||||
GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
|
||||
//if (renderWithLighting) RenderUtils.enableLightmap();
|
||||
renderer.doRender(entity, 0, 0, 0, 0, 0);
|
||||
GL11.glPopAttrib();
|
||||
}
|
||||
|
||||
}
|
||||
entity.worldObj = null;
|
||||
}
|
||||
GL11.glPopMatrix();
|
||||
case EQUIPPED:
|
||||
break;
|
||||
case EQUIPPED_FIRST_PERSON:
|
||||
break;
|
||||
case INVENTORY:
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(0.5, 0.2 + verticalOffset, 0.5);
|
||||
GL11.glRotatef(-30.0F, 1.0F, 0.0F, 0.0F);
|
||||
GL11.glTranslatef(0.0F, -0.4F, 0.0F);
|
||||
GL11.glScalef(f1, f1, f1);
|
||||
if (entity != null) {
|
||||
entity.worldObj = (Minecraft.getMinecraft() != null) ? Minecraft.getMinecraft().theWorld : null;
|
||||
if (entity.worldObj != null) {
|
||||
Render renderer = RenderManager.instance.getEntityRenderObject(entity);
|
||||
if (renderer != null && renderer.getFontRendererFromRenderManager() != null) {
|
||||
GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
|
||||
//if (renderWithLighting) RenderUtils.enableLightmap();
|
||||
renderer.doRender(entity, 0, 0, 0, 0, 0);
|
||||
GL11.glPopAttrib();
|
||||
}
|
||||
}
|
||||
entity.worldObj = null;
|
||||
}
|
||||
GL11.glPopMatrix();
|
||||
case EQUIPPED:
|
||||
break;
|
||||
case EQUIPPED_FIRST_PERSON:
|
||||
break;
|
||||
case INVENTORY:
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(0.5, 0.2 + verticalOffset, 0.5);
|
||||
GL11.glRotatef(-30.0F, 1.0F, 0.0F, 0.0F);
|
||||
GL11.glTranslatef(0.0F, -0.4F, 0.0F);
|
||||
GL11.glScalef(f1, f1, f1);
|
||||
if (entity != null) {
|
||||
entity.worldObj = (Minecraft.getMinecraft() != null) ? Minecraft.getMinecraft().theWorld : null;
|
||||
if (entity.worldObj != null) {
|
||||
Render renderer = RenderManager.instance.getEntityRenderObject(entity);
|
||||
if (renderer != null && renderer.getFontRendererFromRenderManager() != null) {
|
||||
GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
|
||||
//if (renderWithLighting) RenderUtils.enableLightmap();
|
||||
renderer.doRender(entity, 0, 0, 0, 0, 0);
|
||||
GL11.glPopAttrib();
|
||||
}
|
||||
|
||||
}
|
||||
entity.worldObj = null;
|
||||
}
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
entity.worldObj = null;
|
||||
}
|
||||
GL11.glPopMatrix();
|
||||
|
||||
case FIRST_PERSON_MAP:
|
||||
break;
|
||||
}
|
||||
}
|
||||
case FIRST_PERSON_MAP:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -13,66 +13,66 @@ import thaumic.tinkerer.common.item.kami.ItemPlacementMirror;
|
||||
|
||||
public class RenderPlacementMirror implements IItemRenderer {
|
||||
|
||||
RenderItem render = new RenderItem();
|
||||
ItemRenderer renderer = new ItemRenderer(Minecraft.getMinecraft());
|
||||
RenderItem render = new RenderItem();
|
||||
ItemRenderer renderer = new ItemRenderer(Minecraft.getMinecraft());
|
||||
|
||||
@Override
|
||||
public boolean handleRenderType(ItemStack item, ItemRenderType type) {
|
||||
//return type != ItemRenderType.INVENTORY && type!=ItemRenderType.ENTITY;
|
||||
//return type != ItemRenderType.INVENTORY ;
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean handleRenderType(ItemStack item, ItemRenderType type) {
|
||||
//return type != ItemRenderType.INVENTORY && type!=ItemRenderType.ENTITY;
|
||||
//return type != ItemRenderType.INVENTORY ;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) {
|
||||
return type == ItemRenderType.ENTITY || type == ItemRenderType.INVENTORY;
|
||||
}
|
||||
@Override
|
||||
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) {
|
||||
return type == ItemRenderType.ENTITY || type == ItemRenderType.INVENTORY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
|
||||
switch (type) {
|
||||
case ENTITY: {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(-0.5F, 0F, 0F);
|
||||
renderItem(ItemRenderType.EQUIPPED, item, data);
|
||||
GL11.glPopMatrix();
|
||||
break;
|
||||
}
|
||||
case EQUIPPED: {
|
||||
for (int i = 1; i >= 0; i--) {
|
||||
IIcon icon = ThaumicTinkerer.registry.getFirstItemFromClass(ItemPlacementMirror.class).getIconFromDamageForRenderPass(0, i);
|
||||
if (i == 0) {
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
}
|
||||
@Override
|
||||
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
|
||||
switch (type) {
|
||||
case ENTITY: {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(-0.5F, 0F, 0F);
|
||||
renderItem(ItemRenderType.EQUIPPED, item, data);
|
||||
GL11.glPopMatrix();
|
||||
break;
|
||||
}
|
||||
case EQUIPPED: {
|
||||
for (int i = 1; i >= 0; i--) {
|
||||
IIcon icon = ThaumicTinkerer.registry.getFirstItemFromClass(ItemPlacementMirror.class).getIconFromDamageForRenderPass(0, i);
|
||||
if (i == 0) {
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
}
|
||||
|
||||
float f = icon.getMinU();
|
||||
float f1 = icon.getMaxU();
|
||||
float f2 = icon.getMinV();
|
||||
float f3 = icon.getMaxV();
|
||||
ItemRenderer.renderItemIn2D(Tessellator.instance, f1, f2, f, f3, icon.getIconWidth(), icon.getIconHeight(), 1F / 16F);
|
||||
}
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
break;
|
||||
}
|
||||
case EQUIPPED_FIRST_PERSON: {
|
||||
renderItem(ItemRenderType.EQUIPPED, item, data);
|
||||
break;
|
||||
}
|
||||
case INVENTORY: {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glRotatef(45f, 0f, 1f, 0f);
|
||||
GL11.glScalef(1.5f, 1.8f, 1.8f);
|
||||
GL11.glRotatef(-45f, 0f, 0f, 1f);
|
||||
GL11.glTranslatef(-0.46F, -0.58F, 0F);
|
||||
float f = icon.getMinU();
|
||||
float f1 = icon.getMaxU();
|
||||
float f2 = icon.getMinV();
|
||||
float f3 = icon.getMaxV();
|
||||
ItemRenderer.renderItemIn2D(Tessellator.instance, f1, f2, f, f3, icon.getIconWidth(), icon.getIconHeight(), 1F / 16F);
|
||||
}
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
break;
|
||||
}
|
||||
case EQUIPPED_FIRST_PERSON: {
|
||||
renderItem(ItemRenderType.EQUIPPED, item, data);
|
||||
break;
|
||||
}
|
||||
case INVENTORY: {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glRotatef(45f, 0f, 1f, 0f);
|
||||
GL11.glScalef(1.5f, 1.8f, 1.8f);
|
||||
GL11.glRotatef(-45f, 0f, 0f, 1f);
|
||||
GL11.glTranslatef(-0.46F, -0.58F, 0F);
|
||||
|
||||
renderItem(ItemRenderType.EQUIPPED, item, data);
|
||||
GL11.glPopMatrix();
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
renderItem(ItemRenderType.EQUIPPED, item, data);
|
||||
GL11.glPopMatrix();
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -31,96 +31,96 @@ import thaumic.tinkerer.common.block.tile.tablet.TileAnimationTablet;
|
||||
|
||||
public class RenderTileAnimationTablet extends TileEntitySpecialRenderer {
|
||||
|
||||
private static final ResourceLocation overlayCenter = new ResourceLocation(LibResources.MISC_AT_CENTER);
|
||||
private static final ResourceLocation overlayLeft = new ResourceLocation(LibResources.MISC_AT_LEFT);
|
||||
private static final ResourceLocation overlayRight = new ResourceLocation(LibResources.MISC_AT_RIGHT);
|
||||
private static final ResourceLocation overlayIndent = new ResourceLocation(LibResources.MISC_AT_INDENT);
|
||||
private static final ResourceLocation overlayCenter = new ResourceLocation(LibResources.MISC_AT_CENTER);
|
||||
private static final ResourceLocation overlayLeft = new ResourceLocation(LibResources.MISC_AT_LEFT);
|
||||
private static final ResourceLocation overlayRight = new ResourceLocation(LibResources.MISC_AT_RIGHT);
|
||||
private static final ResourceLocation overlayIndent = new ResourceLocation(LibResources.MISC_AT_INDENT);
|
||||
|
||||
private static final float[][] TRANSLATIONS = new float[][]{
|
||||
{ 0F, 0F, -1F },
|
||||
{ -1F, 0F, 0F },
|
||||
{ 0F, 0F, 0F },
|
||||
{ -1F, 0F, -1F }
|
||||
};
|
||||
private static final float[][] TRANSLATIONS = new float[][]{
|
||||
{0F, 0F, -1F},
|
||||
{-1F, 0F, 0F},
|
||||
{0F, 0F, 0F},
|
||||
{-1F, 0F, -1F}
|
||||
};
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tileentity, double d0, double d1, double d2, float partialTicks) {
|
||||
TileAnimationTablet tile = (TileAnimationTablet) tileentity;
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tileentity, double d0, double d1, double d2, float partialTicks) {
|
||||
TileAnimationTablet tile = (TileAnimationTablet) tileentity;
|
||||
|
||||
int meta = tile.getBlockMetadata() & 7;
|
||||
if (meta < 2)
|
||||
meta = 2; // Just in case
|
||||
int meta = tile.getBlockMetadata() & 7;
|
||||
if (meta < 2)
|
||||
meta = 2; // Just in case
|
||||
|
||||
int rotation = meta == 2 ? 270 : meta == 3 ? 90 : meta == 4 ? 0 : 180;
|
||||
int rotation = meta == 2 ? 270 : meta == 3 ? 90 : meta == 4 ? 0 : 180;
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(d0, d1, d2);
|
||||
renderOverlay(tile, overlayCenter, -1, false, false, 0.65, 0.13F, 0F);
|
||||
if (tile.leftClick)
|
||||
renderOverlay(tile, overlayLeft, 1, false, true, 1, 0.13F, 0F);
|
||||
else renderOverlay(tile, overlayRight, 1, false, true, 1, 0.131F, 0F);
|
||||
renderOverlay(tile, overlayIndent, 0, false, false, 0.5F, 0.13F, rotation + 90F);
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(d0, d1, d2);
|
||||
renderOverlay(tile, overlayCenter, -1, false, false, 0.65, 0.13F, 0F);
|
||||
if (tile.leftClick)
|
||||
renderOverlay(tile, overlayLeft, 1, false, true, 1, 0.13F, 0F);
|
||||
else renderOverlay(tile, overlayRight, 1, false, true, 1, 0.131F, 0F);
|
||||
renderOverlay(tile, overlayIndent, 0, false, false, 0.5F, 0.13F, rotation + 90F);
|
||||
|
||||
GL11.glRotatef(rotation, 0F, 1F, 0F);
|
||||
GL11.glTranslated(0.1, 0.2 + Math.cos(System.currentTimeMillis() / 600D) / 18F, 0.5);
|
||||
float[] translations = TRANSLATIONS[meta - 2];
|
||||
GL11.glTranslatef(translations[0], translations[1], translations[2]);
|
||||
GL11.glScalef(0.8F, 0.8F, 0.8F);
|
||||
GL11.glTranslatef(0.5F, 0F, 0.5F);
|
||||
GL11.glRotatef(tile.swingProgress, 0F, 0F, 1F);
|
||||
GL11.glTranslatef(-0.5F, 0F, -0.5F);
|
||||
GL11.glTranslatef(-tile.swingProgress / 250F, tile.swingProgress / 1000F, 0F);
|
||||
GL11.glRotatef((float) Math.cos(System.currentTimeMillis() / 400F) * 5F, 1F, 0F, 1F);
|
||||
renderItem(tile);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
GL11.glRotatef(rotation, 0F, 1F, 0F);
|
||||
GL11.glTranslated(0.1, 0.2 + Math.cos(System.currentTimeMillis() / 600D) / 18F, 0.5);
|
||||
float[] translations = TRANSLATIONS[meta - 2];
|
||||
GL11.glTranslatef(translations[0], translations[1], translations[2]);
|
||||
GL11.glScalef(0.8F, 0.8F, 0.8F);
|
||||
GL11.glTranslatef(0.5F, 0F, 0.5F);
|
||||
GL11.glRotatef(tile.swingProgress, 0F, 0F, 1F);
|
||||
GL11.glTranslatef(-0.5F, 0F, -0.5F);
|
||||
GL11.glTranslatef(-tile.swingProgress / 250F, tile.swingProgress / 1000F, 0F);
|
||||
GL11.glRotatef((float) Math.cos(System.currentTimeMillis() / 400F) * 5F, 1F, 0F, 1F);
|
||||
renderItem(tile);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
private void renderItem(TileAnimationTablet tablet) {
|
||||
ItemStack stack = tablet.getStackInSlot(0);
|
||||
if (stack != null) {
|
||||
EntityItem entityitem = new EntityItem(tablet.getWorldObj(), 0.0D, 0.0D, 0.0D, stack);
|
||||
entityitem.getEntityItem().stackSize = 1;
|
||||
entityitem.hoverStart = 0.0F;
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(0.5F, 0.55F, 0F);
|
||||
if (stack.getItem() instanceof ItemBlock)
|
||||
GL11.glScalef(2.5F, 2.5F, 2.5F);
|
||||
else
|
||||
GL11.glScalef(1.5F, 1.5F, 1.5F);
|
||||
RenderItem.renderInFrame = true;
|
||||
RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
|
||||
RenderItem.renderInFrame = false;
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
private void renderItem(TileAnimationTablet tablet) {
|
||||
ItemStack stack = tablet.getStackInSlot(0);
|
||||
if (stack != null) {
|
||||
EntityItem entityitem = new EntityItem(tablet.getWorldObj(), 0.0D, 0.0D, 0.0D, stack);
|
||||
entityitem.getEntityItem().stackSize = 1;
|
||||
entityitem.hoverStart = 0.0F;
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(0.5F, 0.55F, 0F);
|
||||
if (stack.getItem() instanceof ItemBlock)
|
||||
GL11.glScalef(2.5F, 2.5F, 2.5F);
|
||||
else
|
||||
GL11.glScalef(1.5F, 1.5F, 1.5F);
|
||||
RenderItem.renderInFrame = true;
|
||||
RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
|
||||
RenderItem.renderInFrame = false;
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
|
||||
private void renderOverlay(TileAnimationTablet tablet, ResourceLocation texture, int rotationMod, boolean useLighting, boolean useBlend, double size, float height, float forceDeg) {
|
||||
Minecraft mc = ClientHelper.minecraft();
|
||||
mc.renderEngine.bindTexture(texture);
|
||||
GL11.glPushMatrix();
|
||||
GL11.glDepthMask(false);
|
||||
if (!useLighting)
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
if (useBlend) {
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
}
|
||||
GL11.glTranslatef(0.5F, height, 0.5F);
|
||||
float deg = rotationMod == 0 ? forceDeg : (float) (tablet.ticksExisted * rotationMod % 360F);
|
||||
GL11.glRotatef(deg, 0F, 1F, 0F);
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
Tessellator tess = Tessellator.instance;
|
||||
double size1 = size / 2;
|
||||
double size2 = -size1;
|
||||
tess.startDrawingQuads();
|
||||
tess.addVertexWithUV(size2, 0, size1, 0, 1);
|
||||
tess.addVertexWithUV(size1, 0, size1, 1, 1);
|
||||
tess.addVertexWithUV(size1, 0, size2, 1, 0);
|
||||
tess.addVertexWithUV(size2, 0, size2, 0, 0);
|
||||
tess.draw();
|
||||
GL11.glDepthMask(true);
|
||||
if (!useLighting)
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
private void renderOverlay(TileAnimationTablet tablet, ResourceLocation texture, int rotationMod, boolean useLighting, boolean useBlend, double size, float height, float forceDeg) {
|
||||
Minecraft mc = ClientHelper.minecraft();
|
||||
mc.renderEngine.bindTexture(texture);
|
||||
GL11.glPushMatrix();
|
||||
GL11.glDepthMask(false);
|
||||
if (!useLighting)
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
if (useBlend) {
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
}
|
||||
GL11.glTranslatef(0.5F, height, 0.5F);
|
||||
float deg = rotationMod == 0 ? forceDeg : (float) (tablet.ticksExisted * rotationMod % 360F);
|
||||
GL11.glRotatef(deg, 0F, 1F, 0F);
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
Tessellator tess = Tessellator.instance;
|
||||
double size1 = size / 2;
|
||||
double size2 = -size1;
|
||||
tess.startDrawingQuads();
|
||||
tess.addVertexWithUV(size2, 0, size1, 0, 1);
|
||||
tess.addVertexWithUV(size1, 0, size1, 1, 1);
|
||||
tess.addVertexWithUV(size1, 0, size2, 1, 0);
|
||||
tess.addVertexWithUV(size2, 0, size2, 0, 0);
|
||||
tess.draw();
|
||||
GL11.glDepthMask(true);
|
||||
if (!useLighting)
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
@@ -31,63 +31,63 @@ import java.awt.*;
|
||||
|
||||
public class RenderTileEnchanter extends TileEntitySpecialRenderer {
|
||||
|
||||
ItemWandRenderer wandRenderer = new ItemWandRenderer();
|
||||
ItemWandRenderer wandRenderer = new ItemWandRenderer();
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tileentity, double d0, double d1, double d2, float partTicks) {
|
||||
TileEnchanter enchanter = (TileEnchanter) tileentity;
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tileentity, double d0, double d1, double d2, float partTicks) {
|
||||
TileEnchanter enchanter = (TileEnchanter) tileentity;
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(d0, d1 + 0.75, d2);
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(d0, d1 + 0.75, d2);
|
||||
|
||||
ItemStack item = enchanter.getStackInSlot(0);
|
||||
if (item != null) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glRotatef(90F, 1F, 0F, 0F);
|
||||
final float scale = 0.7F;
|
||||
GL11.glScalef(scale, scale, scale);
|
||||
GL11.glTranslatef(0.6F, -0.2F, 0F);
|
||||
GL11.glRotatef(30F, 0F, 0F, 1F);
|
||||
ItemStack item = enchanter.getStackInSlot(0);
|
||||
if (item != null) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glRotatef(90F, 1F, 0F, 0F);
|
||||
final float scale = 0.7F;
|
||||
GL11.glScalef(scale, scale, scale);
|
||||
GL11.glTranslatef(0.6F, -0.2F, 0F);
|
||||
GL11.glRotatef(30F, 0F, 0F, 1F);
|
||||
|
||||
ClientHelper.minecraft().renderEngine.bindTexture(TextureMap.locationItemsTexture);
|
||||
ClientHelper.minecraft().renderEngine.bindTexture(TextureMap.locationItemsTexture);
|
||||
|
||||
int renderPass = 0;
|
||||
do {
|
||||
IIcon icon = item.getItem().getIcon(item, renderPass);
|
||||
if (icon != null) {
|
||||
Color color = new Color(item.getItem().getColorFromItemStack(item, renderPass));
|
||||
GL11.glColor3ub((byte) color.getRed(), (byte) color.getGreen(), (byte) color.getBlue());
|
||||
float f = icon.getMinU();
|
||||
float f1 = icon.getMaxU();
|
||||
float f2 = icon.getMinV();
|
||||
float f3 = icon.getMaxV();
|
||||
ItemRenderer.renderItemIn2D(Tessellator.instance, f1, f2, f, f3, icon.getIconWidth(), icon.getIconHeight(), 1F / 16F);
|
||||
GL11.glColor3f(1F, 1F, 1F);
|
||||
}
|
||||
renderPass++;
|
||||
} while (renderPass < item.getItem().getRenderPasses(item.getItemDamage()));
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
int renderPass = 0;
|
||||
do {
|
||||
IIcon icon = item.getItem().getIcon(item, renderPass);
|
||||
if (icon != null) {
|
||||
Color color = new Color(item.getItem().getColorFromItemStack(item, renderPass));
|
||||
GL11.glColor3ub((byte) color.getRed(), (byte) color.getGreen(), (byte) color.getBlue());
|
||||
float f = icon.getMinU();
|
||||
float f1 = icon.getMaxU();
|
||||
float f2 = icon.getMinV();
|
||||
float f3 = icon.getMaxV();
|
||||
ItemRenderer.renderItemIn2D(Tessellator.instance, f1, f2, f, f3, icon.getIconWidth(), icon.getIconHeight(), 1F / 16F);
|
||||
GL11.glColor3f(1F, 1F, 1F);
|
||||
}
|
||||
renderPass++;
|
||||
} while (renderPass < item.getItem().getRenderPasses(item.getItemDamage()));
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
item = enchanter.getStackInSlot(1);
|
||||
if (item != null) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glRotatef(90F, 1F, 0F, 0F);
|
||||
final float scale = 0.5F;
|
||||
GL11.glScalef(scale, scale, scale);
|
||||
GL11.glTranslatef(0.6F, 1.5F, -0.1F);
|
||||
GL11.glRotatef(-70F, 0F, 0F, 1F);
|
||||
long millis = System.currentTimeMillis();
|
||||
item = enchanter.getStackInSlot(1);
|
||||
if (item != null) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glRotatef(90F, 1F, 0F, 0F);
|
||||
final float scale = 0.5F;
|
||||
GL11.glScalef(scale, scale, scale);
|
||||
GL11.glTranslatef(0.6F, 1.5F, -0.1F);
|
||||
GL11.glRotatef(-70F, 0F, 0F, 1F);
|
||||
long millis = System.currentTimeMillis();
|
||||
|
||||
GL11.glTranslatef(0F, 0F, (float) (Math.cos((double) millis / 1000F) - 1.2F) / 10F);
|
||||
GL11.glTranslatef(0F, 0.325F, 0F);
|
||||
GL11.glRotatef((float) Math.cos((double) millis / 500F) * 5F, 1F, 0F, 0F);
|
||||
GL11.glTranslatef(0F, -0.325F, 0F);
|
||||
GL11.glTranslatef(0F, 0F, (float) (Math.cos((double) millis / 1000F) - 1.2F) / 10F);
|
||||
GL11.glTranslatef(0F, 0.325F, 0F);
|
||||
GL11.glRotatef((float) Math.cos((double) millis / 500F) * 5F, 1F, 0F, 0F);
|
||||
GL11.glTranslatef(0F, -0.325F, 0F);
|
||||
|
||||
wandRenderer.renderItem(ItemRenderType.ENTITY, item, (Object[]) null);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
wandRenderer.renderItem(ItemRenderType.ENTITY, item, (Object[]) null);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
@@ -25,24 +25,24 @@ import thaumic.tinkerer.common.block.tile.TileFunnel;
|
||||
|
||||
public class RenderTileFunnel extends TileEntitySpecialRenderer {
|
||||
|
||||
BlockJarRenderer jarRenderer = new BlockJarRenderer();
|
||||
ItemJarFilledRenderer jarRenderer1 = new ItemJarFilledRenderer();
|
||||
BlockJarRenderer jarRenderer = new BlockJarRenderer();
|
||||
ItemJarFilledRenderer jarRenderer1 = new ItemJarFilledRenderer();
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tileentity, double d0, double d1, double d2, float f) {
|
||||
TileFunnel funnel = (TileFunnel) tileentity;
|
||||
ItemStack stack = funnel.getStackInSlot(0);
|
||||
if (stack != null) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(d0 + 0.5, d1 + 0.365, d2 + 0.5);
|
||||
//if(Block.getBlockFromItem(stack.getItem())== ConfigBlocks.blockJar) {
|
||||
// GL11.glTranslatef(0F, 0.25F, 0F);
|
||||
// jarRenderer.renderInventoryBlock(ConfigBlocks.blockJar, 0, 0, new RenderBlocks());
|
||||
//}
|
||||
// else
|
||||
jarRenderer1.renderItem(IItemRenderer.ItemRenderType.ENTITY, stack, (Object[]) null);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tileentity, double d0, double d1, double d2, float f) {
|
||||
TileFunnel funnel = (TileFunnel) tileentity;
|
||||
ItemStack stack = funnel.getStackInSlot(0);
|
||||
if (stack != null) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(d0 + 0.5, d1 + 0.365, d2 + 0.5);
|
||||
//if(Block.getBlockFromItem(stack.getItem())== ConfigBlocks.blockJar) {
|
||||
// GL11.glTranslatef(0F, 0.25F, 0F);
|
||||
// jarRenderer.renderInventoryBlock(ConfigBlocks.blockJar, 0, 0, new RenderBlocks());
|
||||
//}
|
||||
// else
|
||||
jarRenderer1.renderItem(IItemRenderer.ItemRenderType.ENTITY, stack, (Object[]) null);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -30,49 +30,48 @@ import thaumic.tinkerer.client.model.ModelMagnet;
|
||||
|
||||
public class RenderTileMagnet extends TileEntitySpecialRenderer {
|
||||
|
||||
public static boolean mob = false;
|
||||
ModelMagnet model = new ModelMagnet();
|
||||
private static final ResourceLocation blue = new ResourceLocation(LibResources.MODEL_MAGNET_S);
|
||||
private static final ResourceLocation red = new ResourceLocation(LibResources.MODEL_MAGNET_N);
|
||||
private static final ResourceLocation blueMob = new ResourceLocation(LibResources.MODEL_MOB_MAGNET_S);
|
||||
private static final ResourceLocation redMob = new ResourceLocation(LibResources.MODEL_MOB_MAGNET_N);
|
||||
public static boolean mob = false;
|
||||
ModelMagnet model = new ModelMagnet();
|
||||
|
||||
private static final ResourceLocation blue = new ResourceLocation(LibResources.MODEL_MAGNET_S);
|
||||
private static final ResourceLocation red = new ResourceLocation(LibResources.MODEL_MAGNET_N);
|
||||
private static final ResourceLocation blueMob = new ResourceLocation(LibResources.MODEL_MOB_MAGNET_S);
|
||||
private static final ResourceLocation redMob = new ResourceLocation(LibResources.MODEL_MOB_MAGNET_N);
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float f) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
GL11.glTranslatef((float) x, (float) y, (float) z);
|
||||
boolean blue = tileentity.getWorldObj() == null || (tileentity.getBlockMetadata() & 1) == 0;
|
||||
boolean mob = tileentity.getWorldObj() == null ? RenderTileMagnet.mob : (tileentity.getBlockMetadata() & 2) == 2;
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float f) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
GL11.glTranslatef((float) x, (float) y, (float) z);
|
||||
boolean blue = tileentity.getWorldObj() == null || (tileentity.getBlockMetadata() & 1) == 0;
|
||||
boolean mob = tileentity.getWorldObj() == null ? RenderTileMagnet.mob : (tileentity.getBlockMetadata() & 2) == 2;
|
||||
ClientHelper.minecraft().renderEngine.bindTexture(mob ? blue ? blueMob : redMob : blue ? RenderTileMagnet.blue : red);
|
||||
|
||||
ClientHelper.minecraft().renderEngine.bindTexture(mob ? blue ? blueMob : redMob : blue ? RenderTileMagnet.blue : red);
|
||||
int redstone = 0;
|
||||
if (tileentity.getWorldObj() != null) {
|
||||
for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS)
|
||||
redstone = Math.max(redstone, tileentity.getWorldObj().getIndirectPowerLevelTo(tileentity.xCoord + dir.offsetX, tileentity.yCoord + dir.offsetY, tileentity.zCoord + dir.offsetZ, dir.ordinal()));
|
||||
} else redstone = 15;
|
||||
|
||||
int redstone = 0;
|
||||
if (tileentity.getWorldObj() != null) {
|
||||
for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS)
|
||||
redstone = Math.max(redstone, tileentity.getWorldObj().getIndirectPowerLevelTo(tileentity.xCoord + dir.offsetX, tileentity.yCoord + dir.offsetY, tileentity.zCoord + dir.offsetZ, dir.ordinal()));
|
||||
} else redstone = 15;
|
||||
GL11.glTranslatef(0.5F, 1.5F, 0.5F);
|
||||
GL11.glScalef(1F, -1F, -1F);
|
||||
model.render();
|
||||
|
||||
GL11.glTranslatef(0.5F, 1.5F, 0.5F);
|
||||
GL11.glScalef(1F, -1F, -1F);
|
||||
model.render();
|
||||
GL11.glRotatef(90F, 1F, 0F, 0F);
|
||||
GL11.glTranslatef(0F, 0F, -0.6F);
|
||||
IIcon icon = ((ItemHoverHarness) ConfigItems.itemHoverHarness).iconLightningRing;
|
||||
|
||||
GL11.glRotatef(90F, 1F, 0F, 0F);
|
||||
GL11.glTranslatef(0F, 0F, -0.6F);
|
||||
IIcon icon = ((ItemHoverHarness) ConfigItems.itemHoverHarness).iconLightningRing;
|
||||
for (int i = 0; i < 3; i++) {
|
||||
for (int j = 0; j < 2; j++) {
|
||||
GL11.glScalef(1F, -1F, 1F);
|
||||
UtilsFX.renderQuadCenteredFromIcon(false, icon, redstone / 15F * 0.7F + (redstone == 0 ? 0 : 0.4F), blue ? 0F : 1F, 0F, blue ? 1F : 0F, 225, GL11.GL_ONE_MINUS_SRC_ALPHA, 0.9F);
|
||||
}
|
||||
|
||||
for (int i = 0; i < 3; i++) {
|
||||
for (int j = 0; j < 2; j++) {
|
||||
GL11.glScalef(1F, -1F, 1F);
|
||||
UtilsFX.renderQuadCenteredFromIcon(false, icon, redstone / 15F * 0.7F + (redstone == 0 ? 0 : 0.4F), blue ? 0F : 1F, 0F, blue ? 1F : 0F, 225, GL11.GL_ONE_MINUS_SRC_ALPHA, 0.9F);
|
||||
}
|
||||
GL11.glTranslated(0, 0, -(Math.cos(System.currentTimeMillis() / 500F) + 1) * 0.09 - 0.1);
|
||||
}
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
|
||||
GL11.glTranslated(0, 0, -(Math.cos(System.currentTimeMillis() / 500F) + 1) * 0.09 - 0.1);
|
||||
}
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
@@ -25,21 +25,20 @@ import thaumic.tinkerer.client.model.ModelRelay;
|
||||
|
||||
public class RenderTileRelay extends TileEntitySpecialRenderer {
|
||||
|
||||
ModelRelay model = new ModelRelay();
|
||||
private static final ResourceLocation texture = new ResourceLocation(LibResources.MODEL_RELAY_TEXTURE);
|
||||
ModelRelay model = new ModelRelay();
|
||||
|
||||
private static final ResourceLocation texture = new ResourceLocation(LibResources.MODEL_RELAY_TEXTURE);
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float f) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
GL11.glTranslatef((float) x, (float) y, (float) z);
|
||||
ClientHelper.minecraft().renderEngine.bindTexture(texture);
|
||||
GL11.glTranslatef(0.5F, 1.5F, 0.5F);
|
||||
GL11.glScalef(1F, -1F, -1F);
|
||||
model.render();
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float f) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
GL11.glTranslatef((float) x, (float) y, (float) z);
|
||||
ClientHelper.minecraft().renderEngine.bindTexture(texture);
|
||||
GL11.glTranslatef(0.5F, 1.5F, 0.5F);
|
||||
GL11.glScalef(1F, -1F, -1F);
|
||||
model.render();
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
@@ -34,103 +34,102 @@ import java.awt.*;
|
||||
|
||||
public class RenderTileRepairer extends TileEntitySpecialRenderer {
|
||||
|
||||
ModelRepairer model = new ModelRepairer();
|
||||
private static final ResourceLocation modelTex = new ResourceLocation(LibResources.MODEL_REPAIRER);
|
||||
private static final ResourceLocation repair = new ResourceLocation(LibResources.MISC_REPAIR);
|
||||
private static final ResourceLocation repairOff = new ResourceLocation(LibResources.MISC_REPAIR_OFF);
|
||||
ModelRepairer model = new ModelRepairer();
|
||||
|
||||
private static final ResourceLocation modelTex = new ResourceLocation(LibResources.MODEL_REPAIRER);
|
||||
private static final ResourceLocation repair = new ResourceLocation(LibResources.MISC_REPAIR);
|
||||
private static final ResourceLocation repairOff = new ResourceLocation(LibResources.MISC_REPAIR_OFF);
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float t) {
|
||||
int meta = tileentity.getWorldObj() == null ? 3 : tileentity.getBlockMetadata();
|
||||
int rotation = meta == 2 ? 0 : meta == 3 ? 180 : meta == 4 ? 270 : 90;
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float t) {
|
||||
int meta = tileentity.getWorldObj() == null ? 3 : tileentity.getBlockMetadata();
|
||||
int rotation = meta == 2 ? 0 : meta == 3 ? 180 : meta == 4 ? 270 : 90;
|
||||
TileRepairer repairer = (TileRepairer) tileentity;
|
||||
|
||||
TileRepairer repairer = (TileRepairer) tileentity;
|
||||
GL11.glPushMatrix();
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
GL11.glTranslatef((float) x, (float) y, (float) z);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
bindTexture(modelTex);
|
||||
GL11.glTranslatef(0F, 2F, 1F);
|
||||
GL11.glScalef(1F, -1F, -1F);
|
||||
GL11.glTranslatef(0.5F, 0.5F, 0.5F);
|
||||
GL11.glRotatef(rotation, 0F, 1F, 0F);
|
||||
model.render();
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
GL11.glScalef(1F, -1F, -1F);
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
GL11.glTranslatef((float) x, (float) y, (float) z);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
bindTexture(modelTex);
|
||||
GL11.glTranslatef(0F, 2F, 1F);
|
||||
GL11.glScalef(1F, -1F, -1F);
|
||||
GL11.glTranslatef(0.5F, 0.5F, 0.5F);
|
||||
GL11.glRotatef(rotation, 0F, 1F, 0F);
|
||||
model.render();
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
GL11.glScalef(1F, -1F, -1F);
|
||||
ItemStack item = ((TileRepairer) tileentity).getStackInSlot(0);
|
||||
if (item != null) {
|
||||
GL11.glPushMatrix();
|
||||
final float scale = 0.5F;
|
||||
GL11.glScalef(scale, scale, scale);
|
||||
GL11.glTranslatef(-0.5F, (float) (-2.5F + Math.sin(repairer.ticksExisted / 10F) * 0.1F), 0F);
|
||||
|
||||
ItemStack item = ((TileRepairer) tileentity).getStackInSlot(0);
|
||||
if (item != null) {
|
||||
GL11.glPushMatrix();
|
||||
final float scale = 0.5F;
|
||||
GL11.glScalef(scale, scale, scale);
|
||||
GL11.glTranslatef(-0.5F, (float) (-2.5F + Math.sin(repairer.ticksExisted / 10F) * 0.1F), 0F);
|
||||
float deg = repairer.ticksExisted * 0.75F % 360F;
|
||||
GL11.glTranslatef(1F / 2F, 1F / 2F, 1F / 32F);
|
||||
GL11.glRotatef(deg, 0F, 1F, 0F);
|
||||
GL11.glTranslatef(-1F / 2F, -1F / 2F, -1F / 32F);
|
||||
|
||||
float deg = repairer.ticksExisted * 0.75F % 360F;
|
||||
GL11.glTranslatef(1F / 2F, 1F / 2F, 1F / 32F);
|
||||
GL11.glRotatef(deg, 0F, 1F, 0F);
|
||||
GL11.glTranslatef(-1F / 2F, -1F / 2F, -1F / 32F);
|
||||
bindTexture(TextureMap.locationItemsTexture);
|
||||
|
||||
bindTexture(TextureMap.locationItemsTexture);
|
||||
int renderPass = 0;
|
||||
do {
|
||||
IIcon icon = item.getItem().getIcon(item, renderPass);
|
||||
if (icon != null) {
|
||||
Color color = new Color(item.getItem().getColorFromItemStack(item, renderPass));
|
||||
GL11.glColor3ub((byte) color.getRed(), (byte) color.getGreen(), (byte) color.getBlue());
|
||||
float f = icon.getMinU();
|
||||
float f1 = icon.getMaxU();
|
||||
float f2 = icon.getMinV();
|
||||
float f3 = icon.getMaxV();
|
||||
ItemRenderer.renderItemIn2D(Tessellator.instance, f1, f2, f, f3, icon.getIconWidth(), icon.getIconHeight(), 1F / 16F);
|
||||
GL11.glColor3f(1F, 1F, 1F);
|
||||
}
|
||||
renderPass++;
|
||||
} while (renderPass < item.getItem().getRenderPasses(item.getItemDamage()));
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
int renderPass = 0;
|
||||
do {
|
||||
IIcon icon = item.getItem().getIcon(item, renderPass);
|
||||
if (icon != null) {
|
||||
Color color = new Color(item.getItem().getColorFromItemStack(item, renderPass));
|
||||
GL11.glColor3ub((byte) color.getRed(), (byte) color.getGreen(), (byte) color.getBlue());
|
||||
float f = icon.getMinU();
|
||||
float f1 = icon.getMaxU();
|
||||
float f2 = icon.getMinV();
|
||||
float f3 = icon.getMaxV();
|
||||
ItemRenderer.renderItemIn2D(Tessellator.instance, f1, f2, f, f3, icon.getIconWidth(), icon.getIconHeight(), 1F / 16F);
|
||||
GL11.glColor3f(1F, 1F, 1F);
|
||||
}
|
||||
renderPass++;
|
||||
} while (renderPass < item.getItem().getRenderPasses(item.getItemDamage()));
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
bindTexture(modelTex);
|
||||
GL11.glScalef(1F, -1F, -1F);
|
||||
GL11.glRotatef(rotation, 0F, 1F, 0F);
|
||||
model.renderGlass();
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
GL11.glScalef(1F, -1F, -1F);
|
||||
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
bindTexture(modelTex);
|
||||
GL11.glScalef(1F, -1F, -1F);
|
||||
GL11.glRotatef(rotation, 0F, 1F, 0F);
|
||||
model.renderGlass();
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
GL11.glScalef(1F, -1F, -1F);
|
||||
renderOverlay((TileRepairer) tileentity, ((TileRepairer) tileentity).tookLastTick ? repair : repairOff, 1.25F);
|
||||
GL11.glPopMatrix();
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
}
|
||||
|
||||
renderOverlay((TileRepairer) tileentity, ((TileRepairer) tileentity).tookLastTick ? repair : repairOff, 1.25F);
|
||||
GL11.glPopMatrix();
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
}
|
||||
|
||||
private void renderOverlay(TileRepairer tablet, ResourceLocation texture, double size) {
|
||||
Minecraft mc = ClientHelper.minecraft();
|
||||
mc.renderEngine.bindTexture(texture);
|
||||
GL11.glPushMatrix();
|
||||
GL11.glDepthMask(false);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
GL11.glTranslatef(0F, -0.525F, 0F);
|
||||
float deg = tablet.ticksExisted * 0.75F % 360F;
|
||||
GL11.glRotatef(deg, 0F, 1F, 0F);
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
Tessellator tess = Tessellator.instance;
|
||||
double size1 = size / 2;
|
||||
double size2 = -size1;
|
||||
tess.startDrawingQuads();
|
||||
tess.addVertexWithUV(size2, 0, size1, 0, 1);
|
||||
tess.addVertexWithUV(size1, 0, size1, 1, 1);
|
||||
tess.addVertexWithUV(size1, 0, size2, 1, 0);
|
||||
tess.addVertexWithUV(size2, 0, size2, 0, 0);
|
||||
tess.draw();
|
||||
GL11.glDepthMask(true);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
private void renderOverlay(TileRepairer tablet, ResourceLocation texture, double size) {
|
||||
Minecraft mc = ClientHelper.minecraft();
|
||||
mc.renderEngine.bindTexture(texture);
|
||||
GL11.glPushMatrix();
|
||||
GL11.glDepthMask(false);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
GL11.glTranslatef(0F, -0.525F, 0F);
|
||||
float deg = tablet.ticksExisted * 0.75F % 360F;
|
||||
GL11.glRotatef(deg, 0F, 1F, 0F);
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
Tessellator tess = Tessellator.instance;
|
||||
double size1 = size / 2;
|
||||
double size2 = -size1;
|
||||
tess.startDrawingQuads();
|
||||
tess.addVertexWithUV(size2, 0, size1, 0, 1);
|
||||
tess.addVertexWithUV(size1, 0, size1, 1, 1);
|
||||
tess.addVertexWithUV(size1, 0, size2, 1, 0);
|
||||
tess.addVertexWithUV(size2, 0, size2, 0, 0);
|
||||
tess.draw();
|
||||
GL11.glDepthMask(true);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -21,17 +21,17 @@ import thaumic.tinkerer.client.model.kami.ModelSpinningCubes;
|
||||
|
||||
public class RenderTileWarpGate extends TileEntitySpecialRenderer {
|
||||
|
||||
ModelSpinningCubes cubes = new ModelSpinningCubes();
|
||||
ModelSpinningCubes cubes = new ModelSpinningCubes();
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float f) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
GL11.glTranslated(x + 0.5, y + 2.5, z + 0.5);
|
||||
GL11.glRotatef(180F, 1F, 0F, 1F);
|
||||
int repeat = 5;
|
||||
cubes.renderSpinningCubes(12, repeat, repeat);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float f) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
GL11.glTranslated(x + 0.5, y + 2.5, z + 0.5);
|
||||
GL11.glRotatef(180F, 1F, 0F, 1F);
|
||||
int repeat = 5;
|
||||
cubes.renderSpinningCubes(12, repeat, repeat);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -25,13 +25,9 @@ import cpw.mods.fml.common.network.NetworkRegistry;
|
||||
import cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper;
|
||||
import net.minecraft.command.ICommandManager;
|
||||
import net.minecraft.command.ServerCommandManager;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraftforge.common.DimensionManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import thaumcraft.api.ThaumcraftApi;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
import thaumcraft.api.aspects.AspectList;
|
||||
import thaumcraft.common.CommonProxy;
|
||||
import thaumcraft.common.Thaumcraft;
|
||||
import thaumic.tinkerer.api.InterModCommsOperations;
|
||||
@@ -50,62 +46,62 @@ import java.util.Arrays;
|
||||
@Mod(modid = LibMisc.MOD_ID, name = LibMisc.MOD_NAME, version = LibMisc.VERSION, dependencies = LibMisc.DEPENDENCIES)
|
||||
public class ThaumicTinkerer {
|
||||
|
||||
@Instance(LibMisc.MOD_ID)
|
||||
public static ThaumicTinkerer instance;
|
||||
@Instance(LibMisc.MOD_ID)
|
||||
public static ThaumicTinkerer instance;
|
||||
|
||||
@SidedProxy(clientSide = LibMisc.CLIENT_PROXY, serverSide = LibMisc.COMMON_PROXY)
|
||||
public static TTCommonProxy proxy;
|
||||
@SidedProxy(clientSide = LibMisc.CLIENT_PROXY, serverSide = LibMisc.COMMON_PROXY)
|
||||
public static TTCommonProxy proxy;
|
||||
|
||||
public static CommonProxy tcProxy;
|
||||
public static SimpleNetworkWrapper netHandler = NetworkRegistry.INSTANCE.newSimpleChannel(LibMisc.MOD_ID + "|B");
|
||||
public static CommonProxy tcProxy;
|
||||
public static SimpleNetworkWrapper netHandler = NetworkRegistry.INSTANCE.newSimpleChannel(LibMisc.MOD_ID + "|B");
|
||||
|
||||
public static TTRegistry registry = new TTRegistry();
|
||||
public static TTRegistry registry = new TTRegistry();
|
||||
|
||||
public static Logger log;
|
||||
|
||||
@EventHandler
|
||||
public void preInit(FMLPreInitializationEvent event) {
|
||||
log=event.getModLog();
|
||||
tcProxy = Thaumcraft.proxy;
|
||||
proxy.preInit(event);
|
||||
if (Loader.isModLoaded("Waila")) {
|
||||
FMLInterModComms.sendMessage("Waila", "register", "thaumic.tinkerer.common.compat.TTinkererProvider.callbackRegister");
|
||||
}
|
||||
@EventHandler
|
||||
public void preInit(FMLPreInitializationEvent event) {
|
||||
log = event.getModLog();
|
||||
tcProxy = Thaumcraft.proxy;
|
||||
proxy.preInit(event);
|
||||
if (Loader.isModLoaded("Waila")) {
|
||||
FMLInterModComms.sendMessage("Waila", "register", "thaumic.tinkerer.common.compat.TTinkererProvider.callbackRegister");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void serverStart(FMLServerStartingEvent event) {
|
||||
MinecraftServer server = MinecraftServer.getServer();
|
||||
ICommandManager command = server.getCommandManager();
|
||||
ServerCommandManager manager = (ServerCommandManager) command;
|
||||
@EventHandler
|
||||
public void serverStart(FMLServerStartingEvent event) {
|
||||
MinecraftServer server = MinecraftServer.getServer();
|
||||
ICommandManager command = server.getCommandManager();
|
||||
ServerCommandManager manager = (ServerCommandManager) command;
|
||||
manager.registerCommand(new SetTendencyCommand());
|
||||
manager.registerCommand(new MaxResearchCommand());
|
||||
manager.registerCommand(new KamiUnlockedCommand());
|
||||
}
|
||||
manager.registerCommand(new KamiUnlockedCommand());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void HandleIMCMessages(FMLInterModComms.IMCEvent messages) {
|
||||
for (FMLInterModComms.IMCMessage message : messages.getMessages()) {
|
||||
if (message.key.equalsIgnoreCase(InterModCommsOperations.ADD_RESEARCH_BLACKLIST)) {
|
||||
String[] values = message.getStringValue().split(",");
|
||||
KamiResearchItem.Blacklist.addAll(Arrays.asList(values));
|
||||
}
|
||||
}
|
||||
}
|
||||
@EventHandler
|
||||
public void HandleIMCMessages(FMLInterModComms.IMCEvent messages) {
|
||||
for (FMLInterModComms.IMCMessage message : messages.getMessages()) {
|
||||
if (message.key.equalsIgnoreCase(InterModCommsOperations.ADD_RESEARCH_BLACKLIST)) {
|
||||
String[] values = message.getStringValue().split(",");
|
||||
KamiResearchItem.Blacklist.addAll(Arrays.asList(values));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void init(FMLInitializationEvent event) {
|
||||
proxy.init(event);
|
||||
if (ConfigHandler.enableKami && ConfigHandler.bedrockDimensionID != 0) {
|
||||
DimensionManager.registerProviderType(ConfigHandler.bedrockDimensionID, WorldProviderBedrock.class, false);
|
||||
DimensionManager.registerDimension(ConfigHandler.bedrockDimensionID, ConfigHandler.bedrockDimensionID);
|
||||
}
|
||||
}
|
||||
@EventHandler
|
||||
public void init(FMLInitializationEvent event) {
|
||||
proxy.init(event);
|
||||
if (ConfigHandler.enableKami && ConfigHandler.bedrockDimensionID != 0) {
|
||||
DimensionManager.registerProviderType(ConfigHandler.bedrockDimensionID, WorldProviderBedrock.class, false);
|
||||
DimensionManager.registerDimension(ConfigHandler.bedrockDimensionID, ConfigHandler.bedrockDimensionID);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void postInit(FMLPostInitializationEvent event) {
|
||||
proxy.postInit(event);
|
||||
@EventHandler
|
||||
public void postInit(FMLPostInitializationEvent event) {
|
||||
proxy.postInit(event);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -54,225 +54,225 @@ import java.util.Random;
|
||||
|
||||
public class BlockAnimationTablet extends BlockModContainer {
|
||||
|
||||
IIcon iconBottom;
|
||||
IIcon iconTop;
|
||||
IIcon iconSides;
|
||||
IIcon iconBottom;
|
||||
IIcon iconTop;
|
||||
IIcon iconSides;
|
||||
|
||||
Random random;
|
||||
Random random;
|
||||
|
||||
public BlockAnimationTablet() {
|
||||
super(Material.iron);
|
||||
setBlockBounds(0F, 0F, 0F, 1F, 1F / 16F * 2F, 1F);
|
||||
setHardness(3F);
|
||||
setResistance(50F);
|
||||
setStepSound(soundTypeMetal);
|
||||
public BlockAnimationTablet() {
|
||||
super(Material.iron);
|
||||
setBlockBounds(0F, 0F, 0F, 1F, 1F / 16F * 2F, 1F);
|
||||
setHardness(3F);
|
||||
setResistance(50F);
|
||||
setStepSound(soundTypeMetal);
|
||||
|
||||
random = new Random();
|
||||
}
|
||||
random = new Random();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister par1IconRegister) {
|
||||
iconBottom = IconHelper.forBlock(par1IconRegister, this, 0);
|
||||
iconTop = IconHelper.forBlock(par1IconRegister, this, 1);
|
||||
iconSides = IconHelper.forBlock(par1IconRegister, this, 2);
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister par1IconRegister) {
|
||||
iconBottom = IconHelper.forBlock(par1IconRegister, this, 0);
|
||||
iconTop = IconHelper.forBlock(par1IconRegister, this, 1);
|
||||
iconSides = IconHelper.forBlock(par1IconRegister, this, 2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World par1World, int par2, int par3, int par4, EntityLivingBase par5EntityLiving, ItemStack par6ItemStack) {
|
||||
byte b0 = 0;
|
||||
int l1 = MathHelper.floor_double(par5EntityLiving.rotationYaw * 4.0F / 360.0F + 0.5D) & 3;
|
||||
@Override
|
||||
public void onBlockPlacedBy(World par1World, int par2, int par3, int par4, EntityLivingBase par5EntityLiving, ItemStack par6ItemStack) {
|
||||
byte b0 = 0;
|
||||
int l1 = MathHelper.floor_double(par5EntityLiving.rotationYaw * 4.0F / 360.0F + 0.5D) & 3;
|
||||
|
||||
if (l1 == 0)
|
||||
b0 = 2;
|
||||
if (l1 == 0)
|
||||
b0 = 2;
|
||||
|
||||
if (l1 == 1)
|
||||
b0 = 5;
|
||||
if (l1 == 1)
|
||||
b0 = 5;
|
||||
|
||||
if (l1 == 2)
|
||||
b0 = 3;
|
||||
if (l1 == 2)
|
||||
b0 = 3;
|
||||
|
||||
if (l1 == 3)
|
||||
b0 = 4;
|
||||
if (l1 == 3)
|
||||
b0 = 4;
|
||||
|
||||
par1World.setBlockMetadataWithNotify(par2, par3, par4, b0, 2);
|
||||
//TileAnimationTablet tablet = (TileAnimationTablet) par1World.getTileEntity(par2, par3, par4);
|
||||
//if(par5EntityLiving instanceof EntityPlayer) {
|
||||
// tablet.Owner = ((EntityPlayer) par5EntityLiving).username;
|
||||
//}
|
||||
}
|
||||
par1World.setBlockMetadataWithNotify(par2, par3, par4, b0, 2);
|
||||
//TileAnimationTablet tablet = (TileAnimationTablet) par1World.getTileEntity(par2, par3, par4);
|
||||
//if(par5EntityLiving instanceof EntityPlayer) {
|
||||
// tablet.Owner = ((EntityPlayer) par5EntityLiving).username;
|
||||
//}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World par1World, int par2, int par3, int par4, Block par5, int par6) {
|
||||
TileAnimationTablet tablet = (TileAnimationTablet) par1World.getTileEntity(par2, par3, par4);
|
||||
@Override
|
||||
public void breakBlock(World par1World, int par2, int par3, int par4, Block par5, int par6) {
|
||||
TileAnimationTablet tablet = (TileAnimationTablet) par1World.getTileEntity(par2, par3, par4);
|
||||
|
||||
if (tablet != null) {
|
||||
if (tablet.getIsBreaking()) {
|
||||
//ChunkCoordinates coords = tablet.getTargetLoc();
|
||||
//par1World.destroyBlockInWorldPartially(tablet.getFakePlayer().entityId, coords.posX, coords.posY, coords.posZ, -1);
|
||||
}
|
||||
if (tablet != null) {
|
||||
if (tablet.getIsBreaking()) {
|
||||
//ChunkCoordinates coords = tablet.getTargetLoc();
|
||||
//par1World.destroyBlockInWorldPartially(tablet.getFakePlayer().entityId, coords.posX, coords.posY, coords.posZ, -1);
|
||||
}
|
||||
|
||||
for (int j1 = 0; j1 < tablet.getSizeInventory(); ++j1) {
|
||||
ItemStack itemstack = tablet.getStackInSlot(j1);
|
||||
for (int j1 = 0; j1 < tablet.getSizeInventory(); ++j1) {
|
||||
ItemStack itemstack = tablet.getStackInSlot(j1);
|
||||
|
||||
if (itemstack != null) {
|
||||
float f = random.nextFloat() * 0.8F + 0.1F;
|
||||
float f1 = random.nextFloat() * 0.8F + 0.1F;
|
||||
EntityItem entityitem;
|
||||
if (itemstack != null) {
|
||||
float f = random.nextFloat() * 0.8F + 0.1F;
|
||||
float f1 = random.nextFloat() * 0.8F + 0.1F;
|
||||
EntityItem entityitem;
|
||||
|
||||
for (float f2 = random.nextFloat() * 0.8F + 0.1F; itemstack.stackSize > 0; par1World.spawnEntityInWorld(entityitem)) {
|
||||
int k1 = random.nextInt(21) + 10;
|
||||
for (float f2 = random.nextFloat() * 0.8F + 0.1F; itemstack.stackSize > 0; par1World.spawnEntityInWorld(entityitem)) {
|
||||
int k1 = random.nextInt(21) + 10;
|
||||
|
||||
if (k1 > itemstack.stackSize)
|
||||
k1 = itemstack.stackSize;
|
||||
if (k1 > itemstack.stackSize)
|
||||
k1 = itemstack.stackSize;
|
||||
|
||||
itemstack.stackSize -= k1;
|
||||
entityitem = new EntityItem(par1World, par2 + f, par3 + f1, par4 + f2, new ItemStack(itemstack.getItem(), k1, itemstack.getItemDamage()));
|
||||
float f3 = 0.05F;
|
||||
entityitem.motionX = (float) random.nextGaussian() * f3;
|
||||
entityitem.motionY = (float) random.nextGaussian() * f3 + 0.2F;
|
||||
entityitem.motionZ = (float) random.nextGaussian() * f3;
|
||||
itemstack.stackSize -= k1;
|
||||
entityitem = new EntityItem(par1World, par2 + f, par3 + f1, par4 + f2, new ItemStack(itemstack.getItem(), k1, itemstack.getItemDamage()));
|
||||
float f3 = 0.05F;
|
||||
entityitem.motionX = (float) random.nextGaussian() * f3;
|
||||
entityitem.motionY = (float) random.nextGaussian() * f3 + 0.2F;
|
||||
entityitem.motionZ = (float) random.nextGaussian() * f3;
|
||||
|
||||
if (itemstack.hasTagCompound())
|
||||
entityitem.getEntityItem().setTagCompound((NBTTagCompound) itemstack.getTagCompound().copy());
|
||||
}
|
||||
}
|
||||
}
|
||||
if (itemstack.hasTagCompound())
|
||||
entityitem.getEntityItem().setTagCompound((NBTTagCompound) itemstack.getTagCompound().copy());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Look here if something breaks in 1.7
|
||||
par1World.func_147453_f(par2, par3, par4, par5);
|
||||
}
|
||||
//Look here if something breaks in 1.7
|
||||
par1World.func_147453_f(par2, par3, par4, par5);
|
||||
}
|
||||
|
||||
super.breakBlock(par1World, par2, par3, par4, par5, par6);
|
||||
}
|
||||
super.breakBlock(par1World, par2, par3, par4, par5, par6);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNeighborBlockChange(World par1World, int par2, int par3, int par4, Block par5) {
|
||||
if (par1World.isRemote)
|
||||
return;
|
||||
@Override
|
||||
public void onNeighborBlockChange(World par1World, int par2, int par3, int par4, Block par5) {
|
||||
if (par1World.isRemote)
|
||||
return;
|
||||
|
||||
boolean power = par1World.isBlockIndirectlyGettingPowered(par2, par3, par4) || par1World.isBlockIndirectlyGettingPowered(par2, par3 + 1, par4);
|
||||
int meta = par1World.getBlockMetadata(par2, par3, par4);
|
||||
boolean on = (meta & 8) != 0;
|
||||
boolean power = par1World.isBlockIndirectlyGettingPowered(par2, par3, par4) || par1World.isBlockIndirectlyGettingPowered(par2, par3 + 1, par4);
|
||||
int meta = par1World.getBlockMetadata(par2, par3, par4);
|
||||
boolean on = (meta & 8) != 0;
|
||||
|
||||
if (power && !on) {
|
||||
par1World.scheduleBlockUpdate(par2, par3, par4, this, tickRate(par1World));
|
||||
par1World.setBlockMetadataWithNotify(par2, par3, par4, meta | 8, 4);
|
||||
} else if (!power && on)
|
||||
par1World.setBlockMetadataWithNotify(par2, par3, par4, meta & 7, 4);
|
||||
}
|
||||
if (power && !on) {
|
||||
par1World.scheduleBlockUpdate(par2, par3, par4, this, tickRate(par1World));
|
||||
par1World.setBlockMetadataWithNotify(par2, par3, par4, meta | 8, 4);
|
||||
} else if (!power && on)
|
||||
par1World.setBlockMetadataWithNotify(par2, par3, par4, meta & 7, 4);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int tickRate(World par1World) {
|
||||
return 1;
|
||||
}
|
||||
@Override
|
||||
public int tickRate(World par1World) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random) {
|
||||
TileEntity tile = par1World.getTileEntity(par2, par3, par4);
|
||||
if (tile != null && tile instanceof TileAnimationTablet) {
|
||||
TileAnimationTablet tablet = (TileAnimationTablet) tile;
|
||||
if (tablet.redstone && tablet.swingProgress == 0) {
|
||||
tablet.findEntities(tablet.getTargetLoc());
|
||||
tablet.initiateSwing();
|
||||
par1World.addBlockEvent(par2, par3, par4, ThaumicTinkerer.registry.getFirstBlockFromClass(BlockAnimationTablet.class), 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random) {
|
||||
TileEntity tile = par1World.getTileEntity(par2, par3, par4);
|
||||
if (tile != null && tile instanceof TileAnimationTablet) {
|
||||
TileAnimationTablet tablet = (TileAnimationTablet) tile;
|
||||
if (tablet.redstone && tablet.swingProgress == 0) {
|
||||
tablet.findEntities(tablet.getTargetLoc());
|
||||
tablet.initiateSwing();
|
||||
par1World.addBlockEvent(par2, par3, par4, ThaumicTinkerer.registry.getFirstBlockFromClass(BlockAnimationTablet.class), 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) {
|
||||
if (!par1World.isRemote) {
|
||||
TileEntity tile = par1World.getTileEntity(par2, par3, par4);
|
||||
if (tile != null) {
|
||||
TileAnimationTablet tablet = (TileAnimationTablet) tile;
|
||||
if (par5EntityPlayer.getCurrentEquippedItem() != null && par5EntityPlayer.getCurrentEquippedItem().getItem() instanceof ItemWandCasting) {
|
||||
int meta = par1World.getBlockMetadata(par2, par3, par4);
|
||||
boolean activated = (meta & 8) != 0;
|
||||
if (!activated && !tablet.getIsBreaking() && tablet.swingProgress == 0) {
|
||||
par1World.setBlockMetadataWithNotify(par2, par3, par4, meta == 5 ? 2 : meta + 1, 1 | 2);
|
||||
par1World.playSoundEffect(par2, par3, par4, "thaumcraft:tool", 0.6F, 1F);
|
||||
} else
|
||||
par5EntityPlayer.addChatMessage(new ChatComponentTranslation("ttmisc.animationTablet.notRotatable"));
|
||||
// Rare chance this might happen, but better to cope for it.
|
||||
@Override
|
||||
public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) {
|
||||
if (!par1World.isRemote) {
|
||||
TileEntity tile = par1World.getTileEntity(par2, par3, par4);
|
||||
if (tile != null) {
|
||||
TileAnimationTablet tablet = (TileAnimationTablet) tile;
|
||||
if (par5EntityPlayer.getCurrentEquippedItem() != null && par5EntityPlayer.getCurrentEquippedItem().getItem() instanceof ItemWandCasting) {
|
||||
int meta = par1World.getBlockMetadata(par2, par3, par4);
|
||||
boolean activated = (meta & 8) != 0;
|
||||
if (!activated && !tablet.getIsBreaking() && tablet.swingProgress == 0) {
|
||||
par1World.setBlockMetadataWithNotify(par2, par3, par4, meta == 5 ? 2 : meta + 1, 1 | 2);
|
||||
par1World.playSoundEffect(par2, par3, par4, "thaumcraft:tool", 0.6F, 1F);
|
||||
} else
|
||||
par5EntityPlayer.addChatMessage(new ChatComponentTranslation("ttmisc.animationTablet.notRotatable"));
|
||||
// Rare chance this might happen, but better to cope for it.
|
||||
|
||||
return true;
|
||||
} else {
|
||||
//if(tablet.Owner==null || tablet.Owner.equals(""))
|
||||
// tablet.Owner=par5EntityPlayer.username;
|
||||
par5EntityPlayer.openGui(ThaumicTinkerer.instance, LibGuiIDs.GUI_ID_TABLET, par1World, par2, par3, par4);
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
//if(tablet.Owner==null || tablet.Owner.equals(""))
|
||||
// tablet.Owner=par5EntityPlayer.username;
|
||||
par5EntityPlayer.openGui(ThaumicTinkerer.instance, LibGuiIDs.GUI_ID_TABLET, par1World, par2, par3, par4);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int par1, int par2) {
|
||||
return par1 == ForgeDirection.UP.ordinal() ? iconTop : par1 == ForgeDirection.DOWN.ordinal() ? iconBottom : iconSides;
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int par1, int par2) {
|
||||
return par1 == ForgeDirection.UP.ordinal() ? iconTop : par1 == ForgeDirection.DOWN.ordinal() ? iconBottom : iconSides;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int par2) {
|
||||
return new TileAnimationTablet();
|
||||
}
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int par2) {
|
||||
return new TileAnimationTablet();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<Object> getSpecialParameters() {
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public ArrayList<Object> getSpecialParameters() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBlockName() {
|
||||
return LibBlockNames.ANIMATION_TABLET;
|
||||
}
|
||||
@Override
|
||||
public String getBlockName() {
|
||||
return LibBlockNames.ANIMATION_TABLET;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRegister() {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean shouldRegister() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldDisplayInTab() {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean shouldDisplayInTab() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends ItemBlock> getItemBlock() {
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public Class<? extends ItemBlock> getItemBlock() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends TileEntity> getTileEntity() {
|
||||
return TileAnimationTablet.class;
|
||||
}
|
||||
@Override
|
||||
public Class<? extends TileEntity> getTileEntity() {
|
||||
return TileAnimationTablet.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IRegisterableResearch getResearchItem() {
|
||||
@Override
|
||||
public IRegisterableResearch getResearchItem() {
|
||||
return (IRegisterableResearch) new TTResearchItem(LibResearch.KEY_ANIMATION_TABLET, new AspectList().add(Aspect.MECHANISM, 2).add(Aspect.METAL, 1).add(Aspect.MOTION, 1).add(Aspect.ENERGY, 1), -8, 2, 4, new ItemStack(ThaumicTinkerer.registry.getFirstBlockFromClass(BlockAnimationTablet.class))).setWarp(1).setParents(LibResearch.KEY_MAGNETS)
|
||||
.setPages(new ResearchPage("0"), ResearchHelper.arcaneRecipePage(LibResearch.KEY_ANIMATION_TABLET));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ThaumicTinkererRecipe getRecipeItem() {
|
||||
return new ThaumicTinkererArcaneRecipe(LibResearch.KEY_ANIMATION_TABLET, LibResearch.KEY_ANIMATION_TABLET, new ItemStack(ThaumicTinkerer.registry.getFirstBlockFromClass(BlockAnimationTablet.class)), new AspectList().add(Aspect.AIR, 25).add(Aspect.ORDER, 15).add(Aspect.FIRE, 10),
|
||||
"GIG", "ICI",
|
||||
'G', new ItemStack(Items.gold_ingot),
|
||||
'I', new ItemStack(Items.iron_ingot),
|
||||
'C', new ItemStack(ConfigItems.itemGolemCore, 1, 100));
|
||||
@Override
|
||||
public ThaumicTinkererRecipe getRecipeItem() {
|
||||
return new ThaumicTinkererArcaneRecipe(LibResearch.KEY_ANIMATION_TABLET, LibResearch.KEY_ANIMATION_TABLET, new ItemStack(ThaumicTinkerer.registry.getFirstBlockFromClass(BlockAnimationTablet.class)), new AspectList().add(Aspect.AIR, 25).add(Aspect.ORDER, 15).add(Aspect.FIRE, 10),
|
||||
"GIG", "ICI",
|
||||
'G', new ItemStack(Items.gold_ingot),
|
||||
'I', new ItemStack(Items.iron_ingot),
|
||||
'C', new ItemStack(ConfigItems.itemGolemCore, 1, 100));
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -31,12 +31,9 @@ import thaumcraft.api.aspects.AspectList;
|
||||
import thaumcraft.api.research.ResearchPage;
|
||||
import thaumcraft.common.config.ConfigBlocks;
|
||||
import thaumcraft.common.config.ConfigItems;
|
||||
import thaumcraft.common.lib.crafting.ThaumcraftCraftingManager;
|
||||
import thaumcraft.common.lib.research.ResearchManager;
|
||||
import thaumic.tinkerer.client.core.helper.IconHelper;
|
||||
import thaumic.tinkerer.common.ThaumicTinkerer;
|
||||
import thaumic.tinkerer.common.block.tile.TileAspectAnalyzer;
|
||||
import thaumic.tinkerer.common.block.tile.kami.TileBedrockPortal;
|
||||
import thaumic.tinkerer.common.lib.LibBlockNames;
|
||||
import thaumic.tinkerer.common.lib.LibGuiIDs;
|
||||
import thaumic.tinkerer.common.lib.LibResearch;
|
||||
@@ -51,126 +48,126 @@ import java.util.Random;
|
||||
|
||||
public class BlockAspectAnalyzer extends BlockModContainer {
|
||||
|
||||
IIcon[] icons = new IIcon[5];
|
||||
Random random;
|
||||
IIcon[] icons = new IIcon[5];
|
||||
Random random;
|
||||
|
||||
public BlockAspectAnalyzer() {
|
||||
super(Material.wood);
|
||||
setHardness(1.7F);
|
||||
setResistance(1F);
|
||||
setStepSound(Block.soundTypeWood);
|
||||
public BlockAspectAnalyzer() {
|
||||
super(Material.wood);
|
||||
setHardness(1.7F);
|
||||
setResistance(1F);
|
||||
setStepSound(Block.soundTypeWood);
|
||||
|
||||
random = new Random();
|
||||
}
|
||||
random = new Random();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) {
|
||||
if (!par1World.isRemote) {
|
||||
TileAspectAnalyzer tile = (TileAspectAnalyzer) par1World.getTileEntity(par2, par3, par4);
|
||||
if (tile != null) {
|
||||
@Override
|
||||
public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) {
|
||||
if (!par1World.isRemote) {
|
||||
TileAspectAnalyzer tile = (TileAspectAnalyzer) par1World.getTileEntity(par2, par3, par4);
|
||||
if (tile != null) {
|
||||
par5EntityPlayer.openGui(ThaumicTinkerer.instance, LibGuiIDs.GUI_ID_ASPECT_ANALYZER, par1World, par2, par3, par4);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World par1World, int par2, int par3, int par4, Block par5, int par6) {
|
||||
TileAspectAnalyzer analyzer = (TileAspectAnalyzer) par1World.getTileEntity(par2, par3, par4);
|
||||
@Override
|
||||
public void breakBlock(World par1World, int par2, int par3, int par4, Block par5, int par6) {
|
||||
TileAspectAnalyzer analyzer = (TileAspectAnalyzer) par1World.getTileEntity(par2, par3, par4);
|
||||
|
||||
if (analyzer != null) {
|
||||
for (int j1 = 0; j1 < analyzer.getSizeInventory(); ++j1) {
|
||||
ItemStack itemstack = analyzer.getStackInSlot(j1);
|
||||
if (analyzer != null) {
|
||||
for (int j1 = 0; j1 < analyzer.getSizeInventory(); ++j1) {
|
||||
ItemStack itemstack = analyzer.getStackInSlot(j1);
|
||||
|
||||
if (itemstack != null) {
|
||||
float f = random.nextFloat() * 0.8F + 0.1F;
|
||||
float f1 = random.nextFloat() * 0.8F + 0.1F;
|
||||
EntityItem entityitem;
|
||||
if (itemstack != null) {
|
||||
float f = random.nextFloat() * 0.8F + 0.1F;
|
||||
float f1 = random.nextFloat() * 0.8F + 0.1F;
|
||||
EntityItem entityitem;
|
||||
|
||||
for (float f2 = random.nextFloat() * 0.8F + 0.1F; itemstack.stackSize > 0; par1World.spawnEntityInWorld(entityitem)) {
|
||||
int k1 = random.nextInt(21) + 10;
|
||||
for (float f2 = random.nextFloat() * 0.8F + 0.1F; itemstack.stackSize > 0; par1World.spawnEntityInWorld(entityitem)) {
|
||||
int k1 = random.nextInt(21) + 10;
|
||||
|
||||
if (k1 > itemstack.stackSize)
|
||||
k1 = itemstack.stackSize;
|
||||
if (k1 > itemstack.stackSize)
|
||||
k1 = itemstack.stackSize;
|
||||
|
||||
itemstack.stackSize -= k1;
|
||||
entityitem = new EntityItem(par1World, par2 + f, par3 + f1, par4 + f2, new ItemStack(itemstack.getItem(), k1, itemstack.getItemDamage()));
|
||||
float f3 = 0.05F;
|
||||
entityitem.motionX = (float) random.nextGaussian() * f3;
|
||||
entityitem.motionY = (float) random.nextGaussian() * f3 + 0.2F;
|
||||
entityitem.motionZ = (float) random.nextGaussian() * f3;
|
||||
itemstack.stackSize -= k1;
|
||||
entityitem = new EntityItem(par1World, par2 + f, par3 + f1, par4 + f2, new ItemStack(itemstack.getItem(), k1, itemstack.getItemDamage()));
|
||||
float f3 = 0.05F;
|
||||
entityitem.motionX = (float) random.nextGaussian() * f3;
|
||||
entityitem.motionY = (float) random.nextGaussian() * f3 + 0.2F;
|
||||
entityitem.motionZ = (float) random.nextGaussian() * f3;
|
||||
|
||||
if (itemstack.hasTagCompound())
|
||||
entityitem.getEntityItem().setTagCompound((NBTTagCompound) itemstack.getTagCompound().copy());
|
||||
}
|
||||
}
|
||||
}
|
||||
if (itemstack.hasTagCompound())
|
||||
entityitem.getEntityItem().setTagCompound((NBTTagCompound) itemstack.getTagCompound().copy());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
par1World.func_147453_f(par2, par3, par4, par5);
|
||||
}
|
||||
par1World.func_147453_f(par2, par3, par4, par5);
|
||||
}
|
||||
|
||||
super.breakBlock(par1World, par2, par3, par4, par5, par6);
|
||||
}
|
||||
super.breakBlock(par1World, par2, par3, par4, par5, par6);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerBlockIcons(IIconRegister par1IconRegister) {
|
||||
for (int i = 0; i < 5; i++)
|
||||
icons[i] = IconHelper.forBlock(par1IconRegister, this, i);
|
||||
}
|
||||
@Override
|
||||
public void registerBlockIcons(IIconRegister par1IconRegister) {
|
||||
for (int i = 0; i < 5; i++)
|
||||
icons[i] = IconHelper.forBlock(par1IconRegister, this, i);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(int par1, int par2) {
|
||||
return icons[par1 == 0 || par1 == 1 ? 0 : par1 - 1];
|
||||
}
|
||||
@Override
|
||||
public IIcon getIcon(int par1, int par2) {
|
||||
return icons[par1 == 0 || par1 == 1 ? 0 : par1 - 1];
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta) {
|
||||
return new TileAspectAnalyzer();
|
||||
}
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta) {
|
||||
return new TileAspectAnalyzer();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<Object> getSpecialParameters() {
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public ArrayList<Object> getSpecialParameters() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBlockName() {
|
||||
return LibBlockNames.ASPECT_ANALYZER;
|
||||
}
|
||||
@Override
|
||||
public String getBlockName() {
|
||||
return LibBlockNames.ASPECT_ANALYZER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRegister() {
|
||||
@Override
|
||||
public boolean shouldRegister() {
|
||||
return Loader.isModLoaded("ComputerCraft");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldDisplayInTab() {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean shouldDisplayInTab() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends ItemBlock> getItemBlock() {
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public Class<? extends ItemBlock> getItemBlock() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends TileEntity> getTileEntity() {
|
||||
return TileAspectAnalyzer.class;
|
||||
}
|
||||
@Override
|
||||
public Class<? extends TileEntity> getTileEntity() {
|
||||
return TileAspectAnalyzer.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IRegisterableResearch getResearchItem() {
|
||||
return (IRegisterableResearch) new TTResearchItem(LibResearch.KEY_ASPECT_ANALYZER, new AspectList().add(Aspect.MECHANISM, 2).add(Aspect.SENSES, 1).add(Aspect.MIND, 1), 0, 1, 2, new ItemStack(this)).setParents(LibResearch.KEY_PERIPHERALS).setParentsHidden("GOGGLES", "THAUMIUM").setConcealed().setRound()
|
||||
.setPages(new ResearchPage("0"), ResearchHelper.arcaneRecipePage(LibResearch.KEY_ASPECT_ANALYZER));
|
||||
}
|
||||
@Override
|
||||
public IRegisterableResearch getResearchItem() {
|
||||
return (IRegisterableResearch) new TTResearchItem(LibResearch.KEY_ASPECT_ANALYZER, new AspectList().add(Aspect.MECHANISM, 2).add(Aspect.SENSES, 1).add(Aspect.MIND, 1), 0, 1, 2, new ItemStack(this)).setParents(LibResearch.KEY_PERIPHERALS).setParentsHidden("GOGGLES", "THAUMIUM").setConcealed().setRound()
|
||||
.setPages(new ResearchPage("0"), ResearchHelper.arcaneRecipePage(LibResearch.KEY_ASPECT_ANALYZER));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ThaumicTinkererRecipe getRecipeItem() {
|
||||
return new ThaumicTinkererArcaneRecipe(LibResearch.KEY_ASPECT_ANALYZER, LibResearch.KEY_ASPECT_ANALYZER, new ItemStack(this), new AspectList().add(Aspect.ORDER, 1).add(Aspect.ENTROPY, 1),
|
||||
"TWT", "WMW", "TWT",
|
||||
'W', new ItemStack(ConfigBlocks.blockWoodenDevice, 1, 6),
|
||||
'M', new ItemStack(ConfigItems.itemThaumometer),
|
||||
'T', new ItemStack(ConfigItems.itemResource, 1, 2));
|
||||
}
|
||||
@Override
|
||||
public ThaumicTinkererRecipe getRecipeItem() {
|
||||
return new ThaumicTinkererArcaneRecipe(LibResearch.KEY_ASPECT_ANALYZER, LibResearch.KEY_ASPECT_ANALYZER, new ItemStack(this), new AspectList().add(Aspect.ORDER, 1).add(Aspect.ENTROPY, 1),
|
||||
"TWT", "WMW", "TWT",
|
||||
'W', new ItemStack(ConfigBlocks.blockWoodenDevice, 1, 6),
|
||||
'M', new ItemStack(ConfigItems.itemThaumometer),
|
||||
'T', new ItemStack(ConfigItems.itemResource, 1, 2));
|
||||
}
|
||||
}
|
||||
@@ -35,122 +35,122 @@ import java.util.List;
|
||||
|
||||
public abstract class BlockCamo extends BlockModContainer<TileCamo> {
|
||||
|
||||
static List<Integer> validRenderTypes = Arrays.asList(0, 31, 39);
|
||||
static List<Integer> validRenderTypes = Arrays.asList(0, 31, 39);
|
||||
|
||||
protected BlockCamo(Material par2Material) {
|
||||
super(par2Material);
|
||||
}
|
||||
protected BlockCamo(Material par2Material) {
|
||||
super(par2Material);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
@Override
|
||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
|
||||
if (tile instanceof TileCamo) {
|
||||
TileCamo camo = (TileCamo) tile;
|
||||
Block block = camo.camo;
|
||||
if (block != null && isValidRenderType(block.getRenderType()))
|
||||
return block.getIcon(side, camo.camoMeta);
|
||||
}
|
||||
if (tile instanceof TileCamo) {
|
||||
TileCamo camo = (TileCamo) tile;
|
||||
Block block = camo.camo;
|
||||
if (block != null && isValidRenderType(block.getRenderType()))
|
||||
return block.getIcon(side, camo.camoMeta);
|
||||
}
|
||||
|
||||
return getIconFromSideAfterCheck(tile, meta, side);
|
||||
}
|
||||
return getIconFromSideAfterCheck(tile, meta, side);
|
||||
}
|
||||
|
||||
public boolean isValidRenderType(int type) {
|
||||
return validRenderTypes.contains(type);
|
||||
}
|
||||
public boolean isValidRenderType(int type) {
|
||||
return validRenderTypes.contains(type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) {
|
||||
TileEntity tile = par1World.getTileEntity(par2, par3, par4);
|
||||
@Override
|
||||
public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) {
|
||||
TileEntity tile = par1World.getTileEntity(par2, par3, par4);
|
||||
|
||||
if (tile instanceof TileCamo) {
|
||||
TileCamo camo = (TileCamo) tile;
|
||||
ItemStack currentStack = par5EntityPlayer.getCurrentEquippedItem();
|
||||
if (tile instanceof TileCamo) {
|
||||
TileCamo camo = (TileCamo) tile;
|
||||
ItemStack currentStack = par5EntityPlayer.getCurrentEquippedItem();
|
||||
|
||||
boolean doChange = true;
|
||||
Block block = null;
|
||||
checkChange:
|
||||
{
|
||||
if (currentStack != null) {
|
||||
if (Item.getIdFromItem(currentStack.getItem()) == 0) {
|
||||
doChange = false;
|
||||
break checkChange;
|
||||
}
|
||||
boolean doChange = true;
|
||||
Block block = null;
|
||||
checkChange:
|
||||
{
|
||||
if (currentStack != null) {
|
||||
if (Item.getIdFromItem(currentStack.getItem()) == 0) {
|
||||
doChange = false;
|
||||
break checkChange;
|
||||
}
|
||||
|
||||
block = Block.getBlockFromItem(currentStack.getItem());
|
||||
if (block == null || !isValidRenderType(block.getRenderType()) || block instanceof BlockCamo || block.getMaterial() == Material.air)
|
||||
doChange = false;
|
||||
}
|
||||
}
|
||||
block = Block.getBlockFromItem(currentStack.getItem());
|
||||
if (block == null || !isValidRenderType(block.getRenderType()) || block instanceof BlockCamo || block.getMaterial() == Material.air)
|
||||
doChange = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (doChange) {
|
||||
int metadata = currentStack == null ? 0 :currentStack.getItemDamage();
|
||||
if (block instanceof BlockDirectional) {
|
||||
switch (par6) {
|
||||
case 0:
|
||||
case 1:
|
||||
break;
|
||||
case 2:
|
||||
metadata = metadata & 12 | 2;
|
||||
break;
|
||||
case 3:
|
||||
metadata = metadata & 12;
|
||||
break;
|
||||
case 4:
|
||||
metadata = metadata & 12 | 1;
|
||||
break;
|
||||
case 5:
|
||||
metadata = metadata & 12 | 3;
|
||||
break;
|
||||
}
|
||||
}
|
||||
camo.camo = currentStack == null ? Blocks.air : Block.getBlockFromItem(currentStack.getItem());
|
||||
camo.camoMeta = metadata;
|
||||
par1World.markBlockForUpdate(par2, par3, par4);
|
||||
if (doChange) {
|
||||
int metadata = currentStack == null ? 0 : currentStack.getItemDamage();
|
||||
if (block instanceof BlockDirectional) {
|
||||
switch (par6) {
|
||||
case 0:
|
||||
case 1:
|
||||
break;
|
||||
case 2:
|
||||
metadata = metadata & 12 | 2;
|
||||
break;
|
||||
case 3:
|
||||
metadata = metadata & 12;
|
||||
break;
|
||||
case 4:
|
||||
metadata = metadata & 12 | 1;
|
||||
break;
|
||||
case 5:
|
||||
metadata = metadata & 12 | 3;
|
||||
break;
|
||||
}
|
||||
}
|
||||
camo.camo = currentStack == null ? Blocks.air : Block.getBlockFromItem(currentStack.getItem());
|
||||
camo.camoMeta = metadata;
|
||||
par1World.markBlockForUpdate(par2, par3, par4);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public int colorMultiplier(IBlockAccess par1World, int par2, int par3, int par4) {
|
||||
TileEntity tile = par1World.getTileEntity(par2, par3, par4);
|
||||
if (tile instanceof TileCamo) {
|
||||
TileCamo camo = (TileCamo) tile;
|
||||
Block block = camo.camo;
|
||||
if (block != null)
|
||||
return block instanceof BlockCamo ? 0xFFFFFF : block.colorMultiplier(par1World, par2, par3, par4);
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public int colorMultiplier(IBlockAccess par1World, int par2, int par3, int par4) {
|
||||
TileEntity tile = par1World.getTileEntity(par2, par3, par4);
|
||||
if (tile instanceof TileCamo) {
|
||||
TileCamo camo = (TileCamo) tile;
|
||||
Block block = camo.camo;
|
||||
if (block != null)
|
||||
return block instanceof BlockCamo ? 0xFFFFFF : block.colorMultiplier(par1World, par2, par3, par4);
|
||||
|
||||
}
|
||||
return 0xFFFFFF;
|
||||
}
|
||||
}
|
||||
return 0xFFFFFF;
|
||||
}
|
||||
|
||||
public IIcon getIconFromSideAfterCheck(TileEntity tile, int meta, int side) {
|
||||
return blockIcon;
|
||||
}
|
||||
public IIcon getIconFromSideAfterCheck(TileEntity tile, int meta, int side) {
|
||||
return blockIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends ItemBlock> getItemBlock() {
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public Class<? extends ItemBlock> getItemBlock() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends TileEntity> getTileEntity() {
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public Class<? extends TileEntity> getTileEntity() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -52,141 +52,141 @@ import java.util.Random;
|
||||
|
||||
public class BlockEnchanter extends BlockModContainer {
|
||||
|
||||
Random random;
|
||||
Random random;
|
||||
|
||||
IIcon iconBottom;
|
||||
IIcon iconTop;
|
||||
IIcon iconSides;
|
||||
IIcon iconBottom;
|
||||
IIcon iconTop;
|
||||
IIcon iconSides;
|
||||
|
||||
public BlockEnchanter() {
|
||||
super(Material.rock);
|
||||
setBlockBounds(0F, 0F, 0F, 1F, 0.75F, 1F);
|
||||
setHardness(5.0F);
|
||||
setResistance(2000.0F);
|
||||
public BlockEnchanter() {
|
||||
super(Material.rock);
|
||||
setBlockBounds(0F, 0F, 0F, 1F, 0.75F, 1F);
|
||||
setHardness(5.0F);
|
||||
setResistance(2000.0F);
|
||||
|
||||
random = new Random();
|
||||
}
|
||||
random = new Random();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) {
|
||||
if (!par1World.isRemote) {
|
||||
TileEntity tile = par1World.getTileEntity(par2, par3, par4);
|
||||
if (tile != null) {
|
||||
par1World.markBlockForUpdate(par2, par3, par4);
|
||||
par5EntityPlayer.openGui(ThaumicTinkerer.instance, LibGuiIDs.GUI_ID_ENCHANTER, par1World, par2, par3, par4);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) {
|
||||
if (!par1World.isRemote) {
|
||||
TileEntity tile = par1World.getTileEntity(par2, par3, par4);
|
||||
if (tile != null) {
|
||||
par1World.markBlockForUpdate(par2, par3, par4);
|
||||
par5EntityPlayer.openGui(ThaumicTinkerer.instance, LibGuiIDs.GUI_ID_ENCHANTER, par1World, par2, par3, par4);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World par1World, int par2, int par3, int par4, Block par5, int par6) {
|
||||
TileEnchanter enchanter = (TileEnchanter) par1World.getTileEntity(par2, par3, par4);
|
||||
@Override
|
||||
public void breakBlock(World par1World, int par2, int par3, int par4, Block par5, int par6) {
|
||||
TileEnchanter enchanter = (TileEnchanter) par1World.getTileEntity(par2, par3, par4);
|
||||
|
||||
if (enchanter != null) {
|
||||
for (int j1 = 0; j1 < enchanter.getSizeInventory(); ++j1) {
|
||||
ItemStack itemstack = enchanter.getStackInSlot(j1);
|
||||
if (enchanter != null) {
|
||||
for (int j1 = 0; j1 < enchanter.getSizeInventory(); ++j1) {
|
||||
ItemStack itemstack = enchanter.getStackInSlot(j1);
|
||||
|
||||
if (itemstack != null) {
|
||||
float f = random.nextFloat() * 0.8F + 0.1F;
|
||||
float f1 = random.nextFloat() * 0.8F + 0.1F;
|
||||
EntityItem entityitem;
|
||||
if (itemstack != null) {
|
||||
float f = random.nextFloat() * 0.8F + 0.1F;
|
||||
float f1 = random.nextFloat() * 0.8F + 0.1F;
|
||||
EntityItem entityitem;
|
||||
|
||||
for (float f2 = random.nextFloat() * 0.8F + 0.1F; itemstack.stackSize > 0; par1World.spawnEntityInWorld(entityitem)) {
|
||||
int k1 = random.nextInt(21) + 10;
|
||||
for (float f2 = random.nextFloat() * 0.8F + 0.1F; itemstack.stackSize > 0; par1World.spawnEntityInWorld(entityitem)) {
|
||||
int k1 = random.nextInt(21) + 10;
|
||||
|
||||
if (k1 > itemstack.stackSize)
|
||||
k1 = itemstack.stackSize;
|
||||
if (k1 > itemstack.stackSize)
|
||||
k1 = itemstack.stackSize;
|
||||
|
||||
itemstack.stackSize -= k1;
|
||||
entityitem = new EntityItem(par1World, par2 + f, par3 + f1, par4 + f2, new ItemStack(itemstack.getItem(), k1, itemstack.getItemDamage()));
|
||||
float f3 = 0.05F;
|
||||
entityitem.motionX = (float) random.nextGaussian() * f3;
|
||||
entityitem.motionY = (float) random.nextGaussian() * f3 + 0.2F;
|
||||
entityitem.motionZ = (float) random.nextGaussian() * f3;
|
||||
itemstack.stackSize -= k1;
|
||||
entityitem = new EntityItem(par1World, par2 + f, par3 + f1, par4 + f2, new ItemStack(itemstack.getItem(), k1, itemstack.getItemDamage()));
|
||||
float f3 = 0.05F;
|
||||
entityitem.motionX = (float) random.nextGaussian() * f3;
|
||||
entityitem.motionY = (float) random.nextGaussian() * f3 + 0.2F;
|
||||
entityitem.motionZ = (float) random.nextGaussian() * f3;
|
||||
|
||||
if (itemstack.hasTagCompound())
|
||||
entityitem.getEntityItem().setTagCompound((NBTTagCompound) itemstack.getTagCompound().copy());
|
||||
}
|
||||
}
|
||||
}
|
||||
if (itemstack.hasTagCompound())
|
||||
entityitem.getEntityItem().setTagCompound((NBTTagCompound) itemstack.getTagCompound().copy());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
par1World.func_147453_f(par2, par3, par4, par5);
|
||||
}
|
||||
par1World.func_147453_f(par2, par3, par4, par5);
|
||||
}
|
||||
|
||||
super.breakBlock(par1World, par2, par3, par4, par5, par6);
|
||||
}
|
||||
super.breakBlock(par1World, par2, par3, par4, par5, par6);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister par1IconRegister) {
|
||||
iconBottom = IconHelper.forBlock(par1IconRegister, this, 0);
|
||||
iconTop = IconHelper.forBlock(par1IconRegister, this, 1);
|
||||
iconSides = IconHelper.forBlock(par1IconRegister, this, 2);
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister par1IconRegister) {
|
||||
iconBottom = IconHelper.forBlock(par1IconRegister, this, 0);
|
||||
iconTop = IconHelper.forBlock(par1IconRegister, this, 1);
|
||||
iconSides = IconHelper.forBlock(par1IconRegister, this, 2);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int par1, int par2) {
|
||||
return par1 == ForgeDirection.UP.ordinal() ? iconTop : par1 == ForgeDirection.DOWN.ordinal() ? iconBottom : iconSides;
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int par1, int par2) {
|
||||
return par1 == ForgeDirection.UP.ordinal() ? iconTop : par1 == ForgeDirection.DOWN.ordinal() ? iconBottom : iconSides;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta) {
|
||||
return new TileEnchanter();
|
||||
}
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta) {
|
||||
return new TileEnchanter();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<Object> getSpecialParameters() {
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public ArrayList<Object> getSpecialParameters() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBlockName() {
|
||||
return LibBlockNames.ENCHANTER;
|
||||
}
|
||||
@Override
|
||||
public String getBlockName() {
|
||||
return LibBlockNames.ENCHANTER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRegister() {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean shouldRegister() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldDisplayInTab() {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean shouldDisplayInTab() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends ItemBlock> getItemBlock() {
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public Class<? extends ItemBlock> getItemBlock() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends TileEntity> getTileEntity() {
|
||||
return TileEnchanter.class;
|
||||
}
|
||||
@Override
|
||||
public Class<? extends TileEntity> getTileEntity() {
|
||||
return TileEnchanter.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IRegisterableResearch getResearchItem() {
|
||||
return (IRegisterableResearch) new TTResearchItem(LibResearch.KEY_ENCHANTER, new AspectList().add(Aspect.MAGIC, 2).add(Aspect.AURA, 1).add(Aspect.ELDRITCH, 1).add(Aspect.DARKNESS, 1).add(Aspect.MIND, 1), 5, 4, 5, new ItemStack(this)).setParents(LibResearch.KEY_SPELL_CLOTH)
|
||||
.setPages(new ResearchPage("0"), new ResearchPage("1"), new ResearchPage("2"), ResearchHelper.infusionPage(LibResearch.KEY_ENCHANTER));
|
||||
@Override
|
||||
public IRegisterableResearch getResearchItem() {
|
||||
return (IRegisterableResearch) new TTResearchItem(LibResearch.KEY_ENCHANTER, new AspectList().add(Aspect.MAGIC, 2).add(Aspect.AURA, 1).add(Aspect.ELDRITCH, 1).add(Aspect.DARKNESS, 1).add(Aspect.MIND, 1), 5, 4, 5, new ItemStack(this)).setParents(LibResearch.KEY_SPELL_CLOTH)
|
||||
.setPages(new ResearchPage("0"), new ResearchPage("1"), new ResearchPage("2"), ResearchHelper.infusionPage(LibResearch.KEY_ENCHANTER));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ThaumicTinkererRecipe getRecipeItem() {
|
||||
return new ThaumicTinkererInfusionRecipe(LibResearch.KEY_ENCHANTER, new ItemStack(this), 15, new AspectList().add(Aspect.MAGIC, 50).add(Aspect.ENERGY, 20).add(Aspect.ELDRITCH, 20).add(Aspect.VOID, 20).add(Aspect.MIND, 10), new ItemStack(Blocks.enchanting_table),
|
||||
new ItemStack(ConfigBlocks.blockCosmeticSolid, 1, 1), new ItemStack(ConfigBlocks.blockCosmeticSolid, 1, 1), new ItemStack(ConfigBlocks.blockCosmeticSolid, 1, 1), new ItemStack(ConfigBlocks.blockCosmeticSolid, 1, 1), new ItemStack(ConfigBlocks.blockCosmeticSolid, 1, 1), new ItemStack(ConfigItems.itemResource, 1, 2), new ItemStack(ConfigItems.itemResource, 1, 2), new ItemStack(ThaumicTinkerer.registry.getFirstItemFromClass(ItemSpellCloth.class)));
|
||||
}
|
||||
@Override
|
||||
public ThaumicTinkererRecipe getRecipeItem() {
|
||||
return new ThaumicTinkererInfusionRecipe(LibResearch.KEY_ENCHANTER, new ItemStack(this), 15, new AspectList().add(Aspect.MAGIC, 50).add(Aspect.ENERGY, 20).add(Aspect.ELDRITCH, 20).add(Aspect.VOID, 20).add(Aspect.MIND, 10), new ItemStack(Blocks.enchanting_table),
|
||||
new ItemStack(ConfigBlocks.blockCosmeticSolid, 1, 1), new ItemStack(ConfigBlocks.blockCosmeticSolid, 1, 1), new ItemStack(ConfigBlocks.blockCosmeticSolid, 1, 1), new ItemStack(ConfigBlocks.blockCosmeticSolid, 1, 1), new ItemStack(ConfigBlocks.blockCosmeticSolid, 1, 1), new ItemStack(ConfigItems.itemResource, 1, 2), new ItemStack(ConfigItems.itemResource, 1, 2), new ItemStack(ThaumicTinkerer.registry.getFirstItemFromClass(ItemSpellCloth.class)));
|
||||
}
|
||||
}
|
||||
@@ -4,8 +4,8 @@ import net.minecraft.block.material.Material;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import thaumic.tinkerer.common.lib.LibBlockNames;
|
||||
import thaumic.tinkerer.common.block.tile.TileForcefield;
|
||||
import thaumic.tinkerer.common.lib.LibBlockNames;
|
||||
import thaumic.tinkerer.common.registry.ThaumicTinkererRecipe;
|
||||
import thaumic.tinkerer.common.research.IRegisterableResearch;
|
||||
|
||||
@@ -15,14 +15,14 @@ import java.util.ArrayList;
|
||||
* Created by pixlepix on 4/19/14.
|
||||
*/
|
||||
public class BlockForcefield extends BlockMod {
|
||||
public BlockForcefield() {
|
||||
super(Material.air);
|
||||
}
|
||||
public BlockForcefield() {
|
||||
super(Material.air);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return -1;
|
||||
}
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune) {
|
||||
@@ -31,36 +31,36 @@ public class BlockForcefield extends BlockMod {
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createTileEntity(World world, int metadata) {
|
||||
return new TileForcefield();
|
||||
}
|
||||
@Override
|
||||
public TileEntity createTileEntity(World world, int metadata) {
|
||||
return new TileForcefield();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasTileEntity(int metadata) {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean hasTileEntity(int metadata) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBlockName() {
|
||||
return LibBlockNames.FORCEFIELD;
|
||||
}
|
||||
@Override
|
||||
public String getBlockName() {
|
||||
return LibBlockNames.FORCEFIELD;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IRegisterableResearch getResearchItem() {
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public IRegisterableResearch getResearchItem() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ThaumicTinkererRecipe getRecipeItem() {
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public ThaumicTinkererRecipe getRecipeItem() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldDisplayInTab() {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean shouldDisplayInTab() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -49,174 +49,174 @@ import java.util.Random;
|
||||
|
||||
public class BlockFunnel extends BlockModContainer {
|
||||
|
||||
IIcon sideIcon, topIcon;
|
||||
IIcon sideIcon, topIcon;
|
||||
|
||||
Random random;
|
||||
Random random;
|
||||
|
||||
public BlockFunnel() {
|
||||
super(Material.rock);
|
||||
setHardness(3.0F);
|
||||
setResistance(8.0F);
|
||||
setStepSound(Block.soundTypeStone);
|
||||
setBlockBounds(0F, 0F, 0F, 1F, 1F / 8F, 1F);
|
||||
public BlockFunnel() {
|
||||
super(Material.rock);
|
||||
setHardness(3.0F);
|
||||
setResistance(8.0F);
|
||||
setStepSound(Block.soundTypeStone);
|
||||
setBlockBounds(0F, 0F, 0F, 1F, 1F / 8F, 1F);
|
||||
|
||||
random = new Random();
|
||||
}
|
||||
random = new Random();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean shouldSideBeRendered(IBlockAccess par1iBlockAccess, int par2, int par3, int par4, int par5) {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean shouldSideBeRendered(IBlockAccess par1iBlockAccess, int par2, int par3, int par4, int par5) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister par1IconRegister) {
|
||||
topIcon = IconHelper.forBlock(par1IconRegister, this, 0);
|
||||
sideIcon = IconHelper.forBlock(par1IconRegister, this, 1);
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister par1IconRegister) {
|
||||
topIcon = IconHelper.forBlock(par1IconRegister, this, 0);
|
||||
sideIcon = IconHelper.forBlock(par1IconRegister, this, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int par1, int par2) {
|
||||
return par1 > 1 ? sideIcon : topIcon;
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int par1, int par2) {
|
||||
return par1 > 1 ? sideIcon : topIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getCollisionBoundingBoxFromPool(World par1World, int par2, int par3, int par4) {
|
||||
return AxisAlignedBB.getBoundingBox(par2, par3, par4, par2 + 1, par3 + 1, par4 + 1);
|
||||
}
|
||||
@Override
|
||||
public AxisAlignedBB getCollisionBoundingBoxFromPool(World par1World, int par2, int par3, int par4) {
|
||||
return AxisAlignedBB.getBoundingBox(par2, par3, par4, par2 + 1, par3 + 1, par4 + 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4) {
|
||||
return par1World.getBlock(par2, par3 - 1, par4) == Block.getBlockFromName("hopper");
|
||||
}
|
||||
@Override
|
||||
public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4) {
|
||||
return par1World.getBlock(par2, par3 - 1, par4) == Block.getBlockFromName("hopper");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNeighborBlockChange(World par1World, int par2, int par3, int par4, Block par5) {
|
||||
if (par1World.getBlock(par2, par3 - 1, par4) != Block.getBlockFromName("hopper")) {
|
||||
dropBlockAsItem(par1World, par2, par3, par4, 0, 0);
|
||||
par1World.setBlockToAir(par2, par3, par4);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void onNeighborBlockChange(World par1World, int par2, int par3, int par4, Block par5) {
|
||||
if (par1World.getBlock(par2, par3 - 1, par4) != Block.getBlockFromName("hopper")) {
|
||||
dropBlockAsItem(par1World, par2, par3, par4, 0, 0);
|
||||
par1World.setBlockToAir(par2, par3, par4);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World par1World, int par2, int par3, int par4, Block par5, int par6) {
|
||||
TileFunnel funnel = (TileFunnel) par1World.getTileEntity(par2, par3, par4);
|
||||
@Override
|
||||
public void breakBlock(World par1World, int par2, int par3, int par4, Block par5, int par6) {
|
||||
TileFunnel funnel = (TileFunnel) par1World.getTileEntity(par2, par3, par4);
|
||||
|
||||
if (funnel != null) {
|
||||
for (int j1 = 0; j1 < funnel.getSizeInventory(); ++j1) {
|
||||
ItemStack itemstack = funnel.getStackInSlot(j1);
|
||||
if (funnel != null) {
|
||||
for (int j1 = 0; j1 < funnel.getSizeInventory(); ++j1) {
|
||||
ItemStack itemstack = funnel.getStackInSlot(j1);
|
||||
|
||||
if (itemstack != null) {
|
||||
float f = random.nextFloat() * 0.8F + 0.1F;
|
||||
float f1 = random.nextFloat() * 0.8F + 0.1F;
|
||||
EntityItem entityitem;
|
||||
if (itemstack != null) {
|
||||
float f = random.nextFloat() * 0.8F + 0.1F;
|
||||
float f1 = random.nextFloat() * 0.8F + 0.1F;
|
||||
EntityItem entityitem;
|
||||
|
||||
for (float f2 = random.nextFloat() * 0.8F + 0.1F; itemstack.stackSize > 0; par1World.spawnEntityInWorld(entityitem)) {
|
||||
int k1 = random.nextInt(21) + 10;
|
||||
for (float f2 = random.nextFloat() * 0.8F + 0.1F; itemstack.stackSize > 0; par1World.spawnEntityInWorld(entityitem)) {
|
||||
int k1 = random.nextInt(21) + 10;
|
||||
|
||||
if (k1 > itemstack.stackSize)
|
||||
k1 = itemstack.stackSize;
|
||||
if (k1 > itemstack.stackSize)
|
||||
k1 = itemstack.stackSize;
|
||||
|
||||
itemstack.stackSize -= k1;
|
||||
entityitem = new EntityItem(par1World, par2 + f, par3 + f1, par4 + f2, new ItemStack(itemstack.getItem(), k1, itemstack.getItemDamage()));
|
||||
float f3 = 0.05F;
|
||||
entityitem.motionX = (float) random.nextGaussian() * f3;
|
||||
entityitem.motionY = (float) random.nextGaussian() * f3 + 0.2F;
|
||||
entityitem.motionZ = (float) random.nextGaussian() * f3;
|
||||
itemstack.stackSize -= k1;
|
||||
entityitem = new EntityItem(par1World, par2 + f, par3 + f1, par4 + f2, new ItemStack(itemstack.getItem(), k1, itemstack.getItemDamage()));
|
||||
float f3 = 0.05F;
|
||||
entityitem.motionX = (float) random.nextGaussian() * f3;
|
||||
entityitem.motionY = (float) random.nextGaussian() * f3 + 0.2F;
|
||||
entityitem.motionZ = (float) random.nextGaussian() * f3;
|
||||
|
||||
if (itemstack.hasTagCompound())
|
||||
entityitem.getEntityItem().setTagCompound((NBTTagCompound) itemstack.getTagCompound().copy());
|
||||
}
|
||||
}
|
||||
}
|
||||
if (itemstack.hasTagCompound())
|
||||
entityitem.getEntityItem().setTagCompound((NBTTagCompound) itemstack.getTagCompound().copy());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
par1World.func_147453_f(par2, par3, par4, par5);
|
||||
}
|
||||
par1World.func_147453_f(par2, par3, par4, par5);
|
||||
}
|
||||
|
||||
super.breakBlock(par1World, par2, par3, par4, par5, par6);
|
||||
}
|
||||
super.breakBlock(par1World, par2, par3, par4, par5, par6);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) {
|
||||
TileFunnel funnel = (TileFunnel) par1World.getTileEntity(par2, par3, par4);
|
||||
ItemStack stack = funnel.getStackInSlot(0);
|
||||
@Override
|
||||
public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) {
|
||||
TileFunnel funnel = (TileFunnel) par1World.getTileEntity(par2, par3, par4);
|
||||
ItemStack stack = funnel.getStackInSlot(0);
|
||||
|
||||
if (stack == null) {
|
||||
ItemStack playerStack = par5EntityPlayer.getCurrentEquippedItem();
|
||||
if (funnel.canInsertItem(0, playerStack, 1)) {
|
||||
funnel.setInventorySlotContents(0, playerStack.splitStack(1));
|
||||
if (stack == null) {
|
||||
ItemStack playerStack = par5EntityPlayer.getCurrentEquippedItem();
|
||||
if (funnel.canInsertItem(0, playerStack, 1)) {
|
||||
funnel.setInventorySlotContents(0, playerStack.splitStack(1));
|
||||
|
||||
if (playerStack.stackSize <= 0)
|
||||
par5EntityPlayer.inventory.setInventorySlotContents(par5EntityPlayer.inventory.currentItem, null);
|
||||
funnel.markDirty();
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
if (!par5EntityPlayer.inventory.addItemStackToInventory(stack))
|
||||
par5EntityPlayer.dropPlayerItemWithRandomChoice(stack, false);
|
||||
if (playerStack.stackSize <= 0)
|
||||
par5EntityPlayer.inventory.setInventorySlotContents(par5EntityPlayer.inventory.currentItem, null);
|
||||
funnel.markDirty();
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
if (!par5EntityPlayer.inventory.addItemStackToInventory(stack))
|
||||
par5EntityPlayer.dropPlayerItemWithRandomChoice(stack, false);
|
||||
|
||||
funnel.setInventorySlotContents(0, null);
|
||||
funnel.markDirty();
|
||||
return true;
|
||||
}
|
||||
funnel.setInventorySlotContents(0, null);
|
||||
funnel.markDirty();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta) {
|
||||
return new TileFunnel();
|
||||
}
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta) {
|
||||
return new TileFunnel();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<Object> getSpecialParameters() {
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public ArrayList<Object> getSpecialParameters() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBlockName() {
|
||||
return LibBlockNames.FUNNEL;
|
||||
}
|
||||
@Override
|
||||
public String getBlockName() {
|
||||
return LibBlockNames.FUNNEL;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRegister() {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean shouldRegister() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldDisplayInTab() {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean shouldDisplayInTab() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends ItemBlock> getItemBlock() {
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public Class<? extends ItemBlock> getItemBlock() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends TileEntity> getTileEntity() {
|
||||
return TileFunnel.class;
|
||||
}
|
||||
@Override
|
||||
public Class<? extends TileEntity> getTileEntity() {
|
||||
return TileFunnel.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IRegisterableResearch getResearchItem() {
|
||||
return (IRegisterableResearch) new TTResearchItem(LibResearch.KEY_FUNNEL, new AspectList().add(Aspect.TOOL, 1).add(Aspect.TRAVEL, 2), 0, -7, 1, new ItemStack(this)).setParentsHidden("DISTILESSENTIA").setParents(LibResearch.KEY_BRIGHT_NITOR).setConcealed()
|
||||
.setPages(new ResearchPage("0"), ResearchHelper.arcaneRecipePage(LibResearch.KEY_FUNNEL)).setSecondary();
|
||||
@Override
|
||||
public IRegisterableResearch getResearchItem() {
|
||||
return (IRegisterableResearch) new TTResearchItem(LibResearch.KEY_FUNNEL, new AspectList().add(Aspect.TOOL, 1).add(Aspect.TRAVEL, 2), 0, -7, 1, new ItemStack(this)).setParentsHidden("DISTILESSENTIA").setParents(LibResearch.KEY_BRIGHT_NITOR).setConcealed()
|
||||
.setPages(new ResearchPage("0"), ResearchHelper.arcaneRecipePage(LibResearch.KEY_FUNNEL)).setSecondary();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ThaumicTinkererRecipe getRecipeItem() {
|
||||
return new ThaumicTinkererArcaneRecipe(LibResearch.KEY_FUNNEL, LibResearch.KEY_FUNNEL, new ItemStack(this), new AspectList().add(Aspect.ORDER, 1).add(Aspect.ENTROPY, 1),
|
||||
"STS",
|
||||
'S', new ItemStack(Blocks.stone),
|
||||
'T', new ItemStack(ConfigItems.itemResource, 1, 2));
|
||||
}
|
||||
@Override
|
||||
public ThaumicTinkererRecipe getRecipeItem() {
|
||||
return new ThaumicTinkererArcaneRecipe(LibResearch.KEY_FUNNEL, LibResearch.KEY_FUNNEL, new ItemStack(this), new AspectList().add(Aspect.ORDER, 1).add(Aspect.ENTROPY, 1),
|
||||
"STS",
|
||||
'S', new ItemStack(Blocks.stone),
|
||||
'T', new ItemStack(ConfigItems.itemResource, 1, 2));
|
||||
}
|
||||
}
|
||||
@@ -36,146 +36,146 @@ import java.util.Random;
|
||||
|
||||
public abstract class BlockGas extends BlockMod implements ITTinkererBlock {
|
||||
|
||||
public BlockGas() {
|
||||
super(Material.air);
|
||||
setBlockBounds(0, 0, 0, 0, 0, 0);
|
||||
setTickRandomly(true);
|
||||
}
|
||||
public BlockGas() {
|
||||
super(Material.air);
|
||||
setBlockBounds(0, 0, 0, 0, 0, 0);
|
||||
setTickRandomly(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister par1IconRegister) {
|
||||
blockIcon = IconHelper.emptyTexture(par1IconRegister);
|
||||
}
|
||||
public BlockGas(Material par2Material) {
|
||||
super(par2Material);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return -1;
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister par1IconRegister) {
|
||||
blockIcon = IconHelper.emptyTexture(par1IconRegister);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random) {
|
||||
int meta = par1World.getBlockMetadata(par2, par3, par4);
|
||||
if (meta != 0) {
|
||||
setAt(par1World, par2 - 1, par3, par4, meta - 1);
|
||||
setAt(par1World, par2 + 1, par3, par4, meta - 1);
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return -1;
|
||||
}
|
||||
|
||||
setAt(par1World, par2, par3 - 1, par4, meta - 1);
|
||||
setAt(par1World, par2, par3 + 1, par4, meta - 1);
|
||||
@Override
|
||||
public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random) {
|
||||
int meta = par1World.getBlockMetadata(par2, par3, par4);
|
||||
if (meta != 0) {
|
||||
setAt(par1World, par2 - 1, par3, par4, meta - 1);
|
||||
setAt(par1World, par2 + 1, par3, par4, meta - 1);
|
||||
|
||||
setAt(par1World, par2, par3, par4 - 1, meta - 1);
|
||||
setAt(par1World, par2, par3, par4 + 1, meta - 1);
|
||||
setAt(par1World, par2, par3 - 1, par4, meta - 1);
|
||||
setAt(par1World, par2, par3 + 1, par4, meta - 1);
|
||||
|
||||
// Just in case...
|
||||
par1World.setBlockMetadataWithNotify(par2, par3, par4, 0, 2);
|
||||
setAt(par1World, par2, par3, par4 - 1, meta - 1);
|
||||
setAt(par1World, par2, par3, par4 + 1, meta - 1);
|
||||
|
||||
placeParticle(par1World, par2, par3, par4);
|
||||
}
|
||||
}
|
||||
// Just in case...
|
||||
par1World.setBlockMetadataWithNotify(par2, par3, par4, 0, 2);
|
||||
|
||||
public void placeParticle(World world, int par2, int par3, int par4) {
|
||||
// NO-OP, override
|
||||
}
|
||||
placeParticle(par1World, par2, par3, par4);
|
||||
}
|
||||
}
|
||||
|
||||
private void setAt(World world, int x, int y, int z, int meta) {
|
||||
if (world.isAirBlock(x, y, z) && world.getBlock(x, y, z) != this) {
|
||||
if (!world.isRemote)
|
||||
world.setBlock(x, y, z, this, meta, 2);
|
||||
world.scheduleBlockUpdate(x, y, z, this, 10);
|
||||
}
|
||||
}
|
||||
public void placeParticle(World world, int par2, int par3, int par4) {
|
||||
// NO-OP, override
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBlockNormalCube() {
|
||||
return false;
|
||||
}
|
||||
private void setAt(World world, int x, int y, int z, int meta) {
|
||||
if (world.isAirBlock(x, y, z) && world.getBlock(x, y, z) != this) {
|
||||
if (!world.isRemote)
|
||||
world.setBlock(x, y, z, this, meta, 2);
|
||||
world.scheduleBlockUpdate(x, y, z, this, 10);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean isBlockNormalCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canEntityDestroy(IBlockAccess world, int x, int y, int z, Entity e) {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canCollideCheck(int par1, boolean par2) {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean canEntityDestroy(IBlockAccess world, int x, int y, int z, Entity e) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBeReplacedByLeaves(IBlockAccess world, int x, int y, int z) {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean canCollideCheck(int par1, boolean par2) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canDropFromExplosion(Explosion par1Explosion) {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean canBeReplacedByLeaves(IBlockAccess world, int x, int y, int z) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune) {
|
||||
return new ArrayList(); // Empty List
|
||||
}
|
||||
@Override
|
||||
public boolean canDropFromExplosion(Explosion par1Explosion) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getCollisionBoundingBoxFromPool(World par1World, int par2, int par3, int par4) {
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune) {
|
||||
return new ArrayList(); // Empty List
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAir(IBlockAccess world, int x, int y, int z) {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public AxisAlignedBB getCollisionBoundingBoxFromPool(World par1World, int par2, int par3, int par4) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
boolean registerInCreative() {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean isAir(IBlockAccess world, int x, int y, int z) {
|
||||
return true;
|
||||
}
|
||||
|
||||
public BlockGas(Material par2Material) {
|
||||
super(par2Material);
|
||||
}
|
||||
@Override
|
||||
boolean registerInCreative() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<Object> getSpecialParameters() {
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public ArrayList<Object> getSpecialParameters() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRegister() {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean shouldRegister() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean func_149730_j() {
|
||||
return super.func_149730_j();
|
||||
}
|
||||
@Override
|
||||
public boolean func_149730_j() {
|
||||
return super.func_149730_j();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IRegisterableResearch getResearchItem() {
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public IRegisterableResearch getResearchItem() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ThaumicTinkererRecipe getRecipeItem() {
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public ThaumicTinkererRecipe getRecipeItem() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldDisplayInTab() {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean shouldDisplayInTab() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends ItemBlock> getItemBlock() {
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public Class<? extends ItemBlock> getItemBlock() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends TileEntity> getTileEntity() {
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public Class<? extends TileEntity> getTileEntity() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -26,35 +26,35 @@ import java.util.Random;
|
||||
|
||||
public class BlockGaseousLight extends BlockGas {
|
||||
|
||||
public BlockGaseousLight() {
|
||||
super();
|
||||
setLightLevel(0.85F);
|
||||
}
|
||||
public BlockGaseousLight() {
|
||||
super();
|
||||
setLightLevel(0.85F);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void randomDisplayTick(World par1World, int par2, int par3, int par4, Random par5Random) {
|
||||
if (par5Random.nextFloat() < 0.0075F)
|
||||
ThaumicTinkerer.tcProxy.sparkle(par2 + 0.5F, par3 + 0.5F, par4 + 0.5F, 1F, 1, par5Random.nextFloat() / 2);
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void randomDisplayTick(World par1World, int par2, int par3, int par4, Random par5Random) {
|
||||
if (par5Random.nextFloat() < 0.0075F)
|
||||
ThaumicTinkerer.tcProxy.sparkle(par2 + 0.5F, par3 + 0.5F, par4 + 0.5F, 1F, 1, par5Random.nextFloat() / 2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void placeParticle(World world, int par2, int par3, int par4) {
|
||||
ThaumicTinkerer.tcProxy.sparkle(par2 + 0.5F, par3 + 0.5F, par4 + 0.5F, 1);
|
||||
}
|
||||
@Override
|
||||
public void placeParticle(World world, int par2, int par3, int par4) {
|
||||
ThaumicTinkerer.tcProxy.sparkle(par2 + 0.5F, par3 + 0.5F, par4 + 0.5F, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBlockName() {
|
||||
return LibBlockNames.GASEOUS_LIGHT;
|
||||
}
|
||||
@Override
|
||||
public String getBlockName() {
|
||||
return LibBlockNames.GASEOUS_LIGHT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends ItemBlock> getItemBlock() {
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public Class<? extends ItemBlock> getItemBlock() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends TileEntity> getTileEntity() {
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public Class<? extends TileEntity> getTileEntity() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -27,69 +27,69 @@ import java.util.ArrayList;
|
||||
|
||||
public class BlockGolemConnector extends BlockCamo {
|
||||
|
||||
public BlockGolemConnector() {
|
||||
super(Material.wood);
|
||||
}
|
||||
public BlockGolemConnector() {
|
||||
super(Material.wood);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileCamo createNewTileEntity(World world, int meta) {
|
||||
// TODO Auto-generated method stub
|
||||
return new TileGolemConnector();
|
||||
}
|
||||
@Override
|
||||
public TileCamo createNewTileEntity(World world, int meta) {
|
||||
// TODO Auto-generated method stub
|
||||
return new TileGolemConnector();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<Object> getSpecialParameters() {
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public ArrayList<Object> getSpecialParameters() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBlockName() {
|
||||
return LibBlockNames.GOLEMCONNECTOR;
|
||||
}
|
||||
@Override
|
||||
public String getBlockName() {
|
||||
return LibBlockNames.GOLEMCONNECTOR;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRegister() {
|
||||
return Loader.isModLoaded("ComputerCraft");
|
||||
}
|
||||
@Override
|
||||
public boolean shouldRegister() {
|
||||
return Loader.isModLoaded("ComputerCraft");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldDisplayInTab() {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean shouldDisplayInTab() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends ItemBlock> getItemBlock() {
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public Class<? extends ItemBlock> getItemBlock() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends TileEntity> getTileEntity() {
|
||||
return TileGolemConnector.class;
|
||||
}
|
||||
@Override
|
||||
public Class<? extends TileEntity> getTileEntity() {
|
||||
return TileGolemConnector.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IRegisterableResearch getResearchItem() {
|
||||
return (IRegisterableResearch) new TTResearchItem(LibResearch.KEY_GOLEMCONNECTOR, new AspectList().add(Aspect.ORDER, 1).add(Aspect.TRAVEL, 2).add(Aspect.TOOL, 1), 1, 0, 0, new ItemStack(this)).setParents(LibResearch.KEY_PERIPHERALS).setParentsHidden("GOLEMBELL").setConcealed().setRound()
|
||||
.setPages(new ResearchPage("0"), ResearchHelper.arcaneRecipePage(LibResearch.KEY_GOLEMCONNECTOR), new ResearchPage("1"), ResearchHelper.arcaneRecipePage(LibResearch.KEY_INTERFACE + "1"), new ResearchPage("2"), new ResearchPage("3"));
|
||||
}
|
||||
@Override
|
||||
public IRegisterableResearch getResearchItem() {
|
||||
return (IRegisterableResearch) new TTResearchItem(LibResearch.KEY_GOLEMCONNECTOR, new AspectList().add(Aspect.ORDER, 1).add(Aspect.TRAVEL, 2).add(Aspect.TOOL, 1), 1, 0, 0, new ItemStack(this)).setParents(LibResearch.KEY_PERIPHERALS).setParentsHidden("GOLEMBELL").setConcealed().setRound()
|
||||
.setPages(new ResearchPage("0"), ResearchHelper.arcaneRecipePage(LibResearch.KEY_GOLEMCONNECTOR), new ResearchPage("1"), ResearchHelper.arcaneRecipePage(LibResearch.KEY_INTERFACE + "1"), new ResearchPage("2"), new ResearchPage("3"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ThaumicTinkererRecipe getRecipeItem() {
|
||||
return new ThaumicTinkererArcaneRecipe(LibResearch.KEY_GOLEMCONNECTOR, LibResearch.KEY_GOLEMCONNECTOR, new ItemStack(this), new AspectList().add(Aspect.AIR, 20).add(Aspect.ORDER, 5).add(Aspect.ENTROPY, 15),
|
||||
"WFW", "sIs", "WFW",
|
||||
'I', new ItemStack(ConfigItems.itemGolemBell),
|
||||
's', new ItemStack(Items.ender_pearl),
|
||||
'W', new ItemStack(ConfigBlocks.blockMagicalLog),
|
||||
'F', new ItemStack(Blocks.redstone_block));
|
||||
}
|
||||
@Override
|
||||
public ThaumicTinkererRecipe getRecipeItem() {
|
||||
return new ThaumicTinkererArcaneRecipe(LibResearch.KEY_GOLEMCONNECTOR, LibResearch.KEY_GOLEMCONNECTOR, new ItemStack(this), new AspectList().add(Aspect.AIR, 20).add(Aspect.ORDER, 5).add(Aspect.ENTROPY, 15),
|
||||
"WFW", "sIs", "WFW",
|
||||
'I', new ItemStack(ConfigItems.itemGolemBell),
|
||||
's', new ItemStack(Items.ender_pearl),
|
||||
'W', new ItemStack(ConfigBlocks.blockMagicalLog),
|
||||
'F', new ItemStack(Blocks.redstone_block));
|
||||
}
|
||||
}
|
||||
@@ -8,7 +8,6 @@ import net.minecraft.entity.Entity;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
@@ -14,7 +14,6 @@ import thaumcraft.api.aspects.Aspect;
|
||||
import thaumcraft.api.aspects.AspectList;
|
||||
import thaumcraft.common.lib.research.ResearchManager;
|
||||
import thaumic.tinkerer.client.core.helper.IconHelper;
|
||||
import thaumic.tinkerer.client.core.proxy.TTClientProxy;
|
||||
import thaumic.tinkerer.client.lib.LibRenderIDs;
|
||||
import thaumic.tinkerer.common.ThaumicTinkerer;
|
||||
import thaumic.tinkerer.common.block.tile.TileInfusedFarmland;
|
||||
@@ -38,6 +37,42 @@ public class BlockInfusedGrain extends BlockCrops implements ITTinkererBlock {
|
||||
//Code based off vanilla potato code
|
||||
|
||||
|
||||
public static final int BREEDING_CHANCE = 10;
|
||||
private IIcon[][] icons;
|
||||
|
||||
//Returns 0-5 for primal aspects, or 6 if compound aspect
|
||||
public static int getNumberFromAspectForTexture(Aspect aspect) {
|
||||
if (aspect == Aspect.AIR) {
|
||||
return 0;
|
||||
}
|
||||
if (aspect == Aspect.FIRE) {
|
||||
return 1;
|
||||
}
|
||||
if (aspect == Aspect.WATER) {
|
||||
return 2;
|
||||
}
|
||||
if (aspect == Aspect.EARTH) {
|
||||
return 3;
|
||||
}
|
||||
if (aspect == Aspect.ORDER) {
|
||||
return 4;
|
||||
}
|
||||
if (aspect == Aspect.ENTROPY) {
|
||||
return 5;
|
||||
}
|
||||
return 6;
|
||||
}
|
||||
|
||||
public static Aspect getAspect(IBlockAccess world, int x, int y, int z) {
|
||||
return world.getTileEntity(x, y, z) instanceof TileInfusedGrain ? ((TileInfusedGrain) world.getTileEntity(x, y, z)).aspect : null;
|
||||
}
|
||||
|
||||
public static void setAspect(IBlockAccess world, int x, int y, int z, Aspect aspect) {
|
||||
if (world.getTileEntity(x, y, z) instanceof TileInfusedGrain) {
|
||||
((TileInfusedGrain) world.getTileEntity(x, y, z)).aspect = aspect;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int meta) {
|
||||
if (meta < 7) {
|
||||
@@ -66,32 +101,6 @@ public class BlockInfusedGrain extends BlockCrops implements ITTinkererBlock {
|
||||
return LibRenderIDs.idGrain;
|
||||
}
|
||||
|
||||
//Returns 0-5 for primal aspects, or 6 if compound aspect
|
||||
public static int getNumberFromAspectForTexture(Aspect aspect) {
|
||||
if (aspect == Aspect.AIR) {
|
||||
return 0;
|
||||
}
|
||||
if (aspect == Aspect.FIRE) {
|
||||
return 1;
|
||||
}
|
||||
if (aspect == Aspect.WATER) {
|
||||
return 2;
|
||||
}
|
||||
if (aspect == Aspect.EARTH) {
|
||||
return 3;
|
||||
}
|
||||
if (aspect == Aspect.ORDER) {
|
||||
return 4;
|
||||
}
|
||||
if (aspect == Aspect.ENTROPY) {
|
||||
return 5;
|
||||
}
|
||||
return 6;
|
||||
}
|
||||
|
||||
|
||||
private IIcon[][] icons;
|
||||
|
||||
@Override
|
||||
public void registerBlockIcons(IIconRegister par1IconRegister) {
|
||||
icons = new IIcon[7][4];
|
||||
@@ -122,7 +131,7 @@ public class BlockInfusedGrain extends BlockCrops implements ITTinkererBlock {
|
||||
}
|
||||
if (metadata >= 7) {
|
||||
do {
|
||||
ret.add(AspectCropLootManager.getLootForAspect(getAspect(world, x, y, z)));
|
||||
ret.add(AspectCropLootManager.getLootForAspect(getAspect(world, x, y, z)));
|
||||
|
||||
} while (world.rand.nextInt(75) < getPrimalTendencyCount(world, x, y, z, Aspect.ORDER));
|
||||
}
|
||||
@@ -168,9 +177,6 @@ public class BlockInfusedGrain extends BlockCrops implements ITTinkererBlock {
|
||||
checkAndDropBlock(world, x, y, z);
|
||||
}
|
||||
|
||||
|
||||
public static final int BREEDING_CHANCE = 10;
|
||||
|
||||
public Aspect getAspectDropped(World world, int x, int y, int z, int metadata) {
|
||||
Aspect currentAspect = getAspect(world, x, y, z);
|
||||
if (metadata >= 7 && currentAspect != null) {
|
||||
@@ -239,15 +245,4 @@ public class BlockInfusedGrain extends BlockCrops implements ITTinkererBlock {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public static Aspect getAspect(IBlockAccess world, int x, int y, int z) {
|
||||
return world.getTileEntity(x, y, z) instanceof TileInfusedGrain ? ((TileInfusedGrain) world.getTileEntity(x, y, z)).aspect : null;
|
||||
}
|
||||
|
||||
public static void setAspect(IBlockAccess world, int x, int y, int z, Aspect aspect) {
|
||||
if (world.getTileEntity(x, y, z) instanceof TileInfusedGrain) {
|
||||
((TileInfusedGrain) world.getTileEntity(x, y, z)).aspect = aspect;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -60,185 +60,185 @@ import java.util.Random;
|
||||
|
||||
public class BlockMagnet extends BlockModContainer implements IMultiTileEntityBlock {
|
||||
|
||||
Random random;
|
||||
Random random;
|
||||
|
||||
public BlockMagnet() {
|
||||
super(Material.iron);
|
||||
setBlockBounds(0.0625F, 0F, 0.0625F, 0.9375F, 1F / 16F * 2F, 0.9375F);
|
||||
setHardness(1.7F);
|
||||
setResistance(1F);
|
||||
setStepSound(Block.soundTypeWood);
|
||||
public BlockMagnet() {
|
||||
super(Material.iron);
|
||||
setBlockBounds(0.0625F, 0F, 0.0625F, 0.9375F, 1F / 16F * 2F, 0.9375F);
|
||||
setHardness(1.7F);
|
||||
setResistance(1F);
|
||||
setStepSound(Block.soundTypeWood);
|
||||
|
||||
random = new Random();
|
||||
}
|
||||
random = new Random();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) {
|
||||
if (par5EntityPlayer.getCurrentEquippedItem() != null) {
|
||||
if (par5EntityPlayer.getCurrentEquippedItem().getItem() instanceof ItemWandCasting) {
|
||||
TileEntity tile = par1World.getTileEntity(par2, par3, par4);
|
||||
if (tile != null && tile instanceof TileMobMagnet) {
|
||||
par5EntityPlayer.openGui(ThaumicTinkerer.instance, LibGuiIDs.GUI_ID_MOB_MAGNET, par1World, par2, par3, par4);
|
||||
if (!par1World.isRemote) {
|
||||
par1World.playSoundEffect(par2, par3, par4, "thaumcraft:key", 1F, 0.5F);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) {
|
||||
if (par5EntityPlayer.getCurrentEquippedItem() != null) {
|
||||
if (par5EntityPlayer.getCurrentEquippedItem().getItem() instanceof ItemWandCasting) {
|
||||
TileEntity tile = par1World.getTileEntity(par2, par3, par4);
|
||||
if (tile != null && tile instanceof TileMobMagnet) {
|
||||
par5EntityPlayer.openGui(ThaumicTinkerer.instance, LibGuiIDs.GUI_ID_MOB_MAGNET, par1World, par2, par3, par4);
|
||||
if (!par1World.isRemote) {
|
||||
par1World.playSoundEffect(par2, par3, par4, "thaumcraft:key", 1F, 0.5F);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
int meta = par1World.getBlockMetadata(par2, par3, par4);
|
||||
par1World.setBlockMetadataWithNotify(par2, par3, par4, (meta & 1) == 0 ? meta + 1 : meta - 1, 2);
|
||||
if (!par1World.isRemote) {
|
||||
par1World.playSoundEffect(par2, par3, par4, "random.click", 1F, 0.5F);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
int meta = par1World.getBlockMetadata(par2, par3, par4);
|
||||
par1World.setBlockMetadataWithNotify(par2, par3, par4, (meta & 1) == 0 ? meta + 1 : meta - 1, 2);
|
||||
if (!par1World.isRemote) {
|
||||
par1World.playSoundEffect(par2, par3, par4, "random.click", 1F, 0.5F);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World par1World, int par2, int par3, int par4, Block par5, int par6) {
|
||||
TileMagnet magnet = (TileMagnet) par1World.getTileEntity(par2, par3, par4);
|
||||
TileMobMagnet mobMagnet = magnet instanceof TileMobMagnet ? (TileMobMagnet) magnet : null;
|
||||
@Override
|
||||
public void breakBlock(World par1World, int par2, int par3, int par4, Block par5, int par6) {
|
||||
TileMagnet magnet = (TileMagnet) par1World.getTileEntity(par2, par3, par4);
|
||||
TileMobMagnet mobMagnet = magnet instanceof TileMobMagnet ? (TileMobMagnet) magnet : null;
|
||||
|
||||
if (mobMagnet != null) {
|
||||
for (int j1 = 0; j1 < mobMagnet.getSizeInventory(); ++j1) {
|
||||
ItemStack itemstack = mobMagnet.getStackInSlot(j1);
|
||||
if (mobMagnet != null) {
|
||||
for (int j1 = 0; j1 < mobMagnet.getSizeInventory(); ++j1) {
|
||||
ItemStack itemstack = mobMagnet.getStackInSlot(j1);
|
||||
|
||||
if (itemstack != null) {
|
||||
float f = random.nextFloat() * 0.8F + 0.1F;
|
||||
float f1 = random.nextFloat() * 0.8F + 0.1F;
|
||||
EntityItem entityitem;
|
||||
if (itemstack != null) {
|
||||
float f = random.nextFloat() * 0.8F + 0.1F;
|
||||
float f1 = random.nextFloat() * 0.8F + 0.1F;
|
||||
EntityItem entityitem;
|
||||
|
||||
for (float f2 = random.nextFloat() * 0.8F + 0.1F; itemstack.stackSize > 0; par1World.spawnEntityInWorld(entityitem)) {
|
||||
int k1 = random.nextInt(21) + 10;
|
||||
for (float f2 = random.nextFloat() * 0.8F + 0.1F; itemstack.stackSize > 0; par1World.spawnEntityInWorld(entityitem)) {
|
||||
int k1 = random.nextInt(21) + 10;
|
||||
|
||||
if (k1 > itemstack.stackSize)
|
||||
k1 = itemstack.stackSize;
|
||||
if (k1 > itemstack.stackSize)
|
||||
k1 = itemstack.stackSize;
|
||||
|
||||
itemstack.stackSize -= k1;
|
||||
entityitem = new EntityItem(par1World, par2 + f, par3 + f1, par4 + f2, new ItemStack(itemstack.getItem(), k1, itemstack.getItemDamage()));
|
||||
float f3 = 0.05F;
|
||||
entityitem.motionX = (float) random.nextGaussian() * f3;
|
||||
entityitem.motionY = (float) random.nextGaussian() * f3 + 0.2F;
|
||||
entityitem.motionZ = (float) random.nextGaussian() * f3;
|
||||
itemstack.stackSize -= k1;
|
||||
entityitem = new EntityItem(par1World, par2 + f, par3 + f1, par4 + f2, new ItemStack(itemstack.getItem(), k1, itemstack.getItemDamage()));
|
||||
float f3 = 0.05F;
|
||||
entityitem.motionX = (float) random.nextGaussian() * f3;
|
||||
entityitem.motionY = (float) random.nextGaussian() * f3 + 0.2F;
|
||||
entityitem.motionZ = (float) random.nextGaussian() * f3;
|
||||
|
||||
if (itemstack.hasTagCompound())
|
||||
entityitem.getEntityItem().setTagCompound((NBTTagCompound) itemstack.getTagCompound().copy());
|
||||
}
|
||||
}
|
||||
}
|
||||
if (itemstack.hasTagCompound())
|
||||
entityitem.getEntityItem().setTagCompound((NBTTagCompound) itemstack.getTagCompound().copy());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
par1World.func_147453_f(par2, par3, par4, par5);
|
||||
}
|
||||
par1World.func_147453_f(par2, par3, par4, par5);
|
||||
}
|
||||
|
||||
super.breakBlock(par1World, par2, par3, par4, par5, par6);
|
||||
}
|
||||
super.breakBlock(par1World, par2, par3, par4, par5, par6);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(int par1) {
|
||||
switch (par1) {
|
||||
case 1:
|
||||
return 0;
|
||||
case 2:
|
||||
return 1;
|
||||
case 3:
|
||||
return 1;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public int damageDropped(int par1) {
|
||||
switch (par1) {
|
||||
case 1:
|
||||
return 0;
|
||||
case 2:
|
||||
return 1;
|
||||
case 3:
|
||||
return 1;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List) {
|
||||
super.getSubBlocks(par1, par2CreativeTabs, par3List);
|
||||
par3List.add(new ItemStack(par1, 1, 1));
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List) {
|
||||
super.getSubBlocks(par1, par2CreativeTabs, par3List);
|
||||
par3List.add(new ItemStack(par1, 1, 1));
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int par1, int par2) {
|
||||
return Block.getBlockFromName("log").getIcon(par1, 1);
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int par1, int par2) {
|
||||
return Block.getBlockFromName("log").getIcon(par1, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return LibRenderIDs.idMagnet;
|
||||
}
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return LibRenderIDs.idMagnet;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int metadata) {
|
||||
return (metadata & 2) == 2 ? new TileMobMagnet() : new TileMagnet();
|
||||
}
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int metadata) {
|
||||
return (metadata & 2) == 2 ? new TileMobMagnet() : new TileMagnet();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<Object> getSpecialParameters() {
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public ArrayList<Object> getSpecialParameters() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBlockName() {
|
||||
return LibBlockNames.MAGNET;
|
||||
}
|
||||
@Override
|
||||
public String getBlockName() {
|
||||
return LibBlockNames.MAGNET;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRegister() {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean shouldRegister() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldDisplayInTab() {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean shouldDisplayInTab() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends ItemBlock> getItemBlock() {
|
||||
return ItemBlockMagnet.class;
|
||||
}
|
||||
@Override
|
||||
public Class<? extends ItemBlock> getItemBlock() {
|
||||
return ItemBlockMagnet.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends TileEntity> getTileEntity() {
|
||||
return TileMagnet.class;
|
||||
}
|
||||
@Override
|
||||
public Class<? extends TileEntity> getTileEntity() {
|
||||
return TileMagnet.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IRegisterableResearch getResearchItem() {
|
||||
return (IRegisterableResearch) new TTResearchItem(LibResearch.KEY_MAGNETS, new AspectList().add(Aspect.MECHANISM, 2).add(Aspect.MOTION, 1).add(Aspect.SENSES, 1), -6, 3, 3, new ItemStack(this)).setParents(LibResearch.KEY_INTERFACE).setParentsHidden(LibResearch.KEY_FOCUS_TELEKINESIS).setConcealed()
|
||||
.setPages(new ResearchPage("0"), new ResearchPage("1"), ResearchHelper.arcaneRecipePage(LibResearch.KEY_MAGNET), ResearchHelper.arcaneRecipePage(LibResearch.KEY_MOB_MAGNET), ResearchHelper.crucibleRecipePage(LibResearch.KEY_MAGNETS));
|
||||
@Override
|
||||
public IRegisterableResearch getResearchItem() {
|
||||
return (IRegisterableResearch) new TTResearchItem(LibResearch.KEY_MAGNETS, new AspectList().add(Aspect.MECHANISM, 2).add(Aspect.MOTION, 1).add(Aspect.SENSES, 1), -6, 3, 3, new ItemStack(this)).setParents(LibResearch.KEY_INTERFACE).setParentsHidden(LibResearch.KEY_FOCUS_TELEKINESIS).setConcealed()
|
||||
.setPages(new ResearchPage("0"), new ResearchPage("1"), ResearchHelper.arcaneRecipePage(LibResearch.KEY_MAGNET), ResearchHelper.arcaneRecipePage(LibResearch.KEY_MOB_MAGNET), ResearchHelper.crucibleRecipePage(LibResearch.KEY_MAGNETS));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ThaumicTinkererRecipe getRecipeItem() {
|
||||
@Override
|
||||
public ThaumicTinkererRecipe getRecipeItem() {
|
||||
|
||||
return new ThaumicTinkererRecipeMulti(
|
||||
new ThaumicTinkererArcaneRecipe(LibResearch.KEY_MAGNET, LibResearch.KEY_MAGNETS, new ItemStack(this), new AspectList().add(Aspect.AIR, 20).add(Aspect.ORDER, 5).add(Aspect.EARTH, 15).add(Aspect.ENTROPY, 5),
|
||||
" I ", "SIs", "WFW",
|
||||
'I', new ItemStack(Items.iron_ingot),
|
||||
's', new ItemStack(ConfigItems.itemShard, 1, 3),
|
||||
'S', new ItemStack(ConfigItems.itemShard),
|
||||
'W', new ItemStack(ConfigBlocks.blockMagicalLog),
|
||||
'F', new ItemStack(ThaumicTinkerer.registry.getFirstItemFromClass(ItemFocusTelekinesis.class))),
|
||||
new ThaumicTinkererArcaneRecipe(LibResearch.KEY_MOB_MAGNET, LibResearch.KEY_MAGNETS, new ItemStack(this, 1, 1), new AspectList().add(Aspect.AIR, 20).add(Aspect.ORDER, 5).add(Aspect.EARTH, 15).add(Aspect.ENTROPY, 5),
|
||||
" G ", "SGs", "WFW",
|
||||
'G', RecipeHelper.oreDictOrStack(new ItemStack(Items.gold_ingot), "ingotCopper"),
|
||||
's', new ItemStack(ConfigItems.itemShard, 1, 3),
|
||||
'S', new ItemStack(ConfigItems.itemShard),
|
||||
'W', new ItemStack(ConfigBlocks.blockMagicalLog),
|
||||
'F', new ItemStack(ThaumicTinkerer.registry.getFirstItemFromClass(ItemFocusTelekinesis.class)))
|
||||
return new ThaumicTinkererRecipeMulti(
|
||||
new ThaumicTinkererArcaneRecipe(LibResearch.KEY_MAGNET, LibResearch.KEY_MAGNETS, new ItemStack(this), new AspectList().add(Aspect.AIR, 20).add(Aspect.ORDER, 5).add(Aspect.EARTH, 15).add(Aspect.ENTROPY, 5),
|
||||
" I ", "SIs", "WFW",
|
||||
'I', new ItemStack(Items.iron_ingot),
|
||||
's', new ItemStack(ConfigItems.itemShard, 1, 3),
|
||||
'S', new ItemStack(ConfigItems.itemShard),
|
||||
'W', new ItemStack(ConfigBlocks.blockMagicalLog),
|
||||
'F', new ItemStack(ThaumicTinkerer.registry.getFirstItemFromClass(ItemFocusTelekinesis.class))),
|
||||
new ThaumicTinkererArcaneRecipe(LibResearch.KEY_MOB_MAGNET, LibResearch.KEY_MAGNETS, new ItemStack(this, 1, 1), new AspectList().add(Aspect.AIR, 20).add(Aspect.ORDER, 5).add(Aspect.EARTH, 15).add(Aspect.ENTROPY, 5),
|
||||
" G ", "SGs", "WFW",
|
||||
'G', RecipeHelper.oreDictOrStack(new ItemStack(Items.gold_ingot), "ingotCopper"),
|
||||
's', new ItemStack(ConfigItems.itemShard, 1, 3),
|
||||
'S', new ItemStack(ConfigItems.itemShard),
|
||||
'W', new ItemStack(ConfigBlocks.blockMagicalLog),
|
||||
'F', new ItemStack(ThaumicTinkerer.registry.getFirstItemFromClass(ItemFocusTelekinesis.class)))
|
||||
|
||||
);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HashMap<Class<? extends TileEntity>, String> getAdditionalTileEntities() {
|
||||
|
||||
@@ -29,44 +29,44 @@ import java.util.ArrayList;
|
||||
|
||||
public abstract class BlockMod extends Block implements ITTinkererBlock {
|
||||
|
||||
public BlockMod(Material par2Material) {
|
||||
super(par2Material);
|
||||
if (registerInCreative())
|
||||
setCreativeTab(ModCreativeTab.INSTANCE);
|
||||
}
|
||||
public BlockMod(Material par2Material) {
|
||||
super(par2Material);
|
||||
if (registerInCreative())
|
||||
setCreativeTab(ModCreativeTab.INSTANCE);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister par1IconRegister) {
|
||||
blockIcon = IconHelper.forBlock(par1IconRegister, this);
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister par1IconRegister) {
|
||||
blockIcon = IconHelper.forBlock(par1IconRegister, this);
|
||||
}
|
||||
|
||||
boolean registerInCreative() {
|
||||
return true;
|
||||
}
|
||||
boolean registerInCreative() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<Object> getSpecialParameters() {
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public ArrayList<Object> getSpecialParameters() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRegister() {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean shouldRegister() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldDisplayInTab() {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean shouldDisplayInTab() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends ItemBlock> getItemBlock() {
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public Class<? extends ItemBlock> getItemBlock() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends TileEntity> getTileEntity() {
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public Class<? extends TileEntity> getTileEntity() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -28,35 +28,35 @@ import thaumic.tinkerer.common.registry.ITTinkererBlock;
|
||||
|
||||
public abstract class BlockModContainer<T extends TileEntity> extends BlockContainer implements ITTinkererBlock {
|
||||
|
||||
protected BlockModContainer(Material par2Material) {
|
||||
super(par2Material);
|
||||
if (registerInCreative())
|
||||
setCreativeTab(ModCreativeTab.INSTANCE);
|
||||
}
|
||||
protected BlockModContainer(Material par2Material) {
|
||||
super(par2Material);
|
||||
if (registerInCreative())
|
||||
setCreativeTab(ModCreativeTab.INSTANCE);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister par1IconRegister) {
|
||||
blockIcon = IconHelper.forBlock(par1IconRegister, this);
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister par1IconRegister) {
|
||||
blockIcon = IconHelper.forBlock(par1IconRegister, this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Does the block register in the creative inv? *
|
||||
*/
|
||||
boolean registerInCreative() {
|
||||
return true;
|
||||
}
|
||||
/**
|
||||
* Does the block register in the creative inv? *
|
||||
*/
|
||||
boolean registerInCreative() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public abstract T createNewTileEntity(World world, int var2);
|
||||
@Override
|
||||
public abstract T createNewTileEntity(World world, int var2);
|
||||
|
||||
@Override
|
||||
public Class<? extends ItemBlock> getItemBlock() {
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public Class<? extends ItemBlock> getItemBlock() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends TileEntity> getTileEntity() {
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public Class<? extends TileEntity> getTileEntity() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -33,72 +33,72 @@ import java.util.Random;
|
||||
|
||||
public class BlockNitorGas extends BlockGas {
|
||||
|
||||
public BlockNitorGas() {
|
||||
super();
|
||||
}
|
||||
public BlockNitorGas() {
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int tickRate(World par1World) {
|
||||
return par1World.provider.dimensionId == -1 ? 60 : 20;
|
||||
}
|
||||
@Override
|
||||
public int tickRate(World par1World) {
|
||||
return par1World.provider.dimensionId == -1 ? 60 : 20;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void randomDisplayTick(World par1World, int par2, int par3, int par4, Random par5Random) {
|
||||
if (par5Random.nextFloat() < 0.03F)
|
||||
ThaumicTinkerer.tcProxy.sparkle(par2 + 0.5F, par3 + 0.5F, par4 + 0.5F, 1F, 4, par5Random.nextFloat() / 2);
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void randomDisplayTick(World par1World, int par2, int par3, int par4, Random par5Random) {
|
||||
if (par5Random.nextFloat() < 0.03F)
|
||||
ThaumicTinkerer.tcProxy.sparkle(par2 + 0.5F, par3 + 0.5F, par4 + 0.5F, 1F, 4, par5Random.nextFloat() / 2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random) {
|
||||
if (!par1World.isRemote) {
|
||||
int dist = par1World.getBlockMetadata(par2, par3, par4) == 1 ? 6 : 1;
|
||||
List<EntityPlayer> players = par1World.getEntitiesWithinAABB(EntityPlayer.class, AxisAlignedBB.getBoundingBox(par2 - dist, par3 - dist, par4 - dist, par2 + dist, par3 + dist, par4 + dist));
|
||||
if (players.isEmpty())
|
||||
par1World.setBlockToAir(par2, par3, par4);
|
||||
else {
|
||||
boolean has = false;
|
||||
for (EntityPlayer player : players)
|
||||
if (player.inventory.hasItem(ThaumicTinkerer.registry.getFirstItemFromClass(ItemBrightNitor.class)) || (ConfigHandler.enableKami && player.getCurrentArmor(1) != null && player.getCurrentArmor(1).getItem() == ThaumicTinkerer.registry.getFirstItemFromClass(ItemGemLegs.class))) {
|
||||
has = true;
|
||||
break;
|
||||
}
|
||||
@Override
|
||||
public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random) {
|
||||
if (!par1World.isRemote) {
|
||||
int dist = par1World.getBlockMetadata(par2, par3, par4) == 1 ? 6 : 1;
|
||||
List<EntityPlayer> players = par1World.getEntitiesWithinAABB(EntityPlayer.class, AxisAlignedBB.getBoundingBox(par2 - dist, par3 - dist, par4 - dist, par2 + dist, par3 + dist, par4 + dist));
|
||||
if (players.isEmpty())
|
||||
par1World.setBlockToAir(par2, par3, par4);
|
||||
else {
|
||||
boolean has = false;
|
||||
for (EntityPlayer player : players)
|
||||
if (player.inventory.hasItem(ThaumicTinkerer.registry.getFirstItemFromClass(ItemBrightNitor.class)) || (ConfigHandler.enableKami && player.getCurrentArmor(1) != null && player.getCurrentArmor(1).getItem() == ThaumicTinkerer.registry.getFirstItemFromClass(ItemGemLegs.class))) {
|
||||
has = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if (!has)
|
||||
par1World.setBlockToAir(par2, par3, par4);
|
||||
}
|
||||
par1World.scheduleBlockUpdate(par2, par3, par4, this, tickRate(par1World));
|
||||
}
|
||||
}
|
||||
if (!has)
|
||||
par1World.setBlockToAir(par2, par3, par4);
|
||||
}
|
||||
par1World.scheduleBlockUpdate(par2, par3, par4, this, tickRate(par1World));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLightValue() {
|
||||
return 15;
|
||||
}
|
||||
@Override
|
||||
public int getLightValue() {
|
||||
return 15;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLightValue(IBlockAccess world, int x, int y, int z) {
|
||||
return world.getBlockMetadata(x, y, z) == 1 ? 15 : 12;
|
||||
}
|
||||
@Override
|
||||
public int getLightValue(IBlockAccess world, int x, int y, int z) {
|
||||
return world.getBlockMetadata(x, y, z) == 1 ? 15 : 12;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockAdded(World par1World, int par2, int par3, int par4) {
|
||||
if (!par1World.isRemote)
|
||||
par1World.scheduleBlockUpdate(par2, par3, par4, this, tickRate(par1World));
|
||||
}
|
||||
@Override
|
||||
public void onBlockAdded(World par1World, int par2, int par3, int par4) {
|
||||
if (!par1World.isRemote)
|
||||
par1World.scheduleBlockUpdate(par2, par3, par4, this, tickRate(par1World));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBlockName() {
|
||||
return LibBlockNames.NITOR_GAS;
|
||||
}
|
||||
@Override
|
||||
public String getBlockName() {
|
||||
return LibBlockNames.NITOR_GAS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends ItemBlock> getItemBlock() {
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public Class<? extends ItemBlock> getItemBlock() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends TileEntity> getTileEntity() {
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public Class<? extends TileEntity> getTileEntity() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -42,71 +42,71 @@ import java.util.List;
|
||||
|
||||
public class BlockPlatform extends BlockCamo {
|
||||
|
||||
public BlockPlatform() {
|
||||
super(Material.wood);
|
||||
setHardness(2.0F);
|
||||
setResistance(5.0F);
|
||||
setStepSound(Block.soundTypeWood);
|
||||
}
|
||||
public BlockPlatform() {
|
||||
super(Material.wood);
|
||||
setHardness(2.0F);
|
||||
setResistance(5.0F);
|
||||
setStepSound(Block.soundTypeWood);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCollisionBoxesToList(World par1World, int par2, int par3, int par4, AxisAlignedBB par5AxisAlignedBB, List par6List, Entity par7Entity) {
|
||||
if (par7Entity != null && par7Entity.posY > par3 + (par7Entity instanceof EntityPlayer ? 2 : 0) && (!(par7Entity instanceof EntityPlayer) || !par7Entity.isSneaking()))
|
||||
super.addCollisionBoxesToList(par1World, par2, par3, par4, par5AxisAlignedBB, par6List, par7Entity);
|
||||
}
|
||||
@Override
|
||||
public void addCollisionBoxesToList(World par1World, int par2, int par3, int par4, AxisAlignedBB par5AxisAlignedBB, List par6List, Entity par7Entity) {
|
||||
if (par7Entity != null && par7Entity.posY > par3 + (par7Entity instanceof EntityPlayer ? 2 : 0) && (!(par7Entity instanceof EntityPlayer) || !par7Entity.isSneaking()))
|
||||
super.addCollisionBoxesToList(par1World, par2, par3, par4, par5AxisAlignedBB, par6List, par7Entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getBlocksMovement(IBlockAccess par1iBlockAccess, int par2, int par3, int par4) {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean getBlocksMovement(IBlockAccess par1iBlockAccess, int par2, int par3, int par4) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileCamo createNewTileEntity(World world, int meta) {
|
||||
return new TileCamo();
|
||||
}
|
||||
@Override
|
||||
public TileCamo createNewTileEntity(World world, int meta) {
|
||||
return new TileCamo();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<Object> getSpecialParameters() {
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public ArrayList<Object> getSpecialParameters() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBlockName() {
|
||||
return LibBlockNames.PLATFORM;
|
||||
}
|
||||
@Override
|
||||
public String getBlockName() {
|
||||
return LibBlockNames.PLATFORM;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRegister() {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean shouldRegister() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldDisplayInTab() {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean shouldDisplayInTab() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends ItemBlock> getItemBlock() {
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public Class<? extends ItemBlock> getItemBlock() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends TileEntity> getTileEntity() {
|
||||
@Override
|
||||
public Class<? extends TileEntity> getTileEntity() {
|
||||
return TileCamo.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IRegisterableResearch getResearchItem() {
|
||||
return (IRegisterableResearch) new TTResearchItem(LibResearch.KEY_PLATFORM, new AspectList().add(Aspect.SENSES, 2).add(Aspect.TREE, 1).add(Aspect.MOTION, 1), -2, 6, 3, new ItemStack(this)).setConcealed().setParents(LibResearch.KEY_CLEANSING_TALISMAN)
|
||||
.setPages(new ResearchPage("0"), ResearchHelper.arcaneRecipePage(LibResearch.KEY_PLATFORM)).setSecondary();
|
||||
@Override
|
||||
public IRegisterableResearch getResearchItem() {
|
||||
return (IRegisterableResearch) new TTResearchItem(LibResearch.KEY_PLATFORM, new AspectList().add(Aspect.SENSES, 2).add(Aspect.TREE, 1).add(Aspect.MOTION, 1), -2, 6, 3, new ItemStack(this)).setConcealed().setParents(LibResearch.KEY_CLEANSING_TALISMAN)
|
||||
.setPages(new ResearchPage("0"), ResearchHelper.arcaneRecipePage(LibResearch.KEY_PLATFORM)).setSecondary();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ThaumicTinkererRecipe getRecipeItem() {
|
||||
return new ThaumicTinkererArcaneRecipe(LibResearch.KEY_PLATFORM, LibResearch.KEY_PLATFORM, new ItemStack(this, 2), new AspectList().add(Aspect.AIR, 2).add(Aspect.ENTROPY, 4),
|
||||
" S ", "G G",
|
||||
'G', new ItemStack(ConfigBlocks.blockWoodenDevice, 1, 6),
|
||||
'S', new ItemStack(ConfigBlocks.blockWoodenDevice, 1, 7));
|
||||
}
|
||||
@Override
|
||||
public ThaumicTinkererRecipe getRecipeItem() {
|
||||
return new ThaumicTinkererArcaneRecipe(LibResearch.KEY_PLATFORM, LibResearch.KEY_PLATFORM, new ItemStack(this, 2), new AspectList().add(Aspect.AIR, 2).add(Aspect.ENTROPY, 4),
|
||||
" S ", "G G",
|
||||
'G', new ItemStack(ConfigBlocks.blockWoodenDevice, 1, 6),
|
||||
'S', new ItemStack(ConfigBlocks.blockWoodenDevice, 1, 7));
|
||||
}
|
||||
}
|
||||
@@ -38,11 +38,12 @@ import java.util.Random;
|
||||
/**
|
||||
* Created by nekosune on 28/06/14.
|
||||
*/
|
||||
public class BlockRPlacer extends BlockCamo implements IWandable{
|
||||
public class BlockRPlacer extends BlockCamo implements IWandable {
|
||||
IIcon[] icons = new IIcon[2];
|
||||
|
||||
public BlockRPlacer() {
|
||||
super(Material.rock);
|
||||
}
|
||||
IIcon[] icons = new IIcon[2];
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) {
|
||||
@@ -68,6 +69,7 @@ public class BlockRPlacer extends BlockCamo implements IWandable{
|
||||
public Class<? extends TileEntity> getTileEntity() {
|
||||
return TileRPlacer.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerBlockIcons(IIconRegister par1IconRegister) {
|
||||
icons[0] = IconHelper.forBlock(par1IconRegister, this, 0);
|
||||
@@ -107,16 +109,19 @@ public class BlockRPlacer extends BlockCamo implements IWandable{
|
||||
|
||||
@Override
|
||||
public ThaumicTinkererRecipe getRecipeItem() {
|
||||
return new ThaumicTinkererArcaneRecipe(LibResearch.KEY_REMOTE_PLACER,LibResearch.KEY_REMOTE_PLACER,new ItemStack(this),new AspectList().add(Aspect.AIR, 20).add(Aspect.ORDER, 5).add(Aspect.EARTH, 15).add(Aspect.ENTROPY, 5),"ses","sds","sss",'s', ConfigBlocks.blockStoneDevice,'e', Items.ender_pearl,'d', Blocks.dispenser);
|
||||
return new ThaumicTinkererArcaneRecipe(LibResearch.KEY_REMOTE_PLACER, LibResearch.KEY_REMOTE_PLACER, new ItemStack(this), new AspectList().add(Aspect.AIR, 20).add(Aspect.ORDER, 5).add(Aspect.EARTH, 15).add(Aspect.ENTROPY, 5), "ses", "sds", "sss", 's', ConfigBlocks.blockStoneDevice, 'e', Items.ender_pearl, 'd', Blocks.dispenser);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(int par1, int par2) {
|
||||
return icons[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIconFromSideAfterCheck(TileEntity tile, int meta, int side) {
|
||||
return icons[((TileRPlacer) tile).orientation == side ? 1 : 0];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World par1World, int par2, int par3, int par4, EntityLivingBase par5EntityLivingBase, ItemStack par6ItemStack) {
|
||||
TileEntity tile = par1World.getTileEntity(par2, par3, par4);
|
||||
@@ -126,10 +131,8 @@ public class BlockRPlacer extends BlockCamo implements IWandable{
|
||||
|
||||
@Override
|
||||
public int onWandRightClick(World world, ItemStack itemStack, EntityPlayer entityPlayer, int i, int i2, int i3, int i4, int i5) {
|
||||
if(!world.isRemote)
|
||||
{
|
||||
if(entityPlayer.isSneaking())
|
||||
{
|
||||
if (!world.isRemote) {
|
||||
if (entityPlayer.isSneaking()) {
|
||||
entityPlayer.openGui(ThaumicTinkerer.instance, LibGuiIDs.GUI_ID_REMOTE_PLACER, world, i, i2, i3);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,177 +53,177 @@ import java.util.Random;
|
||||
|
||||
public class BlockRepairer extends BlockModContainer {
|
||||
|
||||
Random random;
|
||||
Random random;
|
||||
|
||||
public BlockRepairer() {
|
||||
super(Material.iron);
|
||||
setHardness(5F);
|
||||
setResistance(10F);
|
||||
public BlockRepairer() {
|
||||
super(Material.iron);
|
||||
setHardness(5F);
|
||||
setResistance(10F);
|
||||
|
||||
random = new Random();
|
||||
}
|
||||
random = new Random();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) {
|
||||
TileRepairer repairer = (TileRepairer) par1World.getTileEntity(par2, par3, par4);
|
||||
ItemStack stack = repairer.getStackInSlot(0);
|
||||
@Override
|
||||
public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) {
|
||||
TileRepairer repairer = (TileRepairer) par1World.getTileEntity(par2, par3, par4);
|
||||
ItemStack stack = repairer.getStackInSlot(0);
|
||||
|
||||
if (stack == null) {
|
||||
ItemStack playerStack = par5EntityPlayer.getCurrentEquippedItem();
|
||||
if (repairer.canInsertItem(0, playerStack, 1)) {
|
||||
repairer.setInventorySlotContents(0, playerStack.splitStack(1));
|
||||
if (stack == null) {
|
||||
ItemStack playerStack = par5EntityPlayer.getCurrentEquippedItem();
|
||||
if (repairer.canInsertItem(0, playerStack, 1)) {
|
||||
repairer.setInventorySlotContents(0, playerStack.splitStack(1));
|
||||
|
||||
if (playerStack.stackSize <= 0)
|
||||
par5EntityPlayer.inventory.setInventorySlotContents(par5EntityPlayer.inventory.currentItem, null);
|
||||
if (playerStack.stackSize <= 0)
|
||||
par5EntityPlayer.inventory.setInventorySlotContents(par5EntityPlayer.inventory.currentItem, null);
|
||||
|
||||
repairer.markDirty();
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
if (!par5EntityPlayer.inventory.addItemStackToInventory(stack))
|
||||
par5EntityPlayer.dropPlayerItemWithRandomChoice(stack, false);
|
||||
repairer.markDirty();
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
if (!par5EntityPlayer.inventory.addItemStackToInventory(stack))
|
||||
par5EntityPlayer.dropPlayerItemWithRandomChoice(stack, false);
|
||||
|
||||
repairer.setInventorySlotContents(0, null);
|
||||
repairer.markDirty();
|
||||
return true;
|
||||
}
|
||||
repairer.setInventorySlotContents(0, null);
|
||||
repairer.markDirty();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World par1World, int par2, int par3, int par4, EntityLivingBase par5EntityLiving, ItemStack par6ItemStack) {
|
||||
byte b0 = 0;
|
||||
int l1 = MathHelper.floor_double(par5EntityLiving.rotationYaw * 4.0F / 360.0F + 0.5D) & 3;
|
||||
@Override
|
||||
public void onBlockPlacedBy(World par1World, int par2, int par3, int par4, EntityLivingBase par5EntityLiving, ItemStack par6ItemStack) {
|
||||
byte b0 = 0;
|
||||
int l1 = MathHelper.floor_double(par5EntityLiving.rotationYaw * 4.0F / 360.0F + 0.5D) & 3;
|
||||
|
||||
if (l1 == 0)
|
||||
b0 = 2;
|
||||
if (l1 == 0)
|
||||
b0 = 2;
|
||||
|
||||
if (l1 == 1)
|
||||
b0 = 5;
|
||||
if (l1 == 1)
|
||||
b0 = 5;
|
||||
|
||||
if (l1 == 2)
|
||||
b0 = 3;
|
||||
if (l1 == 2)
|
||||
b0 = 3;
|
||||
|
||||
if (l1 == 3)
|
||||
b0 = 4;
|
||||
if (l1 == 3)
|
||||
b0 = 4;
|
||||
|
||||
par1World.setBlockMetadataWithNotify(par2, par3, par4, b0, 2);
|
||||
}
|
||||
par1World.setBlockMetadataWithNotify(par2, par3, par4, b0, 2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World par1World, int par2, int par3, int par4, Block par5, int par6) {
|
||||
TileRepairer repairer = (TileRepairer) par1World.getTileEntity(par2, par3, par4);
|
||||
@Override
|
||||
public void breakBlock(World par1World, int par2, int par3, int par4, Block par5, int par6) {
|
||||
TileRepairer repairer = (TileRepairer) par1World.getTileEntity(par2, par3, par4);
|
||||
|
||||
if (repairer != null) {
|
||||
for (int j1 = 0; j1 < repairer.getSizeInventory(); ++j1) {
|
||||
ItemStack itemstack = repairer.getStackInSlot(j1);
|
||||
if (repairer != null) {
|
||||
for (int j1 = 0; j1 < repairer.getSizeInventory(); ++j1) {
|
||||
ItemStack itemstack = repairer.getStackInSlot(j1);
|
||||
|
||||
if (itemstack != null) {
|
||||
float f = random.nextFloat() * 0.8F + 0.1F;
|
||||
float f1 = random.nextFloat() * 0.8F + 0.1F;
|
||||
EntityItem entityitem;
|
||||
if (itemstack != null) {
|
||||
float f = random.nextFloat() * 0.8F + 0.1F;
|
||||
float f1 = random.nextFloat() * 0.8F + 0.1F;
|
||||
EntityItem entityitem;
|
||||
|
||||
for (float f2 = random.nextFloat() * 0.8F + 0.1F; itemstack.stackSize > 0; par1World.spawnEntityInWorld(entityitem)) {
|
||||
int k1 = random.nextInt(21) + 10;
|
||||
for (float f2 = random.nextFloat() * 0.8F + 0.1F; itemstack.stackSize > 0; par1World.spawnEntityInWorld(entityitem)) {
|
||||
int k1 = random.nextInt(21) + 10;
|
||||
|
||||
if (k1 > itemstack.stackSize)
|
||||
k1 = itemstack.stackSize;
|
||||
if (k1 > itemstack.stackSize)
|
||||
k1 = itemstack.stackSize;
|
||||
|
||||
itemstack.stackSize -= k1;
|
||||
int dmg;
|
||||
if (Loader.isModLoaded("TConstruct")) {
|
||||
if (TinkersConstructCompat.isTConstructTool(itemstack)) {
|
||||
dmg = TinkersConstructCompat.getDamage(itemstack);
|
||||
} else
|
||||
dmg = itemstack.getItemDamage();
|
||||
} else
|
||||
dmg = itemstack.getItemDamage();
|
||||
entityitem = new EntityItem(par1World, par2 + f, par3 + f1, par4 + f2, new ItemStack(itemstack.getItem(), k1, dmg));
|
||||
float f3 = 0.05F;
|
||||
entityitem.motionX = (float) random.nextGaussian() * f3;
|
||||
entityitem.motionY = (float) random.nextGaussian() * f3 + 0.2F;
|
||||
entityitem.motionZ = (float) random.nextGaussian() * f3;
|
||||
itemstack.stackSize -= k1;
|
||||
int dmg;
|
||||
if (Loader.isModLoaded("TConstruct")) {
|
||||
if (TinkersConstructCompat.isTConstructTool(itemstack)) {
|
||||
dmg = TinkersConstructCompat.getDamage(itemstack);
|
||||
} else
|
||||
dmg = itemstack.getItemDamage();
|
||||
} else
|
||||
dmg = itemstack.getItemDamage();
|
||||
entityitem = new EntityItem(par1World, par2 + f, par3 + f1, par4 + f2, new ItemStack(itemstack.getItem(), k1, dmg));
|
||||
float f3 = 0.05F;
|
||||
entityitem.motionX = (float) random.nextGaussian() * f3;
|
||||
entityitem.motionY = (float) random.nextGaussian() * f3 + 0.2F;
|
||||
entityitem.motionZ = (float) random.nextGaussian() * f3;
|
||||
|
||||
if (itemstack.hasTagCompound())
|
||||
entityitem.getEntityItem().setTagCompound((NBTTagCompound) itemstack.getTagCompound().copy());
|
||||
}
|
||||
}
|
||||
}
|
||||
if (itemstack.hasTagCompound())
|
||||
entityitem.getEntityItem().setTagCompound((NBTTagCompound) itemstack.getTagCompound().copy());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
par1World.func_147453_f(par2, par3, par4, par5);
|
||||
}
|
||||
par1World.func_147453_f(par2, par3, par4, par5);
|
||||
}
|
||||
|
||||
super.breakBlock(par1World, par2, par3, par4, par5, par6);
|
||||
}
|
||||
super.breakBlock(par1World, par2, par3, par4, par5, par6);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int par1, int par2) {
|
||||
return ConfigBlocks.blockCosmeticSolid.getIcon(par1, 4);
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int par1, int par2) {
|
||||
return ConfigBlocks.blockCosmeticSolid.getIcon(par1, 4);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return LibRenderIDs.idRepairer;
|
||||
}
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return LibRenderIDs.idRepairer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta) {
|
||||
return new TileRepairer();
|
||||
}
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta) {
|
||||
return new TileRepairer();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<Object> getSpecialParameters() {
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public ArrayList<Object> getSpecialParameters() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBlockName() {
|
||||
return LibBlockNames.REPAIRER;
|
||||
}
|
||||
@Override
|
||||
public String getBlockName() {
|
||||
return LibBlockNames.REPAIRER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRegister() {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean shouldRegister() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldDisplayInTab() {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean shouldDisplayInTab() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends ItemBlock> getItemBlock() {
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public Class<? extends ItemBlock> getItemBlock() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends TileEntity> getTileEntity() {
|
||||
return TileRepairer.class;
|
||||
}
|
||||
@Override
|
||||
public Class<? extends TileEntity> getTileEntity() {
|
||||
return TileRepairer.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IRegisterableResearch getResearchItem() {
|
||||
return (IRegisterableResearch) new TTResearchItem(LibResearch.KEY_REPAIRER, new AspectList().add(Aspect.TOOL, 2).add(Aspect.CRAFT, 1).add(Aspect.ORDER, 1).add(Aspect.MAGIC, 1), -1, -9, 3, new ItemStack(this)).setConcealed().setParents(LibResearch.KEY_FUNNEL).setParentsHidden("THAUMIUM", "ENCHFABRIC")
|
||||
.setPages(new ResearchPage("0"), ResearchHelper.infusionPage(LibResearch.KEY_REPAIRER));
|
||||
}
|
||||
@Override
|
||||
public IRegisterableResearch getResearchItem() {
|
||||
return (IRegisterableResearch) new TTResearchItem(LibResearch.KEY_REPAIRER, new AspectList().add(Aspect.TOOL, 2).add(Aspect.CRAFT, 1).add(Aspect.ORDER, 1).add(Aspect.MAGIC, 1), -1, -9, 3, new ItemStack(this)).setConcealed().setParents(LibResearch.KEY_FUNNEL).setParentsHidden("THAUMIUM", "ENCHFABRIC")
|
||||
.setPages(new ResearchPage("0"), ResearchHelper.infusionPage(LibResearch.KEY_REPAIRER));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ThaumicTinkererRecipe getRecipeItem() {
|
||||
return new ThaumicTinkererInfusionRecipe(LibResearch.KEY_REPAIRER, new ItemStack(this), 8, new AspectList().add(Aspect.TOOL, 15).add(Aspect.CRAFT, 20).add(Aspect.ORDER, 10).add(Aspect.MAGIC, 15), new ItemStack(ConfigBlocks.blockCosmeticSolid, 1, 4),
|
||||
new ItemStack(Items.iron_ingot), new ItemStack(Items.gold_ingot), new ItemStack(Items.diamond), new ItemStack(Blocks.cobblestone), new ItemStack(Blocks.planks), new ItemStack(Items.leather), new ItemStack(ConfigItems.itemResource, 1, 7), new ItemStack(ConfigItems.itemResource, 1, 2));
|
||||
}
|
||||
@Override
|
||||
public ThaumicTinkererRecipe getRecipeItem() {
|
||||
return new ThaumicTinkererInfusionRecipe(LibResearch.KEY_REPAIRER, new ItemStack(this), 8, new AspectList().add(Aspect.TOOL, 15).add(Aspect.CRAFT, 20).add(Aspect.ORDER, 10).add(Aspect.MAGIC, 15), new ItemStack(ConfigBlocks.blockCosmeticSolid, 1, 4),
|
||||
new ItemStack(Items.iron_ingot), new ItemStack(Items.gold_ingot), new ItemStack(Items.diamond), new ItemStack(Blocks.cobblestone), new ItemStack(Blocks.planks), new ItemStack(Items.leather), new ItemStack(ConfigItems.itemResource, 1, 7), new ItemStack(ConfigItems.itemResource, 1, 2));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canProvidePower() {
|
||||
|
||||
@@ -47,93 +47,93 @@ import java.util.Random;
|
||||
|
||||
public class BlockSummon extends Block implements ITTinkererBlock {
|
||||
|
||||
IIcon iconTop;
|
||||
IIcon iconSide;
|
||||
IIcon iconTop;
|
||||
IIcon iconSide;
|
||||
|
||||
Random random;
|
||||
Random random;
|
||||
|
||||
public BlockSummon() {
|
||||
super(Material.iron);
|
||||
setBlockBounds(0F, 0F, 0F, 1F, 1F / 16F * 2F, 1F);
|
||||
setHardness(3F);
|
||||
setResistance(50F);
|
||||
setStepSound(Block.soundTypeMetal);
|
||||
public BlockSummon() {
|
||||
super(Material.iron);
|
||||
setBlockBounds(0F, 0F, 0F, 1F, 1F / 16F * 2F, 1F);
|
||||
setHardness(3F);
|
||||
setResistance(50F);
|
||||
setStepSound(Block.soundTypeMetal);
|
||||
|
||||
random = new Random();
|
||||
}
|
||||
random = new Random();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasTileEntity(int metadata) {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean hasTileEntity(int metadata) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createTileEntity(World world, int meta) {
|
||||
return new TileSummon();
|
||||
}
|
||||
@Override
|
||||
public TileEntity createTileEntity(World world, int meta) {
|
||||
return new TileSummon();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||
iconTop = IconHelper.forBlock(iconRegister, this, 1);
|
||||
iconSide = IconHelper.forBlock(iconRegister, this, 2);
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||
iconTop = IconHelper.forBlock(iconRegister, this, 1);
|
||||
iconSide = IconHelper.forBlock(iconRegister, this, 2);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int par1, int meta) {
|
||||
return par1 == ForgeDirection.UP.ordinal() ? iconTop : par1 == ForgeDirection.DOWN.ordinal() ? Block.getBlockFromName("obsidian").getIcon(0, 0) : iconSide;
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int par1, int meta) {
|
||||
return par1 == ForgeDirection.UP.ordinal() ? iconTop : par1 == ForgeDirection.DOWN.ordinal() ? Block.getBlockFromName("obsidian").getIcon(0, 0) : iconSide;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<Object> getSpecialParameters() {
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public ArrayList<Object> getSpecialParameters() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBlockName() {
|
||||
return LibBlockNames.SPAWNER;
|
||||
}
|
||||
@Override
|
||||
public String getBlockName() {
|
||||
return LibBlockNames.SPAWNER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRegister() {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean shouldRegister() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldDisplayInTab() {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean shouldDisplayInTab() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends ItemBlock> getItemBlock() {
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public Class<? extends ItemBlock> getItemBlock() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends TileEntity> getTileEntity() {
|
||||
return TileSummon.class;
|
||||
}
|
||||
@Override
|
||||
public Class<? extends TileEntity> getTileEntity() {
|
||||
return TileSummon.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IRegisterableResearch getResearchItem() {
|
||||
@Override
|
||||
public IRegisterableResearch getResearchItem() {
|
||||
return (IRegisterableResearch) new TTResearchItem(LibResearch.KEY_SUMMON, new AspectList().add(Aspect.WEAPON, 1).add(Aspect.BEAST, 3).add(Aspect.MAGIC, 3), -5, 8, 3, new ItemStack(ThaumicTinkerer.registry.getFirstBlockFromClass(BlockSummon.class))).setWarp(3).setParents(LibResearch.KEY_BLOOD_SWORD)
|
||||
.setPages(new ResearchPage("0"), ResearchHelper.arcaneRecipePage(LibResearch.KEY_SUMMON + "0"), ResearchHelper.recipePage(LibResearch.KEY_SUMMON + "1"), ResearchHelper.infusionPage(LibResearch.KEY_SUMMON), new ResearchPage("1"));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ThaumicTinkererRecipe getRecipeItem() {
|
||||
return new ThaumicTinkererArcaneRecipe(LibResearch.KEY_SUMMON + "0", LibResearch.KEY_SUMMON, new ItemStack(ThaumicTinkerer.registry.getFirstBlockFromClass(BlockSummon.class)), new AspectList().add(Aspect.ORDER, 50).add(Aspect.ENTROPY, 50), "WWW", "SSS", 'S', new ItemStack(Blocks.stone), 'W', new ItemStack(ConfigBlocks.blockCosmeticSolid, 1, 1));
|
||||
}
|
||||
@Override
|
||||
public ThaumicTinkererRecipe getRecipeItem() {
|
||||
return new ThaumicTinkererArcaneRecipe(LibResearch.KEY_SUMMON + "0", LibResearch.KEY_SUMMON, new ItemStack(ThaumicTinkerer.registry.getFirstBlockFromClass(BlockSummon.class)), new AspectList().add(Aspect.ORDER, 50).add(Aspect.ENTROPY, 50), "WWW", "SSS", 'S', new ItemStack(Blocks.stone), 'W', new ItemStack(ConfigBlocks.blockCosmeticSolid, 1, 1));
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
package thaumic.tinkerer.common.block.fire;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
@@ -8,7 +8,6 @@ import net.minecraft.block.material.MapColor;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.IIcon;
|
||||
@@ -29,6 +28,9 @@ import static net.minecraftforge.common.util.ForgeDirection.*;
|
||||
|
||||
public abstract class BlockFireBase extends BlockFire implements ITTinkererBlock {
|
||||
|
||||
private IIcon[] icons;
|
||||
private IIcon itemIcon;
|
||||
|
||||
public abstract HashMap<BlockTuple, BlockTuple> getBlockTransformation();
|
||||
|
||||
public boolean isTransmutationTarget(Block block, World w, int x, int y, int z) {
|
||||
@@ -387,19 +389,6 @@ public abstract class BlockFireBase extends BlockFire implements ITTinkererBlock
|
||||
return ItemBlockFire.class;
|
||||
}
|
||||
|
||||
private static class FireInfo {
|
||||
public int encouragement = 0;
|
||||
public int flammibility = 0;
|
||||
|
||||
public FireInfo(int flammibility, int encouragement) {
|
||||
this.flammibility = flammibility;
|
||||
this.encouragement = encouragement;
|
||||
}
|
||||
}
|
||||
|
||||
private IIcon[] icons;
|
||||
private IIcon itemIcon;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||
this.icons = new IIcon[]{IconHelper.forName(iconRegister, this.getBlockName() + "_layer_0"), IconHelper.forName(iconRegister, this.getBlockName() + "_layer_1")};
|
||||
@@ -439,4 +428,14 @@ public abstract class BlockFireBase extends BlockFire implements ITTinkererBlock
|
||||
public IIcon getIcon(int p_149691_1_, int p_149691_2_) {
|
||||
return itemIcon;
|
||||
}
|
||||
|
||||
private static class FireInfo {
|
||||
public int encouragement = 0;
|
||||
public int flammibility = 0;
|
||||
|
||||
public FireInfo(int flammibility, int encouragement) {
|
||||
this.flammibility = flammibility;
|
||||
this.encouragement = encouragement;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
package thaumic.tinkerer.common.block.fire;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package thaumic.tinkerer.common.block.fire;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package thaumic.tinkerer.common.block.fire;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
@@ -16,7 +16,6 @@ import thaumcraft.api.aspects.AspectList;
|
||||
import thaumcraft.api.research.ResearchPage;
|
||||
import thaumcraft.common.config.ConfigItems;
|
||||
import thaumic.tinkerer.common.core.helper.BlockTuple;
|
||||
import thaumic.tinkerer.common.core.helper.FakeContainerCrafting;
|
||||
import thaumic.tinkerer.common.lib.LibBlockNames;
|
||||
import thaumic.tinkerer.common.lib.LibResearch;
|
||||
import thaumic.tinkerer.common.registry.ThaumicTinkererCrucibleRecipe;
|
||||
@@ -30,6 +29,9 @@ import java.util.HashMap;
|
||||
|
||||
public class BlockFireOrder extends BlockFireBase {
|
||||
|
||||
public HashMap<BlockTuple, BlockTuple> fireResults = new HashMap<BlockTuple, BlockTuple>();
|
||||
private HashMap<Block, Block> oreDictinaryOresCache;
|
||||
|
||||
public BlockFireOrder() {
|
||||
super();
|
||||
fireResults.put(new BlockTuple(Blocks.stone), null);
|
||||
@@ -44,8 +46,6 @@ public class BlockFireOrder extends BlockFireBase {
|
||||
return LibBlockNames.BLOCK_FIRE_ORDER;
|
||||
}
|
||||
|
||||
public HashMap<BlockTuple, BlockTuple> fireResults = new HashMap<BlockTuple, BlockTuple>();
|
||||
|
||||
@Override
|
||||
public IRegisterableResearch getResearchItem() {
|
||||
return (TTResearchItem) new TTResearchItem(LibResearch.KEY_FIRE_ORDO, new AspectList().add(Aspect.FIRE, 5).add(Aspect.ORDER, 5), 3, -3, 2, new ItemStack(this)).setParents(LibResearch.KEY_BRIGHT_NITOR).setConcealed()
|
||||
@@ -69,15 +69,13 @@ public class BlockFireOrder extends BlockFireBase {
|
||||
return 3;
|
||||
}
|
||||
|
||||
private HashMap<Block, Block> oreDictinaryOresCache;
|
||||
|
||||
public HashMap<Block, Block> getOreDictionaryOres() {
|
||||
if (oreDictinaryOresCache == null) {
|
||||
HashMap<Block, Block> result = new HashMap<Block, Block>();
|
||||
for (String ore : OreDictionary.getOreNames()) {
|
||||
if (ore.startsWith("ore")) {
|
||||
for (String block : OreDictionary.getOreNames()) {
|
||||
if (block.startsWith("block") && block.substring(5).equalsIgnoreCase(ore.substring(3))) {
|
||||
if (block.startsWith("block") && block.substring(5).equalsIgnoreCase(ore.substring(3))) {
|
||||
if (OreDictionary.getOres(block).size() > 0 && OreDictionary.getOres(ore).size() > 0) {
|
||||
result.put(((ItemBlock) OreDictionary.getOres(ore).get(0).getItem()).field_150939_a, ((ItemBlock) OreDictionary.getOres(block).get(0).getItem()).field_150939_a);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package thaumic.tinkerer.common.block.fire;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
@@ -36,13 +36,16 @@ import java.util.Random;
|
||||
|
||||
public class BlockBedrockPortal extends BlockMod {
|
||||
|
||||
public BlockBedrockPortal() {
|
||||
super(Material.portal);
|
||||
setStepSound(Block.soundTypeStone);
|
||||
setResistance(6000000.0F);
|
||||
disableStats();
|
||||
setCreativeTab(ModCreativeTab.INSTANCE);
|
||||
}
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon icon;
|
||||
|
||||
public BlockBedrockPortal() {
|
||||
super(Material.portal);
|
||||
setStepSound(Block.soundTypeStone);
|
||||
setResistance(6000000.0F);
|
||||
disableStats();
|
||||
setCreativeTab(ModCreativeTab.INSTANCE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer p_149727_5_, int p_149727_6_, float p_149727_7_, float p_149727_8_, float p_149727_9_) {
|
||||
@@ -50,177 +53,174 @@ public class BlockBedrockPortal extends BlockMod {
|
||||
return super.onBlockActivated(world, x, y, z, p_149727_5_, p_149727_6_, p_149727_7_, p_149727_8_, p_149727_9_);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon icon;
|
||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||
icon = IconHelper.forName(iconRegister, "portal");
|
||||
|
||||
icon = IconHelper.forName(iconRegister, "portal");
|
||||
}
|
||||
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int par1, int meta) {
|
||||
return icon;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int par1, int meta) {
|
||||
return icon;
|
||||
}
|
||||
@Override
|
||||
public float getBlockHardness(World par1World, int par2, int par3, int par4) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getBlockHardness(World par1World, int par2, int par3, int par4) {
|
||||
return -1;
|
||||
}
|
||||
@Override
|
||||
public AxisAlignedBB getCollisionBoundingBoxFromPool(World par1World, int par2, int par3, int par4) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getCollisionBoundingBoxFromPool(World par1World, int par2, int par3, int par4) {
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public boolean canHarvestBlock(EntityPlayer player, int meta) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canHarvestBlock(EntityPlayer player, int meta) {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public TileEntity createTileEntity(World world, int metadata) {
|
||||
return new TileBedrockPortal();
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createTileEntity(World world, int metadata) {
|
||||
return new TileBedrockPortal();
|
||||
}
|
||||
@Override
|
||||
public boolean canEntityDestroy(IBlockAccess world, int x, int y, int z, Entity entity) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canEntityDestroy(IBlockAccess world, int x, int y, int z, Entity entity) {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
public boolean shouldSideBeRendered(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5) {
|
||||
if (par5 != 1 && par5 != 0 && !super.shouldSideBeRendered(par1IBlockAccess, par2, par3, par4, par5)) {
|
||||
return false;
|
||||
} else {
|
||||
int i1 = par2 + Facing.offsetsXForSide[Facing.oppositeSide[par5]];
|
||||
int j1 = par3 + Facing.offsetsYForSide[Facing.oppositeSide[par5]];
|
||||
int k1 = par4 + Facing.offsetsZForSide[Facing.oppositeSide[par5]];
|
||||
boolean flag = (par1IBlockAccess.getBlockMetadata(i1, j1, k1) & 8) != 0;
|
||||
return flag ? (par5 == 0 || (par5 == 1 && super.shouldSideBeRendered(par1IBlockAccess, par2, par3, par4, par5) ? true : true)) : (par5 == 1 || (par5 == 0 && super.shouldSideBeRendered(par1IBlockAccess, par2, par3, par4, par5) ? true : true));
|
||||
}
|
||||
}
|
||||
|
||||
public boolean shouldSideBeRendered(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5) {
|
||||
if (par5 != 1 && par5 != 0 && !super.shouldSideBeRendered(par1IBlockAccess, par2, par3, par4, par5)) {
|
||||
return false;
|
||||
} else {
|
||||
int i1 = par2 + Facing.offsetsXForSide[Facing.oppositeSide[par5]];
|
||||
int j1 = par3 + Facing.offsetsYForSide[Facing.oppositeSide[par5]];
|
||||
int k1 = par4 + Facing.offsetsZForSide[Facing.oppositeSide[par5]];
|
||||
boolean flag = (par1IBlockAccess.getBlockMetadata(i1, j1, k1) & 8) != 0;
|
||||
return flag ? (par5 == 0 || (par5 == 1 && super.shouldSideBeRendered(par1IBlockAccess, par2, par3, par4, par5) ? true : true)) : (par5 == 1 || (par5 == 0 && super.shouldSideBeRendered(par1IBlockAccess, par2, par3, par4, par5) ? true : true));
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void onEntityCollidedWithBlock(World par1World, int par2, int par3, int par4, Entity entity) {
|
||||
super.onEntityCollidedWithBlock(par1World, par2, par3, par4, entity);
|
||||
|
||||
@Override
|
||||
public void onEntityCollidedWithBlock(World par1World, int par2, int par3, int par4, Entity entity) {
|
||||
super.onEntityCollidedWithBlock(par1World, par2, par3, par4, entity);
|
||||
if (entity.worldObj.provider.isSurfaceWorld()) {
|
||||
|
||||
if (entity.worldObj.provider.isSurfaceWorld()) {
|
||||
if (entity instanceof EntityPlayer && !par1World.isRemote) {
|
||||
|
||||
if (entity instanceof EntityPlayer && !par1World.isRemote) {
|
||||
FMLCommonHandler.instance().getMinecraftServerInstance().getConfigurationManager().transferPlayerToDimension((EntityPlayerMP) entity, ConfigHandler.bedrockDimensionID, new TeleporterBedrock((WorldServer) par1World));
|
||||
|
||||
FMLCommonHandler.instance().getMinecraftServerInstance().getConfigurationManager().transferPlayerToDimension((EntityPlayerMP) entity, ConfigHandler.bedrockDimensionID, new TeleporterBedrock((WorldServer) par1World));
|
||||
if (entity.worldObj.getBlock(par2, 251, par4) == Blocks.bedrock) {
|
||||
entity.worldObj.setBlock(par2, 251, par4, Blocks.air);
|
||||
}
|
||||
if (entity.worldObj.getBlock(par2, 252, par4) == Blocks.bedrock) {
|
||||
entity.worldObj.setBlock(par2, 252, par4, Blocks.air);
|
||||
}
|
||||
if (entity.worldObj.getBlock(par2, 253, par4) == Blocks.bedrock) {
|
||||
entity.worldObj.setBlock(par2, 253, par4, Blocks.air);
|
||||
}
|
||||
if (entity.worldObj.getBlock(par2, 254, par4) == Blocks.bedrock) {
|
||||
entity.worldObj.setBlock(par2, 254, par4, this);
|
||||
}
|
||||
((EntityPlayerMP) entity).playerNetServerHandler.setPlayerLocation(par2 + 0.5, 252, par4 + 0.5, 0, 0);
|
||||
}
|
||||
} else if (entity.worldObj.provider instanceof WorldProviderBedrock) {
|
||||
if (entity instanceof EntityPlayer && !par1World.isRemote) {
|
||||
|
||||
if (entity.worldObj.getBlock(par2, 251, par4) == Blocks.bedrock) {
|
||||
entity.worldObj.setBlock(par2, 251, par4, Blocks.air);
|
||||
}
|
||||
if (entity.worldObj.getBlock(par2, 252, par4) == Blocks.bedrock) {
|
||||
entity.worldObj.setBlock(par2, 252, par4, Blocks.air);
|
||||
}
|
||||
if (entity.worldObj.getBlock(par2, 253, par4) == Blocks.bedrock) {
|
||||
entity.worldObj.setBlock(par2, 253, par4, Blocks.air);
|
||||
}
|
||||
if (entity.worldObj.getBlock(par2, 254, par4) == Blocks.bedrock) {
|
||||
entity.worldObj.setBlock(par2, 254, par4, this);
|
||||
}
|
||||
((EntityPlayerMP) entity).playerNetServerHandler.setPlayerLocation(par2 + 0.5, 252, par4 + 0.5, 0, 0);
|
||||
}
|
||||
} else if (entity.worldObj.provider instanceof WorldProviderBedrock) {
|
||||
if (entity instanceof EntityPlayer && !par1World.isRemote) {
|
||||
FMLCommonHandler.instance().getMinecraftServerInstance().getConfigurationManager().transferPlayerToDimension((EntityPlayerMP) entity, 0, new TeleporterBedrock((WorldServer) par1World));
|
||||
|
||||
FMLCommonHandler.instance().getMinecraftServerInstance().getConfigurationManager().transferPlayerToDimension((EntityPlayerMP) entity, 0, new TeleporterBedrock((WorldServer) par1World));
|
||||
Random rand = new Random();
|
||||
|
||||
Random rand = new Random();
|
||||
int x = (int) entity.posX + rand.nextInt(100);
|
||||
int z = (int) entity.posZ + rand.nextInt(100);
|
||||
|
||||
int x = (int) entity.posX + rand.nextInt(100);
|
||||
int z = (int) entity.posZ + rand.nextInt(100);
|
||||
x -= 50;
|
||||
z -= 50;
|
||||
|
||||
x -= 50;
|
||||
z -= 50;
|
||||
int y = 120;
|
||||
|
||||
int y = 120;
|
||||
while (entity.worldObj.getBlock(x, y, z) == Blocks.air || entity.worldObj.getBlock(x, y, z).isAir(par1World, x, y, z)) {
|
||||
y--;
|
||||
}
|
||||
|
||||
while (entity.worldObj.getBlock(x, y, z) == Blocks.air || entity.worldObj.getBlock(x, y, z).isAir(par1World, x, y, z)) {
|
||||
y--;
|
||||
}
|
||||
((EntityPlayerMP) entity).playerNetServerHandler.setPlayerLocation(x + 0.5, y + 3, z + 0.5, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
((EntityPlayerMP) entity).playerNetServerHandler.setPlayerLocation(x + 0.5, y + 3, z + 0.5, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
public void travelToDimension(int par1, Entity e) {
|
||||
if (!e.worldObj.isRemote && !e.isDead) {
|
||||
e.worldObj.theProfiler.startSection("changeDimension");
|
||||
MinecraftServer minecraftserver = MinecraftServer.getServer();
|
||||
int j = e.dimension;
|
||||
WorldServer worldserver = minecraftserver.worldServerForDimension(j);
|
||||
WorldServer worldserver1 = minecraftserver.worldServerForDimension(par1);
|
||||
e.dimension = par1;
|
||||
|
||||
public void travelToDimension(int par1, Entity e) {
|
||||
if (!e.worldObj.isRemote && !e.isDead) {
|
||||
e.worldObj.theProfiler.startSection("changeDimension");
|
||||
MinecraftServer minecraftserver = MinecraftServer.getServer();
|
||||
int j = e.dimension;
|
||||
WorldServer worldserver = minecraftserver.worldServerForDimension(j);
|
||||
WorldServer worldserver1 = minecraftserver.worldServerForDimension(par1);
|
||||
e.dimension = par1;
|
||||
if (j == 1 && par1 == 1) {
|
||||
worldserver1 = minecraftserver.worldServerForDimension(0);
|
||||
e.dimension = 0;
|
||||
}
|
||||
|
||||
if (j == 1 && par1 == 1) {
|
||||
worldserver1 = minecraftserver.worldServerForDimension(0);
|
||||
e.dimension = 0;
|
||||
}
|
||||
e.worldObj.removeEntity(e);
|
||||
e.isDead = false;
|
||||
e.worldObj.theProfiler.startSection("reposition");
|
||||
minecraftserver.getConfigurationManager().transferEntityToWorld(e, j, worldserver, worldserver1, new TeleporterBedrock(worldserver));
|
||||
e.worldObj.theProfiler.endStartSection("reloading");
|
||||
Entity entity = EntityList.createEntityByName(EntityList.getEntityString(e), worldserver1);
|
||||
|
||||
e.worldObj.removeEntity(e);
|
||||
e.isDead = false;
|
||||
e.worldObj.theProfiler.startSection("reposition");
|
||||
minecraftserver.getConfigurationManager().transferEntityToWorld(e, j, worldserver, worldserver1, new TeleporterBedrock(worldserver));
|
||||
e.worldObj.theProfiler.endStartSection("reloading");
|
||||
Entity entity = EntityList.createEntityByName(EntityList.getEntityString(e), worldserver1);
|
||||
if (entity != null) {
|
||||
entity.copyDataFrom(e, true);
|
||||
|
||||
if (entity != null) {
|
||||
entity.copyDataFrom(e, true);
|
||||
if (j == 1 && par1 == 1) {
|
||||
ChunkCoordinates chunkcoordinates = worldserver1.getSpawnPoint();
|
||||
chunkcoordinates.posY = e.worldObj.getTopSolidOrLiquidBlock(chunkcoordinates.posX, chunkcoordinates.posZ);
|
||||
entity.setLocationAndAngles((double) chunkcoordinates.posX, (double) chunkcoordinates.posY, (double) chunkcoordinates.posZ, entity.rotationYaw, entity.rotationPitch);
|
||||
}
|
||||
|
||||
if (j == 1 && par1 == 1) {
|
||||
ChunkCoordinates chunkcoordinates = worldserver1.getSpawnPoint();
|
||||
chunkcoordinates.posY = e.worldObj.getTopSolidOrLiquidBlock(chunkcoordinates.posX, chunkcoordinates.posZ);
|
||||
entity.setLocationAndAngles((double) chunkcoordinates.posX, (double) chunkcoordinates.posY, (double) chunkcoordinates.posZ, entity.rotationYaw, entity.rotationPitch);
|
||||
}
|
||||
worldserver1.spawnEntityInWorld(entity);
|
||||
}
|
||||
|
||||
worldserver1.spawnEntityInWorld(entity);
|
||||
}
|
||||
e.isDead = true;
|
||||
e.worldObj.theProfiler.endSection();
|
||||
worldserver.resetUpdateEntityTick();
|
||||
worldserver1.resetUpdateEntityTick();
|
||||
e.worldObj.theProfiler.endSection();
|
||||
}
|
||||
}
|
||||
|
||||
e.isDead = true;
|
||||
e.worldObj.theProfiler.endSection();
|
||||
worldserver.resetUpdateEntityTick();
|
||||
worldserver1.resetUpdateEntityTick();
|
||||
e.worldObj.theProfiler.endSection();
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public String getBlockName() {
|
||||
return LibBlockNames.PORTAL;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBlockName() {
|
||||
return LibBlockNames.PORTAL;
|
||||
}
|
||||
@Override
|
||||
public Class<? extends ItemBlock> getItemBlock() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends ItemBlock> getItemBlock() {
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public Class<? extends TileEntity> getTileEntity() {
|
||||
return TileBedrockPortal.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends TileEntity> getTileEntity() {
|
||||
return TileBedrockPortal.class;
|
||||
}
|
||||
@Override
|
||||
public IRegisterableResearch getResearchItem() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IRegisterableResearch getResearchItem() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ThaumicTinkererRecipe getRecipeItem() {
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public ThaumicTinkererRecipe getRecipeItem() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -54,146 +54,146 @@ import java.util.Random;
|
||||
|
||||
public class BlockWarpGate extends BlockModContainer {
|
||||
|
||||
public static IIcon[] icons = new IIcon[3];
|
||||
Random random;
|
||||
public static IIcon[] icons = new IIcon[3];
|
||||
Random random;
|
||||
|
||||
public BlockWarpGate() {
|
||||
super(Material.rock);
|
||||
setHardness(5.0F);
|
||||
setResistance(2000.0F);
|
||||
public BlockWarpGate() {
|
||||
super(Material.rock);
|
||||
setHardness(5.0F);
|
||||
setResistance(2000.0F);
|
||||
|
||||
random = new Random();
|
||||
}
|
||||
random = new Random();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) {
|
||||
if (!par1World.isRemote) {
|
||||
TileEntity tile = par1World.getTileEntity(par2, par3, par4);
|
||||
if (tile != null) {
|
||||
par1World.markBlockForUpdate(par2, par3, par4);
|
||||
par5EntityPlayer.openGui(ThaumicTinkerer.instance, LibGuiIDs.GUI_ID_WARP_GATE, par1World, par2, par3, par4);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) {
|
||||
if (!par1World.isRemote) {
|
||||
TileEntity tile = par1World.getTileEntity(par2, par3, par4);
|
||||
if (tile != null) {
|
||||
par1World.markBlockForUpdate(par2, par3, par4);
|
||||
par5EntityPlayer.openGui(ThaumicTinkerer.instance, LibGuiIDs.GUI_ID_WARP_GATE, par1World, par2, par3, par4);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World par1World, int par2, int par3, int par4, Block par5, int par6) {
|
||||
TileWarpGate warpGate = (TileWarpGate) par1World.getTileEntity(par2, par3, par4);
|
||||
@Override
|
||||
public void breakBlock(World par1World, int par2, int par3, int par4, Block par5, int par6) {
|
||||
TileWarpGate warpGate = (TileWarpGate) par1World.getTileEntity(par2, par3, par4);
|
||||
|
||||
if (warpGate != null) {
|
||||
for (int j1 = 0; j1 < warpGate.getSizeInventory(); ++j1) {
|
||||
ItemStack itemstack = warpGate.getStackInSlot(j1);
|
||||
if (warpGate != null) {
|
||||
for (int j1 = 0; j1 < warpGate.getSizeInventory(); ++j1) {
|
||||
ItemStack itemstack = warpGate.getStackInSlot(j1);
|
||||
|
||||
if (itemstack != null) {
|
||||
float f = random.nextFloat() * 0.8F + 0.1F;
|
||||
float f1 = random.nextFloat() * 0.8F + 0.1F;
|
||||
EntityItem entityitem;
|
||||
if (itemstack != null) {
|
||||
float f = random.nextFloat() * 0.8F + 0.1F;
|
||||
float f1 = random.nextFloat() * 0.8F + 0.1F;
|
||||
EntityItem entityitem;
|
||||
|
||||
for (float f2 = random.nextFloat() * 0.8F + 0.1F; itemstack.stackSize > 0; par1World.spawnEntityInWorld(entityitem)) {
|
||||
int k1 = random.nextInt(21) + 10;
|
||||
for (float f2 = random.nextFloat() * 0.8F + 0.1F; itemstack.stackSize > 0; par1World.spawnEntityInWorld(entityitem)) {
|
||||
int k1 = random.nextInt(21) + 10;
|
||||
|
||||
if (k1 > itemstack.stackSize)
|
||||
k1 = itemstack.stackSize;
|
||||
if (k1 > itemstack.stackSize)
|
||||
k1 = itemstack.stackSize;
|
||||
|
||||
itemstack.stackSize -= k1;
|
||||
entityitem = new EntityItem(par1World, par2 + f, par3 + f1, par4 + f2, new ItemStack(itemstack.getItem(), k1, itemstack.getItemDamage()));
|
||||
float f3 = 0.05F;
|
||||
entityitem.motionX = (float) random.nextGaussian() * f3;
|
||||
entityitem.motionY = (float) random.nextGaussian() * f3 + 0.2F;
|
||||
entityitem.motionZ = (float) random.nextGaussian() * f3;
|
||||
itemstack.stackSize -= k1;
|
||||
entityitem = new EntityItem(par1World, par2 + f, par3 + f1, par4 + f2, new ItemStack(itemstack.getItem(), k1, itemstack.getItemDamage()));
|
||||
float f3 = 0.05F;
|
||||
entityitem.motionX = (float) random.nextGaussian() * f3;
|
||||
entityitem.motionY = (float) random.nextGaussian() * f3 + 0.2F;
|
||||
entityitem.motionZ = (float) random.nextGaussian() * f3;
|
||||
|
||||
if (itemstack.hasTagCompound())
|
||||
entityitem.getEntityItem().setTagCompound((NBTTagCompound) itemstack.getTagCompound().copy());
|
||||
}
|
||||
}
|
||||
}
|
||||
if (itemstack.hasTagCompound())
|
||||
entityitem.getEntityItem().setTagCompound((NBTTagCompound) itemstack.getTagCompound().copy());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
par1World.func_147453_f(par2, par3, par4, par5);
|
||||
par1World.func_147453_f(par2, par3, par4, par5);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
super.breakBlock(par1World, par2, par3, par4, par5, par6);
|
||||
}
|
||||
super.breakBlock(par1World, par2, par3, par4, par5, par6);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int in) {
|
||||
return new TileWarpGate();
|
||||
}
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int in) {
|
||||
return new TileWarpGate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(int par1, int par2) {
|
||||
return icons[par1 == 1 ? 0 : 1];
|
||||
}
|
||||
@Override
|
||||
public IIcon getIcon(int par1, int par2) {
|
||||
return icons[par1 == 1 ? 0 : 1];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerBlockIcons(IIconRegister par1IconRegister) {
|
||||
for (int i = 0; i < icons.length; i++)
|
||||
icons[i] = IconHelper.forBlock(par1IconRegister, this, i);
|
||||
}
|
||||
@Override
|
||||
public void registerBlockIcons(IIconRegister par1IconRegister) {
|
||||
for (int i = 0; i < icons.length; i++)
|
||||
icons[i] = IconHelper.forBlock(par1IconRegister, this, i);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return LibRenderIDs.idWarpGate;
|
||||
}
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return LibRenderIDs.idWarpGate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<Object> getSpecialParameters() {
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public ArrayList<Object> getSpecialParameters() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBlockName() {
|
||||
return LibBlockNames.WARP_GATE;
|
||||
}
|
||||
@Override
|
||||
public String getBlockName() {
|
||||
return LibBlockNames.WARP_GATE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRegister() {
|
||||
return ConfigHandler.enableKami;
|
||||
}
|
||||
@Override
|
||||
public boolean shouldRegister() {
|
||||
return ConfigHandler.enableKami;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldDisplayInTab() {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean shouldDisplayInTab() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends ItemBlock> getItemBlock() {
|
||||
return ItemBlockWarpGate.class;
|
||||
}
|
||||
@Override
|
||||
public Class<? extends ItemBlock> getItemBlock() {
|
||||
return ItemBlockWarpGate.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends TileEntity> getTileEntity() {
|
||||
return TileWarpGate.class;
|
||||
}
|
||||
@Override
|
||||
public Class<? extends TileEntity> getTileEntity() {
|
||||
return TileWarpGate.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IRegisterableResearch getResearchItem() {
|
||||
if (!Config.allowMirrors) {
|
||||
return null;
|
||||
}
|
||||
return (IRegisterableResearch) new KamiResearchItem(LibResearch.KEY_WARP_GATE, new AspectList().add(Aspect.TRAVEL, 2).add(Aspect.ELDRITCH, 1).add(Aspect.FLIGHT, 1).add(Aspect.MECHANISM, 1), 19, 6, 5, new ItemStack(this)).setParents(LibResearch.KEY_ICHORCLOTH_CHEST_GEM).setParentsHidden(LibResearch.KEY_ICHORCLOTH_BOOTS_GEM)
|
||||
.setPages(new ResearchPage("0"), ResearchHelper.infusionPage(LibResearch.KEY_WARP_GATE), new ResearchPage("1"), ResearchHelper.infusionPage(LibResearch.KEY_SKY_PEARL));
|
||||
@Override
|
||||
public IRegisterableResearch getResearchItem() {
|
||||
if (!Config.allowMirrors) {
|
||||
return null;
|
||||
}
|
||||
return (IRegisterableResearch) new KamiResearchItem(LibResearch.KEY_WARP_GATE, new AspectList().add(Aspect.TRAVEL, 2).add(Aspect.ELDRITCH, 1).add(Aspect.FLIGHT, 1).add(Aspect.MECHANISM, 1), 19, 6, 5, new ItemStack(this)).setParents(LibResearch.KEY_ICHORCLOTH_CHEST_GEM).setParentsHidden(LibResearch.KEY_ICHORCLOTH_BOOTS_GEM)
|
||||
.setPages(new ResearchPage("0"), ResearchHelper.infusionPage(LibResearch.KEY_WARP_GATE), new ResearchPage("1"), ResearchHelper.infusionPage(LibResearch.KEY_SKY_PEARL));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ThaumicTinkererRecipe getRecipeItem() {
|
||||
if (!Config.allowMirrors) {
|
||||
return null;
|
||||
}
|
||||
return new ThaumicTinkererInfusionRecipe(LibResearch.KEY_WARP_GATE, new ItemStack(this), 8, new AspectList().add(Aspect.TRAVEL, 64).add(Aspect.ELDRITCH, 50).add(Aspect.FLIGHT, 50), new ItemStack(ConfigBlocks.blockCosmeticSolid, 1, 2), new ItemStack(ThaumicTinkerer.registry.getFirstItemFromClass(ItemKamiResource.class)), new ItemStack(ThaumicTinkerer.registry.getFirstItemFromClass(ItemKamiResource.class), 1, 7), new ItemStack(ThaumicTinkerer.registry.getFirstBlockFromClass(BlockTransvectorDislocator.class)), new ItemStack(ThaumicTinkerer.registry.getFirstItemFromClass(ItemKamiResource.class), 1, 6), new ItemStack(Items.diamond), new ItemStack(Items.feather));
|
||||
@Override
|
||||
public ThaumicTinkererRecipe getRecipeItem() {
|
||||
if (!Config.allowMirrors) {
|
||||
return null;
|
||||
}
|
||||
return new ThaumicTinkererInfusionRecipe(LibResearch.KEY_WARP_GATE, new ItemStack(this), 8, new AspectList().add(Aspect.TRAVEL, 64).add(Aspect.ELDRITCH, 50).add(Aspect.FLIGHT, 50), new ItemStack(ConfigBlocks.blockCosmeticSolid, 1, 2), new ItemStack(ThaumicTinkerer.registry.getFirstItemFromClass(ItemKamiResource.class)), new ItemStack(ThaumicTinkerer.registry.getFirstItemFromClass(ItemKamiResource.class), 1, 7), new ItemStack(ThaumicTinkerer.registry.getFirstBlockFromClass(BlockTransvectorDislocator.class)), new ItemStack(ThaumicTinkerer.registry.getFirstItemFromClass(ItemKamiResource.class), 1, 6), new ItemStack(Items.diamond), new ItemStack(Items.feather));
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -28,77 +28,77 @@ import thaumic.tinkerer.common.research.TTResearchItem;
|
||||
|
||||
public class BlockMobilizer extends BlockMod {
|
||||
|
||||
@Override
|
||||
public void onBlockPreDestroy(World par1World, int par2, int par3,
|
||||
int par4, int par5) {
|
||||
TileEntity tile = par1World.getTileEntity(par2, par3, par4);
|
||||
if (tile != null && tile instanceof TileEntityMobilizer) {
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon iconTop;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon iconBottom;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon iconSide;
|
||||
|
||||
((TileEntityMobilizer) tile).dead = true;
|
||||
}
|
||||
super.onBlockPreDestroy(par1World, par2, par3, par4, par5);
|
||||
}
|
||||
public BlockMobilizer() {
|
||||
super(Material.iron);
|
||||
}
|
||||
|
||||
public BlockMobilizer() {
|
||||
super(Material.iron);
|
||||
}
|
||||
@Override
|
||||
public void onBlockPreDestroy(World par1World, int par2, int par3,
|
||||
int par4, int par5) {
|
||||
TileEntity tile = par1World.getTileEntity(par2, par3, par4);
|
||||
if (tile != null && tile instanceof TileEntityMobilizer) {
|
||||
|
||||
@Override
|
||||
public boolean hasTileEntity(int metadata) {
|
||||
return true;
|
||||
}
|
||||
((TileEntityMobilizer) tile).dead = true;
|
||||
}
|
||||
super.onBlockPreDestroy(par1World, par2, par3, par4, par5);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createTileEntity(World world, int metadata) {
|
||||
return new TileEntityMobilizer();
|
||||
}
|
||||
@Override
|
||||
public boolean hasTileEntity(int metadata) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon iconTop;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon iconBottom;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon iconSide;
|
||||
@Override
|
||||
public TileEntity createTileEntity(World world, int metadata) {
|
||||
return new TileEntityMobilizer();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||
iconBottom = IconHelper.forBlock(iconRegister, this, 0);
|
||||
iconTop = IconHelper.forBlock(iconRegister, this, 1);
|
||||
iconSide = IconHelper.forBlock(iconRegister, this, 2);
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||
iconBottom = IconHelper.forBlock(iconRegister, this, 0);
|
||||
iconTop = IconHelper.forBlock(iconRegister, this, 1);
|
||||
iconSide = IconHelper.forBlock(iconRegister, this, 2);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int par1, int meta) {
|
||||
return par1 == ForgeDirection.UP.ordinal() ? iconTop : par1 == ForgeDirection.DOWN.ordinal() ? iconBottom : iconSide;
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int par1, int meta) {
|
||||
return par1 == ForgeDirection.UP.ordinal() ? iconTop : par1 == ForgeDirection.DOWN.ordinal() ? iconBottom : iconSide;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBlockName() {
|
||||
return LibBlockNames.MOBILIZER;
|
||||
}
|
||||
@Override
|
||||
public String getBlockName() {
|
||||
return LibBlockNames.MOBILIZER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends ItemBlock> getItemBlock() {
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public Class<? extends ItemBlock> getItemBlock() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends TileEntity> getTileEntity() {
|
||||
return TileEntityMobilizer.class;
|
||||
}
|
||||
@Override
|
||||
public Class<? extends TileEntity> getTileEntity() {
|
||||
return TileEntityMobilizer.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IRegisterableResearch getResearchItem() {
|
||||
return (IRegisterableResearch) new TTResearchItem(LibResearch.KEY_MOBILIZER, new AspectList().add(Aspect.MOTION, 2).add(Aspect.ORDER, 2), -7, 5, 3, new ItemStack(this)).setParents(LibResearch.KEY_MAGNETS)
|
||||
.setPages(new ResearchPage("0"), ResearchHelper.infusionPage(LibResearch.KEY_MOBILIZER), ResearchHelper.arcaneRecipePage(LibResearch.KEY_RELAY)).setSecondary();
|
||||
}
|
||||
@Override
|
||||
public IRegisterableResearch getResearchItem() {
|
||||
return (IRegisterableResearch) new TTResearchItem(LibResearch.KEY_MOBILIZER, new AspectList().add(Aspect.MOTION, 2).add(Aspect.ORDER, 2), -7, 5, 3, new ItemStack(this)).setParents(LibResearch.KEY_MAGNETS)
|
||||
.setPages(new ResearchPage("0"), ResearchHelper.infusionPage(LibResearch.KEY_MOBILIZER), ResearchHelper.arcaneRecipePage(LibResearch.KEY_RELAY)).setSecondary();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ThaumicTinkererRecipe getRecipeItem() {
|
||||
return new ThaumicTinkererInfusionRecipe(LibResearch.KEY_MOBILIZER, new ItemStack(this), 4, new AspectList().add(Aspect.MOTION, 15).add(Aspect.ORDER, 20).add(Aspect.MAGIC, 15), new ItemStack(ConfigBlocks.blockLifter),
|
||||
new ItemStack(Items.iron_ingot), new ItemStack(Items.feather), new ItemStack(Items.iron_ingot), new ItemStack(ConfigBlocks.blockCosmeticSolid, 1, 1));
|
||||
@Override
|
||||
public ThaumicTinkererRecipe getRecipeItem() {
|
||||
return new ThaumicTinkererInfusionRecipe(LibResearch.KEY_MOBILIZER, new ItemStack(this), 4, new AspectList().add(Aspect.MOTION, 15).add(Aspect.ORDER, 20).add(Aspect.MAGIC, 15), new ItemStack(ConfigBlocks.blockLifter),
|
||||
new ItemStack(Items.iron_ingot), new ItemStack(Items.feather), new ItemStack(Items.iron_ingot), new ItemStack(ConfigBlocks.blockCosmeticSolid, 1, 1));
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -27,69 +27,69 @@ import thaumic.tinkerer.common.research.IRegisterableResearch;
|
||||
|
||||
public class BlockMobilizerRelay extends BlockMod {
|
||||
|
||||
public BlockMobilizerRelay() {
|
||||
super(Material.iron);
|
||||
}
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon iconTop;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon iconBottom;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon iconSide;
|
||||
|
||||
@Override
|
||||
public boolean hasTileEntity(int metadata) {
|
||||
return true;
|
||||
}
|
||||
public BlockMobilizerRelay() {
|
||||
super(Material.iron);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createTileEntity(World world, int metadata) {
|
||||
return new TileEntityRelay();
|
||||
}
|
||||
@Override
|
||||
public boolean hasTileEntity(int metadata) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon iconTop;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon iconBottom;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon iconSide;
|
||||
@Override
|
||||
public TileEntity createTileEntity(World world, int metadata) {
|
||||
return new TileEntityRelay();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||
iconBottom = IconHelper.forBlock(iconRegister, this, 0);
|
||||
iconTop = IconHelper.forBlock(iconRegister, this, 1);
|
||||
iconSide = IconHelper.forBlock(iconRegister, this, 2);
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||
iconBottom = IconHelper.forBlock(iconRegister, this, 0);
|
||||
iconTop = IconHelper.forBlock(iconRegister, this, 1);
|
||||
iconSide = IconHelper.forBlock(iconRegister, this, 2);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int par1, int meta) {
|
||||
return par1 == ForgeDirection.UP.ordinal() ? iconTop : par1 == ForgeDirection.DOWN.ordinal() ? iconBottom : iconSide;
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int par1, int meta) {
|
||||
return par1 == ForgeDirection.UP.ordinal() ? iconTop : par1 == ForgeDirection.DOWN.ordinal() ? iconBottom : iconSide;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBlockName() {
|
||||
return LibBlockNames.MOBILIZER_RELAY;
|
||||
}
|
||||
@Override
|
||||
public String getBlockName() {
|
||||
return LibBlockNames.MOBILIZER_RELAY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends ItemBlock> getItemBlock() {
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public Class<? extends ItemBlock> getItemBlock() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends TileEntity> getTileEntity() {
|
||||
return TileEntityRelay.class;
|
||||
}
|
||||
@Override
|
||||
public Class<? extends TileEntity> getTileEntity() {
|
||||
return TileEntityRelay.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IRegisterableResearch getResearchItem() {
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public IRegisterableResearch getResearchItem() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ThaumicTinkererRecipe getRecipeItem() {
|
||||
return new ThaumicTinkererArcaneRecipe(LibResearch.KEY_RELAY, LibResearch.KEY_MOBILIZER, new ItemStack(this), new AspectList().add(Aspect.AIR, 20).add(Aspect.ORDER, 5).add(Aspect.EARTH, 15),
|
||||
"WFW", "SIs", "WFW",
|
||||
'I', new ItemStack(Items.iron_ingot),
|
||||
's', new ItemStack(ConfigItems.itemShard, 1, 3),
|
||||
'S', new ItemStack(ConfigItems.itemShard),
|
||||
'W', new ItemStack(ConfigBlocks.blockMagicalLog),
|
||||
'F', new ItemStack(Blocks.glass));
|
||||
}
|
||||
@Override
|
||||
public ThaumicTinkererRecipe getRecipeItem() {
|
||||
return new ThaumicTinkererArcaneRecipe(LibResearch.KEY_RELAY, LibResearch.KEY_MOBILIZER, new ItemStack(this), new AspectList().add(Aspect.AIR, 20).add(Aspect.ORDER, 5).add(Aspect.EARTH, 15),
|
||||
"WFW", "SIs", "WFW",
|
||||
'I', new ItemStack(Items.iron_ingot),
|
||||
's', new ItemStack(ConfigItems.itemShard, 1, 3),
|
||||
'S', new ItemStack(ConfigItems.itemShard),
|
||||
'W', new ItemStack(ConfigBlocks.blockMagicalLog),
|
||||
'F', new ItemStack(Blocks.glass));
|
||||
}
|
||||
}
|
||||
@@ -42,144 +42,144 @@ import java.util.List;
|
||||
|
||||
public class BlockDarkQuartz extends BlockMod {
|
||||
|
||||
private static final String[] iconNames = new String[]{ "darkQuartz0", "chiseledDarkQuartz0", "pillarDarkQuartz0", null, null };
|
||||
private IIcon[] darkQuartzIcons;
|
||||
private IIcon chiseledDarkQuartzIcon;
|
||||
private IIcon pillarDarkQuartzIcon;
|
||||
private IIcon darkQuartzTopIcon;
|
||||
private static final String[] iconNames = new String[]{"darkQuartz0", "chiseledDarkQuartz0", "pillarDarkQuartz0", null, null};
|
||||
private IIcon[] darkQuartzIcons;
|
||||
private IIcon chiseledDarkQuartzIcon;
|
||||
private IIcon pillarDarkQuartzIcon;
|
||||
private IIcon darkQuartzTopIcon;
|
||||
|
||||
public BlockDarkQuartz() {
|
||||
super(Material.rock);
|
||||
setHardness(0.8F);
|
||||
setResistance(10F);
|
||||
}
|
||||
public BlockDarkQuartz() {
|
||||
super(Material.rock);
|
||||
setHardness(0.8F);
|
||||
setResistance(10F);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int par1, int par2) {
|
||||
if (par2 != 2 && par2 != 3 && par2 != 4) {
|
||||
if (par1 != 1 && (par1 != 0 || par2 != 1)) {
|
||||
if (par1 == 0)
|
||||
return darkQuartzTopIcon;
|
||||
else {
|
||||
if (par2 < 0 || par2 >= darkQuartzIcons.length)
|
||||
par2 = 0;
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int par1, int par2) {
|
||||
if (par2 != 2 && par2 != 3 && par2 != 4) {
|
||||
if (par1 != 1 && (par1 != 0 || par2 != 1)) {
|
||||
if (par1 == 0)
|
||||
return darkQuartzTopIcon;
|
||||
else {
|
||||
if (par2 < 0 || par2 >= darkQuartzIcons.length)
|
||||
par2 = 0;
|
||||
|
||||
return darkQuartzIcons[par2];
|
||||
}
|
||||
} else return par2 == 1 ? chiseledDarkQuartzIcon : darkQuartzTopIcon;
|
||||
} else
|
||||
return par2 == 2 && (par1 == 1 || par1 == 0) ? pillarDarkQuartzIcon : par2 == 3 && (par1 == 5 || par1 == 4) ? pillarDarkQuartzIcon : par2 == 4 && (par1 == 2 || par1 == 3) ? pillarDarkQuartzIcon : darkQuartzIcons[par2];
|
||||
}
|
||||
return darkQuartzIcons[par2];
|
||||
}
|
||||
} else return par2 == 1 ? chiseledDarkQuartzIcon : darkQuartzTopIcon;
|
||||
} else
|
||||
return par2 == 2 && (par1 == 1 || par1 == 0) ? pillarDarkQuartzIcon : par2 == 3 && (par1 == 5 || par1 == 4) ? pillarDarkQuartzIcon : par2 == 4 && (par1 == 2 || par1 == 3) ? pillarDarkQuartzIcon : darkQuartzIcons[par2];
|
||||
}
|
||||
|
||||
@Override
|
||||
public int onBlockPlaced(World par1World, int par2, int par3, int par4, int par5, float par6, float par7, float par8, int par9) {
|
||||
if (par9 == 2) {
|
||||
switch (par5) {
|
||||
case 0:
|
||||
case 1:
|
||||
par9 = 2;
|
||||
break;
|
||||
case 2:
|
||||
case 3:
|
||||
par9 = 4;
|
||||
break;
|
||||
case 4:
|
||||
case 5:
|
||||
par9 = 3;
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public int onBlockPlaced(World par1World, int par2, int par3, int par4, int par5, float par6, float par7, float par8, int par9) {
|
||||
if (par9 == 2) {
|
||||
switch (par5) {
|
||||
case 0:
|
||||
case 1:
|
||||
par9 = 2;
|
||||
break;
|
||||
case 2:
|
||||
case 3:
|
||||
par9 = 4;
|
||||
break;
|
||||
case 4:
|
||||
case 5:
|
||||
par9 = 3;
|
||||
}
|
||||
}
|
||||
|
||||
return par9;
|
||||
}
|
||||
return par9;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(int par1) {
|
||||
return par1 != 3 && par1 != 4 ? par1 : 2;
|
||||
}
|
||||
@Override
|
||||
public int damageDropped(int par1) {
|
||||
return par1 != 3 && par1 != 4 ? par1 : 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack createStackedBlock(int par1) {
|
||||
return par1 != 3 && par1 != 4 ? super.createStackedBlock(par1) : new ItemStack(this, 1, 2);
|
||||
}
|
||||
@Override
|
||||
public ItemStack createStackedBlock(int par1) {
|
||||
return par1 != 3 && par1 != 4 ? super.createStackedBlock(par1) : new ItemStack(this, 1, 2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return 39;
|
||||
}
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return 39;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubBlocks(Item item, CreativeTabs tab, List par3List) {
|
||||
par3List.add(new ItemStack(this, 1, 0));
|
||||
par3List.add(new ItemStack(this, 1, 1));
|
||||
par3List.add(new ItemStack(this, 1, 2));
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubBlocks(Item item, CreativeTabs tab, List par3List) {
|
||||
par3List.add(new ItemStack(this, 1, 0));
|
||||
par3List.add(new ItemStack(this, 1, 1));
|
||||
par3List.add(new ItemStack(this, 1, 2));
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister par1IconRegister) {
|
||||
darkQuartzIcons = new IIcon[iconNames.length];
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister par1IconRegister) {
|
||||
darkQuartzIcons = new IIcon[iconNames.length];
|
||||
|
||||
for (int i = 0; i < darkQuartzIcons.length; ++i) {
|
||||
if (iconNames[i] == null)
|
||||
darkQuartzIcons[i] = darkQuartzIcons[i - 1];
|
||||
else darkQuartzIcons[i] = IconHelper.forName(par1IconRegister, iconNames[i]);
|
||||
}
|
||||
for (int i = 0; i < darkQuartzIcons.length; ++i) {
|
||||
if (iconNames[i] == null)
|
||||
darkQuartzIcons[i] = darkQuartzIcons[i - 1];
|
||||
else darkQuartzIcons[i] = IconHelper.forName(par1IconRegister, iconNames[i]);
|
||||
}
|
||||
|
||||
darkQuartzTopIcon = IconHelper.forName(par1IconRegister, "darkQuartz1");
|
||||
chiseledDarkQuartzIcon = IconHelper.forName(par1IconRegister, "chiseledDarkQuartz1");
|
||||
pillarDarkQuartzIcon = IconHelper.forName(par1IconRegister, "pillarDarkQuartz1");
|
||||
}
|
||||
darkQuartzTopIcon = IconHelper.forName(par1IconRegister, "darkQuartz1");
|
||||
chiseledDarkQuartzIcon = IconHelper.forName(par1IconRegister, "chiseledDarkQuartz1");
|
||||
pillarDarkQuartzIcon = IconHelper.forName(par1IconRegister, "pillarDarkQuartz1");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<Object> getSpecialParameters() {
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public ArrayList<Object> getSpecialParameters() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBlockName() {
|
||||
return LibBlockNames.DARK_QUARTZ;
|
||||
}
|
||||
@Override
|
||||
public String getBlockName() {
|
||||
return LibBlockNames.DARK_QUARTZ;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRegister() {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean shouldRegister() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldDisplayInTab() {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean shouldDisplayInTab() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends ItemBlock> getItemBlock() {
|
||||
return ItemDarkQuartzBlock.class;
|
||||
}
|
||||
@Override
|
||||
public Class<? extends ItemBlock> getItemBlock() {
|
||||
return ItemDarkQuartzBlock.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends TileEntity> getTileEntity() {
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public Class<? extends TileEntity> getTileEntity() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IRegisterableResearch getResearchItem() {
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public IRegisterableResearch getResearchItem() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ThaumicTinkererRecipe getRecipeItem() {
|
||||
return new ThaumicTinkererRecipeMulti(
|
||||
@Override
|
||||
public ThaumicTinkererRecipe getRecipeItem() {
|
||||
return new ThaumicTinkererRecipeMulti(
|
||||
|
||||
new ThaumicTinkererCraftingBenchRecipe(LibResearch.KEY_DARK_QUARTZ + 1, new ItemStack(ThaumicTinkerer.registry.getFirstBlockFromClass(BlockDarkQuartz.class)),
|
||||
"QQ", "QQ",
|
||||
'Q', ThaumicTinkerer.registry.getFirstItemFromClass(ItemDarkQuartz.class)),
|
||||
new ThaumicTinkererCraftingBenchRecipe(LibResearch.KEY_DARK_QUARTZ + 3, new ItemStack(ThaumicTinkerer.registry.getFirstBlockFromClass(BlockDarkQuartz.class), 2, 2),
|
||||
"Q", "Q",
|
||||
'Q', ThaumicTinkerer.registry.getFirstBlockFromClass(BlockDarkQuartz.class)),
|
||||
new ThaumicTinkererCraftingBenchRecipe(LibResearch.KEY_DARK_QUARTZ + 4, new ItemStack(ThaumicTinkerer.registry.getFirstBlockFromClass(BlockDarkQuartz.class), 1, 1),
|
||||
"Q", "Q",
|
||||
'Q', ThaumicTinkerer.registry.getFirstBlockFromClass(BlockDarkQuartzSlab.class))
|
||||
);
|
||||
}
|
||||
new ThaumicTinkererCraftingBenchRecipe(LibResearch.KEY_DARK_QUARTZ + 1, new ItemStack(ThaumicTinkerer.registry.getFirstBlockFromClass(BlockDarkQuartz.class)),
|
||||
"QQ", "QQ",
|
||||
'Q', ThaumicTinkerer.registry.getFirstItemFromClass(ItemDarkQuartz.class)),
|
||||
new ThaumicTinkererCraftingBenchRecipe(LibResearch.KEY_DARK_QUARTZ + 3, new ItemStack(ThaumicTinkerer.registry.getFirstBlockFromClass(BlockDarkQuartz.class), 2, 2),
|
||||
"Q", "Q",
|
||||
'Q', ThaumicTinkerer.registry.getFirstBlockFromClass(BlockDarkQuartz.class)),
|
||||
new ThaumicTinkererCraftingBenchRecipe(LibResearch.KEY_DARK_QUARTZ + 4, new ItemStack(ThaumicTinkerer.registry.getFirstBlockFromClass(BlockDarkQuartz.class), 1, 1),
|
||||
"Q", "Q",
|
||||
'Q', ThaumicTinkerer.registry.getFirstBlockFromClass(BlockDarkQuartzSlab.class))
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -26,7 +26,6 @@ import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import thaumic.tinkerer.common.ThaumicTinkerer;
|
||||
import thaumic.tinkerer.common.core.handler.ModCreativeTab;
|
||||
import thaumic.tinkerer.common.item.quartz.ItemDarkQuartzBlock;
|
||||
import thaumic.tinkerer.common.item.quartz.ItemDarkQuartzSlab;
|
||||
import thaumic.tinkerer.common.lib.LibBlockNames;
|
||||
import thaumic.tinkerer.common.lib.LibResearch;
|
||||
@@ -40,100 +39,100 @@ import java.util.Random;
|
||||
|
||||
public class BlockDarkQuartzSlab extends BlockSlab implements ITTinkererBlock {
|
||||
|
||||
public BlockDarkQuartzSlab(boolean par2) {
|
||||
super(par2, Material.rock);
|
||||
setHardness(0.8F);
|
||||
setResistance(10F);
|
||||
if (!par2) {
|
||||
setLightOpacity(0);
|
||||
setCreativeTab(ModCreativeTab.INSTANCE);
|
||||
}
|
||||
}
|
||||
public BlockDarkQuartzSlab(boolean par2) {
|
||||
super(par2, Material.rock);
|
||||
setHardness(0.8F);
|
||||
setResistance(10F);
|
||||
if (!par2) {
|
||||
setLightOpacity(0);
|
||||
setCreativeTab(ModCreativeTab.INSTANCE);
|
||||
}
|
||||
}
|
||||
|
||||
public BlockDarkQuartzSlab(Boolean par2) {
|
||||
this(par2.booleanValue());
|
||||
}
|
||||
public BlockDarkQuartzSlab(Boolean par2) {
|
||||
this(par2.booleanValue());
|
||||
}
|
||||
|
||||
public BlockDarkQuartzSlab() {
|
||||
this(false);
|
||||
}
|
||||
public BlockDarkQuartzSlab() {
|
||||
this(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int par1, int par2) {
|
||||
return ThaumicTinkerer.registry.getFirstBlockFromClass(BlockDarkQuartz.class).getBlockTextureFromSide(par1);
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int par1, int par2) {
|
||||
return ThaumicTinkerer.registry.getFirstBlockFromClass(BlockDarkQuartz.class).getBlockTextureFromSide(par1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_) {
|
||||
return Item.getItemFromBlock(ThaumicTinkerer.registry.getFirstBlockFromClass(BlockDarkQuartzSlab.class));
|
||||
}
|
||||
@Override
|
||||
public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_) {
|
||||
return Item.getItemFromBlock(ThaumicTinkerer.registry.getFirstBlockFromClass(BlockDarkQuartzSlab.class));
|
||||
}
|
||||
|
||||
//@Override
|
||||
//public int idDropped(int par1, Random par2Random, int par3) {
|
||||
// return ThaumicTinkerer.registry.getFirstBlockFromClass(BlockDarkQuartzSlab.class).blockID;
|
||||
//}
|
||||
//@Override
|
||||
//public int idDropped(int par1, Random par2Random, int par3) {
|
||||
// return ThaumicTinkerer.registry.getFirstBlockFromClass(BlockDarkQuartzSlab.class).blockID;
|
||||
//}
|
||||
|
||||
@Override
|
||||
public ItemStack createStackedBlock(int par1) {
|
||||
return new ItemStack(ThaumicTinkerer.registry.getFirstBlockFromClass(BlockDarkQuartzSlab.class));
|
||||
}
|
||||
@Override
|
||||
public ItemStack createStackedBlock(int par1) {
|
||||
return new ItemStack(ThaumicTinkerer.registry.getFirstBlockFromClass(BlockDarkQuartzSlab.class));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String func_150002_b(int i) {
|
||||
return "tile." + LibBlockNames.DARK_QUARTZ_SLAB;
|
||||
}
|
||||
@Override
|
||||
public String func_150002_b(int i) {
|
||||
return "tile." + LibBlockNames.DARK_QUARTZ_SLAB;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister par1IconRegister) {
|
||||
// NO-OP
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister par1IconRegister) {
|
||||
// NO-OP
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<Object> getSpecialParameters() {
|
||||
ArrayList result = new ArrayList();
|
||||
result.add(true);
|
||||
return result;
|
||||
}
|
||||
@Override
|
||||
public ArrayList<Object> getSpecialParameters() {
|
||||
ArrayList result = new ArrayList();
|
||||
result.add(true);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBlockName() {
|
||||
return field_150004_a ? LibBlockNames.DARK_QUARTZ_SLAB_FULL : LibBlockNames.DARK_QUARTZ_SLAB;
|
||||
}
|
||||
@Override
|
||||
public String getBlockName() {
|
||||
return field_150004_a ? LibBlockNames.DARK_QUARTZ_SLAB_FULL : LibBlockNames.DARK_QUARTZ_SLAB;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRegister() {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean shouldRegister() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldDisplayInTab() {
|
||||
return !field_150004_a;
|
||||
}
|
||||
@Override
|
||||
public boolean shouldDisplayInTab() {
|
||||
return !field_150004_a;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends ItemBlock> getItemBlock() {
|
||||
return ItemDarkQuartzSlab.class;
|
||||
}
|
||||
@Override
|
||||
public Class<? extends ItemBlock> getItemBlock() {
|
||||
return ItemDarkQuartzSlab.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends TileEntity> getTileEntity() {
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public Class<? extends TileEntity> getTileEntity() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IRegisterableResearch getResearchItem() {
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public IRegisterableResearch getResearchItem() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ThaumicTinkererRecipe getRecipeItem() {
|
||||
if (isOpaqueCube()) {
|
||||
return null;
|
||||
}
|
||||
return new ThaumicTinkererCraftingBenchRecipe(LibResearch.KEY_DARK_QUARTZ + 2, new ItemStack(ThaumicTinkerer.registry.getFirstBlockFromClass(BlockDarkQuartzSlab.class), 6),
|
||||
"QQQ",
|
||||
'Q', ThaumicTinkerer.registry.getFirstBlockFromClass(BlockDarkQuartz.class));
|
||||
}
|
||||
@Override
|
||||
public ThaumicTinkererRecipe getRecipeItem() {
|
||||
if (isOpaqueCube()) {
|
||||
return null;
|
||||
}
|
||||
return new ThaumicTinkererCraftingBenchRecipe(LibResearch.KEY_DARK_QUARTZ + 2, new ItemStack(ThaumicTinkerer.registry.getFirstBlockFromClass(BlockDarkQuartzSlab.class), 6),
|
||||
"QQQ",
|
||||
'Q', ThaumicTinkerer.registry.getFirstBlockFromClass(BlockDarkQuartz.class));
|
||||
}
|
||||
}
|
||||
@@ -20,7 +20,6 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import thaumic.tinkerer.common.ThaumicTinkerer;
|
||||
import thaumic.tinkerer.common.core.handler.ModCreativeTab;
|
||||
import thaumic.tinkerer.common.item.quartz.ItemDarkQuartzBlock;
|
||||
import thaumic.tinkerer.common.lib.LibBlockNames;
|
||||
import thaumic.tinkerer.common.lib.LibResearch;
|
||||
import thaumic.tinkerer.common.registry.ITTinkererBlock;
|
||||
@@ -33,55 +32,55 @@ import java.util.ArrayList;
|
||||
|
||||
public class BlockDarkQuartzStairs extends BlockStairs implements ITTinkererBlock {
|
||||
|
||||
public BlockDarkQuartzStairs() {
|
||||
super(ThaumicTinkerer.registry.getFirstBlockFromClass(BlockDarkQuartz.class), 0);
|
||||
setCreativeTab(ModCreativeTab.INSTANCE);
|
||||
}
|
||||
public BlockDarkQuartzStairs() {
|
||||
super(ThaumicTinkerer.registry.getFirstBlockFromClass(BlockDarkQuartz.class), 0);
|
||||
setCreativeTab(ModCreativeTab.INSTANCE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<Object> getSpecialParameters() {
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public ArrayList<Object> getSpecialParameters() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBlockName() {
|
||||
return LibBlockNames.DARK_QUARTZ_STAIRS;
|
||||
}
|
||||
@Override
|
||||
public String getBlockName() {
|
||||
return LibBlockNames.DARK_QUARTZ_STAIRS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRegister() {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean shouldRegister() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldDisplayInTab() {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean shouldDisplayInTab() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends ItemBlock> getItemBlock() {
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public Class<? extends ItemBlock> getItemBlock() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends TileEntity> getTileEntity() {
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public Class<? extends TileEntity> getTileEntity() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IRegisterableResearch getResearchItem() {
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public IRegisterableResearch getResearchItem() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ThaumicTinkererRecipe getRecipeItem() {
|
||||
return new ThaumicTinkererRecipeMulti(
|
||||
new ThaumicTinkererCraftingBenchRecipe(LibResearch.KEY_DARK_QUARTZ + 5, new ItemStack(this, 4),
|
||||
" Q", " QQ", "QQQ",
|
||||
'Q', ThaumicTinkerer.registry.getFirstBlockFromClass(BlockDarkQuartz.class)),
|
||||
new ThaumicTinkererCraftingBenchRecipe("", new ItemStack(this, 4),
|
||||
"Q ", "QQ ", "QQQ",
|
||||
'Q', ThaumicTinkerer.registry.getFirstBlockFromClass(BlockDarkQuartz.class))
|
||||
);
|
||||
}
|
||||
@Override
|
||||
public ThaumicTinkererRecipe getRecipeItem() {
|
||||
return new ThaumicTinkererRecipeMulti(
|
||||
new ThaumicTinkererCraftingBenchRecipe(LibResearch.KEY_DARK_QUARTZ + 5, new ItemStack(this, 4),
|
||||
" Q", " QQ", "QQQ",
|
||||
'Q', ThaumicTinkerer.registry.getFirstBlockFromClass(BlockDarkQuartz.class)),
|
||||
new ThaumicTinkererCraftingBenchRecipe("", new ItemStack(this, 4),
|
||||
"Q ", "QQ ", "QQQ",
|
||||
'Q', ThaumicTinkerer.registry.getFirstBlockFromClass(BlockDarkQuartz.class))
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -33,260 +33,258 @@ import net.minecraftforge.common.util.Constants;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
import thaumcraft.api.aspects.AspectList;
|
||||
import thaumcraft.common.lib.crafting.ThaumcraftCraftingManager;
|
||||
import thaumcraft.common.lib.research.ResearchManager;
|
||||
import thaumic.tinkerer.common.ThaumicTinkerer;
|
||||
import thaumic.tinkerer.common.lib.LibBlockNames;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Optional.InterfaceList({
|
||||
@Optional.Interface(iface = "li.cil.oc.api.network.SimpleComponent", modid = "OpenComputers"),
|
||||
@Optional.Interface(iface = "dan200.computercraft.api.peripheral.IPeripheral", modid = "ComputerCraft")
|
||||
@Optional.Interface(iface = "li.cil.oc.api.network.SimpleComponent", modid = "OpenComputers"),
|
||||
@Optional.Interface(iface = "dan200.computercraft.api.peripheral.IPeripheral", modid = "ComputerCraft")
|
||||
})
|
||||
public class TileAspectAnalyzer extends TileEntity implements IInventory, SimpleComponent, IPeripheral, IMovableTile {
|
||||
|
||||
ItemStack[] inventorySlots = new ItemStack[1];
|
||||
ItemStack[] inventorySlots = new ItemStack[1];
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound par1NBTTagCompound) {
|
||||
super.readFromNBT(par1NBTTagCompound);
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound par1NBTTagCompound) {
|
||||
super.readFromNBT(par1NBTTagCompound);
|
||||
|
||||
NBTTagList var2 = par1NBTTagCompound.getTagList("Items", Constants.NBT.TAG_COMPOUND);
|
||||
inventorySlots = new ItemStack[getSizeInventory()];
|
||||
for (int var3 = 0; var3 < var2.tagCount(); ++var3) {
|
||||
NBTTagCompound var4 = var2.getCompoundTagAt(var3);
|
||||
byte var5 = var4.getByte("Slot");
|
||||
if (var5 >= 0 && var5 < inventorySlots.length)
|
||||
inventorySlots[var5] = ItemStack.loadItemStackFromNBT(var4);
|
||||
}
|
||||
}
|
||||
NBTTagList var2 = par1NBTTagCompound.getTagList("Items", Constants.NBT.TAG_COMPOUND);
|
||||
inventorySlots = new ItemStack[getSizeInventory()];
|
||||
for (int var3 = 0; var3 < var2.tagCount(); ++var3) {
|
||||
NBTTagCompound var4 = var2.getCompoundTagAt(var3);
|
||||
byte var5 = var4.getByte("Slot");
|
||||
if (var5 >= 0 && var5 < inventorySlots.length)
|
||||
inventorySlots[var5] = ItemStack.loadItemStackFromNBT(var4);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound par1NBTTagCompound) {
|
||||
super.writeToNBT(par1NBTTagCompound);
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound par1NBTTagCompound) {
|
||||
super.writeToNBT(par1NBTTagCompound);
|
||||
|
||||
NBTTagList var2 = new NBTTagList();
|
||||
for (int var3 = 0; var3 < inventorySlots.length; ++var3) {
|
||||
if (inventorySlots[var3] != null) {
|
||||
NBTTagCompound var4 = new NBTTagCompound();
|
||||
var4.setByte("Slot", (byte) var3);
|
||||
inventorySlots[var3].writeToNBT(var4);
|
||||
var2.appendTag(var4);
|
||||
}
|
||||
}
|
||||
par1NBTTagCompound.setTag("Items", var2);
|
||||
NBTTagList var2 = new NBTTagList();
|
||||
for (int var3 = 0; var3 < inventorySlots.length; ++var3) {
|
||||
if (inventorySlots[var3] != null) {
|
||||
NBTTagCompound var4 = new NBTTagCompound();
|
||||
var4.setByte("Slot", (byte) var3);
|
||||
inventorySlots[var3].writeToNBT(var4);
|
||||
var2.appendTag(var4);
|
||||
}
|
||||
}
|
||||
par1NBTTagCompound.setTag("Items", var2);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSizeInventory() {
|
||||
return inventorySlots.length;
|
||||
}
|
||||
@Override
|
||||
public int getSizeInventory() {
|
||||
return inventorySlots.length;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlot(int i) {
|
||||
return inventorySlots[i];
|
||||
}
|
||||
@Override
|
||||
public ItemStack getStackInSlot(int i) {
|
||||
return inventorySlots[i];
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack decrStackSize(int i, int j) {
|
||||
if (inventorySlots[i] != null) {
|
||||
ItemStack stackAt;
|
||||
@Override
|
||||
public ItemStack decrStackSize(int i, int j) {
|
||||
if (inventorySlots[i] != null) {
|
||||
ItemStack stackAt;
|
||||
|
||||
if (inventorySlots[i].stackSize <= j) {
|
||||
stackAt = inventorySlots[i];
|
||||
inventorySlots[i] = null;
|
||||
return stackAt;
|
||||
} else {
|
||||
stackAt = inventorySlots[i].splitStack(j);
|
||||
if (inventorySlots[i].stackSize <= j) {
|
||||
stackAt = inventorySlots[i];
|
||||
inventorySlots[i] = null;
|
||||
return stackAt;
|
||||
} else {
|
||||
stackAt = inventorySlots[i].splitStack(j);
|
||||
|
||||
if (inventorySlots[i].stackSize == 0)
|
||||
inventorySlots[i] = null;
|
||||
if (inventorySlots[i].stackSize == 0)
|
||||
inventorySlots[i] = null;
|
||||
|
||||
return stackAt;
|
||||
}
|
||||
}
|
||||
return stackAt;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlotOnClosing(int i) {
|
||||
return getStackInSlot(i);
|
||||
}
|
||||
@Override
|
||||
public ItemStack getStackInSlotOnClosing(int i) {
|
||||
return getStackInSlot(i);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInventorySlotContents(int i, ItemStack itemstack) {
|
||||
inventorySlots[i] = itemstack;
|
||||
}
|
||||
@Override
|
||||
public void setInventorySlotContents(int i, ItemStack itemstack) {
|
||||
inventorySlots[i] = itemstack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return LibBlockNames.ASPECT_ANALYZER;
|
||||
}
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return LibBlockNames.ASPECT_ANALYZER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCustomInventoryName() {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean hasCustomInventoryName() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInventoryStackLimit() {
|
||||
return 64;
|
||||
}
|
||||
@Override
|
||||
public int getInventoryStackLimit() {
|
||||
return 64;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUseableByPlayer(EntityPlayer entityplayer) {
|
||||
return worldObj.getTileEntity(xCoord, yCoord, zCoord) == this && entityplayer.getDistanceSq(xCoord + 0.5D, yCoord + 0.5D, zCoord + 0.5D) <= 64;
|
||||
}
|
||||
@Override
|
||||
public boolean isUseableByPlayer(EntityPlayer entityplayer) {
|
||||
return worldObj.getTileEntity(xCoord, yCoord, zCoord) == this && entityplayer.getDistanceSq(xCoord + 0.5D, yCoord + 0.5D, zCoord + 0.5D) <= 64;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openInventory() {
|
||||
@Override
|
||||
public void openInventory() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeInventory() {
|
||||
@Override
|
||||
public void closeInventory() {
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int i, ItemStack itemstack) {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int i, ItemStack itemstack) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType() {
|
||||
return "tt_aspectanalyzer";
|
||||
}
|
||||
@Override
|
||||
public String getType() {
|
||||
return "tt_aspectanalyzer";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getMethodNames() {
|
||||
return new String[]{ "hasItem", "itemHasAspects", "getAspects", "getAspectCount" };
|
||||
}
|
||||
@Override
|
||||
public String[] getMethodNames() {
|
||||
return new String[]{"hasItem", "itemHasAspects", "getAspects", "getAspectCount"};
|
||||
}
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid = "ComputerCraft")
|
||||
public Object[] callMethod(IComputerAccess computer, ILuaContext context, int method, Object[] arguments){
|
||||
switch (method) {
|
||||
case 0:
|
||||
return hasItemMethod();
|
||||
case 1:
|
||||
return itemHasAspectsMethod();
|
||||
case 2:
|
||||
return getAspectsMethod();
|
||||
case 3:
|
||||
return getAspectsAmountsMethod();
|
||||
}
|
||||
@Override
|
||||
@Optional.Method(modid = "ComputerCraft")
|
||||
public Object[] callMethod(IComputerAccess computer, ILuaContext context, int method, Object[] arguments) {
|
||||
switch (method) {
|
||||
case 0:
|
||||
return hasItemMethod();
|
||||
case 1:
|
||||
return itemHasAspectsMethod();
|
||||
case 2:
|
||||
return getAspectsMethod();
|
||||
case 3:
|
||||
return getAspectsAmountsMethod();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public Object[] hasItemMethod() {
|
||||
ItemStack stack = getStackInSlot(0);
|
||||
return new Object[]{ stack != null };
|
||||
}
|
||||
public Object[] hasItemMethod() {
|
||||
ItemStack stack = getStackInSlot(0);
|
||||
return new Object[]{stack != null};
|
||||
}
|
||||
|
||||
public AspectList getAspectList() {
|
||||
ItemStack stack = getStackInSlot(0);
|
||||
AspectList aspects = null;
|
||||
if (stack != null) {
|
||||
public AspectList getAspectList() {
|
||||
ItemStack stack = getStackInSlot(0);
|
||||
AspectList aspects = null;
|
||||
if (stack != null) {
|
||||
|
||||
aspects = ThaumcraftCraftingManager.getObjectTags(stack);
|
||||
aspects = ThaumcraftCraftingManager.getBonusTags(stack, aspects);
|
||||
}
|
||||
aspects = ThaumcraftCraftingManager.getObjectTags(stack);
|
||||
aspects = ThaumcraftCraftingManager.getBonusTags(stack, aspects);
|
||||
}
|
||||
|
||||
return aspects;
|
||||
}
|
||||
return aspects;
|
||||
}
|
||||
|
||||
public Object[] itemHasAspectsMethod() {
|
||||
AspectList aspects = getAspectList();
|
||||
return new Object[]{ aspects != null && aspects.size() > 0 };
|
||||
}
|
||||
public Object[] itemHasAspectsMethod() {
|
||||
AspectList aspects = getAspectList();
|
||||
return new Object[]{aspects != null && aspects.size() > 0};
|
||||
}
|
||||
|
||||
public Object[] getAspectsMethod() {
|
||||
AspectList aspects = getAspectList();
|
||||
Map<Double, String> retVals = new HashMap<Double, String>();
|
||||
if (aspects == null)
|
||||
return new Object[]{ retVals };
|
||||
double i = 1;
|
||||
for (Aspect aspect : aspects.getAspectsSorted())
|
||||
retVals.put(i++, aspect.getTag());
|
||||
return new Object[]{ retVals };
|
||||
}
|
||||
public Object[] getAspectsMethod() {
|
||||
AspectList aspects = getAspectList();
|
||||
Map<Double, String> retVals = new HashMap<Double, String>();
|
||||
if (aspects == null)
|
||||
return new Object[]{retVals};
|
||||
double i = 1;
|
||||
for (Aspect aspect : aspects.getAspectsSorted())
|
||||
retVals.put(i++, aspect.getTag());
|
||||
return new Object[]{retVals};
|
||||
}
|
||||
|
||||
public Object[] getAspectsAmountsMethod() {
|
||||
AspectList aspects = getAspectList();
|
||||
Map<String, Double> retVals = new HashMap<String, Double>();
|
||||
if (aspects == null)
|
||||
return new Object[]{ retVals };
|
||||
for (Aspect aspect : aspects.getAspectsSorted())
|
||||
retVals.put(aspect.getTag(), (double) aspects.getAmount(aspect));
|
||||
return new Object[]{ retVals };
|
||||
}
|
||||
public Object[] getAspectsAmountsMethod() {
|
||||
AspectList aspects = getAspectList();
|
||||
Map<String, Double> retVals = new HashMap<String, Double>();
|
||||
if (aspects == null)
|
||||
return new Object[]{retVals};
|
||||
for (Aspect aspect : aspects.getAspectsSorted())
|
||||
retVals.put(aspect.getTag(), (double) aspects.getAmount(aspect));
|
||||
return new Object[]{retVals};
|
||||
}
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid = "ComputerCraft")
|
||||
public void attach(IComputerAccess computer) {
|
||||
// NO-OP
|
||||
}
|
||||
@Override
|
||||
@Optional.Method(modid = "ComputerCraft")
|
||||
public void attach(IComputerAccess computer) {
|
||||
// NO-OP
|
||||
}
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid = "ComputerCraft")
|
||||
public void detach(IComputerAccess computer) {
|
||||
// NO-OP
|
||||
}
|
||||
@Override
|
||||
@Optional.Method(modid = "ComputerCraft")
|
||||
public void detach(IComputerAccess computer) {
|
||||
// NO-OP
|
||||
}
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid = "ComputerCraft")
|
||||
public boolean equals(IPeripheral other) {
|
||||
return this.equals((Object) other);
|
||||
}
|
||||
@Override
|
||||
@Optional.Method(modid = "ComputerCraft")
|
||||
public boolean equals(IPeripheral other) {
|
||||
return this.equals((Object) other);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean prepareToMove() {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean prepareToMove() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doneMoving() {
|
||||
@Override
|
||||
public void doneMoving() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getComponentName() {
|
||||
return getType();
|
||||
}
|
||||
@Override
|
||||
public String getComponentName() {
|
||||
return getType();
|
||||
}
|
||||
|
||||
@Callback
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] greet(Context context, Arguments args) {
|
||||
return new Object[]{ String.format("Hello, %s!", args.checkString(0)) };
|
||||
}
|
||||
@Callback
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] greet(Context context, Arguments args) {
|
||||
return new Object[]{String.format("Hello, %s!", args.checkString(0))};
|
||||
}
|
||||
|
||||
@Callback(doc = "function():boolean -- Whether this inventory contains an item")
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] hasItem(Context context, Arguments args) {
|
||||
return hasItemMethod();
|
||||
}
|
||||
@Callback(doc = "function():boolean -- Whether this inventory contains an item")
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] hasItem(Context context, Arguments args) {
|
||||
return hasItemMethod();
|
||||
}
|
||||
|
||||
@Callback(doc = "function():boolean -- Whether the item contains aspects")
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] itemHasAspects(Context context, Arguments args) {
|
||||
return itemHasAspectsMethod();
|
||||
}
|
||||
@Callback(doc = "function():boolean -- Whether the item contains aspects")
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] itemHasAspects(Context context, Arguments args) {
|
||||
return itemHasAspectsMethod();
|
||||
}
|
||||
|
||||
@Callback(doc = "function():table -- Returns a list of all available aspects")
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getAspects(Context context, Arguments args) {
|
||||
return getAspectsMethod();
|
||||
}
|
||||
@Callback(doc = "function():table -- Returns a list of all available aspects")
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getAspects(Context context, Arguments args) {
|
||||
return getAspectsMethod();
|
||||
}
|
||||
|
||||
@Callback(doc = "function():table -- returns a mapping of all aspect counts")
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getAspectCount(Context context, Arguments args) {
|
||||
return getAspectsAmountsMethod();
|
||||
}
|
||||
@Callback(doc = "function():table -- returns a mapping of all aspect counts")
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getAspectCount(Context context, Arguments args) {
|
||||
return getAspectsAmountsMethod();
|
||||
}
|
||||
}
|
||||
@@ -23,64 +23,64 @@ import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
public class TileCamo extends TileEntity implements IMovableTile {
|
||||
|
||||
private static final String TAG_CAMO = "camo";
|
||||
private static final String TAG_CAMO_META = "camoMeta";
|
||||
private static final String TAG_CAMO = "camo";
|
||||
private static final String TAG_CAMO_META = "camoMeta";
|
||||
|
||||
public Block camo;
|
||||
public int camoMeta;
|
||||
public Block camo;
|
||||
public int camoMeta;
|
||||
|
||||
@Override
|
||||
public boolean canUpdate() {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean canUpdate() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound par1nbtTagCompound) {
|
||||
super.writeToNBT(par1nbtTagCompound);
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound par1nbtTagCompound) {
|
||||
super.writeToNBT(par1nbtTagCompound);
|
||||
|
||||
writeCustomNBT(par1nbtTagCompound);
|
||||
}
|
||||
writeCustomNBT(par1nbtTagCompound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound par1nbtTagCompound) {
|
||||
super.readFromNBT(par1nbtTagCompound);
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound par1nbtTagCompound) {
|
||||
super.readFromNBT(par1nbtTagCompound);
|
||||
|
||||
readCustomNBT(par1nbtTagCompound);
|
||||
}
|
||||
readCustomNBT(par1nbtTagCompound);
|
||||
}
|
||||
|
||||
public void writeCustomNBT(NBTTagCompound cmp) {
|
||||
if (camo != null) {
|
||||
cmp.setString(TAG_CAMO, Block.blockRegistry.getNameForObject(camo));
|
||||
cmp.setInteger(TAG_CAMO_META, camoMeta);
|
||||
}
|
||||
}
|
||||
public void writeCustomNBT(NBTTagCompound cmp) {
|
||||
if (camo != null) {
|
||||
cmp.setString(TAG_CAMO, Block.blockRegistry.getNameForObject(camo));
|
||||
cmp.setInteger(TAG_CAMO_META, camoMeta);
|
||||
}
|
||||
}
|
||||
|
||||
public void readCustomNBT(NBTTagCompound cmp) {
|
||||
camo = Block.getBlockFromName(cmp.getString(TAG_CAMO));
|
||||
camoMeta = cmp.getInteger(TAG_CAMO_META);
|
||||
}
|
||||
public void readCustomNBT(NBTTagCompound cmp) {
|
||||
camo = Block.getBlockFromName(cmp.getString(TAG_CAMO));
|
||||
camoMeta = cmp.getInteger(TAG_CAMO_META);
|
||||
}
|
||||
|
||||
@Override
|
||||
public S35PacketUpdateTileEntity getDescriptionPacket() {
|
||||
NBTTagCompound nbttagcompound = new NBTTagCompound();
|
||||
writeCustomNBT(nbttagcompound);
|
||||
return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, -999, nbttagcompound);
|
||||
}
|
||||
@Override
|
||||
public S35PacketUpdateTileEntity getDescriptionPacket() {
|
||||
NBTTagCompound nbttagcompound = new NBTTagCompound();
|
||||
writeCustomNBT(nbttagcompound);
|
||||
return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, -999, nbttagcompound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDataPacket(NetworkManager manager, S35PacketUpdateTileEntity packet) {
|
||||
super.onDataPacket(manager, packet);
|
||||
readCustomNBT(packet.func_148857_g());
|
||||
worldObj.markBlockRangeForRenderUpdate(xCoord, yCoord, zCoord, xCoord, yCoord, zCoord);
|
||||
}
|
||||
@Override
|
||||
public void onDataPacket(NetworkManager manager, S35PacketUpdateTileEntity packet) {
|
||||
super.onDataPacket(manager, packet);
|
||||
readCustomNBT(packet.func_148857_g());
|
||||
worldObj.markBlockRangeForRenderUpdate(xCoord, yCoord, zCoord, xCoord, yCoord, zCoord);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean prepareToMove() {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean prepareToMove() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doneMoving() {
|
||||
@Override
|
||||
public void doneMoving() {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -42,394 +42,392 @@ import java.util.List;
|
||||
|
||||
public class TileEnchanter extends TileEntity implements ISidedInventory, IMovableTile {
|
||||
|
||||
private static final String TAG_ENCHANTS = "enchantsIntArray";
|
||||
private static final String TAG_LEVELS = "levelsIntArray";
|
||||
private static final String TAG_TOTAL_ASPECTS = "totalAspects";
|
||||
private static final String TAG_CURRENT_ASPECTS = "currentAspects";
|
||||
private static final String TAG_WORKING = "working";
|
||||
|
||||
public List<Integer> enchantments = new ArrayList();
|
||||
public List<Integer> levels = new ArrayList();
|
||||
|
||||
public AspectList totalAspects = new AspectList();
|
||||
public AspectList currentAspects = new AspectList();
|
||||
|
||||
public boolean working = false;
|
||||
|
||||
private List<Tuple4Int> pillars = new ArrayList();
|
||||
|
||||
ItemStack[] inventorySlots = new ItemStack[2];
|
||||
|
||||
public void clearEnchants() {
|
||||
enchantments.clear();
|
||||
levels.clear();
|
||||
}
|
||||
|
||||
public void appendEnchant(int enchant) {
|
||||
enchantments.add(enchant);
|
||||
}
|
||||
|
||||
public void appendLevel(int level) {
|
||||
levels.add(level);
|
||||
}
|
||||
|
||||
public void removeEnchant(int index) {
|
||||
enchantments.remove(index);
|
||||
}
|
||||
|
||||
public void removeLevel(int index) {
|
||||
levels.remove(index);
|
||||
}
|
||||
|
||||
public void setEnchant(int index, int enchant) {
|
||||
enchantments.set(index, enchant);
|
||||
}
|
||||
|
||||
public void setLevel(int index, int level) {
|
||||
levels.set(index, level);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
if (getStackInSlot(0) == null) {
|
||||
enchantments.clear();
|
||||
levels.clear();
|
||||
}
|
||||
|
||||
if (working) {
|
||||
ItemStack tool = getStackInSlot(0);
|
||||
if (tool == null) {
|
||||
working = false;
|
||||
return;
|
||||
}
|
||||
|
||||
checkPillars();
|
||||
|
||||
if (!working) // Pillar check
|
||||
return;
|
||||
|
||||
enchantItem:
|
||||
{
|
||||
for (Aspect aspect : LibFeatures.PRIMAL_ASPECTS) {
|
||||
int currentAmount = currentAspects.getAmount(aspect);
|
||||
int totalAmount = totalAspects.getAmount(aspect);
|
||||
|
||||
if (currentAmount < totalAmount)
|
||||
break enchantItem;
|
||||
}
|
||||
|
||||
working = false;
|
||||
currentAspects = new AspectList();
|
||||
totalAspects = new AspectList();
|
||||
|
||||
for (int i = 0; i < enchantments.size(); i++) {
|
||||
int enchant = enchantments.get(i);
|
||||
int level = levels.get(i);
|
||||
|
||||
if (!worldObj.isRemote)
|
||||
tool.addEnchantment(Enchantment.enchantmentsList[enchant], level);
|
||||
}
|
||||
|
||||
enchantments.clear();
|
||||
levels.clear();
|
||||
worldObj.playSoundEffect(xCoord, yCoord, zCoord, "thaumcraft:wand", 1F, 1F);
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
return;
|
||||
}
|
||||
|
||||
ItemStack wand = getStackInSlot(1);
|
||||
|
||||
if (wand != null && wand.getItem() instanceof ItemWandCasting && !((ItemWandCasting) wand.getItem()).isStaff(wand)) {
|
||||
ItemWandCasting wandItem = (ItemWandCasting) wand.getItem();
|
||||
AspectList wandAspects = wandItem.getAllVis(wand);
|
||||
|
||||
int missing, onWand;
|
||||
List<Aspect> aspectsThatCanGet = new ArrayList();
|
||||
|
||||
for (Aspect aspect : LibFeatures.PRIMAL_ASPECTS) {
|
||||
missing = totalAspects.getAmount(aspect) - currentAspects.getAmount(aspect);
|
||||
onWand = wandAspects.getAmount(aspect);
|
||||
|
||||
if (missing > 0 && onWand >= 100)
|
||||
aspectsThatCanGet.add(aspect);
|
||||
}
|
||||
|
||||
int i = aspectsThatCanGet.isEmpty() ? 0 : worldObj.rand.nextInt(aspectsThatCanGet.size());
|
||||
Aspect aspect = aspectsThatCanGet.isEmpty() ? null : aspectsThatCanGet.get(i);
|
||||
|
||||
if (aspect != null) {
|
||||
wandItem.consumeAllVisCrafting(wand, null, new AspectList().add(aspect, 1), true);
|
||||
currentAspects.add(aspect, 1);
|
||||
Tuple4Int p = pillars.get(i);
|
||||
if (worldObj.rand.nextBoolean()) {
|
||||
Thaumcraft.proxy.blockRunes(worldObj, p.i1, p.i4 - 0.75, p.i3, 0.3F + worldObj.rand.nextFloat() * 0.7F, 0.0F, 0.3F + worldObj.rand.nextFloat() * 0.7F, 15, worldObj.rand.nextFloat() / 8F);
|
||||
Thaumcraft.proxy.blockRunes(worldObj, xCoord, yCoord + 0.25, zCoord, 0.3F + worldObj.rand.nextFloat() * 0.7F, 0.0F, 0.3F + worldObj.rand.nextFloat() * 0.7F, 15, worldObj.rand.nextFloat() / 8F);
|
||||
if (worldObj.rand.nextInt(5) == 0)
|
||||
worldObj.playSoundEffect(p.i1, p.i2, p.i3, "thaumcraft:brain", 0.5F, 1F);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void markDirty() {
|
||||
super.markDirty();
|
||||
if (!worldObj.isRemote && !working) {
|
||||
enchantments.clear();
|
||||
levels.clear();
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean checkPillars() {
|
||||
if (pillars.isEmpty()) {
|
||||
if (assignPillars()) {
|
||||
working = false;
|
||||
currentAspects = new AspectList();
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
for (int i = 0; i < pillars.size(); i++) {
|
||||
Tuple4Int pillar = pillars.get(i);
|
||||
int pillarHeight = findPillar(pillar.i1, pillar.i2, pillar.i3);
|
||||
if (pillarHeight == -1) {
|
||||
pillars.clear();
|
||||
return checkPillars();
|
||||
} else if (pillarHeight != pillar.i4)
|
||||
pillar.i4 = pillarHeight;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean assignPillars() {
|
||||
int y = yCoord;
|
||||
for (int x = xCoord - 4; x <= xCoord + 4; x++)
|
||||
for (int z = zCoord - 4; z <= zCoord + 4; z++) {
|
||||
int height = findPillar(x, y, z);
|
||||
if (height != -1)
|
||||
pillars.add(new Tuple4Int(x, y, z, height));
|
||||
|
||||
if (pillars.size() == 6)
|
||||
return false;
|
||||
}
|
||||
|
||||
pillars.clear();
|
||||
return true;
|
||||
}
|
||||
|
||||
public int findPillar(int x, int y, int z) {
|
||||
int obsidianFound = 0;
|
||||
for (int i = 0; true; i++) {
|
||||
if (y + i >= 256)
|
||||
return -1;
|
||||
|
||||
Block id = worldObj.getBlock(x, y + i, z);
|
||||
int meta = worldObj.getBlockMetadata(x, y + i, z);
|
||||
if (id == ConfigBlocks.blockCosmeticSolid && meta == 0) {
|
||||
++obsidianFound;
|
||||
continue;
|
||||
}
|
||||
if (id == ConfigBlocks.blockAiry && meta == 1) {
|
||||
if (obsidianFound >= 2 && obsidianFound < 13)
|
||||
return y + i;
|
||||
return -1;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
public void updateAspectList() {
|
||||
totalAspects = new AspectList();
|
||||
for (int i = 0; i < enchantments.size(); i++) {
|
||||
int enchant = enchantments.get(i);
|
||||
int level = levels.get(i);
|
||||
|
||||
AspectList aspects = EnchantmentManager.enchantmentData.get(enchant).get(level).aspects;
|
||||
for (Aspect aspect : aspects.getAspectsSorted())
|
||||
totalAspects.add(aspect, aspects.getAmount(aspect));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound par1NBTTagCompound) {
|
||||
super.readFromNBT(par1NBTTagCompound);
|
||||
|
||||
readCustomNBT(par1NBTTagCompound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound par1NBTTagCompound) {
|
||||
super.writeToNBT(par1NBTTagCompound);
|
||||
|
||||
writeCustomNBT(par1NBTTagCompound);
|
||||
}
|
||||
|
||||
public void readCustomNBT(NBTTagCompound par1NBTTagCompound) {
|
||||
working = par1NBTTagCompound.getBoolean(TAG_WORKING);
|
||||
currentAspects.readFromNBT(par1NBTTagCompound.getCompoundTag(TAG_CURRENT_ASPECTS));
|
||||
totalAspects.readFromNBT(par1NBTTagCompound.getCompoundTag(TAG_TOTAL_ASPECTS));
|
||||
|
||||
enchantments.clear();
|
||||
for (int i : par1NBTTagCompound.getIntArray(TAG_ENCHANTS))
|
||||
enchantments.add(i);
|
||||
levels.clear();
|
||||
for (int i : par1NBTTagCompound.getIntArray(TAG_LEVELS))
|
||||
levels.add(i);
|
||||
|
||||
NBTTagList var2 = par1NBTTagCompound.getTagList("Items", Constants.NBT.TAG_COMPOUND);
|
||||
inventorySlots = new ItemStack[getSizeInventory()];
|
||||
for (int var3 = 0; var3 < var2.tagCount(); ++var3) {
|
||||
NBTTagCompound var4 = var2.getCompoundTagAt(var3);
|
||||
byte var5 = var4.getByte("Slot");
|
||||
if (var5 >= 0 && var5 < inventorySlots.length)
|
||||
inventorySlots[var5] = ItemStack.loadItemStackFromNBT(var4);
|
||||
}
|
||||
}
|
||||
|
||||
public void writeCustomNBT(NBTTagCompound par1NBTTagCompound) {
|
||||
par1NBTTagCompound.setIntArray(TAG_LEVELS, ArrayUtils.toPrimitive(levels.toArray(new Integer[levels.size()])));
|
||||
|
||||
par1NBTTagCompound.setIntArray(TAG_ENCHANTS, ArrayUtils.toPrimitive(enchantments.toArray(new Integer[enchantments.size()])));
|
||||
|
||||
NBTTagCompound totalAspectsCmp = new NBTTagCompound();
|
||||
totalAspects.writeToNBT(totalAspectsCmp);
|
||||
|
||||
NBTTagCompound currentAspectsCmp = new NBTTagCompound();
|
||||
currentAspects.writeToNBT(currentAspectsCmp);
|
||||
|
||||
par1NBTTagCompound.setBoolean(TAG_WORKING, working);
|
||||
par1NBTTagCompound.setTag(TAG_TOTAL_ASPECTS, totalAspectsCmp);
|
||||
par1NBTTagCompound.setTag(TAG_CURRENT_ASPECTS, currentAspectsCmp);
|
||||
NBTTagList var2 = new NBTTagList();
|
||||
for (int var3 = 0; var3 < inventorySlots.length; ++var3) {
|
||||
if (inventorySlots[var3] != null) {
|
||||
NBTTagCompound var4 = new NBTTagCompound();
|
||||
var4.setByte("Slot", (byte) var3);
|
||||
inventorySlots[var3].writeToNBT(var4);
|
||||
var2.appendTag(var4);
|
||||
}
|
||||
}
|
||||
par1NBTTagCompound.setTag("Items", var2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSizeInventory() {
|
||||
return inventorySlots.length;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlot(int i) {
|
||||
return inventorySlots[i];
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack decrStackSize(int i, int j) {
|
||||
if (inventorySlots[i] != null) {
|
||||
ItemStack stackAt;
|
||||
|
||||
if (inventorySlots[i].stackSize <= j) {
|
||||
stackAt = inventorySlots[i];
|
||||
inventorySlots[i] = null;
|
||||
return stackAt;
|
||||
} else {
|
||||
stackAt = inventorySlots[i].splitStack(j);
|
||||
|
||||
if (inventorySlots[i].stackSize == 0)
|
||||
inventorySlots[i] = null;
|
||||
|
||||
return stackAt;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlotOnClosing(int i) {
|
||||
return getStackInSlot(i);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInventorySlotContents(int i, ItemStack itemstack) {
|
||||
inventorySlots[i] = itemstack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return LibBlockNames.ENCHANTER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCustomInventoryName() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInventoryStackLimit() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUseableByPlayer(EntityPlayer entityplayer) {
|
||||
return worldObj.getTileEntity(xCoord, yCoord, zCoord) == this && entityplayer.getDistanceSq(xCoord + 0.5D, yCoord + 0.5D, zCoord + 0.5D) <= 64;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openInventory() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeInventory() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int i, ItemStack itemstack) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) {
|
||||
super.onDataPacket(net, pkt);
|
||||
readCustomNBT(pkt.func_148857_g());
|
||||
}
|
||||
|
||||
@Override
|
||||
public S35PacketUpdateTileEntity getDescriptionPacket() {
|
||||
NBTTagCompound nbttagcompound = new NBTTagCompound();
|
||||
writeCustomNBT(nbttagcompound);
|
||||
return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, -999, nbttagcompound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getAccessibleSlotsFromSide(int var1) {
|
||||
return new int[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInsertItem(int i, ItemStack itemstack, int j) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int i, ItemStack itemstack, int j) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean prepareToMove() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doneMoving() {
|
||||
|
||||
}
|
||||
private static final String TAG_ENCHANTS = "enchantsIntArray";
|
||||
private static final String TAG_LEVELS = "levelsIntArray";
|
||||
private static final String TAG_TOTAL_ASPECTS = "totalAspects";
|
||||
private static final String TAG_CURRENT_ASPECTS = "currentAspects";
|
||||
private static final String TAG_WORKING = "working";
|
||||
|
||||
public List<Integer> enchantments = new ArrayList();
|
||||
public List<Integer> levels = new ArrayList();
|
||||
|
||||
public AspectList totalAspects = new AspectList();
|
||||
public AspectList currentAspects = new AspectList();
|
||||
|
||||
public boolean working = false;
|
||||
ItemStack[] inventorySlots = new ItemStack[2];
|
||||
private List<Tuple4Int> pillars = new ArrayList();
|
||||
|
||||
public void clearEnchants() {
|
||||
enchantments.clear();
|
||||
levels.clear();
|
||||
}
|
||||
|
||||
public void appendEnchant(int enchant) {
|
||||
enchantments.add(enchant);
|
||||
}
|
||||
|
||||
public void appendLevel(int level) {
|
||||
levels.add(level);
|
||||
}
|
||||
|
||||
public void removeEnchant(int index) {
|
||||
enchantments.remove(index);
|
||||
}
|
||||
|
||||
public void removeLevel(int index) {
|
||||
levels.remove(index);
|
||||
}
|
||||
|
||||
public void setEnchant(int index, int enchant) {
|
||||
enchantments.set(index, enchant);
|
||||
}
|
||||
|
||||
public void setLevel(int index, int level) {
|
||||
levels.set(index, level);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
if (getStackInSlot(0) == null) {
|
||||
enchantments.clear();
|
||||
levels.clear();
|
||||
}
|
||||
|
||||
if (working) {
|
||||
ItemStack tool = getStackInSlot(0);
|
||||
if (tool == null) {
|
||||
working = false;
|
||||
return;
|
||||
}
|
||||
|
||||
checkPillars();
|
||||
|
||||
if (!working) // Pillar check
|
||||
return;
|
||||
|
||||
enchantItem:
|
||||
{
|
||||
for (Aspect aspect : LibFeatures.PRIMAL_ASPECTS) {
|
||||
int currentAmount = currentAspects.getAmount(aspect);
|
||||
int totalAmount = totalAspects.getAmount(aspect);
|
||||
|
||||
if (currentAmount < totalAmount)
|
||||
break enchantItem;
|
||||
}
|
||||
|
||||
working = false;
|
||||
currentAspects = new AspectList();
|
||||
totalAspects = new AspectList();
|
||||
|
||||
for (int i = 0; i < enchantments.size(); i++) {
|
||||
int enchant = enchantments.get(i);
|
||||
int level = levels.get(i);
|
||||
|
||||
if (!worldObj.isRemote)
|
||||
tool.addEnchantment(Enchantment.enchantmentsList[enchant], level);
|
||||
}
|
||||
|
||||
enchantments.clear();
|
||||
levels.clear();
|
||||
worldObj.playSoundEffect(xCoord, yCoord, zCoord, "thaumcraft:wand", 1F, 1F);
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
return;
|
||||
}
|
||||
|
||||
ItemStack wand = getStackInSlot(1);
|
||||
|
||||
if (wand != null && wand.getItem() instanceof ItemWandCasting && !((ItemWandCasting) wand.getItem()).isStaff(wand)) {
|
||||
ItemWandCasting wandItem = (ItemWandCasting) wand.getItem();
|
||||
AspectList wandAspects = wandItem.getAllVis(wand);
|
||||
|
||||
int missing, onWand;
|
||||
List<Aspect> aspectsThatCanGet = new ArrayList();
|
||||
|
||||
for (Aspect aspect : LibFeatures.PRIMAL_ASPECTS) {
|
||||
missing = totalAspects.getAmount(aspect) - currentAspects.getAmount(aspect);
|
||||
onWand = wandAspects.getAmount(aspect);
|
||||
|
||||
if (missing > 0 && onWand >= 100)
|
||||
aspectsThatCanGet.add(aspect);
|
||||
}
|
||||
|
||||
int i = aspectsThatCanGet.isEmpty() ? 0 : worldObj.rand.nextInt(aspectsThatCanGet.size());
|
||||
Aspect aspect = aspectsThatCanGet.isEmpty() ? null : aspectsThatCanGet.get(i);
|
||||
|
||||
if (aspect != null) {
|
||||
wandItem.consumeAllVisCrafting(wand, null, new AspectList().add(aspect, 1), true);
|
||||
currentAspects.add(aspect, 1);
|
||||
Tuple4Int p = pillars.get(i);
|
||||
if (worldObj.rand.nextBoolean()) {
|
||||
Thaumcraft.proxy.blockRunes(worldObj, p.i1, p.i4 - 0.75, p.i3, 0.3F + worldObj.rand.nextFloat() * 0.7F, 0.0F, 0.3F + worldObj.rand.nextFloat() * 0.7F, 15, worldObj.rand.nextFloat() / 8F);
|
||||
Thaumcraft.proxy.blockRunes(worldObj, xCoord, yCoord + 0.25, zCoord, 0.3F + worldObj.rand.nextFloat() * 0.7F, 0.0F, 0.3F + worldObj.rand.nextFloat() * 0.7F, 15, worldObj.rand.nextFloat() / 8F);
|
||||
if (worldObj.rand.nextInt(5) == 0)
|
||||
worldObj.playSoundEffect(p.i1, p.i2, p.i3, "thaumcraft:brain", 0.5F, 1F);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void markDirty() {
|
||||
super.markDirty();
|
||||
if (!worldObj.isRemote && !working) {
|
||||
enchantments.clear();
|
||||
levels.clear();
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean checkPillars() {
|
||||
if (pillars.isEmpty()) {
|
||||
if (assignPillars()) {
|
||||
working = false;
|
||||
currentAspects = new AspectList();
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
for (int i = 0; i < pillars.size(); i++) {
|
||||
Tuple4Int pillar = pillars.get(i);
|
||||
int pillarHeight = findPillar(pillar.i1, pillar.i2, pillar.i3);
|
||||
if (pillarHeight == -1) {
|
||||
pillars.clear();
|
||||
return checkPillars();
|
||||
} else if (pillarHeight != pillar.i4)
|
||||
pillar.i4 = pillarHeight;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean assignPillars() {
|
||||
int y = yCoord;
|
||||
for (int x = xCoord - 4; x <= xCoord + 4; x++)
|
||||
for (int z = zCoord - 4; z <= zCoord + 4; z++) {
|
||||
int height = findPillar(x, y, z);
|
||||
if (height != -1)
|
||||
pillars.add(new Tuple4Int(x, y, z, height));
|
||||
|
||||
if (pillars.size() == 6)
|
||||
return false;
|
||||
}
|
||||
|
||||
pillars.clear();
|
||||
return true;
|
||||
}
|
||||
|
||||
public int findPillar(int x, int y, int z) {
|
||||
int obsidianFound = 0;
|
||||
for (int i = 0; true; i++) {
|
||||
if (y + i >= 256)
|
||||
return -1;
|
||||
|
||||
Block id = worldObj.getBlock(x, y + i, z);
|
||||
int meta = worldObj.getBlockMetadata(x, y + i, z);
|
||||
if (id == ConfigBlocks.blockCosmeticSolid && meta == 0) {
|
||||
++obsidianFound;
|
||||
continue;
|
||||
}
|
||||
if (id == ConfigBlocks.blockAiry && meta == 1) {
|
||||
if (obsidianFound >= 2 && obsidianFound < 13)
|
||||
return y + i;
|
||||
return -1;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
public void updateAspectList() {
|
||||
totalAspects = new AspectList();
|
||||
for (int i = 0; i < enchantments.size(); i++) {
|
||||
int enchant = enchantments.get(i);
|
||||
int level = levels.get(i);
|
||||
|
||||
AspectList aspects = EnchantmentManager.enchantmentData.get(enchant).get(level).aspects;
|
||||
for (Aspect aspect : aspects.getAspectsSorted())
|
||||
totalAspects.add(aspect, aspects.getAmount(aspect));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound par1NBTTagCompound) {
|
||||
super.readFromNBT(par1NBTTagCompound);
|
||||
|
||||
readCustomNBT(par1NBTTagCompound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound par1NBTTagCompound) {
|
||||
super.writeToNBT(par1NBTTagCompound);
|
||||
|
||||
writeCustomNBT(par1NBTTagCompound);
|
||||
}
|
||||
|
||||
public void readCustomNBT(NBTTagCompound par1NBTTagCompound) {
|
||||
working = par1NBTTagCompound.getBoolean(TAG_WORKING);
|
||||
currentAspects.readFromNBT(par1NBTTagCompound.getCompoundTag(TAG_CURRENT_ASPECTS));
|
||||
totalAspects.readFromNBT(par1NBTTagCompound.getCompoundTag(TAG_TOTAL_ASPECTS));
|
||||
|
||||
enchantments.clear();
|
||||
for (int i : par1NBTTagCompound.getIntArray(TAG_ENCHANTS))
|
||||
enchantments.add(i);
|
||||
levels.clear();
|
||||
for (int i : par1NBTTagCompound.getIntArray(TAG_LEVELS))
|
||||
levels.add(i);
|
||||
|
||||
NBTTagList var2 = par1NBTTagCompound.getTagList("Items", Constants.NBT.TAG_COMPOUND);
|
||||
inventorySlots = new ItemStack[getSizeInventory()];
|
||||
for (int var3 = 0; var3 < var2.tagCount(); ++var3) {
|
||||
NBTTagCompound var4 = var2.getCompoundTagAt(var3);
|
||||
byte var5 = var4.getByte("Slot");
|
||||
if (var5 >= 0 && var5 < inventorySlots.length)
|
||||
inventorySlots[var5] = ItemStack.loadItemStackFromNBT(var4);
|
||||
}
|
||||
}
|
||||
|
||||
public void writeCustomNBT(NBTTagCompound par1NBTTagCompound) {
|
||||
par1NBTTagCompound.setIntArray(TAG_LEVELS, ArrayUtils.toPrimitive(levels.toArray(new Integer[levels.size()])));
|
||||
|
||||
par1NBTTagCompound.setIntArray(TAG_ENCHANTS, ArrayUtils.toPrimitive(enchantments.toArray(new Integer[enchantments.size()])));
|
||||
|
||||
NBTTagCompound totalAspectsCmp = new NBTTagCompound();
|
||||
totalAspects.writeToNBT(totalAspectsCmp);
|
||||
|
||||
NBTTagCompound currentAspectsCmp = new NBTTagCompound();
|
||||
currentAspects.writeToNBT(currentAspectsCmp);
|
||||
|
||||
par1NBTTagCompound.setBoolean(TAG_WORKING, working);
|
||||
par1NBTTagCompound.setTag(TAG_TOTAL_ASPECTS, totalAspectsCmp);
|
||||
par1NBTTagCompound.setTag(TAG_CURRENT_ASPECTS, currentAspectsCmp);
|
||||
NBTTagList var2 = new NBTTagList();
|
||||
for (int var3 = 0; var3 < inventorySlots.length; ++var3) {
|
||||
if (inventorySlots[var3] != null) {
|
||||
NBTTagCompound var4 = new NBTTagCompound();
|
||||
var4.setByte("Slot", (byte) var3);
|
||||
inventorySlots[var3].writeToNBT(var4);
|
||||
var2.appendTag(var4);
|
||||
}
|
||||
}
|
||||
par1NBTTagCompound.setTag("Items", var2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSizeInventory() {
|
||||
return inventorySlots.length;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlot(int i) {
|
||||
return inventorySlots[i];
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack decrStackSize(int i, int j) {
|
||||
if (inventorySlots[i] != null) {
|
||||
ItemStack stackAt;
|
||||
|
||||
if (inventorySlots[i].stackSize <= j) {
|
||||
stackAt = inventorySlots[i];
|
||||
inventorySlots[i] = null;
|
||||
return stackAt;
|
||||
} else {
|
||||
stackAt = inventorySlots[i].splitStack(j);
|
||||
|
||||
if (inventorySlots[i].stackSize == 0)
|
||||
inventorySlots[i] = null;
|
||||
|
||||
return stackAt;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlotOnClosing(int i) {
|
||||
return getStackInSlot(i);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInventorySlotContents(int i, ItemStack itemstack) {
|
||||
inventorySlots[i] = itemstack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return LibBlockNames.ENCHANTER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCustomInventoryName() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInventoryStackLimit() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUseableByPlayer(EntityPlayer entityplayer) {
|
||||
return worldObj.getTileEntity(xCoord, yCoord, zCoord) == this && entityplayer.getDistanceSq(xCoord + 0.5D, yCoord + 0.5D, zCoord + 0.5D) <= 64;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openInventory() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeInventory() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int i, ItemStack itemstack) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) {
|
||||
super.onDataPacket(net, pkt);
|
||||
readCustomNBT(pkt.func_148857_g());
|
||||
}
|
||||
|
||||
@Override
|
||||
public S35PacketUpdateTileEntity getDescriptionPacket() {
|
||||
NBTTagCompound nbttagcompound = new NBTTagCompound();
|
||||
writeCustomNBT(nbttagcompound);
|
||||
return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, -999, nbttagcompound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getAccessibleSlotsFromSide(int var1) {
|
||||
return new int[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInsertItem(int i, ItemStack itemstack, int j) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int i, ItemStack itemstack, int j) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean prepareToMove() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doneMoving() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -13,171 +13,171 @@ import thaumic.tinkerer.common.block.mobilizer.BlockMobilizer;
|
||||
|
||||
public class TileEntityMobilizer extends TileEntity {
|
||||
|
||||
public boolean linked;
|
||||
public boolean linked;
|
||||
|
||||
public int firstRelayX;
|
||||
public int secondRelayX;
|
||||
public int firstRelayX;
|
||||
public int secondRelayX;
|
||||
|
||||
public int firstRelayZ;
|
||||
public int secondRelayZ;
|
||||
public boolean dead = false;
|
||||
public int firstRelayZ;
|
||||
public int secondRelayZ;
|
||||
public boolean dead = false;
|
||||
|
||||
public ForgeDirection movementDirection;
|
||||
public ForgeDirection movementDirection;
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbt) {
|
||||
super.writeToNBT(nbt);
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbt) {
|
||||
super.writeToNBT(nbt);
|
||||
|
||||
nbt.setBoolean("Linked", linked);
|
||||
nbt.setBoolean("Linked", linked);
|
||||
|
||||
nbt.setInteger("FirstRelayX", firstRelayX);
|
||||
nbt.setInteger("FirstRelayZ", firstRelayZ);
|
||||
nbt.setInteger("FirstRelayX", firstRelayX);
|
||||
nbt.setInteger("FirstRelayZ", firstRelayZ);
|
||||
|
||||
nbt.setInteger("SecondRelayX", secondRelayX);
|
||||
nbt.setInteger("SecondRelayZ", secondRelayZ);
|
||||
nbt.setInteger("SecondRelayX", secondRelayX);
|
||||
nbt.setInteger("SecondRelayZ", secondRelayZ);
|
||||
|
||||
nbt.setInteger("Direction", movementDirection != null ? movementDirection.ordinal() : 0);
|
||||
}
|
||||
nbt.setInteger("Direction", movementDirection != null ? movementDirection.ordinal() : 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbt) {
|
||||
super.readFromNBT(nbt);
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbt) {
|
||||
super.readFromNBT(nbt);
|
||||
|
||||
this.linked = nbt.getBoolean("Linked");
|
||||
this.linked = nbt.getBoolean("Linked");
|
||||
|
||||
this.firstRelayX = nbt.getInteger("FirstRelayX");
|
||||
this.firstRelayZ = nbt.getInteger("FirstRelayZ");
|
||||
this.firstRelayX = nbt.getInteger("FirstRelayX");
|
||||
this.firstRelayZ = nbt.getInteger("FirstRelayZ");
|
||||
|
||||
this.secondRelayX = nbt.getInteger("SecondRelayX");
|
||||
this.secondRelayZ = nbt.getInteger("SecondRelayZ");
|
||||
this.secondRelayX = nbt.getInteger("SecondRelayX");
|
||||
this.secondRelayZ = nbt.getInteger("SecondRelayZ");
|
||||
|
||||
movementDirection = ForgeDirection.VALID_DIRECTIONS[nbt.getInteger("Direction")];
|
||||
}
|
||||
movementDirection = ForgeDirection.VALID_DIRECTIONS[nbt.getInteger("Direction")];
|
||||
}
|
||||
|
||||
public void verifyRelay() {
|
||||
TileEntity te = worldObj.getTileEntity(firstRelayX, yCoord, firstRelayZ);
|
||||
if (te instanceof TileEntityRelay) {
|
||||
((TileEntityRelay) te).verifyPartner();
|
||||
}
|
||||
if (!(linked && te instanceof TileEntityRelay && ((TileEntityRelay) te).partnerX == this.secondRelayX && ((TileEntityRelay) te).partnerZ == this.secondRelayZ)) {
|
||||
linked = false;
|
||||
}
|
||||
}
|
||||
public void verifyRelay() {
|
||||
TileEntity te = worldObj.getTileEntity(firstRelayX, yCoord, firstRelayZ);
|
||||
if (te instanceof TileEntityRelay) {
|
||||
((TileEntityRelay) te).verifyPartner();
|
||||
}
|
||||
if (!(linked && te instanceof TileEntityRelay && ((TileEntityRelay) te).partnerX == this.secondRelayX && ((TileEntityRelay) te).partnerZ == this.secondRelayZ)) {
|
||||
linked = false;
|
||||
}
|
||||
}
|
||||
|
||||
public void updateEntity() {
|
||||
public void updateEntity() {
|
||||
|
||||
//Check for ghost TEs
|
||||
if (dead)
|
||||
return;
|
||||
//Make sure the relays haven't been broken
|
||||
verifyRelay();
|
||||
//Bounce
|
||||
if (linked && worldObj.getTotalWorldTime() % 100 == 0 && !worldObj.isBlockIndirectlyGettingPowered(xCoord, yCoord, zCoord)) {
|
||||
//Target coordinates to check
|
||||
int targetX = xCoord + movementDirection.offsetX;
|
||||
int targetZ = zCoord + movementDirection.offsetZ;
|
||||
//Switch direction if at end of track
|
||||
if (worldObj.getBlock(targetX, yCoord, targetZ) != Block.getBlockFromName("air") || worldObj.getBlock(targetX, yCoord + 1, targetZ) != Block.getBlockFromName("air")) {
|
||||
movementDirection = movementDirection.getOpposite();
|
||||
}
|
||||
}
|
||||
//Move
|
||||
if (linked && worldObj.getTotalWorldTime() % 100 == 1 && !worldObj.isBlockIndirectlyGettingPowered(xCoord, yCoord, zCoord)) {
|
||||
//Cache coordinated
|
||||
int targetX = xCoord + movementDirection.offsetX;
|
||||
int targetZ = zCoord + movementDirection.offsetZ;
|
||||
//Check for abandoned TEs
|
||||
if (worldObj.getBlock(xCoord, yCoord, zCoord) != ThaumicTinkerer.registry.getFirstBlockFromClass(BlockMobilizer.class)) {
|
||||
return;
|
||||
}
|
||||
//Check if the space the mobilizer will move into is empty
|
||||
if ((worldObj.isAirBlock(targetX, yCoord, targetZ) || worldObj.getBlock(targetX, yCoord, targetZ).isAir(worldObj, targetX, yCoord, targetZ)
|
||||
&& (worldObj.isAirBlock(xCoord, yCoord + 1, zCoord) || worldObj.isAirBlock(targetX, yCoord + 1, targetZ) || worldObj.getBlock(targetX, yCoord + 1, targetZ).isAir(worldObj, targetX, yCoord + 1, targetZ)))) {
|
||||
//Check for ghost TEs
|
||||
if (dead)
|
||||
return;
|
||||
//Make sure the relays haven't been broken
|
||||
verifyRelay();
|
||||
//Bounce
|
||||
if (linked && worldObj.getTotalWorldTime() % 100 == 0 && !worldObj.isBlockIndirectlyGettingPowered(xCoord, yCoord, zCoord)) {
|
||||
//Target coordinates to check
|
||||
int targetX = xCoord + movementDirection.offsetX;
|
||||
int targetZ = zCoord + movementDirection.offsetZ;
|
||||
//Switch direction if at end of track
|
||||
if (worldObj.getBlock(targetX, yCoord, targetZ) != Block.getBlockFromName("air") || worldObj.getBlock(targetX, yCoord + 1, targetZ) != Block.getBlockFromName("air")) {
|
||||
movementDirection = movementDirection.getOpposite();
|
||||
}
|
||||
}
|
||||
//Move
|
||||
if (linked && worldObj.getTotalWorldTime() % 100 == 1 && !worldObj.isBlockIndirectlyGettingPowered(xCoord, yCoord, zCoord)) {
|
||||
//Cache coordinated
|
||||
int targetX = xCoord + movementDirection.offsetX;
|
||||
int targetZ = zCoord + movementDirection.offsetZ;
|
||||
//Check for abandoned TEs
|
||||
if (worldObj.getBlock(xCoord, yCoord, zCoord) != ThaumicTinkerer.registry.getFirstBlockFromClass(BlockMobilizer.class)) {
|
||||
return;
|
||||
}
|
||||
//Check if the space the mobilizer will move into is empty
|
||||
if ((worldObj.isAirBlock(targetX, yCoord, targetZ) || worldObj.getBlock(targetX, yCoord, targetZ).isAir(worldObj, targetX, yCoord, targetZ)
|
||||
&& (worldObj.isAirBlock(xCoord, yCoord + 1, zCoord) || worldObj.isAirBlock(targetX, yCoord + 1, targetZ) || worldObj.getBlock(targetX, yCoord + 1, targetZ).isAir(worldObj, targetX, yCoord + 1, targetZ)))) {
|
||||
|
||||
//Move Entities
|
||||
//List<Entity> entities = worldObj.getEntitiesWithinAABB(Entity.class, AxisAlignedBB.getBoundingBox(xCoord, yCoord, zCoord, xCoord+1, yCoord+3, zCoord+1));
|
||||
//System.out.print(entities);
|
||||
//for(Entity e: entities){
|
||||
// e.setPosition(e.posX+movementDirection.offsetX, e.posY, e.posZ+movementDirection.offsetZ);
|
||||
//}
|
||||
//Move Entities
|
||||
//List<Entity> entities = worldObj.getEntitiesWithinAABB(Entity.class, AxisAlignedBB.getBoundingBox(xCoord, yCoord, zCoord, xCoord+1, yCoord+3, zCoord+1));
|
||||
//System.out.print(entities);
|
||||
//for(Entity e: entities){
|
||||
// e.setPosition(e.posX+movementDirection.offsetX, e.posY, e.posZ+movementDirection.offsetZ);
|
||||
//}
|
||||
|
||||
//Move the block on top of the mobilizer
|
||||
if (!worldObj.isRemote) {
|
||||
//Move the block on top of the mobilizer
|
||||
if (!worldObj.isRemote) {
|
||||
|
||||
TileEntity passenger = worldObj.getTileEntity(xCoord, yCoord + 1, zCoord);
|
||||
IAppEngApi api = AEApi.instance();
|
||||
TileEntity passenger = worldObj.getTileEntity(xCoord, yCoord + 1, zCoord);
|
||||
IAppEngApi api = AEApi.instance();
|
||||
|
||||
//Prevent the passenger from popping off. Not sent to clients.
|
||||
worldObj.setBlock(targetX, yCoord, targetZ, Block.getBlockFromName("stone"), 0, 0);
|
||||
//Move non-TE blocks
|
||||
Block passengerId = worldObj.getBlock(xCoord, yCoord + 1, zCoord);
|
||||
//Prevent the passenger from popping off. Not sent to clients.
|
||||
worldObj.setBlock(targetX, yCoord, targetZ, Block.getBlockFromName("stone"), 0, 0);
|
||||
//Move non-TE blocks
|
||||
Block passengerId = worldObj.getBlock(xCoord, yCoord + 1, zCoord);
|
||||
|
||||
if (worldObj.isAirBlock(xCoord, yCoord + 1, zCoord) || passengerId.canPlaceBlockAt(worldObj, targetX, yCoord + 1, targetZ)) {
|
||||
if (worldObj.isAirBlock(xCoord, yCoord + 1, zCoord) || passengerId.canPlaceBlockAt(worldObj, targetX, yCoord + 1, targetZ)) {
|
||||
|
||||
if (passenger == null) {
|
||||
if (passengerId != Block.getBlockFromName("bedrock") && passengerId != Block.getBlockFromName("")) {
|
||||
worldObj.setBlock(targetX, yCoord + 1, targetZ, passengerId, worldObj.getBlockMetadata(xCoord, yCoord + 1, zCoord), 3);
|
||||
if (passengerId != Block.getBlockFromName("air") && passengerId != Block.getBlockFromName("piston_head")) {
|
||||
worldObj.setBlock(xCoord, yCoord + 1, zCoord, Block.getBlockFromName("air"), 0, 2);
|
||||
}
|
||||
}
|
||||
//If AE is installed, use its handler
|
||||
} else if (api != null) {
|
||||
if (api.registries().movable().askToMove(passenger)) {
|
||||
worldObj.setBlock(targetX, yCoord + 1, targetZ, worldObj.getBlock(xCoord, yCoord + 1, zCoord), worldObj.getBlockMetadata(xCoord, yCoord + 1, zCoord), 3);
|
||||
passenger.invalidate();
|
||||
worldObj.setBlockToAir(xCoord, yCoord + 1, zCoord);
|
||||
api.registries().movable().getHandler(passenger).moveTile(passenger, worldObj, targetX, yCoord + 1, targetZ);
|
||||
api.registries().movable().doneMoving(passenger);
|
||||
passenger.validate();
|
||||
}
|
||||
if (passenger == null) {
|
||||
if (passengerId != Block.getBlockFromName("bedrock") && passengerId != Block.getBlockFromName("")) {
|
||||
worldObj.setBlock(targetX, yCoord + 1, targetZ, passengerId, worldObj.getBlockMetadata(xCoord, yCoord + 1, zCoord), 3);
|
||||
if (passengerId != Block.getBlockFromName("air") && passengerId != Block.getBlockFromName("piston_head")) {
|
||||
worldObj.setBlock(xCoord, yCoord + 1, zCoord, Block.getBlockFromName("air"), 0, 2);
|
||||
}
|
||||
}
|
||||
//If AE is installed, use its handler
|
||||
} else if (api != null) {
|
||||
if (api.registries().movable().askToMove(passenger)) {
|
||||
worldObj.setBlock(targetX, yCoord + 1, targetZ, worldObj.getBlock(xCoord, yCoord + 1, zCoord), worldObj.getBlockMetadata(xCoord, yCoord + 1, zCoord), 3);
|
||||
passenger.invalidate();
|
||||
worldObj.setBlockToAir(xCoord, yCoord + 1, zCoord);
|
||||
api.registries().movable().getHandler(passenger).moveTile(passenger, worldObj, targetX, yCoord + 1, targetZ);
|
||||
api.registries().movable().doneMoving(passenger);
|
||||
passenger.validate();
|
||||
}
|
||||
|
||||
//Handler IMovableTiles and vanilla TEs without AE
|
||||
} else if (passenger instanceof IMovableTile || passenger.getClass().getName().startsWith("net.minecraft.tileentity")) {
|
||||
boolean imovable = passenger instanceof IMovableTile;
|
||||
if (imovable)
|
||||
((IMovableTile) passenger).prepareToMove();
|
||||
worldObj.setBlock(targetX, yCoord + 1, targetZ, worldObj.getBlock(xCoord, yCoord + 1, zCoord), worldObj.getBlockMetadata(xCoord, yCoord + 1, zCoord), 3);
|
||||
passenger.invalidate();
|
||||
worldObj.setBlockToAir(xCoord, yCoord + 1, zCoord);
|
||||
//Handler IMovableTiles and vanilla TEs without AE
|
||||
} else if (passenger instanceof IMovableTile || passenger.getClass().getName().startsWith("net.minecraft.tileentity")) {
|
||||
boolean imovable = passenger instanceof IMovableTile;
|
||||
if (imovable)
|
||||
((IMovableTile) passenger).prepareToMove();
|
||||
worldObj.setBlock(targetX, yCoord + 1, targetZ, worldObj.getBlock(xCoord, yCoord + 1, zCoord), worldObj.getBlockMetadata(xCoord, yCoord + 1, zCoord), 3);
|
||||
passenger.invalidate();
|
||||
worldObj.setBlockToAir(xCoord, yCoord + 1, zCoord);
|
||||
|
||||
//IMovableHandler default code
|
||||
Chunk c = worldObj.getChunkFromBlockCoords(targetX, targetZ);
|
||||
//IMovableHandler default code
|
||||
Chunk c = worldObj.getChunkFromBlockCoords(targetX, targetZ);
|
||||
|
||||
c.func_150812_a(targetX & 0xF, yCoord + 1, targetZ & 0xF, passenger);
|
||||
c.func_150812_a(targetX & 0xF, yCoord + 1, targetZ & 0xF, passenger);
|
||||
|
||||
if (c.isChunkLoaded) {
|
||||
worldObj.addTileEntity(passenger);
|
||||
worldObj.markBlockForUpdate(targetX, yCoord + 1, targetZ);
|
||||
}
|
||||
if (imovable)
|
||||
((IMovableTile) passenger).doneMoving();
|
||||
passenger.validate();
|
||||
if (c.isChunkLoaded) {
|
||||
worldObj.addTileEntity(passenger);
|
||||
worldObj.markBlockForUpdate(targetX, yCoord + 1, targetZ);
|
||||
}
|
||||
if (imovable)
|
||||
((IMovableTile) passenger).doneMoving();
|
||||
passenger.validate();
|
||||
|
||||
}
|
||||
}
|
||||
//Move self
|
||||
this.invalidate();
|
||||
worldObj.removeTileEntity(xCoord, yCoord, zCoord);
|
||||
worldObj.setBlock(xCoord, yCoord, zCoord, Block.getBlockFromName("air"), 0, 2);
|
||||
worldObj.setBlock(targetX, yCoord, targetZ, ThaumicTinkerer.registry.getFirstBlockFromClass(BlockMobilizer.class));
|
||||
}
|
||||
}
|
||||
//Move self
|
||||
this.invalidate();
|
||||
worldObj.removeTileEntity(xCoord, yCoord, zCoord);
|
||||
worldObj.setBlock(xCoord, yCoord, zCoord, Block.getBlockFromName("air"), 0, 2);
|
||||
worldObj.setBlock(targetX, yCoord, targetZ, ThaumicTinkerer.registry.getFirstBlockFromClass(BlockMobilizer.class));
|
||||
|
||||
int oldX = xCoord;
|
||||
int oldZ = zCoord;
|
||||
int oldX = xCoord;
|
||||
int oldZ = zCoord;
|
||||
|
||||
this.xCoord = targetX;
|
||||
this.zCoord = targetZ;
|
||||
this.validate();
|
||||
worldObj.addTileEntity(this);
|
||||
worldObj.removeTileEntity(oldX, yCoord, oldZ);
|
||||
this.xCoord = targetX;
|
||||
this.zCoord = targetZ;
|
||||
this.validate();
|
||||
worldObj.addTileEntity(this);
|
||||
worldObj.removeTileEntity(oldX, yCoord, oldZ);
|
||||
|
||||
worldObj.notifyBlockChange(oldX, yCoord, oldZ, Block.getBlockFromName("air"));
|
||||
worldObj.notifyBlockChange(oldX, yCoord, oldZ, Block.getBlockFromName("air"));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -8,139 +8,138 @@ import thaumic.tinkerer.common.ThaumicTinkerer;
|
||||
|
||||
public class TileEntityRelay extends TileEntity implements IMovableTile {
|
||||
|
||||
public TileEntityRelay() {
|
||||
}
|
||||
public boolean hasPartner;
|
||||
public int partnerX;
|
||||
public int partnerZ;
|
||||
|
||||
public void verifyPartner() {
|
||||
TileEntity te = worldObj.getTileEntity(partnerX, yCoord, partnerZ);
|
||||
if (!(hasPartner && te instanceof TileEntityRelay && ((TileEntityRelay) te).partnerX == this.xCoord && ((TileEntityRelay) te).partnerZ == this.zCoord)) {
|
||||
hasPartner = false;
|
||||
}
|
||||
}
|
||||
public TileEntityRelay() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbt) {
|
||||
super.writeToNBT(nbt);
|
||||
public void verifyPartner() {
|
||||
TileEntity te = worldObj.getTileEntity(partnerX, yCoord, partnerZ);
|
||||
if (!(hasPartner && te instanceof TileEntityRelay && ((TileEntityRelay) te).partnerX == this.xCoord && ((TileEntityRelay) te).partnerZ == this.zCoord)) {
|
||||
hasPartner = false;
|
||||
}
|
||||
}
|
||||
|
||||
nbt.setBoolean("HasPartner", hasPartner);
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbt) {
|
||||
super.writeToNBT(nbt);
|
||||
|
||||
nbt.setInteger("PartnerX", partnerX);
|
||||
nbt.setInteger("PartnerZ", partnerZ);
|
||||
nbt.setBoolean("HasPartner", hasPartner);
|
||||
|
||||
}
|
||||
nbt.setInteger("PartnerX", partnerX);
|
||||
nbt.setInteger("PartnerZ", partnerZ);
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbt) {
|
||||
super.readFromNBT(nbt);
|
||||
}
|
||||
|
||||
hasPartner = nbt.getBoolean("HasPartner");
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbt) {
|
||||
super.readFromNBT(nbt);
|
||||
|
||||
partnerX = nbt.getInteger("PartnerX");
|
||||
partnerZ = nbt.getInteger("PartnerZ");
|
||||
}
|
||||
hasPartner = nbt.getBoolean("HasPartner");
|
||||
|
||||
public boolean hasPartner;
|
||||
partnerX = nbt.getInteger("PartnerX");
|
||||
partnerZ = nbt.getInteger("PartnerZ");
|
||||
}
|
||||
|
||||
public int partnerX;
|
||||
public int partnerZ;
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
verifyPartner();
|
||||
if (hasPartner) {
|
||||
int i = xCoord;
|
||||
int j;
|
||||
do {
|
||||
j = zCoord;
|
||||
do {
|
||||
float xInc = 0;
|
||||
float zInc = 0;
|
||||
if (partnerZ - zCoord != 0) {
|
||||
zInc = ((float) Math.copySign(.05, partnerZ - zCoord)) * (worldObj.getTotalWorldTime() % 20);
|
||||
}
|
||||
|
||||
verifyPartner();
|
||||
if (hasPartner) {
|
||||
int i = xCoord;
|
||||
int j;
|
||||
do {
|
||||
j = zCoord;
|
||||
do {
|
||||
float xInc = 0;
|
||||
float zInc = 0;
|
||||
if (partnerZ - zCoord != 0) {
|
||||
zInc = ((float) Math.copySign(.05, partnerZ - zCoord)) * (worldObj.getTotalWorldTime() % 20);
|
||||
}
|
||||
if (partnerX - xCoord != 0) {
|
||||
xInc = ((float) Math.copySign(.05, partnerX - xCoord)) * (worldObj.getTotalWorldTime() % 20);
|
||||
}
|
||||
ThaumicTinkerer.tcProxy.sparkle((float) (0.5 + i + xInc), (float) (yCoord + 0.5), (float) (j + 0.5 + zInc), xCoord < partnerX || zCoord > partnerX ? 2 : 14);
|
||||
j += Math.copySign(1, partnerZ - zCoord);
|
||||
} while (j < partnerZ);
|
||||
i += Math.copySign(1, partnerX - xCoord);
|
||||
|
||||
if (partnerX - xCoord != 0) {
|
||||
xInc = ((float) Math.copySign(.05, partnerX - xCoord)) * (worldObj.getTotalWorldTime() % 20);
|
||||
}
|
||||
ThaumicTinkerer.tcProxy.sparkle((float) (0.5 + i + xInc), (float) (yCoord + 0.5), (float) (j + 0.5 + zInc), xCoord < partnerX || zCoord > partnerX ? 2 : 14);
|
||||
j += Math.copySign(1, partnerZ - zCoord);
|
||||
} while (j < partnerZ);
|
||||
i += Math.copySign(1, partnerX - xCoord);
|
||||
} while (i < partnerX);
|
||||
}
|
||||
if (worldObj.getTotalWorldTime() % 40 == 0) {
|
||||
checkForPartner();
|
||||
}
|
||||
int i = xCoord;
|
||||
if (hasPartner && worldObj.getTotalWorldTime() % 40 == 0) {
|
||||
do {
|
||||
|
||||
} while (i < partnerX);
|
||||
}
|
||||
if (worldObj.getTotalWorldTime() % 40 == 0) {
|
||||
checkForPartner();
|
||||
}
|
||||
int i = xCoord;
|
||||
if (hasPartner && worldObj.getTotalWorldTime() % 40 == 0) {
|
||||
do {
|
||||
int j = zCoord;
|
||||
do {
|
||||
if (worldObj.getTileEntity(i, yCoord, j) instanceof TileEntityMobilizer) {
|
||||
TileEntityMobilizer te = (TileEntityMobilizer) worldObj.getTileEntity(i, yCoord, j);
|
||||
te.verifyRelay();
|
||||
if (!te.linked) {
|
||||
te.firstRelayX = xCoord;
|
||||
te.firstRelayZ = zCoord;
|
||||
|
||||
int j = zCoord;
|
||||
do {
|
||||
if (worldObj.getTileEntity(i, yCoord, j) instanceof TileEntityMobilizer) {
|
||||
TileEntityMobilizer te = (TileEntityMobilizer) worldObj.getTileEntity(i, yCoord, j);
|
||||
te.verifyRelay();
|
||||
if (!te.linked) {
|
||||
te.firstRelayX = xCoord;
|
||||
te.firstRelayZ = zCoord;
|
||||
te.secondRelayX = partnerX;
|
||||
te.secondRelayZ = partnerZ;
|
||||
|
||||
te.secondRelayX = partnerX;
|
||||
te.secondRelayZ = partnerZ;
|
||||
te.linked = true;
|
||||
|
||||
te.linked = true;
|
||||
if (xCoord != partnerX) {
|
||||
te.movementDirection = ForgeDirection.EAST;
|
||||
} else {
|
||||
te.movementDirection = ForgeDirection.NORTH;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (xCoord != partnerX) {
|
||||
te.movementDirection = ForgeDirection.EAST;
|
||||
} else {
|
||||
te.movementDirection = ForgeDirection.NORTH;
|
||||
}
|
||||
}
|
||||
}
|
||||
j += Math.copySign(1, partnerZ - zCoord);
|
||||
} while (j < partnerZ);
|
||||
i += Math.copySign(1, partnerX - xCoord);
|
||||
} while (i < partnerX);
|
||||
}
|
||||
}
|
||||
|
||||
j += Math.copySign(1, partnerZ - zCoord);
|
||||
} while (j < partnerZ);
|
||||
i += Math.copySign(1, partnerX - xCoord);
|
||||
} while (i < partnerX);
|
||||
}
|
||||
}
|
||||
public void checkForPartner() {
|
||||
if (!hasPartner) {
|
||||
for (int i = -32; i < 32; i++) {
|
||||
if (i != 0) {
|
||||
TileEntity te = worldObj.getTileEntity(xCoord, yCoord, zCoord + i);
|
||||
setPartners(te);
|
||||
|
||||
public void checkForPartner() {
|
||||
if (!hasPartner) {
|
||||
for (int i = -32; i < 32; i++) {
|
||||
if (i != 0) {
|
||||
TileEntity te = worldObj.getTileEntity(xCoord, yCoord, zCoord + i);
|
||||
setPartners(te);
|
||||
te = worldObj.getTileEntity(xCoord + i, yCoord, zCoord);
|
||||
setPartners(te);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
te = worldObj.getTileEntity(xCoord + i, yCoord, zCoord);
|
||||
setPartners(te);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
private void setPartners(TileEntity te) {
|
||||
if (te instanceof TileEntityRelay) {
|
||||
((TileEntityRelay) te).partnerX = this.xCoord;
|
||||
((TileEntityRelay) te).partnerZ = this.zCoord;
|
||||
this.partnerX = te.xCoord;
|
||||
this.partnerZ = te.zCoord;
|
||||
|
||||
private void setPartners(TileEntity te) {
|
||||
if (te instanceof TileEntityRelay) {
|
||||
((TileEntityRelay) te).partnerX = this.xCoord;
|
||||
((TileEntityRelay) te).partnerZ = this.zCoord;
|
||||
this.partnerX = te.xCoord;
|
||||
this.partnerZ = te.zCoord;
|
||||
this.hasPartner = true;
|
||||
((TileEntityRelay) te).hasPartner = true;
|
||||
|
||||
this.hasPartner = true;
|
||||
((TileEntityRelay) te).hasPartner = true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public boolean prepareToMove() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean prepareToMove() {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public void doneMoving() {
|
||||
|
||||
@Override
|
||||
public void doneMoving() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -8,15 +8,15 @@ import thaumic.tinkerer.common.ThaumicTinkerer;
|
||||
*/
|
||||
public class TileForcefield extends TileEntity {
|
||||
|
||||
public int ticks = 60;
|
||||
public int ticks = 60;
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
if (ticks < 0) {
|
||||
worldObj.setBlockToAir(xCoord, yCoord, zCoord);
|
||||
}
|
||||
ticks--;
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
if (ticks < 0) {
|
||||
worldObj.setBlockToAir(xCoord, yCoord, zCoord);
|
||||
}
|
||||
ticks--;
|
||||
|
||||
ThaumicTinkerer.tcProxy.blockSparkle(worldObj, xCoord, yCoord, zCoord, 255, 1);
|
||||
}
|
||||
ThaumicTinkerer.tcProxy.blockSparkle(worldObj, xCoord, yCoord, zCoord, 255, 1);
|
||||
}
|
||||
}
|
||||
@@ -39,258 +39,258 @@ import thaumic.tinkerer.common.lib.LibBlockNames;
|
||||
|
||||
public class TileFunnel extends TileEntity implements ISidedInventory, IAspectContainer, IMovableTile {
|
||||
|
||||
ItemStack[] inventorySlots = new ItemStack[1];
|
||||
ItemStack[] inventorySlots = new ItemStack[1];
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
ItemStack jar = getStackInSlot(0);
|
||||
if (jar != null && jar.getItem() instanceof ItemJarFilled) {
|
||||
if (!worldObj.isRemote) {
|
||||
ItemJarFilled item = (ItemJarFilled) jar.getItem();
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
ItemStack jar = getStackInSlot(0);
|
||||
if (jar != null && jar.getItem() instanceof ItemJarFilled) {
|
||||
if (!worldObj.isRemote) {
|
||||
ItemJarFilled item = (ItemJarFilled) jar.getItem();
|
||||
|
||||
AspectList aspectList = item.getAspects(jar);
|
||||
if (aspectList != null && aspectList.size() == 1) {
|
||||
Aspect aspect = aspectList.getAspects()[0];
|
||||
AspectList aspectList = item.getAspects(jar);
|
||||
if (aspectList != null && aspectList.size() == 1) {
|
||||
Aspect aspect = aspectList.getAspects()[0];
|
||||
|
||||
TileEntity tile = worldObj.getTileEntity(xCoord, yCoord - 1, zCoord);
|
||||
if (tile != null && tile instanceof TileEntityHopper) {
|
||||
TileEntity tile1 = getHopperFacing(tile.xCoord, tile.yCoord, tile.zCoord, tile.getBlockMetadata());
|
||||
if (tile1 instanceof TileJarFillable) {
|
||||
TileJarFillable jar1 = (TileJarFillable) tile1;
|
||||
boolean voidJar = tile1 instanceof TileJarFillableVoid;
|
||||
AspectList aspectList1 = jar1.getAspects();
|
||||
//noinspection ConstantConditions
|
||||
if (aspectList1 != null && aspectList1.size() == 0 && (jar1.aspectFilter == null || jar1.aspectFilter == aspect) || aspectList1.getAspects()[0] == aspect && (aspectList1.getAmount(aspectList1.getAspects()[0]) < 64 || voidJar)) {
|
||||
jar1.addToContainer(aspect, 1);
|
||||
item.setAspects(jar, aspectList.remove(aspect, 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
TileEntity tile = worldObj.getTileEntity(xCoord, yCoord - 1, zCoord);
|
||||
if (tile != null && tile instanceof TileEntityHopper) {
|
||||
TileEntity tile1 = getHopperFacing(tile.xCoord, tile.yCoord, tile.zCoord, tile.getBlockMetadata());
|
||||
if (tile1 instanceof TileJarFillable) {
|
||||
TileJarFillable jar1 = (TileJarFillable) tile1;
|
||||
boolean voidJar = tile1 instanceof TileJarFillableVoid;
|
||||
AspectList aspectList1 = jar1.getAspects();
|
||||
//noinspection ConstantConditions
|
||||
if (aspectList1 != null && aspectList1.size() == 0 && (jar1.aspectFilter == null || jar1.aspectFilter == aspect) || aspectList1.getAspects()[0] == aspect && (aspectList1.getAmount(aspectList1.getAspects()[0]) < 64 || voidJar)) {
|
||||
jar1.addToContainer(aspect, 1);
|
||||
item.setAspects(jar, aspectList.remove(aspect, 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void markDirty() {
|
||||
super.markDirty();
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
}
|
||||
@Override
|
||||
public void markDirty() {
|
||||
super.markDirty();
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
}
|
||||
|
||||
private TileEntity getHopperFacing(int x, int y, int z, int meta) {
|
||||
int i = BlockHopper.getDirectionFromMetadata(meta);
|
||||
return worldObj.getTileEntity(x + Facing.offsetsXForSide[i], y + Facing.offsetsYForSide[i], z + Facing.offsetsZForSide[i]);
|
||||
}
|
||||
private TileEntity getHopperFacing(int x, int y, int z, int meta) {
|
||||
int i = BlockHopper.getDirectionFromMetadata(meta);
|
||||
return worldObj.getTileEntity(x + Facing.offsetsXForSide[i], y + Facing.offsetsYForSide[i], z + Facing.offsetsZForSide[i]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound par1NBTTagCompound) {
|
||||
super.readFromNBT(par1NBTTagCompound);
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound par1NBTTagCompound) {
|
||||
super.readFromNBT(par1NBTTagCompound);
|
||||
|
||||
readCustomNBT(par1NBTTagCompound);
|
||||
}
|
||||
readCustomNBT(par1NBTTagCompound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound par1NBTTagCompound) {
|
||||
super.writeToNBT(par1NBTTagCompound);
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound par1NBTTagCompound) {
|
||||
super.writeToNBT(par1NBTTagCompound);
|
||||
|
||||
writeCustomNBT(par1NBTTagCompound);
|
||||
}
|
||||
writeCustomNBT(par1NBTTagCompound);
|
||||
}
|
||||
|
||||
public void readCustomNBT(NBTTagCompound par1NBTTagCompound) {
|
||||
NBTTagList var2 = par1NBTTagCompound.getTagList("Items", Constants.NBT.TAG_COMPOUND);
|
||||
inventorySlots = new ItemStack[getSizeInventory()];
|
||||
for (int var3 = 0; var3 < var2.tagCount(); ++var3) {
|
||||
NBTTagCompound var4 = var2.getCompoundTagAt(var3);
|
||||
byte var5 = var4.getByte("Slot");
|
||||
if (var5 >= 0 && var5 < inventorySlots.length)
|
||||
inventorySlots[var5] = ItemStack.loadItemStackFromNBT(var4);
|
||||
}
|
||||
}
|
||||
public void readCustomNBT(NBTTagCompound par1NBTTagCompound) {
|
||||
NBTTagList var2 = par1NBTTagCompound.getTagList("Items", Constants.NBT.TAG_COMPOUND);
|
||||
inventorySlots = new ItemStack[getSizeInventory()];
|
||||
for (int var3 = 0; var3 < var2.tagCount(); ++var3) {
|
||||
NBTTagCompound var4 = var2.getCompoundTagAt(var3);
|
||||
byte var5 = var4.getByte("Slot");
|
||||
if (var5 >= 0 && var5 < inventorySlots.length)
|
||||
inventorySlots[var5] = ItemStack.loadItemStackFromNBT(var4);
|
||||
}
|
||||
}
|
||||
|
||||
public void writeCustomNBT(NBTTagCompound par1NBTTagCompound) {
|
||||
NBTTagList var2 = new NBTTagList();
|
||||
for (int var3 = 0; var3 < inventorySlots.length; ++var3) {
|
||||
if (inventorySlots[var3] != null) {
|
||||
NBTTagCompound var4 = new NBTTagCompound();
|
||||
var4.setByte("Slot", (byte) var3);
|
||||
inventorySlots[var3].writeToNBT(var4);
|
||||
var2.appendTag(var4);
|
||||
}
|
||||
}
|
||||
par1NBTTagCompound.setTag("Items", var2);
|
||||
}
|
||||
public void writeCustomNBT(NBTTagCompound par1NBTTagCompound) {
|
||||
NBTTagList var2 = new NBTTagList();
|
||||
for (int var3 = 0; var3 < inventorySlots.length; ++var3) {
|
||||
if (inventorySlots[var3] != null) {
|
||||
NBTTagCompound var4 = new NBTTagCompound();
|
||||
var4.setByte("Slot", (byte) var3);
|
||||
inventorySlots[var3].writeToNBT(var4);
|
||||
var2.appendTag(var4);
|
||||
}
|
||||
}
|
||||
par1NBTTagCompound.setTag("Items", var2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSizeInventory() {
|
||||
return inventorySlots.length;
|
||||
}
|
||||
@Override
|
||||
public int getSizeInventory() {
|
||||
return inventorySlots.length;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlot(int i) {
|
||||
AspectList aspects = getAspects();
|
||||
//if(inventorySlots[i] != null && inventorySlots[i].itemID == ConfigItems.itemJarFilled.itemID && aspects == null) {
|
||||
// Aspect filter=((ItemJarFilled)inventorySlots[i].getItem()).getFilter(inventorySlots[i]);
|
||||
// inventorySlots[i] = new ItemStack(ConfigBlocks.blockJar,1,inventorySlots[i].getItemDamage());
|
||||
// if(filter!=null)
|
||||
// {
|
||||
// if(inventorySlots[i].getTagCompound()==null)
|
||||
// inventorySlots[i].setTagCompound(new NBTTagCompound());
|
||||
// inventorySlots[i].getTagCompound().setString("AspectFilter",filter.getTag());
|
||||
// }
|
||||
// onInventoryChanged();
|
||||
//}
|
||||
@Override
|
||||
public ItemStack getStackInSlot(int i) {
|
||||
AspectList aspects = getAspects();
|
||||
//if(inventorySlots[i] != null && inventorySlots[i].itemID == ConfigItems.itemJarFilled.itemID && aspects == null) {
|
||||
// Aspect filter=((ItemJarFilled)inventorySlots[i].getItem()).getFilter(inventorySlots[i]);
|
||||
// inventorySlots[i] = new ItemStack(ConfigBlocks.blockJar,1,inventorySlots[i].getItemDamage());
|
||||
// if(filter!=null)
|
||||
// {
|
||||
// if(inventorySlots[i].getTagCompound()==null)
|
||||
// inventorySlots[i].setTagCompound(new NBTTagCompound());
|
||||
// inventorySlots[i].getTagCompound().setString("AspectFilter",filter.getTag());
|
||||
// }
|
||||
// onInventoryChanged();
|
||||
//}
|
||||
|
||||
return inventorySlots[i];
|
||||
}
|
||||
return inventorySlots[i];
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack decrStackSize(int i, int j) {
|
||||
if (inventorySlots[i] != null) {
|
||||
ItemStack stackAt;
|
||||
@Override
|
||||
public ItemStack decrStackSize(int i, int j) {
|
||||
if (inventorySlots[i] != null) {
|
||||
ItemStack stackAt;
|
||||
|
||||
if (inventorySlots[i].stackSize <= j) {
|
||||
stackAt = inventorySlots[i];
|
||||
inventorySlots[i] = null;
|
||||
return stackAt;
|
||||
} else {
|
||||
stackAt = inventorySlots[i].splitStack(j);
|
||||
if (inventorySlots[i].stackSize <= j) {
|
||||
stackAt = inventorySlots[i];
|
||||
inventorySlots[i] = null;
|
||||
return stackAt;
|
||||
} else {
|
||||
stackAt = inventorySlots[i].splitStack(j);
|
||||
|
||||
if (inventorySlots[i].stackSize == 0)
|
||||
inventorySlots[i] = null;
|
||||
if (inventorySlots[i].stackSize == 0)
|
||||
inventorySlots[i] = null;
|
||||
|
||||
return stackAt;
|
||||
}
|
||||
}
|
||||
return stackAt;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlotOnClosing(int i) {
|
||||
return getStackInSlot(i);
|
||||
}
|
||||
@Override
|
||||
public ItemStack getStackInSlotOnClosing(int i) {
|
||||
return getStackInSlot(i);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInventorySlotContents(int i, ItemStack itemstack) {
|
||||
inventorySlots[i] = itemstack;
|
||||
}
|
||||
@Override
|
||||
public void setInventorySlotContents(int i, ItemStack itemstack) {
|
||||
inventorySlots[i] = itemstack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return LibBlockNames.FUNNEL;
|
||||
}
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return LibBlockNames.FUNNEL;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCustomInventoryName() {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean hasCustomInventoryName() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInventoryStackLimit() {
|
||||
return 1;
|
||||
}
|
||||
@Override
|
||||
public int getInventoryStackLimit() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUseableByPlayer(EntityPlayer entityplayer) {
|
||||
return worldObj.getTileEntity(xCoord, yCoord, zCoord) == this && entityplayer.getDistanceSq(xCoord + 0.5D, yCoord + 0.5D, zCoord + 0.5D) <= 64;
|
||||
}
|
||||
@Override
|
||||
public boolean isUseableByPlayer(EntityPlayer entityplayer) {
|
||||
return worldObj.getTileEntity(xCoord, yCoord, zCoord) == this && entityplayer.getDistanceSq(xCoord + 0.5D, yCoord + 0.5D, zCoord + 0.5D) <= 64;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openInventory() {
|
||||
@Override
|
||||
public void openInventory() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeInventory() {
|
||||
@Override
|
||||
public void closeInventory() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int i, ItemStack itemstack) {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int i, ItemStack itemstack) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public S35PacketUpdateTileEntity getDescriptionPacket() {
|
||||
NBTTagCompound nbttagcompound = new NBTTagCompound();
|
||||
writeCustomNBT(nbttagcompound);
|
||||
return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, -999, nbttagcompound);
|
||||
}
|
||||
@Override
|
||||
public S35PacketUpdateTileEntity getDescriptionPacket() {
|
||||
NBTTagCompound nbttagcompound = new NBTTagCompound();
|
||||
writeCustomNBT(nbttagcompound);
|
||||
return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, -999, nbttagcompound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDataPacket(NetworkManager manager, S35PacketUpdateTileEntity packet) {
|
||||
super.onDataPacket(manager, packet);
|
||||
readCustomNBT(packet.func_148857_g());
|
||||
}
|
||||
@Override
|
||||
public void onDataPacket(NetworkManager manager, S35PacketUpdateTileEntity packet) {
|
||||
super.onDataPacket(manager, packet);
|
||||
readCustomNBT(packet.func_148857_g());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getAccessibleSlotsFromSide(int var1) {
|
||||
return var1 == ForgeDirection.DOWN.ordinal() ? new int[0] : new int[]{ 0 };
|
||||
}
|
||||
@Override
|
||||
public int[] getAccessibleSlotsFromSide(int var1) {
|
||||
return var1 == ForgeDirection.DOWN.ordinal() ? new int[0] : new int[]{0};
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInsertItem(int i, ItemStack itemstack, int j) {
|
||||
return itemstack != null && itemstack.getItem() instanceof ItemJarFilled;
|
||||
}
|
||||
@Override
|
||||
public boolean canInsertItem(int i, ItemStack itemstack, int j) {
|
||||
return itemstack != null && itemstack.getItem() instanceof ItemJarFilled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int i, ItemStack itemstack, int j) {
|
||||
return j != ForgeDirection.DOWN.ordinal();
|
||||
}
|
||||
@Override
|
||||
public boolean canExtractItem(int i, ItemStack itemstack, int j) {
|
||||
return j != ForgeDirection.DOWN.ordinal();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AspectList getAspects() {
|
||||
ItemStack stack = inventorySlots[0];
|
||||
return stack != null && stack.getItem() instanceof IEssentiaContainerItem ? ((IEssentiaContainerItem) stack.getItem()).getAspects(stack) : null;
|
||||
}
|
||||
@Override
|
||||
public AspectList getAspects() {
|
||||
ItemStack stack = inventorySlots[0];
|
||||
return stack != null && stack.getItem() instanceof IEssentiaContainerItem ? ((IEssentiaContainerItem) stack.getItem()).getAspects(stack) : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAspects(AspectList paramAspectList) {
|
||||
}
|
||||
@Override
|
||||
public void setAspects(AspectList paramAspectList) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean doesContainerAccept(Aspect paramAspect) {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean doesContainerAccept(Aspect paramAspect) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int addToContainer(Aspect paramAspect, int paramInt) {
|
||||
return 0;
|
||||
}
|
||||
@Override
|
||||
public int addToContainer(Aspect paramAspect, int paramInt) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean takeFromContainer(Aspect paramAspect, int paramInt) {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean takeFromContainer(Aspect paramAspect, int paramInt) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean takeFromContainer(AspectList paramAspectList) {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean takeFromContainer(AspectList paramAspectList) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean doesContainerContainAmount(Aspect paramAspect, int paramInt) {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean doesContainerContainAmount(Aspect paramAspect, int paramInt) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean doesContainerContain(AspectList paramAspectList) {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean doesContainerContain(AspectList paramAspectList) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int containerContains(Aspect paramAspect) {
|
||||
return 0;
|
||||
}
|
||||
@Override
|
||||
public int containerContains(Aspect paramAspect) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean prepareToMove() {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean prepareToMove() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doneMoving() {
|
||||
@Override
|
||||
public void doneMoving() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -21,456 +21,456 @@ import thaumic.tinkerer.common.core.golems.EnumGolemDecorations;
|
||||
import java.util.*;
|
||||
|
||||
@Optional.InterfaceList({
|
||||
@Optional.Interface(iface = "li.cil.oc.api.network.SimpleComponent", modid = "OpenComputers"),
|
||||
@Optional.Interface(iface = "dan200.computercraft.api.peripheral.IPeripheral", modid = "ComputerCraft")
|
||||
@Optional.Interface(iface = "li.cil.oc.api.network.SimpleComponent", modid = "OpenComputers"),
|
||||
@Optional.Interface(iface = "dan200.computercraft.api.peripheral.IPeripheral", modid = "ComputerCraft")
|
||||
})
|
||||
public class TileGolemConnector extends TileCamo implements IPeripheral, SimpleComponent {
|
||||
private static final String TAG_UUID_MOST = "UUIDMost";
|
||||
private static final String TAG_UUID_LEAST = "UUIDLeast";
|
||||
public UUID golemConnected;
|
||||
public EntityGolemBase golem;
|
||||
private static final String TAG_UUID_MOST = "UUIDMost";
|
||||
private static final String TAG_UUID_LEAST = "UUIDLeast";
|
||||
public UUID golemConnected;
|
||||
public EntityGolemBase golem;
|
||||
|
||||
@Override
|
||||
public boolean canUpdate() {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean canUpdate() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public void verifyGolem() {
|
||||
if (golemConnected == null)
|
||||
return;
|
||||
List list = this.worldObj.getEntitiesWithinAABB(EntityGolemBase.class,
|
||||
AxisAlignedBB.getBoundingBox(xCoord - 30, yCoord - 30,
|
||||
zCoord - 30, xCoord + 30, yCoord + 30, zCoord + 30)
|
||||
);
|
||||
Iterator iterator = list.iterator();
|
||||
public void verifyGolem() {
|
||||
if (golemConnected == null)
|
||||
return;
|
||||
List list = this.worldObj.getEntitiesWithinAABB(EntityGolemBase.class,
|
||||
AxisAlignedBB.getBoundingBox(xCoord - 30, yCoord - 30,
|
||||
zCoord - 30, xCoord + 30, yCoord + 30, zCoord + 30)
|
||||
);
|
||||
Iterator iterator = list.iterator();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
EntityGolemBase entityGolem = (EntityGolemBase) iterator.next();
|
||||
while (iterator.hasNext()) {
|
||||
EntityGolemBase entityGolem = (EntityGolemBase) iterator.next();
|
||||
|
||||
if (entityGolem.getUniqueID().equals(golemConnected)) {
|
||||
this.golem = entityGolem;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (entityGolem.getUniqueID().equals(golemConnected)) {
|
||||
this.golem = entityGolem;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType() {
|
||||
return "tt_golemconnector";
|
||||
}
|
||||
@Override
|
||||
public String getType() {
|
||||
return "tt_golemconnector";
|
||||
}
|
||||
|
||||
public Object[] getGolemDecorationsImplementation() throws LuaException {
|
||||
if (golem == null || golem.decoration == null || golem.decoration.length() == 0)
|
||||
return new String[]{ };
|
||||
HashMap<Double, String> decorations = new HashMap<Double, String>();
|
||||
for (int i = 0; i < golem.decoration.length(); i++) {
|
||||
EnumGolemDecorations golemDec = EnumGolemDecorations.getFromChar(golem.decoration.charAt(i));
|
||||
if (golemDec == null)
|
||||
throw new LuaException("Golem is wearing unknown accessory: " + golem.decoration.charAt(i));
|
||||
decorations.put((double) i, StatCollector.translateToLocal(golemDec.getName()));
|
||||
}
|
||||
public Object[] getGolemDecorationsImplementation() throws LuaException {
|
||||
if (golem == null || golem.decoration == null || golem.decoration.length() == 0)
|
||||
return new String[]{};
|
||||
HashMap<Double, String> decorations = new HashMap<Double, String>();
|
||||
for (int i = 0; i < golem.decoration.length(); i++) {
|
||||
EnumGolemDecorations golemDec = EnumGolemDecorations.getFromChar(golem.decoration.charAt(i));
|
||||
if (golemDec == null)
|
||||
throw new LuaException("Golem is wearing unknown accessory: " + golem.decoration.charAt(i));
|
||||
decorations.put((double) i, StatCollector.translateToLocal(golemDec.getName()));
|
||||
}
|
||||
|
||||
return new Object[]{ decorations };
|
||||
return new Object[]{decorations};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public String[] getGolemCoreImplementation() throws LuaException {
|
||||
if (golem == null)
|
||||
return new String[]{ };
|
||||
if (golem.getCore() == -1)
|
||||
return new String[]{ StatCollector.translateToLocal("item.ItemGolemCore.100.name") };
|
||||
String[] decorations = new String[1];
|
||||
EnumGolemCores golemCore = EnumGolemCores.getFromByte(golem.getCore());
|
||||
if (golemCore == null)
|
||||
throw new LuaException("Golem has Unknown core: " + golem.getCore());
|
||||
decorations[0] = StatCollector.translateToLocal(golemCore.getName());
|
||||
public String[] getGolemCoreImplementation() throws LuaException {
|
||||
if (golem == null)
|
||||
return new String[]{};
|
||||
if (golem.getCore() == -1)
|
||||
return new String[]{StatCollector.translateToLocal("item.ItemGolemCore.100.name")};
|
||||
String[] decorations = new String[1];
|
||||
EnumGolemCores golemCore = EnumGolemCores.getFromByte(golem.getCore());
|
||||
if (golemCore == null)
|
||||
throw new LuaException("Golem has Unknown core: " + golem.getCore());
|
||||
decorations[0] = StatCollector.translateToLocal(golemCore.getName());
|
||||
|
||||
return decorations;
|
||||
return decorations;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeCustomNBT(NBTTagCompound cmp) {
|
||||
super.writeCustomNBT(cmp);
|
||||
if (golemConnected != null) {
|
||||
cmp.setLong(TAG_UUID_MOST, golemConnected.getMostSignificantBits());
|
||||
cmp.setLong(TAG_UUID_LEAST, golemConnected.getLeastSignificantBits());
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void writeCustomNBT(NBTTagCompound cmp) {
|
||||
super.writeCustomNBT(cmp);
|
||||
if (golemConnected != null) {
|
||||
cmp.setLong(TAG_UUID_MOST, golemConnected.getMostSignificantBits());
|
||||
cmp.setLong(TAG_UUID_LEAST, golemConnected.getLeastSignificantBits());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
super.updateEntity();
|
||||
if (worldObj.getTotalWorldTime() % 100 == 1) {
|
||||
verifyGolem();
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
super.updateEntity();
|
||||
if (worldObj.getTotalWorldTime() % 100 == 1) {
|
||||
verifyGolem();
|
||||
}
|
||||
}
|
||||
|
||||
public void ConnectGolem(UUID golemID) {
|
||||
golemConnected = golemID;
|
||||
if (golemID == null)
|
||||
golem = null;
|
||||
else {
|
||||
verifyGolem();
|
||||
}
|
||||
}
|
||||
public void ConnectGolem(UUID golemID) {
|
||||
golemConnected = golemID;
|
||||
if (golemID == null)
|
||||
golem = null;
|
||||
else {
|
||||
verifyGolem();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readCustomNBT(NBTTagCompound cmp) {
|
||||
super.readCustomNBT(cmp);
|
||||
if (cmp.hasKey(TAG_UUID_LEAST) && cmp.hasKey(TAG_UUID_MOST)) {
|
||||
golemConnected = new UUID(cmp.getLong(TAG_UUID_MOST), cmp.getLong(TAG_UUID_LEAST));
|
||||
//verifyGolem();
|
||||
}
|
||||
@Override
|
||||
public void readCustomNBT(NBTTagCompound cmp) {
|
||||
super.readCustomNBT(cmp);
|
||||
if (cmp.hasKey(TAG_UUID_LEAST) && cmp.hasKey(TAG_UUID_MOST)) {
|
||||
golemConnected = new UUID(cmp.getLong(TAG_UUID_MOST), cmp.getLong(TAG_UUID_LEAST));
|
||||
//verifyGolem();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getMethodNames() {
|
||||
return new String[]{ "getDecorations", "getPosition", "getType", "getHealth", "getCore", "getHome", "setHome", "getMarkers", "setMarkers", "newMarker", "addMarker", "saveMarker", "deleteMarker", "getMarker", "getMarkerCount" };
|
||||
}
|
||||
@Override
|
||||
public String[] getMethodNames() {
|
||||
return new String[]{"getDecorations", "getPosition", "getType", "getHealth", "getCore", "getHome", "setHome", "getMarkers", "setMarkers", "newMarker", "addMarker", "saveMarker", "deleteMarker", "getMarker", "getMarkerCount"};
|
||||
}
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid = "ComputerCraft")
|
||||
public Object[] callMethod(IComputerAccess computer, ILuaContext context,
|
||||
int method, Object[] arguments) throws LuaException{
|
||||
switch (method) {
|
||||
case 0:
|
||||
return getGolemDecorationsImplementation();
|
||||
case 1:
|
||||
if (golem == null)
|
||||
return new Integer[]{ };
|
||||
return new Integer[]{ (int) golem.posX, (int) golem.posY, (int) golem.posZ };
|
||||
case 2:
|
||||
return getGolemTypeImplementation();
|
||||
case 3:
|
||||
if (golem == null)
|
||||
return new Float[]{ };
|
||||
return new Float[]{ golem.getHealth() };
|
||||
case 4:
|
||||
return getGolemCoreImplementation();
|
||||
case 5:
|
||||
return getHomeImplementation();
|
||||
case 6:
|
||||
if (arguments.length != 4)
|
||||
throw new LuaException("Invalid arguments");
|
||||
double x = (Double) arguments[0];
|
||||
double y = (Double) arguments[0];
|
||||
double z = (Double) arguments[0];
|
||||
double facing = (Double) arguments[0];
|
||||
return setHomeImplementation(x, y, z, facing);
|
||||
case 7:
|
||||
return getMarkersImplementation();
|
||||
case 8:
|
||||
if (arguments.length != 1)
|
||||
throw new LuaException("setMarkers takes 1 argument");
|
||||
return setMarkersImplementation((HashMap<Double, HashMap<String, Object>>) arguments[0]);
|
||||
case 9:
|
||||
return newMarkerImplementation();
|
||||
case 10:
|
||||
if (arguments.length != 1)
|
||||
throw new LuaException("addMarker must have 1 argument");
|
||||
return addMarkerImplementation((Map) arguments[0]);
|
||||
case 11:
|
||||
if (arguments.length != 2)
|
||||
throw new LuaException("saveMarker must have 2 arguments");
|
||||
return saveMarkerImplementation((Double) arguments[0], (Map) arguments[1]);
|
||||
case 12:
|
||||
if (arguments.length != 1)
|
||||
throw new LuaException("deleteMarker must have 1 argument");
|
||||
return deleteMarkerImplementation((Double) arguments[0]);
|
||||
case 13:
|
||||
if (arguments.length != 1)
|
||||
throw new LuaException("getMarker must have 1 argument");
|
||||
return getMarkerImplementation((Double) arguments[0]);
|
||||
case 14:
|
||||
return getMarkerCountImplementation();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
@Optional.Method(modid = "ComputerCraft")
|
||||
public Object[] callMethod(IComputerAccess computer, ILuaContext context,
|
||||
int method, Object[] arguments) throws LuaException {
|
||||
switch (method) {
|
||||
case 0:
|
||||
return getGolemDecorationsImplementation();
|
||||
case 1:
|
||||
if (golem == null)
|
||||
return new Integer[]{};
|
||||
return new Integer[]{(int) golem.posX, (int) golem.posY, (int) golem.posZ};
|
||||
case 2:
|
||||
return getGolemTypeImplementation();
|
||||
case 3:
|
||||
if (golem == null)
|
||||
return new Float[]{};
|
||||
return new Float[]{golem.getHealth()};
|
||||
case 4:
|
||||
return getGolemCoreImplementation();
|
||||
case 5:
|
||||
return getHomeImplementation();
|
||||
case 6:
|
||||
if (arguments.length != 4)
|
||||
throw new LuaException("Invalid arguments");
|
||||
double x = (Double) arguments[0];
|
||||
double y = (Double) arguments[0];
|
||||
double z = (Double) arguments[0];
|
||||
double facing = (Double) arguments[0];
|
||||
return setHomeImplementation(x, y, z, facing);
|
||||
case 7:
|
||||
return getMarkersImplementation();
|
||||
case 8:
|
||||
if (arguments.length != 1)
|
||||
throw new LuaException("setMarkers takes 1 argument");
|
||||
return setMarkersImplementation((HashMap<Double, HashMap<String, Object>>) arguments[0]);
|
||||
case 9:
|
||||
return newMarkerImplementation();
|
||||
case 10:
|
||||
if (arguments.length != 1)
|
||||
throw new LuaException("addMarker must have 1 argument");
|
||||
return addMarkerImplementation((Map) arguments[0]);
|
||||
case 11:
|
||||
if (arguments.length != 2)
|
||||
throw new LuaException("saveMarker must have 2 arguments");
|
||||
return saveMarkerImplementation((Double) arguments[0], (Map) arguments[1]);
|
||||
case 12:
|
||||
if (arguments.length != 1)
|
||||
throw new LuaException("deleteMarker must have 1 argument");
|
||||
return deleteMarkerImplementation((Double) arguments[0]);
|
||||
case 13:
|
||||
if (arguments.length != 1)
|
||||
throw new LuaException("getMarker must have 1 argument");
|
||||
return getMarkerImplementation((Double) arguments[0]);
|
||||
case 14:
|
||||
return getMarkerCountImplementation();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private Object[] getMarkerCountImplementation() {
|
||||
if (golem == null)
|
||||
return new String[]{ };
|
||||
ArrayList<Marker> markers = golem.getMarkers();
|
||||
if (markers == null)
|
||||
return new Object[]{ 0 };
|
||||
return new Object[]{ (double) markers.size() };
|
||||
}
|
||||
private Object[] getMarkerCountImplementation() {
|
||||
if (golem == null)
|
||||
return new String[]{};
|
||||
ArrayList<Marker> markers = golem.getMarkers();
|
||||
if (markers == null)
|
||||
return new Object[]{0};
|
||||
return new Object[]{(double) markers.size()};
|
||||
}
|
||||
|
||||
private Object[] getMarkerImplementation(Double arguments) throws LuaException {
|
||||
if (golem == null)
|
||||
return new String[]{ };
|
||||
ArrayList<Marker> markers = golem.getMarkers();
|
||||
if (markers == null || markers.size() <= arguments)
|
||||
throw new LuaException("marker " + (int) (double) arguments + " does not exist");
|
||||
Marker mark = markers.get((int) (double) arguments);
|
||||
private Object[] getMarkerImplementation(Double arguments) throws LuaException {
|
||||
if (golem == null)
|
||||
return new String[]{};
|
||||
ArrayList<Marker> markers = golem.getMarkers();
|
||||
if (markers == null || markers.size() <= arguments)
|
||||
throw new LuaException("marker " + (int) (double) arguments + " does not exist");
|
||||
Marker mark = markers.get((int) (double) arguments);
|
||||
|
||||
return new Object[]{ fromMarkerImplementation(mark) };
|
||||
}
|
||||
return new Object[]{fromMarkerImplementation(mark)};
|
||||
}
|
||||
|
||||
private Object[] deleteMarkerImplementation(double arguments) throws LuaException {
|
||||
if (golem == null)
|
||||
return new String[]{ };
|
||||
ArrayList<Marker> markers = golem.getMarkers();
|
||||
if (markers == null || markers.size() <= arguments)
|
||||
throw new LuaException("marker " + (int) (double) arguments + " does not exist");
|
||||
markers.remove((int) (double) arguments);
|
||||
golem.setMarkers(markers);
|
||||
return new String[]{ };
|
||||
}
|
||||
private Object[] deleteMarkerImplementation(double arguments) throws LuaException {
|
||||
if (golem == null)
|
||||
return new String[]{};
|
||||
ArrayList<Marker> markers = golem.getMarkers();
|
||||
if (markers == null || markers.size() <= arguments)
|
||||
throw new LuaException("marker " + (int) (double) arguments + " does not exist");
|
||||
markers.remove((int) (double) arguments);
|
||||
golem.setMarkers(markers);
|
||||
return new String[]{};
|
||||
}
|
||||
|
||||
private Object[] saveMarkerImplementation(double markerNum, Map markerArg) throws LuaException {
|
||||
if (golem == null)
|
||||
return new String[]{ };
|
||||
ArrayList<Marker> markers = golem.getMarkers();
|
||||
if (markers == null || markers.size() <= markerNum)
|
||||
throw new LuaException("marker " + (int) (double) markerNum + " does not exist");
|
||||
Marker mark = toMarkerImplementation(markerArg);
|
||||
markers.set((int) (double) markerNum, mark);
|
||||
golem.setMarkers(markers);
|
||||
return getMarkerImplementation(markerNum);
|
||||
}
|
||||
private Object[] saveMarkerImplementation(double markerNum, Map markerArg) throws LuaException {
|
||||
if (golem == null)
|
||||
return new String[]{};
|
||||
ArrayList<Marker> markers = golem.getMarkers();
|
||||
if (markers == null || markers.size() <= markerNum)
|
||||
throw new LuaException("marker " + (int) (double) markerNum + " does not exist");
|
||||
Marker mark = toMarkerImplementation(markerArg);
|
||||
markers.set((int) (double) markerNum, mark);
|
||||
golem.setMarkers(markers);
|
||||
return getMarkerImplementation(markerNum);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private Object[] addMarkerImplementation(Map arguments) throws LuaException {
|
||||
if (golem == null)
|
||||
return new String[]{ };
|
||||
ArrayList<Marker> markers = golem.getMarkers();
|
||||
if (markers == null)
|
||||
markers = new ArrayList<Marker>();
|
||||
Marker mark = toMarkerImplementation(arguments);
|
||||
markers.add(mark);
|
||||
golem.setMarkers(markers);
|
||||
return getMarkerImplementation((double) (markers.size() - 1));
|
||||
}
|
||||
@SuppressWarnings("unchecked")
|
||||
private Object[] addMarkerImplementation(Map arguments) throws LuaException {
|
||||
if (golem == null)
|
||||
return new String[]{};
|
||||
ArrayList<Marker> markers = golem.getMarkers();
|
||||
if (markers == null)
|
||||
markers = new ArrayList<Marker>();
|
||||
Marker mark = toMarkerImplementation(arguments);
|
||||
markers.add(mark);
|
||||
golem.setMarkers(markers);
|
||||
return getMarkerImplementation((double) (markers.size() - 1));
|
||||
}
|
||||
|
||||
private Object[] newMarkerImplementation() {
|
||||
HashMap<String, Object> mark = new HashMap<String, Object>();
|
||||
mark.put("posX", xCoord);
|
||||
mark.put("posY", yCoord);
|
||||
mark.put("posZ", zCoord);
|
||||
mark.put("dim", this.worldObj.provider.dimensionId);
|
||||
mark.put("color", -1);
|
||||
mark.put("side", 1);
|
||||
return new Object[]{ mark };
|
||||
}
|
||||
private Object[] newMarkerImplementation() {
|
||||
HashMap<String, Object> mark = new HashMap<String, Object>();
|
||||
mark.put("posX", xCoord);
|
||||
mark.put("posY", yCoord);
|
||||
mark.put("posZ", zCoord);
|
||||
mark.put("dim", this.worldObj.provider.dimensionId);
|
||||
mark.put("color", -1);
|
||||
mark.put("side", 1);
|
||||
return new Object[]{mark};
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private Object[] setMarkersImplementation(Map arguments) throws LuaException {
|
||||
if (golem == null)
|
||||
return new String[]{ };
|
||||
@SuppressWarnings("unchecked")
|
||||
private Object[] setMarkersImplementation(Map arguments) throws LuaException {
|
||||
if (golem == null)
|
||||
return new String[]{};
|
||||
|
||||
ArrayList<Marker> arrList = new ArrayList<Marker>();
|
||||
ArrayList<Marker> arrList = new ArrayList<Marker>();
|
||||
|
||||
for (Object map : arguments.values()) {
|
||||
Marker mark = toMarkerImplementation((Map) map);
|
||||
for (Object map : arguments.values()) {
|
||||
Marker mark = toMarkerImplementation((Map) map);
|
||||
|
||||
arrList.add(mark);
|
||||
arrList.add(mark);
|
||||
|
||||
}
|
||||
golem.setMarkers(arrList);
|
||||
return getMarkersImplementation();
|
||||
}
|
||||
}
|
||||
golem.setMarkers(arrList);
|
||||
return getMarkersImplementation();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param markerMap
|
||||
* @return
|
||||
*/
|
||||
private Marker toMarkerImplementation(Map markerMap) {
|
||||
double posX = (Double) markerMap.get("posX");
|
||||
double posY = (Double) markerMap.get("posY");
|
||||
double posZ = (Double) markerMap.get("posZ");
|
||||
double dim = (Double) markerMap.get("dim");
|
||||
double side = (Double) markerMap.get("side");
|
||||
double color = (Double) markerMap.get("color");
|
||||
return new Marker((int) posX, (int) posY, (int) posZ, (int) dim, (byte) side, (byte) color);
|
||||
}
|
||||
/**
|
||||
* @param markerMap
|
||||
* @return
|
||||
*/
|
||||
private Marker toMarkerImplementation(Map markerMap) {
|
||||
double posX = (Double) markerMap.get("posX");
|
||||
double posY = (Double) markerMap.get("posY");
|
||||
double posZ = (Double) markerMap.get("posZ");
|
||||
double dim = (Double) markerMap.get("dim");
|
||||
double side = (Double) markerMap.get("side");
|
||||
double color = (Double) markerMap.get("color");
|
||||
return new Marker((int) posX, (int) posY, (int) posZ, (int) dim, (byte) side, (byte) color);
|
||||
}
|
||||
|
||||
private Object[] getMarkersImplementation() {
|
||||
if (golem == null)
|
||||
return new String[]{ };
|
||||
ArrayList<Marker> markers = golem.getMarkers();
|
||||
HashMap<Integer, HashMap<String, Object>> luaMarkers = new HashMap<Integer, HashMap<String, Object>>();
|
||||
int i = 1;
|
||||
for (Marker mark : markers) {
|
||||
HashMap<String, Object> luaMarker = fromMarkerImplementation(mark);
|
||||
luaMarkers.put(i++, luaMarker);
|
||||
}
|
||||
return new Object[]{ luaMarkers };
|
||||
}
|
||||
private Object[] getMarkersImplementation() {
|
||||
if (golem == null)
|
||||
return new String[]{};
|
||||
ArrayList<Marker> markers = golem.getMarkers();
|
||||
HashMap<Integer, HashMap<String, Object>> luaMarkers = new HashMap<Integer, HashMap<String, Object>>();
|
||||
int i = 1;
|
||||
for (Marker mark : markers) {
|
||||
HashMap<String, Object> luaMarker = fromMarkerImplementation(mark);
|
||||
luaMarkers.put(i++, luaMarker);
|
||||
}
|
||||
return new Object[]{luaMarkers};
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mark
|
||||
* @return
|
||||
*/
|
||||
private HashMap<String, Object> fromMarkerImplementation(Marker mark) {
|
||||
HashMap<String, Object> luaMarker = new HashMap<String, Object>();
|
||||
/**
|
||||
* @param mark
|
||||
* @return
|
||||
*/
|
||||
private HashMap<String, Object> fromMarkerImplementation(Marker mark) {
|
||||
HashMap<String, Object> luaMarker = new HashMap<String, Object>();
|
||||
|
||||
luaMarker.put("posX", mark.x);
|
||||
luaMarker.put("posY", mark.y);
|
||||
luaMarker.put("posZ", mark.z);
|
||||
luaMarker.put("dim", mark.dim);
|
||||
luaMarker.put("color", mark.color);
|
||||
luaMarker.put("side", mark.side);
|
||||
return luaMarker;
|
||||
}
|
||||
luaMarker.put("posX", mark.x);
|
||||
luaMarker.put("posY", mark.y);
|
||||
luaMarker.put("posZ", mark.z);
|
||||
luaMarker.put("dim", mark.dim);
|
||||
luaMarker.put("color", mark.color);
|
||||
luaMarker.put("side", mark.side);
|
||||
return luaMarker;
|
||||
}
|
||||
|
||||
private Object[] setHomeImplementation(double x, double y, double z, double facing) throws LuaException {
|
||||
if (golem == null)
|
||||
return new String[]{ };
|
||||
private Object[] setHomeImplementation(double x, double y, double z, double facing) throws LuaException {
|
||||
if (golem == null)
|
||||
return new String[]{};
|
||||
|
||||
golem.setHomeArea((int) x, (int) y, (int) z, 35);
|
||||
golem.homeFacing = (int) facing;
|
||||
return getHomeImplementation();
|
||||
}
|
||||
golem.setHomeArea((int) x, (int) y, (int) z, 35);
|
||||
golem.homeFacing = (int) facing;
|
||||
return getHomeImplementation();
|
||||
}
|
||||
|
||||
private Object[] getHomeImplementation() {
|
||||
if (golem == null)
|
||||
return new String[]{ };
|
||||
ChunkCoordinates home = golem.getHomePosition();
|
||||
return new Integer[]{ home.posX, home.posY, home.posZ, golem.homeFacing };
|
||||
}
|
||||
private Object[] getHomeImplementation() {
|
||||
if (golem == null)
|
||||
return new String[]{};
|
||||
ChunkCoordinates home = golem.getHomePosition();
|
||||
return new Integer[]{home.posX, home.posY, home.posZ, golem.homeFacing};
|
||||
}
|
||||
|
||||
private String[] getGolemTypeImplementation() throws LuaException {
|
||||
if (golem == null)
|
||||
return new String[]{ };
|
||||
switch (golem.getGolemType()) {
|
||||
case CLAY:
|
||||
return new String[]{ "Clay" };
|
||||
case FLESH:
|
||||
return new String[]{ "Flesh" };
|
||||
case IRON:
|
||||
return new String[]{ "Iron" };
|
||||
case STONE:
|
||||
return new String[]{ "Stone" };
|
||||
case STRAW:
|
||||
return new String[]{ "Straw" };
|
||||
case TALLOW:
|
||||
return new String[]{ "Tallow" };
|
||||
case THAUMIUM:
|
||||
return new String[]{ "Thaumium" };
|
||||
case WOOD:
|
||||
return new String[]{ "Wood" };
|
||||
default:
|
||||
throw new LuaException("Unknown Golem Type: " + golem.getGolemType());
|
||||
}
|
||||
}
|
||||
private String[] getGolemTypeImplementation() throws LuaException {
|
||||
if (golem == null)
|
||||
return new String[]{};
|
||||
switch (golem.getGolemType()) {
|
||||
case CLAY:
|
||||
return new String[]{"Clay"};
|
||||
case FLESH:
|
||||
return new String[]{"Flesh"};
|
||||
case IRON:
|
||||
return new String[]{"Iron"};
|
||||
case STONE:
|
||||
return new String[]{"Stone"};
|
||||
case STRAW:
|
||||
return new String[]{"Straw"};
|
||||
case TALLOW:
|
||||
return new String[]{"Tallow"};
|
||||
case THAUMIUM:
|
||||
return new String[]{"Thaumium"};
|
||||
case WOOD:
|
||||
return new String[]{"Wood"};
|
||||
default:
|
||||
throw new LuaException("Unknown Golem Type: " + golem.getGolemType());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid = "ComputerCraft")
|
||||
public void attach(IComputerAccess computer) {
|
||||
// TODO Auto-generated method stub
|
||||
@Override
|
||||
@Optional.Method(modid = "ComputerCraft")
|
||||
public void attach(IComputerAccess computer) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid = "ComputerCraft")
|
||||
public void detach(IComputerAccess computer) {
|
||||
// TODO Auto-generated method stub
|
||||
@Override
|
||||
@Optional.Method(modid = "ComputerCraft")
|
||||
public void detach(IComputerAccess computer) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid = "ComputerCraft")
|
||||
public boolean equals(IPeripheral other) {
|
||||
return this.equals((Object) other);
|
||||
@Override
|
||||
@Optional.Method(modid = "ComputerCraft")
|
||||
public boolean equals(IPeripheral other) {
|
||||
return this.equals((Object) other);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getComponentName() {
|
||||
return getType();
|
||||
}
|
||||
@Override
|
||||
public String getComponentName() {
|
||||
return getType();
|
||||
}
|
||||
|
||||
@Callback(doc = "function():table -- Returns table of current decorations on golem")
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getDecorations(Context context, Arguments args) throws LuaException {
|
||||
return getGolemDecorationsImplementation();
|
||||
}
|
||||
@Callback(doc = "function():table -- Returns table of current decorations on golem")
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getDecorations(Context context, Arguments args) throws LuaException {
|
||||
return getGolemDecorationsImplementation();
|
||||
}
|
||||
|
||||
@Callback(doc = "function():x:number,y:number,z:number -- Returns The golems current position")
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getPosition(Context context, Arguments args) {
|
||||
return new Double[]{ golem.posX, golem.posY, golem.posZ };
|
||||
}
|
||||
@Callback(doc = "function():x:number,y:number,z:number -- Returns The golems current position")
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getPosition(Context context, Arguments args) {
|
||||
return new Double[]{golem.posX, golem.posY, golem.posZ};
|
||||
}
|
||||
|
||||
@Callback(doc = "function():string -- Returns The golems type")
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getType(Context context, Arguments args) throws LuaException {
|
||||
return getGolemTypeImplementation();
|
||||
}
|
||||
@Callback(doc = "function():string -- Returns The golems type")
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getType(Context context, Arguments args) throws LuaException {
|
||||
return getGolemTypeImplementation();
|
||||
}
|
||||
|
||||
@Callback(doc = "function():number -- Returns The golems health")
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getHealth(Context context, Arguments args) throws LuaException {
|
||||
return new Float[]{ golem.getHealth() };
|
||||
}
|
||||
@Callback(doc = "function():number -- Returns The golems health")
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getHealth(Context context, Arguments args) throws LuaException {
|
||||
return new Float[]{golem.getHealth()};
|
||||
}
|
||||
|
||||
@Callback(doc = "function():string -- Returns The golems core")
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getCore(Context context, Arguments args) throws LuaException {
|
||||
return getGolemCoreImplementation();
|
||||
}
|
||||
@Callback(doc = "function():string -- Returns The golems core")
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getCore(Context context, Arguments args) throws LuaException {
|
||||
return getGolemCoreImplementation();
|
||||
}
|
||||
|
||||
@Callback(doc = "function():x:number,y:number,z:number,facing:number -- Returns The golems home position")
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getHome(Context context, Arguments args) throws LuaException {
|
||||
return getHomeImplementation();
|
||||
}
|
||||
@Callback(doc = "function():x:number,y:number,z:number,facing:number -- Returns The golems home position")
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getHome(Context context, Arguments args) throws LuaException {
|
||||
return getHomeImplementation();
|
||||
}
|
||||
|
||||
@Callback(doc = "function(x:number,y:number,z:number,facing:number):nill -- Sets The golems home position")
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] setHome(Context context, Arguments args) throws LuaException {
|
||||
return setHomeImplementation(args.checkDouble(0), args.checkDouble(1), args.checkDouble(2), args.checkDouble(3));
|
||||
}
|
||||
@Callback(doc = "function(x:number,y:number,z:number,facing:number):nill -- Sets The golems home position")
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] setHome(Context context, Arguments args) throws LuaException {
|
||||
return setHomeImplementation(args.checkDouble(0), args.checkDouble(1), args.checkDouble(2), args.checkDouble(3));
|
||||
}
|
||||
|
||||
@Callback(doc = "function():table -- Gets list of markers")
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getMarkers(Context context, Arguments args) throws LuaException {
|
||||
return getMarkersImplementation();
|
||||
}
|
||||
@Callback(doc = "function():table -- Gets list of markers")
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getMarkers(Context context, Arguments args) throws LuaException {
|
||||
return getMarkersImplementation();
|
||||
}
|
||||
|
||||
@Callback(doc = "function(list:table):table -- Sets list of markers")
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] setMarkers(Context context, Arguments args) throws LuaException {
|
||||
return setMarkersImplementation(args.checkTable(0));
|
||||
}
|
||||
@Callback(doc = "function(list:table):table -- Sets list of markers")
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] setMarkers(Context context, Arguments args) throws LuaException {
|
||||
return setMarkersImplementation(args.checkTable(0));
|
||||
}
|
||||
|
||||
@Callback(doc = "function():table -- Returns a blank marker with sensible defaults")
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] newMarker(Context context, Arguments args) throws LuaException {
|
||||
return newMarkerImplementation();
|
||||
}
|
||||
@Callback(doc = "function():table -- Returns a blank marker with sensible defaults")
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] newMarker(Context context, Arguments args) throws LuaException {
|
||||
return newMarkerImplementation();
|
||||
}
|
||||
|
||||
@Callback(doc = "function(marker:table):table -- Adds the marker to the end of the marker list")
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] addMarker(Context context, Arguments args) throws LuaException {
|
||||
return addMarkerImplementation(args.checkTable(0));
|
||||
}
|
||||
@Callback(doc = "function(marker:table):table -- Adds the marker to the end of the marker list")
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] addMarker(Context context, Arguments args) throws LuaException {
|
||||
return addMarkerImplementation(args.checkTable(0));
|
||||
}
|
||||
|
||||
@Callback(doc = "function(markerNum:number,marker:table):table -- saves current marker")
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] saveMarker(Context context, Arguments args) throws LuaException {
|
||||
return saveMarkerImplementation((double) args.checkInteger(0), args.checkTable(0));
|
||||
}
|
||||
@Callback(doc = "function(markerNum:number,marker:table):table -- saves current marker")
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] saveMarker(Context context, Arguments args) throws LuaException {
|
||||
return saveMarkerImplementation((double) args.checkInteger(0), args.checkTable(0));
|
||||
}
|
||||
|
||||
@Callback(doc = "function(markerNum:number):table -- Deletes marker number")
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] deleteMarker(Context context, Arguments args) throws LuaException {
|
||||
return deleteMarkerImplementation((double) args.checkInteger(0));
|
||||
}
|
||||
@Callback(doc = "function(markerNum:number):table -- Deletes marker number")
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] deleteMarker(Context context, Arguments args) throws LuaException {
|
||||
return deleteMarkerImplementation((double) args.checkInteger(0));
|
||||
}
|
||||
|
||||
@Callback(doc = "function(markerNum:number):table -- gets a specific marker")
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getMarker(Context context, Arguments args) throws LuaException {
|
||||
return getMarkerImplementation((double) args.checkInteger(0));
|
||||
}
|
||||
@Callback(doc = "function(markerNum:number):table -- gets a specific marker")
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getMarker(Context context, Arguments args) throws LuaException {
|
||||
return getMarkerImplementation((double) args.checkInteger(0));
|
||||
}
|
||||
|
||||
@Callback(doc = "function():number -- Returns number of markers")
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getMarkerCount(Context context, Arguments args) throws LuaException {
|
||||
return getMarkerCountImplementation();
|
||||
}
|
||||
@Callback(doc = "function():number -- Returns number of markers")
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getMarkerCount(Context context, Arguments args) throws LuaException {
|
||||
return getMarkerCountImplementation();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -15,11 +15,9 @@ import java.util.Random;
|
||||
* Created by pixlepix on 8/4/14.
|
||||
*/
|
||||
public class TileInfusedFarmland extends TileEntity implements IAspectContainer {
|
||||
public AspectList aspectList = new AspectList();
|
||||
|
||||
public static final int MAX_ASPECTS = 20;
|
||||
|
||||
public static final String NBT_ASPECT_LIST = "aspectList";
|
||||
public AspectList aspectList = new AspectList();
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbt) {
|
||||
|
||||
@@ -12,7 +12,6 @@ import thaumcraft.api.aspects.Aspect;
|
||||
import thaumcraft.api.aspects.AspectList;
|
||||
import thaumcraft.api.aspects.IAspectContainer;
|
||||
import thaumic.tinkerer.common.ThaumicTinkerer;
|
||||
import thaumic.tinkerer.common.block.BlockInfusedGrain;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
@@ -21,11 +20,10 @@ import java.util.Random;
|
||||
*/
|
||||
public class TileInfusedGrain extends TileEntity implements IAspectContainer {
|
||||
|
||||
public Aspect aspect;
|
||||
public AspectList primalTendencies = new AspectList();
|
||||
|
||||
private final String NBT_MAIN_ASPECT = "mainAspect";
|
||||
private final String NBT_ASPEPCT_TENDENCIES = "aspectTendencies";
|
||||
public Aspect aspect;
|
||||
public AspectList primalTendencies = new AspectList();
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbt) {
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
package thaumic.tinkerer.common.block.tile;
|
||||
|
||||
import appeng.api.movable.IMovableTile;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.Optional;
|
||||
import dan200.computercraft.api.lua.ILuaContext;
|
||||
import dan200.computercraft.api.peripheral.IComputerAccess;
|
||||
@@ -37,144 +36,144 @@ import thaumic.tinkerer.common.core.helper.MiscHelper;
|
||||
import java.util.List;
|
||||
|
||||
@Optional.InterfaceList({
|
||||
@Optional.Interface(iface = "li.cil.oc.api.network.SimpleComponent", modid = "OpenComputers"),
|
||||
@Optional.Interface(iface = "dan200.computercraft.api.peripheral.IPeripheral", modid = "ComputerCraft")
|
||||
@Optional.Interface(iface = "li.cil.oc.api.network.SimpleComponent", modid = "OpenComputers"),
|
||||
@Optional.Interface(iface = "dan200.computercraft.api.peripheral.IPeripheral", modid = "ComputerCraft")
|
||||
})
|
||||
public class TileMagnet extends TileEntity implements IPeripheral, IMovableTile, SimpleComponent {
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
int redstone = 0;
|
||||
for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS)
|
||||
redstone = Math.max(redstone, worldObj.getIndirectPowerLevelTo(xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ, dir.ordinal()));
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
int redstone = 0;
|
||||
for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS)
|
||||
redstone = Math.max(redstone, worldObj.getIndirectPowerLevelTo(xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ, dir.ordinal()));
|
||||
|
||||
if (redstone > 0) {
|
||||
double x1 = xCoord + 0.5;
|
||||
double y1 = yCoord + 0.5;
|
||||
double z1 = zCoord + 0.5;
|
||||
if (redstone > 0) {
|
||||
double x1 = xCoord + 0.5;
|
||||
double y1 = yCoord + 0.5;
|
||||
double z1 = zCoord + 0.5;
|
||||
|
||||
boolean blue = (getBlockMetadata() & 1) == 0;
|
||||
int speedMod = blue ? 1 : -1;
|
||||
double range = redstone / 2;
|
||||
boolean blue = (getBlockMetadata() & 1) == 0;
|
||||
int speedMod = blue ? 1 : -1;
|
||||
double range = redstone / 2;
|
||||
|
||||
AxisAlignedBB boundingBox = AxisAlignedBB.getBoundingBox(x1 - range, yCoord, z1 - range, x1 + range, y1 + range, z1 + range);
|
||||
List<Entity> entities = worldObj.selectEntitiesWithinAABB(Entity.class, boundingBox, getEntitySelector());
|
||||
AxisAlignedBB boundingBox = AxisAlignedBB.getBoundingBox(x1 - range, yCoord, z1 - range, x1 + range, y1 + range, z1 + range);
|
||||
List<Entity> entities = worldObj.selectEntitiesWithinAABB(Entity.class, boundingBox, getEntitySelector());
|
||||
|
||||
for (Entity entity : entities) {
|
||||
double x2 = entity.posX;
|
||||
double y2 = entity.posY;
|
||||
double z2 = entity.posZ;
|
||||
for (Entity entity : entities) {
|
||||
double x2 = entity.posX;
|
||||
double y2 = entity.posY;
|
||||
double z2 = entity.posZ;
|
||||
|
||||
float distanceSqrd = blue ? (float) ((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2) + (z1 - z2) * (z1 - z2)) : 1.1F;
|
||||
float distanceSqrd = blue ? (float) ((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2) + (z1 - z2) * (z1 - z2)) : 1.1F;
|
||||
|
||||
if (distanceSqrd > 1) {
|
||||
MiscHelper.setEntityMotionFromVector(entity, new Vector3(x1, y1, z1), speedMod * 0.25F);
|
||||
ThaumicTinkerer.tcProxy.sparkle((float) x2, (float) y2, (float) z2, blue ? 2 : 4);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (distanceSqrd > 1) {
|
||||
MiscHelper.setEntityMotionFromVector(entity, new Vector3(x1, y1, z1), speedMod * 0.25F);
|
||||
ThaumicTinkerer.tcProxy.sparkle((float) x2, (float) y2, (float) z2, blue ? 2 : 4);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
IEntitySelector getEntitySelector() {
|
||||
return new IEntitySelector() {
|
||||
IEntitySelector getEntitySelector() {
|
||||
return new IEntitySelector() {
|
||||
|
||||
@Override
|
||||
public boolean isEntityApplicable(Entity entity) {
|
||||
return entity instanceof EntityItem;
|
||||
}
|
||||
@Override
|
||||
public boolean isEntityApplicable(Entity entity) {
|
||||
return entity instanceof EntityItem;
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType() {
|
||||
return "tt_magnet";
|
||||
}
|
||||
@Override
|
||||
public String getType() {
|
||||
return "tt_magnet";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getMethodNames() {
|
||||
return new String[]{ "isPulling", "setPulling", "getSignal" };
|
||||
}
|
||||
@Override
|
||||
public String[] getMethodNames() {
|
||||
return new String[]{"isPulling", "setPulling", "getSignal"};
|
||||
}
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid = "ComputerCraft")
|
||||
public Object[] callMethod(IComputerAccess computer, ILuaContext context, int method, Object[] arguments) {
|
||||
switch (method) {
|
||||
case 0:
|
||||
return new Object[]{ (getBlockMetadata() & 1) == 0 };
|
||||
case 1:
|
||||
return setPullingImplementation((Boolean) arguments[0]);
|
||||
case 2:
|
||||
return gotSignalImplementation();
|
||||
}
|
||||
@Override
|
||||
@Optional.Method(modid = "ComputerCraft")
|
||||
public Object[] callMethod(IComputerAccess computer, ILuaContext context, int method, Object[] arguments) {
|
||||
switch (method) {
|
||||
case 0:
|
||||
return new Object[]{(getBlockMetadata() & 1) == 0};
|
||||
case 1:
|
||||
return setPullingImplementation((Boolean) arguments[0]);
|
||||
case 2:
|
||||
return gotSignalImplementation();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private Object[] gotSignalImplementation() {
|
||||
int redstone = 0;
|
||||
for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS)
|
||||
redstone = Math.max(redstone, worldObj.getIndirectPowerLevelTo(xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ, dir.ordinal()));
|
||||
private Object[] gotSignalImplementation() {
|
||||
int redstone = 0;
|
||||
for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS)
|
||||
redstone = Math.max(redstone, worldObj.getIndirectPowerLevelTo(xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ, dir.ordinal()));
|
||||
|
||||
return new Object[]{ redstone };
|
||||
}
|
||||
return new Object[]{redstone};
|
||||
}
|
||||
|
||||
private Object[] setPullingImplementation(boolean argument) {
|
||||
int meta = (getBlockMetadata() & 2) + (argument ? 0 : 1);
|
||||
private Object[] setPullingImplementation(boolean argument) {
|
||||
int meta = (getBlockMetadata() & 2) + (argument ? 0 : 1);
|
||||
|
||||
worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, meta, 1 | 2);
|
||||
return null;
|
||||
}
|
||||
worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, meta, 1 | 2);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid = "ComputerCraft")
|
||||
public void attach(IComputerAccess computer) {
|
||||
// NO-OP
|
||||
}
|
||||
@Override
|
||||
@Optional.Method(modid = "ComputerCraft")
|
||||
public void attach(IComputerAccess computer) {
|
||||
// NO-OP
|
||||
}
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid = "ComputerCraft")
|
||||
public void detach(IComputerAccess computer) {
|
||||
// NO-OP
|
||||
}
|
||||
@Override
|
||||
@Optional.Method(modid = "ComputerCraft")
|
||||
public void detach(IComputerAccess computer) {
|
||||
// NO-OP
|
||||
}
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid = "ComputerCraft")
|
||||
public boolean equals(IPeripheral other) {
|
||||
return this.equals((Object) other);
|
||||
}
|
||||
@Override
|
||||
@Optional.Method(modid = "ComputerCraft")
|
||||
public boolean equals(IPeripheral other) {
|
||||
return this.equals((Object) other);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean prepareToMove() {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean prepareToMove() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doneMoving() {
|
||||
@Override
|
||||
public void doneMoving() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Callback(doc = "function():boolean -- Returns Whether magnet is pushing or pulling")
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] isPulling(Context context, Arguments args) throws Exception {
|
||||
return new Object[]{ (getBlockMetadata() & 1) == 0 };
|
||||
}
|
||||
@Callback(doc = "function():boolean -- Returns Whether magnet is pushing or pulling")
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] isPulling(Context context, Arguments args) throws Exception {
|
||||
return new Object[]{(getBlockMetadata() & 1) == 0};
|
||||
}
|
||||
|
||||
@Callback(doc = "function(boolean):nil -- Sets Whether magnet is pushing or pulling")
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] setPulling(Context context, Arguments args) throws Exception {
|
||||
setPullingImplementation(args.checkBoolean(0));
|
||||
return new Object[]{ };
|
||||
}
|
||||
@Callback(doc = "function(boolean):nil -- Sets Whether magnet is pushing or pulling")
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] setPulling(Context context, Arguments args) throws Exception {
|
||||
setPullingImplementation(args.checkBoolean(0));
|
||||
return new Object[]{};
|
||||
}
|
||||
|
||||
@Callback(doc = "function():boolean -- Sets Whether magnet is pushing or pulling")
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getSignal(Context context, Arguments args) throws Exception {
|
||||
return gotSignalImplementation();
|
||||
}
|
||||
@Callback(doc = "function():boolean -- Sets Whether magnet is pushing or pulling")
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getSignal(Context context, Arguments args) throws Exception {
|
||||
return gotSignalImplementation();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getComponentName() {
|
||||
return this.getType();
|
||||
}
|
||||
@Override
|
||||
public String getComponentName() {
|
||||
return this.getType();
|
||||
}
|
||||
}
|
||||
@@ -17,7 +17,6 @@ package thaumic.tinkerer.common.block.tile;
|
||||
import appeng.api.movable.IMovableTile;
|
||||
import cpw.mods.fml.common.Optional;
|
||||
import dan200.computercraft.api.lua.ILuaContext;
|
||||
import dan200.computercraft.api.lua.LuaException;
|
||||
import dan200.computercraft.api.peripheral.IComputerAccess;
|
||||
import li.cil.oc.api.network.Arguments;
|
||||
import li.cil.oc.api.network.Callback;
|
||||
@@ -40,222 +39,220 @@ import thaumic.tinkerer.common.lib.LibBlockNames;
|
||||
|
||||
public class TileMobMagnet extends TileMagnet implements IInventory, IMovableTile {
|
||||
|
||||
private static final String TAG_ADULT = "adultCheck";
|
||||
private static final String TAG_ADULT = "adultCheck";
|
||||
public boolean adult = true;
|
||||
ItemStack[] inventorySlots = new ItemStack[1];
|
||||
|
||||
ItemStack[] inventorySlots = new ItemStack[1];
|
||||
@Override
|
||||
IEntitySelector getEntitySelector() {
|
||||
return new IEntitySelector() {
|
||||
|
||||
public boolean adult = true;
|
||||
@Override
|
||||
public boolean isEntityApplicable(Entity entity) {
|
||||
if (!(entity instanceof EntityLivingBase) || entity instanceof EntityPlayer)
|
||||
return false;
|
||||
|
||||
@Override
|
||||
IEntitySelector getEntitySelector() {
|
||||
return new IEntitySelector() {
|
||||
boolean can = false;
|
||||
if (entity instanceof EntityAgeable)
|
||||
can = adult != ((EntityAgeable) entity).isChild();
|
||||
else can = true;
|
||||
|
||||
@Override
|
||||
public boolean isEntityApplicable(Entity entity) {
|
||||
if (!(entity instanceof EntityLivingBase) || entity instanceof EntityPlayer)
|
||||
return false;
|
||||
if (can && inventorySlots[0] != null) {
|
||||
String pattern = ItemSoulMould.getPatternName(inventorySlots[0]);
|
||||
String name = EntityList.getEntityString(entity);
|
||||
return name != null && name.equals(pattern);
|
||||
}
|
||||
|
||||
boolean can = false;
|
||||
if (entity instanceof EntityAgeable)
|
||||
can = adult != ((EntityAgeable) entity).isChild();
|
||||
else can = true;
|
||||
return can;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
if (can && inventorySlots[0] != null) {
|
||||
String pattern = ItemSoulMould.getPatternName(inventorySlots[0]);
|
||||
String name = EntityList.getEntityString(entity);
|
||||
return name != null && name.equals(pattern);
|
||||
}
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound par1NBTTagCompound) {
|
||||
super.readFromNBT(par1NBTTagCompound);
|
||||
|
||||
return can;
|
||||
}
|
||||
};
|
||||
}
|
||||
readCustomNBT(par1NBTTagCompound);
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound par1NBTTagCompound) {
|
||||
super.readFromNBT(par1NBTTagCompound);
|
||||
}
|
||||
|
||||
readCustomNBT(par1NBTTagCompound);
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound par1NBTTagCompound) {
|
||||
super.writeToNBT(par1NBTTagCompound);
|
||||
|
||||
}
|
||||
writeCustomNBT(par1NBTTagCompound);
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound par1NBTTagCompound) {
|
||||
super.writeToNBT(par1NBTTagCompound);
|
||||
}
|
||||
|
||||
writeCustomNBT(par1NBTTagCompound);
|
||||
public void readCustomNBT(NBTTagCompound par1NBTTagCompound) {
|
||||
adult = par1NBTTagCompound.getBoolean(TAG_ADULT);
|
||||
NBTTagList var2 = par1NBTTagCompound.getTagList("Items", Constants.NBT.TAG_COMPOUND);
|
||||
inventorySlots = new ItemStack[getSizeInventory()];
|
||||
for (int var3 = 0; var3 < var2.tagCount(); ++var3) {
|
||||
NBTTagCompound var4 = var2.getCompoundTagAt(var3);
|
||||
byte var5 = var4.getByte("Slot");
|
||||
if (var5 >= 0 && var5 < inventorySlots.length)
|
||||
inventorySlots[var5] = ItemStack.loadItemStackFromNBT(var4);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
public void writeCustomNBT(NBTTagCompound par1NBTTagCompound) {
|
||||
par1NBTTagCompound.setBoolean(TAG_ADULT, adult);
|
||||
NBTTagList var2 = new NBTTagList();
|
||||
for (int var3 = 0; var3 < inventorySlots.length; ++var3) {
|
||||
if (inventorySlots[var3] != null) {
|
||||
NBTTagCompound var4 = new NBTTagCompound();
|
||||
var4.setByte("Slot", (byte) var3);
|
||||
inventorySlots[var3].writeToNBT(var4);
|
||||
var2.appendTag(var4);
|
||||
}
|
||||
}
|
||||
par1NBTTagCompound.setTag("Items", var2);
|
||||
}
|
||||
|
||||
public void readCustomNBT(NBTTagCompound par1NBTTagCompound) {
|
||||
adult = par1NBTTagCompound.getBoolean(TAG_ADULT);
|
||||
NBTTagList var2 = par1NBTTagCompound.getTagList("Items", Constants.NBT.TAG_COMPOUND);
|
||||
inventorySlots = new ItemStack[getSizeInventory()];
|
||||
for (int var3 = 0; var3 < var2.tagCount(); ++var3) {
|
||||
NBTTagCompound var4 = var2.getCompoundTagAt(var3);
|
||||
byte var5 = var4.getByte("Slot");
|
||||
if (var5 >= 0 && var5 < inventorySlots.length)
|
||||
inventorySlots[var5] = ItemStack.loadItemStackFromNBT(var4);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public int getSizeInventory() {
|
||||
return inventorySlots.length;
|
||||
}
|
||||
|
||||
public void writeCustomNBT(NBTTagCompound par1NBTTagCompound) {
|
||||
par1NBTTagCompound.setBoolean(TAG_ADULT, adult);
|
||||
NBTTagList var2 = new NBTTagList();
|
||||
for (int var3 = 0; var3 < inventorySlots.length; ++var3) {
|
||||
if (inventorySlots[var3] != null) {
|
||||
NBTTagCompound var4 = new NBTTagCompound();
|
||||
var4.setByte("Slot", (byte) var3);
|
||||
inventorySlots[var3].writeToNBT(var4);
|
||||
var2.appendTag(var4);
|
||||
}
|
||||
}
|
||||
par1NBTTagCompound.setTag("Items", var2);
|
||||
}
|
||||
@Override
|
||||
public ItemStack getStackInSlot(int i) {
|
||||
return inventorySlots[i];
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSizeInventory() {
|
||||
return inventorySlots.length;
|
||||
}
|
||||
@Override
|
||||
public void validate() {
|
||||
super.validate();
|
||||
//markDirty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlot(int i) {
|
||||
return inventorySlots[i];
|
||||
}
|
||||
@Override
|
||||
public ItemStack decrStackSize(int i, int j) {
|
||||
if (inventorySlots[i] != null) {
|
||||
ItemStack stackAt;
|
||||
|
||||
@Override
|
||||
public void validate() {
|
||||
super.validate();
|
||||
//markDirty();
|
||||
}
|
||||
if (inventorySlots[i].stackSize <= j) {
|
||||
stackAt = inventorySlots[i];
|
||||
inventorySlots[i] = null;
|
||||
markDirty();
|
||||
return stackAt;
|
||||
} else {
|
||||
stackAt = inventorySlots[i].splitStack(j);
|
||||
|
||||
@Override
|
||||
public ItemStack decrStackSize(int i, int j) {
|
||||
if (inventorySlots[i] != null) {
|
||||
ItemStack stackAt;
|
||||
if (inventorySlots[i].stackSize == 0)
|
||||
inventorySlots[i] = null;
|
||||
markDirty();
|
||||
return stackAt;
|
||||
}
|
||||
}
|
||||
|
||||
if (inventorySlots[i].stackSize <= j) {
|
||||
stackAt = inventorySlots[i];
|
||||
inventorySlots[i] = null;
|
||||
markDirty();
|
||||
return stackAt;
|
||||
} else {
|
||||
stackAt = inventorySlots[i].splitStack(j);
|
||||
return null;
|
||||
}
|
||||
|
||||
if (inventorySlots[i].stackSize == 0)
|
||||
inventorySlots[i] = null;
|
||||
markDirty();
|
||||
return stackAt;
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public ItemStack getStackInSlotOnClosing(int i) {
|
||||
return getStackInSlot(i);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public void setInventorySlotContents(int i, ItemStack itemstack) {
|
||||
inventorySlots[i] = itemstack;
|
||||
markDirty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlotOnClosing(int i) {
|
||||
return getStackInSlot(i);
|
||||
}
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return LibBlockNames.MAGNET;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInventorySlotContents(int i, ItemStack itemstack) {
|
||||
inventorySlots[i] = itemstack;
|
||||
markDirty();
|
||||
}
|
||||
@Override
|
||||
public boolean hasCustomInventoryName() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return LibBlockNames.MAGNET;
|
||||
}
|
||||
@Override
|
||||
public int getInventoryStackLimit() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCustomInventoryName() {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean isUseableByPlayer(EntityPlayer entityplayer) {
|
||||
return worldObj.getTileEntity(xCoord, yCoord, zCoord) == this && entityplayer.getDistanceSq(xCoord + 0.5D, yCoord + 0.5D, zCoord + 0.5D) <= 64;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInventoryStackLimit() {
|
||||
return 1;
|
||||
}
|
||||
@Override
|
||||
public void openInventory() {
|
||||
|
||||
@Override
|
||||
public boolean isUseableByPlayer(EntityPlayer entityplayer) {
|
||||
return worldObj.getTileEntity(xCoord, yCoord, zCoord) == this && entityplayer.getDistanceSq(xCoord + 0.5D, yCoord + 0.5D, zCoord + 0.5D) <= 64;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openInventory() {
|
||||
@Override
|
||||
public void closeInventory() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeInventory() {
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int i, ItemStack itemstack) {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@Override
|
||||
public String[] getMethodNames() {
|
||||
return new String[]{"isPulling", "setPulling", "getSignal", "getAdultSearch", "setAdultSearch"};
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int i, ItemStack itemstack) {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
@Optional.Method(modid = "ComputerCraft")
|
||||
public Object[] callMethod(IComputerAccess computer, ILuaContext context, int method, Object[] arguments) {
|
||||
switch (method) {
|
||||
case 3:
|
||||
return new Object[]{adult};
|
||||
case 4:
|
||||
return setAdultSearchImplementation((Boolean) arguments[0]);
|
||||
}
|
||||
return super.callMethod(computer, context, method, arguments);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getMethodNames() {
|
||||
return new String[]{ "isPulling", "setPulling", "getSignal", "getAdultSearch", "setAdultSearch" };
|
||||
}
|
||||
private Object[] setAdultSearchImplementation(boolean argument) {
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid = "ComputerCraft")
|
||||
public Object[] callMethod(IComputerAccess computer, ILuaContext context, int method, Object[] arguments){
|
||||
switch (method) {
|
||||
case 3:
|
||||
return new Object[]{ adult };
|
||||
case 4:
|
||||
return setAdultSearchImplementation((Boolean) arguments[0]);
|
||||
}
|
||||
return super.callMethod(computer, context, method, arguments);
|
||||
}
|
||||
this.adult = argument;
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
return null;
|
||||
}
|
||||
|
||||
private Object[] setAdultSearchImplementation(boolean argument) {
|
||||
@Callback(doc = "function():boolean -- Gets Whether magnet is searching for adults")
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getAdultSearch(Context context, Arguments args) throws Exception {
|
||||
return new Object[]{adult};
|
||||
}
|
||||
|
||||
this.adult = argument;
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
return null;
|
||||
}
|
||||
@Callback(doc = "function(boolean):nil -- Sets Whether magnet is searching for adults")
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] setAdultSearch(Context context, Arguments args) throws Exception {
|
||||
setAdultSearchImplementation(args.checkBoolean(0));
|
||||
return new Object[]{};
|
||||
}
|
||||
|
||||
@Callback(doc = "function():boolean -- Gets Whether magnet is searching for adults")
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getAdultSearch(Context context, Arguments args) throws Exception {
|
||||
return new Object[]{ adult };
|
||||
}
|
||||
@Override
|
||||
public S35PacketUpdateTileEntity getDescriptionPacket() {
|
||||
NBTTagCompound nbttagcompound = new NBTTagCompound();
|
||||
writeCustomNBT(nbttagcompound);
|
||||
return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, -999, nbttagcompound);
|
||||
}
|
||||
|
||||
@Callback(doc = "function(boolean):nil -- Sets Whether magnet is searching for adults")
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] setAdultSearch(Context context, Arguments args) throws Exception {
|
||||
setAdultSearchImplementation(args.checkBoolean(0));
|
||||
return new Object[]{ };
|
||||
}
|
||||
@Override
|
||||
public void onDataPacket(NetworkManager manager, S35PacketUpdateTileEntity packet) {
|
||||
super.onDataPacket(manager, packet);
|
||||
readCustomNBT(packet.func_148857_g());
|
||||
}
|
||||
|
||||
@Override
|
||||
public S35PacketUpdateTileEntity getDescriptionPacket() {
|
||||
NBTTagCompound nbttagcompound = new NBTTagCompound();
|
||||
writeCustomNBT(nbttagcompound);
|
||||
return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, -999, nbttagcompound);
|
||||
}
|
||||
@Override
|
||||
public boolean prepareToMove() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDataPacket(NetworkManager manager, S35PacketUpdateTileEntity packet) {
|
||||
super.onDataPacket(manager, packet);
|
||||
readCustomNBT(packet.func_148857_g());
|
||||
}
|
||||
@Override
|
||||
public void doneMoving() {
|
||||
|
||||
@Override
|
||||
public boolean prepareToMove() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doneMoving() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -20,19 +20,19 @@ import thaumic.tinkerer.common.lib.LibBlockNames;
|
||||
/**
|
||||
* Created by nekosune on 30/06/14.
|
||||
*/
|
||||
public class TileRPlacer extends TileCamo implements IInventory{
|
||||
public class TileRPlacer extends TileCamo implements IInventory {
|
||||
private static final String TAG_ORIENTATION = "orientation";
|
||||
private static final String TAG_BLOCKS = "blocks";
|
||||
public int orientation;
|
||||
public int blocks = 1;
|
||||
ItemStack[] inventorySlots = new ItemStack[1];
|
||||
public int blocks=1;
|
||||
|
||||
@Override
|
||||
public void readCustomNBT(NBTTagCompound cmp) {
|
||||
super.readCustomNBT(cmp);
|
||||
|
||||
orientation = cmp.getInteger(TAG_ORIENTATION);
|
||||
blocks=cmp.getInteger(TAG_BLOCKS);
|
||||
blocks = cmp.getInteger(TAG_BLOCKS);
|
||||
NBTTagList var2 = cmp.getTagList("Items", Constants.NBT.TAG_COMPOUND);
|
||||
inventorySlots = new ItemStack[getSizeInventory()];
|
||||
for (int var3 = 0; var3 < var2.tagCount(); ++var3) {
|
||||
@@ -58,7 +58,7 @@ public class TileRPlacer extends TileCamo implements IInventory{
|
||||
super.writeCustomNBT(cmp);
|
||||
|
||||
cmp.setInteger(TAG_ORIENTATION, orientation);
|
||||
cmp.setInteger(TAG_BLOCKS,blocks);
|
||||
cmp.setInteger(TAG_BLOCKS, blocks);
|
||||
NBTTagList var2 = new NBTTagList();
|
||||
for (int var3 = 0; var3 < inventorySlots.length; ++var3) {
|
||||
if (inventorySlots[var3] != null) {
|
||||
@@ -157,6 +157,7 @@ public class TileRPlacer extends TileCamo implements IInventory{
|
||||
public boolean isItemValidForSlot(int var1, ItemStack var2) {
|
||||
return var2.getItem() instanceof ItemBlock;
|
||||
}
|
||||
|
||||
@Override
|
||||
public S35PacketUpdateTileEntity getDescriptionPacket() {
|
||||
NBTTagCompound nbttagcompound = new NBTTagCompound();
|
||||
@@ -171,67 +172,65 @@ public class TileRPlacer extends TileCamo implements IInventory{
|
||||
}
|
||||
|
||||
public void receiveRedstonePulse() {
|
||||
if(worldObj.isRemote)
|
||||
if (worldObj.isRemote)
|
||||
return;
|
||||
if(this.inventorySlots[0]!=null)
|
||||
{
|
||||
int x,y,z=0;
|
||||
x=0;
|
||||
y=0;
|
||||
switch(orientation)
|
||||
{
|
||||
if (this.inventorySlots[0] != null) {
|
||||
int x, y, z = 0;
|
||||
x = 0;
|
||||
y = 0;
|
||||
switch (orientation) {
|
||||
case 0:
|
||||
x=this.xCoord;
|
||||
y=this.yCoord-this.blocks;
|
||||
z=this.zCoord;
|
||||
x = this.xCoord;
|
||||
y = this.yCoord - this.blocks;
|
||||
z = this.zCoord;
|
||||
break;
|
||||
case 1:
|
||||
x=this.xCoord;
|
||||
y=this.yCoord+this.blocks;
|
||||
z=this.zCoord;
|
||||
x = this.xCoord;
|
||||
y = this.yCoord + this.blocks;
|
||||
z = this.zCoord;
|
||||
break;
|
||||
case 2:
|
||||
x=this.xCoord;
|
||||
y=this.yCoord;
|
||||
z=this.zCoord-this.blocks;
|
||||
x = this.xCoord;
|
||||
y = this.yCoord;
|
||||
z = this.zCoord - this.blocks;
|
||||
break;
|
||||
case 3:
|
||||
x=this.xCoord;
|
||||
y=this.yCoord;
|
||||
z=this.zCoord+this.blocks;
|
||||
x = this.xCoord;
|
||||
y = this.yCoord;
|
||||
z = this.zCoord + this.blocks;
|
||||
break;
|
||||
case 4:
|
||||
x=this.xCoord-this.blocks;
|
||||
y=this.yCoord;
|
||||
z=this.zCoord;
|
||||
x = this.xCoord - this.blocks;
|
||||
y = this.yCoord;
|
||||
z = this.zCoord;
|
||||
break;
|
||||
case 5:
|
||||
x=this.xCoord-this.blocks;
|
||||
y=this.yCoord;
|
||||
z=this.zCoord;
|
||||
x = this.xCoord - this.blocks;
|
||||
y = this.yCoord;
|
||||
z = this.zCoord;
|
||||
break;
|
||||
}
|
||||
//if(this.inventorySlots[0].getItem() instanceof ItemBlock) {
|
||||
if (this.worldObj.getBlock(x, y, z) == Blocks.air) {
|
||||
//if (this.worldObj.setBlock(x, y, z, ((ItemBlock) this.inventorySlots[0].getItem()).field_150939_a, this.inventorySlots[0].getItemDamage(), 1 | 2)) {
|
||||
// this.decrStackSize(0, 1);
|
||||
// markDirty();
|
||||
//Block block = worldObj.getBlock(x, y, z);
|
||||
boolean done=false;
|
||||
FakePlayer player=FakePlayerFactory.getMinecraft((WorldServer)worldObj);
|
||||
Item item=inventorySlots[0].getItem();
|
||||
ItemStack stack=inventorySlots[0];
|
||||
if (!done)
|
||||
item.onItemUseFirst(stack, player, worldObj, x, y, z, ForgeDirection.OPPOSITES[orientation], 0F, 0F, 0F);
|
||||
if (!done)
|
||||
done = item.onItemUse(stack, player, worldObj, x, y, z, ForgeDirection.OPPOSITES[orientation], 0F, 0F, 0F);
|
||||
if (!done) {
|
||||
item.onItemRightClick(stack, worldObj, player);
|
||||
done = true;
|
||||
}
|
||||
if (this.worldObj.getBlock(x, y, z) == Blocks.air) {
|
||||
//if (this.worldObj.setBlock(x, y, z, ((ItemBlock) this.inventorySlots[0].getItem()).field_150939_a, this.inventorySlots[0].getItemDamage(), 1 | 2)) {
|
||||
// this.decrStackSize(0, 1);
|
||||
// markDirty();
|
||||
//Block block = worldObj.getBlock(x, y, z);
|
||||
boolean done = false;
|
||||
FakePlayer player = FakePlayerFactory.getMinecraft((WorldServer) worldObj);
|
||||
Item item = inventorySlots[0].getItem();
|
||||
ItemStack stack = inventorySlots[0];
|
||||
if (!done)
|
||||
item.onItemUseFirst(stack, player, worldObj, x, y, z, ForgeDirection.OPPOSITES[orientation], 0F, 0F, 0F);
|
||||
if (!done)
|
||||
done = item.onItemUse(stack, player, worldObj, x, y, z, ForgeDirection.OPPOSITES[orientation], 0F, 0F, 0F);
|
||||
if (!done) {
|
||||
item.onItemRightClick(stack, worldObj, player);
|
||||
done = true;
|
||||
}
|
||||
|
||||
}
|
||||
//}
|
||||
}
|
||||
//}
|
||||
//}
|
||||
|
||||
}
|
||||
|
||||
@@ -43,345 +43,343 @@ import java.util.Map;
|
||||
|
||||
public class TileRepairer extends TileEntity implements ISidedInventory, IAspectContainer, IEssentiaTransport, IMovableTile {
|
||||
|
||||
int dmgLastTick = 0;
|
||||
public int ticksExisted = 0;
|
||||
public boolean tookLastTick = true;
|
||||
private static final Map<Aspect, Integer> repairValues = new HashMap();
|
||||
private static final Map<Aspect, Integer> repairValues = new HashMap();
|
||||
static {
|
||||
repairValues.put(Aspect.TOOL, 8);
|
||||
repairValues.put(Aspect.CRAFT, 5);
|
||||
repairValues.put(Aspect.ORDER, 3);
|
||||
}
|
||||
public int ticksExisted = 0;
|
||||
public boolean tookLastTick = true;
|
||||
int dmgLastTick = 0;
|
||||
ItemStack[] inventorySlots = new ItemStack[1];
|
||||
|
||||
static {
|
||||
repairValues.put(Aspect.TOOL, 8);
|
||||
repairValues.put(Aspect.CRAFT, 5);
|
||||
repairValues.put(Aspect.ORDER, 3);
|
||||
}
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
if (++ticksExisted % 10 == 0) {
|
||||
if (Loader.isModLoaded("TConstruct") && ConfigHandler.repairTConTools) {
|
||||
if (inventorySlots[0] != null) {
|
||||
if (TinkersConstructCompat.isTConstructTool(inventorySlots[0])) {
|
||||
int dmg = TinkersConstructCompat.getDamage(inventorySlots[0]);
|
||||
if (dmg > 0) {
|
||||
int essentia = drawEssentia();
|
||||
TinkersConstructCompat.fixDamage(inventorySlots[0], essentia);
|
||||
markDirty();
|
||||
if (dmgLastTick != 0 && dmgLastTick != dmg) {
|
||||
ThaumicTinkerer.tcProxy.sparkle((float) (xCoord + 0.25 + Math.random() / 2F), (float) (yCoord + 1 + Math.random() / 2F), (float) (zCoord + 0.25 + Math.random() / 2F), 0);
|
||||
tookLastTick = true;
|
||||
} else tookLastTick = false;
|
||||
} else tookLastTick = false;
|
||||
dmgLastTick = inventorySlots[0] == null ? 0 : TinkersConstructCompat.getDamage(inventorySlots[0]);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (inventorySlots[0] != null && inventorySlots[0].getItemDamage() > 0) {
|
||||
int essentia = drawEssentia();
|
||||
int dmg = inventorySlots[0].getItemDamage();
|
||||
inventorySlots[0].setItemDamage(Math.max(0, dmg - essentia));
|
||||
markDirty();
|
||||
|
||||
ItemStack[] inventorySlots = new ItemStack[1];
|
||||
if (dmgLastTick != 0 && dmgLastTick != dmg) {
|
||||
ThaumicTinkerer.tcProxy.sparkle((float) (xCoord + 0.25 + Math.random() / 2F), (float) (yCoord + 1 + Math.random() / 2F), (float) (zCoord + 0.25 + Math.random() / 2F), 0);
|
||||
tookLastTick = true;
|
||||
} else tookLastTick = false;
|
||||
} else tookLastTick = false;
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
if (++ticksExisted % 10 == 0) {
|
||||
if (Loader.isModLoaded("TConstruct") && ConfigHandler.repairTConTools) {
|
||||
if (inventorySlots[0] != null) {
|
||||
if (TinkersConstructCompat.isTConstructTool(inventorySlots[0])) {
|
||||
int dmg = TinkersConstructCompat.getDamage(inventorySlots[0]);
|
||||
if (dmg > 0) {
|
||||
int essentia = drawEssentia();
|
||||
TinkersConstructCompat.fixDamage(inventorySlots[0], essentia);
|
||||
markDirty();
|
||||
if (dmgLastTick != 0 && dmgLastTick != dmg) {
|
||||
ThaumicTinkerer.tcProxy.sparkle((float) (xCoord + 0.25 + Math.random() / 2F), (float) (yCoord + 1 + Math.random() / 2F), (float) (zCoord + 0.25 + Math.random() / 2F), 0);
|
||||
tookLastTick = true;
|
||||
} else tookLastTick = false;
|
||||
} else tookLastTick = false;
|
||||
dmgLastTick = inventorySlots[0] == null ? 0 : TinkersConstructCompat.getDamage(inventorySlots[0]);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (inventorySlots[0] != null && inventorySlots[0].getItemDamage() > 0) {
|
||||
int essentia = drawEssentia();
|
||||
int dmg = inventorySlots[0].getItemDamage();
|
||||
inventorySlots[0].setItemDamage(Math.max(0, dmg - essentia));
|
||||
markDirty();
|
||||
dmgLastTick = inventorySlots[0] == null ? 0 : inventorySlots[0].getItemDamage();
|
||||
}
|
||||
}
|
||||
|
||||
if (dmgLastTick != 0 && dmgLastTick != dmg) {
|
||||
ThaumicTinkerer.tcProxy.sparkle((float) (xCoord + 0.25 + Math.random() / 2F), (float) (yCoord + 1 + Math.random() / 2F), (float) (zCoord + 0.25 + Math.random() / 2F), 0);
|
||||
tookLastTick = true;
|
||||
} else tookLastTick = false;
|
||||
} else tookLastTick = false;
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound par1NBTTagCompound) {
|
||||
super.readFromNBT(par1NBTTagCompound);
|
||||
|
||||
dmgLastTick = inventorySlots[0] == null ? 0 : inventorySlots[0].getItemDamage();
|
||||
}
|
||||
}
|
||||
readCustomNBT(par1NBTTagCompound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound par1NBTTagCompound) {
|
||||
super.readFromNBT(par1NBTTagCompound);
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound par1NBTTagCompound) {
|
||||
super.writeToNBT(par1NBTTagCompound);
|
||||
|
||||
readCustomNBT(par1NBTTagCompound);
|
||||
}
|
||||
writeCustomNBT(par1NBTTagCompound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound par1NBTTagCompound) {
|
||||
super.writeToNBT(par1NBTTagCompound);
|
||||
public void readCustomNBT(NBTTagCompound par1NBTTagCompound) {
|
||||
NBTTagList nbttaglist = par1NBTTagCompound.getTagList("Items", Constants.NBT.TAG_COMPOUND);
|
||||
inventorySlots = new ItemStack[1];
|
||||
|
||||
writeCustomNBT(par1NBTTagCompound);
|
||||
}
|
||||
if (nbttaglist.tagCount() > 0) {
|
||||
NBTTagCompound tagList = nbttaglist.getCompoundTagAt(0);
|
||||
inventorySlots[0] = ItemStack.loadItemStackFromNBT(tagList);
|
||||
}
|
||||
}
|
||||
|
||||
public void readCustomNBT(NBTTagCompound par1NBTTagCompound) {
|
||||
NBTTagList nbttaglist = par1NBTTagCompound.getTagList("Items", Constants.NBT.TAG_COMPOUND);
|
||||
inventorySlots = new ItemStack[1];
|
||||
public void writeCustomNBT(NBTTagCompound par1NBTTagCompound) {
|
||||
NBTTagList nbttaglist = new NBTTagList();
|
||||
if (inventorySlots[0] != null) {
|
||||
NBTTagCompound tagList = new NBTTagCompound();
|
||||
tagList.setByte("Slot", (byte) 0);
|
||||
inventorySlots[0].writeToNBT(tagList);
|
||||
nbttaglist.appendTag(tagList);
|
||||
}
|
||||
par1NBTTagCompound.setTag("Items", nbttaglist);
|
||||
}
|
||||
|
||||
if (nbttaglist.tagCount() > 0) {
|
||||
NBTTagCompound tagList = nbttaglist.getCompoundTagAt(0);
|
||||
inventorySlots[0] = ItemStack.loadItemStackFromNBT(tagList);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public int getSizeInventory() {
|
||||
return inventorySlots.length;
|
||||
}
|
||||
|
||||
public void writeCustomNBT(NBTTagCompound par1NBTTagCompound) {
|
||||
NBTTagList nbttaglist = new NBTTagList();
|
||||
if (inventorySlots[0] != null) {
|
||||
NBTTagCompound tagList = new NBTTagCompound();
|
||||
tagList.setByte("Slot", (byte) 0);
|
||||
inventorySlots[0].writeToNBT(tagList);
|
||||
nbttaglist.appendTag(tagList);
|
||||
}
|
||||
par1NBTTagCompound.setTag("Items", nbttaglist);
|
||||
}
|
||||
@Override
|
||||
public ItemStack getStackInSlot(int i) {
|
||||
return inventorySlots[i];
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSizeInventory() {
|
||||
return inventorySlots.length;
|
||||
}
|
||||
@Override
|
||||
public ItemStack decrStackSize(int i, int j) {
|
||||
if (inventorySlots[i] != null) {
|
||||
ItemStack stackAt;
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlot(int i) {
|
||||
return inventorySlots[i];
|
||||
}
|
||||
if (inventorySlots[i].stackSize <= j) {
|
||||
stackAt = inventorySlots[i];
|
||||
inventorySlots[i] = null;
|
||||
return stackAt;
|
||||
} else {
|
||||
stackAt = inventorySlots[i].splitStack(j);
|
||||
|
||||
@Override
|
||||
public ItemStack decrStackSize(int i, int j) {
|
||||
if (inventorySlots[i] != null) {
|
||||
ItemStack stackAt;
|
||||
if (inventorySlots[i].stackSize == 0)
|
||||
inventorySlots[i] = null;
|
||||
|
||||
if (inventorySlots[i].stackSize <= j) {
|
||||
stackAt = inventorySlots[i];
|
||||
inventorySlots[i] = null;
|
||||
return stackAt;
|
||||
} else {
|
||||
stackAt = inventorySlots[i].splitStack(j);
|
||||
return stackAt;
|
||||
}
|
||||
}
|
||||
|
||||
if (inventorySlots[i].stackSize == 0)
|
||||
inventorySlots[i] = null;
|
||||
return null;
|
||||
}
|
||||
|
||||
return stackAt;
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public ItemStack getStackInSlotOnClosing(int i) {
|
||||
return getStackInSlot(i);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public void setInventorySlotContents(int i, ItemStack itemstack) {
|
||||
inventorySlots[i] = itemstack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlotOnClosing(int i) {
|
||||
return getStackInSlot(i);
|
||||
}
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return LibBlockNames.REPAIRER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInventorySlotContents(int i, ItemStack itemstack) {
|
||||
inventorySlots[i] = itemstack;
|
||||
}
|
||||
@Override
|
||||
public boolean hasCustomInventoryName() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return LibBlockNames.REPAIRER;
|
||||
}
|
||||
@Override
|
||||
public int getInventoryStackLimit() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCustomInventoryName() {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean isUseableByPlayer(EntityPlayer entityplayer) {
|
||||
return worldObj.getTileEntity(xCoord, yCoord, zCoord) == this && entityplayer.getDistanceSq(xCoord + 0.5D, yCoord + 0.5D, zCoord + 0.5D) <= 64;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInventoryStackLimit() {
|
||||
return 1;
|
||||
}
|
||||
@Override
|
||||
public void openInventory() {
|
||||
|
||||
@Override
|
||||
public boolean isUseableByPlayer(EntityPlayer entityplayer) {
|
||||
return worldObj.getTileEntity(xCoord, yCoord, zCoord) == this && entityplayer.getDistanceSq(xCoord + 0.5D, yCoord + 0.5D, zCoord + 0.5D) <= 64;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openInventory() {
|
||||
@Override
|
||||
public void closeInventory() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeInventory() {
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int i, ItemStack itemstack) {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@Override
|
||||
public S35PacketUpdateTileEntity getDescriptionPacket() {
|
||||
NBTTagCompound nbttagcompound = new NBTTagCompound();
|
||||
writeCustomNBT(nbttagcompound);
|
||||
return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, -999, nbttagcompound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int i, ItemStack itemstack) {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public void onDataPacket(NetworkManager manager, S35PacketUpdateTileEntity packet) {
|
||||
super.onDataPacket(manager, packet);
|
||||
readCustomNBT(packet.func_148857_g());
|
||||
}
|
||||
|
||||
@Override
|
||||
public S35PacketUpdateTileEntity getDescriptionPacket() {
|
||||
NBTTagCompound nbttagcompound = new NBTTagCompound();
|
||||
writeCustomNBT(nbttagcompound);
|
||||
return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, -999, nbttagcompound);
|
||||
}
|
||||
@Override
|
||||
public void markDirty() {
|
||||
super.markDirty();
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDataPacket(NetworkManager manager, S35PacketUpdateTileEntity packet) {
|
||||
super.onDataPacket(manager, packet);
|
||||
readCustomNBT(packet.func_148857_g());
|
||||
}
|
||||
@Override
|
||||
public int[] getAccessibleSlotsFromSide(int var1) {
|
||||
return new int[]{0};
|
||||
}
|
||||
|
||||
@Override
|
||||
public void markDirty() {
|
||||
super.markDirty();
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
}
|
||||
@Override
|
||||
public boolean canInsertItem(int i, ItemStack itemstack, int j) {
|
||||
if (Loader.isModLoaded("TConstruct") && ConfigHandler.repairTConTools) {
|
||||
if (TinkersConstructCompat.isTConstructTool(itemstack)) {
|
||||
return itemstack != null;
|
||||
}
|
||||
}
|
||||
return itemstack != null && itemstack.getItem().isRepairable();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getAccessibleSlotsFromSide(int var1) {
|
||||
return new int[]{ 0 };
|
||||
}
|
||||
@Override
|
||||
public boolean canExtractItem(int i, ItemStack itemstack, int j) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInsertItem(int i, ItemStack itemstack, int j) {
|
||||
if (Loader.isModLoaded("TConstruct") && ConfigHandler.repairTConTools) {
|
||||
if (TinkersConstructCompat.isTConstructTool(itemstack)) {
|
||||
return itemstack != null;
|
||||
}
|
||||
}
|
||||
return itemstack != null && itemstack.getItem().isRepairable();
|
||||
}
|
||||
int drawEssentia() {
|
||||
ForgeDirection orientation = getOrientation();
|
||||
TileEntity te = ThaumcraftApiHelper.getConnectableTile(worldObj, xCoord, yCoord, zCoord, orientation);
|
||||
if (te != null) {
|
||||
IEssentiaTransport ic = (IEssentiaTransport) te;
|
||||
if (!ic.canOutputTo(orientation.getOpposite()))
|
||||
return 0;
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int i, ItemStack itemstack, int j) {
|
||||
return true;
|
||||
}
|
||||
for (Aspect aspect : repairValues.keySet())
|
||||
if (ic.getSuctionType(orientation.getOpposite()) == aspect && ic.getSuctionAmount(orientation.getOpposite()) < getSuctionAmount(orientation) && ic.takeEssentia(aspect, 1, orientation.getOpposite()) == 1)
|
||||
return repairValues.get(aspect);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int drawEssentia() {
|
||||
ForgeDirection orientation = getOrientation();
|
||||
TileEntity te = ThaumcraftApiHelper.getConnectableTile(worldObj, xCoord, yCoord, zCoord, orientation);
|
||||
if (te != null) {
|
||||
IEssentiaTransport ic = (IEssentiaTransport) te;
|
||||
if (!ic.canOutputTo(orientation.getOpposite()))
|
||||
return 0;
|
||||
ForgeDirection getOrientation() {
|
||||
return ForgeDirection.getOrientation(getBlockMetadata());
|
||||
}
|
||||
|
||||
for (Aspect aspect : repairValues.keySet())
|
||||
if (ic.getSuctionType(orientation.getOpposite()) == aspect && ic.getSuctionAmount(orientation.getOpposite()) < getSuctionAmount(orientation) && ic.takeEssentia(aspect, 1, orientation.getOpposite()) == 1)
|
||||
return repairValues.get(aspect);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@Override
|
||||
public AspectList getAspects() {
|
||||
ItemStack stack = inventorySlots[0];
|
||||
if (stack == null)
|
||||
return null;
|
||||
if (Loader.isModLoaded("TConstruct") && ConfigHandler.repairTConTools) {
|
||||
if (TinkersConstructCompat.isTConstructTool(stack))
|
||||
return new AspectList().add(Aspect.ENTROPY, TinkersConstructCompat.getDamage(stack));
|
||||
}
|
||||
return new AspectList().add(Aspect.ENTROPY, stack.getItemDamage());
|
||||
}
|
||||
|
||||
ForgeDirection getOrientation() {
|
||||
return ForgeDirection.getOrientation(getBlockMetadata());
|
||||
}
|
||||
@Override
|
||||
public void setAspects(AspectList paramAspectList) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public AspectList getAspects() {
|
||||
ItemStack stack = inventorySlots[0];
|
||||
if (stack == null)
|
||||
return null;
|
||||
if (Loader.isModLoaded("TConstruct") && ConfigHandler.repairTConTools) {
|
||||
if (TinkersConstructCompat.isTConstructTool(stack))
|
||||
return new AspectList().add(Aspect.ENTROPY, TinkersConstructCompat.getDamage(stack));
|
||||
}
|
||||
return new AspectList().add(Aspect.ENTROPY, stack.getItemDamage());
|
||||
}
|
||||
@Override
|
||||
public boolean doesContainerAccept(Aspect paramAspect) {
|
||||
|
||||
@Override
|
||||
public void setAspects(AspectList paramAspectList) {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean doesContainerAccept(Aspect paramAspect) {
|
||||
@Override
|
||||
public int addToContainer(Aspect paramAspect, int paramInt) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean takeFromContainer(Aspect paramAspect, int paramInt) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int addToContainer(Aspect paramAspect, int paramInt) {
|
||||
return 0;
|
||||
}
|
||||
@Override
|
||||
public boolean takeFromContainer(AspectList paramAspectList) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean takeFromContainer(Aspect paramAspect, int paramInt) {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean doesContainerContainAmount(Aspect paramAspect, int paramInt) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean takeFromContainer(AspectList paramAspectList) {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean doesContainerContain(AspectList paramAspectList) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean doesContainerContainAmount(Aspect paramAspect, int paramInt) {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public int containerContains(Aspect paramAspect) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean doesContainerContain(AspectList paramAspectList) {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean isConnectable(ForgeDirection paramForgeDirection) {
|
||||
return paramForgeDirection == getOrientation();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int containerContains(Aspect paramAspect) {
|
||||
return 0;
|
||||
}
|
||||
@Override
|
||||
public boolean canInputFrom(ForgeDirection paramForgeDirection) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isConnectable(ForgeDirection paramForgeDirection) {
|
||||
return paramForgeDirection == getOrientation();
|
||||
}
|
||||
@Override
|
||||
public boolean canOutputTo(ForgeDirection paramForgeDirection) {
|
||||
return isConnectable(paramForgeDirection);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInputFrom(ForgeDirection paramForgeDirection) {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public void setSuction(Aspect paramAspect, int paramInt) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canOutputTo(ForgeDirection paramForgeDirection) {
|
||||
return isConnectable(paramForgeDirection);
|
||||
}
|
||||
@Override
|
||||
public int takeEssentia(Aspect paramAspect, int paramInt, ForgeDirection direction) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSuction(Aspect paramAspect, int paramInt) {
|
||||
}
|
||||
@Override
|
||||
public int getMinimumSuction() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int takeEssentia(Aspect paramAspect, int paramInt, ForgeDirection direction) {
|
||||
return 0;
|
||||
}
|
||||
@Override
|
||||
public boolean renderExtendedTube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMinimumSuction() {
|
||||
return 0;
|
||||
}
|
||||
@Override
|
||||
public int addEssentia(Aspect arg0, int arg1, ForgeDirection direction) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderExtendedTube() {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public int getEssentiaAmount(ForgeDirection arg0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int addEssentia(Aspect arg0, int arg1, ForgeDirection direction) {
|
||||
return 0;
|
||||
}
|
||||
@Override
|
||||
public Aspect getEssentiaType(ForgeDirection arg0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEssentiaAmount(ForgeDirection arg0) {
|
||||
return 0;
|
||||
}
|
||||
@Override
|
||||
public int getSuctionAmount(ForgeDirection arg0) {
|
||||
return arg0 == getOrientation() ? 128 : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Aspect getEssentiaType(ForgeDirection arg0) {
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public Aspect getSuctionType(ForgeDirection arg0) {
|
||||
return arg0 == getOrientation() ? Aspect.TOOL : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSuctionAmount(ForgeDirection arg0) {
|
||||
return arg0 == getOrientation() ? 128 : 0;
|
||||
}
|
||||
@Override
|
||||
public boolean prepareToMove() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Aspect getSuctionType(ForgeDirection arg0) {
|
||||
return arg0 == getOrientation() ? Aspect.TOOL : null;
|
||||
}
|
||||
@Override
|
||||
public void doneMoving() {
|
||||
|
||||
@Override
|
||||
public boolean prepareToMove() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doneMoving() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Loaded 100 of 304 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user