fix: alembic and infusion crafter work now
|
@ -2,7 +2,9 @@ package net.anvilcraft.classiccasting;
|
||||||
|
|
||||||
import cpw.mods.fml.common.Mod;
|
import cpw.mods.fml.common.Mod;
|
||||||
import cpw.mods.fml.common.SidedProxy;
|
import cpw.mods.fml.common.SidedProxy;
|
||||||
|
import cpw.mods.fml.common.event.FMLInitializationEvent;
|
||||||
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
||||||
|
import cpw.mods.fml.common.network.NetworkRegistry;
|
||||||
|
|
||||||
@Mod(
|
@Mod(
|
||||||
modid = "classiccasting",
|
modid = "classiccasting",
|
||||||
|
@ -11,6 +13,9 @@ import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
||||||
dependencies = "required-after:Thaumcraft"
|
dependencies = "required-after:Thaumcraft"
|
||||||
)
|
)
|
||||||
public class ClassicCasting {
|
public class ClassicCasting {
|
||||||
|
@Mod.Instance
|
||||||
|
public static ClassicCasting INSTANCE;
|
||||||
|
|
||||||
@SidedProxy(
|
@SidedProxy(
|
||||||
modId = "classiccasting",
|
modId = "classiccasting",
|
||||||
clientSide = "net.anvilcraft.classiccasting.ClientProxy",
|
clientSide = "net.anvilcraft.classiccasting.ClientProxy",
|
||||||
|
@ -28,4 +33,9 @@ public class ClassicCasting {
|
||||||
|
|
||||||
proxy.preInit();
|
proxy.preInit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Mod.EventHandler
|
||||||
|
public void init(FMLInitializationEvent ev) {
|
||||||
|
NetworkRegistry.INSTANCE.registerGuiHandler(this, proxy);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,17 @@
|
||||||
package net.anvilcraft.classiccasting;
|
package net.anvilcraft.classiccasting;
|
||||||
|
|
||||||
import cpw.mods.fml.client.registry.ClientRegistry;
|
import cpw.mods.fml.client.registry.ClientRegistry;
|
||||||
|
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||||
import cpw.mods.fml.common.FMLCommonHandler;
|
import cpw.mods.fml.common.FMLCommonHandler;
|
||||||
|
import net.anvilcraft.classiccasting.gui.GuiInfusionWorkbench;
|
||||||
|
import net.anvilcraft.classiccasting.render.BlockAlembicRenderer;
|
||||||
|
import net.anvilcraft.classiccasting.render.BlockInfusionWorkbenchRenderer;
|
||||||
import net.anvilcraft.classiccasting.render.TileAlembicRenderer;
|
import net.anvilcraft.classiccasting.render.TileAlembicRenderer;
|
||||||
|
import net.anvilcraft.classiccasting.render.TileInfusionWorkbenchRenderer;
|
||||||
import net.anvilcraft.classiccasting.tiles.TileAlembic;
|
import net.anvilcraft.classiccasting.tiles.TileAlembic;
|
||||||
|
import net.anvilcraft.classiccasting.tiles.TileInfusionWorkbench;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
public class ClientProxy extends CommonProxy {
|
public class ClientProxy extends CommonProxy {
|
||||||
@Override
|
@Override
|
||||||
|
@ -11,6 +19,12 @@ public class ClientProxy extends CommonProxy {
|
||||||
super.preInit();
|
super.preInit();
|
||||||
|
|
||||||
FMLCommonHandler.instance().bus().register(new GuiTicker());
|
FMLCommonHandler.instance().bus().register(new GuiTicker());
|
||||||
|
|
||||||
|
BlockAlembicRenderer.RI = RenderingRegistry.getNextAvailableRenderId();
|
||||||
|
RenderingRegistry.registerBlockHandler(new BlockAlembicRenderer());
|
||||||
|
|
||||||
|
BlockInfusionWorkbenchRenderer.RI = RenderingRegistry.getNextAvailableRenderId();
|
||||||
|
RenderingRegistry.registerBlockHandler(new BlockInfusionWorkbenchRenderer());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -18,5 +32,24 @@ public class ClientProxy extends CommonProxy {
|
||||||
ClientRegistry.registerTileEntity(
|
ClientRegistry.registerTileEntity(
|
||||||
TileAlembic.class, "alembic", new TileAlembicRenderer()
|
TileAlembic.class, "alembic", new TileAlembicRenderer()
|
||||||
);
|
);
|
||||||
|
ClientRegistry.registerTileEntity(
|
||||||
|
TileInfusionWorkbench.class,
|
||||||
|
"infusionWorkbench",
|
||||||
|
new TileInfusionWorkbenchRenderer()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object
|
||||||
|
getClientGuiElement(int id, EntityPlayer player, World world, int x, int y, int z) {
|
||||||
|
switch (GuiType.get(id)) {
|
||||||
|
case INFUSION_WORKBENCH:
|
||||||
|
return new GuiInfusionWorkbench(
|
||||||
|
player.inventory, (TileInfusionWorkbench) world.getTileEntity(x, y, z)
|
||||||
|
);
|
||||||
|
|
||||||
|
default:
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,15 @@
|
||||||
package net.anvilcraft.classiccasting;
|
package net.anvilcraft.classiccasting;
|
||||||
|
|
||||||
import cpw.mods.fml.common.FMLCommonHandler;
|
import cpw.mods.fml.common.FMLCommonHandler;
|
||||||
|
import cpw.mods.fml.common.network.IGuiHandler;
|
||||||
import cpw.mods.fml.common.registry.GameRegistry;
|
import cpw.mods.fml.common.registry.GameRegistry;
|
||||||
|
import net.anvilcraft.classiccasting.container.ContainerInfusionWorkbench;
|
||||||
import net.anvilcraft.classiccasting.tiles.TileAlembic;
|
import net.anvilcraft.classiccasting.tiles.TileAlembic;
|
||||||
|
import net.anvilcraft.classiccasting.tiles.TileInfusionWorkbench;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
public class CommonProxy {
|
public class CommonProxy implements IGuiHandler {
|
||||||
public void preInit() {
|
public void preInit() {
|
||||||
FMLCommonHandler.instance().bus().register(new WorldTicker());
|
FMLCommonHandler.instance().bus().register(new WorldTicker());
|
||||||
}
|
}
|
||||||
|
@ -15,5 +20,26 @@ public class CommonProxy {
|
||||||
|
|
||||||
public void registerTileEntities() {
|
public void registerTileEntities() {
|
||||||
GameRegistry.registerTileEntity(TileAlembic.class, "alembic");
|
GameRegistry.registerTileEntity(TileAlembic.class, "alembic");
|
||||||
|
GameRegistry.registerTileEntity(TileInfusionWorkbench.class, "infusionWorkbench");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object
|
||||||
|
getServerGuiElement(int id, EntityPlayer player, World world, int x, int y, int z) {
|
||||||
|
switch (GuiType.get(id)) {
|
||||||
|
case INFUSION_WORKBENCH:
|
||||||
|
return new ContainerInfusionWorkbench(
|
||||||
|
player.inventory, (TileInfusionWorkbench) world.getTileEntity(x, y, z)
|
||||||
|
);
|
||||||
|
|
||||||
|
default:
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object
|
||||||
|
getClientGuiElement(int id, EntityPlayer player, World world, int x, int y, int z) {
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
12
src/main/java/net/anvilcraft/classiccasting/GuiType.java
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
package net.anvilcraft.classiccasting;
|
||||||
|
|
||||||
|
public enum GuiType {
|
||||||
|
INFUSION_WORKBENCH;
|
||||||
|
|
||||||
|
public static GuiType get(int id) {
|
||||||
|
if (id < 0 || id >= GuiType.values().length)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
return GuiType.values()[id];
|
||||||
|
}
|
||||||
|
}
|
293
src/main/java/net/anvilcraft/classiccasting/UtilsFX.java
Normal file
|
@ -0,0 +1,293 @@
|
||||||
|
package net.anvilcraft.classiccasting;
|
||||||
|
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.client.renderer.RenderBlocks;
|
||||||
|
import net.minecraft.client.renderer.Tessellator;
|
||||||
|
import net.minecraft.client.renderer.texture.TextureMap;
|
||||||
|
import net.minecraft.item.ItemBlock;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.util.IIcon;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
|
public class UtilsFX {
|
||||||
|
public static void render3DItem(
|
||||||
|
final ItemStack par2ItemStack,
|
||||||
|
final int par3,
|
||||||
|
final float scale,
|
||||||
|
final int brightness
|
||||||
|
) {
|
||||||
|
final Minecraft mc = Minecraft.getMinecraft();
|
||||||
|
GL11.glPushMatrix();
|
||||||
|
Block block = null;
|
||||||
|
if (par2ItemStack.getItem() instanceof ItemBlock) {
|
||||||
|
block = Block.getBlockFromItem(par2ItemStack.getItem());
|
||||||
|
}
|
||||||
|
if (block != null && par2ItemStack.getItemSpriteNumber() == 0
|
||||||
|
&& RenderBlocks.renderItemIn3d(block.getRenderType())) {
|
||||||
|
mc.renderEngine.bindTexture(TextureMap.locationBlocksTexture);
|
||||||
|
RenderBlocks.getInstance().renderBlockAsItem(
|
||||||
|
block, par2ItemStack.getItemDamage(), 1.0f
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
final IIcon icon = Minecraft.getMinecraft().renderViewEntity.getItemIcon(
|
||||||
|
par2ItemStack, par3
|
||||||
|
);
|
||||||
|
if (icon == null) {
|
||||||
|
GL11.glPopMatrix();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (par2ItemStack.getItemSpriteNumber() == 0) {
|
||||||
|
mc.renderEngine.bindTexture(TextureMap.locationBlocksTexture);
|
||||||
|
} else {
|
||||||
|
mc.renderEngine.bindTexture(TextureMap.locationItemsTexture);
|
||||||
|
}
|
||||||
|
final Tessellator tessellator = Tessellator.instance;
|
||||||
|
final float f = icon.getMinU();
|
||||||
|
final float f2 = icon.getMaxU();
|
||||||
|
final float f3 = icon.getMinV();
|
||||||
|
final float f4 = icon.getMaxV();
|
||||||
|
GL11.glEnable(32826);
|
||||||
|
final float f7 = scale;
|
||||||
|
GL11.glScalef(f7, f7, f7);
|
||||||
|
renderItemIn2D(
|
||||||
|
tessellator,
|
||||||
|
f2,
|
||||||
|
f3,
|
||||||
|
f,
|
||||||
|
f4,
|
||||||
|
icon.getIconWidth(),
|
||||||
|
icon.getIconHeight(),
|
||||||
|
0.0625f,
|
||||||
|
brightness
|
||||||
|
);
|
||||||
|
if (par2ItemStack != null && par2ItemStack.hasEffect(0) && par3 == 0) {
|
||||||
|
GL11.glDepthFunc(514);
|
||||||
|
GL11.glDisable(2896);
|
||||||
|
// TODO: WTF
|
||||||
|
mc.renderEngine.bindTexture(new ResourceLocation("%blur%/misc/glint.png")
|
||||||
|
);
|
||||||
|
GL11.glEnable(3042);
|
||||||
|
GL11.glBlendFunc(768, 1);
|
||||||
|
final float f8 = 0.76f;
|
||||||
|
GL11.glColor4f(0.5f * f8, 0.25f * f8, 0.8f * f8, 1.0f);
|
||||||
|
GL11.glMatrixMode(5890);
|
||||||
|
GL11.glPushMatrix();
|
||||||
|
final float f9 = 0.125f;
|
||||||
|
GL11.glScalef(f9, f9, f9);
|
||||||
|
float f10 = Minecraft.getSystemTime() % 3000L / 3000.0f * 8.0f;
|
||||||
|
GL11.glTranslatef(f10, 0.0f, 0.0f);
|
||||||
|
GL11.glRotatef(-50.0f, 0.0f, 0.0f, 1.0f);
|
||||||
|
renderItemIn2D(
|
||||||
|
tessellator, 0.0f, 0.0f, 1.0f, 1.0f, 256, 256, 0.0625f, brightness
|
||||||
|
);
|
||||||
|
GL11.glPopMatrix();
|
||||||
|
GL11.glPushMatrix();
|
||||||
|
GL11.glScalef(f9, f9, f9);
|
||||||
|
f10 = Minecraft.getSystemTime() % 4873L / 4873.0f * 8.0f;
|
||||||
|
GL11.glTranslatef(-f10, 0.0f, 0.0f);
|
||||||
|
GL11.glRotatef(10.0f, 0.0f, 0.0f, 1.0f);
|
||||||
|
renderItemIn2D(
|
||||||
|
tessellator, 0.0f, 0.0f, 1.0f, 1.0f, 256, 256, 0.0625f, brightness
|
||||||
|
);
|
||||||
|
GL11.glPopMatrix();
|
||||||
|
GL11.glMatrixMode(5888);
|
||||||
|
GL11.glDisable(3042);
|
||||||
|
GL11.glEnable(2896);
|
||||||
|
GL11.glDepthFunc(515);
|
||||||
|
}
|
||||||
|
GL11.glDisable(32826);
|
||||||
|
}
|
||||||
|
GL11.glPopMatrix();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void renderItemIn2D(
|
||||||
|
Tessellator tes,
|
||||||
|
float p_78439_1_,
|
||||||
|
float p_78439_2_,
|
||||||
|
float p_78439_3_,
|
||||||
|
float p_78439_4_,
|
||||||
|
int p_78439_5_,
|
||||||
|
int p_78439_6_,
|
||||||
|
float p_78439_7_,
|
||||||
|
int brightness
|
||||||
|
) {
|
||||||
|
tes.startDrawingQuads();
|
||||||
|
tes.setBrightness(brightness);
|
||||||
|
tes.setNormal(0.0F, 0.0F, 1.0F);
|
||||||
|
tes.addVertexWithUV(
|
||||||
|
0.0D, 0.0D, 0.0D, (double) p_78439_1_, (double) p_78439_4_
|
||||||
|
);
|
||||||
|
tes.addVertexWithUV(
|
||||||
|
1.0D, 0.0D, 0.0D, (double) p_78439_3_, (double) p_78439_4_
|
||||||
|
);
|
||||||
|
tes.addVertexWithUV(
|
||||||
|
1.0D, 1.0D, 0.0D, (double) p_78439_3_, (double) p_78439_2_
|
||||||
|
);
|
||||||
|
tes.addVertexWithUV(
|
||||||
|
0.0D, 1.0D, 0.0D, (double) p_78439_1_, (double) p_78439_2_
|
||||||
|
);
|
||||||
|
tes.draw();
|
||||||
|
tes.startDrawingQuads();
|
||||||
|
tes.setBrightness(brightness);
|
||||||
|
tes.setNormal(0.0F, 0.0F, -1.0F);
|
||||||
|
tes.addVertexWithUV(
|
||||||
|
0.0D,
|
||||||
|
1.0D,
|
||||||
|
(double) (0.0F - p_78439_7_),
|
||||||
|
(double) p_78439_1_,
|
||||||
|
(double) p_78439_2_
|
||||||
|
);
|
||||||
|
tes.addVertexWithUV(
|
||||||
|
1.0D,
|
||||||
|
1.0D,
|
||||||
|
(double) (0.0F - p_78439_7_),
|
||||||
|
(double) p_78439_3_,
|
||||||
|
(double) p_78439_2_
|
||||||
|
);
|
||||||
|
tes.addVertexWithUV(
|
||||||
|
1.0D,
|
||||||
|
0.0D,
|
||||||
|
(double) (0.0F - p_78439_7_),
|
||||||
|
(double) p_78439_3_,
|
||||||
|
(double) p_78439_4_
|
||||||
|
);
|
||||||
|
tes.addVertexWithUV(
|
||||||
|
0.0D,
|
||||||
|
0.0D,
|
||||||
|
(double) (0.0F - p_78439_7_),
|
||||||
|
(double) p_78439_1_,
|
||||||
|
(double) p_78439_4_
|
||||||
|
);
|
||||||
|
tes.draw();
|
||||||
|
float f5 = 0.5F * (p_78439_1_ - p_78439_3_) / (float) p_78439_5_;
|
||||||
|
float f6 = 0.5F * (p_78439_4_ - p_78439_2_) / (float) p_78439_6_;
|
||||||
|
tes.startDrawingQuads();
|
||||||
|
tes.setBrightness(brightness);
|
||||||
|
tes.setNormal(-1.0F, 0.0F, 0.0F);
|
||||||
|
int k;
|
||||||
|
float f7;
|
||||||
|
float f8;
|
||||||
|
|
||||||
|
for (k = 0; k < p_78439_5_; ++k) {
|
||||||
|
f7 = (float) k / (float) p_78439_5_;
|
||||||
|
f8 = p_78439_1_ + (p_78439_3_ - p_78439_1_) * f7 - f5;
|
||||||
|
tes.addVertexWithUV(
|
||||||
|
(double) f7,
|
||||||
|
0.0D,
|
||||||
|
(double) (0.0F - p_78439_7_),
|
||||||
|
(double) f8,
|
||||||
|
(double) p_78439_4_
|
||||||
|
);
|
||||||
|
tes.addVertexWithUV(
|
||||||
|
(double) f7, 0.0D, 0.0D, (double) f8, (double) p_78439_4_
|
||||||
|
);
|
||||||
|
tes.addVertexWithUV(
|
||||||
|
(double) f7, 1.0D, 0.0D, (double) f8, (double) p_78439_2_
|
||||||
|
);
|
||||||
|
tes.addVertexWithUV(
|
||||||
|
(double) f7,
|
||||||
|
1.0D,
|
||||||
|
(double) (0.0F - p_78439_7_),
|
||||||
|
(double) f8,
|
||||||
|
(double) p_78439_2_
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
tes.draw();
|
||||||
|
tes.startDrawingQuads();
|
||||||
|
tes.setBrightness(brightness);
|
||||||
|
tes.setNormal(1.0F, 0.0F, 0.0F);
|
||||||
|
float f9;
|
||||||
|
|
||||||
|
for (k = 0; k < p_78439_5_; ++k) {
|
||||||
|
f7 = (float) k / (float) p_78439_5_;
|
||||||
|
f8 = p_78439_1_ + (p_78439_3_ - p_78439_1_) * f7 - f5;
|
||||||
|
f9 = f7 + 1.0F / (float) p_78439_5_;
|
||||||
|
tes.addVertexWithUV(
|
||||||
|
(double) f9,
|
||||||
|
1.0D,
|
||||||
|
(double) (0.0F - p_78439_7_),
|
||||||
|
(double) f8,
|
||||||
|
(double) p_78439_2_
|
||||||
|
);
|
||||||
|
tes.addVertexWithUV(
|
||||||
|
(double) f9, 1.0D, 0.0D, (double) f8, (double) p_78439_2_
|
||||||
|
);
|
||||||
|
tes.addVertexWithUV(
|
||||||
|
(double) f9, 0.0D, 0.0D, (double) f8, (double) p_78439_4_
|
||||||
|
);
|
||||||
|
tes.addVertexWithUV(
|
||||||
|
(double) f9,
|
||||||
|
0.0D,
|
||||||
|
(double) (0.0F - p_78439_7_),
|
||||||
|
(double) f8,
|
||||||
|
(double) p_78439_4_
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
tes.draw();
|
||||||
|
tes.startDrawingQuads();
|
||||||
|
tes.setBrightness(brightness);
|
||||||
|
tes.setNormal(0.0F, 1.0F, 0.0F);
|
||||||
|
|
||||||
|
for (k = 0; k < p_78439_6_; ++k) {
|
||||||
|
f7 = (float) k / (float) p_78439_6_;
|
||||||
|
f8 = p_78439_4_ + (p_78439_2_ - p_78439_4_) * f7 - f6;
|
||||||
|
f9 = f7 + 1.0F / (float) p_78439_6_;
|
||||||
|
tes.addVertexWithUV(
|
||||||
|
0.0D, (double) f9, 0.0D, (double) p_78439_1_, (double) f8
|
||||||
|
);
|
||||||
|
tes.addVertexWithUV(
|
||||||
|
1.0D, (double) f9, 0.0D, (double) p_78439_3_, (double) f8
|
||||||
|
);
|
||||||
|
tes.addVertexWithUV(
|
||||||
|
1.0D,
|
||||||
|
(double) f9,
|
||||||
|
(double) (0.0F - p_78439_7_),
|
||||||
|
(double) p_78439_3_,
|
||||||
|
(double) f8
|
||||||
|
);
|
||||||
|
tes.addVertexWithUV(
|
||||||
|
0.0D,
|
||||||
|
(double) f9,
|
||||||
|
(double) (0.0F - p_78439_7_),
|
||||||
|
(double) p_78439_1_,
|
||||||
|
(double) f8
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
tes.draw();
|
||||||
|
tes.startDrawingQuads();
|
||||||
|
tes.setBrightness(brightness);
|
||||||
|
tes.setNormal(0.0F, -1.0F, 0.0F);
|
||||||
|
|
||||||
|
for (k = 0; k < p_78439_6_; ++k) {
|
||||||
|
f7 = (float) k / (float) p_78439_6_;
|
||||||
|
f8 = p_78439_4_ + (p_78439_2_ - p_78439_4_) * f7 - f6;
|
||||||
|
tes.addVertexWithUV(
|
||||||
|
1.0D, (double) f7, 0.0D, (double) p_78439_3_, (double) f8
|
||||||
|
);
|
||||||
|
tes.addVertexWithUV(
|
||||||
|
0.0D, (double) f7, 0.0D, (double) p_78439_1_, (double) f8
|
||||||
|
);
|
||||||
|
tes.addVertexWithUV(
|
||||||
|
0.0D,
|
||||||
|
(double) f7,
|
||||||
|
(double) (0.0F - p_78439_7_),
|
||||||
|
(double) p_78439_1_,
|
||||||
|
(double) f8
|
||||||
|
);
|
||||||
|
tes.addVertexWithUV(
|
||||||
|
1.0D,
|
||||||
|
(double) f7,
|
||||||
|
(double) (0.0F - p_78439_7_),
|
||||||
|
(double) p_78439_3_,
|
||||||
|
(double) f8
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
tes.draw();
|
||||||
|
}
|
||||||
|
}
|
|
@ -2,6 +2,7 @@ package net.anvilcraft.classiccasting;
|
||||||
|
|
||||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||||
import cpw.mods.fml.common.registry.LanguageRegistry;
|
import cpw.mods.fml.common.registry.LanguageRegistry;
|
||||||
|
import dev.tilera.auracore.api.IWand;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
@ -42,8 +43,7 @@ public class WandManager {
|
||||||
) {
|
) {
|
||||||
final int discount = 100 - Math.min(50, getTotalVisDiscount(player));
|
final int discount = 100 - Math.min(50, getTotalVisDiscount(player));
|
||||||
amount = Math.round(amount * (discount / 100.0f));
|
amount = Math.round(amount * (discount / 100.0f));
|
||||||
if (itemstack.hasTagCompound() && itemstack.stackTagCompound.hasKey("vis")) {
|
final int charge = ((IWand) itemstack.getItem()).getVis(itemstack);
|
||||||
final int charge = itemstack.stackTagCompound.getShort("vis");
|
|
||||||
if (world.isRemote) {
|
if (world.isRemote) {
|
||||||
if (charge >= amount) {
|
if (charge >= amount) {
|
||||||
player.swingItem();
|
player.swingItem();
|
||||||
|
@ -51,45 +51,29 @@ public class WandManager {
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
if (charge >= amount) {
|
if (player.capabilities.isCreativeMode
|
||||||
if (!player.capabilities.isCreativeMode) {
|
|| ((IWand) itemstack.getItem()).consumeVis(itemstack, amount)) {
|
||||||
itemstack.setTagInfo(
|
world.playSoundAtEntity((Entity) player, "thaumcraft:wand", 0.5f, 1.0f);
|
||||||
"vis", new NBTTagShort((short) (charge - amount))
|
|
||||||
);
|
|
||||||
}
|
|
||||||
world.playSoundAtEntity(
|
|
||||||
(Entity) player, "thaumcraft:wand", 0.5f, 1.0f
|
|
||||||
);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (amount > 0) {
|
|
||||||
player.addChatMessage(new ChatComponentText(
|
player.addChatMessage(new ChatComponentText(
|
||||||
LanguageRegistry.instance().getStringLocalization(
|
LanguageRegistry.instance().getStringLocalization("tc.wandnocharge")
|
||||||
"tc.wandnocharge"
|
|
||||||
)
|
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean hasCharge(ItemStack is, EntityPlayer pl, int c) {
|
||||||
|
final int discount = 100 - Math.min(50, getTotalVisDiscount(pl));
|
||||||
|
c = Math.round(c * (discount / 100.0f));
|
||||||
|
return ((IWand) is.getItem()).getVis(is) >= c;
|
||||||
|
}
|
||||||
|
|
||||||
public static boolean
|
public static boolean
|
||||||
spendCharge(final ItemStack itemstack, final EntityPlayer player, int amount) {
|
spendCharge(final ItemStack itemstack, final EntityPlayer player, int amount) {
|
||||||
final int discount = 100 - Math.min(50, getTotalVisDiscount(player));
|
final int discount = 100 - Math.min(50, getTotalVisDiscount(player));
|
||||||
amount = Math.round(amount * (discount / 100.0f));
|
amount = Math.round(amount * (discount / 100.0f));
|
||||||
if (itemstack.hasTagCompound() && itemstack.stackTagCompound.hasKey("vis")) {
|
return ((IWand) itemstack.getItem()).consumeVis(itemstack, amount);
|
||||||
final int charge = itemstack.stackTagCompound.getShort("vis");
|
|
||||||
if (charge >= amount) {
|
|
||||||
if (!player.capabilities.isCreativeMode) {
|
|
||||||
itemstack.setTagInfo(
|
|
||||||
"vis", new NBTTagShort((short) (charge - amount))
|
|
||||||
);
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean
|
public static boolean
|
||||||
|
@ -226,4 +210,61 @@ public class WandManager {
|
||||||
}
|
}
|
||||||
return fencefound;
|
return fencefound;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean createInfusionWorkbench(
|
||||||
|
final ItemStack itemstack,
|
||||||
|
final EntityPlayer player,
|
||||||
|
final World world,
|
||||||
|
final int x,
|
||||||
|
final int y,
|
||||||
|
final int z
|
||||||
|
) {
|
||||||
|
for (int xx = x - 1; xx <= x; ++xx) {
|
||||||
|
int zz = z - 1;
|
||||||
|
while (zz <= z) {
|
||||||
|
if (fitInfusionWorkbench(world, xx, y, zz)
|
||||||
|
&& spendCharge(world, itemstack, player, 25)) {
|
||||||
|
if (!world.isRemote) {
|
||||||
|
world.setBlock(xx, y, zz, CCBlocks.infusionWorkbench, 1, 0);
|
||||||
|
world.setBlock(xx + 1, y, zz, CCBlocks.infusionWorkbench, 2, 0);
|
||||||
|
world.setBlock(xx, y, zz + 1, CCBlocks.infusionWorkbench, 3, 0);
|
||||||
|
world.setBlock(
|
||||||
|
xx + 1, y, zz + 1, CCBlocks.infusionWorkbench, 4, 0
|
||||||
|
);
|
||||||
|
world.addBlockEvent(xx, y, zz, CCBlocks.infusionWorkbench, 1, 0);
|
||||||
|
world.addBlockEvent(
|
||||||
|
xx + 1, y, zz, CCBlocks.infusionWorkbench, 1, 0
|
||||||
|
);
|
||||||
|
world.addBlockEvent(
|
||||||
|
xx, y, zz + 1, CCBlocks.infusionWorkbench, 1, 0
|
||||||
|
);
|
||||||
|
world.addBlockEvent(
|
||||||
|
xx + 1, y, zz + 1, CCBlocks.infusionWorkbench, 1, 0
|
||||||
|
);
|
||||||
|
world.markBlockForUpdate(xx, y, zz);
|
||||||
|
world.markBlockForUpdate(xx + 1, y, zz);
|
||||||
|
world.markBlockForUpdate(xx, y, zz + 1);
|
||||||
|
world.markBlockForUpdate(xx + 1, y, zz + 1);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
++zz;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean
|
||||||
|
fitInfusionWorkbench(final World world, final int x, final int y, final int z) {
|
||||||
|
return world.getBlock(x, y, z) == CCBlocks.infusionWorkbench
|
||||||
|
&& world.getBlockMetadata(x, y, z) == 0
|
||||||
|
&& world.getBlock(x + 1, y, z) == CCBlocks.infusionWorkbench
|
||||||
|
&& world.getBlockMetadata(x + 1, y, z) == 0
|
||||||
|
&& world.getBlock(x, y, z + 1) == CCBlocks.infusionWorkbench
|
||||||
|
&& world.getBlockMetadata(x, y, z + 1) == 0
|
||||||
|
&& world.getBlock(x + 1, y, z + 1) == CCBlocks.infusionWorkbench
|
||||||
|
&& world.getBlockMetadata(x + 1, y, z + 1) == 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,35 +4,44 @@ import java.util.List;
|
||||||
|
|
||||||
import dev.tilera.auracore.aura.AuraManager;
|
import dev.tilera.auracore.aura.AuraManager;
|
||||||
import net.anvilcraft.classiccasting.ClassicCastingTab;
|
import net.anvilcraft.classiccasting.ClassicCastingTab;
|
||||||
|
import net.anvilcraft.classiccasting.render.BlockAlembicRenderer;
|
||||||
import net.anvilcraft.classiccasting.tiles.TileAlembic;
|
import net.anvilcraft.classiccasting.tiles.TileAlembic;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.BlockContainer;
|
import net.minecraft.block.BlockContainer;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
|
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.AxisAlignedBB;
|
import net.minecraft.util.AxisAlignedBB;
|
||||||
|
import net.minecraft.util.IIcon;
|
||||||
import net.minecraft.world.IBlockAccess;
|
import net.minecraft.world.IBlockAccess;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
import thaumcraft.api.aspects.AspectList;
|
import thaumcraft.api.aspects.AspectList;
|
||||||
|
import thaumcraft.common.lib.CustomSoundType;
|
||||||
import thaumcraft.common.tiles.TileCrucible;
|
import thaumcraft.common.tiles.TileCrucible;
|
||||||
|
|
||||||
public class BlockAlembic extends BlockContainer {
|
public class BlockAlembic extends BlockContainer {
|
||||||
|
public IIcon iconGlow;
|
||||||
|
|
||||||
public BlockAlembic() {
|
public BlockAlembic() {
|
||||||
super(Material.iron);
|
super(Material.iron);
|
||||||
this.setHardness(3.0f);
|
this.setHardness(3.0f);
|
||||||
this.setResistance(17.0f);
|
this.setResistance(17.0f);
|
||||||
this.setStepSound(Block.soundTypeMetal);
|
this.setStepSound(new CustomSoundType("jar", 1.0f, 1.0f));
|
||||||
this.setBlockName("classiccasting:alembic");
|
this.setBlockName("classiccasting:alembic");
|
||||||
this.setBlockBounds(0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f);
|
this.setBlockBounds(0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f);
|
||||||
this.setCreativeTab(ClassicCastingTab.INSTANCE);
|
this.setCreativeTab(ClassicCastingTab.INSTANCE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void registerBlockIcons(IIconRegister ir) {
|
||||||
|
this.iconGlow = ir.registerIcon("thaumcraft:animatedglow");
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getRenderType() {
|
public int getRenderType() {
|
||||||
// TODO: WTF
|
return BlockAlembicRenderer.RI;
|
||||||
//return Config.blockCrucibleRI;
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -122,7 +131,7 @@ public class BlockAlembic extends BlockContainer {
|
||||||
par2 + 0.5f,
|
par2 + 0.5f,
|
||||||
par3 + 0.5f,
|
par3 + 0.5f,
|
||||||
par4 + 0.5f,
|
par4 + 0.5f,
|
||||||
new AspectList().add(((TileAlembic) te).tag, ((TileAlembic) te).amount)
|
new AspectList().add(((TileAlembic) te).aspect, ((TileAlembic) te).amount)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
super.breakBlock(par1World, par2, par3, par4, par5, par6);
|
super.breakBlock(par1World, par2, par3, par4, par5, par6);
|
||||||
|
|
|
@ -5,6 +5,10 @@ import java.util.Random;
|
||||||
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
import net.anvilcraft.classiccasting.ClassicCasting;
|
||||||
|
import net.anvilcraft.classiccasting.ClassicCastingTab;
|
||||||
|
import net.anvilcraft.classiccasting.GuiType;
|
||||||
|
import net.anvilcraft.classiccasting.render.BlockInfusionWorkbenchRenderer;
|
||||||
import net.anvilcraft.classiccasting.tiles.TileInfusionWorkbench;
|
import net.anvilcraft.classiccasting.tiles.TileInfusionWorkbench;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.BlockContainer;
|
import net.minecraft.block.BlockContainer;
|
||||||
|
@ -25,6 +29,7 @@ import net.minecraft.world.World;
|
||||||
import thaumcraft.common.Thaumcraft;
|
import thaumcraft.common.Thaumcraft;
|
||||||
|
|
||||||
public class BlockInfusionWorkbench extends BlockContainer {
|
public class BlockInfusionWorkbench extends BlockContainer {
|
||||||
|
public IIcon iconGlow;
|
||||||
public IIcon[] icon;
|
public IIcon[] icon;
|
||||||
|
|
||||||
public BlockInfusionWorkbench() {
|
public BlockInfusionWorkbench() {
|
||||||
|
@ -33,16 +38,18 @@ public class BlockInfusionWorkbench extends BlockContainer {
|
||||||
this.setHardness(4.0f);
|
this.setHardness(4.0f);
|
||||||
this.setResistance(100.0f);
|
this.setResistance(100.0f);
|
||||||
this.setStepSound(BlockInfusionWorkbench.soundTypeStone);
|
this.setStepSound(BlockInfusionWorkbench.soundTypeStone);
|
||||||
this.setBlockName("blockInfusionWorkbench");
|
this.setBlockName("classiccasting:infusionWorkbench");
|
||||||
|
this.setCreativeTab(ClassicCastingTab.INSTANCE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void registerBlockIcons(final IIconRegister ir) {
|
public void registerBlockIcons(final IIconRegister ir) {
|
||||||
this.icon[0] = ir.registerIcon("thaumcraft:infusionbase");
|
this.icon[0] = ir.registerIcon("classiccasting:infusionbase");
|
||||||
for (int a = 1; a <= 6; ++a) {
|
for (int a = 1; a <= 6; ++a) {
|
||||||
this.icon[a] = ir.registerIcon("thaumcraft:infusion" + a);
|
this.icon[a] = ir.registerIcon("classiccasting:infusion" + a);
|
||||||
}
|
}
|
||||||
|
this.iconGlow = ir.registerIcon("classiccasting:animatedglow");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -158,9 +165,7 @@ public class BlockInfusionWorkbench extends BlockContainer {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getRenderType() {
|
public int getRenderType() {
|
||||||
// TODO: WTF
|
return BlockInfusionWorkbenchRenderer.RI;
|
||||||
//return Config.blockInfusionWorkbenchRI;
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -311,7 +316,14 @@ public class BlockInfusionWorkbench extends BlockContainer {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (tileEntity != null && tileEntity instanceof TileInfusionWorkbench) {
|
if (tileEntity != null && tileEntity instanceof TileInfusionWorkbench) {
|
||||||
player.openGui((Object) Thaumcraft.instance, 14, world, x, y, z);
|
player.openGui(
|
||||||
|
ClassicCasting.INSTANCE,
|
||||||
|
GuiType.INFUSION_WORKBENCH.ordinal(),
|
||||||
|
world,
|
||||||
|
x,
|
||||||
|
y,
|
||||||
|
z
|
||||||
|
);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
switch (md) {
|
switch (md) {
|
||||||
|
@ -319,6 +331,14 @@ public class BlockInfusionWorkbench extends BlockContainer {
|
||||||
tileEntity = world.getTileEntity(x - 1, y, z);
|
tileEntity = world.getTileEntity(x - 1, y, z);
|
||||||
if (tileEntity != null && tileEntity instanceof TileInfusionWorkbench) {
|
if (tileEntity != null && tileEntity instanceof TileInfusionWorkbench) {
|
||||||
player.openGui((Object) Thaumcraft.instance, 14, world, x - 1, y, z);
|
player.openGui((Object) Thaumcraft.instance, 14, world, x - 1, y, z);
|
||||||
|
player.openGui(
|
||||||
|
ClassicCasting.INSTANCE,
|
||||||
|
GuiType.INFUSION_WORKBENCH.ordinal(),
|
||||||
|
world,
|
||||||
|
x - 1,
|
||||||
|
y,
|
||||||
|
z
|
||||||
|
);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -326,7 +346,14 @@ public class BlockInfusionWorkbench extends BlockContainer {
|
||||||
case 3: {
|
case 3: {
|
||||||
tileEntity = world.getTileEntity(x, y, z - 1);
|
tileEntity = world.getTileEntity(x, y, z - 1);
|
||||||
if (tileEntity != null && tileEntity instanceof TileInfusionWorkbench) {
|
if (tileEntity != null && tileEntity instanceof TileInfusionWorkbench) {
|
||||||
player.openGui((Object) Thaumcraft.instance, 14, world, x, y, z - 1);
|
player.openGui(
|
||||||
|
ClassicCasting.INSTANCE,
|
||||||
|
GuiType.INFUSION_WORKBENCH.ordinal(),
|
||||||
|
world,
|
||||||
|
x,
|
||||||
|
y,
|
||||||
|
z - 1
|
||||||
|
);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -335,7 +362,12 @@ public class BlockInfusionWorkbench extends BlockContainer {
|
||||||
tileEntity = world.getTileEntity(x - 1, y, z - 1);
|
tileEntity = world.getTileEntity(x - 1, y, z - 1);
|
||||||
if (tileEntity != null && tileEntity instanceof TileInfusionWorkbench) {
|
if (tileEntity != null && tileEntity instanceof TileInfusionWorkbench) {
|
||||||
player.openGui(
|
player.openGui(
|
||||||
(Object) Thaumcraft.instance, 14, world, x - 1, y, z - 1
|
ClassicCasting.INSTANCE,
|
||||||
|
GuiType.INFUSION_WORKBENCH.ordinal(),
|
||||||
|
world,
|
||||||
|
x - 1,
|
||||||
|
y,
|
||||||
|
z - 1
|
||||||
);
|
);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,186 @@
|
||||||
|
package net.anvilcraft.classiccasting.container;
|
||||||
|
|
||||||
|
import dev.tilera.auracore.api.crafting.IInfusionRecipe;
|
||||||
|
import net.anvilcraft.classiccasting.WandManager;
|
||||||
|
import net.anvilcraft.classiccasting.recipes.InfusionCraftingManager;
|
||||||
|
import net.anvilcraft.classiccasting.tiles.TileInfusionWorkbench;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.entity.player.InventoryPlayer;
|
||||||
|
import net.minecraft.inventory.Container;
|
||||||
|
import net.minecraft.inventory.IInventory;
|
||||||
|
import net.minecraft.inventory.InventoryCrafting;
|
||||||
|
import net.minecraft.inventory.Slot;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.item.crafting.CraftingManager;
|
||||||
|
import thaumcraft.api.aspects.AspectList;
|
||||||
|
import thaumcraft.common.container.ContainerDummy;
|
||||||
|
import thaumcraft.common.items.wands.ItemWandCasting;
|
||||||
|
|
||||||
|
public class ContainerInfusionWorkbench extends Container {
|
||||||
|
private TileInfusionWorkbench tileEntity;
|
||||||
|
private InventoryPlayer ip;
|
||||||
|
|
||||||
|
public ContainerInfusionWorkbench(
|
||||||
|
final InventoryPlayer par1InventoryPlayer, final TileInfusionWorkbench e
|
||||||
|
) {
|
||||||
|
this.tileEntity = e;
|
||||||
|
this.tileEntity.eventHandler = this;
|
||||||
|
this.ip = par1InventoryPlayer;
|
||||||
|
this.addSlotToContainer((Slot) new SlotCraftingInfusionWorkbench(
|
||||||
|
par1InventoryPlayer.player,
|
||||||
|
(IInventory) this.tileEntity,
|
||||||
|
(IInventory) this.tileEntity,
|
||||||
|
9,
|
||||||
|
132,
|
||||||
|
28
|
||||||
|
));
|
||||||
|
this.addSlotToContainer((Slot
|
||||||
|
) new SlotWand((IInventory) this.tileEntity, 10, 132, 61));
|
||||||
|
for (int var6 = 0; var6 < 3; ++var6) {
|
||||||
|
for (int var7 = 0; var7 < 3; ++var7) {
|
||||||
|
this.addSlotToContainer(new Slot(
|
||||||
|
(IInventory) this.tileEntity,
|
||||||
|
var7 + var6 * 3,
|
||||||
|
36 + var7 * 20,
|
||||||
|
8 + var6 * 20
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (int var6 = 0; var6 < 3; ++var6) {
|
||||||
|
for (int var7 = 0; var7 < 9; ++var7) {
|
||||||
|
this.addSlotToContainer(new Slot(
|
||||||
|
(IInventory) par1InventoryPlayer,
|
||||||
|
var7 + var6 * 9 + 9,
|
||||||
|
8 + var7 * 18,
|
||||||
|
106 + var6 * 18
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (int var6 = 0; var6 < 9; ++var6) {
|
||||||
|
this.addSlotToContainer(
|
||||||
|
new Slot((IInventory) par1InventoryPlayer, var6, 8 + var6 * 18, 164)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
this.onCraftMatrixChanged((IInventory) this.tileEntity);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onCraftMatrixChanged(final IInventory par1IInventory) {
|
||||||
|
this.tileEntity.dispTags = new AspectList();
|
||||||
|
final InventoryCrafting ic
|
||||||
|
= new InventoryCrafting((Container) new ContainerDummy(), 3, 3);
|
||||||
|
for (int a = 0; a < 9; ++a) {
|
||||||
|
ic.setInventorySlotContents(a, this.tileEntity.getStackInSlot(a));
|
||||||
|
}
|
||||||
|
this.tileEntity.setInventorySlotContentsSoftly(
|
||||||
|
9,
|
||||||
|
CraftingManager.getInstance().findMatchingRecipe(
|
||||||
|
ic, this.tileEntity.getWorldObj()
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
// TODO: need arcane crafting stuff for this
|
||||||
|
//if (this.tileEntity.getStackInSlot(9) == null
|
||||||
|
// && this.tileEntity.getStackInSlot(10) != null
|
||||||
|
// && this.tileEntity.getStackInSlot(10).getItem() instanceof ItemWandCasting
|
||||||
|
// && WandManager.hasCharge(
|
||||||
|
// this.tileEntity.getStackInSlot(10),
|
||||||
|
// this.ip.player,
|
||||||
|
// ThaumcraftCraftingManager.findMatchingArcaneRecipeCost(
|
||||||
|
// (IInventory) this.tileEntity, this.ip.player
|
||||||
|
// )
|
||||||
|
// )) {
|
||||||
|
// this.tileEntity.setInventorySlotContentsSoftly(
|
||||||
|
// 9,
|
||||||
|
// ThaumcraftCraftingManager.findMatchingArcaneRecipe(
|
||||||
|
// (IInventory) this.tileEntity, this.ip.player
|
||||||
|
// )
|
||||||
|
// );
|
||||||
|
//}
|
||||||
|
|
||||||
|
if (this.tileEntity.getStackInSlot(9) == null
|
||||||
|
&& this.tileEntity.getStackInSlot(10) != null) {
|
||||||
|
IInfusionRecipe rec
|
||||||
|
= InfusionCraftingManager.INSTANCE.findMatchingInfusionRecipe(
|
||||||
|
this.tileEntity, this.ip.player
|
||||||
|
);
|
||||||
|
|
||||||
|
if (rec != null
|
||||||
|
&& WandManager.hasCharge(
|
||||||
|
this.tileEntity.getStackInSlot(10), this.ip.player, rec.getCost()
|
||||||
|
)
|
||||||
|
&& this.tileEntity.doSourcesMatch(rec.getAspects())) {
|
||||||
|
this.tileEntity.setInventorySlotContentsSoftly(9, rec.getRecipeOutput());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onContainerClosed(final EntityPlayer par1EntityPlayer) {
|
||||||
|
super.onContainerClosed(par1EntityPlayer);
|
||||||
|
if (!this.tileEntity.getWorldObj().isRemote) {
|
||||||
|
this.tileEntity.eventHandler = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean canInteractWith(final EntityPlayer par1EntityPlayer) {
|
||||||
|
return this.tileEntity.getWorldObj().getTileEntity(
|
||||||
|
this.tileEntity.xCoord, this.tileEntity.yCoord, this.tileEntity.zCoord
|
||||||
|
)
|
||||||
|
== this.tileEntity
|
||||||
|
&& par1EntityPlayer.getDistanceSq(
|
||||||
|
this.tileEntity.xCoord + 0.5,
|
||||||
|
this.tileEntity.yCoord + 0.5,
|
||||||
|
this.tileEntity.zCoord + 0.5
|
||||||
|
)
|
||||||
|
<= 64.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ItemStack
|
||||||
|
transferStackInSlot(final EntityPlayer par1EntityPlayer, final int par1) {
|
||||||
|
ItemStack var2 = null;
|
||||||
|
final Slot var3 = (Slot) super.inventorySlots.get(par1);
|
||||||
|
if (var3 != null && var3.getHasStack()) {
|
||||||
|
final ItemStack var4 = var3.getStack();
|
||||||
|
var2 = var4.copy();
|
||||||
|
if (par1 == 0) {
|
||||||
|
if (!this.mergeItemStack(var4, 11, 47, true)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
var3.onSlotChange(var4, var2);
|
||||||
|
} else if (par1 >= 11 && par1 < 38) {
|
||||||
|
if (var4.getItem() instanceof ItemWandCasting) {
|
||||||
|
if (!this.mergeItemStack(var4, 1, 2, false)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
var3.onSlotChange(var4, var2);
|
||||||
|
} else if (!this.mergeItemStack(var4, 38, 47, false)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
} else if (par1 >= 38 && par1 < 47) {
|
||||||
|
if (!this.mergeItemStack(var4, 11, 38, false)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
} else if (!this.mergeItemStack(var4, 11, 47, false)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if (var4.stackSize == 0) {
|
||||||
|
var3.putStack((ItemStack) null);
|
||||||
|
} else {
|
||||||
|
var3.onSlotChanged();
|
||||||
|
}
|
||||||
|
if (var4.stackSize == var2.stackSize) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
var3.onPickupFromSlot(this.ip.player, var4);
|
||||||
|
}
|
||||||
|
return var2;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ItemStack slotClick(
|
||||||
|
final int par1,
|
||||||
|
final int par2,
|
||||||
|
final int par3,
|
||||||
|
final EntityPlayer par4EntityPlayer
|
||||||
|
) {
|
||||||
|
return super.slotClick(par1, par2, par3, par4EntityPlayer);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,96 @@
|
||||||
|
package net.anvilcraft.classiccasting.container;
|
||||||
|
|
||||||
|
import cpw.mods.fml.common.FMLCommonHandler;
|
||||||
|
import dev.tilera.auracore.api.crafting.IInfusionRecipe;
|
||||||
|
import net.anvilcraft.classiccasting.WandManager;
|
||||||
|
import net.anvilcraft.classiccasting.recipes.InfusionCraftingManager;
|
||||||
|
import net.anvilcraft.classiccasting.tiles.TileInfusionWorkbench;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.inventory.IInventory;
|
||||||
|
import net.minecraft.inventory.SlotCrafting;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
|
import net.minecraftforge.event.entity.player.PlayerDestroyItemEvent;
|
||||||
|
import thaumcraft.api.aspects.Aspect;
|
||||||
|
import thaumcraft.api.aspects.AspectList;
|
||||||
|
import thaumcraft.api.aspects.IAspectSource;
|
||||||
|
|
||||||
|
public class SlotCraftingInfusionWorkbench extends SlotCrafting {
|
||||||
|
private final IInventory craftMatrix;
|
||||||
|
private EntityPlayer thePlayer;
|
||||||
|
|
||||||
|
public SlotCraftingInfusionWorkbench(
|
||||||
|
final EntityPlayer par1EntityPlayer,
|
||||||
|
final IInventory par2IInventory,
|
||||||
|
final IInventory par3IInventory,
|
||||||
|
final int par4,
|
||||||
|
final int par5,
|
||||||
|
final int par6
|
||||||
|
) {
|
||||||
|
super(par1EntityPlayer, par2IInventory, par3IInventory, par4, par5, par6);
|
||||||
|
this.thePlayer = par1EntityPlayer;
|
||||||
|
this.craftMatrix = par2IInventory;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void
|
||||||
|
onPickupFromSlot(final EntityPlayer par1EntityPlayer, final ItemStack par1ItemStack) {
|
||||||
|
FMLCommonHandler.instance().firePlayerCraftingEvent(
|
||||||
|
this.thePlayer, par1ItemStack, this.craftMatrix
|
||||||
|
);
|
||||||
|
this.onCrafting(par1ItemStack);
|
||||||
|
int cost;
|
||||||
|
//int cost = ThaumcraftCraftingManager.findMatchingArcaneRecipeCost(
|
||||||
|
// this.craftMatrix, this.thePlayer
|
||||||
|
//);
|
||||||
|
//if (cost == 0) {
|
||||||
|
IInfusionRecipe rec = InfusionCraftingManager.INSTANCE.findMatchingInfusionRecipe(
|
||||||
|
this.craftMatrix, this.thePlayer
|
||||||
|
);
|
||||||
|
if (rec != null) {
|
||||||
|
cost = rec.getCost();
|
||||||
|
final AspectList tags = rec.getAspects();
|
||||||
|
if (tags != null && tags.size() > 0) {
|
||||||
|
final TileInfusionWorkbench tiwb
|
||||||
|
= (TileInfusionWorkbench) this.craftMatrix;
|
||||||
|
for (final Aspect tag : tags.getAspects()) {
|
||||||
|
final IAspectSource as = tiwb.foundAspects.getSource(tag);
|
||||||
|
if (as != null) {
|
||||||
|
as.takeFromContainer(tag, tags.getAmount(tag));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//}
|
||||||
|
if (cost > 0) {
|
||||||
|
WandManager.spendCharge(
|
||||||
|
this.craftMatrix.getStackInSlot(10), par1EntityPlayer, cost
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (int var2 = 0; var2 < 9; ++var2) {
|
||||||
|
final ItemStack var3 = this.craftMatrix.getStackInSlot(var2);
|
||||||
|
if (var3 != null) {
|
||||||
|
this.craftMatrix.decrStackSize(var2, 1);
|
||||||
|
if (var3.getItem().hasContainerItem(var3)) {
|
||||||
|
ItemStack var4 = var3.getItem().getContainerItem(var3);
|
||||||
|
if (var4.isItemStackDamageable()
|
||||||
|
&& var4.getItemDamage() > var4.getMaxDamage()) {
|
||||||
|
MinecraftForge.EVENT_BUS.post(
|
||||||
|
new PlayerDestroyItemEvent(this.thePlayer, var4)
|
||||||
|
);
|
||||||
|
var4 = null;
|
||||||
|
}
|
||||||
|
if (var4 != null
|
||||||
|
&& (!var3.getItem().doesContainerItemLeaveCraftingGrid(var3)
|
||||||
|
|| !this.thePlayer.inventory.addItemStackToInventory(var4))) {
|
||||||
|
if (this.craftMatrix.getStackInSlot(var2) == null) {
|
||||||
|
this.craftMatrix.setInventorySlotContents(var2, var4);
|
||||||
|
} else {
|
||||||
|
this.thePlayer.entityDropItem(var4, 1.5f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,31 @@
|
||||||
|
package net.anvilcraft.classiccasting.container;
|
||||||
|
|
||||||
|
import dev.tilera.auracore.api.IWand;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.inventory.IInventory;
|
||||||
|
import net.minecraft.inventory.Slot;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
|
public class SlotWand extends Slot {
|
||||||
|
public SlotWand(IInventory par2IInventory, int par3, int par4, int par5) {
|
||||||
|
super(par2IInventory, par3, par4, par5);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isItemValid(ItemStack stack) {
|
||||||
|
return stack != null && stack.getItem() != null
|
||||||
|
&& stack.getItem() instanceof IWand
|
||||||
|
// This is so vanilla thaumcraft wands don't work.
|
||||||
|
&& ((IWand) stack.getItem()).getMaxVis(stack) > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getSlotStackLimit() {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPickupFromSlot(EntityPlayer par1EntityPlayer, ItemStack par2ItemStack) {
|
||||||
|
super.onPickupFromSlot(par1EntityPlayer, par2ItemStack);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,204 @@
|
||||||
|
package net.anvilcraft.classiccasting.gui;
|
||||||
|
|
||||||
|
import cpw.mods.fml.relauncher.Side;
|
||||||
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
import dev.tilera.auracore.api.IWand;
|
||||||
|
import dev.tilera.auracore.api.crafting.IInfusionRecipe;
|
||||||
|
import net.anvilcraft.classiccasting.WandManager;
|
||||||
|
import net.anvilcraft.classiccasting.container.ContainerInfusionWorkbench;
|
||||||
|
import net.anvilcraft.classiccasting.recipes.InfusionCraftingManager;
|
||||||
|
import net.anvilcraft.classiccasting.tiles.TileInfusionWorkbench;
|
||||||
|
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||||
|
import net.minecraft.client.renderer.RenderHelper;
|
||||||
|
import net.minecraft.client.renderer.entity.RenderItem;
|
||||||
|
import net.minecraft.entity.player.InventoryPlayer;
|
||||||
|
import net.minecraft.inventory.Container;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
import org.lwjgl.opengl.GL11;
|
||||||
|
import thaumcraft.api.aspects.Aspect;
|
||||||
|
import thaumcraft.api.aspects.AspectList;
|
||||||
|
import thaumcraft.client.lib.UtilsFX;
|
||||||
|
import thaumcraft.codechicken.lib.math.MathHelper;
|
||||||
|
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public class GuiInfusionWorkbench extends GuiContainer {
|
||||||
|
private TileInfusionWorkbench tileEntity;
|
||||||
|
private InventoryPlayer ip;
|
||||||
|
|
||||||
|
public GuiInfusionWorkbench(
|
||||||
|
final InventoryPlayer par1InventoryPlayer, final TileInfusionWorkbench e
|
||||||
|
) {
|
||||||
|
super((Container) new ContainerInfusionWorkbench(par1InventoryPlayer, e));
|
||||||
|
this.tileEntity = e;
|
||||||
|
this.ip = par1InventoryPlayer;
|
||||||
|
this.ySize += 21;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void drawGuiContainerForegroundLayer(final int par1, final int par2) {}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawScreen(final int par1, final int par2, final float par3) {
|
||||||
|
super.drawScreen(par1, par2, par3);
|
||||||
|
// TODO: crafting
|
||||||
|
//if (ThaumcraftCraftingManager.findMatchingInfusionRecipe(
|
||||||
|
// (IInventory) this.tileEntity, this.ip.player
|
||||||
|
// )
|
||||||
|
// != null) {
|
||||||
|
// final ObjectTags reqs
|
||||||
|
// = ThaumcraftCraftingManager.findMatchingInfusionRecipeTags(
|
||||||
|
// (IInventory) this.tileEntity, this.ip.player
|
||||||
|
// );
|
||||||
|
// int count = 0;
|
||||||
|
// if (reqs != null && reqs.size() > 0) {
|
||||||
|
// for (final EnumTag tag : reqs.getAspects()) {
|
||||||
|
// mposx = par1 - (var5 + 24 + 16 * count + (5 - reqs.size()) * 8);
|
||||||
|
// mposy = par2 - (var6 + 72);
|
||||||
|
// if (mposx >= 0 && mposy >= 0 && mposx < 16 && mposy < 16) {
|
||||||
|
// UtilsFX.drawCustomTooltip(
|
||||||
|
// (GuiScreen) this,
|
||||||
|
// GuiInfusionWorkbench.field_74196_a,
|
||||||
|
// this.field_73886_k,
|
||||||
|
// Arrays.asList(tag.name, tag.meaning),
|
||||||
|
// par1,
|
||||||
|
// par2,
|
||||||
|
// 11
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
// ++count;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void
|
||||||
|
drawGuiContainerBackgroundLayer(final float par1, final int par2, final int par3) {
|
||||||
|
GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
|
||||||
|
GL11.glEnable(3042);
|
||||||
|
this.mc.renderEngine.bindTexture(new ResourceLocation(
|
||||||
|
"classiccasting", "textures/gui/gui_infusionworkbench.png"
|
||||||
|
));
|
||||||
|
final int var5 = (this.width - this.xSize) / 2;
|
||||||
|
final int var6 = (this.height - this.ySize) / 2;
|
||||||
|
this.drawTexturedModalRect(var5, var6, 0, 0, this.xSize, this.ySize);
|
||||||
|
GL11.glDisable(3042);
|
||||||
|
ItemStack result = null;
|
||||||
|
// TODO: arcane crafting
|
||||||
|
//if (ThaumcraftCraftingManager.findMatchingArcaneRecipe(
|
||||||
|
// (IInventory) this.tileEntity, this.ip.player
|
||||||
|
// )
|
||||||
|
// != null) {
|
||||||
|
// result = ThaumcraftCraftingManager.findMatchingArcaneRecipe(
|
||||||
|
// (IInventory) this.tileEntity, this.ip.player
|
||||||
|
// );
|
||||||
|
//} else
|
||||||
|
IInfusionRecipe rec = InfusionCraftingManager.INSTANCE.findMatchingInfusionRecipe(
|
||||||
|
this.tileEntity, this.ip.player
|
||||||
|
);
|
||||||
|
if (rec != null) {
|
||||||
|
result = rec.getRecipeOutput();
|
||||||
|
final AspectList reqs = rec.getAspects();
|
||||||
|
int count = 0;
|
||||||
|
if (reqs != null && reqs.size() > 0) {
|
||||||
|
for (final Aspect tag : reqs.getAspects()) {
|
||||||
|
float op = 1.0f;
|
||||||
|
if (this.tileEntity.foundAspects.getAmount(tag)
|
||||||
|
< reqs.getAmount(tag)) {
|
||||||
|
op = (float
|
||||||
|
) (MathHelper.sin(this.ip.player.ticksExisted - count * 10)
|
||||||
|
/ 8.0f)
|
||||||
|
* 0.125f
|
||||||
|
+ 0.25f;
|
||||||
|
}
|
||||||
|
UtilsFX.drawTag(
|
||||||
|
var5 + 24 + 16 * count + (5 - reqs.size()) * 8,
|
||||||
|
var6 + 72,
|
||||||
|
tag,
|
||||||
|
reqs.getAmount(tag),
|
||||||
|
0,
|
||||||
|
op
|
||||||
|
);
|
||||||
|
++count;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (this.tileEntity.getStackInSlot(10) != null) {
|
||||||
|
final int charge = ((IWand)this.tileEntity.getStackInSlot(10).getItem()).getVis(this.tileEntity.getStackInSlot(10));
|
||||||
|
if (charge > 0) {
|
||||||
|
GL11.glPushMatrix();
|
||||||
|
GL11.glTranslatef((float) (var5 + 140), (float) (var6 + 85), 505.0f);
|
||||||
|
GL11.glScalef(0.5f, 0.5f, 0.0f);
|
||||||
|
final String text = charge + " vis";
|
||||||
|
final int ll = this.fontRendererObj.getStringWidth(text) / 2;
|
||||||
|
this.fontRendererObj.drawStringWithShadow(text, -ll, -16, 16777215);
|
||||||
|
GL11.glScalef(1.0f, 1.0f, 1.0f);
|
||||||
|
GL11.glPopMatrix();
|
||||||
|
}
|
||||||
|
if (result != null) {
|
||||||
|
final int discount
|
||||||
|
= 100 - Math.min(50, WandManager.getTotalVisDiscount(this.ip.player));
|
||||||
|
//int cost1 = ThaumcraftCraftingManager.findMatchingArcaneRecipeCost(
|
||||||
|
// this.tileEntity, this.ip.player
|
||||||
|
//);
|
||||||
|
//cost1 = Math.round(cost1 * (discount / 100.0f));
|
||||||
|
int cost2 = rec.getCost();
|
||||||
|
cost2 = Math.round(cost2 * (discount / 100.0f));
|
||||||
|
if (/*charge < cost1 ||*/ charge < cost2) {
|
||||||
|
GL11.glPushMatrix();
|
||||||
|
RenderHelper.enableGUIStandardItemLighting();
|
||||||
|
GL11.glDisable(2896);
|
||||||
|
GL11.glEnable(32826);
|
||||||
|
GL11.glEnable(2903);
|
||||||
|
GL11.glEnable(2896);
|
||||||
|
RenderItem.getInstance().renderItemIntoGUI(
|
||||||
|
this.mc.fontRenderer,
|
||||||
|
this.mc.renderEngine,
|
||||||
|
result,
|
||||||
|
var5 + 132,
|
||||||
|
var6 + 28
|
||||||
|
);
|
||||||
|
RenderItem.getInstance().renderItemOverlayIntoGUI(
|
||||||
|
this.mc.fontRenderer,
|
||||||
|
this.mc.renderEngine,
|
||||||
|
result,
|
||||||
|
var5 + 132,
|
||||||
|
var6 + 28
|
||||||
|
);
|
||||||
|
GL11.glDisable(2896);
|
||||||
|
GL11.glDepthMask(true);
|
||||||
|
GL11.glEnable(2929);
|
||||||
|
GL11.glPopMatrix();
|
||||||
|
GL11.glPushMatrix();
|
||||||
|
GL11.glTranslatef((float) (var5 + 140), (float) (var6 + 85), 0.0f);
|
||||||
|
GL11.glScalef(0.5f, 0.5f, 0.0f);
|
||||||
|
String text2 = "Insufficient charge";
|
||||||
|
if (/*cost1 > ((ItemWandCasting) this.tileEntity.getStackInSlot(10)
|
||||||
|
.getItem())
|
||||||
|
.getMaxVis()
|
||||||
|
||*/ cost2 > ((IWand) this.tileEntity.getStackInSlot(10)
|
||||||
|
.getItem())
|
||||||
|
.getMaxVis(this.tileEntity.getStackInSlot(10))) {
|
||||||
|
text2 = "This wand is too weak";
|
||||||
|
}
|
||||||
|
final int ll2 = this.fontRendererObj.getStringWidth(text2) / 2;
|
||||||
|
this.fontRendererObj.drawString(text2, -ll2, 0, 15625838);
|
||||||
|
GL11.glScalef(1.0f, 1.0f, 1.0f);
|
||||||
|
GL11.glPopMatrix();
|
||||||
|
}
|
||||||
|
if (/*cost1 > 0 ||*/ cost2 > 0) {
|
||||||
|
GL11.glPushMatrix();
|
||||||
|
GL11.glTranslatef((float) (var5 + 140), (float) (var6 + 81), 0.0f);
|
||||||
|
GL11.glScalef(0.5f, 0.5f, 0.0f);
|
||||||
|
//final String text2 = Math.max(cost1, cost2) + " vis";
|
||||||
|
final String text2 = cost2 + " vis";
|
||||||
|
final int ll2 = this.fontRendererObj.getStringWidth(text2) / 2;
|
||||||
|
this.fontRendererObj.drawStringWithShadow(text2, -ll2, -64, 15658734);
|
||||||
|
GL11.glScalef(1.0f, 1.0f, 1.0f);
|
||||||
|
GL11.glPopMatrix();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -5,6 +5,7 @@ import java.util.List;
|
||||||
import cpw.mods.fml.common.registry.LanguageRegistry;
|
import cpw.mods.fml.common.registry.LanguageRegistry;
|
||||||
import dev.tilera.auracore.api.IWand;
|
import dev.tilera.auracore.api.IWand;
|
||||||
import dev.tilera.auracore.aura.AuraManager;
|
import dev.tilera.auracore.aura.AuraManager;
|
||||||
|
import net.anvilcraft.classiccasting.CCBlocks;
|
||||||
import net.anvilcraft.classiccasting.ClassicCastingTab;
|
import net.anvilcraft.classiccasting.ClassicCastingTab;
|
||||||
import net.anvilcraft.classiccasting.WandManager;
|
import net.anvilcraft.classiccasting.WandManager;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
|
@ -310,13 +311,11 @@ public abstract class ItemWandCasting extends Item implements IWand {
|
||||||
// result = WandManager.createNodeMagnet(itemstack, player, world, x, y, z);
|
// result = WandManager.createNodeMagnet(itemstack, player, world, x, y, z);
|
||||||
//}
|
//}
|
||||||
|
|
||||||
// TODO: implement infusion workbench
|
if (bi == CCBlocks.infusionWorkbench
|
||||||
//if (bi == ConfigBlocks.blockInfusionWorkbench
|
/*&& ResearchManager.isResearchComplete(player.getDisplayName(), "MAGBLOCK")*/) {
|
||||||
// && ResearchManager.isResearchComplete(player.getDisplayName(), "MAGBLOCK"))
|
result
|
||||||
// { result
|
= WandManager.createInfusionWorkbench(itemstack, player, world, x, y, z);
|
||||||
// = WandManager.createInfusionWorkbench(itemstack, player, world, x, y,
|
}
|
||||||
// z);
|
|
||||||
//}
|
|
||||||
|
|
||||||
// TODO: need alembics for this
|
// TODO: need alembics for this
|
||||||
//if (bi == ConfigBlocks.blockMetalDevice && md >= 1 && md <= 4) {
|
//if (bi == ConfigBlocks.blockMetalDevice && md >= 1 && md <= 4) {
|
||||||
|
|
|
@ -0,0 +1,75 @@
|
||||||
|
package net.anvilcraft.classiccasting.recipes;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import dev.tilera.auracore.api.crafting.IInfusionRecipe;
|
||||||
|
import net.anvilcraft.classiccasting.CCBlocks;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.init.Items;
|
||||||
|
import net.minecraft.inventory.IInventory;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import thaumcraft.api.aspects.Aspect;
|
||||||
|
import thaumcraft.api.aspects.AspectList;
|
||||||
|
|
||||||
|
public class InfusionCraftingManager {
|
||||||
|
public static InfusionCraftingManager INSTANCE = new InfusionCraftingManager();
|
||||||
|
public List<IInfusionRecipe> recipes = new ArrayList<>();
|
||||||
|
|
||||||
|
public InfusionCraftingManager() {
|
||||||
|
this.recipes.add(new IInfusionRecipe() {
|
||||||
|
@Override
|
||||||
|
public boolean matches(IInventory var1, World var2, EntityPlayer var3) {
|
||||||
|
return var1.getStackInSlot(0) != null
|
||||||
|
&& var1.getStackInSlot(0).getItem()
|
||||||
|
== Items.gold_nugget;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ItemStack getCraftingResult(IInventory var1) {
|
||||||
|
return this.getRecipeOutput();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getRecipeSize() {
|
||||||
|
return 9;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ItemStack getRecipeOutput() {
|
||||||
|
return new ItemStack(CCBlocks.alembic);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getCost() {
|
||||||
|
return 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AspectList getAspects() {
|
||||||
|
return new AspectList().add(Aspect.GREED, 8);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getKey() {
|
||||||
|
return "alembus";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getResearch() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public IInfusionRecipe findMatchingInfusionRecipe(IInventory inv, EntityPlayer pl) {
|
||||||
|
for (IInfusionRecipe recipe : this.recipes) {
|
||||||
|
if (recipe.matches(inv, pl.worldObj, pl)) {
|
||||||
|
return recipe;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,73 @@
|
||||||
|
package net.anvilcraft.classiccasting.render;
|
||||||
|
|
||||||
|
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||||
|
import net.anvilcraft.classiccasting.blocks.BlockAlembic;
|
||||||
|
import net.anvilcraft.classiccasting.tiles.TileAlembic;
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.client.renderer.RenderBlocks;
|
||||||
|
import net.minecraft.client.renderer.Tessellator;
|
||||||
|
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
|
||||||
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import net.minecraft.world.IBlockAccess;
|
||||||
|
import org.lwjgl.opengl.GL11;
|
||||||
|
import thaumcraft.client.renderers.block.BlockRenderer;
|
||||||
|
|
||||||
|
public class BlockAlembicRenderer
|
||||||
|
extends BlockRenderer implements ISimpleBlockRenderingHandler {
|
||||||
|
public static int RI;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void renderInventoryBlock(
|
||||||
|
final Block block,
|
||||||
|
final int metadata,
|
||||||
|
final int modelID,
|
||||||
|
final RenderBlocks renderer
|
||||||
|
) {
|
||||||
|
GL11.glRotatef(90.0f, 0.0f, 1.0f, 0.0f);
|
||||||
|
GL11.glTranslatef(-0.3f, -0.75f, -0.5f);
|
||||||
|
TileEntityRendererDispatcher.instance.renderTileEntityAt(
|
||||||
|
(TileEntity) new TileAlembic(), 0.0, 0.0, 0.0, 0.0f
|
||||||
|
);
|
||||||
|
GL11.glEnable(32826);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean renderWorldBlock(
|
||||||
|
final IBlockAccess world,
|
||||||
|
final int x,
|
||||||
|
final int y,
|
||||||
|
final int z,
|
||||||
|
final Block block,
|
||||||
|
final int modelId,
|
||||||
|
final RenderBlocks renderer
|
||||||
|
) {
|
||||||
|
final TileEntity te2 = world.getTileEntity(x, y, z);
|
||||||
|
if (te2 != null && te2 instanceof TileAlembic && ((TileAlembic) te2).amount > 0) {
|
||||||
|
final float level = ((TileAlembic) te2).amount
|
||||||
|
/ (float) ((TileAlembic) te2).maxAmount * 0.5625f;
|
||||||
|
final Tessellator t = Tessellator.instance;
|
||||||
|
t.setColorOpaque_I(((TileAlembic) te2).aspect.getColor());
|
||||||
|
t.setBrightness(200);
|
||||||
|
block.setBlockBounds(0.275f, 0.25f, 0.275f, 0.725f, 0.25f + level, 0.725f);
|
||||||
|
renderer.setRenderBoundsFromBlock(block);
|
||||||
|
BlockRenderer.renderAllSides(
|
||||||
|
world, x, y, z, block, renderer, ((BlockAlembic) block).iconGlow, true
|
||||||
|
);
|
||||||
|
GL11.glColor3f(1.0f, 1.0f, 1.0f);
|
||||||
|
}
|
||||||
|
renderer.clearOverrideBlockTexture();
|
||||||
|
block.setBlockBounds(0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f);
|
||||||
|
renderer.setRenderBoundsFromBlock(block);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean shouldRender3DInInventory(int meta) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getRenderId() {
|
||||||
|
return RI;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,90 @@
|
||||||
|
package net.anvilcraft.classiccasting.render;
|
||||||
|
|
||||||
|
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||||
|
import net.anvilcraft.classiccasting.blocks.BlockInfusionWorkbench;
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.client.renderer.RenderBlocks;
|
||||||
|
import net.minecraft.client.renderer.Tessellator;
|
||||||
|
import net.minecraft.world.IBlockAccess;
|
||||||
|
import org.lwjgl.opengl.GL11;
|
||||||
|
import thaumcraft.client.renderers.block.BlockRenderer;
|
||||||
|
|
||||||
|
public class BlockInfusionWorkbenchRenderer
|
||||||
|
extends BlockRenderer implements ISimpleBlockRenderingHandler {
|
||||||
|
public static int RI;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void renderInventoryBlock(
|
||||||
|
final Block block,
|
||||||
|
final int metadata,
|
||||||
|
final int modelID,
|
||||||
|
final RenderBlocks renderer
|
||||||
|
) {
|
||||||
|
if (metadata == 0) {
|
||||||
|
block.setBlockBounds(0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f);
|
||||||
|
renderer.setRenderBoundsFromBlock(block);
|
||||||
|
BlockRenderer.drawFaces(
|
||||||
|
renderer, block, block.getBlockTextureFromSide(0), false
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean renderWorldBlock(
|
||||||
|
final IBlockAccess world,
|
||||||
|
final int x,
|
||||||
|
final int y,
|
||||||
|
final int z,
|
||||||
|
final Block block,
|
||||||
|
final int modelId,
|
||||||
|
final RenderBlocks renderer
|
||||||
|
) {
|
||||||
|
BlockRenderer.setBrightness(world, x, y, z, block);
|
||||||
|
final int metadata = world.getBlockMetadata(x, y, z);
|
||||||
|
block.setBlockBounds(0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f);
|
||||||
|
renderer.setRenderBoundsFromBlock(block);
|
||||||
|
renderer.renderStandardBlock(block, x, y, z);
|
||||||
|
if (metadata != 0 && metadata != 7) {
|
||||||
|
final Tessellator t = Tessellator.instance;
|
||||||
|
t.setColorOpaque_I(12583104);
|
||||||
|
t.setBrightness(180);
|
||||||
|
BlockRenderer.renderAllSidesInverted(
|
||||||
|
world,
|
||||||
|
x,
|
||||||
|
y,
|
||||||
|
z,
|
||||||
|
block,
|
||||||
|
renderer,
|
||||||
|
((BlockInfusionWorkbench) block).iconGlow,
|
||||||
|
false
|
||||||
|
);
|
||||||
|
block.setBlockBounds(0.02f, 0.02f, 0.02f, 0.98f, 0.98f, 0.98f);
|
||||||
|
renderer.setRenderBoundsFromBlock(block);
|
||||||
|
BlockRenderer.renderAllSides(
|
||||||
|
world,
|
||||||
|
x,
|
||||||
|
y,
|
||||||
|
z,
|
||||||
|
block,
|
||||||
|
renderer,
|
||||||
|
((BlockInfusionWorkbench) block).iconGlow,
|
||||||
|
false
|
||||||
|
);
|
||||||
|
GL11.glColor3f(1.0f, 1.0f, 1.0f);
|
||||||
|
}
|
||||||
|
renderer.clearOverrideBlockTexture();
|
||||||
|
block.setBlockBounds(0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f);
|
||||||
|
renderer.setRenderBoundsFromBlock(block);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean shouldRender3DInInventory(int meta) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getRenderId() {
|
||||||
|
return RI;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,75 @@
|
||||||
|
package net.anvilcraft.classiccasting.render;
|
||||||
|
|
||||||
|
import cpw.mods.fml.relauncher.Side;
|
||||||
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
import net.anvilcraft.classiccasting.CCBlocks;
|
||||||
|
import net.anvilcraft.classiccasting.UtilsFX;
|
||||||
|
import net.anvilcraft.classiccasting.items.wands.ItemWandCasting;
|
||||||
|
import net.anvilcraft.classiccasting.tiles.TileInfusionWorkbench;
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.client.renderer.ItemRenderer;
|
||||||
|
import net.minecraft.client.renderer.RenderHelper;
|
||||||
|
import net.minecraft.client.renderer.entity.RenderItem;
|
||||||
|
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||||
|
import net.minecraft.entity.Entity;
|
||||||
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import net.minecraft.util.MathHelper;
|
||||||
|
import net.minecraft.world.IBlockAccess;
|
||||||
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public class TileInfusionWorkbenchRenderer extends TileEntitySpecialRenderer {
|
||||||
|
public void renderTileEntityAt(
|
||||||
|
final TileInfusionWorkbench table,
|
||||||
|
final double par2,
|
||||||
|
final double par4,
|
||||||
|
final double par6,
|
||||||
|
final float par8
|
||||||
|
) {
|
||||||
|
if (table.getWorldObj() != null && table.getStackInSlot(10) != null) {
|
||||||
|
final float bob
|
||||||
|
= MathHelper.sin(
|
||||||
|
((Entity) Minecraft.getMinecraft().renderViewEntity).ticksExisted
|
||||||
|
/ 14.0f
|
||||||
|
) * 0.03f
|
||||||
|
+ 0.03f;
|
||||||
|
final float weave
|
||||||
|
= MathHelper.sin(
|
||||||
|
((Entity) Minecraft.getMinecraft().renderViewEntity).ticksExisted
|
||||||
|
/ 10.0f
|
||||||
|
) * 0.5f
|
||||||
|
+ 0.5f;
|
||||||
|
GL11.glPushMatrix();
|
||||||
|
GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
|
||||||
|
GL11.glTranslatef(
|
||||||
|
(float) par2 + 0.625f, (float) par4 + 1.1f + bob, (float) par6 + 0.625f
|
||||||
|
);
|
||||||
|
GL11.glRotatef(85.0f + weave * 10.0f, 1.0f, 0.0f, 0.0f);
|
||||||
|
UtilsFX.render3DItem(
|
||||||
|
table.getStackInSlot(10),
|
||||||
|
0,
|
||||||
|
0.75f,
|
||||||
|
CCBlocks.infusionWorkbench.getMixedBrightnessForBlock(
|
||||||
|
(IBlockAccess) table.getWorldObj(),
|
||||||
|
table.xCoord,
|
||||||
|
table.yCoord + 1,
|
||||||
|
table.zCoord
|
||||||
|
)
|
||||||
|
);
|
||||||
|
GL11.glPopMatrix();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void renderTileEntityAt(
|
||||||
|
final TileEntity par1TileEntity,
|
||||||
|
final double par2,
|
||||||
|
final double par4,
|
||||||
|
final double par6,
|
||||||
|
final float par8
|
||||||
|
) {
|
||||||
|
this.renderTileEntityAt(
|
||||||
|
(TileInfusionWorkbench) par1TileEntity, par2, par4, par6, par8
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,5 +1,7 @@
|
||||||
package net.anvilcraft.classiccasting.tiles;
|
package net.anvilcraft.classiccasting.tiles;
|
||||||
|
|
||||||
|
import dev.tilera.auracore.api.IAlembic;
|
||||||
|
import dev.tilera.auracore.api.IEssenceContainer;
|
||||||
import dev.tilera.auracore.aura.AuraManager;
|
import dev.tilera.auracore.aura.AuraManager;
|
||||||
import net.anvilcraft.classiccasting.ClassicCasting;
|
import net.anvilcraft.classiccasting.ClassicCasting;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
@ -7,17 +9,19 @@ import net.minecraft.network.NetworkManager;
|
||||||
import net.minecraft.network.Packet;
|
import net.minecraft.network.Packet;
|
||||||
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
|
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
import thaumcraft.api.aspects.Aspect;
|
import thaumcraft.api.aspects.Aspect;
|
||||||
import thaumcraft.api.aspects.AspectList;
|
import thaumcraft.api.aspects.AspectList;
|
||||||
import thaumcraft.api.aspects.IAspectSource;
|
import thaumcraft.api.aspects.IEssentiaTransport;
|
||||||
|
|
||||||
public class TileAlembic extends TileEntity implements IAspectSource {
|
public class TileAlembic
|
||||||
public Aspect tag;
|
extends TileEntity implements IAlembic, IEssenceContainer, IEssentiaTransport {
|
||||||
|
public Aspect aspect;
|
||||||
public int amount;
|
public int amount;
|
||||||
public int maxAmount;
|
public int maxAmount;
|
||||||
|
|
||||||
public TileAlembic() {
|
public TileAlembic() {
|
||||||
this.tag = null;
|
this.aspect = null;
|
||||||
this.amount = 0;
|
this.amount = 0;
|
||||||
this.maxAmount = 16;
|
this.maxAmount = 16;
|
||||||
}
|
}
|
||||||
|
@ -26,15 +30,15 @@ public class TileAlembic extends TileEntity implements IAspectSource {
|
||||||
public void readFromNBT(final NBTTagCompound nbttagcompound) {
|
public void readFromNBT(final NBTTagCompound nbttagcompound) {
|
||||||
super.readFromNBT(nbttagcompound);
|
super.readFromNBT(nbttagcompound);
|
||||||
if (nbttagcompound.hasKey("tag"))
|
if (nbttagcompound.hasKey("tag"))
|
||||||
this.tag = Aspect.getAspect(nbttagcompound.getString("tag"));
|
this.aspect = Aspect.getAspect(nbttagcompound.getString("tag"));
|
||||||
this.amount = nbttagcompound.getShort("amount");
|
this.amount = nbttagcompound.getShort("amount");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void writeToNBT(final NBTTagCompound nbttagcompound) {
|
public void writeToNBT(final NBTTagCompound nbttagcompound) {
|
||||||
super.writeToNBT(nbttagcompound);
|
super.writeToNBT(nbttagcompound);
|
||||||
if (this.tag != null)
|
if (this.aspect != null)
|
||||||
nbttagcompound.setString("tag", this.tag.getTag());
|
nbttagcompound.setString("tag", this.aspect.getTag());
|
||||||
nbttagcompound.setShort("amount", (short) this.amount);
|
nbttagcompound.setShort("amount", (short) this.amount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,8 +49,8 @@ public class TileAlembic extends TileEntity implements IAspectSource {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int addToContainer(final Aspect tt, int am) {
|
public int addToContainer(final Aspect tt, int am) {
|
||||||
if ((this.amount < this.maxAmount && tt == this.tag) || this.amount == 0) {
|
if ((this.amount < this.maxAmount && tt == this.aspect) || this.amount == 0) {
|
||||||
this.tag = tt;
|
this.aspect = tt;
|
||||||
final int added = Math.min(am, this.maxAmount - this.amount);
|
final int added = Math.min(am, this.maxAmount - this.amount);
|
||||||
this.amount += added;
|
this.amount += added;
|
||||||
am -= added;
|
am -= added;
|
||||||
|
@ -57,8 +61,12 @@ public class TileAlembic extends TileEntity implements IAspectSource {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean takeFromContainer(final Aspect tt, final int am) {
|
public boolean takeFromContainer(final Aspect tt, final int am) {
|
||||||
if (this.amount >= am && tt == this.tag) {
|
if (this.amount >= am && tt == this.aspect) {
|
||||||
this.amount -= am;
|
this.amount -= am;
|
||||||
|
|
||||||
|
if (this.amount == 0)
|
||||||
|
this.aspect = null;
|
||||||
|
|
||||||
this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord);
|
this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -68,7 +76,7 @@ public class TileAlembic extends TileEntity implements IAspectSource {
|
||||||
@Override
|
@Override
|
||||||
public boolean doesContainerContain(final AspectList ot) {
|
public boolean doesContainerContain(final AspectList ot) {
|
||||||
for (final Aspect tt : ot.getAspects()) {
|
for (final Aspect tt : ot.getAspects()) {
|
||||||
if (this.amount > 0 && tt == this.tag) {
|
if (this.amount > 0 && tt == this.aspect) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -77,25 +85,28 @@ public class TileAlembic extends TileEntity implements IAspectSource {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean doesContainerContainAmount(final Aspect tt, final int am) {
|
public boolean doesContainerContainAmount(final Aspect tt, final int am) {
|
||||||
return this.amount >= am && tt == this.tag;
|
return this.amount >= am && tt == this.aspect;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int containerContains(final Aspect tt) {
|
public int containerContains(final Aspect tt) {
|
||||||
return (tt == this.tag) ? this.amount : 0;
|
return (tt == this.aspect) ? this.amount : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AspectList getAspects() {
|
public AspectList getAspects() {
|
||||||
return new AspectList().add(this.tag, this.amount);
|
AspectList l = new AspectList();
|
||||||
|
if (this.aspect != null)
|
||||||
|
l.add(this.aspect, this.amount);
|
||||||
|
return l;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Packet getDescriptionPacket() {
|
public Packet getDescriptionPacket() {
|
||||||
NBTTagCompound nbt = new NBTTagCompound();
|
NBTTagCompound nbt = new NBTTagCompound();
|
||||||
|
|
||||||
if (this.tag != null)
|
if (this.aspect != null)
|
||||||
nbt.setString("tag", this.tag.getTag());
|
nbt.setString("tag", this.aspect.getTag());
|
||||||
|
|
||||||
nbt.setInteger("amount", this.amount);
|
nbt.setInteger("amount", this.amount);
|
||||||
|
|
||||||
|
@ -109,9 +120,15 @@ public class TileAlembic extends TileEntity implements IAspectSource {
|
||||||
NBTTagCompound nbt = pkt.func_148857_g();
|
NBTTagCompound nbt = pkt.func_148857_g();
|
||||||
|
|
||||||
if (nbt.hasKey("tag"))
|
if (nbt.hasKey("tag"))
|
||||||
this.tag = Aspect.getAspect(nbt.getString("tag"));
|
this.aspect = Aspect.getAspect(nbt.getString("tag"));
|
||||||
|
else
|
||||||
|
this.aspect = null;
|
||||||
|
|
||||||
this.amount = nbt.getInteger("amount");
|
this.amount = nbt.getInteger("amount");
|
||||||
|
|
||||||
|
this.worldObj.markBlockRangeForRenderUpdate(
|
||||||
|
this.xCoord, this.yCoord, this.zCoord, this.xCoord, this.yCoord, this.zCoord
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -125,9 +142,9 @@ public class TileAlembic extends TileEntity implements IAspectSource {
|
||||||
this.xCoord + 0.5f,
|
this.xCoord + 0.5f,
|
||||||
this.yCoord + 0.5f,
|
this.yCoord + 0.5f,
|
||||||
this.zCoord + 0.5f,
|
this.zCoord + 0.5f,
|
||||||
new AspectList().add(this.tag, this.amount)
|
new AspectList().add(this.aspect, this.amount)
|
||||||
);
|
);
|
||||||
this.takeFromContainer(this.tag, this.amount);
|
this.takeFromContainer(this.aspect, this.amount);
|
||||||
this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord);
|
this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -149,4 +166,72 @@ public class TileAlembic extends TileEntity implements IAspectSource {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setAspects(AspectList arg0) {}
|
public void setAspects(AspectList arg0) {}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Aspect getAspect() {
|
||||||
|
return this.aspect;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getAmount() {
|
||||||
|
return this.amount;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int addEssentia(Aspect arg0, int arg1, ForgeDirection arg2) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canInputFrom(ForgeDirection arg0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canOutputTo(ForgeDirection arg0) {
|
||||||
|
return this.isConnectable(arg0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getEssentiaAmount(ForgeDirection arg0) {
|
||||||
|
return this.amount;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Aspect getEssentiaType(ForgeDirection arg0) {
|
||||||
|
return this.aspect;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getMinimumSuction() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getSuctionAmount(ForgeDirection arg0) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Aspect getSuctionType(ForgeDirection arg0) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isConnectable(ForgeDirection arg0) {
|
||||||
|
return arg0 != ForgeDirection.UP;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean renderExtendedTube() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setSuction(Aspect arg0, int arg1) {}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int takeEssentia(Aspect arg0, int arg1, ForgeDirection arg2) {
|
||||||
|
return this.canOutputTo(arg2) && this.takeFromContainer(arg0, arg1) ? arg1 : 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -107,10 +107,10 @@ public class TileInfusionWorkbench extends TileMagicWorkbench {
|
||||||
if (te != null && te instanceof IAspectSource) {
|
if (te != null && te instanceof IAspectSource) {
|
||||||
final IAspectSource ts = (IAspectSource) te;
|
final IAspectSource ts = (IAspectSource) te;
|
||||||
for (final Aspect tag2 : ts.getAspects().getAspects()) {
|
for (final Aspect tag2 : ts.getAspects().getAspects()) {
|
||||||
if (ts.containerContains(tag2)
|
if (ts.getAspects().getAmount(tag2)
|
||||||
> this.foundAspects.getAmount(tag2)) {
|
> this.foundAspects.getAmount(tag2)) {
|
||||||
this.foundAspects.merge(
|
this.foundAspects.merge(
|
||||||
tag2, ts.containerContains(tag2)
|
tag2, ts.getAspects().getAmount(tag2)
|
||||||
);
|
);
|
||||||
this.foundAspects.linkSource(tag2, ts);
|
this.foundAspects.linkSource(tag2, ts);
|
||||||
}
|
}
|
||||||
|
@ -169,42 +169,6 @@ public class TileInfusionWorkbench extends TileMagicWorkbench {
|
||||||
this.foundAspects.readFromNBT(nbt.getCompoundTag("aspects"));
|
this.foundAspects.readFromNBT(nbt.getCompoundTag("aspects"));
|
||||||
}
|
}
|
||||||
|
|
||||||
//public static void handlePacket(final ByteArrayDataInput dat) {
|
|
||||||
// final World world = Thaumcraft.proxy.getClientWorld();
|
|
||||||
// final int x = dat.readInt();
|
|
||||||
// final int y = dat.readInt();
|
|
||||||
// final int z = dat.readInt();
|
|
||||||
// final short id = dat.readShort();
|
|
||||||
// final short dmg = dat.readShort();
|
|
||||||
// final InfuserAspectList ot = new InfuserAspectList();
|
|
||||||
// try {
|
|
||||||
// while (true) {
|
|
||||||
// final int tid = dat.readByte();
|
|
||||||
// final int tam = dat.readShort();
|
|
||||||
// final int sx = dat.readInt();
|
|
||||||
// final int sy = dat.readInt();
|
|
||||||
// final int sz = dat.readInt();
|
|
||||||
// final TileEntity te = world.getTileEntity(sx, sy, sz);
|
|
||||||
// if (te != null && te instanceof IAspectSource) {
|
|
||||||
// ot.merge(Aspect.get(tid), tam);
|
|
||||||
// ot.linkSource(Aspect.get(tid), (IAspectSource) te);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// } catch (final Exception e) {
|
|
||||||
// final TileEntity te2 = world.getTileEntity(x, y, z);
|
|
||||||
// if (te2 instanceof TileInfusionWorkbench && id != 0) {
|
|
||||||
// ((TileInfusionWorkbench) te2)
|
|
||||||
// .setInventorySlotContentsSoftly(10, new ItemStack(id, 1, (int)
|
|
||||||
// dmg));
|
|
||||||
// ((TileInfusionWorkbench) te2).foundAspects = ot;
|
|
||||||
// if (((TileInfusionWorkbench) te2).eventHandler != null) {
|
|
||||||
// ((TileInfusionWorkbench) te2)
|
|
||||||
// .eventHandler.onCraftMatrixChanged((IInventory) te2);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void openInventory() {}
|
public void openInventory() {}
|
||||||
|
|
||||||
|
|
|
@ -18,3 +18,4 @@ item.classiccasting:wandTrade.name=Wand of Equal Trade
|
||||||
# ---- BLOCKS ----
|
# ---- BLOCKS ----
|
||||||
|
|
||||||
tile.classiccasting:alembic.name=Arcane Alembic
|
tile.classiccasting:alembic.name=Arcane Alembic
|
||||||
|
tile.classiccasting:infusionWorkbench.name=Arcane Stone
|
||||||
|
|
After Width: | Height: | Size: 5.1 KiB |
|
@ -0,0 +1,45 @@
|
||||||
|
{
|
||||||
|
"animation": {
|
||||||
|
"width": 1,
|
||||||
|
"height": 19,
|
||||||
|
"frametime": 1,
|
||||||
|
"frames": [
|
||||||
|
0,
|
||||||
|
1,
|
||||||
|
2,
|
||||||
|
3,
|
||||||
|
4,
|
||||||
|
5,
|
||||||
|
6,
|
||||||
|
7,
|
||||||
|
8,
|
||||||
|
9,
|
||||||
|
10,
|
||||||
|
11,
|
||||||
|
12,
|
||||||
|
13,
|
||||||
|
14,
|
||||||
|
15,
|
||||||
|
16,
|
||||||
|
17,
|
||||||
|
18,
|
||||||
|
17,
|
||||||
|
16,
|
||||||
|
15,
|
||||||
|
14,
|
||||||
|
13,
|
||||||
|
12,
|
||||||
|
11,
|
||||||
|
10,
|
||||||
|
9,
|
||||||
|
8,
|
||||||
|
7,
|
||||||
|
6,
|
||||||
|
5,
|
||||||
|
4,
|
||||||
|
3,
|
||||||
|
2,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
After Width: | Height: | Size: 797 B |
After Width: | Height: | Size: 791 B |
After Width: | Height: | Size: 806 B |
After Width: | Height: | Size: 830 B |
After Width: | Height: | Size: 837 B |
After Width: | Height: | Size: 833 B |
After Width: | Height: | Size: 768 B |
After Width: | Height: | Size: 20 KiB |