Merge pull request #26 from GTNewHorizons/java12

Update buildscript, fix potions crash on Java 12+
This commit is contained in:
Martin Robertz authored and GitHub committed 2023-01-24 17:06:18 +01:00
commit 508457c10a
309 files changed
+7409 -4290

No files matched your search

+44
View File
@@ -0,0 +1,44 @@
* text eol=lf
*.[jJ][aA][rR] binary
*.[pP][nN][gG] binary
*.[jJ][pP][gG] binary
*.[jJ][pP][eE][gG] binary
*.[gG][iI][fF] binary
*.[tT][iI][fF] binary
*.[tT][iI][fF][fF] binary
*.[iI][cC][oO] binary
*.[sS][vV][gG] text
*.[eE][pP][sS] binary
*.[xX][cC][fF] binary
*.[kK][aA][rR] binary
*.[mM]4[aA] binary
*.[mM][iI][dD] binary
*.[mM][iI][dD][iI] binary
*.[mM][pP]3 binary
*.[oO][gG][gG] binary
*.[rR][aA] binary
*.7[zZ] binary
*.[gG][zZ] binary
*.[tT][aA][rR] binary
*.[tT][gG][zZ] binary
*.[zZ][iI][pP] binary
*.[tT][cC][nN] binary
*.[sS][oO] binary
*.[dD][lL][lL] binary
*.[dD][yY][lL][iI][bB] binary
*.[pP][sS][dD] binary
*.[tT][tT][fF] binary
*.[oO][tT][fF] binary
*.[pP][aA][tT][cC][hH] -text
*.[bB][aA][tT] text eol=crlf
*.[cC][mM][dD] text eol=crlf
*.[pP][sS]1 text eol=crlf
*[aA][uU][tT][oO][gG][eE][nN][eE][rR][aA][tT][eE][dD]* binary
+565 -170
View File
File diff suppressed because it is too large. Load diff
+1 -1
View File
@@ -2,7 +2,7 @@
dependencies {
compile('com.github.GTNewHorizons:Baubles:1.0.1.14:dev')
compile('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-76-GTNH:api')
compile('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-147-GTNH:api')
compile('thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev')
+10
View File
@@ -0,0 +1,10 @@
plugins {
id 'com.diffplug.blowdryerSetup' version '1.6.0'
}
apply plugin: 'com.diffplug.blowdryerSetup'
blowdryerSetup {
github('GTNewHorizons/ExampleMod1.7.10', 'tag', '0.1.5')
//devLocal '.' // Use this when testing config updates locally
}
@@ -14,6 +14,4 @@
*/
package thaumic.tinkerer.api;
public interface INoRemoveEnchant {
}
public interface INoRemoveEnchant {}
@@ -33,9 +33,13 @@ public class ClientTickHandler {
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))
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));
}
@@ -44,5 +48,4 @@ public class ClientTickHandler {
++elapsedTicks;
}
}
}
@@ -29,10 +29,33 @@ public class GemArmorKeyHandler {
@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()));
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()));
}
}
}
}
@@ -73,10 +73,20 @@ public final class HUDHandler {
}
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);
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);
renderItem.renderItemIntoGUI(
font,
ClientHelper.minecraft().renderEngine,
new ItemStack(Items.reeds),
xpos,
ypos);
}
font.setUnicodeFlag(unicode);
}
@@ -84,5 +94,4 @@ public final class HUDHandler {
}
}
}
}
@@ -14,10 +14,8 @@ public class KamiArmorClientHandler {
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"));
if (status) ToolModeHUDHandler.setTooltip(StatCollector.translateToLocal("ttmisc.enableAllArmor"));
else ToolModeHUDHandler.setTooltip(StatCollector.translateToLocal("ttmisc.disableAllArmor"));
ArmorEnabled = status;
ThaumicTinkerer.netHandler.sendToServer(new PacketToggleArmor(status));
}
@@ -1,6 +1,7 @@
package thaumic.tinkerer.client.core.handler.kami;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.RenderBlocks;
@@ -16,8 +17,6 @@ import org.lwjgl.opengl.GL11;
import thaumic.tinkerer.common.ThaumicTinkerer;
import thaumic.tinkerer.common.item.kami.ItemPlacementMirror;
import java.util.List;
public final class PlacementMirrorPredictionRenderer {
RenderBlocks blockRender = new RenderBlocks();
@@ -29,7 +28,10 @@ public final class PlacementMirrorPredictionRenderer {
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) {
if (currentStack != null
&& currentStack.getItem()
== ThaumicTinkerer.registry.getFirstItemFromClass(ItemPlacementMirror.class)
&& ItemPlacementMirror.getBlock(currentStack) != Blocks.air) {
renderPlayerLook(player, currentStack);
}
}
@@ -38,7 +40,8 @@ public final class PlacementMirrorPredictionRenderer {
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));
ItemStack block =
new ItemStack(ItemPlacementMirror.getBlock(stack), 1, ItemPlacementMirror.getBlockMeta(stack));
ChunkCoordinates lastCoords = new ChunkCoordinates(0, 0, 0);
GL11.glPushMatrix();
@@ -54,10 +57,12 @@ public final class PlacementMirrorPredictionRenderer {
}
private void renderBlockAt(ItemStack block, ChunkCoordinates pos, ChunkCoordinates last) {
if (block.getItem() == null)
return;
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.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);
@@ -66,5 +71,4 @@ public final class PlacementMirrorPredictionRenderer {
GL11.glPopMatrix();
}
}
@@ -14,6 +14,10 @@
*/
package thaumic.tinkerer.client.core.handler.kami;
import cpw.mods.fml.common.eventhandler.EventPriority;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.gui.ScaledResolution;
@@ -24,10 +28,6 @@ import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.event.RenderGameOverlayEvent;
import thaumic.tinkerer.client.lib.LibResources;
import thaumic.tinkerer.common.core.handler.ConfigHandler;
import cpw.mods.fml.common.eventhandler.EventPriority;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public final class SoulHeartClientHandler {
@@ -86,30 +86,27 @@ public final class SoulHeartClientHandler {
//if (event.type == ElementType.AIR && event instanceof RenderGameOverlayEvent.Post && clientPlayerHP > 0)
//GL11.glTranslatef(0F, 10F, 0F);
}*/
@SubscribeEvent(priority=EventPriority.HIGHEST)
public void onDrawScreenPre(RenderGameOverlayEvent.Pre event)
{
Minecraft mc = Minecraft.getMinecraft();
if (event.type == RenderGameOverlayEvent.ElementType.HEALTH)
{
renderHUD(event.resolution, mc.thePlayer, null);
}
@SubscribeEvent(priority = EventPriority.HIGHEST)
public void onDrawScreenPre(RenderGameOverlayEvent.Pre event) {
Minecraft mc = Minecraft.getMinecraft();
if (event.type == RenderGameOverlayEvent.ElementType.HEALTH) {
renderHUD(event.resolution, mc.thePlayer, null);
}
}
@SideOnly(Side.CLIENT)
public static void renderHUD(ScaledResolution resolution, EntityPlayer player, ItemStack stack)
{
Minecraft mc = Minecraft.getMinecraft();
mc.renderEngine.bindTexture(heartsResource);
int x = resolution.getScaledWidth() / 2 + 10;
int y = resolution.getScaledHeight() - ConfigHandler.soulHeartHeight;
if (player.getAir() < 300) {
y = resolution.getScaledHeight() - (ConfigHandler.soulHeartHeight + 10);
}
mc.renderEngine.bindTexture(heartsResource);
public static void renderHUD(ScaledResolution resolution, EntityPlayer player, ItemStack stack) {
Minecraft mc = Minecraft.getMinecraft();
mc.renderEngine.bindTexture(heartsResource);
int x = resolution.getScaledWidth() / 2 + 10;
int y = resolution.getScaledHeight() - ConfigHandler.soulHeartHeight;
if (player.getAir() < 300) {
y = resolution.getScaledHeight() - (ConfigHandler.soulHeartHeight + 10);
}
mc.renderEngine.bindTexture(heartsResource);
int it = 0;
for (int i = 0; i < clientPlayerHP; i++) {
boolean half = i == clientPlayerHP - 1 && clientPlayerHP % 2 != 0;
@@ -119,9 +116,8 @@ public final class SoulHeartClientHandler {
}
}
//GL11.glEnable(3008);
//GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
mc.renderEngine.bindTexture(Gui.icons);
}
}
// GL11.glEnable(3008);
// GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
mc.renderEngine.bindTexture(Gui.icons);
}
}
@@ -17,6 +17,7 @@ package thaumic.tinkerer.client.core.handler.kami;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import java.awt.*;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.ScaledResolution;
@@ -26,8 +27,6 @@ import net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType;
import org.lwjgl.opengl.GL11;
import thaumic.tinkerer.client.core.handler.ClientTickHandler;
import java.awt.*;
public final class ToolModeHUDHandler {
private static String currentTooltip;
@@ -42,14 +41,15 @@ public final class ToolModeHUDHandler {
@SideOnly(Side.CLIENT)
public static void clientTick() {
if (tooltipDisplayTicks > 0)
--tooltipDisplayTicks;
if (tooltipDisplayTicks > 0) --tooltipDisplayTicks;
}
@SubscribeEvent
@SideOnly(Side.CLIENT)
public void drawDislocationFocusHUD(RenderGameOverlayEvent.Post event) {
if (event.type == ElementType.ALL && tooltipDisplayTicks > 0 && !MathHelper.stringNullOrLengthZero(currentTooltip)) {
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();
@@ -61,19 +61,18 @@ public final class ToolModeHUDHandler {
int opacity = (int) (tooltipDisplayTicks * 256.0F / 10.0F);
if (opacity > 160)
opacity = 160;
if (opacity > 160) opacity = 160;
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();
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();
}
}
}
}
@@ -14,6 +14,7 @@
*/
package thaumic.tinkerer.client.core.helper;
import java.util.List;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.EntityClientPlayerMP;
import net.minecraft.client.gui.FontRenderer;
@@ -21,8 +22,6 @@ import net.minecraft.client.renderer.Tessellator;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
import java.util.List;
public final class ClientHelper {
public static Minecraft minecraft() {
@@ -53,14 +52,12 @@ public final class ClientHelper {
FontRenderer fontRenderer = Minecraft.getMinecraft().fontRenderer;
for (var6 = 0; var6 < tooltipData.size(); ++var6) {
var7 = fontRenderer.getStringWidth(tooltipData.get(var6));
if (var7 > var5)
var5 = var7;
if (var7 > var5) var5 = var7;
}
var6 = x + 12;
var7 = y - 12;
int var9 = 8;
if (tooltipData.size() > 1)
var9 += 2 + (tooltipData.size() - 1) * 10;
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);
@@ -75,8 +72,7 @@ public final class ClientHelper {
for (int var13 = 0; var13 < tooltipData.size(); ++var13) {
String var14 = tooltipData.get(var13);
fontRenderer.drawStringWithShadow(var14, var6, var7, -1);
if (var13 == 0)
var7 += 2;
if (var13 == 0) var7 += 2;
var7 += 10;
}
}
@@ -110,5 +106,4 @@ public final class ClientHelper {
GL11.glEnable(GL11.GL_ALPHA_TEST);
GL11.glEnable(GL11.GL_TEXTURE_2D);
}
}
@@ -55,5 +55,4 @@ public class IconHelper {
public static IIcon forItem(IIconRegister ir, Item item, String s) {
return forName(ir, item.getUnlocalizedName().replaceAll("item.", "") + s);
}
}
@@ -33,7 +33,6 @@ import thaumcraft.client.fx.ParticleEngine;
import thaumic.tinkerer.client.core.handler.ClientTickHandler;
import thaumic.tinkerer.client.core.handler.GemArmorKeyHandler;
import thaumic.tinkerer.client.core.handler.HUDHandler;
import thaumic.tinkerer.client.core.handler.kami.KamiArmorClientHandler;
import thaumic.tinkerer.client.core.handler.kami.PlacementMirrorPredictionRenderer;
import thaumic.tinkerer.client.core.handler.kami.SoulHeartClientHandler;
@@ -76,10 +75,15 @@ public class TTClientProxy extends TTCommonProxy {
if (Loader.isModLoaded("ComputerCraft")) {
MinecraftForge.EVENT_BUS.register(new FumeTool());
}
if (ConfigHandler.enableKami)
//kamiRarity = EnumHelperClient.addRarity("KAMI", 0x6, "Kami");
kamiRarity = EnumHelperClient.addEnum(new Class[][]{{EnumRarity.class, EnumChatFormatting.class, String.class}}, EnumRarity.class, "KAMI", EnumChatFormatting.LIGHT_PURPLE, "Kami");
// kamiRarity = EnumHelperClient.addRarity("KAMI", 0x6, "Kami");
kamiRarity = EnumHelperClient.addEnum(
new Class[][] {{EnumRarity.class, EnumChatFormatting.class, String.class}},
EnumRarity.class,
"KAMI",
EnumChatFormatting.LIGHT_PURPLE,
"Kami");
}
@Override
@@ -102,7 +106,6 @@ public class TTClientProxy extends TTCommonProxy {
}
}
private void registerTiles() {
ClientRegistry.bindTileEntitySpecialRenderer(TileAnimationTablet.class, new RenderTileAnimationTablet());
ClientRegistry.bindTileEntitySpecialRenderer(TileMagnet.class, new RenderTileMagnet());
@@ -125,22 +128,27 @@ public class TTClientProxy extends TTCommonProxy {
RenderingRegistry.registerBlockHandler(new RenderMagnet());
RenderingRegistry.registerBlockHandler(new RenderRepairer());
MinecraftForgeClient.registerItemRenderer(ThaumicTinkerer.registry.getFirstItemFromClass(ItemMobDisplay.class), new RenderMobDisplay());
MinecraftForgeClient.registerItemRenderer(ThaumicTinkerer.registry.getFirstItemFromClass(ItemInfusedSeeds.class), new RenderGenericSeeds());
MinecraftForgeClient.registerItemRenderer(
ThaumicTinkerer.registry.getFirstItemFromClass(ItemMobDisplay.class), new RenderMobDisplay());
MinecraftForgeClient.registerItemRenderer(
ThaumicTinkerer.registry.getFirstItemFromClass(ItemInfusedSeeds.class), new RenderGenericSeeds());
if (ConfigHandler.enableKami) {
MinecraftForgeClient.registerItemRenderer(ThaumicTinkerer.registry.getFirstItemFromClass(ItemPlacementMirror.class), new RenderPlacementMirror());
MinecraftForgeClient.registerItemRenderer(
ThaumicTinkerer.registry.getFirstItemFromClass(ItemPlacementMirror.class),
new RenderPlacementMirror());
LibRenderIDs.idWarpGate = RenderingRegistry.getNextAvailableRenderId();
RenderingRegistry.registerBlockHandler(new RenderWarpGate());
//KeyBindingRegistry.registerKeyBinding(new GemArmorKeyHandler());
// KeyBindingRegistry.registerKeyBinding(new GemArmorKeyHandler());
}
}
@Override
public void shadowSparkle(World world, float x, float y, float z, int size) {
ItemFocusShadowbeam.Particle fx = new ItemFocusShadowbeam.Particle(world, (double)x, (double)y, (double)z, size, 0.001f, 0.001f, 0.001f, 5);
ItemFocusShadowbeam.Particle fx = new ItemFocusShadowbeam.Particle(
world, (double) x, (double) y, (double) z, size, 0.001f, 0.001f, 0.001f, 5);
ParticleEngine.instance.addEffect(world, fx);
}
@@ -161,7 +169,6 @@ public class TTClientProxy extends TTCommonProxy {
@Override
public boolean armorStatus(EntityPlayer player) {
return KamiArmorClientHandler.ArmorEnabled;
}
@Override
@@ -176,5 +183,4 @@ public class TTClientProxy extends TTCommonProxy {
public EntityPlayer getClientPlayer() {
return ClientHelper.clientPlayer();
}
}
@@ -14,6 +14,8 @@
*/
package thaumic.tinkerer.client.gui;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.entity.player.InventoryPlayer;
@@ -29,9 +31,6 @@ import thaumic.tinkerer.common.block.tile.container.ContainerAnimationTablet;
import thaumic.tinkerer.common.block.tile.tablet.TileAnimationTablet;
import thaumic.tinkerer.common.network.packet.PacketTabletButton;
import java.util.ArrayList;
import java.util.List;
public class GuiAnimationTablet extends GuiContainer {
private static final ResourceLocation gui = new ResourceLocation(LibResources.GUI_ANIMATION_TABLET);
@@ -61,14 +60,12 @@ public class GuiAnimationTablet extends GuiContainer {
private void addButton(GuiButtonAT button) {
buttonListAT.add(button);
if (button instanceof IRadioButton)
radioButtons.add((IRadioButton) button);
if (button instanceof IRadioButton) radioButtons.add((IRadioButton) button);
}
@Override
protected void actionPerformed(GuiButton par1GuiButton) {
if (par1GuiButton instanceof IRadioButton)
((IRadioButton) par1GuiButton).enableFromClick();
if (par1GuiButton instanceof IRadioButton) ((IRadioButton) par1GuiButton).enableFromClick();
else buttonListAT.get(0).buttonEnabled = !buttonListAT.get(0).buttonEnabled;
tablet.leftClick = buttonListAT.get(1).buttonEnabled;
@@ -88,7 +85,8 @@ public class GuiAnimationTablet extends GuiContainer {
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);
fontRendererObj.drawString(
redstone, x + xSize / 2 - fontRendererObj.getStringWidth(redstone) / 2, y + 50, 0x999999);
GL11.glColor3f(1F, 1F, 1F);
}
}
}
@@ -14,6 +14,8 @@
*/
package thaumic.tinkerer.client.gui;
import java.util.Arrays;
import java.util.List;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
@@ -31,9 +33,6 @@ import thaumic.tinkerer.client.lib.LibResources;
import thaumic.tinkerer.common.block.tile.TileAspectAnalyzer;
import thaumic.tinkerer.common.block.tile.container.ContainerAspectAnalyzer;
import java.util.Arrays;
import java.util.List;
public class GuiAspectAnalyzer extends GuiContainer {
private static final ResourceLocation gui = new ResourceLocation(LibResources.GUI_ASPECT_ANALYZER);
@@ -66,7 +65,9 @@ public class GuiAspectAnalyzer extends GuiContainer {
if (stack != null) {
int h = ScanManager.generateItemHash(stack.getItem(), stack.getItemDamage());
List<String> list = Thaumcraft.proxy.getScannedObjects().get(ClientHelper.clientPlayer().getGameProfile().getName());
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);
@@ -77,8 +78,7 @@ public class GuiAspectAnalyzer extends GuiContainer {
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++;
}
@@ -90,9 +90,13 @@ public class GuiAspectAnalyzer extends GuiContainer {
@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()));
ClientHelper.renderTooltip(
mx - x,
my - y,
Arrays.asList(
EnumChatFormatting.AQUA + aspectHovered.getName(),
EnumChatFormatting.GRAY + aspectHovered.getLocalizedDescription()));
super.drawGuiContainerForegroundLayer(mx, my);
}
}
@@ -14,6 +14,9 @@
*/
package thaumic.tinkerer.client.gui;
import java.awt.*;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.enchantment.Enchantment;
@@ -36,10 +39,6 @@ import thaumic.tinkerer.common.lib.LibFeatures;
import thaumic.tinkerer.common.network.packet.PacketEnchanterAddEnchant;
import thaumic.tinkerer.common.network.packet.PacketEnchanterStartWorking;
import java.awt.*;
import java.util.ArrayList;
import java.util.List;
public class GuiEnchanting extends GuiContainer {
private static final ResourceLocation gui = new ResourceLocation(LibResources.GUI_ENCHANTER);
@@ -106,21 +105,23 @@ public class GuiEnchanting extends GuiContainer {
enchantButtons[i].enabled = false;
}
if (currentStack == null || currentStack.isItemEnchanted())
return;
if (currentStack == null || currentStack.isItemEnchanted()) return;
int it = 0;
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])) {
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;
if (it >= 16) break;
}
}
}
@Override
@@ -130,13 +131,13 @@ public class GuiEnchanting extends GuiContainer {
} 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));
ThaumicTinkerer.netHandler.sendToServer(
new PacketEnchanterAddEnchant(enchanter, button.enchant.effectId, 0));
} else {
int type = (par1GuiButton.id - 17) % 3;
int index = (par1GuiButton.id - 17) / 3;
if (index >= enchanter.enchantments.size() || index >= enchanter.levels.size())
return;
if (index >= enchanter.enchantments.size() || index >= enchanter.levels.size()) return;
int level = enchanter.levels.get(index);
@@ -144,15 +145,18 @@ public class GuiEnchanting extends GuiContainer {
switch (type) {
case 0: {
ThaumicTinkerer.netHandler.sendToServer(new PacketEnchanterAddEnchant(enchanter, enchant.effectId, -1));
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));
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));
ThaumicTinkerer.netHandler.sendToServer(
new PacketEnchanterAddEnchant(enchanter, enchant.effectId, level + 1));
break;
}
}
@@ -165,8 +169,9 @@ public class GuiEnchanting extends GuiContainer {
public void updateScreen() {
currentStack = enchanter.getStackInSlot(0);
buildButtonList();
if (currentStack != lastTickStack || !lastTickEnchants.equals(enchanter.enchantments) || !lastTickLevels.equals(enchanter.levels))
buildButtonList();
if (currentStack != lastTickStack
|| !lastTickEnchants.equals(enchanter.enchantments)
|| !lastTickLevels.equals(enchanter.levels)) buildButtonList();
lastTickStack = currentStack;
lastTickEnchants = new ArrayList(enchanter.enchantments);
@@ -193,8 +198,7 @@ public class GuiEnchanting extends GuiContainer {
GL11.glEnable(GL11.GL_BLEND);
int xo = 15;
int z = 50;
if (enchantButtons[8].enabled)
z = 26;
if (enchantButtons[8].enabled) z = 26;
for (Aspect aspect : LibFeatures.PRIMAL_ASPECTS) {
drawAspectBar(aspect, x + xo, y + z, i, j);
xo += 15;
@@ -205,8 +209,7 @@ public class GuiEnchanting extends GuiContainer {
@Override
protected void drawGuiContainerForegroundLayer(int par1, int par2) {
if (!tooltip.isEmpty())
ClientHelper.renderTooltip(par1 - x, par2 - y, tooltip);
if (!tooltip.isEmpty()) ClientHelper.renderTooltip(par1 - x, par2 - y, tooltip);
tooltip.clear();
}
@@ -235,5 +238,4 @@ public class GuiEnchanting extends GuiContainer {
this.tooltip = tooltip;
}
}
}
@@ -14,6 +14,8 @@
*/
package thaumic.tinkerer.client.gui;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.entity.player.InventoryPlayer;
@@ -31,9 +33,6 @@ import thaumic.tinkerer.common.block.tile.container.ContainerMobMagnet;
import thaumic.tinkerer.common.item.ItemSoulMould;
import thaumic.tinkerer.common.network.packet.PacketMobMagnetButton;
import java.util.ArrayList;
import java.util.List;
public class GuiMobMagnet extends GuiContainer {
private static final ResourceLocation gui = new ResourceLocation(LibResources.GUI_MOB_MAGNET);
@@ -64,14 +63,12 @@ public class GuiMobMagnet extends GuiContainer {
private void addButton(GuiButtonMM button) {
buttonListMM.add(button);
if (button instanceof IRadioButton)
radioButtons.add((IRadioButton) button);
if (button instanceof IRadioButton) radioButtons.add((IRadioButton) button);
}
@Override
protected void actionPerformed(GuiButton par1GuiButton) {
if (par1GuiButton instanceof IRadioButton)
((IRadioButton) par1GuiButton).enableFromClick();
if (par1GuiButton instanceof IRadioButton) ((IRadioButton) par1GuiButton).enableFromClick();
else buttonListMM.get(0).enabled = !buttonListMM.get(0).enabled;
mobMagnet.adult = buttonListMM.get(0).enabled;
@@ -92,15 +89,14 @@ public class GuiMobMagnet extends GuiContainer {
if (stack != null) {
String name = ItemSoulMould.getPatternName(stack);
if (name.isEmpty())
filter = StatCollector.translateToLocal("ttmisc.none");
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(
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);
}
}
}
@@ -1,5 +1,7 @@
package thaumic.tinkerer.client.gui;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.entity.player.InventoryPlayer;
@@ -15,9 +17,6 @@ import thaumic.tinkerer.common.block.tile.TileRPlacer;
import thaumic.tinkerer.common.block.tile.container.ContainerRemotePlacer;
import thaumic.tinkerer.common.network.packet.PacketPlacerButton;
import java.util.ArrayList;
import java.util.List;
/**
* Created by nekosune on 30/06/14.
*/
@@ -46,19 +45,16 @@ public class GuiRemotePlacer extends GuiContainer {
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)
radioButtons.add((IRadioButton) button);
if (button instanceof IRadioButton) radioButtons.add((IRadioButton) button);
}
@Override
protected void actionPerformed(GuiButton par1GuiButton) {
if (par1GuiButton instanceof IRadioButton)
((IRadioButton) par1GuiButton).enableFromClick();
if (par1GuiButton instanceof IRadioButton) ((IRadioButton) par1GuiButton).enableFromClick();
else buttonListRP.get(0).buttonEnabled = !buttonListRP.get(0).buttonEnabled;
placer.blocks = par1GuiButton.id + 1;
@@ -77,6 +73,4 @@ public class GuiRemotePlacer extends GuiContainer {
fontRendererObj.drawString("4", x + 120, y + 41, 0x999999);
GL11.glColor3f(1F, 1F, 1F);
}
}
@@ -16,13 +16,12 @@ package thaumic.tinkerer.client.gui;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import java.awt.*;
import java.net.URI;
import net.minecraft.util.StatCollector;
import thaumcraft.api.research.ResearchItem;
import thaumcraft.client.gui.GuiResearchRecipe;
import java.awt.*;
import java.net.URI;
@SideOnly(Side.CLIENT)
public class GuiResearchPeripheral extends GuiResearchRecipe {
@@ -41,5 +40,4 @@ public class GuiResearchPeripheral extends GuiResearchRecipe {
}
} else super.keyTyped(par1, par2);
}
}
@@ -38,4 +38,4 @@ public class GuiButtonAT extends GuiButton {
drawTexturedModalRect(xPosition, yPosition, 176, y, width, height);
}
}
}
}
@@ -28,15 +28,12 @@ public class GuiButtonATRadio extends GuiButtonAT implements IRadioButton {
@Override
public void enableFromClick() {
setEnabled(true);
for (IRadioButton button : linkedButtons)
if (button != this)
button.updateStatus(this);
for (IRadioButton button : linkedButtons) if (button != this) button.updateStatus(this);
}
@Override
public void updateStatus(IRadioButton otherButton) {
if (otherButton.isEnabled())
setEnabled(false);
if (otherButton.isEnabled()) setEnabled(false);
}
@Override
@@ -48,4 +45,4 @@ public class GuiButtonATRadio extends GuiButtonAT implements IRadioButton {
public void setEnabled(boolean enabled) {
this.buttonEnabled = enabled;
}
}
}
@@ -14,6 +14,8 @@
*/
package thaumic.tinkerer.client.gui.button;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.util.EnumChatFormatting;
@@ -24,9 +26,6 @@ import thaumic.tinkerer.client.gui.GuiEnchanting;
import thaumic.tinkerer.client.lib.LibResources;
import thaumic.tinkerer.common.block.tile.TileEnchanter;
import java.util.ArrayList;
import java.util.List;
public class GuiButtonEnchant extends GuiButton {
private static final ResourceLocation gui = new ResourceLocation(LibResources.GUI_ENCHANTER);
@@ -41,8 +40,7 @@ public class GuiButtonEnchant extends GuiButton {
@Override
public void drawButton(Minecraft par1Minecraft, int par2, int par3) {
if (!enabled)
return;
if (!enabled) return;
final int x = 176;
final int y = enchanter.working ? 39 : 24;
@@ -50,11 +48,14 @@ public class GuiButtonEnchant extends GuiButton {
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) {
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;
}
}
}
@@ -32,13 +32,11 @@ public class GuiButtonEnchanterLevel extends GuiButton {
@Override
public void drawButton(Minecraft par1Minecraft, int par2, int par3) {
if (!enabled)
return;
if (!enabled) return;
int x = 218 + (plus ? 7 : 0);
par1Minecraft.renderEngine.bindTexture(gui);
drawTexturedModalRect(xPosition, yPosition, x, 0, 7, 7);
}
}
@@ -14,6 +14,8 @@
*/
package thaumic.tinkerer.client.gui.button;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.renderer.Tessellator;
@@ -27,9 +29,6 @@ import thaumic.tinkerer.client.gui.GuiEnchanting;
import thaumic.tinkerer.common.enchantment.core.EnchantmentData;
import thaumic.tinkerer.common.enchantment.core.EnchantmentManager;
import java.util.ArrayList;
import java.util.List;
public class GuiButtonEnchantment extends GuiButton {
public Enchantment enchant;
@@ -46,10 +45,10 @@ public class GuiButtonEnchantment extends GuiButton {
@Override
public void drawButton(Minecraft par1Minecraft, int par2, int par3) {
if (dontRender())
return;
if (dontRender()) return;
EnchantmentData data = EnchantmentManager.enchantmentData.get(enchant.effectId).get(1);
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);
@@ -59,9 +58,11 @@ public class GuiButtonEnchantment extends GuiButton {
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"));
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"));
tooltip.add(EnumChatFormatting.GRAY + "" + EnumChatFormatting.ITALIC + " "
+ StatCollector.translateToLocal("ttmisc.clickToRemove"));
parent.tooltip = tooltip;
}
@@ -78,5 +79,4 @@ public class GuiButtonEnchantment extends GuiButton {
tessellator.addVertexWithUV(par1, par2, zLevel, (par3) * f, (par4) * f1);
tessellator.draw();
}
}
@@ -31,8 +31,7 @@ public class GuiButtonFramedEnchantment extends GuiButtonEnchantment {
@Override
public void drawButton(Minecraft par1Minecraft, int par2, int par3) {
if (dontRender() || parent.enchanter.enchantments.isEmpty() || parent.enchanter.levels.isEmpty())
return;
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);
@@ -40,10 +39,13 @@ public class GuiButtonFramedEnchantment extends GuiButtonEnchantment {
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);
par1Minecraft.fontRenderer.drawStringWithShadow(
StatCollector.translateToLocal("enchantment.level." + level),
xPosition + 26,
yPosition + 8,
0xFFFFFF);
}
super.drawButton(par1Minecraft, par2, par3);
}
}
@@ -38,4 +38,4 @@ public class GuiButtonMM extends GuiButton {
drawTexturedModalRect(xPosition, yPosition, 176, y, width, height);
}
}
}
}
@@ -28,15 +28,12 @@ public class GuiButtonMMRadio extends GuiButtonMM implements IRadioButton {
@Override
public void enableFromClick() {
setEnabled(true);
for (IRadioButton button : linkedButtons)
if (button != this)
button.updateStatus(this);
for (IRadioButton button : linkedButtons) if (button != this) button.updateStatus(this);
}
@Override
public void updateStatus(IRadioButton otherButton) {
if (otherButton.isEnabled())
setEnabled(false);
if (otherButton.isEnabled()) setEnabled(false);
}
@Override
@@ -48,4 +45,4 @@ public class GuiButtonMMRadio extends GuiButtonMM implements IRadioButton {
public void setEnabled(boolean enabled) {
this.enabled = enabled;
}
}
}
@@ -16,15 +16,12 @@ public class GuiButtonRPRadio extends GuiButtonRP implements IRadioButton {
@Override
public void enableFromClick() {
setEnabled(true);
for (IRadioButton button : linkedButtons)
if (button != this)
button.updateStatus(this);
for (IRadioButton button : linkedButtons) if (button != this) button.updateStatus(this);
}
@Override
public void updateStatus(IRadioButton otherButton) {
if (otherButton.isEnabled())
setEnabled(false);
if (otherButton.isEnabled()) setEnabled(false);
}
@Override
@@ -23,5 +23,4 @@ public interface IRadioButton {
public boolean isEnabled();
public void setEnabled(boolean enabled);
}
}
@@ -38,4 +38,4 @@ public class GuiButtonWG extends GuiButton {
drawTexturedModalRect(xPosition, yPosition, 176, y, width, height);
}
}
}
}
@@ -30,8 +30,8 @@ public class GuiIchorPouch extends GuiContainer {
super(par1Container);
}
//Overridden to prevent a dupe
//See issue 367
// 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);
@@ -57,5 +57,4 @@ public class GuiIchorPouch extends GuiContainer {
drawTexturedModalRect(x, y, 0, 0, xSize, ySize);
GL11.glDisable(GL11.GL_BLEND);
}
}
@@ -62,7 +62,7 @@ public class GuiWarpGate extends GuiContainer {
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);
fontRendererObj.drawStringWithShadow(
StatCollector.translateToLocal("ttmisc.lockedGate"), x + 20, y + 7, 0x999999);
}
}
@@ -14,6 +14,9 @@
*/
package thaumic.tinkerer.client.gui.kami;
import java.awt.*;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.renderer.Tessellator;
@@ -32,10 +35,6 @@ import thaumic.tinkerer.common.block.tile.kami.TileWarpGate;
import thaumic.tinkerer.common.item.kami.ItemSkyPearl;
import thaumic.tinkerer.common.network.packet.kami.PacketWarpGateTeleport;
import java.awt.*;
import java.util.ArrayList;
import java.util.List;
public class GuiWarpGateDestinations extends GuiScreen {
private static ResourceLocation enderField = new ResourceLocation("textures/entity/end_portal.png");
@@ -92,7 +91,9 @@ public class GuiWarpGateDestinations extends GuiScreen {
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) {
if (stack != null
&& ItemSkyPearl.isAttuned(stack)
&& ItemSkyPearl.getDim(stack) == warpGate.getWorldObj().provider.dimensionId) {
int x = ItemSkyPearl.getX(stack);
int z = ItemSkyPearl.getZ(stack);
@@ -119,15 +120,13 @@ public class GuiWarpGateDestinations extends GuiScreen {
ItemStack stack = warpGate.getStackInSlot(i);
if (stack != null && ItemSkyPearl.isAttuned(stack)) {
int dim = ItemSkyPearl.getDim(stack);
if (warpGate.getWorldObj().provider.dimensionId != dim)
continue;
if (warpGate.getWorldObj().provider.dimensionId != dim) continue;
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});
}
}
@@ -148,17 +147,25 @@ public class GuiWarpGateDestinations extends GuiScreen {
GL11.glEnable(GL11.GL_TEXTURE_2D);
GL11.glDisable(GL11.GL_BLEND);
fontRendererObj.drawStringWithShadow(EnumChatFormatting.UNDERLINE + StatCollector.translateToLocal("ttmisc.destinations"), 3, 40, 0xFFFFFF);
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);
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) {
@@ -171,22 +178,33 @@ public class GuiWarpGateDestinations extends GuiScreen {
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);
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();
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 (stack != null) {
ItemSkyPearl.addInfo(stack, warpGate.getWorldObj().provider.dimensionId, Vector3.fromTileEntity(warpGate), tooltip, true);
ItemSkyPearl.addInfo(
stack,
warpGate.getWorldObj().provider.dimensionId,
Vector3.fromTileEntity(warpGate),
tooltip,
true);
tooltip.add(StatCollector.translateToLocal("ttmisc.clickToTeleport"));
} else {
tooltip.add("X: " + x);
@@ -218,5 +236,4 @@ public class GuiWarpGateDestinations extends GuiScreen {
tessellator.addVertexWithUV(0.0D, 0.0D, 0.0D, 0.0D, par1);
tessellator.draw();
}
}
@@ -23,6 +23,5 @@ public final class LibRenderIDs {
public static int idFire = -1;
public static int idGrain = -1;
}
@@ -85,4 +85,4 @@ public class ModelMagnet extends ModelBase {
model.rotateAngleY = y;
model.rotateAngleZ = z;
}
}
}
@@ -85,4 +85,4 @@ public class ModelRelay extends ModelBase {
model.rotateAngleY = y;
model.rotateAngleZ = z;
}
}
}
@@ -150,7 +150,6 @@ public class ModelRepairer extends ModelBase {
Opening2.render(scale);
Opening3.render(scale);
Opening4.render(scale);
}
public void renderGlass() {
@@ -168,5 +167,4 @@ public class ModelRepairer extends ModelBase {
model.rotateAngleY = y;
model.rotateAngleZ = z;
}
}
@@ -79,8 +79,7 @@ public class ModelSpinningCubes extends ModelBase {
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();
}
@@ -88,8 +87,6 @@ public class ModelSpinningCubes extends ModelBase {
GL11.glEnable(GL11.GL_TEXTURE_2D);
if (repeat != 0)
renderSpinningCubes(cubes, repeat - 1, origRepeat);
if (repeat != 0) renderSpinningCubes(cubes, repeat - 1, origRepeat);
}
}
@@ -70,10 +70,8 @@ public class ModelWings extends ModelBiped {
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) {
@@ -90,5 +88,4 @@ public class ModelWings extends ModelBiped {
model.rotateAngleY = y;
model.rotateAngleZ = z;
}
}
@@ -15,19 +15,18 @@ import thaumic.tinkerer.common.block.BlockInfusedGrain;
*/
public class RenderInfusedCrops implements ISimpleBlockRenderingHandler {
@Override
public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer) {}
@Override
public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer) {
}
@Override
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
public boolean renderWorldBlock(
IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
GL11.glPushMatrix();
Aspect aspect = BlockInfusedGrain.getAspect(world, x, y, z);
GL11.glPushAttrib(GL11.GL_COLOR_BUFFER_BIT);
if (aspect != null && !aspect.isPrimal()) {
//Hex to RGB code from vanilla tesselator
// Hex to RGB code from vanilla tesselator
float r = (aspect.getColor() >> 16 & 0xFF) / 255.0F;
float g = (aspect.getColor() >> 8 & 0xFF) / 255.0F;
float b = (aspect.getColor() & 0xFF) / 255.0F;
@@ -41,7 +40,7 @@ public class RenderInfusedCrops implements ISimpleBlockRenderingHandler {
tessellator.setBrightness(block.getMixedBrightnessForBlock(world, x, y, z));
renderer.renderBlockCropsImpl(block, world.getBlockMetadata(x, y, z), x, y - 0.0625F, z);
renderer.clearOverrideBlockTexture();
//Tessellator.instance.setColorOpaque_I(0xFFFFFF);
// Tessellator.instance.setColorOpaque_I(0xFFFFFF);
GL11.glPopAttrib();
GL11.glPopMatrix();
@@ -37,7 +37,8 @@ public class RenderMagnet implements ISimpleBlockRenderingHandler {
}
@Override
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
public boolean renderWorldBlock(
IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
return false;
}
@@ -50,5 +51,4 @@ public class RenderMagnet implements ISimpleBlockRenderingHandler {
public int getRenderId() {
return LibRenderIDs.idMagnet;
}
}
}
@@ -34,7 +34,8 @@ public class RenderRepairer implements ISimpleBlockRenderingHandler {
}
@Override
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
public boolean renderWorldBlock(
IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
return false;
}
@@ -47,5 +48,4 @@ public class RenderRepairer implements ISimpleBlockRenderingHandler {
public int getRenderId() {
return LibRenderIDs.idRepairer;
}
}
}
@@ -47,7 +47,8 @@ public class RenderWarpGate extends BlockRenderer implements ISimpleBlockRenderi
}
@Override
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
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);
@@ -73,5 +74,4 @@ public class RenderWarpGate extends BlockRenderer implements ISimpleBlockRenderi
public int getRenderId() {
return LibRenderIDs.idWarpGate;
}
}
@@ -21,12 +21,9 @@ public class RenderGenericSeeds implements IItemRenderer {
@Override
public boolean handleRenderType(ItemStack item, ItemRenderType type) {
if (type == ItemRenderType.INVENTORY)
return true;
if (type == ItemRenderType.EQUIPPED)
return true;
if (type == ItemRenderType.ENTITY)
return true;
if (type == ItemRenderType.INVENTORY) return true;
if (type == ItemRenderType.EQUIPPED) return true;
if (type == ItemRenderType.ENTITY) return true;
if (type == ItemRenderType.EQUIPPED_FIRST_PERSON) {
return true;
}
@@ -35,10 +32,8 @@ public class RenderGenericSeeds implements IItemRenderer {
@Override
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) {
if (helper == ItemRendererHelper.ENTITY_BOBBING)
return true;
if (helper == ItemRendererHelper.ENTITY_ROTATION)
return true;
if (helper == ItemRendererHelper.ENTITY_BOBBING) return true;
if (helper == ItemRendererHelper.ENTITY_ROTATION) return true;
return false;
}
@@ -82,7 +77,15 @@ public class RenderGenericSeeds implements IItemRenderer {
private void renderItemInEquipped(ItemStack itemstack, Aspect aspect, IIcon icon) {
Tessellator tessellator = Tessellator.instance;
setColorForAspect(aspect);
ItemRenderer.renderItemIn2D(tessellator, icon.getMaxU(), icon.getMinV(), icon.getMinU(), icon.getMaxV(), icon.getIconWidth(), icon.getIconHeight(), 0.0625F);
ItemRenderer.renderItemIn2D(
tessellator,
icon.getMaxU(),
icon.getMinV(),
icon.getMinU(),
icon.getMaxV(),
icon.getIconWidth(),
icon.getIconHeight(),
0.0625F);
GL11.glColor3f(1.0F, 1.0F, 1.0F);
}
@@ -99,7 +102,15 @@ public class RenderGenericSeeds implements IItemRenderer {
float scale = 0.7F;
GL11.glPushMatrix();
GL11.glScalef(scale, scale, scale);
ItemRenderer.renderItemIn2D(tesselator, texture.getMaxU(), texture.getMinV(), texture.getMinU(), texture.getMaxV(), texture.getIconWidth(), texture.getIconHeight(), .05F);
ItemRenderer.renderItemIn2D(
tesselator,
texture.getMaxU(),
texture.getMinV(),
texture.getMinU(),
texture.getMaxV(),
texture.getIconWidth(),
texture.getIconHeight(),
.05F);
GL11.glPopMatrix();
}
@@ -114,11 +125,11 @@ public class RenderGenericSeeds implements IItemRenderer {
}
private void setColorForAspect(Aspect aspect) {
//if(!aspect.isPrimal()){
// if(!aspect.isPrimal()){
// float r = (aspect.getColor() >> 16 & 0xFF) / 255.0F;
// float g = (aspect.getColor() >> 8 & 0xFF) / 255.0F;
// float b = (aspect.getColor() & 0xFF) / 255.0F;
// GL11.glColor3f(r, g, b);
//}
// }
}
}
@@ -22,7 +22,8 @@ public class RenderMobDisplay implements IItemRenderer {
}
@Override
public boolean shouldUseRenderHelper(ItemRenderType itemRenderType, ItemStack itemStack, ItemRendererHelper itemRendererHelper) {
public boolean shouldUseRenderHelper(
ItemRenderType itemRenderType, ItemStack itemStack, ItemRendererHelper itemRendererHelper) {
return true;
}
@@ -39,9 +40,7 @@ public class RenderMobDisplay implements IItemRenderer {
verticalOffset = aspect.getVerticalOffset();
}
switch (itemRenderType) {
case ENTITY:
GL11.glPushMatrix();
GL11.glTranslated(0.5, 0.2 + verticalOffset, 0.5);
GL11.glRotatef(-30.0F, 1.0F, 0.0F, 0.0F);
@@ -56,11 +55,10 @@ public class RenderMobDisplay implements IItemRenderer {
entity.copyLocationAndAnglesFrom(eItem);
if (renderer != null && renderer.getFontRendererFromRenderManager() != null) {
GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
//if (renderWithLighting) RenderUtils.enableLightmap();
// if (renderWithLighting) RenderUtils.enableLightmap();
renderer.doRender(entity, 0, 0, 0, 0, 0);
GL11.glPopAttrib();
}
}
entity.worldObj = null;
}
@@ -81,11 +79,10 @@ public class RenderMobDisplay implements IItemRenderer {
Render renderer = RenderManager.instance.getEntityRenderObject(entity);
if (renderer != null && renderer.getFontRendererFromRenderManager() != null) {
GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
//if (renderWithLighting) RenderUtils.enableLightmap();
// if (renderWithLighting) RenderUtils.enableLightmap();
renderer.doRender(entity, 0, 0, 0, 0, 0);
GL11.glPopAttrib();
}
}
entity.worldObj = null;
}
@@ -95,4 +92,4 @@ public class RenderMobDisplay implements IItemRenderer {
break;
}
}
}
}
@@ -18,8 +18,8 @@ public class RenderPlacementMirror implements IItemRenderer {
@Override
public boolean handleRenderType(ItemStack item, ItemRenderType type) {
//return type != ItemRenderType.INVENTORY && type!=ItemRenderType.ENTITY;
//return type != ItemRenderType.INVENTORY ;
// return type != ItemRenderType.INVENTORY && type!=ItemRenderType.ENTITY;
// return type != ItemRenderType.INVENTORY ;
return true;
}
@@ -40,7 +40,9 @@ public class RenderPlacementMirror implements IItemRenderer {
}
case EQUIPPED: {
for (int i = 1; i >= 0; i--) {
IIcon icon = ThaumicTinkerer.registry.getFirstItemFromClass(ItemPlacementMirror.class).getIconFromDamageForRenderPass(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);
@@ -50,7 +52,8 @@ public class RenderPlacementMirror implements IItemRenderer {
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);
ItemRenderer.renderItemIn2D(
Tessellator.instance, f1, f2, f, f3, icon.getIconWidth(), icon.getIconHeight(), 1F / 16F);
}
GL11.glDisable(GL11.GL_BLEND);
break;
@@ -74,5 +77,4 @@ public class RenderPlacementMirror implements IItemRenderer {
break;
}
}
}
@@ -36,11 +36,11 @@ public class RenderTileAnimationTablet extends TileEntitySpecialRenderer {
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
@@ -48,16 +48,14 @@ public class RenderTileAnimationTablet extends TileEntitySpecialRenderer {
TileAnimationTablet tile = (TileAnimationTablet) tileentity;
int meta = tile.getBlockMetadata() & 7;
if (meta < 2)
meta = 2; // Just in case
if (meta < 2) meta = 2; // Just in case
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);
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);
@@ -83,10 +81,8 @@ public class RenderTileAnimationTablet extends TileEntitySpecialRenderer {
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);
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;
@@ -94,13 +90,20 @@ public class RenderTileAnimationTablet extends TileEntitySpecialRenderer {
}
}
private void renderOverlay(TileAnimationTablet tablet, ResourceLocation texture, int rotationMod, boolean useLighting, boolean useBlend, double size, float height, float forceDeg) {
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 (!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);
@@ -119,8 +122,7 @@ public class RenderTileAnimationTablet extends TileEntitySpecialRenderer {
tess.addVertexWithUV(size2, 0, size2, 0, 0);
tess.draw();
GL11.glDepthMask(true);
if (!useLighting)
GL11.glEnable(GL11.GL_LIGHTING);
if (!useLighting) GL11.glEnable(GL11.GL_LIGHTING);
GL11.glPopMatrix();
}
}
}
@@ -14,6 +14,7 @@
*/
package thaumic.tinkerer.client.render.tile;
import java.awt.*;
import net.minecraft.client.renderer.ItemRenderer;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.texture.TextureMap;
@@ -27,8 +28,6 @@ import thaumcraft.client.renderers.item.ItemWandRenderer;
import thaumic.tinkerer.client.core.helper.ClientHelper;
import thaumic.tinkerer.common.block.tile.TileEnchanter;
import java.awt.*;
public class RenderTileEnchanter extends TileEntitySpecialRenderer {
ItemWandRenderer wandRenderer = new ItemWandRenderer();
@@ -61,7 +60,8 @@ public class RenderTileEnchanter extends TileEntitySpecialRenderer {
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);
ItemRenderer.renderItemIn2D(
Tessellator.instance, f1, f2, f, f3, icon.getIconWidth(), icon.getIconHeight(), 1F / 16F);
GL11.glColor3f(1F, 1F, 1F);
}
renderPass++;
@@ -35,14 +35,13 @@ public class RenderTileFunnel extends TileEntitySpecialRenderer {
if (stack != null) {
GL11.glPushMatrix();
GL11.glTranslated(d0 + 0.5, d1 + 0.365, d2 + 0.5);
//if(Block.getBlockFromItem(stack.getItem())== ConfigBlocks.blockJar) {
// 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();
}
}
}
@@ -44,14 +44,25 @@ public class RenderTileMagnet extends TileEntitySpecialRenderer {
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;
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()));
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);
@@ -65,7 +76,16 @@ public class RenderTileMagnet extends TileEntitySpecialRenderer {
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);
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);
@@ -74,4 +94,4 @@ public class RenderTileMagnet extends TileEntitySpecialRenderer {
GL11.glPopMatrix();
}
}
}
@@ -41,4 +41,4 @@ public class RenderTileRelay extends TileEntitySpecialRenderer {
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
GL11.glPopMatrix();
}
}
}
@@ -14,6 +14,7 @@
*/
package thaumic.tinkerer.client.render.tile;
import java.awt.*;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.ItemRenderer;
import net.minecraft.client.renderer.Tessellator;
@@ -30,8 +31,6 @@ import thaumic.tinkerer.client.lib.LibResources;
import thaumic.tinkerer.client.model.ModelRepairer;
import thaumic.tinkerer.common.block.tile.TileRepairer;
import java.awt.*;
public class RenderTileRepairer extends TileEntitySpecialRenderer {
private static final ResourceLocation modelTex = new ResourceLocation(LibResources.MODEL_REPAIRER);
@@ -85,7 +84,8 @@ public class RenderTileRepairer extends TileEntitySpecialRenderer {
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);
ItemRenderer.renderItemIn2D(
Tessellator.instance, f1, f2, f, f3, icon.getIconWidth(), icon.getIconHeight(), 1F / 16F);
GL11.glColor3f(1F, 1F, 1F);
}
renderPass++;
@@ -131,5 +131,4 @@ public class RenderTileRepairer extends TileEntitySpecialRenderer {
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glPopMatrix();
}
}
@@ -33,5 +33,4 @@ public class RenderTileWarpGate extends TileEntitySpecialRenderer {
cubes.renderSpinningCubes(12, repeat, repeat);
GL11.glPopMatrix();
}
}
@@ -14,7 +14,6 @@
*/
package thaumic.tinkerer.common;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
@@ -24,6 +23,7 @@ import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.*;
import cpw.mods.fml.common.network.NetworkRegistry;
import cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper;
import java.util.Arrays;
import net.minecraft.command.ICommandManager;
import net.minecraft.command.ServerCommandManager;
import net.minecraft.server.MinecraftServer;
@@ -43,8 +43,6 @@ import thaumic.tinkerer.common.peripheral.PeripheralHandler;
import thaumic.tinkerer.common.registry.TTRegistry;
import thaumic.tinkerer.common.research.KamiResearchItem;
import java.util.Arrays;
@Mod(modid = LibMisc.MOD_ID, name = LibMisc.MOD_NAME, version = LibMisc.VERSION, dependencies = LibMisc.DEPENDENCIES)
public class ThaumicTinkerer {
@@ -67,9 +65,9 @@ public class ThaumicTinkerer {
tcProxy = Thaumcraft.proxy;
proxy.preInit(event);
if (Loader.isModLoaded("Waila")) {
FMLInterModComms.sendMessage("Waila", "register", "thaumic.tinkerer.common.compat.TTinkererProvider.callbackRegister");
FMLInterModComms.sendMessage(
"Waila", "register", "thaumic.tinkerer.common.compat.TTinkererProvider.callbackRegister");
}
}
@EventHandler
@@ -89,17 +87,14 @@ public class ThaumicTinkerer {
String[] values = message.getStringValue().split(",");
KamiResearchItem.Blacklist.addAll(Arrays.asList(values));
}
if(message.key.equalsIgnoreCase(InterModCommsOperations.ADD_CC_BLACKLIST))
{
if(Loader.isModLoaded("ComputerCraft"))
blackListCCDevices(message.getStringValue());
if (message.key.equalsIgnoreCase(InterModCommsOperations.ADD_CC_BLACKLIST)) {
if (Loader.isModLoaded("ComputerCraft")) blackListCCDevices(message.getStringValue());
}
}
}
@Optional.Method(modid = "ComputerCraft")
public void blackListCCDevices(String classname)
{
public void blackListCCDevices(String classname) {
PeripheralHandler.Blacklist.add(classname);
}
@@ -115,6 +110,5 @@ public class ThaumicTinkerer {
@EventHandler
public void postInit(FMLPostInitializationEvent event) {
proxy.postInit(event);
}
}
@@ -16,6 +16,8 @@ package thaumic.tinkerer.common.block;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import java.util.ArrayList;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
@@ -49,9 +51,6 @@ import thaumic.tinkerer.common.research.IRegisterableResearch;
import thaumic.tinkerer.common.research.ResearchHelper;
import thaumic.tinkerer.common.research.TTResearchItem;
import java.util.ArrayList;
import java.util.Random;
public class BlockAnimationTablet extends BlockModContainer {
IIcon iconBottom;
@@ -79,27 +78,24 @@ public class BlockAnimationTablet extends BlockModContainer {
}
@Override
public void onBlockPlacedBy(World par1World, int par2, int par3, int par4, EntityLivingBase par5EntityLiving, ItemStack par6ItemStack) {
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) {
// TileAnimationTablet tablet = (TileAnimationTablet) par1World.getTileEntity(par2, par3, par4);
// if(par5EntityLiving instanceof EntityPlayer) {
// tablet.Owner = ((EntityPlayer) par5EntityLiving).username;
//}
// }
}
@Override
@@ -108,8 +104,9 @@ public class BlockAnimationTablet extends BlockModContainer {
if (tablet != null) {
if (tablet.getIsBreaking()) {
//ChunkCoordinates coords = tablet.getTargetLoc();
//par1World.destroyBlockInWorldPartially(tablet.getFakePlayer().entityId, coords.posX, coords.posY, coords.posZ, -1);
// ChunkCoordinates coords = tablet.getTargetLoc();
// par1World.destroyBlockInWorldPartially(tablet.getFakePlayer().entityId, coords.posX, coords.posY,
// coords.posZ, -1);
}
for (int j1 = 0; j1 < tablet.getSizeInventory(); ++j1) {
@@ -120,26 +117,33 @@ public class BlockAnimationTablet extends BlockModContainer {
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)) {
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()));
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());
entityitem.getEntityItem().setTagCompound((NBTTagCompound)
itemstack.getTagCompound().copy());
}
}
}
//Look here if something breaks in 1.7
// Look here if something breaks in 1.7
par1World.func_147453_f(par2, par3, par4, par5);
}
@@ -148,18 +152,17 @@ public class BlockAnimationTablet extends BlockModContainer {
@Override
public void onNeighborBlockChange(World par1World, int par2, int par3, int par4, Block par5) {
if (par1World.isRemote)
return;
if (par1World.isRemote) return;
boolean power = par1World.isBlockIndirectlyGettingPowered(par2, par3, par4) || par1World.isBlockIndirectlyGettingPowered(par2, par3 + 1, par4);
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);
} else if (!power && on) par1World.setBlockMetadataWithNotify(par2, par3, par4, meta & 7, 4);
}
@Override
@@ -175,32 +178,50 @@ public class BlockAnimationTablet extends BlockModContainer {
if (tablet.redstone && tablet.swingProgress == 0) {
tablet.findEntities(tablet.getTargetLoc());
tablet.initiateSwing();
par1World.addBlockEvent(par2, par3, par4, ThaumicTinkerer.registry.getFirstBlockFromClass(BlockAnimationTablet.class), 0, 0);
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) {
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) {
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"));
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(""))
// if(tablet.Owner==null || tablet.Owner.equals(""))
// tablet.Owner=par5EntityPlayer.username;
par5EntityPlayer.openGui(ThaumicTinkerer.instance, LibGuiIDs.GUI_ID_TABLET, par1World, par2, par3, par4);
par5EntityPlayer.openGui(
ThaumicTinkerer.instance, LibGuiIDs.GUI_ID_TABLET, par1World, par2, par3, par4);
}
}
}
@@ -211,7 +232,9 @@ public class BlockAnimationTablet extends BlockModContainer {
@Override
@SideOnly(Side.CLIENT)
public IIcon getIcon(int par1, int par2) {
return par1 == ForgeDirection.UP.ordinal() ? iconTop : par1 == ForgeDirection.DOWN.ordinal() ? iconBottom : iconSides;
return par1 == ForgeDirection.UP.ordinal()
? iconTop
: par1 == ForgeDirection.DOWN.ordinal() ? iconBottom : iconSides;
}
@Override
@@ -261,18 +284,36 @@ public class BlockAnimationTablet extends BlockModContainer {
@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)
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));
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));
}
}
@@ -15,6 +15,8 @@
package thaumic.tinkerer.common.block;
import cpw.mods.fml.common.Loader;
import java.util.ArrayList;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
@@ -43,9 +45,6 @@ import thaumic.tinkerer.common.research.IRegisterableResearch;
import thaumic.tinkerer.common.research.ResearchHelper;
import thaumic.tinkerer.common.research.TTResearchItem;
import java.util.ArrayList;
import java.util.Random;
public class BlockAspectAnalyzer extends BlockModContainer {
IIcon[] icons = new IIcon[5];
@@ -61,11 +60,21 @@ public class BlockAspectAnalyzer extends BlockModContainer {
}
@Override
public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) {
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);
par5EntityPlayer.openGui(
ThaumicTinkerer.instance, LibGuiIDs.GUI_ID_ASPECT_ANALYZER, par1World, par2, par3, par4);
}
}
@@ -85,21 +94,28 @@ public class BlockAspectAnalyzer extends BlockModContainer {
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)) {
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()));
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());
entityitem.getEntityItem().setTagCompound((NBTTagCompound)
itemstack.getTagCompound().copy());
}
}
}
@@ -112,8 +128,7 @@ public class BlockAspectAnalyzer extends BlockModContainer {
@Override
public void registerBlockIcons(IIconRegister par1IconRegister) {
for (int i = 0; i < 5; i++)
icons[i] = IconHelper.forBlock(par1IconRegister, this, i);
for (int i = 0; i < 5; i++) icons[i] = IconHelper.forBlock(par1IconRegister, this, i);
}
@Override
@@ -158,16 +173,38 @@ public class BlockAspectAnalyzer extends BlockModContainer {
@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()
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));
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));
}
}
@@ -16,6 +16,8 @@ package thaumic.tinkerer.common.block;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import java.util.Arrays;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.block.BlockDirectional;
import net.minecraft.block.material.Material;
@@ -30,9 +32,6 @@ import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import thaumic.tinkerer.common.block.tile.TileCamo;
import java.util.Arrays;
import java.util.List;
public abstract class BlockCamo extends BlockModContainer<TileCamo> {
static List<Integer> validRenderTypes = Arrays.asList(0, 31, 39);
@@ -49,8 +48,7 @@ public abstract class BlockCamo extends BlockModContainer<TileCamo> {
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 (block != null && isValidRenderType(block.getRenderType())) return block.getIcon(side, camo.camoMeta);
}
return getIconFromSideAfterCheck(tile, meta, side);
@@ -61,7 +59,16 @@ public abstract class BlockCamo extends BlockModContainer<TileCamo> {
}
@Override
public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) {
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) {
@@ -79,8 +86,10 @@ public abstract class BlockCamo extends BlockModContainer<TileCamo> {
}
block = Block.getBlockFromItem(currentStack.getItem());
if (block == null || !isValidRenderType(block.getRenderType()) || block instanceof BlockCamo || block.getMaterial() == Material.air)
doChange = false;
if (block == null
|| !isValidRenderType(block.getRenderType())
|| block instanceof BlockCamo
|| block.getMaterial() == Material.air) doChange = false;
}
}
@@ -135,7 +144,6 @@ public abstract class BlockCamo extends BlockModContainer<TileCamo> {
Block block = camo.camo;
if (block != null)
return block instanceof BlockCamo ? 0xFFFFFF : block.colorMultiplier(par1World, par2, par3, par4);
}
return 0xFFFFFF;
}
@@ -16,6 +16,8 @@ package thaumic.tinkerer.common.block;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import java.util.ArrayList;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
@@ -47,9 +49,6 @@ import thaumic.tinkerer.common.research.IRegisterableResearch;
import thaumic.tinkerer.common.research.ResearchHelper;
import thaumic.tinkerer.common.research.TTResearchItem;
import java.util.ArrayList;
import java.util.Random;
public class BlockEnchanter extends BlockModContainer {
Random random;
@@ -68,12 +67,22 @@ public class BlockEnchanter extends BlockModContainer {
}
@Override
public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) {
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);
par5EntityPlayer.openGui(
ThaumicTinkerer.instance, LibGuiIDs.GUI_ID_ENCHANTER, par1World, par2, par3, par4);
}
}
@@ -93,21 +102,28 @@ public class BlockEnchanter extends BlockModContainer {
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)) {
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()));
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());
entityitem.getEntityItem().setTagCompound((NBTTagCompound)
itemstack.getTagCompound().copy());
}
}
}
@@ -129,7 +145,9 @@ public class BlockEnchanter extends BlockModContainer {
@Override
@SideOnly(Side.CLIENT)
public IIcon getIcon(int par1, int par2) {
return par1 == ForgeDirection.UP.ordinal() ? iconTop : par1 == ForgeDirection.DOWN.ordinal() ? iconBottom : iconSides;
return par1 == ForgeDirection.UP.ordinal()
? iconTop
: par1 == ForgeDirection.DOWN.ordinal() ? iconBottom : iconSides;
}
@Override
@@ -179,14 +197,46 @@ public class BlockEnchanter extends BlockModContainer {
@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));
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)));
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)));
}
}
@@ -1,5 +1,6 @@
package thaumic.tinkerer.common.block;
import java.util.ArrayList;
import net.minecraft.block.material.Material;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
@@ -9,8 +10,6 @@ import thaumic.tinkerer.common.lib.LibBlockNames;
import thaumic.tinkerer.common.registry.ThaumicTinkererRecipe;
import thaumic.tinkerer.common.research.IRegisterableResearch;
import java.util.ArrayList;
/**
* Created by pixlepix on 4/19/14.
*/
@@ -16,6 +16,8 @@ package thaumic.tinkerer.common.block;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import java.util.ArrayList;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
@@ -44,9 +46,6 @@ import thaumic.tinkerer.common.research.IRegisterableResearch;
import thaumic.tinkerer.common.research.ResearchHelper;
import thaumic.tinkerer.common.research.TTResearchItem;
import java.util.ArrayList;
import java.util.Random;
public class BlockFunnel extends BlockModContainer {
IIcon sideIcon, topIcon;
@@ -118,21 +117,28 @@ public class BlockFunnel extends BlockModContainer {
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)) {
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()));
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());
entityitem.getEntityItem().setTagCompound((NBTTagCompound)
itemstack.getTagCompound().copy());
}
}
}
@@ -144,7 +150,16 @@ public class BlockFunnel extends BlockModContainer {
}
@Override
public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) {
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);
@@ -207,16 +222,31 @@ public class BlockFunnel extends BlockModContainer {
@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();
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),
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));
'S',
new ItemStack(Blocks.stone),
'T',
new ItemStack(ConfigItems.itemResource, 1, 2));
}
}
@@ -16,6 +16,8 @@ package thaumic.tinkerer.common.block;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import java.util.ArrayList;
import java.util.Random;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.Entity;
@@ -31,9 +33,6 @@ import thaumic.tinkerer.common.registry.ITTinkererBlock;
import thaumic.tinkerer.common.registry.ThaumicTinkererRecipe;
import thaumic.tinkerer.common.research.IRegisterableResearch;
import java.util.ArrayList;
import java.util.Random;
public abstract class BlockGas extends BlockMod implements ITTinkererBlock {
public BlockGas() {
@@ -83,8 +82,7 @@ public abstract class BlockGas extends BlockMod implements ITTinkererBlock {
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);
if (!world.isRemote) world.setBlock(x, y, z, this, meta, 2);
world.scheduleBlockUpdate(x, y, z, this, 10);
}
}
@@ -16,14 +16,13 @@ package thaumic.tinkerer.common.block;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import java.util.Random;
import net.minecraft.item.ItemBlock;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import thaumic.tinkerer.common.ThaumicTinkerer;
import thaumic.tinkerer.common.lib.LibBlockNames;
import java.util.Random;
public class BlockGaseousLight extends BlockGas {
public BlockGaseousLight() {
@@ -57,4 +56,4 @@ public class BlockGaseousLight extends BlockGas {
public Class<? extends TileEntity> getTileEntity() {
return null;
}
}
}
@@ -16,14 +16,13 @@ package thaumic.tinkerer.common.block;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import java.util.Random;
import net.minecraft.item.ItemBlock;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import thaumic.tinkerer.common.ThaumicTinkerer;
import thaumic.tinkerer.common.lib.LibBlockNames;
import java.util.Random;
public class BlockGaseousShadow extends BlockGas {
public BlockGaseousShadow() {
@@ -35,7 +34,8 @@ public class BlockGaseousShadow extends BlockGas {
@SideOnly(Side.CLIENT)
public void randomDisplayTick(World par1World, int par2, int par3, int par4, Random par5Random) {
if (par5Random.nextFloat() < 0.0075F)
ThaumicTinkerer.tcProxy.wispFX2(par1World, par2 + 0.5, par3 + 0.5, par4 + 0.5, 0.125F, 5, true, true, -0.02F);
ThaumicTinkerer.tcProxy.wispFX2(
par1World, par2 + 0.5, par3 + 0.5, par4 + 0.5, 0.125F, 5, true, true, -0.02F);
}
@Override
@@ -57,4 +57,4 @@ public class BlockGaseousShadow extends BlockGas {
public Class<? extends TileEntity> getTileEntity() {
return null;
}
}
}
@@ -1,6 +1,7 @@
package thaumic.tinkerer.common.block;
import cpw.mods.fml.common.Loader;
import java.util.ArrayList;
import net.minecraft.block.material.Material;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
@@ -23,8 +24,6 @@ import thaumic.tinkerer.common.research.IRegisterableResearch;
import thaumic.tinkerer.common.research.ResearchHelper;
import thaumic.tinkerer.common.research.TTResearchItem;
import java.util.ArrayList;
public class BlockGolemConnector extends BlockCamo {
public BlockGolemConnector() {
@@ -79,17 +78,46 @@ public class BlockGolemConnector extends BlockCamo {
@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"));
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));
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));
}
}
}
@@ -2,6 +2,8 @@ package thaumic.tinkerer.common.block;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import java.util.ArrayList;
import java.util.Random;
import net.minecraft.block.BlockFarmland;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.Entity;
@@ -20,17 +22,14 @@ import thaumic.tinkerer.common.registry.ITTinkererBlock;
import thaumic.tinkerer.common.registry.ThaumicTinkererRecipe;
import thaumic.tinkerer.common.research.IRegisterableResearch;
import java.util.ArrayList;
import java.util.Random;
/**
* Created by pixlepix on 8/4/14.
*/
public class BlockInfusedFarmland extends BlockFarmland implements ITTinkererBlock {
@SideOnly(Side.CLIENT)
private IIcon iconWet;
@SideOnly(Side.CLIENT)
private IIcon iconDry;
@@ -83,7 +82,8 @@ public class BlockInfusedFarmland extends BlockFarmland implements ITTinkererBlo
}
@Override
public boolean canSustainPlant(IBlockAccess world, int x, int y, int z, ForgeDirection direction, IPlantable plantable) {
public boolean canSustainPlant(
IBlockAccess world, int x, int y, int z, ForgeDirection direction, IPlantable plantable) {
return plantable instanceof BlockInfusedGrain;
}
@@ -102,15 +102,19 @@ public class BlockInfusedFarmland extends BlockFarmland implements ITTinkererBlo
return null;
}
//Prevent farmland degrading
// Prevent farmland degrading
@Override
public void onFallenUpon(World p_149746_1_, int p_149746_2_, int p_149746_3_, int p_149746_4_, Entity p_149746_5_, float p_149746_6_) {
}
public void onFallenUpon(
World p_149746_1_,
int p_149746_2_,
int p_149746_3_,
int p_149746_4_,
Entity p_149746_5_,
float p_149746_6_) {}
@Override
public void updateTick(World p_149674_1_, int p_149674_2_, int p_149674_3_, int p_149674_4_, Random p_149674_5_) {
}
public void updateTick(World p_149674_1_, int p_149674_2_, int p_149674_3_, int p_149674_4_, Random p_149674_5_) {}
@SideOnly(Side.CLIENT)
public IIcon getIcon(int p_149691_1_, int p_149691_2_) {
@@ -121,5 +125,4 @@ public class BlockInfusedFarmland extends BlockFarmland implements ITTinkererBlo
public void registerBlockIcons(IIconRegister p_149651_1_) {
this.iconWet = IconHelper.forBlock(p_149651_1_, this);
}
}
@@ -1,9 +1,10 @@
package thaumic.tinkerer.common.block;
import java.util.ArrayList;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.block.BlockCrops;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
@@ -25,23 +26,18 @@ import thaumic.tinkerer.common.registry.ITTinkererBlock;
import thaumic.tinkerer.common.registry.ThaumicTinkererRecipe;
import thaumic.tinkerer.common.research.IRegisterableResearch;
import java.util.ArrayList;
import java.util.Random;
/**
* Created by pixlepix on 4/14/14.
*/
public class BlockInfusedGrain extends BlockCrops implements ITTinkererBlock {
//Code based off vanilla potato code
// Code based off vanilla potato code
public static final int BREEDING_CHANCE = 10;
private IIcon[][] icons;
private TileInfusedGrain tileEntity;
//Returns 0-5 for primal aspects, or 6 if compound aspect
// Returns 0-5 for primal aspects, or 6 if compound aspect
public static int getNumberFromAspectForTexture(Aspect aspect) {
if (aspect == Aspect.AIR) {
return 0;
@@ -65,7 +61,9 @@ public class BlockInfusedGrain extends BlockCrops implements ITTinkererBlock {
}
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;
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) {
@@ -86,7 +84,7 @@ public class BlockInfusedGrain extends BlockCrops implements ITTinkererBlock {
}
}
//Override BlockCrop's getIcon to prevent a crash with mods such as WAILA
// Override BlockCrop's getIcon to prevent a crash with mods such as WAILA
@Override
public IIcon getIcon(int p_149691_1_, int p_149691_2_) {
return this.icons[1][0];
@@ -118,7 +116,7 @@ public class BlockInfusedGrain extends BlockCrops implements ITTinkererBlock {
public void breakBlock(World world, int x, int y, int z, Block block, int metadata) {
TileEntity tile = world.getTileEntity(x, y, z);
if (tile instanceof TileInfusedGrain) {
tileEntity = (TileInfusedGrain)tile;
tileEntity = (TileInfusedGrain) tile;
}
super.breakBlock(world, x, y, z, block, metadata);
}
@@ -126,8 +124,7 @@ public class BlockInfusedGrain extends BlockCrops implements ITTinkererBlock {
@Override
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune) {
ArrayList<ItemStack> ret = new ArrayList<ItemStack>();
if(world==null)
return ret;
if (world == null) return ret;
Random rand = new Random();
int count = 1;
for (int i = 0; i < count; i++) {
@@ -146,9 +143,8 @@ public class BlockInfusedGrain extends BlockCrops implements ITTinkererBlock {
if (metadata >= 7) {
do {
Aspect aspect = getAspectSafe(world, x, y, z);
ItemStack retItem=AspectCropLootManager.getLootForAspect(aspect);
if(retItem!=null)
ret.add(retItem);
ItemStack retItem = AspectCropLootManager.getLootForAspect(aspect);
if (retItem != null) ret.add(retItem);
} while (world.rand.nextInt(75) < getPrimalTendencyCount(world, x, y, z, Aspect.ORDER));
}
@@ -175,10 +171,9 @@ public class BlockInfusedGrain extends BlockCrops implements ITTinkererBlock {
}
}
public void updateTick(World world, int x, int y, int z, Random rand) {
//Prevent normal growth from occuring
//Growth takes place in the tile entity
// Prevent normal growth from occuring
// Growth takes place in the tile entity
checkAndDropBlock(world, x, y, z);
}
@@ -189,7 +184,10 @@ public class BlockInfusedGrain extends BlockCrops implements ITTinkererBlock {
AspectList farmlandAspectList = ((TileInfusedFarmland) world.getTileEntity(x, y - 1, z)).aspectList;
for (Aspect aspect : farmlandAspectList.getAspects()) {
Random rand = new Random();
if (rand.nextInt(BREEDING_CHANCE) < (getPrimalTendencyCount(world, x, y, z, Aspect.FIRE) + 1) * farmlandAspectList.getAmount(aspect) * farmlandAspectList.getAmount(aspect)) {
if (rand.nextInt(BREEDING_CHANCE)
< (getPrimalTendencyCount(world, x, y, z, Aspect.FIRE) + 1)
* farmlandAspectList.getAmount(aspect)
* farmlandAspectList.getAmount(aspect)) {
if (ResearchManager.getCombinationResult(aspect, currentAspect) != null) {
return ResearchManager.getCombinationResult(aspect, currentAspect);
}
@@ -250,17 +248,15 @@ public class BlockInfusedGrain extends BlockCrops implements ITTinkererBlock {
return null;
}
private TileInfusedGrain getTileEntitySafe(World world, int x, int y, int z)
{
private TileInfusedGrain getTileEntitySafe(World world, int x, int y, int z) {
if (tileEntity != null) {
return tileEntity;
}
TileEntity tile = world.getTileEntity(x, y, z);
if (tile != null && tile instanceof TileInfusedGrain)
{
return (TileInfusedGrain)tile;
if (tile != null && tile instanceof TileInfusedGrain) {
return (TileInfusedGrain) tile;
}
return null;
@@ -273,12 +269,10 @@ public class BlockInfusedGrain extends BlockCrops implements ITTinkererBlock {
TileEntity tile = world.getTileEntity(x, y, z);
if (tile != null && tile instanceof TileInfusedGrain)
{
return ((TileInfusedGrain)tile).aspect;
if (tile != null && tile instanceof TileInfusedGrain) {
return ((TileInfusedGrain) tile).aspect;
}
return null;
}
}
@@ -16,6 +16,10 @@ package thaumic.tinkerer.common.block;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.creativetab.CreativeTabs;
@@ -53,11 +57,6 @@ import thaumic.tinkerer.common.research.RecipeHelper;
import thaumic.tinkerer.common.research.ResearchHelper;
import thaumic.tinkerer.common.research.TTResearchItem;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Random;
public class BlockMagnet extends BlockModContainer implements IMultiTileEntityBlock {
Random random;
@@ -73,12 +72,22 @@ public class BlockMagnet extends BlockModContainer implements IMultiTileEntityBl
}
@Override
public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) {
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);
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);
}
@@ -109,21 +118,28 @@ public class BlockMagnet extends BlockModContainer implements IMultiTileEntityBl
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)) {
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()));
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());
entityitem.getEntityItem().setTagCompound((NBTTagCompound)
itemstack.getTagCompound().copy());
}
}
}
@@ -213,31 +229,75 @@ public class BlockMagnet extends BlockModContainer implements IMultiTileEntityBl
@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));
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() {
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)))
);
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
@@ -16,6 +16,7 @@ package thaumic.tinkerer.common.block;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import java.util.ArrayList;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
@@ -25,14 +26,11 @@ import thaumic.tinkerer.client.core.helper.IconHelper;
import thaumic.tinkerer.common.core.handler.ModCreativeTab;
import thaumic.tinkerer.common.registry.ITTinkererBlock;
import java.util.ArrayList;
public abstract class BlockMod extends Block implements ITTinkererBlock {
public BlockMod(Material par2Material) {
super(par2Material);
if (registerInCreative())
setCreativeTab(ModCreativeTab.INSTANCE);
if (registerInCreative()) setCreativeTab(ModCreativeTab.INSTANCE);
}
@Override
@@ -30,8 +30,7 @@ public abstract class BlockModContainer<T extends TileEntity> extends BlockConta
protected BlockModContainer(Material par2Material) {
super(par2Material);
if (registerInCreative())
setCreativeTab(ModCreativeTab.INSTANCE);
if (registerInCreative()) setCreativeTab(ModCreativeTab.INSTANCE);
}
@Override
@@ -16,6 +16,8 @@ package thaumic.tinkerer.common.block;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import java.util.List;
import java.util.Random;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemBlock;
import net.minecraft.tileentity.TileEntity;
@@ -28,9 +30,6 @@ import thaumic.tinkerer.common.item.ItemBrightNitor;
import thaumic.tinkerer.common.item.kami.armor.ItemGemLegs;
import thaumic.tinkerer.common.lib.LibBlockNames;
import java.util.List;
import java.util.Random;
public class BlockNitorGas extends BlockGas {
public BlockNitorGas() {
@@ -52,30 +51,33 @@ public class BlockNitorGas extends BlockGas {
@Override
public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random) {
if (!par1World.isRemote) {
boolean remove=false;
boolean remove = false;
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())
{
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);
remove=true;
}
else {
remove = true;
} 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))) {
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)
{
if (!has) {
par1World.setBlockToAir(par2, par3, par4);
remove=true;
remove = true;
}
}
if(!remove)
par1World.scheduleBlockUpdate(par2, par3, par4, this, tickRate(par1World));
if (!remove) par1World.scheduleBlockUpdate(par2, par3, par4, this, tickRate(par1World));
}
}
@@ -91,8 +93,7 @@ public class BlockNitorGas extends BlockGas {
@Override
public void onBlockAdded(World par1World, int par2, int par3, int par4) {
if (!par1World.isRemote)
par1World.scheduleBlockUpdate(par2, par3, par4, this, tickRate(par1World));
if (!par1World.isRemote) par1World.scheduleBlockUpdate(par2, par3, par4, this, tickRate(par1World));
}
@Override
@@ -109,4 +110,4 @@ public class BlockNitorGas extends BlockGas {
public Class<? extends TileEntity> getTileEntity() {
return null;
}
}
}
@@ -14,6 +14,8 @@
*/
package thaumic.tinkerer.common.block;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.entity.Entity;
@@ -37,9 +39,6 @@ import thaumic.tinkerer.common.research.IRegisterableResearch;
import thaumic.tinkerer.common.research.ResearchHelper;
import thaumic.tinkerer.common.research.TTResearchItem;
import java.util.ArrayList;
import java.util.List;
public class BlockPlatform extends BlockCamo {
public BlockPlatform() {
@@ -50,8 +49,17 @@ public class BlockPlatform extends BlockCamo {
}
@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()))
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);
}
@@ -97,16 +105,34 @@ public class BlockPlatform extends BlockCamo {
@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();
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));
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));
}
}
@@ -1,5 +1,7 @@
package thaumic.tinkerer.common.block;
import java.util.ArrayList;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.block.BlockPistonBase;
import net.minecraft.block.material.Material;
@@ -32,9 +34,6 @@ import thaumic.tinkerer.common.research.IRegisterableResearch;
import thaumic.tinkerer.common.research.ResearchHelper;
import thaumic.tinkerer.common.research.TTResearchItem;
import java.util.ArrayList;
import java.util.Random;
/**
* Created by nekosune on 28/06/14.
*/
@@ -46,7 +45,16 @@ public class BlockRPlacer extends BlockCamo implements IWandable {
}
@Override
public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) {
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);
TileRPlacer dislocator = (TileRPlacer) tile;
@@ -58,7 +66,6 @@ public class BlockRPlacer extends BlockCamo implements IWandable {
par1World.markBlockForUpdate(par2, par3, par4);
return true;
}
@@ -103,13 +110,44 @@ public class BlockRPlacer extends BlockCamo implements IWandable {
@Override
public IRegisterableResearch getResearchItem() {
return (IRegisterableResearch) new TTResearchItem(LibResearch.KEY_REMOTE_PLACER, new AspectList().add(Aspect.MECHANISM, 2).add(Aspect.MOTION, 1).add(Aspect.SENSES, 1), -6, 3, 3, new ItemStack(this)).setParents(LibResearch.KEY_ANIMATION_TABLET).setConcealed()
.setPages(new ResearchPage("0"), new ResearchPage("1"), ResearchHelper.arcaneRecipePage(LibResearch.KEY_REMOTE_PLACER));
return (IRegisterableResearch) new TTResearchItem(
LibResearch.KEY_REMOTE_PLACER,
new AspectList()
.add(Aspect.MECHANISM, 2)
.add(Aspect.MOTION, 1)
.add(Aspect.SENSES, 1),
-6,
3,
3,
new ItemStack(this))
.setParents(LibResearch.KEY_ANIMATION_TABLET)
.setConcealed()
.setPages(
new ResearchPage("0"),
new ResearchPage("1"),
ResearchHelper.arcaneRecipePage(LibResearch.KEY_REMOTE_PLACER));
}
@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
@@ -123,14 +161,22 @@ public class BlockRPlacer extends BlockCamo implements IWandable {
}
@Override
public void onBlockPlacedBy(World par1World, int par2, int par3, int par4, EntityLivingBase par5EntityLivingBase, ItemStack par6ItemStack) {
public void onBlockPlacedBy(
World par1World,
int par2,
int par3,
int par4,
EntityLivingBase par5EntityLivingBase,
ItemStack par6ItemStack) {
TileEntity tile = par1World.getTileEntity(par2, par3, par4);
((TileRPlacer) tile).orientation = BlockPistonBase.determineOrientation(par1World, par2, par3, par4, par5EntityLivingBase);
((TileRPlacer) tile).orientation =
BlockPistonBase.determineOrientation(par1World, par2, par3, par4, par5EntityLivingBase);
par1World.markBlockForUpdate(par2, par3, par4);
}
@Override
public int onWandRightClick(World world, ItemStack itemStack, EntityPlayer entityPlayer, int i, int i2, int i3, int i4, int i5) {
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()) {
entityPlayer.openGui(ThaumicTinkerer.instance, LibGuiIDs.GUI_ID_REMOTE_PLACER, world, i, i2, i3);
@@ -142,35 +188,28 @@ public class BlockRPlacer extends BlockCamo implements IWandable {
@Override
public ItemStack onWandRightClick(World world, ItemStack itemStack, EntityPlayer entityPlayer) {
return itemStack;
}
@Override
public void onUsingWandTick(ItemStack itemStack, EntityPlayer entityPlayer, int i) {
}
public void onUsingWandTick(ItemStack itemStack, EntityPlayer entityPlayer, int i) {}
@Override
public void onWandStoppedUsing(ItemStack itemStack, World world, EntityPlayer entityPlayer, int i) {
}
public void onWandStoppedUsing(ItemStack itemStack, World world, EntityPlayer entityPlayer, int i) {}
@Override
public void onNeighborBlockChange(World par1World, int par2, int par3, int par4, Block par5) {
if (par1World.isRemote)
return;
if (par1World.isRemote) return;
boolean power = par1World.isBlockIndirectlyGettingPowered(par2, par3, par4) || par1World.isBlockIndirectlyGettingPowered(par2, par3 + 1, par4);
boolean power = par1World.isBlockIndirectlyGettingPowered(par2, par3, par4)
|| par1World.isBlockIndirectlyGettingPowered(par2, par3 + 1, par4);
int meta = par1World.getBlockMetadata(par2, par3, par4);
boolean on = meta != 0;
if (power && !on) {
par1World.scheduleBlockUpdate(par2, par3, par4, this, tickRate(par1World));
par1World.setBlockMetadataWithNotify(par2, par3, par4, 1, 4);
} else if (!power && on)
par1World.setBlockMetadataWithNotify(par2, par3, par4, 0, 4);
} else if (!power && on) par1World.setBlockMetadataWithNotify(par2, par3, par4, 0, 4);
}
@Override
@@ -17,6 +17,8 @@ package thaumic.tinkerer.common.block;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import java.util.ArrayList;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.entity.EntityLivingBase;
@@ -48,9 +50,6 @@ import thaumic.tinkerer.common.research.IRegisterableResearch;
import thaumic.tinkerer.common.research.ResearchHelper;
import thaumic.tinkerer.common.research.TTResearchItem;
import java.util.ArrayList;
import java.util.Random;
public class BlockRepairer extends BlockModContainer {
Random random;
@@ -64,7 +63,16 @@ public class BlockRepairer extends BlockModContainer {
}
@Override
public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) {
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);
@@ -92,21 +100,18 @@ public class BlockRepairer extends BlockModContainer {
}
@Override
public void onBlockPlacedBy(World par1World, int par2, int par3, int par4, EntityLivingBase par5EntityLiving, ItemStack par6ItemStack) {
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);
}
@@ -124,29 +129,30 @@ public class BlockRepairer extends BlockModContainer {
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)) {
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));
} 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());
entityitem.getEntityItem().setTagCompound((NBTTagCompound)
itemstack.getTagCompound().copy());
}
}
}
@@ -215,14 +221,43 @@ public class BlockRepairer extends BlockModContainer {
@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")
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));
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
@@ -16,6 +16,8 @@ package thaumic.tinkerer.common.block;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import java.util.ArrayList;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
@@ -42,9 +44,6 @@ import thaumic.tinkerer.common.research.IRegisterableResearch;
import thaumic.tinkerer.common.research.ResearchHelper;
import thaumic.tinkerer.common.research.TTResearchItem;
import java.util.ArrayList;
import java.util.Random;
public class BlockSummon extends Block implements ITTinkererBlock {
IIcon iconTop;
@@ -92,7 +91,11 @@ public class BlockSummon extends Block implements ITTinkererBlock {
@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;
return par1 == ForgeDirection.UP.ordinal()
? iconTop
: par1 == ForgeDirection.DOWN.ordinal()
? Block.getBlockFromName("obsidian").getIcon(0, 0)
: iconSide;
}
@Override
@@ -127,13 +130,38 @@ public class BlockSummon extends Block implements ITTinkererBlock {
@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"));
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));
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));
}
}
@@ -2,6 +2,8 @@ package thaumic.tinkerer.common.block;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import java.util.ArrayList;
import java.util.Random;
import net.minecraft.block.BlockSlab;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
@@ -18,20 +20,14 @@ import net.minecraft.world.World;
import thaumcraft.common.Thaumcraft;
import thaumcraft.common.config.ConfigBlocks;
import thaumic.tinkerer.common.ThaumicTinkerer;
import thaumic.tinkerer.common.block.quartz.BlockDarkQuartz;
import thaumic.tinkerer.common.core.handler.ModCreativeTab;
import thaumic.tinkerer.common.item.ItemTravelSlab;
import thaumic.tinkerer.common.item.quartz.ItemDarkQuartzSlab;
import thaumic.tinkerer.common.lib.LibBlockNames;
import thaumic.tinkerer.common.lib.LibResearch;
import thaumic.tinkerer.common.registry.ITTinkererBlock;
import thaumic.tinkerer.common.registry.ThaumicTinkererCraftingBenchRecipe;
import thaumic.tinkerer.common.registry.ThaumicTinkererRecipe;
import thaumic.tinkerer.common.research.IRegisterableResearch;
import java.util.ArrayList;
import java.util.Random;
/**
* Created by Katrina on 13/04/2015.
*/
@@ -58,7 +54,7 @@ public class BlockTravelSlab extends BlockSlab implements ITTinkererBlock {
@Override
@SideOnly(Side.CLIENT)
public IIcon getIcon(int par1, int par2) {
return ConfigBlocks.blockCosmeticSolid.getIcon(par1,2);
return ConfigBlocks.blockCosmeticSolid.getIcon(par1, 2);
}
@Override
@@ -66,10 +62,10 @@ public class BlockTravelSlab extends BlockSlab implements ITTinkererBlock {
return Item.getItemFromBlock(ThaumicTinkerer.registry.getFirstBlockFromClass(BlockTravelSlab.class));
}
//@Override
//public int idDropped(int par1, Random par2Random, int par3) {
// @Override
// public int idDropped(int par1, Random par2Random, int par3) {
// return ThaumicTinkerer.registry.getFirstBlockFromClass(BlockDarkQuartzSlab.class).blockID;
//}
// }
@Override
public ItemStack createStackedBlock(int par1) {
@@ -129,26 +125,27 @@ public class BlockTravelSlab extends BlockSlab implements ITTinkererBlock {
if (isOpaqueCube()) {
return null;
}
return new ThaumicTinkererCraftingBenchRecipe("PAVETRAVEL", new ItemStack(ThaumicTinkerer.registry.getFirstBlockFromClass(BlockTravelSlab.class), 6),
return new ThaumicTinkererCraftingBenchRecipe(
"PAVETRAVEL",
new ItemStack(ThaumicTinkerer.registry.getFirstBlockFromClass(BlockTravelSlab.class), 6),
"QQQ",
'Q', new ItemStack(ConfigBlocks.blockCosmeticSolid,1,2));
'Q',
new ItemStack(ConfigBlocks.blockCosmeticSolid, 1, 2));
}
@Override
public void onEntityWalking(World world, int x, int y, int z, Entity e) {
if(world.getBlock(x, y, z) == this) {
if(e instanceof EntityLivingBase) {
if(world.isRemote) {
if (world.getBlock(x, y, z) == this) {
if (e instanceof EntityLivingBase) {
if (world.isRemote) {
Thaumcraft.proxy.blockSparkle(world, x, y, z, '?', 5);
}
((EntityLivingBase)e).addPotionEffect(new PotionEffect(Potion.moveSpeed.id, 40, 1));
((EntityLivingBase)e).addPotionEffect(new PotionEffect(Potion.jump.id, 40, 0));
((EntityLivingBase) e).addPotionEffect(new PotionEffect(Potion.moveSpeed.id, 40, 1));
((EntityLivingBase) e).addPotionEffect(new PotionEffect(Potion.jump.id, 40, 0));
}
super.onEntityWalking(world, x, y, z, e);
}
}
}
@@ -1,6 +1,6 @@
package thaumic.tinkerer.common.block;
import net.minecraft.block.Block;
import java.util.ArrayList;
import net.minecraft.block.BlockStairs;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
@@ -12,26 +12,21 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import thaumcraft.common.Thaumcraft;
import thaumcraft.common.config.ConfigBlocks;
import thaumic.tinkerer.common.ThaumicTinkerer;
import thaumic.tinkerer.common.block.quartz.BlockDarkQuartz;
import thaumic.tinkerer.common.core.handler.ModCreativeTab;
import thaumic.tinkerer.common.lib.LibBlockNames;
import thaumic.tinkerer.common.lib.LibResearch;
import thaumic.tinkerer.common.registry.ITTinkererBlock;
import thaumic.tinkerer.common.registry.ThaumicTinkererCraftingBenchRecipe;
import thaumic.tinkerer.common.registry.ThaumicTinkererRecipe;
import thaumic.tinkerer.common.registry.ThaumicTinkererRecipeMulti;
import thaumic.tinkerer.common.research.IRegisterableResearch;
import java.util.ArrayList;
/**
* Created by Katrina on 16/04/2015.
*/
public class BlockTravelStairs extends BlockStairs implements ITTinkererBlock {
public BlockTravelStairs() {
super(ConfigBlocks.blockCosmeticSolid,2);
super(ConfigBlocks.blockCosmeticSolid, 2);
setCreativeTab(ModCreativeTab.INSTANCE);
}
@@ -72,22 +67,26 @@ public class BlockTravelStairs extends BlockStairs implements ITTinkererBlock {
@Override
public ThaumicTinkererRecipe getRecipeItem() {
return new ThaumicTinkererRecipeMulti(
new ThaumicTinkererCraftingBenchRecipe("PAVETRAVEL", new ItemStack(this, 4),
" Q", " QQ", "QQQ",
'Q', new ItemStack(ConfigBlocks.blockCosmeticSolid,1,2))
);
return new ThaumicTinkererRecipeMulti(new ThaumicTinkererCraftingBenchRecipe(
"PAVETRAVEL",
new ItemStack(this, 4),
" Q",
" QQ",
"QQQ",
'Q',
new ItemStack(ConfigBlocks.blockCosmeticSolid, 1, 2)));
}
@Override
public void onEntityWalking(World world, int x, int y, int z, Entity e) {
if(world.getBlock(x, y, z) == this) {
if(e instanceof EntityLivingBase) {
if(world.isRemote) {
if (world.getBlock(x, y, z) == this) {
if (e instanceof EntityLivingBase) {
if (world.isRemote) {
Thaumcraft.proxy.blockSparkle(world, x, y, z, '?', 5);
}
((EntityLivingBase)e).addPotionEffect(new PotionEffect(Potion.moveSpeed.id, 40, 1));
((EntityLivingBase)e).addPotionEffect(new PotionEffect(Potion.jump.id, 40, 0));
((EntityLivingBase) e).addPotionEffect(new PotionEffect(Potion.moveSpeed.id, 40, 1));
((EntityLivingBase) e).addPotionEffect(new PotionEffect(Potion.jump.id, 40, 0));
}
super.onEntityWalking(world, x, y, z, e);
@@ -2,6 +2,10 @@ package thaumic.tinkerer.common.block;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Random;
import net.minecraft.block.BlockSlab;
import net.minecraft.block.ITileEntityProvider;
import net.minecraft.block.material.Material;
@@ -22,34 +26,25 @@ import net.minecraft.world.World;
import thaumcraft.common.Thaumcraft;
import thaumcraft.common.config.ConfigBlocks;
import thaumic.tinkerer.common.ThaumicTinkerer;
import thaumic.tinkerer.common.block.quartz.BlockDarkQuartz;
import thaumic.tinkerer.common.block.tile.TileWardedSlab;
import thaumic.tinkerer.common.core.handler.ModCreativeTab;
import thaumic.tinkerer.common.item.ItemTravelSlab;
import thaumic.tinkerer.common.item.ItemWardSlab;
import thaumic.tinkerer.common.item.quartz.ItemDarkQuartzSlab;
import thaumic.tinkerer.common.lib.LibBlockNames;
import thaumic.tinkerer.common.lib.LibResearch;
import thaumic.tinkerer.common.registry.ITTinkererBlock;
import thaumic.tinkerer.common.registry.ThaumicTinkererCraftingBenchRecipe;
import thaumic.tinkerer.common.registry.ThaumicTinkererRecipe;
import thaumic.tinkerer.common.research.IRegisterableResearch;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Random;
/**
* Created by Katrina on 13/04/2015.
*/
public class BlockWardSlab extends BlockSlab implements ITTinkererBlock,ITileEntityProvider {
public class BlockWardSlab extends BlockSlab implements ITTinkererBlock, ITileEntityProvider {
public BlockWardSlab(boolean par2) {
super(par2, Material.rock);
setHardness(0.8F);
setResistance(10F);
isBlockContainer=true;
isBlockContainer = true;
if (!par2) {
setLightOpacity(0);
setCreativeTab(ModCreativeTab.INSTANCE);
@@ -67,7 +62,7 @@ public class BlockWardSlab extends BlockSlab implements ITTinkererBlock,ITileEnt
@Override
@SideOnly(Side.CLIENT)
public IIcon getIcon(int par1, int par2) {
return ConfigBlocks.blockCosmeticSolid.getIcon(par1,3);
return ConfigBlocks.blockCosmeticSolid.getIcon(par1, 3);
}
@Override
@@ -75,10 +70,10 @@ public class BlockWardSlab extends BlockSlab implements ITTinkererBlock,ITileEnt
return Item.getItemFromBlock(ThaumicTinkerer.registry.getFirstBlockFromClass(BlockWardSlab.class));
}
//@Override
//public int idDropped(int par1, Random par2Random, int par3) {
// @Override
// public int idDropped(int par1, Random par2Random, int par3) {
// return ThaumicTinkerer.registry.getFirstBlockFromClass(BlockDarkQuartzSlab.class).blockID;
//}
// }
@Override
public ItemStack createStackedBlock(int par1) {
@@ -143,9 +138,12 @@ public class BlockWardSlab extends BlockSlab implements ITTinkererBlock,ITileEnt
if (isOpaqueCube()) {
return null;
}
return new ThaumicTinkererCraftingBenchRecipe("PAVEWARD", new ItemStack(ThaumicTinkerer.registry.getFirstBlockFromClass(BlockWardSlab.class), 6),
return new ThaumicTinkererCraftingBenchRecipe(
"PAVEWARD",
new ItemStack(ThaumicTinkerer.registry.getFirstBlockFromClass(BlockWardSlab.class), 6),
"QQQ",
'Q', new ItemStack(ConfigBlocks.blockCosmeticSolid, 1,3));
'Q',
new ItemStack(ConfigBlocks.blockCosmeticSolid, 1, 3));
}
@Override
@@ -154,41 +152,76 @@ public class BlockWardSlab extends BlockSlab implements ITTinkererBlock,ITileEnt
int list;
if (world.isBlockIndirectlyGettingPowered(x, y, z)) {
for (list = 0; list < Thaumcraft.proxy.particleCount(2); ++list) {
Thaumcraft.proxy.blockRunes(world, (double) x, (double) ((float) y + 0.7F), (double) z, 0.2F + world.rand.nextFloat() * 0.4F, world.rand.nextFloat() * 0.3F, 0.8F + world.rand.nextFloat() * 0.2F, 20, -0.02F);
Thaumcraft.proxy.blockRunes(
world,
(double) x,
(double) ((float) y + 0.7F),
(double) z,
0.2F + world.rand.nextFloat() * 0.4F,
world.rand.nextFloat() * 0.3F,
0.8F + world.rand.nextFloat() * 0.2F,
20,
-0.02F);
}
} else if (world.getBlock(x, y + 1, z) != ConfigBlocks.blockAiry && world.getBlock(x, y + 1, z).getBlocksMovement(world, x, y + 1, z) || world.getBlock(x, y + 2, z) != ConfigBlocks.blockAiry && world.getBlock(x, y + 1, z).getBlocksMovement(world, x, y + 1, z)) {
} else if (world.getBlock(x, y + 1, z) != ConfigBlocks.blockAiry
&& world.getBlock(x, y + 1, z).getBlocksMovement(world, x, y + 1, z)
|| world.getBlock(x, y + 2, z) != ConfigBlocks.blockAiry
&& world.getBlock(x, y + 1, z).getBlocksMovement(world, x, y + 1, z)) {
for (list = 0; list < Thaumcraft.proxy.particleCount(3); ++list) {
Thaumcraft.proxy.blockRunes(world, (double) x, (double) ((float) y + 0.7F), (double) z, 0.9F + world.rand.nextFloat() * 0.1F, world.rand.nextFloat() * 0.3F, world.rand.nextFloat() * 0.3F, 24, -0.02F);
Thaumcraft.proxy.blockRunes(
world,
(double) x,
(double) ((float) y + 0.7F),
(double) z,
0.9F + world.rand.nextFloat() * 0.1F,
world.rand.nextFloat() * 0.3F,
world.rand.nextFloat() * 0.3F,
24,
-0.02F);
}
} else {
List var10 = world.getEntitiesWithinAABBExcludingEntity((Entity) null, AxisAlignedBB.getBoundingBox((double) x, (double) y, (double) z, (double) (x + 1), (double) (y + 1), (double) (z + 1)).expand(1.0D, 1.0D, 1.0D));
List var10 = world.getEntitiesWithinAABBExcludingEntity(
(Entity) null,
AxisAlignedBB.getBoundingBox(
(double) x, (double) y, (double) z, (double) (x + 1), (double) (y + 1), (double)
(z + 1))
.expand(1.0D, 1.0D, 1.0D));
if (!var10.isEmpty()) {
Iterator iterator = var10.iterator();
while (iterator.hasNext()) {
Entity entity = (Entity) iterator.next();
if (entity instanceof EntityLivingBase && !(entity instanceof EntityPlayer)) {
Thaumcraft.proxy.blockRunes(world, (double) x, (double) ((float) y + 0.6F + world.rand.nextFloat() * Math.max(0.8F, entity.getEyeHeight())), (double) z, 0.6F + world.rand.nextFloat() * 0.4F, 0.0F, 0.3F + world.rand.nextFloat() * 0.7F, 20, 0.0F);
Thaumcraft.proxy.blockRunes(
world,
(double) x,
(double) ((float) y
+ 0.6F
+ world.rand.nextFloat() * Math.max(0.8F, entity.getEyeHeight())),
(double) z,
0.6F + world.rand.nextFloat() * 0.4F,
0.0F,
0.3F + world.rand.nextFloat() * 0.7F,
20,
0.0F);
break;
}
}
}
}
}
}
@Override
public void onEntityWalking(World world, int x, int y, int z, Entity e) {
if(world.getBlock(x, y, z) == this) {
if(e instanceof EntityLivingBase) {
if(world.isRemote) {
if (world.getBlock(x, y, z) == this) {
if (e instanceof EntityLivingBase) {
if (world.isRemote) {
Thaumcraft.proxy.blockSparkle(world, x, y, z, '?', 5);
}
((EntityLivingBase)e).addPotionEffect(new PotionEffect(Potion.moveSpeed.id, 40, 1));
((EntityLivingBase)e).addPotionEffect(new PotionEffect(Potion.jump.id, 40, 0));
((EntityLivingBase) e).addPotionEffect(new PotionEffect(Potion.moveSpeed.id, 40, 1));
((EntityLivingBase) e).addPotionEffect(new PotionEffect(Potion.jump.id, 40, 0));
}
super.onEntityWalking(world, x, y, z, e);
@@ -197,7 +230,7 @@ public class BlockWardSlab extends BlockSlab implements ITTinkererBlock,ITileEnt
@Override
public boolean getBlocksMovement(IBlockAccess world, int x, int y, int z) {
return !((TileWardedSlab)world.getTileEntity(x,y,z)).gettingPower();
return !((TileWardedSlab) world.getTileEntity(x, y, z)).gettingPower();
}
@Override
@@ -1,5 +1,6 @@
package thaumic.tinkerer.common.block.fire;
import java.util.HashMap;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
@@ -17,8 +18,6 @@ import thaumic.tinkerer.common.research.IRegisterableResearch;
import thaumic.tinkerer.common.research.ResearchHelper;
import thaumic.tinkerer.common.research.TTResearchItem;
import java.util.HashMap;
public class BlockFireAir extends BlockFireBase {
@Override
public String getBlockName() {
@@ -27,17 +26,28 @@ public class BlockFireAir extends BlockFireBase {
@Override
public IRegisterableResearch getResearchItem() {
if(!ConfigHandler.enableFire)
return null;
return (TTResearchItem) new TTResearchItem(LibResearch.KEY_FIRE_AER, new AspectList().add(Aspect.FIRE, 5).add(Aspect.AIR, 5), 3, -7, 2, new ItemStack(this)).setParents(LibResearch.KEY_BRIGHT_NITOR).setConcealed()
.setPages(new ResearchPage("0"), ResearchHelper.crucibleRecipePage(LibResearch.KEY_FIRE_AER)).setSecondary();
if (!ConfigHandler.enableFire) return null;
return (TTResearchItem) new TTResearchItem(
LibResearch.KEY_FIRE_AER,
new AspectList().add(Aspect.FIRE, 5).add(Aspect.AIR, 5),
3,
-7,
2,
new ItemStack(this))
.setParents(LibResearch.KEY_BRIGHT_NITOR)
.setConcealed()
.setPages(new ResearchPage("0"), ResearchHelper.crucibleRecipePage(LibResearch.KEY_FIRE_AER))
.setSecondary();
}
@Override
public ThaumicTinkererRecipe getRecipeItem() {
if(!ConfigHandler.enableFire)
return null;
return new ThaumicTinkererCrucibleRecipe(LibResearch.KEY_FIRE_AER, new ItemStack(this), new ItemStack(ConfigItems.itemShard, 1, 0), new AspectList().add(Aspect.FIRE, 5).add(Aspect.MAGIC, 5).add(Aspect.AIR, 5));
if (!ConfigHandler.enableFire) return null;
return new ThaumicTinkererCrucibleRecipe(
LibResearch.KEY_FIRE_AER,
new ItemStack(this),
new ItemStack(ConfigItems.itemShard, 1, 0),
new AspectList().add(Aspect.FIRE, 5).add(Aspect.MAGIC, 5).add(Aspect.AIR, 5));
}
@Override
@@ -57,9 +67,8 @@ public class BlockFireAir extends BlockFireBase {
}
@Override
public HashMap<thaumic.tinkerer.common.core.helper.BlockTuple, thaumic.tinkerer.common.core.helper.BlockTuple> getBlockTransformation(World w, int x, int y, int z) {
public HashMap<thaumic.tinkerer.common.core.helper.BlockTuple, thaumic.tinkerer.common.core.helper.BlockTuple>
getBlockTransformation(World w, int x, int y, int z) {
return getBlockTransformation();
}
}
@@ -1,7 +1,12 @@
package thaumic.tinkerer.common.block.fire;
import static net.minecraftforge.common.util.ForgeDirection.*;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.block.BlockFire;
import net.minecraft.block.material.MapColor;
@@ -24,12 +29,6 @@ import thaumic.tinkerer.common.core.helper.BlockTuple;
import thaumic.tinkerer.common.item.ItemBlockFire;
import thaumic.tinkerer.common.registry.ITTinkererBlock;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Random;
import static net.minecraftforge.common.util.ForgeDirection.*;
public abstract class BlockFireBase extends BlockFire implements ITTinkererBlock {
private IIcon[] icons;
@@ -58,14 +57,21 @@ public abstract class BlockFireBase extends BlockFire implements ITTinkererBlock
public boolean isNeighborTarget(World w, int x, int y, int z) {
for (ForgeDirection f : ForgeDirection.VALID_DIRECTIONS) {
if (w.blockExists(x + f.offsetX, y + f.offsetY, z + f.offsetZ) && isTransmutationTarget(w.getBlock(x + f.offsetX, y + f.offsetY, z + f.offsetZ), w, x + f.offsetX, y + f.offsetY, z + f.offsetZ)) {
if (w.blockExists(x + f.offsetX, y + f.offsetY, z + f.offsetZ)
&& isTransmutationTarget(
w.getBlock(x + f.offsetX, y + f.offsetY, z + f.offsetZ),
w,
x + f.offsetX,
y + f.offsetY,
z + f.offsetZ)) {
return true;
}
}
return false;
}
public AxisAlignedBB getCollisionBoundingBoxFromPool(World p_149668_1_, int p_149668_2_, int p_149668_3_, int p_149668_4_) {
public AxisAlignedBB getCollisionBoundingBoxFromPool(
World p_149668_1_, int p_149668_2_, int p_149668_3_, int p_149668_4_) {
return null;
}
@@ -95,8 +101,15 @@ public abstract class BlockFireBase extends BlockFire implements ITTinkererBlock
public void setBlockWithTransmutationTarget(World world, int x, int y, int z, int meta, Block block) {
Random random = new Random();
if (isTransmutationTarget(world.getBlock(x, z, y), world, x, y, z) && random.nextInt(getDecayChance(world, x, y, z)) == 0) {
world.setBlock(x, z, y, getBlockTransformation(world, x, y, z).get(new BlockTuple(world.getBlock(x, z, y))).block, getBlockTransformation(world, x, y, z).get(new BlockTuple(world.getBlock(x, z, y))).meta, 3);
if (isTransmutationTarget(world.getBlock(x, z, y), world, x, y, z)
&& random.nextInt(getDecayChance(world, x, y, z)) == 0) {
world.setBlock(
x,
z,
y,
getBlockTransformation(world, x, y, z).get(new BlockTuple(world.getBlock(x, z, y))).block,
getBlockTransformation(world, x, y, z).get(new BlockTuple(world.getBlock(x, z, y))).meta,
3);
} else {
world.setBlock(x, z, y, block, meta, 3);
}
@@ -104,9 +117,16 @@ public abstract class BlockFireBase extends BlockFire implements ITTinkererBlock
public void updateTick(World world, int x, int y, int z, Random rand) {
if (world.getGameRules().getGameRuleBooleanValue("doFireTick") && ConfigHandler.enableFire && ConfigHandler.enableFireMechanics) {
if (world.getGameRules().getGameRuleBooleanValue("doFireTick")
&& ConfigHandler.enableFire
&& ConfigHandler.enableFireMechanics) {
if (world.isRaining() && (world.canLightningStrikeAt(x, y, z) || world.canLightningStrikeAt(x - 1, y, z) || world.canLightningStrikeAt(x + 1, y, z) || world.canLightningStrikeAt(x, y, z - 1) || world.canLightningStrikeAt(x, y, z + 1))) {
if (world.isRaining()
&& (world.canLightningStrikeAt(x, y, z)
|| world.canLightningStrikeAt(x - 1, y, z)
|| world.canLightningStrikeAt(x + 1, y, z)
|| world.canLightningStrikeAt(x, y, z - 1)
|| world.canLightningStrikeAt(x, y, z + 1))) {
world.setBlockToAir(x, y, z);
} else {
if (!isNeighborTarget(world, x, y, z)) {
@@ -115,19 +135,38 @@ public abstract class BlockFireBase extends BlockFire implements ITTinkererBlock
if (rand.nextInt(20) == 0) {
if (isNeighborTarget(world, x, y, z)) {
for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
if (isTransmutationTarget(world.getBlock(x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ), world, x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ)) {
if (isTransmutationTarget(
world.getBlock(x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ),
world,
x + dir.offsetX,
y + dir.offsetY,
z + dir.offsetZ)) {
Random random = new Random();
if (random.nextInt(getDecayChance(world, x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ)) == 0) {
world.setBlock(x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ, getBlockTransformation(world, x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ).get(new BlockTuple(world.getBlock(x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ))).block, getBlockTransformation(world, x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ).get(new BlockTuple(world.getBlock(x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ))).meta, 3);
if (random.nextInt(getDecayChance(
world, x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ))
== 0) {
world.setBlock(
x + dir.offsetX,
y + dir.offsetY,
z + dir.offsetZ,
getBlockTransformation(
world, x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ)
.get(new BlockTuple(world.getBlock(
x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ)))
.block,
getBlockTransformation(
world, x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ)
.get(new BlockTuple(world.getBlock(
x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ)))
.meta,
3);
} else {
world.setBlockToAir(x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ);
}
}
}
}
}
}
int l = world.getBlockMetadata(x, y, z);
@@ -145,7 +184,15 @@ public abstract class BlockFireBase extends BlockFire implements ITTinkererBlock
}
for (ForgeDirection direction : ForgeDirection.VALID_DIRECTIONS) {
this.tryCatchFire(world, x + direction.offsetX, y + direction.offsetY, z + direction.offsetZ, 300 + b0, rand, l, direction);
this.tryCatchFire(
world,
x + direction.offsetX,
y + direction.offsetY,
z + direction.offsetZ,
300 + b0,
rand,
l,
direction);
}
for (int i1 = x - 1; i1 <= x + 1; i1++) {
@@ -163,7 +210,13 @@ public abstract class BlockFireBase extends BlockFire implements ITTinkererBlock
j2 /= 2;
}
if (j2 > 0 && rand.nextInt(l1) <= j2 && (!world.isRaining() || !world.canLightningStrikeAt(i1, k1, j1)) && !world.canLightningStrikeAt(i1 - 1, k1, z) && !world.canLightningStrikeAt(i1 + 1, k1, j1) && !world.canLightningStrikeAt(i1, k1, j1 - 1) && !world.canLightningStrikeAt(i1, k1, j1 + 1)) {
if (j2 > 0
&& rand.nextInt(l1) <= j2
&& (!world.isRaining() || !world.canLightningStrikeAt(i1, k1, j1))
&& !world.canLightningStrikeAt(i1 - 1, k1, z)
&& !world.canLightningStrikeAt(i1 + 1, k1, j1)
&& !world.canLightningStrikeAt(i1, k1, j1 - 1)
&& !world.canLightningStrikeAt(i1, k1, j1 + 1)) {
int k2 = l + rand.nextInt(5) / 4;
if (k2 > 15) {
@@ -174,7 +227,6 @@ public abstract class BlockFireBase extends BlockFire implements ITTinkererBlock
}
}
}
}
}
}
@@ -195,7 +247,8 @@ public abstract class BlockFireBase extends BlockFire implements ITTinkererBlock
return world.getBlock(x, y, z).getFlammability(world, x, y, z, face);
}
private void tryCatchFire(World world, int x, int y, int z, int strength, Random rand, int meta, ForgeDirection face) {
private void tryCatchFire(
World world, int x, int y, int z, int strength, Random rand, int meta, ForgeDirection face) {
int j1 = getBlockFlammability(world, x, y, z, face);
if (rand.nextInt(strength) < j1) {
@@ -261,9 +314,15 @@ public abstract class BlockFireBase extends BlockFire implements ITTinkererBlock
}
@Override
public void onBlockPlacedBy(World p_149689_1_, int p_149689_2_, int p_149689_3_, int p_149689_4_, EntityLivingBase p_149689_5_, ItemStack p_149689_6_) {
if(p_149689_5_ instanceof EntityPlayer)
ThaumicTinkerer.log.info("Player: "+((EntityPlayer)p_149689_5_).getDisplayName()+" placed TT Fire");
public void onBlockPlacedBy(
World p_149689_1_,
int p_149689_2_,
int p_149689_3_,
int p_149689_4_,
EntityLivingBase p_149689_5_,
ItemStack p_149689_6_) {
if (p_149689_5_ instanceof EntityPlayer)
ThaumicTinkerer.log.info("Player: " + ((EntityPlayer) p_149689_5_).getDisplayName() + " placed TT Fire");
}
/**
@@ -308,7 +367,14 @@ public abstract class BlockFireBase extends BlockFire implements ITTinkererBlock
@SideOnly(Side.CLIENT)
public void randomDisplayTick(World world, int x, int y, int z, Random rand) {
if (rand.nextInt(24) == 0) {
world.playSound((double) ((float) x + 0.5F), (double) ((float) y + 0.5F), (double) ((float) z + 0.5F), "fire.fire", 1.0F + rand.nextFloat(), rand.nextFloat() * 0.7F + 0.3F, false);
world.playSound(
(double) ((float) x + 0.5F),
(double) ((float) y + 0.5F),
(double) ((float) z + 0.5F),
"fire.fire",
1.0F + rand.nextFloat(),
rand.nextFloat() * 0.7F + 0.3F,
false);
}
int l;
@@ -316,7 +382,8 @@ public abstract class BlockFireBase extends BlockFire implements ITTinkererBlock
float f1;
float f2;
if (!World.doesBlockHaveSolidTopSurface(world, x, y - 1, z) && !Blocks.fire.canCatchFire(world, x, y - 1, z, UP)) {
if (!World.doesBlockHaveSolidTopSurface(world, x, y - 1, z)
&& !Blocks.fire.canCatchFire(world, x, y - 1, z, UP)) {
if (Blocks.fire.canCatchFire(world, x - 1, y, z, EAST)) {
for (l = 0; l < 2; ++l) {
f = (float) x + rand.nextFloat() * 0.1F;
@@ -402,7 +469,10 @@ public abstract class BlockFireBase extends BlockFire implements ITTinkererBlock
@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")};
this.icons = new IIcon[] {
IconHelper.forName(iconRegister, this.getBlockName() + "_layer_0"),
IconHelper.forName(iconRegister, this.getBlockName() + "_layer_1")
};
String s = "";
if (this instanceof BlockFireAir) {
@@ -1,5 +1,6 @@
package thaumic.tinkerer.common.block.fire;
import java.util.HashMap;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
@@ -18,8 +19,6 @@ import thaumic.tinkerer.common.research.IRegisterableResearch;
import thaumic.tinkerer.common.research.ResearchHelper;
import thaumic.tinkerer.common.research.TTResearchItem;
import java.util.HashMap;
public class BlockFireChaos extends BlockFireBase {
@Override
public String getBlockName() {
@@ -28,17 +27,28 @@ public class BlockFireChaos extends BlockFireBase {
@Override
public IRegisterableResearch getResearchItem() {
if(!ConfigHandler.enableFire)
return null;
return (TTResearchItem) new TTResearchItem(LibResearch.KEY_FIRE_PERDITIO, new AspectList().add(Aspect.FIRE, 5).add(Aspect.ENTROPY, 5), 2, -8, 3, new ItemStack(this)).setParents(LibResearch.KEY_BRIGHT_NITOR).setConcealed()
.setPages(new ResearchPage("0"), ResearchHelper.crucibleRecipePage(LibResearch.KEY_FIRE_PERDITIO)).setSecondary();
if (!ConfigHandler.enableFire) return null;
return (TTResearchItem) new TTResearchItem(
LibResearch.KEY_FIRE_PERDITIO,
new AspectList().add(Aspect.FIRE, 5).add(Aspect.ENTROPY, 5),
2,
-8,
3,
new ItemStack(this))
.setParents(LibResearch.KEY_BRIGHT_NITOR)
.setConcealed()
.setPages(new ResearchPage("0"), ResearchHelper.crucibleRecipePage(LibResearch.KEY_FIRE_PERDITIO))
.setSecondary();
}
@Override
public ThaumicTinkererRecipe getRecipeItem() {
if(!ConfigHandler.enableFire)
return null;
return new ThaumicTinkererCrucibleRecipe(LibResearch.KEY_FIRE_PERDITIO, new ItemStack(this), new ItemStack(ConfigItems.itemShard, 1, 5), new AspectList().add(Aspect.FIRE, 5).add(Aspect.MAGIC, 5).add(Aspect.ENTROPY, 5));
if (!ConfigHandler.enableFire) return null;
return new ThaumicTinkererCrucibleRecipe(
LibResearch.KEY_FIRE_PERDITIO,
new ItemStack(this),
new ItemStack(ConfigItems.itemShard, 1, 5),
new AspectList().add(Aspect.FIRE, 5).add(Aspect.MAGIC, 5).add(Aspect.ENTROPY, 5));
}
@Override
@@ -49,17 +59,28 @@ public class BlockFireChaos extends BlockFireBase {
@Override
public HashMap<BlockTuple, BlockTuple> getBlockTransformation() {
HashMap<BlockTuple, BlockTuple> result = new HashMap<BlockTuple, BlockTuple>();
result.put(new BlockTuple(ThaumicTinkerer.registry.getFirstBlockFromClass(BlockFireAir.class)), new BlockTuple(Blocks.fire));
result.put(new BlockTuple(ThaumicTinkerer.registry.getFirstBlockFromClass(BlockFireWater.class)), new BlockTuple(Blocks.fire));
result.put(new BlockTuple(ThaumicTinkerer.registry.getFirstBlockFromClass(BlockFireEarth.class)), new BlockTuple(Blocks.fire));
result.put(new BlockTuple(ThaumicTinkerer.registry.getFirstBlockFromClass(BlockFireIgnis.class)), new BlockTuple(Blocks.fire));
result.put(new BlockTuple(ThaumicTinkerer.registry.getFirstBlockFromClass(BlockFireOrder.class)), new BlockTuple(Blocks.fire));
result.put(
new BlockTuple(ThaumicTinkerer.registry.getFirstBlockFromClass(BlockFireAir.class)),
new BlockTuple(Blocks.fire));
result.put(
new BlockTuple(ThaumicTinkerer.registry.getFirstBlockFromClass(BlockFireWater.class)),
new BlockTuple(Blocks.fire));
result.put(
new BlockTuple(ThaumicTinkerer.registry.getFirstBlockFromClass(BlockFireEarth.class)),
new BlockTuple(Blocks.fire));
result.put(
new BlockTuple(ThaumicTinkerer.registry.getFirstBlockFromClass(BlockFireIgnis.class)),
new BlockTuple(Blocks.fire));
result.put(
new BlockTuple(ThaumicTinkerer.registry.getFirstBlockFromClass(BlockFireOrder.class)),
new BlockTuple(Blocks.fire));
return result;
}
@Override
public HashMap<thaumic.tinkerer.common.core.helper.BlockTuple, thaumic.tinkerer.common.core.helper.BlockTuple> getBlockTransformation(World w, int x, int y, int z) {
public HashMap<thaumic.tinkerer.common.core.helper.BlockTuple, thaumic.tinkerer.common.core.helper.BlockTuple>
getBlockTransformation(World w, int x, int y, int z) {
return getBlockTransformation();
}
}
@@ -1,5 +1,6 @@
package thaumic.tinkerer.common.block.fire;
import java.util.HashMap;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
@@ -17,8 +18,6 @@ import thaumic.tinkerer.common.research.IRegisterableResearch;
import thaumic.tinkerer.common.research.ResearchHelper;
import thaumic.tinkerer.common.research.TTResearchItem;
import java.util.HashMap;
public class BlockFireEarth extends BlockFireBase {
public BlockFireEarth() {
super();
@@ -31,17 +30,28 @@ public class BlockFireEarth extends BlockFireBase {
@Override
public IRegisterableResearch getResearchItem() {
if(!ConfigHandler.enableFire)
return null;
return (TTResearchItem) new TTResearchItem(LibResearch.KEY_FIRE_TERRA, new AspectList().add(Aspect.FIRE, 5).add(Aspect.EARTH, 5), 4, -6, 2, new ItemStack(this)).setParents(LibResearch.KEY_BRIGHT_NITOR).setConcealed()
.setPages(new ResearchPage("0"), ResearchHelper.crucibleRecipePage(LibResearch.KEY_FIRE_TERRA)).setSecondary();
if (!ConfigHandler.enableFire) return null;
return (TTResearchItem) new TTResearchItem(
LibResearch.KEY_FIRE_TERRA,
new AspectList().add(Aspect.FIRE, 5).add(Aspect.EARTH, 5),
4,
-6,
2,
new ItemStack(this))
.setParents(LibResearch.KEY_BRIGHT_NITOR)
.setConcealed()
.setPages(new ResearchPage("0"), ResearchHelper.crucibleRecipePage(LibResearch.KEY_FIRE_TERRA))
.setSecondary();
}
@Override
public ThaumicTinkererRecipe getRecipeItem() {
if(!ConfigHandler.enableFire)
return null;
return new ThaumicTinkererCrucibleRecipe(LibResearch.KEY_FIRE_TERRA, new ItemStack(this), new ItemStack(ConfigItems.itemShard, 1, 3), new AspectList().add(Aspect.FIRE, 5).add(Aspect.MAGIC, 5).add(Aspect.EARTH, 5));
if (!ConfigHandler.enableFire) return null;
return new ThaumicTinkererCrucibleRecipe(
LibResearch.KEY_FIRE_TERRA,
new ItemStack(this),
new ItemStack(ConfigItems.itemShard, 1, 3),
new AspectList().add(Aspect.FIRE, 5).add(Aspect.MAGIC, 5).add(Aspect.EARTH, 5));
}
@Override
@@ -69,7 +79,8 @@ public class BlockFireEarth extends BlockFireBase {
}
@Override
public HashMap<thaumic.tinkerer.common.core.helper.BlockTuple, thaumic.tinkerer.common.core.helper.BlockTuple> getBlockTransformation(World w, int x, int y, int z) {
public HashMap<thaumic.tinkerer.common.core.helper.BlockTuple, thaumic.tinkerer.common.core.helper.BlockTuple>
getBlockTransformation(World w, int x, int y, int z) {
return getBlockTransformation();
}
}
@@ -1,5 +1,6 @@
package thaumic.tinkerer.common.block.fire;
import java.util.HashMap;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
@@ -17,8 +18,6 @@ import thaumic.tinkerer.common.research.IRegisterableResearch;
import thaumic.tinkerer.common.research.ResearchHelper;
import thaumic.tinkerer.common.research.TTResearchItem;
import java.util.HashMap;
public class BlockFireIgnis extends BlockFireBase {
@Override
@@ -28,17 +27,28 @@ public class BlockFireIgnis extends BlockFireBase {
@Override
public IRegisterableResearch getResearchItem() {
if(!ConfigHandler.enableFire)
return null;
return (TTResearchItem) new TTResearchItem(LibResearch.KEY_FIRE_IGNIS, new AspectList().add(Aspect.FIRE, 10), 4, -4, 2, new ItemStack(this)).setParents(LibResearch.KEY_BRIGHT_NITOR).setConcealed()
.setPages(new ResearchPage("0"), ResearchHelper.crucibleRecipePage(LibResearch.KEY_FIRE_IGNIS)).setSecondary();
if (!ConfigHandler.enableFire) return null;
return (TTResearchItem) new TTResearchItem(
LibResearch.KEY_FIRE_IGNIS,
new AspectList().add(Aspect.FIRE, 10),
4,
-4,
2,
new ItemStack(this))
.setParents(LibResearch.KEY_BRIGHT_NITOR)
.setConcealed()
.setPages(new ResearchPage("0"), ResearchHelper.crucibleRecipePage(LibResearch.KEY_FIRE_IGNIS))
.setSecondary();
}
@Override
public ThaumicTinkererRecipe getRecipeItem() {
if(!ConfigHandler.enableFire)
return null;
return new ThaumicTinkererCrucibleRecipe(LibResearch.KEY_FIRE_IGNIS, new ItemStack(this), new ItemStack(ConfigItems.itemShard, 1, 1), new AspectList().add(Aspect.FIRE, 10).add(Aspect.AIR, 5));
if (!ConfigHandler.enableFire) return null;
return new ThaumicTinkererCrucibleRecipe(
LibResearch.KEY_FIRE_IGNIS,
new ItemStack(this),
new ItemStack(ConfigItems.itemShard, 1, 1),
new AspectList().add(Aspect.FIRE, 10).add(Aspect.AIR, 5));
}
@Override
@@ -67,7 +77,8 @@ public class BlockFireIgnis extends BlockFireBase {
}
@Override
public HashMap<thaumic.tinkerer.common.core.helper.BlockTuple, thaumic.tinkerer.common.core.helper.BlockTuple> getBlockTransformation(World w, int x, int y, int z) {
public HashMap<thaumic.tinkerer.common.core.helper.BlockTuple, thaumic.tinkerer.common.core.helper.BlockTuple>
getBlockTransformation(World w, int x, int y, int z) {
return getBlockTransformation();
}
}
@@ -1,5 +1,7 @@
package thaumic.tinkerer.common.block.fire;
import java.util.ArrayList;
import java.util.HashMap;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
@@ -25,9 +27,6 @@ import thaumic.tinkerer.common.research.IRegisterableResearch;
import thaumic.tinkerer.common.research.ResearchHelper;
import thaumic.tinkerer.common.research.TTResearchItem;
import java.util.ArrayList;
import java.util.HashMap;
public class BlockFireOrder extends BlockFireBase {
public HashMap<BlockTuple, BlockTuple> fireResults = new HashMap<BlockTuple, BlockTuple>();
@@ -39,7 +38,6 @@ public class BlockFireOrder extends BlockFireBase {
fireResults.put(new BlockTuple(Blocks.glass), null);
fireResults.put(new BlockTuple(Blocks.sand), null);
fireResults.put(new BlockTuple(Blocks.gravel), null);
}
@Override
@@ -49,22 +47,35 @@ public class BlockFireOrder extends BlockFireBase {
@Override
public IRegisterableResearch getResearchItem() {
if(!ConfigHandler.enableFire)
return null;
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()
.setPages(new ResearchPage("0"), ResearchHelper.crucibleRecipePage(LibResearch.KEY_FIRE_ORDO)).setSecondary();
if (!ConfigHandler.enableFire) return null;
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()
.setPages(new ResearchPage("0"), ResearchHelper.crucibleRecipePage(LibResearch.KEY_FIRE_ORDO))
.setSecondary();
}
@Override
public ThaumicTinkererRecipe getRecipeItem() {
if(!ConfigHandler.enableFire)
return null;
return new ThaumicTinkererCrucibleRecipe(LibResearch.KEY_FIRE_ORDO, new ItemStack(this), new ItemStack(ConfigItems.itemShard, 1, 4), new AspectList().add(Aspect.FIRE, 5).add(Aspect.MAGIC, 5).add(Aspect.ORDER, 5));
if (!ConfigHandler.enableFire) return null;
return new ThaumicTinkererCrucibleRecipe(
LibResearch.KEY_FIRE_ORDO,
new ItemStack(this),
new ItemStack(ConfigItems.itemShard, 1, 4),
new AspectList().add(Aspect.FIRE, 5).add(Aspect.MAGIC, 5).add(Aspect.ORDER, 5));
}
@Override
public int getDecayChance(World world, int x, int y, int z) {
int dropSize = world.getBlock(x, y, z).getDrops(world, x, y, z, world.getBlockMetadata(x, y, z), 0).size();
int dropSize = world.getBlock(x, y, z)
.getDrops(world, x, y, z, world.getBlockMetadata(x, y, z), 0)
.size();
if (dropSize == 2) {
return 2;
}
@@ -81,8 +92,17 @@ public class BlockFireOrder extends BlockFireBase {
if (ore.startsWith("ore")) {
for (String block : OreDictionary.getOreNames()) {
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);
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);
}
}
}
@@ -105,12 +125,15 @@ public class BlockFireOrder extends BlockFireBase {
}
public ItemStack getBlockCraftingResult(World w, ItemStack itemStack) {
InventoryCrafting blockCraftInventory = new InventoryCrafting(new Container() {
@Override
public boolean canInteractWith(EntityPlayer entityPlayer) {
return false;
}
}, 3, 3);
InventoryCrafting blockCraftInventory = new InventoryCrafting(
new Container() {
@Override
public boolean canInteractWith(EntityPlayer entityPlayer) {
return false;
}
},
3,
3);
for (int i = 0; i < 9; i++) {
blockCraftInventory.setInventorySlotContents(i, itemStack);
@@ -159,6 +182,8 @@ public class BlockFireOrder extends BlockFireBase {
}
public boolean isTransmutationTarget(BlockTuple block, World w, int x, int y, int z) {
return getBlockTransformation(w, x, y, z).keySet().contains(block) && getBlockTransformation().get(block) != null && getBlockTransformation().get(block).block != null;
return getBlockTransformation(w, x, y, z).keySet().contains(block)
&& getBlockTransformation().get(block) != null
&& getBlockTransformation().get(block).block != null;
}
}
@@ -1,5 +1,6 @@
package thaumic.tinkerer.common.block.fire;
import java.util.HashMap;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
@@ -17,8 +18,6 @@ import thaumic.tinkerer.common.research.IRegisterableResearch;
import thaumic.tinkerer.common.research.ResearchHelper;
import thaumic.tinkerer.common.research.TTResearchItem;
import java.util.HashMap;
public class BlockFireWater extends BlockFireBase {
public BlockFireWater() {
super();
@@ -31,17 +30,28 @@ public class BlockFireWater extends BlockFireBase {
@Override
public IRegisterableResearch getResearchItem() {
if(!ConfigHandler.enableFire)
return null;
return (TTResearchItem) new TTResearchItem(LibResearch.KEY_FIRE_AQUA, new AspectList().add(Aspect.FIRE, 5).add(Aspect.WATER, 5), 2, -2, 2, new ItemStack(this)).setParents(LibResearch.KEY_BRIGHT_NITOR).setConcealed()
.setPages(new ResearchPage("0"), ResearchHelper.crucibleRecipePage(LibResearch.KEY_FIRE_AQUA)).setSecondary();
if (!ConfigHandler.enableFire) return null;
return (TTResearchItem) new TTResearchItem(
LibResearch.KEY_FIRE_AQUA,
new AspectList().add(Aspect.FIRE, 5).add(Aspect.WATER, 5),
2,
-2,
2,
new ItemStack(this))
.setParents(LibResearch.KEY_BRIGHT_NITOR)
.setConcealed()
.setPages(new ResearchPage("0"), ResearchHelper.crucibleRecipePage(LibResearch.KEY_FIRE_AQUA))
.setSecondary();
}
@Override
public ThaumicTinkererRecipe getRecipeItem() {
if(!ConfigHandler.enableFire)
return null;
return new ThaumicTinkererCrucibleRecipe(LibResearch.KEY_FIRE_AQUA, new ItemStack(this), new ItemStack(ConfigItems.itemShard, 1, 2), new AspectList().add(Aspect.FIRE, 5).add(Aspect.MAGIC, 5).add(Aspect.WATER, 5));
if (!ConfigHandler.enableFire) return null;
return new ThaumicTinkererCrucibleRecipe(
LibResearch.KEY_FIRE_AQUA,
new ItemStack(this),
new ItemStack(ConfigItems.itemShard, 1, 2),
new AspectList().add(Aspect.FIRE, 5).add(Aspect.MAGIC, 5).add(Aspect.WATER, 5));
}
@Override
@@ -57,7 +67,8 @@ public class BlockFireWater extends BlockFireBase {
}
@Override
public HashMap<thaumic.tinkerer.common.core.helper.BlockTuple, thaumic.tinkerer.common.core.helper.BlockTuple> getBlockTransformation(World w, int x, int y, int z) {
public HashMap<thaumic.tinkerer.common.core.helper.BlockTuple, thaumic.tinkerer.common.core.helper.BlockTuple>
getBlockTransformation(World w, int x, int y, int z) {
return getBlockTransformation();
}
}
@@ -3,6 +3,7 @@ package thaumic.tinkerer.common.block.kami;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
@@ -32,8 +33,6 @@ import thaumic.tinkerer.common.lib.LibBlockNames;
import thaumic.tinkerer.common.registry.ThaumicTinkererRecipe;
import thaumic.tinkerer.common.research.IRegisterableResearch;
import java.util.Random;
public class BlockBedrockPortal extends BlockMod {
@SideOnly(Side.CLIENT)
@@ -48,7 +47,16 @@ public class BlockBedrockPortal extends BlockMod {
}
@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_) {
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_) {
world.setBlock(x, y, z, Blocks.bedrock);
return super.onBlockActivated(world, x, y, z, p_149727_5_, p_149727_6_, p_149727_7_, p_149727_8_, p_149727_9_);
}
@@ -58,7 +66,6 @@ public class BlockBedrockPortal extends BlockMod {
public void registerBlockIcons(IIconRegister iconRegister) {
icon = IconHelper.forName(iconRegister, "portal");
}
@Override
@@ -105,7 +112,15 @@ public class BlockBedrockPortal extends BlockMod {
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));
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));
}
}
@@ -117,8 +132,14 @@ public class BlockBedrockPortal extends BlockMod {
if (entity instanceof EntityPlayer && !par1World.isRemote) {
FMLCommonHandler.instance().getMinecraftServerInstance().getConfigurationManager().transferPlayerToDimension((EntityPlayerMP) entity, ConfigHandler.bedrockDimensionID, new TeleporterBedrock((WorldServer) par1World));
if(entity.worldObj.getBlock(par2, 250, par4) == Blocks.bedrock) {
FMLCommonHandler.instance()
.getMinecraftServerInstance()
.getConfigurationManager()
.transferPlayerToDimension(
(EntityPlayerMP) entity,
ConfigHandler.bedrockDimensionID,
new TeleporterBedrock((WorldServer) par1World));
if (entity.worldObj.getBlock(par2, 250, par4) == Blocks.bedrock) {
entity.worldObj.setBlock(par2, 250, par4, Blocks.air);
}
if (entity.worldObj.getBlock(par2, 251, par4) == Blocks.bedrock) {
@@ -138,7 +159,11 @@ public class BlockBedrockPortal extends BlockMod {
} 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();
@@ -150,7 +175,8 @@ public class BlockBedrockPortal extends BlockMod {
int y = 120;
while (entity.worldObj.getBlock(x, y, z) == Blocks.air || entity.worldObj.getBlock(x, y, z).isAir(par1World, x, y, z)) {
while (entity.worldObj.getBlock(x, y, z) == Blocks.air
|| entity.worldObj.getBlock(x, y, z).isAir(par1World, x, y, z)) {
y--;
// Avoid infinite loop.
if (y <= 1) {
@@ -163,7 +189,6 @@ public class BlockBedrockPortal extends BlockMod {
((EntityPlayerMP) entity).playerNetServerHandler.setPlayerLocation(x + 0.5, y + 3, z + 0.5, 0, 0);
}
}
}
public void travelToDimension(int par1, Entity e) {
@@ -183,7 +208,9 @@ public class BlockBedrockPortal extends BlockMod {
e.worldObj.removeEntity(e);
e.isDead = false;
e.worldObj.theProfiler.startSection("reposition");
minecraftserver.getConfigurationManager().transferEntityToWorld(e, j, worldserver, worldserver1, new TeleporterBedrock(worldserver));
minecraftserver
.getConfigurationManager()
.transferEntityToWorld(e, j, worldserver, worldserver1, new TeleporterBedrock(worldserver));
e.worldObj.theProfiler.endStartSection("reloading");
Entity entity = EntityList.createEntityByName(EntityList.getEntityString(e), worldserver1);
@@ -192,8 +219,14 @@ public class BlockBedrockPortal extends BlockMod {
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);
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);
@@ -14,6 +14,8 @@
*/
package thaumic.tinkerer.common.block.kami;
import java.util.ArrayList;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
@@ -49,9 +51,6 @@ import thaumic.tinkerer.common.research.IRegisterableResearch;
import thaumic.tinkerer.common.research.KamiResearchItem;
import thaumic.tinkerer.common.research.ResearchHelper;
import java.util.ArrayList;
import java.util.Random;
public class BlockWarpGate extends BlockModContainer {
public static IIcon[] icons = new IIcon[3];
@@ -66,12 +65,22 @@ public class BlockWarpGate extends BlockModContainer {
}
@Override
public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) {
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);
par5EntityPlayer.openGui(
ThaumicTinkerer.instance, LibGuiIDs.GUI_ID_WARP_GATE, par1World, par2, par3, par4);
}
}
@@ -91,27 +100,33 @@ public class BlockWarpGate extends BlockModContainer {
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)) {
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()));
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());
entityitem.getEntityItem().setTagCompound((NBTTagCompound)
itemstack.getTagCompound().copy());
}
}
}
par1World.func_147453_f(par2, par3, par4, par5);
}
super.breakBlock(par1World, par2, par3, par4, par5, par6);
@@ -129,8 +144,7 @@ public class BlockWarpGate extends BlockModContainer {
@Override
public void registerBlockIcons(IIconRegister par1IconRegister) {
for (int i = 0; i < icons.length; i++)
icons[i] = IconHelper.forBlock(par1IconRegister, this, i);
for (int i = 0; i < icons.length; i++) icons[i] = IconHelper.forBlock(par1IconRegister, this, i);
}
@Override
@@ -183,11 +197,25 @@ public class BlockWarpGate extends BlockModContainer {
if (!Config.allowMirrors) {
return null;
}
if(!ConfigHandler.enableKami)
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));
if (!ConfigHandler.enableKami) 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
@@ -195,7 +223,17 @@ public class BlockWarpGate extends BlockModContainer {
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));
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));
}
}
@@ -30,8 +30,10 @@ public class BlockMobilizer extends BlockMod {
@SideOnly(Side.CLIENT)
private IIcon iconTop;
@SideOnly(Side.CLIENT)
private IIcon iconBottom;
@SideOnly(Side.CLIENT)
private IIcon iconSide;
@@ -40,8 +42,7 @@ public class BlockMobilizer extends BlockMod {
}
@Override
public void onBlockPreDestroy(World par1World, int par2, int par3,
int par4, int par5) {
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) {
@@ -71,7 +72,9 @@ public class BlockMobilizer extends BlockMod {
@Override
@SideOnly(Side.CLIENT)
public IIcon getIcon(int par1, int meta) {
return par1 == ForgeDirection.UP.ordinal() ? iconTop : par1 == ForgeDirection.DOWN.ordinal() ? iconBottom : iconSide;
return par1 == ForgeDirection.UP.ordinal()
? iconTop
: par1 == ForgeDirection.DOWN.ordinal() ? iconBottom : iconSide;
}
@Override
@@ -91,14 +94,32 @@ public class BlockMobilizer extends BlockMod {
@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();
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));
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));
}
}
@@ -29,8 +29,10 @@ public class BlockMobilizerRelay extends BlockMod {
@SideOnly(Side.CLIENT)
private IIcon iconTop;
@SideOnly(Side.CLIENT)
private IIcon iconBottom;
@SideOnly(Side.CLIENT)
private IIcon iconSide;
@@ -59,7 +61,9 @@ public class BlockMobilizerRelay extends BlockMod {
@Override
@SideOnly(Side.CLIENT)
public IIcon getIcon(int par1, int meta) {
return par1 == ForgeDirection.UP.ordinal() ? iconTop : par1 == ForgeDirection.DOWN.ordinal() ? iconBottom : iconSide;
return par1 == ForgeDirection.UP.ordinal()
? iconTop
: par1 == ForgeDirection.DOWN.ordinal() ? iconBottom : iconSide;
}
@Override
@@ -84,12 +88,23 @@ public class BlockMobilizerRelay extends BlockMod {
@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));
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));
}
}
@@ -16,6 +16,8 @@ package thaumic.tinkerer.common.block.quartz;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
@@ -37,12 +39,10 @@ import thaumic.tinkerer.common.registry.ThaumicTinkererRecipe;
import thaumic.tinkerer.common.registry.ThaumicTinkererRecipeMulti;
import thaumic.tinkerer.common.research.IRegisterableResearch;
import java.util.ArrayList;
import java.util.List;
public class BlockDarkQuartz extends BlockMod {
private static final String[] iconNames = new String[]{"darkQuartz0", "chiseledDarkQuartz0", "pillarDarkQuartz0", null, null};
private static final String[] iconNames =
new String[] {"darkQuartz0", "chiseledDarkQuartz0", "pillarDarkQuartz0", null, null};
private IIcon[] darkQuartzIcons;
private IIcon chiseledDarkQuartzIcon;
private IIcon pillarDarkQuartzIcon;
@@ -59,21 +59,24 @@ public class BlockDarkQuartz extends BlockMod {
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;
if (par1 == 0) return darkQuartzTopIcon;
else {
if (par2 < 0 || par2 >= darkQuartzIcons.length)
par2 = 0;
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 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) {
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:
@@ -122,8 +125,7 @@ public class BlockDarkQuartz extends BlockMod {
darkQuartzIcons = new IIcon[iconNames.length];
for (int i = 0; i < darkQuartzIcons.length; ++i) {
if (iconNames[i] == null)
darkQuartzIcons[i] = darkQuartzIcons[i - 1];
if (iconNames[i] == null) darkQuartzIcons[i] = darkQuartzIcons[i - 1];
else darkQuartzIcons[i] = IconHelper.forName(par1IconRegister, iconNames[i]);
}
@@ -170,16 +172,26 @@ public class BlockDarkQuartz extends BlockMod {
@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)));
}
}
@@ -16,6 +16,8 @@ package thaumic.tinkerer.common.block.quartz;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import java.util.ArrayList;
import java.util.Random;
import net.minecraft.block.BlockSlab;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
@@ -34,9 +36,6 @@ import thaumic.tinkerer.common.registry.ThaumicTinkererCraftingBenchRecipe;
import thaumic.tinkerer.common.registry.ThaumicTinkererRecipe;
import thaumic.tinkerer.common.research.IRegisterableResearch;
import java.util.ArrayList;
import java.util.Random;
public class BlockDarkQuartzSlab extends BlockSlab implements ITTinkererBlock {
public BlockDarkQuartzSlab(boolean par2) {
@@ -60,7 +59,9 @@ public class BlockDarkQuartzSlab extends BlockSlab implements ITTinkererBlock {
@Override
@SideOnly(Side.CLIENT)
public IIcon getIcon(int par1, int par2) {
return ThaumicTinkerer.registry.getFirstBlockFromClass(BlockDarkQuartz.class).getBlockTextureFromSide(par1);
return ThaumicTinkerer.registry
.getFirstBlockFromClass(BlockDarkQuartz.class)
.getBlockTextureFromSide(par1);
}
@Override
@@ -68,10 +69,10 @@ public class BlockDarkQuartzSlab extends BlockSlab implements ITTinkererBlock {
return Item.getItemFromBlock(ThaumicTinkerer.registry.getFirstBlockFromClass(BlockDarkQuartzSlab.class));
}
//@Override
//public int idDropped(int par1, Random par2Random, int par3) {
// @Override
// public int idDropped(int par1, Random par2Random, int par3) {
// return ThaumicTinkerer.registry.getFirstBlockFromClass(BlockDarkQuartzSlab.class).blockID;
//}
// }
@Override
public ItemStack createStackedBlock(int par1) {
@@ -131,8 +132,11 @@ public class BlockDarkQuartzSlab extends BlockSlab implements ITTinkererBlock {
if (isOpaqueCube()) {
return null;
}
return new ThaumicTinkererCraftingBenchRecipe(LibResearch.KEY_DARK_QUARTZ + 2, new ItemStack(ThaumicTinkerer.registry.getFirstBlockFromClass(BlockDarkQuartzSlab.class), 6),
return new ThaumicTinkererCraftingBenchRecipe(
LibResearch.KEY_DARK_QUARTZ + 2,
new ItemStack(ThaumicTinkerer.registry.getFirstBlockFromClass(BlockDarkQuartzSlab.class), 6),
"QQQ",
'Q', ThaumicTinkerer.registry.getFirstBlockFromClass(BlockDarkQuartz.class));
'Q',
ThaumicTinkerer.registry.getFirstBlockFromClass(BlockDarkQuartz.class));
}
}
}
@@ -14,6 +14,7 @@
*/
package thaumic.tinkerer.common.block.quartz;
import java.util.ArrayList;
import net.minecraft.block.BlockStairs;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
@@ -28,8 +29,6 @@ import thaumic.tinkerer.common.registry.ThaumicTinkererRecipe;
import thaumic.tinkerer.common.registry.ThaumicTinkererRecipeMulti;
import thaumic.tinkerer.common.research.IRegisterableResearch;
import java.util.ArrayList;
public class BlockDarkQuartzStairs extends BlockStairs implements ITTinkererBlock {
public BlockDarkQuartzStairs() {
@@ -75,12 +74,21 @@ public class BlockDarkQuartzStairs extends BlockStairs implements ITTinkererBloc
@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))
);
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)));
}
}
}
@@ -19,6 +19,8 @@ import cpw.mods.fml.common.Optional;
import dan200.computercraft.api.lua.ILuaContext;
import dan200.computercraft.api.peripheral.IComputerAccess;
import dan200.computercraft.api.peripheral.IPeripheral;
import java.util.HashMap;
import java.util.Map;
import li.cil.oc.api.machine.Arguments;
import li.cil.oc.api.machine.Callback;
import li.cil.oc.api.machine.Context;
@@ -35,12 +37,9 @@ import thaumcraft.api.aspects.AspectList;
import thaumcraft.common.lib.crafting.ThaumcraftCraftingManager;
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 {
@@ -55,8 +54,7 @@ public class TileAspectAnalyzer extends TileEntity implements IInventory, Simple
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);
if (var5 >= 0 && var5 < inventorySlots.length) inventorySlots[var5] = ItemStack.loadItemStackFromNBT(var4);
}
}
@@ -74,7 +72,6 @@ public class TileAspectAnalyzer extends TileEntity implements IInventory, Simple
}
}
par1NBTTagCompound.setTag("Items", var2);
}
@Override
@@ -99,8 +96,7 @@ public class TileAspectAnalyzer extends TileEntity implements IInventory, Simple
} else {
stackAt = inventorySlots[i].splitStack(j);
if (inventorySlots[i].stackSize == 0)
inventorySlots[i] = null;
if (inventorySlots[i].stackSize == 0) inventorySlots[i] = null;
return stackAt;
}
@@ -136,19 +132,15 @@ public class TileAspectAnalyzer extends TileEntity implements IInventory, Simple
@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;
return worldObj.getTileEntity(xCoord, yCoord, zCoord) == this
&& entityplayer.getDistanceSq(xCoord + 0.5D, yCoord + 0.5D, zCoord + 0.5D) <= 64;
}
@Override
public void openInventory() {
}
public void openInventory() {}
@Override
public void closeInventory() {
}
public void closeInventory() {}
@Override
public boolean isItemValidForSlot(int i, ItemStack itemstack) {
@@ -162,7 +154,7 @@ public class TileAspectAnalyzer extends TileEntity implements IInventory, Simple
@Override
public String[] getMethodNames() {
return new String[]{"hasItem", "itemHasAspects", "getAspects", "getAspectCount"};
return new String[] {"hasItem", "itemHasAspects", "getAspects", "getAspectCount"};
}
@Override
@@ -184,7 +176,7 @@ public class TileAspectAnalyzer extends TileEntity implements IInventory, Simple
public Object[] hasItemMethod() {
ItemStack stack = getStackInSlot(0);
return new Object[]{stack != null};
return new Object[] {stack != null};
}
public AspectList getAspectList() {
@@ -201,28 +193,25 @@ public class TileAspectAnalyzer extends TileEntity implements IInventory, Simple
public Object[] itemHasAspectsMethod() {
AspectList aspects = getAspectList();
return new Object[]{aspects != null && aspects.size() > 0};
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};
if (aspects == null) return new Object[] {retVals};
double i = 1;
for (Aspect aspect : aspects.getAspectsSorted())
retVals.put(i++, aspect.getTag());
return new Object[]{retVals};
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};
if (aspects == null) return new Object[] {retVals};
for (Aspect aspect : aspects.getAspectsSorted())
retVals.put(aspect.getTag(), (double) aspects.getAmount(aspect));
return new Object[]{retVals};
return new Object[] {retVals};
}
@Override
@@ -249,9 +238,7 @@ public class TileAspectAnalyzer extends TileEntity implements IInventory, Simple
}
@Override
public void doneMoving() {
}
public void doneMoving() {}
@Override
public String getComponentName() {
@@ -261,7 +248,7 @@ public class TileAspectAnalyzer extends TileEntity implements IInventory, Simple
@Callback
@Optional.Method(modid = "OpenComputers")
public Object[] greet(Context context, Arguments args) {
return new Object[]{String.format("Hello, %s!", args.checkString(0))};
return new Object[] {String.format("Hello, %s!", args.checkString(0))};
}
@Callback(doc = "function():boolean -- Whether this inventory contains an item")
@@ -80,7 +80,5 @@ public class TileCamo extends TileEntity implements IMovableTile {
}
@Override
public void doneMoving() {
}
public void doneMoving() {}
}
@@ -14,14 +14,11 @@
*/
package thaumic.tinkerer.common.block.tile;
import java.util.ArrayList;
import java.util.List;
import org.apache.commons.lang3.ArrayUtils;
import appeng.api.movable.IMovableTile;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.relauncher.Side;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.entity.player.EntityPlayer;
@@ -33,6 +30,7 @@ import net.minecraft.network.NetworkManager;
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.util.Constants;
import org.apache.commons.lang3.ArrayUtils;
import thaumcraft.api.aspects.Aspect;
import thaumcraft.api.aspects.AspectList;
import thaumcraft.common.Thaumcraft;
@@ -79,7 +77,7 @@ public class TileEnchanter extends TileEntity implements ISidedInventory, IMovab
}
public void removeLevel(int index) {
levels.remove(index);
levels.remove(index);
}
public void setEnchant(int index, int enchant) {
@@ -107,7 +105,7 @@ public class TileEnchanter extends TileEntity implements ISidedInventory, IMovab
checkPillars();
if (!working) // Pillar check
return;
return;
enchantItem:
{
@@ -115,8 +113,7 @@ public class TileEnchanter extends TileEntity implements ISidedInventory, IMovab
int currentAmount = currentAspects.getAmount(aspect);
int totalAmount = totalAspects.getAmount(aspect);
if (currentAmount < totalAmount)
break enchantItem;
if (currentAmount < totalAmount) break enchantItem;
}
working = false;
@@ -127,8 +124,7 @@ public class TileEnchanter extends TileEntity implements ISidedInventory, IMovab
int enchant = enchantments.get(i);
int level = levels.get(i);
if (!worldObj.isRemote)
tool.addEnchantment(Enchantment.enchantmentsList[enchant], level);
if (!worldObj.isRemote) tool.addEnchantment(Enchantment.enchantmentsList[enchant], level);
}
enchantments.clear();
@@ -140,7 +136,9 @@ public class TileEnchanter extends TileEntity implements ISidedInventory, IMovab
ItemStack wand = getStackInSlot(1);
if (wand != null && wand.getItem() instanceof ItemWandCasting && !((ItemWandCasting) wand.getItem()).isStaff(wand)) {
if (wand != null
&& wand.getItem() instanceof ItemWandCasting
&& !((ItemWandCasting) wand.getItem()).isStaff(wand)) {
ItemWandCasting wandItem = (ItemWandCasting) wand.getItem();
AspectList wandAspects = wandItem.getAllVis(wand);
@@ -151,8 +149,7 @@ public class TileEnchanter extends TileEntity implements ISidedInventory, IMovab
missing = totalAspects.getAmount(aspect) - currentAspects.getAmount(aspect);
onWand = wandAspects.getAmount(aspect);
if (missing > 0 && onWand >= 100)
aspectsThatCanGet.add(aspect);
if (missing > 0 && onWand >= 100) aspectsThatCanGet.add(aspect);
}
int i = aspectsThatCanGet.isEmpty() ? 0 : worldObj.rand.nextInt(aspectsThatCanGet.size());
@@ -163,62 +160,90 @@ public class TileEnchanter extends TileEntity implements ISidedInventory, IMovab
currentAspects.add(aspect, 1);
Tuple4Int p = pillars.get(i);
if (worldObj.rand.nextBoolean()) {
if (FMLCommonHandler.instance().getEffectiveSide().isClient()) {
Thaumcraft.proxy.essentiaTrailFx(getWorldObj(), p.i1, p.i4, p.i3, xCoord, yCoord, zCoord, 4, aspect.getColor(), worldObj.rand.nextFloat() * 0.5F + 0.5F);
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 (FMLCommonHandler.instance().getEffectiveSide().isClient()) {
Thaumcraft.proxy.essentiaTrailFx(
getWorldObj(),
p.i1,
p.i4,
p.i3,
xCoord,
yCoord,
zCoord,
4,
aspect.getColor(),
worldObj.rand.nextFloat() * 0.5F + 0.5F);
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:egidle", 0.5F, 1F);
}
}
}
}
}
public boolean consumeAllVisCrafting(ItemStack is, EntityPlayer player, AspectList aspects, boolean doit, ItemWandCasting wandItem) {
if(aspects != null && aspects.size() != 0) {
public boolean consumeAllVisCrafting(
ItemStack is, EntityPlayer player, AspectList aspects, boolean doit, ItemWandCasting wandItem) {
if (aspects != null && aspects.size() != 0) {
AspectList aspectList = new AspectList();
Aspect[] aspectArray = aspects.getAspects();
int arrayLength = aspectArray.length;
for(int i$ = 0; i$ < arrayLength; ++i$) {
for (int i$ = 0; i$ < arrayLength; ++i$) {
Aspect aspect = aspectArray[i$];
int cost = aspects.getAmount(aspect) * 100;
aspectList.add(aspect, cost);
}
aspects=aspectList;
if(aspects != null && aspects.size() != 0) {
aspects = aspectList;
if (aspects != null && aspects.size() != 0) {
AspectList nl = new AspectList();
Aspect[] arr$ = aspects.getAspects();
int len$ = arr$.length;
int i$;
Aspect aspect;
for(i$ = 0; i$ < len$; ++i$) {
for (i$ = 0; i$ < len$; ++i$) {
aspect = arr$[i$];
int cost = aspects.getAmount(aspect);
cost = (int)((float)cost * wandItem.getConsumptionModifier(is, player, aspect, true));
cost = (int) ((float) cost * wandItem.getConsumptionModifier(is, player, aspect, true));
nl.add(aspect, cost);
}
arr$ = nl.getAspects();
len$ = arr$.length;
for(i$ = 0; i$ < len$; ++i$) {
for (i$ = 0; i$ < len$; ++i$) {
aspect = arr$[i$];
if(wandItem.getVis(is, aspect) < nl.getAmount(aspect)) {
if (wandItem.getVis(is, aspect) < nl.getAmount(aspect)) {
return false;
}
}
if(doit && FMLCommonHandler.instance().getEffectiveSide()== Side.SERVER) {
if (doit && FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER) {
arr$ = nl.getAspects();
len$ = arr$.length;
for(i$ = 0; i$ < len$; ++i$) {
for (i$ = 0; i$ < len$; ++i$) {
aspect = arr$[i$];
wandItem.storeVis(is, aspect, wandItem.getVis(is, aspect) - nl.getAmount(aspect));
}
@@ -233,7 +258,6 @@ public class TileEnchanter extends TileEntity implements ISidedInventory, IMovab
}
}
@Override
public void markDirty() {
super.markDirty();
@@ -260,8 +284,7 @@ public class TileEnchanter extends TileEntity implements ISidedInventory, IMovab
if (pillarHeight == -1) {
pillars.clear();
return checkPillars();
} else if (pillarHeight != pillar.i4)
pillar.i4 = pillarHeight;
} else if (pillarHeight != pillar.i4) pillar.i4 = pillarHeight;
}
return true;
@@ -272,11 +295,9 @@ public class TileEnchanter extends TileEntity implements ISidedInventory, IMovab
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 (height != -1) pillars.add(new Tuple4Int(x, y, z, height));
if (pillars.size() == 6)
return false;
if (pillars.size() == 6) return false;
}
pillars.clear();
@@ -286,8 +307,7 @@ public class TileEnchanter extends TileEntity implements ISidedInventory, IMovab
public int findPillar(int x, int y, int z) {
int obsidianFound = 0;
for (int i = 0; true; i++) {
if (y + i >= 256)
return -1;
if (y + i >= 256) return -1;
Block id = worldObj.getBlock(x, y + i, z);
int meta = worldObj.getBlockMetadata(x, y + i, z);
@@ -296,8 +316,7 @@ public class TileEnchanter extends TileEntity implements ISidedInventory, IMovab
continue;
}
if (id == ConfigBlocks.blockAiry && meta == 1) {
if (obsidianFound >= 2 && obsidianFound < 13)
return y + i;
if (obsidianFound >= 2 && obsidianFound < 13) return y + i;
return -1;
}
@@ -312,8 +331,7 @@ public class TileEnchanter extends TileEntity implements ISidedInventory, IMovab
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));
for (Aspect aspect : aspects.getAspectsSorted()) totalAspects.add(aspect, aspects.getAmount(aspect));
}
}
@@ -337,26 +355,24 @@ public class TileEnchanter extends TileEntity implements ISidedInventory, IMovab
totalAspects.readFromNBT(par1NBTTagCompound.getCompoundTag(TAG_TOTAL_ASPECTS));
enchantments.clear();
for (int i : par1NBTTagCompound.getIntArray(TAG_ENCHANTS))
enchantments.add(i);
for (int i : par1NBTTagCompound.getIntArray(TAG_ENCHANTS)) enchantments.add(i);
levels.clear();
for (int i : par1NBTTagCompound.getIntArray(TAG_LEVELS))
levels.add(i);
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);
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()])));
par1NBTTagCompound.setIntArray(
TAG_ENCHANTS, ArrayUtils.toPrimitive(enchantments.toArray(new Integer[enchantments.size()])));
NBTTagCompound totalAspectsCmp = new NBTTagCompound();
totalAspects.writeToNBT(totalAspectsCmp);
@@ -401,8 +417,7 @@ public class TileEnchanter extends TileEntity implements ISidedInventory, IMovab
} else {
stackAt = inventorySlots[i].splitStack(j);
if (inventorySlots[i].stackSize == 0)
inventorySlots[i] = null;
if (inventorySlots[i].stackSize == 0) inventorySlots[i] = null;
return stackAt;
}
@@ -438,18 +453,15 @@ public class TileEnchanter extends TileEntity implements ISidedInventory, IMovab
@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;
return worldObj.getTileEntity(xCoord, yCoord, zCoord) == this
&& entityplayer.getDistanceSq(xCoord + 0.5D, yCoord + 0.5D, zCoord + 0.5D) <= 64;
}
@Override
public void openInventory() {
}
public void openInventory() {}
@Override
public void closeInventory() {
}
public void closeInventory() {}
@Override
public boolean isItemValidForSlot(int i, ItemStack itemstack) {
@@ -490,7 +502,5 @@ public class TileEnchanter extends TileEntity implements ISidedInventory, IMovab
}
@Override
public void doneMoving() {
}
public void doneMoving() {}
}
@@ -59,89 +59,126 @@ public class TileEntityMobilizer extends TileEntity {
if (te instanceof TileEntityRelay) {
((TileEntityRelay) te).verifyPartner();
}
if (!(linked && te instanceof TileEntityRelay && ((TileEntityRelay) te).partnerX == this.secondRelayX && ((TileEntityRelay) te).partnerZ == this.secondRelayZ)) {
if (!(linked
&& te instanceof TileEntityRelay
&& ((TileEntityRelay) te).partnerX == this.secondRelayX
&& ((TileEntityRelay) te).partnerZ == this.secondRelayZ)) {
linked = false;
}
}
public void updateEntity() {
//Check for ghost TEs
if (dead)
return;
//Make sure the relays haven't been broken
// 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
// 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")) {
// 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
// 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)) {
// 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 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){
// 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
// Move the block on top of the mobilizer
if (!worldObj.isRemote) {
TileEntity passenger = worldObj.getTileEntity(xCoord, yCoord + 1, zCoord);
IAppEngApi api = AEApi.instance();
//Prevent the passenger from popping off. Not sent to clients.
// Prevent the passenger from popping off. Not sent to clients.
worldObj.setBlock(targetX, yCoord, targetZ, Block.getBlockFromName("stone"), 0, 0);
//Move non-TE blocks
// 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")) {
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
// 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);
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()
.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")) {
// 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);
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
// IMovableHandler default code
Chunk c = worldObj.getChunkFromBlockCoords(targetX, targetZ);
c.func_150812_a(targetX & 0xF, yCoord + 1, targetZ & 0xF, passenger);
@@ -150,17 +187,19 @@ public class TileEntityMobilizer extends TileEntity {
worldObj.addTileEntity(passenger);
worldObj.markBlockForUpdate(targetX, yCoord + 1, targetZ);
}
if (imovable)
((IMovableTile) passenger).doneMoving();
if (imovable) ((IMovableTile) passenger).doneMoving();
passenger.validate();
}
}
//Move self
// 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));
worldObj.setBlock(
targetX,
yCoord,
targetZ,
ThaumicTinkerer.registry.getFirstBlockFromClass(BlockMobilizer.class));
int oldX = xCoord;
int oldZ = zCoord;
@@ -172,12 +211,8 @@ public class TileEntityMobilizer extends TileEntity {
worldObj.removeTileEntity(oldX, yCoord, oldZ);
worldObj.notifyBlockChange(oldX, yCoord, oldZ, Block.getBlockFromName("air"));
}
}
}
}
}
@@ -12,12 +12,14 @@ public class TileEntityRelay extends TileEntity implements IMovableTile {
public int partnerX;
public int partnerZ;
public TileEntityRelay() {
}
public TileEntityRelay() {}
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)) {
if (!(hasPartner
&& te instanceof TileEntityRelay
&& ((TileEntityRelay) te).partnerX == this.xCoord
&& ((TileEntityRelay) te).partnerZ == this.zCoord)) {
hasPartner = false;
}
}
@@ -30,7 +32,6 @@ public class TileEntityRelay extends TileEntity implements IMovableTile {
nbt.setInteger("PartnerX", partnerX);
nbt.setInteger("PartnerZ", partnerZ);
}
@Override
@@ -62,7 +63,11 @@ public class TileEntityRelay extends TileEntity implements IMovableTile {
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);
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);
@@ -128,7 +133,6 @@ public class TileEntityRelay extends TileEntity implements IMovableTile {
this.hasPartner = true;
((TileEntityRelay) te).hasPartner = true;
}
}
@@ -138,8 +142,5 @@ public class TileEntityRelay extends TileEntity implements IMovableTile {
}
@Override
public void doneMoving() {
}
public void doneMoving() {}
}
@@ -54,13 +54,21 @@ public class TileFunnel extends TileEntity implements ISidedInventory, IAspectCo
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());
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)) {
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));
}
@@ -79,7 +87,8 @@ public class TileFunnel extends TileEntity implements ISidedInventory, IAspectCo
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]);
return worldObj.getTileEntity(
x + Facing.offsetsXForSide[i], y + Facing.offsetsYForSide[i], z + Facing.offsetsZForSide[i]);
}
@Override
@@ -102,8 +111,7 @@ public class TileFunnel extends TileEntity implements ISidedInventory, IAspectCo
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);
if (var5 >= 0 && var5 < inventorySlots.length) inventorySlots[var5] = ItemStack.loadItemStackFromNBT(var4);
}
}
@@ -128,7 +136,8 @@ public class TileFunnel extends TileEntity implements ISidedInventory, IAspectCo
@Override
public ItemStack getStackInSlot(int i) {
AspectList aspects = getAspects();
//if(inventorySlots[i] != null && inventorySlots[i].itemID == ConfigItems.itemJarFilled.itemID && aspects == null) {
// 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)
@@ -138,7 +147,7 @@ public class TileFunnel extends TileEntity implements ISidedInventory, IAspectCo
// inventorySlots[i].getTagCompound().setString("AspectFilter",filter.getTag());
// }
// onInventoryChanged();
//}
// }
return inventorySlots[i];
}
@@ -155,8 +164,7 @@ public class TileFunnel extends TileEntity implements ISidedInventory, IAspectCo
} else {
stackAt = inventorySlots[i].splitStack(j);
if (inventorySlots[i].stackSize == 0)
inventorySlots[i] = null;
if (inventorySlots[i].stackSize == 0) inventorySlots[i] = null;
return stackAt;
}
@@ -192,18 +200,15 @@ public class TileFunnel extends TileEntity implements ISidedInventory, IAspectCo
@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;
return worldObj.getTileEntity(xCoord, yCoord, zCoord) == this
&& entityplayer.getDistanceSq(xCoord + 0.5D, yCoord + 0.5D, zCoord + 0.5D) <= 64;
}
@Override
public void openInventory() {
}
public void openInventory() {}
@Override
public void closeInventory() {
}
public void closeInventory() {}
@Override
public boolean isItemValidForSlot(int i, ItemStack itemstack) {
@@ -225,7 +230,7 @@ public class TileFunnel extends TileEntity implements ISidedInventory, IAspectCo
@Override
public int[] getAccessibleSlotsFromSide(int var1) {
return var1 == ForgeDirection.DOWN.ordinal() ? new int[0] : new int[]{0};
return var1 == ForgeDirection.DOWN.ordinal() ? new int[0] : new int[] {0};
}
@Override
@@ -241,12 +246,13 @@ public class TileFunnel extends TileEntity implements ISidedInventory, IAspectCo
@Override
public AspectList getAspects() {
ItemStack stack = inventorySlots[0];
return stack != null && stack.getItem() instanceof IEssentiaContainerItem ? ((IEssentiaContainerItem) stack.getItem()).getAspects(stack) : null;
return stack != null && stack.getItem() instanceof IEssentiaContainerItem
? ((IEssentiaContainerItem) stack.getItem()).getAspects(stack)
: null;
}
@Override
public void setAspects(AspectList paramAspectList) {
}
public void setAspects(AspectList paramAspectList) {}
@Override
public boolean doesContainerAccept(Aspect paramAspect) {
@@ -289,8 +295,5 @@ public class TileFunnel extends TileEntity implements ISidedInventory, IAspectCo
}
@Override
public void doneMoving() {
}
public void doneMoving() {}
}
@@ -5,6 +5,7 @@ import dan200.computercraft.api.lua.ILuaContext;
import dan200.computercraft.api.lua.LuaException;
import dan200.computercraft.api.peripheral.IComputerAccess;
import dan200.computercraft.api.peripheral.IPeripheral;
import java.util.*;
import li.cil.oc.api.machine.Arguments;
import li.cil.oc.api.machine.Callback;
import li.cil.oc.api.machine.Context;
@@ -18,11 +19,9 @@ import thaumcraft.common.entities.golems.Marker;
import thaumic.tinkerer.common.core.golems.EnumGolemCores;
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";
@@ -36,12 +35,11 @@ public class TileGolemConnector extends TileCamo implements IPeripheral, SimpleC
}
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)
);
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()) {
@@ -60,8 +58,7 @@ public class TileGolemConnector extends TileCamo implements IPeripheral, SimpleC
}
public Object[] getGolemDecorationsImplementation() throws LuaException {
if (golem == null || golem.decoration == null || golem.decoration.length() == 0)
return new String[]{};
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));
@@ -70,23 +67,18 @@ public class TileGolemConnector extends TileCamo implements IPeripheral, SimpleC
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")};
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());
if (golemCore == null) throw new LuaException("Golem has Unknown core: " + golem.getCore());
decorations[0] = StatCollector.translateToLocal(golemCore.getName());
return decorations;
}
@Override
@@ -108,8 +100,7 @@ public class TileGolemConnector extends TileCamo implements IPeripheral, SimpleC
public void ConnectGolem(UUID golemID) {
golemConnected = golemID;
if (golemID == null)
golem = null;
if (golemID == null) golem = null;
else {
verifyGolem();
}
@@ -120,40 +111,52 @@ public class TileGolemConnector extends TileCamo implements IPeripheral, SimpleC
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();
// verifyGolem();
}
}
@Override
public String[] getMethodNames() {
return new String[]{"getDecorations", "getPosition", "getType", "getHealth", "getCore", "getHome", "setHome", "getMarkers", "setMarkers", "newMarker", "addMarker", "saveMarker", "deleteMarker", "getMarker", "getMarkerCount"};
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 {
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};
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()};
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");
if (arguments.length != 4) throw new LuaException("Invalid arguments");
double x = (Double) arguments[0];
double y = (Double) arguments[1];
double z = (Double) arguments[2];
@@ -162,26 +165,21 @@ public class TileGolemConnector extends TileCamo implements IPeripheral, SimpleC
case 7:
return getMarkersImplementation();
case 8:
if (arguments.length != 1)
throw new LuaException("setMarkers takes 1 argument");
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");
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");
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");
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");
if (arguments.length != 1) throw new LuaException("getMarker must have 1 argument");
return getMarkerImplementation((Double) arguments[0]);
case 14:
return getMarkerCountImplementation();
@@ -190,39 +188,34 @@ public class TileGolemConnector extends TileCamo implements IPeripheral, SimpleC
}
private Object[] getMarkerCountImplementation() {
if (golem == null)
return new String[]{};
if (golem == null) return new String[] {};
ArrayList<Marker> markers = golem.getMarkers();
if (markers == null)
return new Object[]{0};
return new Object[]{(double) markers.size()};
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[]{};
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[]{};
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[]{};
return new String[] {};
}
private Object[] saveMarkerImplementation(double markerNum, Map markerArg) throws LuaException {
if (golem == null)
return new String[]{};
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");
@@ -234,11 +227,9 @@ public class TileGolemConnector extends TileCamo implements IPeripheral, SimpleC
@SuppressWarnings("unchecked")
private Object[] addMarkerImplementation(Map arguments) throws LuaException {
if (golem == null)
return new String[]{};
if (golem == null) return new String[] {};
ArrayList<Marker> markers = golem.getMarkers();
if (markers == null)
markers = new ArrayList<Marker>();
if (markers == null) markers = new ArrayList<Marker>();
Marker mark = toMarkerImplementation(arguments);
markers.add(mark);
golem.setMarkers(markers);
@@ -253,13 +244,12 @@ public class TileGolemConnector extends TileCamo implements IPeripheral, SimpleC
mark.put("dim", this.worldObj.provider.dimensionId);
mark.put("color", -1);
mark.put("side", 1);
return new Object[]{mark};
return new Object[] {mark};
}
@SuppressWarnings("unchecked")
private Object[] setMarkersImplementation(Map arguments) throws LuaException {
if (golem == null)
return new String[]{};
if (golem == null) return new String[] {};
ArrayList<Marker> arrList = new ArrayList<Marker>();
@@ -267,7 +257,6 @@ public class TileGolemConnector extends TileCamo implements IPeripheral, SimpleC
Marker mark = toMarkerImplementation((Map) map);
arrList.add(mark);
}
golem.setMarkers(arrList);
return getMarkersImplementation();
@@ -288,8 +277,7 @@ public class TileGolemConnector extends TileCamo implements IPeripheral, SimpleC
}
private Object[] getMarkersImplementation() {
if (golem == null)
return new String[]{};
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;
@@ -297,7 +285,7 @@ public class TileGolemConnector extends TileCamo implements IPeripheral, SimpleC
HashMap<String, Object> luaMarker = fromMarkerImplementation(mark);
luaMarkers.put(i++, luaMarker);
}
return new Object[]{luaMarkers};
return new Object[] {luaMarkers};
}
/**
@@ -317,8 +305,7 @@ public class TileGolemConnector extends TileCamo implements IPeripheral, SimpleC
}
private Object[] setHomeImplementation(double x, double y, double z, double facing) throws LuaException {
if (golem == null)
return new String[]{};
if (golem == null) return new String[] {};
golem.setHomeArea((int) x, (int) y, (int) z, 35);
golem.homeFacing = (int) facing;
@@ -326,32 +313,30 @@ public class TileGolemConnector extends TileCamo implements IPeripheral, SimpleC
}
private Object[] getHomeImplementation() {
if (golem == null)
return new String[]{};
if (golem == null) return new String[] {};
ChunkCoordinates home = golem.getHomePosition();
return new Integer[]{home.posX, home.posY, home.posZ, golem.homeFacing};
return new Integer[] {home.posX, home.posY, home.posZ, golem.homeFacing};
}
private String[] getGolemTypeImplementation() throws LuaException {
if (golem == null)
return new String[]{};
if (golem == null) return new String[] {};
switch (golem.getGolemType()) {
case CLAY:
return new String[]{"Clay"};
return new String[] {"Clay"};
case FLESH:
return new String[]{"Flesh"};
return new String[] {"Flesh"};
case IRON:
return new String[]{"Iron"};
return new String[] {"Iron"};
case STONE:
return new String[]{"Stone"};
return new String[] {"Stone"};
case STRAW:
return new String[]{"Straw"};
return new String[] {"Straw"};
case TALLOW:
return new String[]{"Tallow"};
return new String[] {"Tallow"};
case THAUMIUM:
return new String[]{"Thaumium"};
return new String[] {"Thaumium"};
case WOOD:
return new String[]{"Wood"};
return new String[] {"Wood"};
default:
throw new LuaException("Unknown Golem Type: " + golem.getGolemType());
}
@@ -375,7 +360,6 @@ public class TileGolemConnector extends TileCamo implements IPeripheral, SimpleC
@Optional.Method(modid = "ComputerCraft")
public boolean equals(IPeripheral other) {
return this.equals((Object) other);
}
@Override
@@ -392,7 +376,7 @@ public class TileGolemConnector extends TileCamo implements IPeripheral, SimpleC
@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};
return new Double[] {golem.posX, golem.posY, golem.posZ};
}
@Callback(doc = "function():string -- Returns The golems type")
@@ -404,7 +388,7 @@ public class TileGolemConnector extends TileCamo implements IPeripheral, SimpleC
@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()};
return new Float[] {golem.getHealth()};
}
@Callback(doc = "function():string -- Returns The golems core")
@@ -422,7 +406,8 @@ public class TileGolemConnector extends TileCamo implements IPeripheral, SimpleC
@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));
return setHomeImplementation(
args.checkDouble(0), args.checkDouble(1), args.checkDouble(2), args.checkDouble(3));
}
@Callback(doc = "function():table -- Gets list of markers")
@@ -472,5 +457,4 @@ public class TileGolemConnector extends TileCamo implements IPeripheral, SimpleC
public Object[] getMarkerCount(Context context, Arguments args) throws LuaException {
return getMarkerCountImplementation();
}
}
Loaded 100 of 309 files, more files were not shown because too many files have changed in this diff. Show more