feat: merge with arcane-seals
|
@ -2,9 +2,11 @@ package net.anvilcraft.thaummach;
|
|||
|
||||
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.registry.GameRegistry;
|
||||
import net.anvilcraft.thaummach.entities.EntitySingularity;
|
||||
import net.anvilcraft.thaummach.render.BlockApparatusRenderer;
|
||||
import net.anvilcraft.thaummach.render.TileSealRenderer;
|
||||
import net.anvilcraft.thaummach.render.entity.EntitySingularityRenderer;
|
||||
import net.anvilcraft.thaummach.render.tile.TileBoreRenderer;
|
||||
import net.anvilcraft.thaummach.render.tile.TileConduitPumpRenderer;
|
||||
|
@ -19,6 +21,7 @@ import net.anvilcraft.thaummach.tiles.TileCrucible;
|
|||
import net.anvilcraft.thaummach.tiles.TileCrystallizer;
|
||||
import net.anvilcraft.thaummach.tiles.TileFilter;
|
||||
import net.anvilcraft.thaummach.tiles.TilePurifier;
|
||||
import net.anvilcraft.thaummach.tiles.TileSeal;
|
||||
|
||||
public class ClientProxy extends CommonProxy {
|
||||
@Override
|
||||
|
@ -34,6 +37,8 @@ public class ClientProxy extends CommonProxy {
|
|||
RenderingRegistry.registerEntityRenderingHandler(
|
||||
EntitySingularity.class, new EntitySingularityRenderer()
|
||||
);
|
||||
|
||||
FMLCommonHandler.instance().bus().register(new RenderTicker());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -55,5 +60,6 @@ public class ClientProxy extends CommonProxy {
|
|||
ClientRegistry.registerTileEntity(
|
||||
TileCrystallizer.class, "crystallizer", new TileCrystallizerRenderer()
|
||||
);
|
||||
ClientRegistry.registerTileEntity(TileSeal.class, "seal", new TileSealRenderer());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ import net.anvilcraft.thaummach.tiles.TileCrucible;
|
|||
import net.anvilcraft.thaummach.tiles.TileCrystallizer;
|
||||
import net.anvilcraft.thaummach.tiles.TileFilter;
|
||||
import net.anvilcraft.thaummach.tiles.TilePurifier;
|
||||
import net.anvilcraft.thaummach.tiles.TileSeal;
|
||||
|
||||
public class CommonProxy {
|
||||
public void preInit() {}
|
||||
|
@ -30,5 +31,6 @@ public class CommonProxy {
|
|||
GameRegistry.registerTileEntity(TileCrystallizer.class, "crystallizer");
|
||||
GameRegistry.registerTileEntity(TileFilter.class, "filter");
|
||||
GameRegistry.registerTileEntity(TilePurifier.class, "purifier");
|
||||
GameRegistry.registerTileEntity(TileSeal.class, "seal");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
package net.anvilcraft.thaummach;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.gameevent.TickEvent.RenderTickEvent;
|
||||
import net.anvilcraft.thaummach.render.PortalRenderer;
|
||||
import net.minecraft.client.Minecraft;
|
||||
|
||||
public class RenderTicker {
|
||||
@SubscribeEvent
|
||||
public void onRenderTickEvent(RenderTickEvent ev) {
|
||||
if (Minecraft.getMinecraft().theWorld == null)
|
||||
return;
|
||||
|
||||
for (PortalRenderer ren : PortalRenderer.INSTANCES) {
|
||||
// TODO: optimize
|
||||
ren.createPortalView();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,88 @@
|
|||
package net.anvilcraft.thaummach;
|
||||
|
||||
import net.anvilcraft.thaummach.tiles.TileSeal;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
public class SealData {
|
||||
public int dim;
|
||||
public int x;
|
||||
public int y;
|
||||
public int z;
|
||||
public short orientation;
|
||||
public byte rune;
|
||||
|
||||
public SealData() {}
|
||||
|
||||
public SealData(TileSeal seal) {
|
||||
this.dim = seal.getWorldObj().provider.dimensionId;
|
||||
|
||||
this.x = seal.xCoord;
|
||||
this.y = seal.yCoord;
|
||||
this.z = seal.zCoord;
|
||||
|
||||
this.orientation = seal.orientation;
|
||||
|
||||
this.rune = seal.runes[2];
|
||||
}
|
||||
|
||||
public NBTTagCompound writeToNbt(NBTTagCompound nbt) {
|
||||
nbt.setInteger("dim", this.dim);
|
||||
nbt.setInteger("x", this.x);
|
||||
nbt.setInteger("y", this.y);
|
||||
nbt.setInteger("z", this.z);
|
||||
nbt.setShort("orientation", this.orientation);
|
||||
nbt.setByte("rune", this.rune);
|
||||
|
||||
return nbt;
|
||||
}
|
||||
|
||||
public static SealData readFromNbt(NBTTagCompound nbt) {
|
||||
SealData self = new SealData();
|
||||
|
||||
self.dim = nbt.getInteger("dim");
|
||||
self.x = nbt.getInteger("x");
|
||||
self.y = nbt.getInteger("y");
|
||||
self.z = nbt.getInteger("z");
|
||||
self.orientation = nbt.getShort("orientation");
|
||||
self.rune = nbt.getByte("rune");
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + dim;
|
||||
result = prime * result + x;
|
||||
result = prime * result + y;
|
||||
result = prime * result + z;
|
||||
result = prime * result + orientation;
|
||||
result = prime * result + rune;
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
SealData other = (SealData) obj;
|
||||
if (dim != other.dim)
|
||||
return false;
|
||||
if (x != other.x)
|
||||
return false;
|
||||
if (y != other.y)
|
||||
return false;
|
||||
if (z != other.z)
|
||||
return false;
|
||||
if (orientation != other.orientation)
|
||||
return false;
|
||||
if (rune != other.rune)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -3,19 +3,28 @@ package net.anvilcraft.thaummach;
|
|||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import net.anvilcraft.thaummach.blocks.BlockApparatusFragile;
|
||||
import net.anvilcraft.thaummach.blocks.BlockApparatusMetal;
|
||||
import net.anvilcraft.thaummach.blocks.BlockSeal;
|
||||
import net.anvilcraft.thaummach.items.ItemBlockApparatusFragile;
|
||||
import net.anvilcraft.thaummach.items.ItemBlockApparatusMetal;
|
||||
import net.anvilcraft.thaummach.items.ItemSeal;
|
||||
import net.minecraft.block.Block;
|
||||
|
||||
public class TMBlocks {
|
||||
public static Block apparatusFragile;
|
||||
public static Block apparatusMetal;
|
||||
public static Block seal;
|
||||
|
||||
public static void init() {
|
||||
apparatusFragile = new BlockApparatusFragile();
|
||||
apparatusMetal = new BlockApparatusMetal();
|
||||
seal = new BlockSeal();
|
||||
|
||||
GameRegistry.registerBlock(apparatusFragile, ItemBlockApparatusFragile.class, "apparatus_fragile");
|
||||
GameRegistry.registerBlock(apparatusMetal, ItemBlockApparatusMetal.class, "apparatus_metal");
|
||||
GameRegistry.registerBlock(
|
||||
apparatusFragile, ItemBlockApparatusFragile.class, "apparatus_fragile"
|
||||
);
|
||||
GameRegistry.registerBlock(
|
||||
apparatusMetal, ItemBlockApparatusMetal.class, "apparatus_metal"
|
||||
);
|
||||
GameRegistry.registerBlock(seal, ItemSeal.class, "seal");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package net.anvilcraft.thaummach;
|
|||
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import net.anvilcraft.thaummach.items.ItemFocus;
|
||||
import net.anvilcraft.thaummach.items.ItemRunicEssence;
|
||||
import net.anvilcraft.thaummach.items.ItemSingularity;
|
||||
import net.minecraft.item.Item;
|
||||
|
||||
|
@ -11,6 +12,7 @@ public class TMItems {
|
|||
public static Item focus2;
|
||||
public static Item focus3;
|
||||
public static Item focus4;
|
||||
public static Item runicEssence;
|
||||
public static Item singularity;
|
||||
|
||||
public static void init() {
|
||||
|
@ -20,6 +22,8 @@ public class TMItems {
|
|||
focus3 = new ItemFocus(3);
|
||||
focus4 = new ItemFocus(4);
|
||||
|
||||
runicEssence = new ItemRunicEssence();
|
||||
|
||||
singularity = new ItemSingularity();
|
||||
|
||||
GameRegistry.registerItem(focus0, "focus0");
|
||||
|
@ -28,6 +32,8 @@ public class TMItems {
|
|||
GameRegistry.registerItem(focus3, "focus3");
|
||||
GameRegistry.registerItem(focus4, "focus4");
|
||||
|
||||
GameRegistry.registerItem(runicEssence, "runicEssence");
|
||||
|
||||
GameRegistry.registerItem(singularity, "singularity");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,263 @@
|
|||
package net.anvilcraft.thaummach.blocks;
|
||||
|
||||
import net.anvilcraft.thaummach.TMTab;
|
||||
import net.anvilcraft.thaummach.tiles.TileSeal;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class BlockSeal extends BlockContainer {
|
||||
public BlockSeal() {
|
||||
super(Material.rock);
|
||||
this.setHardness(0.5F);
|
||||
this.setResistance(15.0F);
|
||||
this.setStepSound(Block.soundTypeStone);
|
||||
this.setBlockName("thaummach:seal");
|
||||
this.setCreativeTab(TMTab.INSTANCE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerBlockIcons(IIconRegister ir) {
|
||||
// TODO: add texture for this
|
||||
this.blockIcon = ir.registerIcon("thaummach:seal");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(
|
||||
World world,
|
||||
int i,
|
||||
int j,
|
||||
int k,
|
||||
EntityPlayer entityplayer,
|
||||
// useless parameters
|
||||
int alec1,
|
||||
float alec2,
|
||||
float alec3,
|
||||
float alec4
|
||||
) {
|
||||
TileEntity te = world.getTileEntity(i, j, k);
|
||||
if (te != null && ((TileSeal) te).runes[0] == 0
|
||||
&& ((TileSeal) te).runes[1] == 1) {
|
||||
++((TileSeal) te).portalWindow;
|
||||
world.playSoundEffect(
|
||||
(double) i + 0.5,
|
||||
(double) j + 0.5,
|
||||
(double) k + 0.5,
|
||||
"thaummach:pclose",
|
||||
0.2F,
|
||||
1.0F + world.rand.nextFloat() * 0.2F
|
||||
);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z) {
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
int l = 1;
|
||||
if (te != null && te instanceof TileSeal) {
|
||||
l = ((TileSeal) te).orientation;
|
||||
}
|
||||
|
||||
float thickness = 0.0625F;
|
||||
if (l == 0) {
|
||||
this.setBlockBounds(0.3F, 1.0F - thickness, 0.3F, 0.7F, 1.0F, 0.7F);
|
||||
}
|
||||
|
||||
if (l == 1) {
|
||||
this.setBlockBounds(0.3F, 0.0F, 0.3F, 0.7F, thickness, 0.7F);
|
||||
}
|
||||
|
||||
if (l == 2) {
|
||||
this.setBlockBounds(0.3F, 0.3F, 1.0F - thickness, 0.7F, 0.7F, 1.0F);
|
||||
}
|
||||
|
||||
if (l == 3) {
|
||||
this.setBlockBounds(0.3F, 0.3F, 0.0F, 0.7F, 0.7F, thickness);
|
||||
}
|
||||
|
||||
if (l == 4) {
|
||||
this.setBlockBounds(1.0F - thickness, 0.3F, 0.3F, 1.0F, 0.7F, 0.7F);
|
||||
}
|
||||
|
||||
if (l == 5) {
|
||||
this.setBlockBounds(0.0F, 0.3F, 0.3F, thickness, 0.7F, 0.7F);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
|
||||
return new TileSeal();
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createTileEntity(World world, int metadata) {
|
||||
return this.createNewTileEntity(world, metadata);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBlockBoundsForItemRender() {
|
||||
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean
|
||||
isSideSolid(IBlockAccess world, int i, int j, int k, ForgeDirection side) {
|
||||
//int md = world.getBlockMetadata(i, j, k);
|
||||
//return md != 0 && md != 3 && md != 4 && md != 7;
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canPlaceBlockOnSide(World world, int i, int j, int k, int l) {
|
||||
if (l == 0 && world.isSideSolid(i, j + 1, k, ForgeDirection.DOWN)) {
|
||||
return true;
|
||||
} else if (l == 1 && world.isSideSolid(i, j - 1, k, ForgeDirection.UP)) {
|
||||
return true;
|
||||
} else if (l == 2 && world.isSideSolid(i, j, k + 1, ForgeDirection.NORTH)) {
|
||||
return true;
|
||||
} else if (l == 3 && world.isSideSolid(i, j, k - 1, ForgeDirection.SOUTH)) {
|
||||
return true;
|
||||
} else if (l == 4 && world.isSideSolid(i + 1, j, k, ForgeDirection.EAST)) {
|
||||
return true;
|
||||
} else {
|
||||
return l == 5 && world.isSideSolid(i - 1, j, k, ForgeDirection.WEST);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canPlaceBlockAt(World world, int i, int j, int k) {
|
||||
if (world.isSideSolid(i - 1, j, k, ForgeDirection.EAST)) {
|
||||
return true;
|
||||
} else if (world.isSideSolid(i + 1, j, k, ForgeDirection.WEST)) {
|
||||
return true;
|
||||
} else if (world.isSideSolid(i, j, k - 1, ForgeDirection.SOUTH)) {
|
||||
return true;
|
||||
} else if (world.isSideSolid(i, j, k + 1, ForgeDirection.NORTH)) {
|
||||
return true;
|
||||
} else {
|
||||
return world.isSideSolid(i, j - 1, k, ForgeDirection.UP)
|
||||
? true
|
||||
: world.isSideSolid(i, j + 1, k, ForgeDirection.DOWN);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPostBlockPlaced(
|
||||
World world,
|
||||
int x,
|
||||
int y,
|
||||
int z,
|
||||
int l
|
||||
) {
|
||||
int orientation = -1;
|
||||
if (world.isSideSolid(x, y + 1, z, ForgeDirection.DOWN)) {
|
||||
orientation = 0;
|
||||
} else if (world.isSideSolid(x, y - 1, z, ForgeDirection.UP)) {
|
||||
orientation = 1;
|
||||
} else if (world.isSideSolid(x, y, z + 1, ForgeDirection.NORTH)) {
|
||||
orientation = 2;
|
||||
} else if (world.isSideSolid(x, y, z - 1, ForgeDirection.SOUTH)) {
|
||||
orientation = 3;
|
||||
} else if (world.isSideSolid(x + 1, y, z, ForgeDirection.WEST)) {
|
||||
orientation = 4;
|
||||
} else if (world.isSideSolid(x - 1, y, z, ForgeDirection.EAST)) {
|
||||
orientation = 5;
|
||||
}
|
||||
|
||||
TileSeal ts = (TileSeal) world.getTileEntity(x, y, z);
|
||||
ts.orientation = (short) orientation;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canProvidePower() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int
|
||||
isProvidingStrongPower(IBlockAccess iblockaccess, int i, int j, int k, int meta) {
|
||||
TileSeal ts = (TileSeal) iblockaccess.getTileEntity(i, j, k);
|
||||
if (ts != null) {
|
||||
return ts.isPowering ? 15 : 0;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int isProvidingWeakPower(IBlockAccess world, int x, int y, int z, int meta) {
|
||||
return this.isProvidingStrongPower(world, x, y, z, meta);
|
||||
}
|
||||
|
||||
private boolean checkIfAttachedToBlock(World world, int i, int j, int k) {
|
||||
if (!this.canPlaceBlockAt(world, i, j, k)) {
|
||||
this.dropBlockAsItem(world, i, j, k, world.getBlockMetadata(i, j, k), 0);
|
||||
world.setBlockToAir(i, j, k);
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNeighborBlockChange(World world, int i, int j, int k, Block l) {
|
||||
super.onNeighborBlockChange(world, i, j, k, l);
|
||||
if (this.checkIfAttachedToBlock(world, i, j, k)) {
|
||||
TileSeal tes = (TileSeal) world.getTileEntity(i, j, k);
|
||||
if (tes != null) {
|
||||
int i1 = tes.orientation;
|
||||
boolean flag = false;
|
||||
if (!world.isSideSolid(i - 1, j, k, ForgeDirection.EAST) && i1 == 5) {
|
||||
flag = true;
|
||||
}
|
||||
|
||||
if (!world.isSideSolid(i + 1, j, k, ForgeDirection.WEST) && i1 == 4) {
|
||||
flag = true;
|
||||
}
|
||||
|
||||
if (!world.isSideSolid(i, j, k - 1, ForgeDirection.SOUTH) && i1 == 3) {
|
||||
flag = true;
|
||||
}
|
||||
|
||||
if (!world.isSideSolid(i, j, k + 1, ForgeDirection.NORTH) && i1 == 2) {
|
||||
flag = true;
|
||||
}
|
||||
|
||||
if (!world.isSideSolid(i, j - 1, k, ForgeDirection.UP) && i1 == 1) {
|
||||
flag = true;
|
||||
}
|
||||
|
||||
if (!world.isSideSolid(i, j + 1, k, ForgeDirection.DOWN) && i1 == 0) {
|
||||
flag = true;
|
||||
}
|
||||
|
||||
if (flag) {
|
||||
world.setBlockToAir(i, j, k);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,112 @@
|
|||
package net.anvilcraft.thaummach.items;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.anvilcraft.thaummach.TMBlocks;
|
||||
import net.anvilcraft.thaummach.TMTab;
|
||||
import net.anvilcraft.thaummach.tiles.TileSeal;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class ItemRunicEssence extends Item {
|
||||
private IIcon[] icons = new IIcon[6];
|
||||
|
||||
public ItemRunicEssence() {
|
||||
super();
|
||||
super.maxStackSize = 16;
|
||||
this.setHasSubtypes(true);
|
||||
this.setMaxDamage(0);
|
||||
this.setCreativeTab(TMTab.INSTANCE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerIcons(IIconRegister reg) {
|
||||
for (int i = 0; i < 6; i++) {
|
||||
this.icons[i] = reg.registerIcon("thaummach:runic_essence_" + i);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubItems(Item p_150895_1_, CreativeTabs p_150895_2_, List l) {
|
||||
for (int i = 0; i < 6; i++) {
|
||||
l.add(new ItemStack(this, 1, i));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIconFromDamage(int meta) {
|
||||
return this.icons[meta];
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(ItemStack stack, int pass) {
|
||||
return this.getIconFromDamage(stack.getItemDamage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName(ItemStack is) {
|
||||
return "thaummach:runic_essence." + is.getItemDamage();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemUseFirst(
|
||||
ItemStack itemstack,
|
||||
EntityPlayer player,
|
||||
World world,
|
||||
int i,
|
||||
int j,
|
||||
int k,
|
||||
int l,
|
||||
// useless parameters
|
||||
float alec1,
|
||||
float alec2,
|
||||
float alec3
|
||||
) {
|
||||
Block bi = world.getBlock(i, j, k);
|
||||
if (itemstack.stackSize == 0) {
|
||||
return false;
|
||||
} else {
|
||||
if (bi == TMBlocks.seal) {
|
||||
TileSeal ts = (TileSeal) world.getTileEntity(i, j, k);
|
||||
if (ts != null) {
|
||||
boolean added = false;
|
||||
int addPitch = 0;
|
||||
|
||||
for (int q = 0; q < 3; ++q) {
|
||||
if (ts.runes[q] == -1) {
|
||||
ts.runes[q] = (byte) itemstack.getItemDamage();
|
||||
added = true;
|
||||
addPitch = ts.runes[q];
|
||||
ts.delay = 60;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (added) {
|
||||
world.playSoundEffect(
|
||||
(double) ((float) i + 0.5F),
|
||||
(double) ((float) j + 0.5F),
|
||||
(double) ((float) k + 0.5F),
|
||||
"thaumcraft:rune_set",
|
||||
0.5F,
|
||||
1.2F - (float) addPitch * 0.075F
|
||||
);
|
||||
--itemstack.stackSize;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return super.onItemUseFirst(
|
||||
itemstack, player, world, i, j, k, l, alec1, alec2, alec3
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
package net.anvilcraft.thaummach.items;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
|
||||
public class ItemSeal extends ItemBlock {
|
||||
public ItemSeal(Block b) {
|
||||
super(b);
|
||||
super.maxStackSize = 16;
|
||||
this.setHasSubtypes(true);
|
||||
this.setMaxDamage(0);
|
||||
this.setUnlocalizedName("thaummach:seal");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,196 @@
|
|||
package net.anvilcraft.thaummach.render;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import net.anvilcraft.thaummach.SealData;
|
||||
import net.anvilcraft.thaummach.tiles.TileSeal;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.ChunkCoordinates;
|
||||
import net.minecraft.util.IChatComponent;
|
||||
import org.lwjgl.opengl.EXTFramebufferObject;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class PortalRenderer {
|
||||
public static Set<PortalRenderer> INSTANCES = new HashSet<>();
|
||||
|
||||
public int portalTexture;
|
||||
public int depthRenderBuffer;
|
||||
public int frameBuffer;
|
||||
public TileSeal seal;
|
||||
|
||||
public PortalRenderer(TileSeal seal) {
|
||||
this.frameBuffer = EXTFramebufferObject.glGenFramebuffersEXT();
|
||||
this.portalTexture = GL11.glGenTextures();
|
||||
this.depthRenderBuffer = EXTFramebufferObject.glGenRenderbuffersEXT();
|
||||
EXTFramebufferObject.glBindFramebufferEXT(36160, this.frameBuffer);
|
||||
GL11.glBindTexture(3553, this.portalTexture);
|
||||
GL11.glTexParameterf(3553, 10241, 9729.0F);
|
||||
GL11.glTexImage2D(3553, 0, 32856, 512, 512, 0, 6408, 5124, (ByteBuffer) null);
|
||||
EXTFramebufferObject.glFramebufferTexture2DEXT(
|
||||
36160, 36064, 3553, this.portalTexture, 0
|
||||
);
|
||||
EXTFramebufferObject.glBindRenderbufferEXT(36161, this.depthRenderBuffer);
|
||||
EXTFramebufferObject.glRenderbufferStorageEXT(36161, 35056, 512, 512);
|
||||
EXTFramebufferObject.glFramebufferRenderbufferEXT(
|
||||
36160, 33306, 36161, this.depthRenderBuffer
|
||||
);
|
||||
EXTFramebufferObject.glBindFramebufferEXT(36160, 0);
|
||||
this.seal = seal;
|
||||
INSTANCES.add(this);
|
||||
}
|
||||
|
||||
public void deinit() {
|
||||
// TODO: WTF
|
||||
//GL11.glDeleteFramebuffers(this.frameBuffer);
|
||||
GL11.glDeleteTextures(this.portalTexture);
|
||||
INSTANCES.remove(this);
|
||||
}
|
||||
|
||||
public void createPortalView() {
|
||||
if (this.seal.otherSeal == null)
|
||||
return;
|
||||
|
||||
SealData target = this.seal.otherSeal;
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
GL11.glPushMatrix();
|
||||
GL11.glLoadIdentity();
|
||||
|
||||
int prevFbo = GL11.glGetInteger(EXTFramebufferObject.GL_FRAMEBUFFER_BINDING_EXT);
|
||||
EXTFramebufferObject.glBindFramebufferEXT(36160, this.frameBuffer);
|
||||
|
||||
// TODO: stencils aren't stenciling
|
||||
GL11.glEnable(2960);
|
||||
GL11.glStencilFunc(519, 1, 1);
|
||||
GL11.glStencilOp(7680, 7680, 7681);
|
||||
GL11.glViewport(0, 0, 512, 512);
|
||||
GL11.glMatrixMode(5889);
|
||||
GL11.glLoadIdentity();
|
||||
GL11.glMatrixMode(5888);
|
||||
GL11.glLoadIdentity();
|
||||
GL11.glDisable(3553);
|
||||
GL11.glColor3f(1.0F, 1.0F, 1.0F);
|
||||
GL11.glBegin(6);
|
||||
GL11.glVertex2f(0.0F, 0.0F);
|
||||
|
||||
for (int oh = 0; oh <= 10; ++oh) {
|
||||
double aa = 6.283185307179586 * (double) oh / 10.0;
|
||||
GL11.glVertex2f((float) Math.cos(aa), (float) Math.sin(aa));
|
||||
}
|
||||
|
||||
GL11.glEnd();
|
||||
GL11.glStencilFunc(514, 1, 1);
|
||||
GL11.glStencilOp(7680, 7680, 7680);
|
||||
GL11.glEnable(3553);
|
||||
Entity rve = mc.renderViewEntity;
|
||||
|
||||
mc.renderViewEntity = new EntityPlayer(
|
||||
mc.theWorld, mc.getSession().func_148256_e()
|
||||
) {
|
||||
@Override
|
||||
public void addChatMessage(IChatComponent p_145747_1_) {}
|
||||
|
||||
@Override
|
||||
public boolean canCommandSenderUseCommand(int p_70003_1_, String p_70003_2_) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ChunkCoordinates getPlayerCoordinates() {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
int orientation = target.orientation;
|
||||
float yaw = 0.0f;
|
||||
float pitch = 0.0f;
|
||||
switch (orientation) {
|
||||
case 0: {
|
||||
pitch = 90.0f;
|
||||
break;
|
||||
}
|
||||
case 1: {
|
||||
pitch = -90.0f;
|
||||
break;
|
||||
}
|
||||
case 2: {
|
||||
yaw = 180.0f;
|
||||
break;
|
||||
}
|
||||
case 3: {
|
||||
yaw = 0.0f;
|
||||
break;
|
||||
}
|
||||
case 4: {
|
||||
yaw = 90.0f;
|
||||
break;
|
||||
}
|
||||
case 5: {
|
||||
yaw = 270.0f;
|
||||
break;
|
||||
}
|
||||
}
|
||||
int xm = 0;
|
||||
int zm = 0;
|
||||
int ym = 0;
|
||||
switch (orientation) {
|
||||
case 0: {
|
||||
ym = -1;
|
||||
break;
|
||||
}
|
||||
case 1: {
|
||||
ym = 1;
|
||||
break;
|
||||
}
|
||||
case 2: {
|
||||
zm = -1;
|
||||
break;
|
||||
}
|
||||
case 3: {
|
||||
zm = 1;
|
||||
break;
|
||||
}
|
||||
case 4: {
|
||||
xm = -1;
|
||||
break;
|
||||
}
|
||||
case 5: {
|
||||
xm = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
mc.renderViewEntity.setPositionAndRotation(
|
||||
target.x + 0.5 + xm, target.y + 0.5f + ym, target.z + 0.5 + zm, yaw, pitch
|
||||
);
|
||||
final boolean di = mc.gameSettings.showDebugInfo;
|
||||
mc.gameSettings.showDebugInfo = false;
|
||||
final float fov = mc.gameSettings.fovSetting;
|
||||
final int width = mc.displayWidth;
|
||||
final int height = mc.displayHeight;
|
||||
int tpv = mc.gameSettings.thirdPersonView;
|
||||
mc.displayWidth = 512;
|
||||
mc.displayHeight = 512;
|
||||
mc.gameSettings.thirdPersonView = 0;
|
||||
mc.gameSettings.fovSetting = 120.0f;
|
||||
mc.renderViewEntity.rotationYaw = yaw;
|
||||
mc.renderViewEntity.rotationPitch = pitch;
|
||||
final boolean hg = mc.gameSettings.hideGUI;
|
||||
mc.gameSettings.hideGUI = true;
|
||||
mc.entityRenderer.renderWorld(1F, 0L);
|
||||
mc.renderViewEntity = (EntityLivingBase) rve;
|
||||
mc.displayWidth = width;
|
||||
mc.displayHeight = height;
|
||||
mc.gameSettings.showDebugInfo = di;
|
||||
mc.gameSettings.hideGUI = hg;
|
||||
mc.gameSettings.fovSetting = fov;
|
||||
mc.gameSettings.thirdPersonView = tpv;
|
||||
GL11.glViewport(0, 0, mc.displayWidth, mc.displayHeight);
|
||||
GL11.glDisable(2960);
|
||||
EXTFramebufferObject.glBindFramebufferEXT(36160, prevFbo);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,236 @@
|
|||
package net.anvilcraft.thaummach.render;
|
||||
|
||||
import net.anvilcraft.thaummach.TMBlocks;
|
||||
import net.anvilcraft.thaummach.tiles.TileSeal;
|
||||
import net.anvilcraft.thaummach.utils.UtilsFX;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class TileSealRenderer extends TileEntitySpecialRenderer {
|
||||
private float bob = 0.0F;
|
||||
private int count = 0;
|
||||
private static int[] colors
|
||||
= new int[] { 13532671, 16777088, 8421631, 8454016, 16744576, 4194368 };
|
||||
|
||||
private void translateFromOrientation(double x, double y, double z, int orientation) {
|
||||
GL11.glPushMatrix();
|
||||
if (orientation == 0) {
|
||||
GL11.glTranslatef((float) x, (float) y + 1.0F, (float) z + 1.0F);
|
||||
GL11.glRotatef(-90.0F, 1.0F, 0.0F, 0.0F);
|
||||
} else if (orientation == 1) {
|
||||
GL11.glTranslatef((float) x, (float) y, (float) z);
|
||||
GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F);
|
||||
} else if (orientation == 2) {
|
||||
GL11.glTranslatef((float) x, (float) y, (float) z + 1.0F);
|
||||
} else if (orientation == 3) {
|
||||
GL11.glTranslatef((float) x + 1.0F, (float) y, (float) z);
|
||||
GL11.glRotatef(180.0F, 0.0F, 1.0F, 0.0F);
|
||||
} else if (orientation == 4) {
|
||||
GL11.glTranslatef((float) x + 1.0F, (float) y, (float) z + 1.0F);
|
||||
GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F);
|
||||
} else if (orientation == 5) {
|
||||
GL11.glTranslatef((float) x, (float) y, (float) z);
|
||||
GL11.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F);
|
||||
}
|
||||
}
|
||||
|
||||
private void drawSeal(float angle, int level, int rune) {
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
GL11.glRotatef(90.0F, -1.0F, 0.0F, 0.0F);
|
||||
GL11.glRotatef(angle, 0.0F, 1.0F, 0.0F);
|
||||
GL11.glTranslatef(-0.5F, 0.0F, -0.5F);
|
||||
GL11.glDepthMask(false);
|
||||
GL11.glEnable(3042);
|
||||
GL11.glBlendFunc(770, 1);
|
||||
if (level != 2) {
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(new ResourceLocation(
|
||||
"thaummach", "textures/misc/s_" + level + "_" + rune + ".png"
|
||||
));
|
||||
} else {
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(
|
||||
new ResourceLocation("thaummach", "textures/misc/seal5.png")
|
||||
);
|
||||
}
|
||||
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setBrightness(220);
|
||||
if (level == 2) {
|
||||
tessellator.setColorRGBA_I(colors[rune], 255);
|
||||
}
|
||||
|
||||
tessellator.addVertexWithUV(0.0, 0.0, 1.0, 0.0, 1.0);
|
||||
tessellator.addVertexWithUV(1.0, 0.0, 1.0, 1.0, 1.0);
|
||||
tessellator.addVertexWithUV(1.0, 0.0, 0.0, 1.0, 0.0);
|
||||
tessellator.addVertexWithUV(0.0, 0.0, 0.0, 0.0, 0.0);
|
||||
tessellator.draw();
|
||||
GL11.glDisable(3042);
|
||||
GL11.glDepthMask(true);
|
||||
}
|
||||
|
||||
private void drawPortal(TileSeal seal, float angle, double x, double y, double z) {
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
GL11.glDisable(2896);
|
||||
if (seal.otherSeal != null && seal.renderer != null) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glDisable(3553);
|
||||
GL11.glColor4f(
|
||||
1.0f,
|
||||
1.0f,
|
||||
1.0f,
|
||||
1.0f
|
||||
);
|
||||
tessellator.setBrightness(220);
|
||||
GL11.glRotatef(180.0F, 0.0F, 1.0F, 0.0F);
|
||||
GL11.glScaled(
|
||||
(double) (seal.pSize / 2.0F),
|
||||
(double) (seal.pSize / 2.0F),
|
||||
(double) (seal.pSize / 2.0F)
|
||||
);
|
||||
GL11.glBegin(6);
|
||||
GL11.glVertex2f(0.0F, 0.0F);
|
||||
|
||||
for (int oh = 0; oh <= 10; ++oh) {
|
||||
double aa = 6.283185307179586 * (double) oh / 10.0;
|
||||
GL11.glVertex2f((float) Math.cos(aa), (float) Math.sin(aa));
|
||||
}
|
||||
|
||||
GL11.glEnd();
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
GL11.glPopMatrix();
|
||||
GL11.glEnable(3553);
|
||||
GL11.glPushMatrix();
|
||||
GL11.glDisable(2896);
|
||||
GL11.glEnable(3042);
|
||||
GL11.glBlendFunc(770, 771);
|
||||
GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F);
|
||||
GL11.glRotatef(180.0F, 0.0F, 1.0F, 0.0F);
|
||||
GL11.glTranslatef(-seal.pSize / 2.0F, -0.01F, -seal.pSize / 2.0F);
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
GL11.glBindTexture(GL11.GL_TEXTURE_2D, seal.renderer.portalTexture);
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setBrightness(220);
|
||||
tessellator.setColorRGBA_F(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
tessellator.addVertexWithUV(0.0, 0.0, 0.0, 0.0, 0.0);
|
||||
tessellator.addVertexWithUV((double) seal.pSize, 0.0, 0.0, 1.0, 0.0);
|
||||
tessellator.addVertexWithUV(
|
||||
(double) seal.pSize, 0.0, (double) seal.pSize, 1.0, 1.0
|
||||
);
|
||||
tessellator.addVertexWithUV(0.0, 0.0, (double) seal.pSize, 0.0, 1.0);
|
||||
tessellator.draw();
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
GL11.glDisable(3042);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glRotatef(90.0F, -1.0F, 0.0F, 0.0F);
|
||||
GL11.glRotatef(angle, 0.0F, 1.0F, 0.0F);
|
||||
GL11.glTranslatef(-seal.pSize, 0.02F, -seal.pSize);
|
||||
GL11.glDepthMask(false);
|
||||
GL11.glEnable(3042);
|
||||
GL11.glBlendFunc(770, 771);
|
||||
if (seal.otherSeal != null && seal.renderer != null) {
|
||||
mc.renderEngine.bindTexture(
|
||||
new ResourceLocation("thaummach", "textures/misc/portal2.png")
|
||||
);
|
||||
} else {
|
||||
mc.renderEngine.bindTexture(
|
||||
new ResourceLocation("thaummach", "textures/misc/portal.png")
|
||||
);
|
||||
}
|
||||
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setBrightness(220);
|
||||
tessellator.setColorRGBA_F(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
tessellator.addVertexWithUV(0.0, 0.0, (double) (seal.pSize * 2.0F), 0.0, 1.0);
|
||||
tessellator.addVertexWithUV(
|
||||
(double) (seal.pSize * 2.0F), 0.0, (double) (seal.pSize * 2.0F), 1.0, 1.0
|
||||
);
|
||||
tessellator.addVertexWithUV((double) (seal.pSize * 2.0F), 0.0, 0.0, 1.0, 0.0);
|
||||
tessellator.addVertexWithUV(0.0, 0.0, 0.0, 0.0, 0.0);
|
||||
tessellator.draw();
|
||||
GL11.glDisable(3042);
|
||||
GL11.glDepthMask(true);
|
||||
GL11.glPopMatrix();
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
GL11.glEnable(2896);
|
||||
}
|
||||
|
||||
public void renderEntityAt(TileSeal seal, double x, double y, double z, float fq) {
|
||||
int a = this.count % 360;
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
this.translateFromOrientation(
|
||||
(double) ((float) x),
|
||||
(double) ((float) y),
|
||||
(double) ((float) z),
|
||||
seal.orientation
|
||||
);
|
||||
GL11.glTranslatef(0.33F, 0.33F, -0.01F);
|
||||
GL11.glScalef(0.33f, 0.33f, 0.33f);
|
||||
mc.getTextureManager().bindTexture(TextureMap.locationBlocksTexture);
|
||||
IIcon icon = TMBlocks.seal.getIcon(0, 0);
|
||||
UtilsFX.renderItemIn2D(
|
||||
Tessellator.instance,
|
||||
icon.getMaxU(),
|
||||
icon.getMinV(),
|
||||
icon.getMinU(),
|
||||
icon.getMaxV(),
|
||||
icon.getIconWidth(),
|
||||
icon.getIconHeight(),
|
||||
0.0625f,
|
||||
128
|
||||
);
|
||||
GL11.glPopMatrix();
|
||||
this.translateFromOrientation(
|
||||
(double) ((float) x),
|
||||
(double) ((float) y),
|
||||
(double) ((float) z),
|
||||
seal.orientation
|
||||
);
|
||||
if (seal.runes[0] != -1) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(0.5F, 0.5F, -0.02f);
|
||||
this.drawSeal(180.0F, 0, seal.runes[0]);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
if (seal.runes[1] != -1) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(0.5F, 0.5F, -0.03f);
|
||||
this.drawSeal((float) (-a), 1, seal.runes[1]);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
if (seal.runes[2] != -1) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(0.5F, 0.5F, -0.03f - this.bob);
|
||||
this.drawSeal((float) a, 2, seal.runes[2]);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
if (seal.runes[0] == 0 && seal.runes[1] == 1 && seal.pSize > 0.0F) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(0.5F, 0.5F, -seal.pSize / 5.0F);
|
||||
this.drawPortal(seal, (float) (-a * 4), x, y, z);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
public void
|
||||
renderTileEntityAt(TileEntity tileentity, double d, double d1, double d2, float f) {
|
||||
this.count = Minecraft.getMinecraft().thePlayer.ticksExisted;
|
||||
this.bob = MathHelper.sin((float) this.count / 10.0F) * 0.025F + 0.03F;
|
||||
this.renderEntityAt((TileSeal) tileentity, d, d1, d2, f);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,90 @@
|
|||
package net.anvilcraft.thaummach.utils;
|
||||
|
||||
public enum HelperFacing {
|
||||
NEGY,
|
||||
POSY,
|
||||
NEGZ,
|
||||
POSZ,
|
||||
NEGX,
|
||||
POSX,
|
||||
UNKNOWN;
|
||||
|
||||
public HelperFacing turnAround() {
|
||||
switch (this) {
|
||||
case POSY: {
|
||||
return HelperFacing.NEGY;
|
||||
}
|
||||
|
||||
case NEGY: {
|
||||
return HelperFacing.POSY;
|
||||
}
|
||||
case POSZ: {
|
||||
return HelperFacing.NEGZ;
|
||||
}
|
||||
case NEGZ: {
|
||||
return HelperFacing.POSZ;
|
||||
}
|
||||
case POSX: {
|
||||
return HelperFacing.NEGX;
|
||||
}
|
||||
case NEGX: {
|
||||
return HelperFacing.POSX;
|
||||
}
|
||||
default: {
|
||||
return HelperFacing.UNKNOWN;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public HelperFacing turnLeft() {
|
||||
switch (this) {
|
||||
case POSY: {
|
||||
return HelperFacing.POSY;
|
||||
}
|
||||
case NEGY: {
|
||||
return HelperFacing.NEGY;
|
||||
}
|
||||
case POSZ: {
|
||||
return HelperFacing.POSX;
|
||||
}
|
||||
case NEGZ: {
|
||||
return HelperFacing.NEGX;
|
||||
}
|
||||
case POSX: {
|
||||
return HelperFacing.NEGZ;
|
||||
}
|
||||
case NEGX: {
|
||||
return HelperFacing.POSZ;
|
||||
}
|
||||
default: {
|
||||
return HelperFacing.UNKNOWN;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public HelperFacing turnRight() {
|
||||
switch (this) {
|
||||
case POSY: {
|
||||
return HelperFacing.POSY;
|
||||
}
|
||||
case NEGY: {
|
||||
return HelperFacing.NEGY;
|
||||
}
|
||||
case POSZ: {
|
||||
return HelperFacing.NEGX;
|
||||
}
|
||||
case NEGZ: {
|
||||
return HelperFacing.POSX;
|
||||
}
|
||||
case POSX: {
|
||||
return HelperFacing.POSZ;
|
||||
}
|
||||
case NEGX: {
|
||||
return HelperFacing.NEGZ;
|
||||
}
|
||||
default: {
|
||||
return HelperFacing.UNKNOWN;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,253 @@
|
|||
package net.anvilcraft.thaummach.utils;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class HelperLocation {
|
||||
public double x;
|
||||
public double y;
|
||||
public double z;
|
||||
public HelperFacing facing;
|
||||
|
||||
public HelperLocation(final TileEntity tile) {
|
||||
this.x = tile.xCoord;
|
||||
this.y = tile.yCoord;
|
||||
this.z = tile.zCoord;
|
||||
this.facing = HelperFacing.UNKNOWN;
|
||||
}
|
||||
|
||||
public HelperLocation(final double x, final double y, final double z) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
this.facing = HelperFacing.UNKNOWN;
|
||||
}
|
||||
|
||||
public HelperLocation(
|
||||
final double x, final double y, final double z, final HelperFacing facing
|
||||
) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
this.facing = facing;
|
||||
}
|
||||
|
||||
public HelperLocation(final TileEntity te, final HelperFacing facing) {
|
||||
this.x = te.xCoord;
|
||||
this.y = te.yCoord;
|
||||
this.z = te.zCoord;
|
||||
this.facing = facing;
|
||||
}
|
||||
|
||||
public HelperLocation(final TileEntity te, final int facing) {
|
||||
this.x = te.xCoord;
|
||||
this.y = te.yCoord;
|
||||
this.z = te.zCoord;
|
||||
switch (facing) {
|
||||
case 0: {
|
||||
this.facing = HelperFacing.NEGY;
|
||||
break;
|
||||
}
|
||||
case 1: {
|
||||
this.facing = HelperFacing.POSY;
|
||||
break;
|
||||
}
|
||||
case 2: {
|
||||
this.facing = HelperFacing.NEGZ;
|
||||
break;
|
||||
}
|
||||
case 3: {
|
||||
this.facing = HelperFacing.POSZ;
|
||||
break;
|
||||
}
|
||||
case 4: {
|
||||
this.facing = HelperFacing.NEGX;
|
||||
break;
|
||||
}
|
||||
case 5: {
|
||||
this.facing = HelperFacing.POSX;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public HelperLocation(final HelperLocation l) {
|
||||
this.x = l.x;
|
||||
this.y = l.y;
|
||||
this.z = l.z;
|
||||
this.facing = l.facing;
|
||||
}
|
||||
|
||||
public void moveUp(final double amount) {
|
||||
switch (this.facing) {
|
||||
case POSZ:
|
||||
case NEGZ:
|
||||
case POSX:
|
||||
case NEGX: {
|
||||
this.y += amount;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void moveDown(final double amount) {
|
||||
switch (this.facing) {
|
||||
case POSZ:
|
||||
case NEGZ:
|
||||
case POSX:
|
||||
case NEGX: {
|
||||
this.y -= amount;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void moveRight(final double amount) {
|
||||
switch (this.facing) {
|
||||
case POSZ: {
|
||||
this.x -= amount;
|
||||
break;
|
||||
}
|
||||
case NEGZ: {
|
||||
this.x += amount;
|
||||
break;
|
||||
}
|
||||
case POSX: {
|
||||
this.z += amount;
|
||||
break;
|
||||
}
|
||||
case NEGX: {
|
||||
this.z -= amount;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void moveLeft(final double amount) {
|
||||
switch (this.facing) {
|
||||
case POSZ: {
|
||||
this.x += amount;
|
||||
break;
|
||||
}
|
||||
case NEGZ: {
|
||||
this.x -= amount;
|
||||
break;
|
||||
}
|
||||
case POSX: {
|
||||
this.z -= amount;
|
||||
break;
|
||||
}
|
||||
case NEGX: {
|
||||
this.z += amount;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void moveForwards(final double amount) {
|
||||
switch (this.facing) {
|
||||
case POSY: {
|
||||
this.y += amount;
|
||||
break;
|
||||
}
|
||||
case NEGY: {
|
||||
this.y -= amount;
|
||||
break;
|
||||
}
|
||||
case POSZ: {
|
||||
this.z += amount;
|
||||
break;
|
||||
}
|
||||
case NEGZ: {
|
||||
this.z -= amount;
|
||||
break;
|
||||
}
|
||||
case POSX: {
|
||||
this.x += amount;
|
||||
break;
|
||||
}
|
||||
case NEGX: {
|
||||
this.x -= amount;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void moveBackwards(final double amount) {
|
||||
switch (this.facing) {
|
||||
case POSY: {
|
||||
this.y -= amount;
|
||||
break;
|
||||
}
|
||||
case NEGY: {
|
||||
this.y += amount;
|
||||
break;
|
||||
}
|
||||
case POSZ: {
|
||||
this.z -= amount;
|
||||
break;
|
||||
}
|
||||
case NEGZ: {
|
||||
this.z += amount;
|
||||
break;
|
||||
}
|
||||
case POSX: {
|
||||
this.x -= amount;
|
||||
break;
|
||||
}
|
||||
case NEGX: {
|
||||
this.x += amount;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: waiting on auracore update
|
||||
//public TileEntity getConnectableTile(final World w) {
|
||||
// this.moveForwards(1.0);
|
||||
// final TileEntity te
|
||||
// = w.getTileEntity((int) this.x, (int) this.y, (int) this.z);
|
||||
// if (te instanceof IConnection
|
||||
// && ((IConnection) te).getConnectable(this.facing.turnAround())) {
|
||||
// return te;
|
||||
// }
|
||||
// return null;
|
||||
//}
|
||||
|
||||
public TileEntity getFacingTile(final World w) {
|
||||
this.moveForwards(1.0);
|
||||
final TileEntity te
|
||||
= w.getTileEntity((int) this.x, (int) this.y, (int) this.z);
|
||||
if (te != null) {
|
||||
return te;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
//public TileEntity getConnectableTile(final IBlockAccess ibc) {
|
||||
// this.moveForwards(1.0);
|
||||
// final TileEntity te
|
||||
// = ibc.getTileEntity((int) this.x, (int) this.y, (int) this.z);
|
||||
// if (te instanceof IConnection
|
||||
// && ((IConnection) te).getConnectable(this.facing.turnAround())) {
|
||||
// return te;
|
||||
// }
|
||||
// return null;
|
||||
//}
|
||||
|
||||
public boolean equals(final HelperLocation loc) {
|
||||
return this.x == loc.x && this.y == loc.y && this.z == loc.z;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,275 @@
|
|||
package net.anvilcraft.thaummach.utils;
|
||||
|
||||
import dev.tilera.auracore.client.FXSparkle;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.world.World;
|
||||
import thaumcraft.client.fx.particles.FXWisp;
|
||||
|
||||
public class UtilsFX {
|
||||
public static void poof(World worldObj, float x, float y, float z) {
|
||||
int puffs = 6;
|
||||
|
||||
for (int a = 0; a < puffs; ++a) {
|
||||
worldObj.spawnParticle(
|
||||
"explode",
|
||||
(double) (x + worldObj.rand.nextFloat()),
|
||||
(double) (y + worldObj.rand.nextFloat()),
|
||||
(double) (z + worldObj.rand.nextFloat()),
|
||||
-0.0,
|
||||
-0.0,
|
||||
-0.0
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
public static void poofUpwards(World w, int x, int y, int z, int color) {
|
||||
int puffs = 10;
|
||||
|
||||
for (int a = 0; a < puffs; ++a) {
|
||||
float xx = (float) x + w.rand.nextFloat();
|
||||
float zz = (float) z + w.rand.nextFloat();
|
||||
FXWisp ef = new FXWisp(
|
||||
w,
|
||||
(double) xx,
|
||||
(double) y,
|
||||
(double) zz,
|
||||
(double) xx,
|
||||
(double) ((float) y + 0.5F + w.rand.nextFloat()),
|
||||
(double) zz,
|
||||
0.3F,
|
||||
color
|
||||
);
|
||||
ef.tinkle = false;
|
||||
ef.shrink = true;
|
||||
Minecraft.getMinecraft().effectRenderer.addEffect(ef);
|
||||
}
|
||||
}
|
||||
|
||||
public static void sparkleDown(World w, int x, int y, int z, int color) {
|
||||
int puffs = 16;
|
||||
|
||||
for (int a = 0; a < puffs; ++a) {
|
||||
float xx = (float) x + w.rand.nextFloat();
|
||||
float zz = (float) z + w.rand.nextFloat();
|
||||
FXSparkle ef = new FXSparkle(
|
||||
w,
|
||||
(double) xx,
|
||||
(double) ((float) y + w.rand.nextFloat() * 0.5F),
|
||||
(double) zz,
|
||||
(double) xx,
|
||||
(double) y,
|
||||
(double) zz,
|
||||
2.0F,
|
||||
color,
|
||||
5
|
||||
);
|
||||
ef.tinkle = true;
|
||||
Minecraft.getMinecraft().effectRenderer.addEffect(ef);
|
||||
}
|
||||
}
|
||||
|
||||
public static void sparkleUp(World w, int x, int y, int z, int color) {
|
||||
int puffs = 16;
|
||||
|
||||
for (int a = 0; a < puffs; ++a) {
|
||||
float xx = (float) x + w.rand.nextFloat();
|
||||
float zz = (float) z + w.rand.nextFloat();
|
||||
FXSparkle ef = new FXSparkle(
|
||||
w,
|
||||
(double) xx,
|
||||
(double) y,
|
||||
(double) zz,
|
||||
(double) xx,
|
||||
(double) ((float) y + w.rand.nextFloat() * 0.5F),
|
||||
(double) zz,
|
||||
2.0F,
|
||||
color,
|
||||
5
|
||||
);
|
||||
ef.tinkle = true;
|
||||
Minecraft.getMinecraft().effectRenderer.addEffect(ef);
|
||||
}
|
||||
}
|
||||
|
||||
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,8 @@ itemGroup.thaummach=Thaumic Machinery
|
|||
|
||||
# ---- BLOCKS ----
|
||||
|
||||
tile.thaummach:seal.name=Arcane Seal
|
||||
|
||||
tile.thaummach:apparatus_fragile_conduit.name=Vis Conduit
|
||||
tile.thaummach:apparatus_fragile_conduit_pump.name=Vis Pump
|
||||
tile.thaummach:apparatus_fragile_conduit_tank.name=Vis Tank
|
||||
|
@ -32,3 +34,10 @@ item.thaummach:focus_3.name=Arcane Focus: Earth
|
|||
item.thaummach:focus_4.name=Arcane Focus: Fire
|
||||
|
||||
item.thaummach:singularity.name=Arcane Singularity
|
||||
|
||||
thaummach:runic_essence.0.name=Runic Essence: Magic
|
||||
thaummach:runic_essence.1.name=Runic Essence: Air
|
||||
thaummach:runic_essence.2.name=Runic Essence: Water
|
||||
thaummach:runic_essence.3.name=Runic Essence: Earth
|
||||
thaummach:runic_essence.4.name=Runic Essence: Fire
|
||||
thaummach:runic_essence.5.name=Runic Essence: Dark
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
{
|
||||
"popen": {
|
||||
"category": "master",
|
||||
"sounds": [
|
||||
{
|
||||
"name": "popen",
|
||||
"stream": false
|
||||
}
|
||||
]
|
||||
},
|
||||
"pclose": {
|
||||
"category": "master",
|
||||
"sounds": [
|
||||
{
|
||||
"name": "pclose",
|
||||
"stream": false
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
After Width: | Height: | Size: 797 B |
After Width: | Height: | Size: 357 B |
After Width: | Height: | Size: 390 B |
After Width: | Height: | Size: 323 B |
After Width: | Height: | Size: 335 B |
After Width: | Height: | Size: 352 B |
After Width: | Height: | Size: 343 B |
After Width: | Height: | Size: 84 KiB |
After Width: | Height: | Size: 70 KiB |
After Width: | Height: | Size: 76 KiB |
After Width: | Height: | Size: 66 KiB |
After Width: | Height: | Size: 62 KiB |
After Width: | Height: | Size: 66 KiB |
After Width: | Height: | Size: 74 KiB |
After Width: | Height: | Size: 39 KiB |
After Width: | Height: | Size: 35 KiB |
After Width: | Height: | Size: 24 KiB |
After Width: | Height: | Size: 36 KiB |
After Width: | Height: | Size: 30 KiB |
After Width: | Height: | Size: 20 KiB |
After Width: | Height: | Size: 63 KiB |
After Width: | Height: | Size: 24 KiB |