Various states of working. Lots of things happening.
This commit is contained in:
parent
1cceeeefc2
commit
a530b67e91
|
@ -9,13 +9,14 @@ import com.pahimar.ee3.knowledge.AbilityRegistry;
|
|||
import com.pahimar.ee3.knowledge.TransmutationKnowledgeRegistry;
|
||||
import com.pahimar.ee3.network.PacketHandler;
|
||||
import com.pahimar.ee3.proxy.IProxy;
|
||||
import com.pahimar.ee3.recipe.AludelRecipeManager;
|
||||
import com.pahimar.ee3.recipe.RecipeRegistry;
|
||||
import com.pahimar.ee3.recipe.RecipesAludel;
|
||||
import com.pahimar.ee3.reference.Messages;
|
||||
import com.pahimar.ee3.reference.Reference;
|
||||
import com.pahimar.ee3.reference.Settings;
|
||||
import com.pahimar.ee3.util.LogHelper;
|
||||
import com.pahimar.ee3.util.SerializationHelper;
|
||||
import com.pahimar.ee3.util.TileEntityDataHelper;
|
||||
import cpw.mods.fml.common.Mod;
|
||||
import cpw.mods.fml.common.Mod.EventHandler;
|
||||
import cpw.mods.fml.common.Mod.Instance;
|
||||
|
@ -73,6 +74,8 @@ public class EquivalentExchange3
|
|||
|
||||
EnergyValues.addDefaultEnergyValues();
|
||||
|
||||
AlchemyArrays.registerAlchemyArrays();
|
||||
|
||||
Abilities.setOresNotLearnable();
|
||||
}
|
||||
|
||||
|
@ -105,7 +108,7 @@ public class EquivalentExchange3
|
|||
public void postInit(FMLPostInitializationEvent event)
|
||||
{
|
||||
RecipeRegistry.getInstance().registerVanillaRecipes();
|
||||
RecipesAludel.registerRecipes();
|
||||
AludelRecipeManager.registerRecipes();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
|
@ -130,6 +133,11 @@ public class EquivalentExchange3
|
|||
return RecipeRegistry.getInstance();
|
||||
}
|
||||
|
||||
public AludelRecipeManager getAludelRecipeManager()
|
||||
{
|
||||
return AludelRecipeManager.getInstance();
|
||||
}
|
||||
|
||||
public AbilityRegistry getAbilityRegistry()
|
||||
{
|
||||
return AbilityRegistry.getInstance();
|
||||
|
@ -144,4 +152,9 @@ public class EquivalentExchange3
|
|||
{
|
||||
return TransmutationKnowledgeRegistry.getInstance();
|
||||
}
|
||||
|
||||
public TileEntityDataHelper getTileEntityDataHelper()
|
||||
{
|
||||
return TileEntityDataHelper.getInstance();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ import net.minecraft.util.ResourceLocation;
|
|||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
// TODO Switch bare Strings to String constants
|
||||
public class AlchemyArray implements Comparable<AlchemyArray>
|
||||
{
|
||||
private ResourceLocation texture;
|
||||
|
@ -32,6 +33,11 @@ public class AlchemyArray implements Comparable<AlchemyArray>
|
|||
return unLocalizedName;
|
||||
}
|
||||
|
||||
public String getDisplayName()
|
||||
{
|
||||
return StatCollector.translateToLocal(unLocalizedName);
|
||||
}
|
||||
|
||||
public void readFromNBT(NBTTagCompound nbtTagCompound)
|
||||
{
|
||||
if (nbtTagCompound != null)
|
||||
|
@ -68,24 +74,18 @@ public class AlchemyArray implements Comparable<AlchemyArray>
|
|||
nbtTagCompound.setString("unLocalizedName", unLocalizedName);
|
||||
}
|
||||
|
||||
public static AlchemyArray readGlyphFromNBT(NBTTagCompound nbtTagCompound)
|
||||
public static AlchemyArray readArrayFromNBT(NBTTagCompound nbtTagCompound)
|
||||
{
|
||||
AlchemyArray alchemyArray = new AlchemyArray();
|
||||
alchemyArray.readFromNBT(nbtTagCompound);
|
||||
return alchemyArray;
|
||||
}
|
||||
|
||||
public void onAlchemyArrayActivated(World world, int x, int y, int z, EntityPlayer entityPlayer, int sideHit, float hitX, float hitY, float hitZ)
|
||||
public void onArrayActivated(World world, int x, int y, int z, EntityPlayer entityPlayer, int sideHit, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return StatCollector.translateToLocal(unLocalizedName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object object)
|
||||
{
|
||||
|
|
|
@ -3,11 +3,37 @@ package com.pahimar.ee3.api;
|
|||
import com.pahimar.ee3.EquivalentExchange3;
|
||||
import cpw.mods.fml.common.Mod;
|
||||
|
||||
import java.util.SortedSet;
|
||||
|
||||
public class AlchemyArrayRegistryProxy
|
||||
{
|
||||
@Mod.Instance("EE3")
|
||||
private static Object ee3Mod;
|
||||
|
||||
public static boolean registerAlchemyArray(AlchemyArray alchemyArray)
|
||||
{
|
||||
init();
|
||||
|
||||
if (ee3Mod != null)
|
||||
{
|
||||
return EE3Wrapper.ee3mod.getAlchemyArrayRegistry().registerAlchemyArray(alchemyArray);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static SortedSet<AlchemyArray> getRegisteredAlchemyArrays()
|
||||
{
|
||||
init();
|
||||
|
||||
if (ee3Mod != null)
|
||||
{
|
||||
return EE3Wrapper.ee3mod.getAlchemyArrayRegistry().getRegisteredAlchemyArrays();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private static class EE3Wrapper
|
||||
{
|
||||
private static EquivalentExchange3 ee3mod;
|
||||
|
|
48
src/main/java/com/pahimar/ee3/api/AludelRecipeProxy.java
Normal file
48
src/main/java/com/pahimar/ee3/api/AludelRecipeProxy.java
Normal file
|
@ -0,0 +1,48 @@
|
|||
package com.pahimar.ee3.api;
|
||||
|
||||
import com.pahimar.ee3.EquivalentExchange3;
|
||||
import cpw.mods.fml.common.Mod;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
// TODO Clean this up and make it more nice for modders. Consider this very volatile for the time being
|
||||
public class AludelRecipeProxy
|
||||
{
|
||||
@Mod.Instance("EE3")
|
||||
private static Object ee3Mod;
|
||||
|
||||
public void addRecipe(ItemStack recipeOutput, ItemStack recipeInputStack, ItemStack recipeInputDust)
|
||||
{
|
||||
init();
|
||||
|
||||
if (ee3Mod != null)
|
||||
{
|
||||
EE3Wrapper.ee3mod.getAludelRecipeManager().addRecipe(recipeOutput, recipeInputStack, recipeInputDust);
|
||||
}
|
||||
}
|
||||
|
||||
public ItemStack getResult(ItemStack recipeInputStack, ItemStack recipeInputDust)
|
||||
{
|
||||
init();
|
||||
|
||||
if (ee3Mod != null)
|
||||
{
|
||||
return EE3Wrapper.ee3mod.getAludelRecipeManager().getResult(recipeInputStack, recipeInputDust);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
private static class EE3Wrapper
|
||||
{
|
||||
private static EquivalentExchange3 ee3mod;
|
||||
}
|
||||
|
||||
private static void init()
|
||||
{
|
||||
if (ee3Mod != null)
|
||||
{
|
||||
EE3Wrapper.ee3mod = (EquivalentExchange3) ee3Mod;
|
||||
}
|
||||
}
|
||||
}
|
90
src/main/java/com/pahimar/ee3/api/TileEntityDataProxy.java
Normal file
90
src/main/java/com/pahimar/ee3/api/TileEntityDataProxy.java
Normal file
|
@ -0,0 +1,90 @@
|
|||
package com.pahimar.ee3.api;
|
||||
|
||||
import com.pahimar.ee3.EquivalentExchange3;
|
||||
import com.pahimar.ee3.tileentity.TileEntityEE;
|
||||
import cpw.mods.fml.common.Mod;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public class TileEntityDataProxy
|
||||
{
|
||||
@Mod.Instance("EE3")
|
||||
private static Object ee3Mod;
|
||||
|
||||
public static Class getTileEntityClass(World world, int xCoord, int yCoord, int zCoord)
|
||||
{
|
||||
init();
|
||||
|
||||
if (ee3Mod != null)
|
||||
{
|
||||
return EE3Wrapper.ee3mod.getTileEntityDataHelper().getTileEntityClass(world, xCoord, yCoord, zCoord);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static ForgeDirection getOrientation(World world, int xCoord, int yCoord, int zCoord)
|
||||
{
|
||||
if (!world.isRemote && world.getTileEntity(xCoord, yCoord, zCoord) instanceof TileEntityEE)
|
||||
{
|
||||
return ((TileEntityEE) world.getTileEntity(xCoord, yCoord, zCoord)).getOrientation();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static short getState(World world, int xCoord, int yCoord, int zCoord)
|
||||
{
|
||||
if (!world.isRemote && world.getTileEntity(xCoord, yCoord, zCoord) instanceof TileEntityEE)
|
||||
{
|
||||
return ((TileEntityEE) world.getTileEntity(xCoord, yCoord, zCoord)).getState();
|
||||
}
|
||||
|
||||
return Short.MIN_VALUE;
|
||||
}
|
||||
|
||||
public static String getCustomName(World world, int xCoord, int yCoord, int zCoord)
|
||||
{
|
||||
if (!world.isRemote && world.getTileEntity(xCoord, yCoord, zCoord) instanceof TileEntityEE)
|
||||
{
|
||||
return ((TileEntityEE) world.getTileEntity(xCoord, yCoord, zCoord)).getCustomName();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static UUID getOwnerUUID(World world, int xCoord, int yCoord, int zCoord)
|
||||
{
|
||||
if (!world.isRemote && world.getTileEntity(xCoord, yCoord, zCoord) instanceof TileEntityEE)
|
||||
{
|
||||
return ((TileEntityEE) world.getTileEntity(xCoord, yCoord, zCoord)).getOwnerUUID();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static String getOwnerName(World world, int xCoord, int yCoord, int zCoord)
|
||||
{
|
||||
if (!world.isRemote && world.getTileEntity(xCoord, yCoord, zCoord) instanceof TileEntityEE)
|
||||
{
|
||||
return ((TileEntityEE) world.getTileEntity(xCoord, yCoord, zCoord)).getOwnerName();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private static class EE3Wrapper
|
||||
{
|
||||
private static EquivalentExchange3 ee3mod;
|
||||
}
|
||||
|
||||
private static void init()
|
||||
{
|
||||
if (ee3Mod != null)
|
||||
{
|
||||
EE3Wrapper.ee3mod = (EquivalentExchange3) ee3Mod;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -31,6 +31,22 @@ public class AlchemyArrayRegistry
|
|||
registeredAlchemyArrays = new TreeSet<AlchemyArray>();
|
||||
}
|
||||
|
||||
public AlchemyArray getAlchemyArray(int index)
|
||||
{
|
||||
if (registeredAlchemyArrays != null)
|
||||
{
|
||||
AlchemyArray[] alchemyArrays = new AlchemyArray[0];
|
||||
alchemyArrays = registeredAlchemyArrays.toArray(alchemyArrays);
|
||||
|
||||
if (index < alchemyArrays.length)
|
||||
{
|
||||
return alchemyArrays[index];
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public SortedSet<AlchemyArray> getRegisteredAlchemyArrays()
|
||||
{
|
||||
return ImmutableSortedSet.copyOf(registeredAlchemyArrays);
|
||||
|
|
22
src/main/java/com/pahimar/ee3/array/BasicAlchemyArray.java
Normal file
22
src/main/java/com/pahimar/ee3/array/BasicAlchemyArray.java
Normal file
|
@ -0,0 +1,22 @@
|
|||
package com.pahimar.ee3.array;
|
||||
|
||||
import com.pahimar.ee3.api.AlchemyArray;
|
||||
import com.pahimar.ee3.reference.Names;
|
||||
import com.pahimar.ee3.reference.Textures;
|
||||
import com.pahimar.ee3.util.LogHelper;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BasicAlchemyArray extends AlchemyArray
|
||||
{
|
||||
public BasicAlchemyArray()
|
||||
{
|
||||
super(Textures.AlchemyArray.BASIC_ALCHEMY_ARRAY, Names.AlchemyArrays.BASIC_ALCHEMY_ARRAY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onArrayActivated(World world, int x, int y, int z, EntityPlayer entityPlayer, int sideHit, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
LogHelper.info("You attempted to perform alchemy!");
|
||||
}
|
||||
}
|
189
src/main/java/com/pahimar/ee3/block/BlockAlchemyArray.java
Normal file
189
src/main/java/com/pahimar/ee3/block/BlockAlchemyArray.java
Normal file
|
@ -0,0 +1,189 @@
|
|||
package com.pahimar.ee3.block;
|
||||
|
||||
import com.pahimar.ee3.api.AlchemyArray;
|
||||
import com.pahimar.ee3.array.AlchemyArrayRegistry;
|
||||
import com.pahimar.ee3.reference.Names;
|
||||
import com.pahimar.ee3.reference.RenderIds;
|
||||
import com.pahimar.ee3.settings.ChalkSettings;
|
||||
import com.pahimar.ee3.tileentity.TileEntityAlchemyArray;
|
||||
import com.pahimar.ee3.tileentity.TileEntityEE;
|
||||
import com.pahimar.ee3.util.CommonSoundHelper;
|
||||
import com.pahimar.ee3.util.EntityHelper;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.ITileEntityProvider;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockAlchemyArray extends BlockEE implements ITileEntityProvider
|
||||
{
|
||||
public BlockAlchemyArray()
|
||||
{
|
||||
super(Material.circuits);
|
||||
this.setCreativeTab(null);
|
||||
this.setBlockName(Names.Blocks.BASIC_ALCHEMY_ARRAY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType()
|
||||
{
|
||||
return RenderIds.alchemyArray;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getItemDropped(int par1, Random random, int par2)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canPlaceBlockAt(World world, int x, int y, int z)
|
||||
{
|
||||
return world.getBlock(x, y, z).isReplaceable(world, x, y, z) && (world.isSideSolid(x - 1, y, z, ForgeDirection.EAST) ||
|
||||
world.isSideSolid(x + 1, y, z, ForgeDirection.WEST) ||
|
||||
world.isSideSolid(x, y, z - 1, ForgeDirection.SOUTH) ||
|
||||
world.isSideSolid(x, y, z + 1, ForgeDirection.NORTH) ||
|
||||
world.isSideSolid(x, y - 1, z, ForgeDirection.UP) ||
|
||||
world.isSideSolid(x, y + 1, z, ForgeDirection.DOWN));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canPlaceBlockOnSide(World world, int x, int y, int z, int sideHit)
|
||||
{
|
||||
ForgeDirection side = ForgeDirection.getOrientation(sideHit);
|
||||
return world.getBlock(x, y, z).isReplaceable(world, x, y, z) && ((side == ForgeDirection.DOWN && world.isSideSolid(x, y + 1, z, ForgeDirection.DOWN)) ||
|
||||
(side == ForgeDirection.UP && world.isSideSolid(x, y - 1, z, ForgeDirection.UP)) ||
|
||||
(side == ForgeDirection.NORTH && world.isSideSolid(x, y, z + 1, ForgeDirection.NORTH)) ||
|
||||
(side == ForgeDirection.SOUTH && world.isSideSolid(x, y, z - 1, ForgeDirection.SOUTH)) ||
|
||||
(side == ForgeDirection.WEST && world.isSideSolid(x + 1, y, z, ForgeDirection.WEST)) ||
|
||||
(side == ForgeDirection.EAST && world.isSideSolid(x - 1, y, z, ForgeDirection.EAST)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSideSolid(IBlockAccess world, int x, int y, int z, ForgeDirection side)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isReplaceable(IBlockAccess world, int x, int y, int z)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNeighborBlockChange(World world, int x, int y, int z, Block block)
|
||||
{
|
||||
if (!world.isRemote && world.getTileEntity(x, y, z) instanceof TileEntityAlchemyArray)
|
||||
{
|
||||
TileEntityAlchemyArray tileEntityAlchemyArray = (TileEntityAlchemyArray) world.getTileEntity(x, y, z);
|
||||
boolean invalidateAlchemyArray = false;
|
||||
|
||||
if (tileEntityAlchemyArray.getOrientation() == ForgeDirection.UP && !world.isSideSolid(x, y - 1, z, ForgeDirection.UP, true))
|
||||
{
|
||||
invalidateAlchemyArray = true;
|
||||
}
|
||||
else if (tileEntityAlchemyArray.getOrientation() == ForgeDirection.DOWN && !world.isSideSolid(x, y + 1, z, ForgeDirection.DOWN, true))
|
||||
{
|
||||
invalidateAlchemyArray = true;
|
||||
}
|
||||
else if (tileEntityAlchemyArray.getOrientation() == ForgeDirection.NORTH && !world.isSideSolid(x, y, z + 1, ForgeDirection.NORTH, true))
|
||||
{
|
||||
invalidateAlchemyArray = true;
|
||||
}
|
||||
else if (tileEntityAlchemyArray.getOrientation() == ForgeDirection.SOUTH && !world.isSideSolid(x, y, z - 1, ForgeDirection.SOUTH, true))
|
||||
{
|
||||
invalidateAlchemyArray = true;
|
||||
}
|
||||
else if (tileEntityAlchemyArray.getOrientation() == ForgeDirection.EAST && !world.isSideSolid(x - 1, y, z, ForgeDirection.EAST, true))
|
||||
{
|
||||
invalidateAlchemyArray = true;
|
||||
}
|
||||
else if (tileEntityAlchemyArray.getOrientation() == ForgeDirection.WEST && !world.isSideSolid(x + 1, y, z, ForgeDirection.WEST, true))
|
||||
{
|
||||
invalidateAlchemyArray = true;
|
||||
}
|
||||
|
||||
if (invalidateAlchemyArray)
|
||||
{
|
||||
tileEntityAlchemyArray.invalidate();
|
||||
world.setBlockToAir(x, y, z);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int onBlockPlaced(World world, int x, int y, int z, int sideHit, float hitX, float hitY, float hitZ, int metaData)
|
||||
{
|
||||
return sideHit;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entityLiving, ItemStack itemStack)
|
||||
{
|
||||
((TileEntityEE) world.getTileEntity(x, y, z)).setOrientation(world.getBlockMetadata(x, y, z));
|
||||
|
||||
if (!world.isRemote && world.getTileEntity(x, y, z) instanceof TileEntityAlchemyArray && entityLiving instanceof EntityPlayer)
|
||||
{
|
||||
NBTTagCompound customEntityData = EntityHelper.getCustomEntityData(entityLiving);
|
||||
ChalkSettings chalkSettings = new ChalkSettings();
|
||||
chalkSettings.readFromNBT(customEntityData);
|
||||
AlchemyArray alchemyArray = AlchemyArrayRegistry.getInstance().getAlchemyArray(chalkSettings.getIndex());
|
||||
|
||||
if (alchemyArray != null)
|
||||
{
|
||||
// Set adjusted rotation
|
||||
int facing = MathHelper.floor_double(entityLiving.rotationYaw * 4.0F / 360.0F + 0.5D) & 3;
|
||||
((TileEntityAlchemyArray) world.getTileEntity(x, y, z)).setRotation(chalkSettings.getRotation(), facing);
|
||||
((TileEntityAlchemyArray) world.getTileEntity(x, y, z)).setAlchemyArray(alchemyArray, chalkSettings.getSize());
|
||||
CommonSoundHelper.playChalkSoundAt((EntityPlayer) entityLiving);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer entityPlayer, int sideHit, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
if (!world.isRemote && world.getTileEntity(x, y, z) instanceof TileEntityAlchemyArray && !entityPlayer.isSneaking())
|
||||
{
|
||||
((TileEntityAlchemyArray) world.getTileEntity(x, y, z)).onBlockActivated(world, x, y, z, entityPlayer, sideHit, hitX, hitY, hitZ);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int metaData)
|
||||
{
|
||||
return new TileEntityAlchemyArray();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
package com.pahimar.ee3.block;
|
||||
|
||||
import com.pahimar.ee3.reference.Names;
|
||||
import net.minecraft.block.material.Material;
|
||||
|
||||
public class BlockAshInfusedStone extends BlockEE
|
||||
{
|
||||
public BlockAshInfusedStone()
|
||||
{
|
||||
super(Material.rock);
|
||||
this.setBlockName(Names.Blocks.ASH_INFUSED_STONE);
|
||||
this.setHardness(1.5f);
|
||||
this.setResistance(10.0f);
|
||||
this.setStepSound(soundTypeStone);
|
||||
}
|
||||
}
|
248
src/main/java/com/pahimar/ee3/block/BlockDummyArray.java
Normal file
248
src/main/java/com/pahimar/ee3/block/BlockDummyArray.java
Normal file
|
@ -0,0 +1,248 @@
|
|||
package com.pahimar.ee3.block;
|
||||
|
||||
import com.pahimar.ee3.reference.Names;
|
||||
import com.pahimar.ee3.reference.RenderIds;
|
||||
import com.pahimar.ee3.tileentity.TileEntityAlchemyArray;
|
||||
import com.pahimar.ee3.tileentity.TileEntityDummyArray;
|
||||
import com.pahimar.ee3.tileentity.TileEntityEE;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.ITileEntityProvider;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockDummyArray extends BlockEE implements ITileEntityProvider
|
||||
{
|
||||
public BlockDummyArray()
|
||||
{
|
||||
super(Material.circuits);
|
||||
setCreativeTab(null);
|
||||
this.setBlockName(Names.Blocks.DUMMY_ALCHEMY_ARRAY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType()
|
||||
{
|
||||
return RenderIds.dummyArray;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSideSolid(IBlockAccess world, int x, int y, int z, ForgeDirection side)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isReplaceable(IBlockAccess world, int x, int y, int z)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canPlaceBlockAt(World world, int x, int y, int z)
|
||||
{
|
||||
return world.getBlock(x, y, z).isReplaceable(world, x, y, z) && (world.isSideSolid(x - 1, y, z, ForgeDirection.EAST) ||
|
||||
world.isSideSolid(x + 1, y, z, ForgeDirection.WEST) ||
|
||||
world.isSideSolid(x, y, z - 1, ForgeDirection.SOUTH) ||
|
||||
world.isSideSolid(x, y, z + 1, ForgeDirection.NORTH) ||
|
||||
world.isSideSolid(x, y - 1, z, ForgeDirection.UP) ||
|
||||
world.isSideSolid(x, y + 1, z, ForgeDirection.DOWN));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canPlaceBlockOnSide(World world, int x, int y, int z, int sideHit)
|
||||
{
|
||||
ForgeDirection side = ForgeDirection.getOrientation(sideHit);
|
||||
return world.getBlock(x, y, z).isReplaceable(world, x, y, z) && ((side == ForgeDirection.DOWN && world.isSideSolid(x, y + 1, z, ForgeDirection.DOWN)) ||
|
||||
(side == ForgeDirection.UP && world.isSideSolid(x, y - 1, z, ForgeDirection.UP)) ||
|
||||
(side == ForgeDirection.NORTH && world.isSideSolid(x, y, z + 1, ForgeDirection.NORTH)) ||
|
||||
(side == ForgeDirection.SOUTH && world.isSideSolid(x, y, z - 1, ForgeDirection.SOUTH)) ||
|
||||
(side == ForgeDirection.WEST && world.isSideSolid(x + 1, y, z, ForgeDirection.WEST)) ||
|
||||
(side == ForgeDirection.EAST && world.isSideSolid(x - 1, y, z, ForgeDirection.EAST)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int onBlockPlaced(World world, int x, int y, int z, int sideHit, float hitX, float hitY, float hitZ, int metaData)
|
||||
{
|
||||
return sideHit;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entityLiving, ItemStack itemStack)
|
||||
{
|
||||
((TileEntityEE) world.getTileEntity(x, y, z)).setOrientation(world.getBlockMetadata(x, y, z));
|
||||
world.setBlockMetadataWithNotify(x, y, z, world.getBlockMetadata(x, y, z), 3);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer entityPlayer, int sideHit, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
if (!world.isRemote && world.getTileEntity(x, y, z) instanceof TileEntityDummyArray)
|
||||
{
|
||||
int trueXCoord = ((TileEntityDummyArray) world.getTileEntity(x, y, z)).getTrueXCoord();
|
||||
int trueYCoord = ((TileEntityDummyArray) world.getTileEntity(x, y, z)).getTrueYCoord();
|
||||
int trueZCoord = ((TileEntityDummyArray) world.getTileEntity(x, y, z)).getTrueZCoord();
|
||||
|
||||
return world.getBlock(trueXCoord, trueYCoord, trueZCoord).onBlockActivated(world, trueXCoord, trueYCoord, trueZCoord, entityPlayer, sideHit, hitX, hitY, hitZ);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNeighborBlockChange(World world, int x, int y, int z, Block block)
|
||||
{
|
||||
if (!world.isRemote && world.getTileEntity(x, y, z) instanceof TileEntityDummyArray)
|
||||
{
|
||||
int trueXCoord = ((TileEntityDummyArray) world.getTileEntity(x, y, z)).getTrueXCoord();
|
||||
int trueYCoord = ((TileEntityDummyArray) world.getTileEntity(x, y, z)).getTrueYCoord();
|
||||
int trueZCoord = ((TileEntityDummyArray) world.getTileEntity(x, y, z)).getTrueZCoord();
|
||||
|
||||
if (world.getTileEntity(trueXCoord, trueYCoord, trueZCoord) instanceof TileEntityAlchemyArray)
|
||||
{
|
||||
TileEntityAlchemyArray tileEntityAlchemyArray = (TileEntityAlchemyArray) world.getTileEntity(trueXCoord, trueYCoord, trueZCoord);
|
||||
boolean invalidateAlchemyArray = false;
|
||||
|
||||
if (tileEntityAlchemyArray.getOrientation() == ForgeDirection.UP && !world.isSideSolid(x, y - 1, z, ForgeDirection.UP, true))
|
||||
{
|
||||
invalidateAlchemyArray = true;
|
||||
}
|
||||
else if (tileEntityAlchemyArray.getOrientation() == ForgeDirection.DOWN && !world.isSideSolid(x, y + 1, z, ForgeDirection.DOWN, true))
|
||||
{
|
||||
invalidateAlchemyArray = true;
|
||||
}
|
||||
else if (tileEntityAlchemyArray.getOrientation() == ForgeDirection.NORTH && !world.isSideSolid(x, y, z + 1, ForgeDirection.NORTH, true))
|
||||
{
|
||||
invalidateAlchemyArray = true;
|
||||
}
|
||||
else if (tileEntityAlchemyArray.getOrientation() == ForgeDirection.SOUTH && !world.isSideSolid(x, y, z - 1, ForgeDirection.SOUTH, true))
|
||||
{
|
||||
invalidateAlchemyArray = true;
|
||||
}
|
||||
else if (tileEntityAlchemyArray.getOrientation() == ForgeDirection.EAST && !world.isSideSolid(x - 1, y, z, ForgeDirection.EAST, true))
|
||||
{
|
||||
invalidateAlchemyArray = true;
|
||||
}
|
||||
else if (tileEntityAlchemyArray.getOrientation() == ForgeDirection.WEST && !world.isSideSolid(x + 1, y, z, ForgeDirection.WEST, true))
|
||||
{
|
||||
invalidateAlchemyArray = true;
|
||||
}
|
||||
|
||||
if (invalidateAlchemyArray)
|
||||
{
|
||||
world.getTileEntity(x, y, z).invalidate();
|
||||
tileEntityAlchemyArray.invalidate();
|
||||
world.setBlockToAir(x, y, z);
|
||||
world.setBlockToAir(trueXCoord, trueYCoord, trueZCoord);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getItemDropped(int par1, Random random, int par2)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MovingObjectPosition collisionRayTrace(World world, int x, int y, int z, Vec3 startVec, Vec3 endVec)
|
||||
{
|
||||
if (world.getTileEntity(x, y, z) instanceof TileEntityDummyArray)
|
||||
{
|
||||
TileEntityDummyArray tileEntityDummyArray = (TileEntityDummyArray) world.getTileEntity(x, y, z);
|
||||
|
||||
switch (tileEntityDummyArray.getOrientation())
|
||||
{
|
||||
case DOWN:
|
||||
{
|
||||
this.setBlockBounds(0f, 1f, 0f, 1f, 1 - 0.0625f, 1f);
|
||||
break;
|
||||
}
|
||||
case UP:
|
||||
{
|
||||
this.setBlockBounds(0f, 0f, 0f, 1f, 0.0625f, 1f);
|
||||
break;
|
||||
}
|
||||
case NORTH:
|
||||
{
|
||||
this.setBlockBounds(0f, 0f, 1 - 0.0625f, 1f, 1f, 1f);
|
||||
break;
|
||||
}
|
||||
case SOUTH:
|
||||
{
|
||||
this.setBlockBounds(0f, 0f, 0f, 1f, 1f, 0.0625f);
|
||||
break;
|
||||
}
|
||||
case EAST:
|
||||
{
|
||||
this.setBlockBounds(0f, 0f, 0f, 0.0625f, 1f, 1f);
|
||||
break;
|
||||
}
|
||||
case WEST:
|
||||
{
|
||||
this.setBlockBounds(1f, 0f, 0f, 1 - 0.0625f, 1f, 1f);
|
||||
break;
|
||||
}
|
||||
case UNKNOWN:
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return super.collisionRayTrace(world, x, y, z, startVec, endVec);
|
||||
}
|
||||
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int metaData)
|
||||
{
|
||||
if (world.getTileEntity(x, y, z) instanceof TileEntityDummyArray)
|
||||
{
|
||||
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||
super.breakBlock(world, ((TileEntityDummyArray) tileEntity).getTrueXCoord(), ((TileEntityDummyArray) tileEntity).getTrueYCoord(), ((TileEntityDummyArray) tileEntity).getTrueZCoord(), block, metaData);
|
||||
}
|
||||
super.breakBlock(world, x, y, z, block, metaData);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a new instance of a block's tile entity class. Called on placing the block.
|
||||
*
|
||||
* @param world
|
||||
* @param metaData
|
||||
*/
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int metaData)
|
||||
{
|
||||
return new TileEntityDummyArray();
|
||||
}
|
||||
}
|
|
@ -18,19 +18,19 @@ public class KeyInputEventHandler
|
|||
{
|
||||
private static Key getPressedKeybinding()
|
||||
{
|
||||
if (Keybindings.charge.isPressed())
|
||||
if (Keybindings.charge.getIsKeyPressed())
|
||||
{
|
||||
return Key.CHARGE;
|
||||
}
|
||||
else if (Keybindings.extra.isPressed())
|
||||
else if (Keybindings.extra.getIsKeyPressed())
|
||||
{
|
||||
return Key.EXTRA;
|
||||
}
|
||||
else if (Keybindings.release.isPressed())
|
||||
else if (Keybindings.release.getIsKeyPressed())
|
||||
{
|
||||
return Key.RELEASE;
|
||||
}
|
||||
else if (Keybindings.toggle.isPressed())
|
||||
else if (Keybindings.toggle.getIsKeyPressed())
|
||||
{
|
||||
return Key.TOGGLE;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,190 @@
|
|||
package com.pahimar.ee3.client.renderer.tileentity;
|
||||
|
||||
import com.pahimar.ee3.api.AlchemyArray;
|
||||
import com.pahimar.ee3.client.util.RenderUtils;
|
||||
import com.pahimar.ee3.tileentity.TileEntityAlchemyArray;
|
||||
import cpw.mods.fml.client.FMLClientHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class TileEntityRendererAlchemyArray extends TileEntitySpecialRenderer
|
||||
{
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float tick)
|
||||
{
|
||||
if (tileEntity instanceof TileEntityAlchemyArray)
|
||||
{
|
||||
TileEntityAlchemyArray tileEntityAlchemyArray = (TileEntityAlchemyArray) FMLClientHandler.instance().getClient().theWorld.getTileEntity(tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord);
|
||||
|
||||
int scale;
|
||||
double xShift = 0.5d, yShift = 0.5d, zShift = 0.5d;
|
||||
float xRotate = 0, yRotate = 0, zRotate = 0;
|
||||
int rotationAngle = 0;
|
||||
|
||||
AlchemyArray alchemyArray = tileEntityAlchemyArray.getAlchemyArray();
|
||||
scale = tileEntityAlchemyArray.getSize();
|
||||
|
||||
if (alchemyArray != null)
|
||||
{
|
||||
GL11.glDisable(GL11.GL_CULL_FACE);
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glPushMatrix();
|
||||
|
||||
GL11.glDepthMask(false);
|
||||
GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
if (tileEntityAlchemyArray.getOrientation() == ForgeDirection.UP)
|
||||
{
|
||||
if (tileEntityAlchemyArray.getRotation() == ForgeDirection.NORTH)
|
||||
{
|
||||
rotationAngle = 0;
|
||||
}
|
||||
else if (tileEntityAlchemyArray.getRotation() == ForgeDirection.EAST)
|
||||
{
|
||||
rotationAngle = -90;
|
||||
}
|
||||
else if (tileEntityAlchemyArray.getRotation() == ForgeDirection.SOUTH)
|
||||
{
|
||||
rotationAngle = 180;
|
||||
}
|
||||
else if (tileEntityAlchemyArray.getRotation() == ForgeDirection.WEST)
|
||||
{
|
||||
rotationAngle = 90;
|
||||
}
|
||||
|
||||
yShift = 0.001d;
|
||||
xRotate = -1;
|
||||
}
|
||||
else if (tileEntityAlchemyArray.getOrientation() == ForgeDirection.DOWN)
|
||||
{
|
||||
if (tileEntityAlchemyArray.getRotation() == ForgeDirection.NORTH)
|
||||
{
|
||||
rotationAngle = 0;
|
||||
}
|
||||
else if (tileEntityAlchemyArray.getRotation() == ForgeDirection.EAST)
|
||||
{
|
||||
rotationAngle = -90;
|
||||
}
|
||||
else if (tileEntityAlchemyArray.getRotation() == ForgeDirection.SOUTH)
|
||||
{
|
||||
rotationAngle = 180;
|
||||
}
|
||||
else if (tileEntityAlchemyArray.getRotation() == ForgeDirection.WEST)
|
||||
{
|
||||
rotationAngle = 90;
|
||||
}
|
||||
|
||||
yShift = 0.999d;
|
||||
xRotate = 1;
|
||||
}
|
||||
else if (tileEntityAlchemyArray.getOrientation() == ForgeDirection.NORTH)
|
||||
{
|
||||
if (tileEntityAlchemyArray.getRotation() == ForgeDirection.UP)
|
||||
{
|
||||
rotationAngle = -90;
|
||||
}
|
||||
else if (tileEntityAlchemyArray.getRotation() == ForgeDirection.EAST)
|
||||
{
|
||||
rotationAngle = -180;
|
||||
}
|
||||
else if (tileEntityAlchemyArray.getRotation() == ForgeDirection.DOWN)
|
||||
{
|
||||
rotationAngle = 90;
|
||||
}
|
||||
else if (tileEntityAlchemyArray.getRotation() == ForgeDirection.WEST)
|
||||
{
|
||||
rotationAngle = 0;
|
||||
}
|
||||
|
||||
zRotate = 1;
|
||||
zShift = 0.999d;
|
||||
}
|
||||
else if (tileEntityAlchemyArray.getOrientation() == ForgeDirection.SOUTH)
|
||||
{
|
||||
if (tileEntityAlchemyArray.getRotation() == ForgeDirection.UP)
|
||||
{
|
||||
rotationAngle = -90;
|
||||
}
|
||||
else if (tileEntityAlchemyArray.getRotation() == ForgeDirection.EAST)
|
||||
{
|
||||
rotationAngle = 0;
|
||||
}
|
||||
else if (tileEntityAlchemyArray.getRotation() == ForgeDirection.DOWN)
|
||||
{
|
||||
rotationAngle = 90;
|
||||
}
|
||||
else if (tileEntityAlchemyArray.getRotation() == ForgeDirection.WEST)
|
||||
{
|
||||
rotationAngle = -180;
|
||||
}
|
||||
|
||||
zRotate = -1;
|
||||
zShift = 0.001d;
|
||||
}
|
||||
else if (tileEntityAlchemyArray.getOrientation() == ForgeDirection.EAST)
|
||||
{
|
||||
if (tileEntityAlchemyArray.getRotation() == ForgeDirection.UP)
|
||||
{
|
||||
rotationAngle = 180;
|
||||
}
|
||||
else if (tileEntityAlchemyArray.getRotation() == ForgeDirection.DOWN)
|
||||
{
|
||||
rotationAngle = 0;
|
||||
}
|
||||
else if (tileEntityAlchemyArray.getRotation() == ForgeDirection.NORTH)
|
||||
{
|
||||
rotationAngle = -90;
|
||||
}
|
||||
else if (tileEntityAlchemyArray.getRotation() == ForgeDirection.SOUTH)
|
||||
{
|
||||
rotationAngle = 90;
|
||||
}
|
||||
|
||||
yRotate = 1;
|
||||
xShift = 0.001d;
|
||||
}
|
||||
else if (tileEntityAlchemyArray.getOrientation() == ForgeDirection.WEST)
|
||||
{
|
||||
if (tileEntityAlchemyArray.getRotation() == ForgeDirection.UP)
|
||||
{
|
||||
rotationAngle = 180;
|
||||
}
|
||||
else if (tileEntityAlchemyArray.getRotation() == ForgeDirection.DOWN)
|
||||
{
|
||||
rotationAngle = 0;
|
||||
}
|
||||
else if (tileEntityAlchemyArray.getRotation() == ForgeDirection.NORTH)
|
||||
{
|
||||
rotationAngle = 90;
|
||||
}
|
||||
else if (tileEntityAlchemyArray.getRotation() == ForgeDirection.SOUTH)
|
||||
{
|
||||
rotationAngle = -90;
|
||||
}
|
||||
|
||||
yRotate = -1;
|
||||
xShift = 0.999d;
|
||||
}
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(x + xShift, y + yShift, z + zShift);
|
||||
GL11.glScalef(1f * scale, 1f * scale, 1f * scale);
|
||||
GL11.glRotatef(rotationAngle, tileEntityAlchemyArray.getOrientation().offsetX, tileEntityAlchemyArray.getOrientation().offsetY, tileEntityAlchemyArray.getOrientation().offsetZ);
|
||||
GL11.glRotatef(90, xRotate, yRotate, zRotate);
|
||||
RenderUtils.renderQuad(alchemyArray.getTexture());
|
||||
GL11.glPopMatrix();
|
||||
|
||||
GL11.glDepthMask(true);
|
||||
|
||||
GL11.glPopMatrix();
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glEnable(GL11.GL_CULL_FACE);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -3,18 +3,17 @@ package com.pahimar.ee3.handler;
|
|||
import com.pahimar.ee3.exchange.EnergyValueRegistry;
|
||||
import com.pahimar.ee3.knowledge.TransmutationKnowledgeRegistry;
|
||||
import com.pahimar.ee3.network.PacketHandler;
|
||||
import com.pahimar.ee3.network.message.MessageChalkSettings;
|
||||
import com.pahimar.ee3.network.message.MessageSyncEnergyValues;
|
||||
import com.pahimar.ee3.settings.ChalkSettings;
|
||||
import com.pahimar.ee3.util.EntityHelper;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.event.entity.player.PlayerEvent;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public class PlayerEventHandler
|
||||
{
|
||||
public static File playerDataDirectory;
|
||||
public static File knowledgeDirectory;
|
||||
|
||||
@SubscribeEvent
|
||||
public void onPlayerLoadFromFileEvent(PlayerEvent.LoadFromFile event)
|
||||
{
|
||||
|
@ -36,8 +35,21 @@ public class PlayerEventHandler
|
|||
@SubscribeEvent
|
||||
public void onPlayerLoggedIn(cpw.mods.fml.common.gameevent.PlayerEvent.PlayerLoggedInEvent event)
|
||||
{
|
||||
TransmutationKnowledgeRegistry.getInstance().loadPlayerFromDiskIfNeeded(event.player);
|
||||
PacketHandler.INSTANCE.sendTo(new MessageSyncEnergyValues(EnergyValueRegistry.getInstance()), (EntityPlayerMP) event.player);
|
||||
if (event.player != null)
|
||||
{
|
||||
NBTTagCompound playerCustomData = EntityHelper.getCustomEntityData(event.player);
|
||||
|
||||
// Chalk Settings
|
||||
ChalkSettings chalkSettings = new ChalkSettings();
|
||||
chalkSettings.readFromNBT(playerCustomData);
|
||||
chalkSettings.writeToNBT(playerCustomData);
|
||||
EntityHelper.saveCustomEntityData(event.player, playerCustomData);
|
||||
PacketHandler.INSTANCE.sendTo(new MessageChalkSettings(chalkSettings), (EntityPlayerMP) event.player);
|
||||
|
||||
TransmutationKnowledgeRegistry.getInstance().loadPlayerFromDiskIfNeeded(event.player);
|
||||
PacketHandler.INSTANCE.sendTo(new MessageSyncEnergyValues(EnergyValueRegistry.getInstance()), (EntityPlayerMP) event.player);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
|
|
15
src/main/java/com/pahimar/ee3/init/AlchemyArrays.java
Normal file
15
src/main/java/com/pahimar/ee3/init/AlchemyArrays.java
Normal file
|
@ -0,0 +1,15 @@
|
|||
package com.pahimar.ee3.init;
|
||||
|
||||
import com.pahimar.ee3.api.AlchemyArray;
|
||||
import com.pahimar.ee3.api.AlchemyArrayRegistryProxy;
|
||||
import com.pahimar.ee3.array.BasicAlchemyArray;
|
||||
|
||||
public class AlchemyArrays
|
||||
{
|
||||
public static final AlchemyArray basicAlchemyArray = new BasicAlchemyArray();
|
||||
|
||||
public static void registerAlchemyArrays()
|
||||
{
|
||||
AlchemyArrayRegistryProxy.registerAlchemyArray(basicAlchemyArray);
|
||||
}
|
||||
}
|
|
@ -18,6 +18,9 @@ public class ModBlocks
|
|||
public static final BlockEE glassBell = new BlockGlassBell();
|
||||
public static final BlockEE researchStation = new BlockResearchStation();
|
||||
public static final BlockEE augmentationTable = new BlockAugmentationTable();
|
||||
public static final BlockEE ashInfusedStone = new BlockAshInfusedStone();
|
||||
public static final BlockEE basicAlchemyArray = new BlockAlchemyArray();
|
||||
public static final BlockEE dummyAlchemyArray = new BlockDummyArray();
|
||||
|
||||
public static void init()
|
||||
{
|
||||
|
@ -29,5 +32,8 @@ public class ModBlocks
|
|||
GameRegistry.registerBlock(alchemicalChest, ItemBlockAlchemicalChest.class, Names.Blocks.ALCHEMICAL_CHEST);
|
||||
GameRegistry.registerBlock(chalkBlock, Names.Blocks.CHALK);
|
||||
GameRegistry.registerBlock(alchemicalFuelBlock, ItemBlockAlchemicalFuel.class, Names.Blocks.ALCHEMICAL_FUEL);
|
||||
GameRegistry.registerBlock(ashInfusedStone, Names.Blocks.ASH_INFUSED_STONE);
|
||||
GameRegistry.registerBlock(basicAlchemyArray, Names.Blocks.BASIC_ALCHEMY_ARRAY);
|
||||
GameRegistry.registerBlock(dummyAlchemyArray, Names.Blocks.DUMMY_ALCHEMY_ARRAY);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package com.pahimar.ee3.init;
|
||||
|
||||
import com.pahimar.ee3.recipe.RecipesAludel;
|
||||
import com.pahimar.ee3.recipe.AludelRecipeManager;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
|
@ -56,42 +56,45 @@ public class Recipes
|
|||
private static void initAludelRecipes()
|
||||
{
|
||||
// Ash + Verdant = Azure
|
||||
RecipesAludel.getInstance().addRecipe(new ItemStack(ModItems.alchemicalDust, 1, 2), new ItemStack(ModItems.alchemicalDust, 1, 0), new ItemStack(ModItems.alchemicalDust, 32, 1));
|
||||
AludelRecipeManager.getInstance().addRecipe(new ItemStack(ModItems.alchemicalDust, 1, 2), new ItemStack(ModItems.alchemicalDust, 1, 0), new ItemStack(ModItems.alchemicalDust, 32, 1));
|
||||
|
||||
// Ash + Azure = Minium
|
||||
RecipesAludel.getInstance().addRecipe(new ItemStack(ModItems.alchemicalDust, 1, 3), new ItemStack(ModItems.alchemicalDust, 1, 0), new ItemStack(ModItems.alchemicalDust, 4, 2));
|
||||
AludelRecipeManager.getInstance().addRecipe(new ItemStack(ModItems.alchemicalDust, 1, 3), new ItemStack(ModItems.alchemicalDust, 1, 0), new ItemStack(ModItems.alchemicalDust, 4, 2));
|
||||
|
||||
// Alchemical Coal
|
||||
RecipesAludel.getInstance().addRecipe(new ItemStack(ModItems.alchemicalFuel, 1, 0), new ItemStack(Items.coal, 1, 0), new ItemStack(ModItems.alchemicalDust, 32, 1));
|
||||
RecipesAludel.getInstance().addRecipe(new ItemStack(ModItems.alchemicalFuel, 1, 0), new ItemStack(Items.coal, 1, 0), new ItemStack(ModItems.alchemicalDust, 1, 2));
|
||||
RecipesAludel.getInstance().addRecipe(new ItemStack(ModItems.alchemicalFuel, 4, 0), new ItemStack(Items.coal, 4, 0), new ItemStack(ModItems.alchemicalDust, 1, 3));
|
||||
AludelRecipeManager.getInstance().addRecipe(new ItemStack(ModItems.alchemicalFuel, 1, 0), new ItemStack(Items.coal, 1, 0), new ItemStack(ModItems.alchemicalDust, 32, 1));
|
||||
AludelRecipeManager.getInstance().addRecipe(new ItemStack(ModItems.alchemicalFuel, 1, 0), new ItemStack(Items.coal, 1, 0), new ItemStack(ModItems.alchemicalDust, 1, 2));
|
||||
AludelRecipeManager.getInstance().addRecipe(new ItemStack(ModItems.alchemicalFuel, 4, 0), new ItemStack(Items.coal, 4, 0), new ItemStack(ModItems.alchemicalDust, 1, 3));
|
||||
|
||||
// Mobius Fuel
|
||||
RecipesAludel.getInstance().addRecipe(new ItemStack(ModItems.alchemicalFuel, 1, 1), new ItemStack(ModItems.alchemicalFuel, 1, 0), new ItemStack(ModItems.alchemicalDust, 7, 2));
|
||||
RecipesAludel.getInstance().addRecipe(new ItemStack(ModItems.alchemicalFuel, 1, 1), new ItemStack(ModItems.alchemicalFuel, 1, 0), new ItemStack(ModItems.alchemicalDust, 2, 3));
|
||||
AludelRecipeManager.getInstance().addRecipe(new ItemStack(ModItems.alchemicalFuel, 1, 1), new ItemStack(ModItems.alchemicalFuel, 1, 0), new ItemStack(ModItems.alchemicalDust, 7, 2));
|
||||
AludelRecipeManager.getInstance().addRecipe(new ItemStack(ModItems.alchemicalFuel, 1, 1), new ItemStack(ModItems.alchemicalFuel, 1, 0), new ItemStack(ModItems.alchemicalDust, 2, 3));
|
||||
|
||||
// Aeternalis Fuel
|
||||
RecipesAludel.getInstance().addRecipe(new ItemStack(ModItems.alchemicalFuel, 1, 2), new ItemStack(ModItems.alchemicalFuel, 1, 1), new ItemStack(ModItems.alchemicalDust, 56, 2));
|
||||
RecipesAludel.getInstance().addRecipe(new ItemStack(ModItems.alchemicalFuel, 1, 2), new ItemStack(ModItems.alchemicalFuel, 1, 1), new ItemStack(ModItems.alchemicalDust, 14, 3));
|
||||
AludelRecipeManager.getInstance().addRecipe(new ItemStack(ModItems.alchemicalFuel, 1, 2), new ItemStack(ModItems.alchemicalFuel, 1, 1), new ItemStack(ModItems.alchemicalDust, 56, 2));
|
||||
AludelRecipeManager.getInstance().addRecipe(new ItemStack(ModItems.alchemicalFuel, 1, 2), new ItemStack(ModItems.alchemicalFuel, 1, 1), new ItemStack(ModItems.alchemicalDust, 14, 3));
|
||||
|
||||
// Alchemical Chest
|
||||
RecipesAludel.getInstance().addRecipe(new ItemStack(ModBlocks.alchemicalChest, 1, 0), new ItemStack(Blocks.chest, 1, OreDictionary.WILDCARD_VALUE), new ItemStack(ModItems.alchemicalDust, 8, 1));
|
||||
RecipesAludel.getInstance().addRecipe(new ItemStack(ModBlocks.alchemicalChest, 1, 0), new ItemStack(Blocks.trapped_chest, 1, OreDictionary.WILDCARD_VALUE), new ItemStack(ModItems.alchemicalDust, 8, 1));
|
||||
RecipesAludel.getInstance().addRecipe(new ItemStack(ModBlocks.alchemicalChest, 1, 1), new ItemStack(Blocks.chest, 1, OreDictionary.WILDCARD_VALUE), new ItemStack(ModItems.alchemicalDust, 8, 2));
|
||||
RecipesAludel.getInstance().addRecipe(new ItemStack(ModBlocks.alchemicalChest, 1, 1), new ItemStack(ModBlocks.alchemicalChest, 1, 0), new ItemStack(ModItems.alchemicalDust, 8, 2));
|
||||
RecipesAludel.getInstance().addRecipe(new ItemStack(ModBlocks.alchemicalChest, 1, 2), new ItemStack(Blocks.chest, 1, OreDictionary.WILDCARD_VALUE), new ItemStack(ModItems.alchemicalDust, 8, 3));
|
||||
RecipesAludel.getInstance().addRecipe(new ItemStack(ModBlocks.alchemicalChest, 1, 2), new ItemStack(ModBlocks.alchemicalChest, 1, 0), new ItemStack(ModItems.alchemicalDust, 8, 3));
|
||||
RecipesAludel.getInstance().addRecipe(new ItemStack(ModBlocks.alchemicalChest, 1, 2), new ItemStack(ModBlocks.alchemicalChest, 1, 1), new ItemStack(ModItems.alchemicalDust, 8, 3));
|
||||
AludelRecipeManager.getInstance().addRecipe(new ItemStack(ModBlocks.alchemicalChest, 1, 0), new ItemStack(Blocks.chest, 1, OreDictionary.WILDCARD_VALUE), new ItemStack(ModItems.alchemicalDust, 8, 1));
|
||||
AludelRecipeManager.getInstance().addRecipe(new ItemStack(ModBlocks.alchemicalChest, 1, 0), new ItemStack(Blocks.trapped_chest, 1, OreDictionary.WILDCARD_VALUE), new ItemStack(ModItems.alchemicalDust, 8, 1));
|
||||
AludelRecipeManager.getInstance().addRecipe(new ItemStack(ModBlocks.alchemicalChest, 1, 1), new ItemStack(Blocks.chest, 1, OreDictionary.WILDCARD_VALUE), new ItemStack(ModItems.alchemicalDust, 8, 2));
|
||||
AludelRecipeManager.getInstance().addRecipe(new ItemStack(ModBlocks.alchemicalChest, 1, 1), new ItemStack(ModBlocks.alchemicalChest, 1, 0), new ItemStack(ModItems.alchemicalDust, 8, 2));
|
||||
AludelRecipeManager.getInstance().addRecipe(new ItemStack(ModBlocks.alchemicalChest, 1, 2), new ItemStack(Blocks.chest, 1, OreDictionary.WILDCARD_VALUE), new ItemStack(ModItems.alchemicalDust, 8, 3));
|
||||
AludelRecipeManager.getInstance().addRecipe(new ItemStack(ModBlocks.alchemicalChest, 1, 2), new ItemStack(ModBlocks.alchemicalChest, 1, 0), new ItemStack(ModItems.alchemicalDust, 8, 3));
|
||||
AludelRecipeManager.getInstance().addRecipe(new ItemStack(ModBlocks.alchemicalChest, 1, 2), new ItemStack(ModBlocks.alchemicalChest, 1, 1), new ItemStack(ModItems.alchemicalDust, 8, 3));
|
||||
|
||||
// Minium Stone
|
||||
RecipesAludel.getInstance().addRecipe(new ItemStack(ModItems.stoneMinium), new ItemStack(ModItems.stoneInert), new ItemStack(ModItems.alchemicalDust, 8, 3));
|
||||
AludelRecipeManager.getInstance().addRecipe(new ItemStack(ModItems.stoneMinium), new ItemStack(ModItems.stoneInert), new ItemStack(ModItems.alchemicalDust, 8, 3));
|
||||
|
||||
// Tome of Alchemical Knowledge
|
||||
RecipesAludel.getInstance().addRecipe(new ItemStack(ModItems.alchemicalTome), new ItemStack(Items.book), new ItemStack(ModItems.alchemicalDust, 1, 3));
|
||||
AludelRecipeManager.getInstance().addRecipe(new ItemStack(ModItems.alchemicalTome), new ItemStack(Items.book), new ItemStack(ModItems.alchemicalDust, 1, 3));
|
||||
|
||||
// Alchemical bags
|
||||
RecipesAludel.getInstance().addRecipe(new ItemStack(ModItems.alchemicalBag, 1, 0), new ItemStack(Blocks.wool, 1, OreDictionary.WILDCARD_VALUE), new ItemStack(ModItems.alchemicalDust, 8, 1));
|
||||
RecipesAludel.getInstance().addRecipe(new ItemStack(ModItems.alchemicalBag, 1, 1), new ItemStack(Blocks.wool, 1, OreDictionary.WILDCARD_VALUE), new ItemStack(ModItems.alchemicalDust, 8, 2));
|
||||
RecipesAludel.getInstance().addRecipe(new ItemStack(ModItems.alchemicalBag, 1, 2), new ItemStack(Blocks.wool, 1, OreDictionary.WILDCARD_VALUE), new ItemStack(ModItems.alchemicalDust, 8, 3));
|
||||
AludelRecipeManager.getInstance().addRecipe(new ItemStack(ModItems.alchemicalBag, 1, 0), new ItemStack(Blocks.wool, 1, OreDictionary.WILDCARD_VALUE), new ItemStack(ModItems.alchemicalDust, 8, 1));
|
||||
AludelRecipeManager.getInstance().addRecipe(new ItemStack(ModItems.alchemicalBag, 1, 1), new ItemStack(Blocks.wool, 1, OreDictionary.WILDCARD_VALUE), new ItemStack(ModItems.alchemicalDust, 8, 2));
|
||||
AludelRecipeManager.getInstance().addRecipe(new ItemStack(ModItems.alchemicalBag, 1, 2), new ItemStack(Blocks.wool, 1, OreDictionary.WILDCARD_VALUE), new ItemStack(ModItems.alchemicalDust, 8, 3));
|
||||
|
||||
// Infused Stone
|
||||
AludelRecipeManager.getInstance().addRecipe(new ItemStack(ModBlocks.ashInfusedStone), new ItemStack(Blocks.stone), new ItemStack(ModItems.alchemicalDust, 1, 0));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,5 +17,7 @@ public class TileEntities
|
|||
GameRegistry.registerTileEntityWithAlternatives(TileEntityGlassBell.class, Names.Blocks.GLASS_BELL, "tile." + Names.Blocks.GLASS_BELL);
|
||||
GameRegistry.registerTileEntity(TileEntityResearchStation.class, Names.Blocks.RESEARCH_STATION);
|
||||
GameRegistry.registerTileEntity(TileEntityAugmentationTable.class, Names.Blocks.AUGMENTATION_TABLE);
|
||||
GameRegistry.registerTileEntity(TileEntityAlchemyArray.class, Names.Blocks.BASIC_ALCHEMY_ARRAY);
|
||||
GameRegistry.registerTileEntity(TileEntityDummyArray.class, Names.Blocks.DUMMY_ALCHEMY_ARRAY);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,13 +1,21 @@
|
|||
package com.pahimar.ee3.item;
|
||||
|
||||
import com.pahimar.ee3.init.ModBlocks;
|
||||
import com.pahimar.ee3.network.PacketHandler;
|
||||
import com.pahimar.ee3.network.message.MessageChalkSettings;
|
||||
import com.pahimar.ee3.reference.Key;
|
||||
import com.pahimar.ee3.reference.Names;
|
||||
import com.pahimar.ee3.settings.ChalkSettings;
|
||||
import com.pahimar.ee3.tileentity.TileEntityDummyArray;
|
||||
import com.pahimar.ee3.util.EntityHelper;
|
||||
import com.pahimar.ee3.util.IKeyBound;
|
||||
import com.pahimar.ee3.util.LogHelper;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class ItemChalk extends ItemEE implements IKeyBound
|
||||
{
|
||||
|
@ -17,12 +25,6 @@ public class ItemChalk extends ItemEE implements IKeyBound
|
|||
this.setUnlocalizedName(Names.Items.CHALK);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getShareTag()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback for item usage. If the item does something special on right clicking, he will have one of those. Return
|
||||
* True if something happen and false if it don't. This is for ITEMS, not BLOCKS
|
||||
|
@ -57,7 +59,6 @@ public class ItemChalk extends ItemEE implements IKeyBound
|
|||
++x;
|
||||
}
|
||||
|
||||
LogHelper.info(String.format("x: %s, y: %s, z: %s", x, y, z));
|
||||
if (canPlaceAlchemyArray(itemStack, entityPlayer, world, x, y, z, side))
|
||||
{
|
||||
placeAlchemyArray(itemStack, entityPlayer, world, x, y, z, side);
|
||||
|
@ -72,127 +73,127 @@ public class ItemChalk extends ItemEE implements IKeyBound
|
|||
{
|
||||
if (!world.isRemote)
|
||||
{
|
||||
// NBTTagCompound playerCustomData = EntityHelper.getCustomEntityData(entityPlayer);
|
||||
// ChalkSettings chalkSettings = new ChalkSettings();
|
||||
// chalkSettings.readFromNBT(playerCustomData);
|
||||
// int coordOffset = getOffsetForSize(chalkSettings.getSize());
|
||||
// ForgeDirection orientation = ForgeDirection.getOrientation(side);
|
||||
// boolean canPlaceAlchemyArray = ModBlocks.alchemyArray.canPlaceBlockOnSide(world, x, y, z, side);
|
||||
//
|
||||
// if (canPlaceAlchemyArray)
|
||||
// {
|
||||
// if (orientation == ForgeDirection.UP || orientation == ForgeDirection.DOWN)
|
||||
// {
|
||||
// for (int i = x - coordOffset; i <= x + coordOffset; i++)
|
||||
// {
|
||||
// for (int j = z - coordOffset; j <= z + coordOffset; j++)
|
||||
// {
|
||||
// if ((i != x || j != z) && (!ModBlocks.dummyArray.canPlaceBlockOnSide(world, i, y, j, side) || world.getTileEntity(i, y, j) instanceof TileEntityDummyArray))
|
||||
// {
|
||||
// canPlaceAlchemyArray = false;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// else if (orientation == ForgeDirection.NORTH || orientation == ForgeDirection.SOUTH)
|
||||
// {
|
||||
// for (int i = x - coordOffset; i <= x + coordOffset; i++)
|
||||
// {
|
||||
// for (int j = y - coordOffset; j <= y + coordOffset; j++)
|
||||
// {
|
||||
// if ((i != x || j != y) && (!ModBlocks.dummyArray.canPlaceBlockOnSide(world, i, j, z, side) || world.getTileEntity(i, j, z) instanceof TileEntityDummyArray))
|
||||
// {
|
||||
// canPlaceAlchemyArray = false;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// else if (orientation == ForgeDirection.EAST || orientation == ForgeDirection.WEST)
|
||||
// {
|
||||
// for (int i = y - coordOffset; i <= y + coordOffset; i++)
|
||||
// {
|
||||
// for (int j = z - coordOffset; j <= z + coordOffset; j++)
|
||||
// {
|
||||
// if ((i != y || j != z) && (!ModBlocks.dummyArray.canPlaceBlockOnSide(world, x, i, j, side) || world.getTileEntity(x, i, j) instanceof TileEntityDummyArray))
|
||||
// {
|
||||
// canPlaceAlchemyArray = false;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// return canPlaceAlchemyArray;
|
||||
NBTTagCompound playerCustomData = EntityHelper.getCustomEntityData(entityPlayer);
|
||||
ChalkSettings chalkSettings = new ChalkSettings();
|
||||
chalkSettings.readFromNBT(playerCustomData);
|
||||
int coordOffset = getOffsetForSize(chalkSettings.getSize());
|
||||
ForgeDirection orientation = ForgeDirection.getOrientation(side);
|
||||
boolean canPlaceAlchemyArray = ModBlocks.basicAlchemyArray.canPlaceBlockOnSide(world, x, y, z, side);
|
||||
|
||||
if (canPlaceAlchemyArray)
|
||||
{
|
||||
if (orientation == ForgeDirection.UP || orientation == ForgeDirection.DOWN)
|
||||
{
|
||||
for (int i = x - coordOffset; i <= x + coordOffset; i++)
|
||||
{
|
||||
for (int j = z - coordOffset; j <= z + coordOffset; j++)
|
||||
{
|
||||
if ((i != x || j != z) && (!ModBlocks.dummyAlchemyArray.canPlaceBlockOnSide(world, i, y, j, side) || world.getTileEntity(i, y, j) instanceof TileEntityDummyArray))
|
||||
{
|
||||
canPlaceAlchemyArray = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (orientation == ForgeDirection.NORTH || orientation == ForgeDirection.SOUTH)
|
||||
{
|
||||
for (int i = x - coordOffset; i <= x + coordOffset; i++)
|
||||
{
|
||||
for (int j = y - coordOffset; j <= y + coordOffset; j++)
|
||||
{
|
||||
if ((i != x || j != y) && (!ModBlocks.dummyAlchemyArray.canPlaceBlockOnSide(world, i, j, z, side) || world.getTileEntity(i, j, z) instanceof TileEntityDummyArray))
|
||||
{
|
||||
canPlaceAlchemyArray = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (orientation == ForgeDirection.EAST || orientation == ForgeDirection.WEST)
|
||||
{
|
||||
for (int i = y - coordOffset; i <= y + coordOffset; i++)
|
||||
{
|
||||
for (int j = z - coordOffset; j <= z + coordOffset; j++)
|
||||
{
|
||||
if ((i != y || j != z) && (!ModBlocks.dummyAlchemyArray.canPlaceBlockOnSide(world, x, i, j, side) || world.getTileEntity(x, i, j) instanceof TileEntityDummyArray))
|
||||
{
|
||||
canPlaceAlchemyArray = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return canPlaceAlchemyArray;
|
||||
}
|
||||
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
private void placeAlchemyArray(ItemStack itemStack, EntityPlayer entityPlayer, World world, int x, int y, int z, int side)
|
||||
{
|
||||
if (!world.isRemote)
|
||||
{
|
||||
// NBTTagCompound playerCustomData = EntityHelper.getCustomEntityData(entityPlayer);
|
||||
// ChalkSettings chalkSettings = new ChalkSettings();
|
||||
// chalkSettings.readFromNBT(playerCustomData);
|
||||
// int coordOffset = getOffsetForSize(chalkSettings.getSize());
|
||||
// ForgeDirection orientation = ForgeDirection.getOrientation(side);
|
||||
// boolean canPlaceAlchemyArray = ModBlocks.alchemyArray.canPlaceBlockOnSide(world, x, y, z, side);
|
||||
//
|
||||
// placeBlockAt(entityPlayer, itemStack, world, x, y, z, ModBlocks.alchemyArray, side);
|
||||
//
|
||||
// if (canPlaceAlchemyArray)
|
||||
// {
|
||||
// if (orientation == ForgeDirection.UP || orientation == ForgeDirection.DOWN)
|
||||
// {
|
||||
// for (int i = x - coordOffset; i <= x + coordOffset; i++)
|
||||
// {
|
||||
// for (int j = z - coordOffset; j <= z + coordOffset; j++)
|
||||
// {
|
||||
// if (i != x || j != z)
|
||||
// {
|
||||
// placeBlockAt(entityPlayer, itemStack, world, i, y, j, ModBlocks.dummyArray, side);
|
||||
// if (world.getTileEntity(i, y, j) instanceof TileEntityDummyArray)
|
||||
// {
|
||||
// ((TileEntityDummyArray) world.getTileEntity(i, y, j)).setTrueCoords(x, y, z);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// else if (orientation == ForgeDirection.NORTH || orientation == ForgeDirection.SOUTH)
|
||||
// {
|
||||
// for (int i = x - coordOffset; i <= x + coordOffset; i++)
|
||||
// {
|
||||
// for (int j = y - coordOffset; j <= y + coordOffset; j++)
|
||||
// {
|
||||
// if (i != x || j != y)
|
||||
// {
|
||||
// placeBlockAt(entityPlayer, itemStack, world, i, j, z, ModBlocks.dummyArray, side);
|
||||
// {
|
||||
// ((TileEntityDummyArray) world.getTileEntity(i, j, z)).setTrueCoords(x, y, z);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// else if (orientation == ForgeDirection.EAST || orientation == ForgeDirection.WEST)
|
||||
// {
|
||||
// for (int i = y - coordOffset; i <= y + coordOffset; i++)
|
||||
// {
|
||||
// for (int j = z - coordOffset; j <= z + coordOffset; j++)
|
||||
// {
|
||||
// if (i != y || j != z)
|
||||
// {
|
||||
// placeBlockAt(entityPlayer, itemStack, world, x, i, j, ModBlocks.dummyArray, side);
|
||||
// {
|
||||
// ((TileEntityDummyArray) world.getTileEntity(x, i, j)).setTrueCoords(x, y, z);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
NBTTagCompound playerCustomData = EntityHelper.getCustomEntityData(entityPlayer);
|
||||
ChalkSettings chalkSettings = new ChalkSettings();
|
||||
chalkSettings.readFromNBT(playerCustomData);
|
||||
int coordOffset = getOffsetForSize(chalkSettings.getSize());
|
||||
ForgeDirection orientation = ForgeDirection.getOrientation(side);
|
||||
boolean canPlaceAlchemyArray = ModBlocks.basicAlchemyArray.canPlaceBlockOnSide(world, x, y, z, side);
|
||||
|
||||
placeBlockAt(entityPlayer, itemStack, world, x, y, z, ModBlocks.basicAlchemyArray, side);
|
||||
|
||||
if (canPlaceAlchemyArray)
|
||||
{
|
||||
if (orientation == ForgeDirection.UP || orientation == ForgeDirection.DOWN)
|
||||
{
|
||||
for (int i = x - coordOffset; i <= x + coordOffset; i++)
|
||||
{
|
||||
for (int j = z - coordOffset; j <= z + coordOffset; j++)
|
||||
{
|
||||
if (i != x || j != z)
|
||||
{
|
||||
placeBlockAt(entityPlayer, itemStack, world, i, y, j, ModBlocks.dummyAlchemyArray, side);
|
||||
if (world.getTileEntity(i, y, j) instanceof TileEntityDummyArray)
|
||||
{
|
||||
((TileEntityDummyArray) world.getTileEntity(i, y, j)).setTrueCoords(x, y, z);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (orientation == ForgeDirection.NORTH || orientation == ForgeDirection.SOUTH)
|
||||
{
|
||||
for (int i = x - coordOffset; i <= x + coordOffset; i++)
|
||||
{
|
||||
for (int j = y - coordOffset; j <= y + coordOffset; j++)
|
||||
{
|
||||
if (i != x || j != y)
|
||||
{
|
||||
placeBlockAt(entityPlayer, itemStack, world, i, j, z, ModBlocks.dummyAlchemyArray, side);
|
||||
{
|
||||
((TileEntityDummyArray) world.getTileEntity(i, j, z)).setTrueCoords(x, y, z);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (orientation == ForgeDirection.EAST || orientation == ForgeDirection.WEST)
|
||||
{
|
||||
for (int i = y - coordOffset; i <= y + coordOffset; i++)
|
||||
{
|
||||
for (int j = z - coordOffset; j <= z + coordOffset; j++)
|
||||
{
|
||||
if (i != y || j != z)
|
||||
{
|
||||
placeBlockAt(entityPlayer, itemStack, world, x, i, j, ModBlocks.dummyAlchemyArray, side);
|
||||
{
|
||||
((TileEntityDummyArray) world.getTileEntity(x, i, j)).setTrueCoords(x, y, z);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -221,7 +222,50 @@ public class ItemChalk extends ItemEE implements IKeyBound
|
|||
@Override
|
||||
public void doKeyBindingAction(EntityPlayer entityPlayer, ItemStack itemStack, Key key)
|
||||
{
|
||||
if (key != Key.UNKNOWN)
|
||||
{
|
||||
NBTTagCompound playerCustomData = EntityHelper.getCustomEntityData(entityPlayer);
|
||||
ChalkSettings chalkSettings = new ChalkSettings();
|
||||
chalkSettings.readFromNBT(playerCustomData);
|
||||
|
||||
if (key == Key.CHARGE)
|
||||
{
|
||||
if (!entityPlayer.isSneaking())
|
||||
{
|
||||
chalkSettings.incrementSize();
|
||||
}
|
||||
else
|
||||
{
|
||||
chalkSettings.decrementSize();
|
||||
}
|
||||
}
|
||||
else if (key == Key.TOGGLE)
|
||||
{
|
||||
if (!entityPlayer.isSneaking())
|
||||
{
|
||||
chalkSettings.incrementIndex();
|
||||
}
|
||||
else
|
||||
{
|
||||
chalkSettings.decrementIndex();
|
||||
}
|
||||
}
|
||||
else if (key == Key.RELEASE)
|
||||
{
|
||||
if (!entityPlayer.isSneaking())
|
||||
{
|
||||
chalkSettings.rotateClockwise();
|
||||
}
|
||||
else
|
||||
{
|
||||
chalkSettings.rotateCounterClockwise();
|
||||
}
|
||||
}
|
||||
|
||||
chalkSettings.writeToNBT(playerCustomData);
|
||||
EntityHelper.saveCustomEntityData(entityPlayer, playerCustomData);
|
||||
PacketHandler.INSTANCE.sendTo(new MessageChalkSettings(chalkSettings), (EntityPlayerMP) entityPlayer);
|
||||
}
|
||||
}
|
||||
|
||||
private static int getOffsetForSize(int size)
|
||||
|
|
|
@ -7,7 +7,7 @@ import codechicken.nei.recipe.TemplateRecipeHandler;
|
|||
import com.pahimar.ee3.client.gui.inventory.GuiAludel;
|
||||
import com.pahimar.ee3.exchange.WrappedStack;
|
||||
import com.pahimar.ee3.item.crafting.RecipeAludel;
|
||||
import com.pahimar.ee3.recipe.RecipesAludel;
|
||||
import com.pahimar.ee3.recipe.AludelRecipeManager;
|
||||
import com.pahimar.ee3.reference.Names;
|
||||
import com.pahimar.ee3.reference.Reference;
|
||||
import com.pahimar.ee3.reference.Textures;
|
||||
|
@ -99,7 +99,7 @@ public class AludelRecipeHandler extends TemplateRecipeHandler
|
|||
@Override
|
||||
public void loadCraftingRecipes(ItemStack result)
|
||||
{
|
||||
for (RecipeAludel recipe : RecipesAludel.getInstance().getRecipes())
|
||||
for (RecipeAludel recipe : AludelRecipeManager.getInstance().getRecipes())
|
||||
{
|
||||
if (NEIServerUtils.areStacksSameTypeCrafting(recipe.getRecipeOutput(), result))
|
||||
{
|
||||
|
@ -113,7 +113,7 @@ public class AludelRecipeHandler extends TemplateRecipeHandler
|
|||
{
|
||||
if (outputId.equals(getRecipeID()))
|
||||
{
|
||||
for (RecipeAludel recipe : RecipesAludel.getInstance().getRecipes())
|
||||
for (RecipeAludel recipe : AludelRecipeManager.getInstance().getRecipes())
|
||||
{
|
||||
arecipes.add(new CachedAludelRecipe(recipe));
|
||||
}
|
||||
|
@ -135,7 +135,7 @@ public class AludelRecipeHandler extends TemplateRecipeHandler
|
|||
@Override
|
||||
public void loadUsageRecipes(ItemStack ingredient)
|
||||
{
|
||||
for (RecipeAludel recipe : RecipesAludel.getInstance().getRecipes())
|
||||
for (RecipeAludel recipe : AludelRecipeManager.getInstance().getRecipes())
|
||||
{
|
||||
for (WrappedStack wrappedStack : recipe.getRecipeInputs())
|
||||
{
|
||||
|
|
|
@ -22,5 +22,8 @@ public class PacketHandler
|
|||
INSTANCE.registerMessage(MessageSetEnergyValue.class, MessageSetEnergyValue.class, 7, Side.CLIENT);
|
||||
INSTANCE.registerMessage(MessageGuiElementClicked.class, MessageGuiElementClicked.class, 8, Side.SERVER);
|
||||
INSTANCE.registerMessage(MessageGuiElementTextFieldUpdate.class, MessageGuiElementTextFieldUpdate.class, 9, Side.SERVER);
|
||||
INSTANCE.registerMessage(MessageChalkSettings.class, MessageChalkSettings.class, 10, Side.CLIENT);
|
||||
INSTANCE.registerMessage(MessageTileEntityDummy.class, MessageTileEntityDummy.class, 11, Side.CLIENT);
|
||||
INSTANCE.registerMessage(MessageTileEntityAlchemyArray.class, MessageTileEntityAlchemyArray.class, 12, Side.CLIENT);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,70 @@
|
|||
package com.pahimar.ee3.network.message;
|
||||
|
||||
import com.pahimar.ee3.EquivalentExchange3;
|
||||
import com.pahimar.ee3.settings.ChalkSettings;
|
||||
import com.pahimar.ee3.util.LogHelper;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
|
||||
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
public class MessageChalkSettings implements IMessage, IMessageHandler<MessageChalkSettings, IMessage>
|
||||
{
|
||||
private int index, size, rotation;
|
||||
|
||||
public MessageChalkSettings()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public MessageChalkSettings(ChalkSettings chalkSettings)
|
||||
{
|
||||
this.index = chalkSettings.getIndex();
|
||||
this.size = chalkSettings.getSize();
|
||||
this.rotation = chalkSettings.getRotation();
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert from the supplied buffer into your specific message type
|
||||
*
|
||||
* @param buf
|
||||
*/
|
||||
@Override
|
||||
public void fromBytes(ByteBuf buf)
|
||||
{
|
||||
this.index = buf.readInt();
|
||||
this.size = buf.readInt();
|
||||
this.rotation = buf.readInt();
|
||||
}
|
||||
|
||||
/**
|
||||
* Deconstruct your message into the supplied byte buffer
|
||||
*
|
||||
* @param buf
|
||||
*/
|
||||
@Override
|
||||
public void toBytes(ByteBuf buf)
|
||||
{
|
||||
buf.writeInt(this.index);
|
||||
buf.writeInt(this.size);
|
||||
buf.writeInt(this.rotation);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a message is received of the appropriate type. You can optionally return a reply message, or null if no reply
|
||||
* is needed.
|
||||
*
|
||||
* @param message The message
|
||||
* @param ctx
|
||||
* @return an optional return message
|
||||
*/
|
||||
@Override
|
||||
public IMessage onMessage(MessageChalkSettings message, MessageContext ctx)
|
||||
{
|
||||
EquivalentExchange3.proxy.getClientProxy().chalkSettings = new ChalkSettings(message.index, message.size, message.rotation);
|
||||
|
||||
LogHelper.info(String.format("index: %s, size: %s, rotation: %s", EquivalentExchange3.proxy.getClientProxy().chalkSettings.getIndex(), EquivalentExchange3.proxy.getClientProxy().chalkSettings.getSize(), EquivalentExchange3.proxy.getClientProxy().chalkSettings.getRotation()));
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,118 @@
|
|||
package com.pahimar.ee3.network.message;
|
||||
|
||||
import com.pahimar.ee3.tileentity.TileEntityAlchemyArray;
|
||||
import cpw.mods.fml.client.FMLClientHandler;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
|
||||
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.nbt.CompressedStreamTools;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
public class MessageTileEntityAlchemyArray implements IMessage, IMessageHandler<MessageTileEntityAlchemyArray, IMessage>
|
||||
{
|
||||
public NBTTagCompound tileEntityAlchemyArrayNBT;
|
||||
|
||||
public MessageTileEntityAlchemyArray()
|
||||
{
|
||||
}
|
||||
|
||||
public MessageTileEntityAlchemyArray(TileEntityAlchemyArray tileEntityAlchemyArray)
|
||||
{
|
||||
tileEntityAlchemyArrayNBT = new NBTTagCompound();
|
||||
tileEntityAlchemyArray.writeToNBT(tileEntityAlchemyArrayNBT);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert from the supplied buffer into your specific message type
|
||||
*
|
||||
* @param buf
|
||||
*/
|
||||
@Override
|
||||
public void fromBytes(ByteBuf buf)
|
||||
{
|
||||
byte[] compressedNBT = null;
|
||||
int readableBytes = buf.readInt();
|
||||
|
||||
if (readableBytes > 0)
|
||||
{
|
||||
compressedNBT = buf.readBytes(readableBytes).array();
|
||||
}
|
||||
|
||||
if (compressedNBT != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
this.tileEntityAlchemyArrayNBT = CompressedStreamTools.readCompressed(new ByteArrayInputStream(compressedNBT));
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Deconstruct your message into the supplied byte buffer
|
||||
*
|
||||
* @param buf
|
||||
*/
|
||||
@Override
|
||||
public void toBytes(ByteBuf buf)
|
||||
{
|
||||
byte[] compressedNBT = null;
|
||||
|
||||
try
|
||||
{
|
||||
if (tileEntityAlchemyArrayNBT != null)
|
||||
{
|
||||
compressedNBT = CompressedStreamTools.compress(tileEntityAlchemyArrayNBT);
|
||||
}
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
if (compressedNBT != null)
|
||||
{
|
||||
buf.writeInt(compressedNBT.length);
|
||||
buf.writeBytes(compressedNBT);
|
||||
}
|
||||
else
|
||||
{
|
||||
buf.writeInt(0);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a message is received of the appropriate type. You can optionally return a reply message, or null if no reply
|
||||
* is needed.
|
||||
*
|
||||
* @param message The message
|
||||
* @param ctx
|
||||
* @return an optional return message
|
||||
*/
|
||||
@Override
|
||||
public IMessage onMessage(MessageTileEntityAlchemyArray message, MessageContext ctx)
|
||||
{
|
||||
if (message.tileEntityAlchemyArrayNBT != null)
|
||||
{
|
||||
TileEntityAlchemyArray tileEntityAlchemyArray = new TileEntityAlchemyArray();
|
||||
tileEntityAlchemyArray.readFromNBT(message.tileEntityAlchemyArrayNBT);
|
||||
|
||||
TileEntity tileEntity = FMLClientHandler.instance().getClient().theWorld.getTileEntity(tileEntityAlchemyArray.xCoord, tileEntityAlchemyArray.yCoord, tileEntityAlchemyArray.zCoord);
|
||||
|
||||
if (tileEntity instanceof TileEntityAlchemyArray)
|
||||
{
|
||||
tileEntity.readFromNBT(message.tileEntityAlchemyArrayNBT);
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,128 @@
|
|||
package com.pahimar.ee3.network.message;
|
||||
|
||||
import com.pahimar.ee3.tileentity.TileEntityDummyArray;
|
||||
import com.pahimar.ee3.tileentity.TileEntityEE;
|
||||
import cpw.mods.fml.client.FMLClientHandler;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
|
||||
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public class MessageTileEntityDummy implements IMessage, IMessageHandler<MessageTileEntityDummy, IMessage>
|
||||
{
|
||||
public int x, y, z;
|
||||
public byte orientation;
|
||||
public byte state;
|
||||
public String customName;
|
||||
public UUID ownerUUID;
|
||||
public int trueXCoord, trueYCoord, trueZCoord;
|
||||
|
||||
public MessageTileEntityDummy()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public MessageTileEntityDummy(TileEntityDummyArray tileEntityDummyArray)
|
||||
{
|
||||
this.x = tileEntityDummyArray.xCoord;
|
||||
this.y = tileEntityDummyArray.yCoord;
|
||||
this.z = tileEntityDummyArray.zCoord;
|
||||
this.orientation = (byte) tileEntityDummyArray.getOrientation().ordinal();
|
||||
this.state = (byte) tileEntityDummyArray.getState();
|
||||
this.customName = tileEntityDummyArray.getCustomName();
|
||||
this.ownerUUID = tileEntityDummyArray.getOwnerUUID();
|
||||
this.trueXCoord = tileEntityDummyArray.getTrueXCoord();
|
||||
this.trueYCoord = tileEntityDummyArray.getTrueYCoord();
|
||||
this.trueZCoord = tileEntityDummyArray.getTrueZCoord();
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert from the supplied buffer into your specific message type
|
||||
*
|
||||
* @param buf
|
||||
*/
|
||||
@Override
|
||||
public void fromBytes(ByteBuf buf)
|
||||
{
|
||||
this.x = buf.readInt();
|
||||
this.y = buf.readInt();
|
||||
this.z = buf.readInt();
|
||||
this.orientation = buf.readByte();
|
||||
this.state = buf.readByte();
|
||||
int customNameLength = buf.readInt();
|
||||
this.customName = new String(buf.readBytes(customNameLength).array());
|
||||
if (buf.readBoolean())
|
||||
{
|
||||
this.ownerUUID = new UUID(buf.readLong(), buf.readLong());
|
||||
}
|
||||
else
|
||||
{
|
||||
this.ownerUUID = null;
|
||||
}
|
||||
this.trueXCoord = buf.readInt();
|
||||
this.trueYCoord = buf.readInt();
|
||||
this.trueZCoord = buf.readInt();
|
||||
}
|
||||
|
||||
/**
|
||||
* Deconstruct your message into the supplied byte buffer
|
||||
*
|
||||
* @param buf
|
||||
*/
|
||||
@Override
|
||||
public void toBytes(ByteBuf buf)
|
||||
{
|
||||
buf.writeInt(x);
|
||||
buf.writeInt(y);
|
||||
buf.writeInt(z);
|
||||
buf.writeByte(orientation);
|
||||
buf.writeByte(state);
|
||||
buf.writeInt(customName.length());
|
||||
buf.writeBytes(customName.getBytes());
|
||||
if (ownerUUID != null)
|
||||
{
|
||||
buf.writeBoolean(true);
|
||||
buf.writeLong(ownerUUID.getMostSignificantBits());
|
||||
buf.writeLong(ownerUUID.getLeastSignificantBits());
|
||||
}
|
||||
else
|
||||
{
|
||||
buf.writeBoolean(false);
|
||||
}
|
||||
buf.writeInt(trueXCoord);
|
||||
buf.writeInt(trueYCoord);
|
||||
buf.writeInt(trueZCoord);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a message is received of the appropriate type. You can optionally return a reply message, or null if no reply
|
||||
* is needed.
|
||||
*
|
||||
* @param message The message
|
||||
* @param ctx
|
||||
* @return an optional return message
|
||||
*/
|
||||
@Override
|
||||
public IMessage onMessage(MessageTileEntityDummy message, MessageContext ctx)
|
||||
{
|
||||
TileEntity tileEntity = FMLClientHandler.instance().getClient().theWorld.getTileEntity(message.x, message.y, message.z);
|
||||
|
||||
if (tileEntity instanceof TileEntityEE)
|
||||
{
|
||||
((TileEntityEE) tileEntity).setOrientation(message.orientation);
|
||||
((TileEntityEE) tileEntity).setState(message.state);
|
||||
((TileEntityEE) tileEntity).setCustomName(message.customName);
|
||||
((TileEntityEE) tileEntity).setOwnerUUID(message.ownerUUID);
|
||||
|
||||
if (tileEntity instanceof TileEntityDummyArray)
|
||||
{
|
||||
((TileEntityDummyArray) tileEntity).setTrueCoords(message.trueXCoord, message.trueYCoord, message.trueZCoord);
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -10,6 +10,7 @@ import com.pahimar.ee3.client.settings.Keybindings;
|
|||
import com.pahimar.ee3.client.util.ClientSoundHelper;
|
||||
import com.pahimar.ee3.init.ModBlocks;
|
||||
import com.pahimar.ee3.reference.RenderIds;
|
||||
import com.pahimar.ee3.settings.ChalkSettings;
|
||||
import com.pahimar.ee3.tileentity.*;
|
||||
import cpw.mods.fml.client.registry.ClientRegistry;
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
|
@ -20,6 +21,8 @@ import net.minecraftforge.common.MinecraftForge;
|
|||
|
||||
public class ClientProxy extends CommonProxy
|
||||
{
|
||||
public ChalkSettings chalkSettings = new ChalkSettings();
|
||||
|
||||
@Override
|
||||
public void registerEventHandlers()
|
||||
{
|
||||
|
@ -76,5 +79,6 @@ public class ClientProxy extends CommonProxy
|
|||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityGlassBell.class, new TileEntityRendererGlassBell());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityResearchStation.class, new TileEntityRendererResearchStation());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityAugmentationTable.class, new TileEntityRendererAugmentationTable());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityAlchemyArray.class, new TileEntityRendererAlchemyArray());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,22 +9,22 @@ import net.minecraft.item.ItemStack;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class RecipesAludel
|
||||
public class AludelRecipeManager
|
||||
{
|
||||
private static RecipesAludel aludelRegistry = null;
|
||||
private static AludelRecipeManager aludelRegistry = null;
|
||||
|
||||
private List<RecipeAludel> aludelRecipes;
|
||||
|
||||
private RecipesAludel()
|
||||
private AludelRecipeManager()
|
||||
{
|
||||
aludelRecipes = new ArrayList<RecipeAludel>();
|
||||
}
|
||||
|
||||
public static RecipesAludel getInstance()
|
||||
public static AludelRecipeManager getInstance()
|
||||
{
|
||||
if (aludelRegistry == null)
|
||||
{
|
||||
aludelRegistry = new RecipesAludel();
|
||||
aludelRegistry = new AludelRecipeManager();
|
||||
}
|
||||
|
||||
return aludelRegistry;
|
||||
|
@ -81,7 +81,7 @@ public class RecipesAludel
|
|||
|
||||
public static void registerRecipes()
|
||||
{
|
||||
for (RecipeAludel recipeAludel : RecipesAludel.getInstance().getRecipes())
|
||||
for (RecipeAludel recipeAludel : AludelRecipeManager.getInstance().getRecipes())
|
||||
{
|
||||
RecipeRegistryProxy.addRecipe(recipeAludel.getRecipeOutput(), recipeAludel.getRecipeInputsAsWrappedStacks());
|
||||
}
|
|
@ -12,6 +12,9 @@ public class Names
|
|||
public static final String CALCINATOR = "calcinator";
|
||||
public static final String RESEARCH_STATION = "researchStation";
|
||||
public static final String AUGMENTATION_TABLE = "augmentationTable";
|
||||
public static final String ASH_INFUSED_STONE = "ashInfusedStone";
|
||||
public static final String BASIC_ALCHEMY_ARRAY = "basicAlchemyArray";
|
||||
public static final String DUMMY_ALCHEMY_ARRAY = "dummyAlchemyArray";
|
||||
}
|
||||
|
||||
public static final class Items
|
||||
|
@ -142,4 +145,10 @@ public class Names
|
|||
public static final String SET_ITEM_RECOVERABLE = "set-item-recoverable";
|
||||
public static final String SET_ITEM_NOT_RECOVERABLE = "set-item-not-recoverable";
|
||||
}
|
||||
|
||||
public static final class AlchemyArrays
|
||||
{
|
||||
private static final String ALCHEMY_ARRAY_BASE = "arrays.ee3:";
|
||||
public static final String BASIC_ALCHEMY_ARRAY = ALCHEMY_ARRAY_BASE + "basicAlchemyArray";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -53,20 +53,10 @@ public final class Textures
|
|||
public static final ResourceLocation WORLD_TRANSMUTATION = ResourceLocationHelper.getResourceLocation(EFFECTS_LOCATION + "noise.png");
|
||||
}
|
||||
|
||||
public static final class Glyph
|
||||
public static final class AlchemyArray
|
||||
{
|
||||
private static final String SYMBOL_TEXTURE_LOCATION = "textures/glyphs/";
|
||||
private static final String SYMBOL_TEXTURE_LOCATION = "textures/arrays/";
|
||||
|
||||
public static final ResourceLocation BASE_CIRCLE = ResourceLocationHelper.getResourceLocation(SYMBOL_TEXTURE_LOCATION + "transBaseCircle.png");
|
||||
public static final ResourceLocation DOT = ResourceLocationHelper.getResourceLocation(SYMBOL_TEXTURE_LOCATION + "transDot.png");
|
||||
public static final ResourceLocation LINE = ResourceLocationHelper.getResourceLocation(SYMBOL_TEXTURE_LOCATION + "transLine.png");
|
||||
public static final ResourceLocation CIRCLE = ResourceLocationHelper.getResourceLocation(SYMBOL_TEXTURE_LOCATION + "transCircle.png");
|
||||
public static final ResourceLocation TRIANGLE = ResourceLocationHelper.getResourceLocation(SYMBOL_TEXTURE_LOCATION + "transTriangle.png");
|
||||
public static final ResourceLocation SQUARE = ResourceLocationHelper.getResourceLocation(SYMBOL_TEXTURE_LOCATION + "transSquare.png");
|
||||
public static final ResourceLocation DIAMOND = ResourceLocationHelper.getResourceLocation(SYMBOL_TEXTURE_LOCATION + "transDiamond.png");
|
||||
public static final ResourceLocation PENTAGON = ResourceLocationHelper.getResourceLocation(SYMBOL_TEXTURE_LOCATION + "transPentagon.png");
|
||||
public static final ResourceLocation HEXAGON = ResourceLocationHelper.getResourceLocation(SYMBOL_TEXTURE_LOCATION + "transHexagon.png");
|
||||
public static final ResourceLocation HEPTAGON = ResourceLocationHelper.getResourceLocation(SYMBOL_TEXTURE_LOCATION + "transHeptagon.png");
|
||||
public static final ResourceLocation OCTAGON = ResourceLocationHelper.getResourceLocation(SYMBOL_TEXTURE_LOCATION + "transOctagon.png");
|
||||
public static final ResourceLocation BASIC_ALCHEMY_ARRAY = ResourceLocationHelper.getResourceLocation(SYMBOL_TEXTURE_LOCATION + "basicAlchemyArray.png");
|
||||
}
|
||||
}
|
||||
|
|
215
src/main/java/com/pahimar/ee3/settings/ChalkSettings.java
Normal file
215
src/main/java/com/pahimar/ee3/settings/ChalkSettings.java
Normal file
|
@ -0,0 +1,215 @@
|
|||
package com.pahimar.ee3.settings;
|
||||
|
||||
import com.pahimar.ee3.api.AlchemyArrayRegistryProxy;
|
||||
import com.pahimar.ee3.util.INBTTaggable;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
// TODO Set the NBT tag names to constants
|
||||
public class ChalkSettings implements INBTTaggable
|
||||
{
|
||||
private int index;
|
||||
private int size;
|
||||
private int rotation;
|
||||
|
||||
private final int MAX_SIZE = 6;
|
||||
|
||||
public ChalkSettings()
|
||||
{
|
||||
this(0, 1, 0);
|
||||
}
|
||||
|
||||
public ChalkSettings(int index, int size, int rotation)
|
||||
{
|
||||
this.index = index;
|
||||
this.size = size;
|
||||
this.rotation = rotation;
|
||||
}
|
||||
|
||||
public int getIndex()
|
||||
{
|
||||
return index;
|
||||
}
|
||||
|
||||
public void setIndex(int index)
|
||||
{
|
||||
this.index = index;
|
||||
|
||||
if (this.index < 0)
|
||||
{
|
||||
this.index = 0;
|
||||
}
|
||||
else if (this.index >= AlchemyArrayRegistryProxy.getRegisteredAlchemyArrays().size())
|
||||
{
|
||||
this.index = AlchemyArrayRegistryProxy.getRegisteredAlchemyArrays().size() - 1;
|
||||
}
|
||||
}
|
||||
|
||||
public void incrementIndex()
|
||||
{
|
||||
index += 1;
|
||||
|
||||
if (index >= AlchemyArrayRegistryProxy.getRegisteredAlchemyArrays().size())
|
||||
{
|
||||
index = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public void decrementIndex()
|
||||
{
|
||||
index -= 1;
|
||||
|
||||
if (index < 0)
|
||||
{
|
||||
this.index = AlchemyArrayRegistryProxy.getRegisteredAlchemyArrays().size() - 1;
|
||||
}
|
||||
}
|
||||
|
||||
public int getSize()
|
||||
{
|
||||
return size;
|
||||
}
|
||||
|
||||
public void setSize(int size)
|
||||
{
|
||||
if (size < 1)
|
||||
{
|
||||
this.size = 1;
|
||||
}
|
||||
else if (size > MAX_SIZE)
|
||||
{
|
||||
this.size = MAX_SIZE;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.size = size;
|
||||
}
|
||||
}
|
||||
|
||||
public void incrementSize()
|
||||
{
|
||||
if (size < MAX_SIZE)
|
||||
{
|
||||
size += 1;
|
||||
}
|
||||
}
|
||||
|
||||
public void decrementSize()
|
||||
{
|
||||
if (size > 1)
|
||||
{
|
||||
size -= 1;
|
||||
}
|
||||
}
|
||||
|
||||
public int getRotation()
|
||||
{
|
||||
return rotation;
|
||||
}
|
||||
|
||||
public void setRotation(int rotation)
|
||||
{
|
||||
if (rotation < 0)
|
||||
{
|
||||
this.rotation = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.rotation = rotation % 4;
|
||||
}
|
||||
}
|
||||
|
||||
public void rotateClockwise()
|
||||
{
|
||||
this.rotation = (rotation + 1) % 4;
|
||||
}
|
||||
|
||||
public void rotateCounterClockwise()
|
||||
{
|
||||
this.rotation -= 1;
|
||||
|
||||
if (this.rotation < 0)
|
||||
{
|
||||
this.rotation = 3;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbtTagCompound)
|
||||
{
|
||||
if (nbtTagCompound != null && nbtTagCompound.hasKey("chalk_settings") && nbtTagCompound.getTag("chalk_settings").getId() == (byte) 10)
|
||||
{
|
||||
NBTTagCompound chalkSettings = nbtTagCompound.getCompoundTag("chalk_settings");
|
||||
if (chalkSettings.hasKey("index"))
|
||||
{
|
||||
this.index = chalkSettings.getInteger("index");
|
||||
|
||||
if (this.index < 0 || this.index >= AlchemyArrayRegistryProxy.getRegisteredAlchemyArrays().size())
|
||||
{
|
||||
this.index = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.index = 0;
|
||||
}
|
||||
|
||||
if (chalkSettings.hasKey("size"))
|
||||
{
|
||||
this.size = chalkSettings.getInteger("size");
|
||||
|
||||
if (this.size < 1)
|
||||
{
|
||||
this.size = 1;
|
||||
}
|
||||
else if (this.size > MAX_SIZE)
|
||||
{
|
||||
this.size = MAX_SIZE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.size = 1;
|
||||
}
|
||||
|
||||
if (chalkSettings.hasKey("rotation"))
|
||||
{
|
||||
this.rotation = chalkSettings.getInteger("rotation");
|
||||
|
||||
if (this.rotation < 0)
|
||||
{
|
||||
this.rotation = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.rotation = this.rotation % 4;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.rotation = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.index = 0;
|
||||
this.size = 1;
|
||||
this.rotation = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbtTagCompound)
|
||||
{
|
||||
NBTTagCompound chalkSettings = new NBTTagCompound();
|
||||
chalkSettings.setInteger("index", index);
|
||||
chalkSettings.setInteger("size", size);
|
||||
chalkSettings.setInteger("rotation", rotation);
|
||||
nbtTagCompound.setTag("chalk_settings", chalkSettings);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTagLabel()
|
||||
{
|
||||
return this.getClass().getName();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,325 @@
|
|||
package com.pahimar.ee3.tileentity;
|
||||
|
||||
import com.pahimar.ee3.api.AlchemyArray;
|
||||
import com.pahimar.ee3.init.AlchemyArrays;
|
||||
import com.pahimar.ee3.network.PacketHandler;
|
||||
import com.pahimar.ee3.network.message.MessageTileEntityAlchemyArray;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.Packet;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class TileEntityAlchemyArray extends TileEntityEE
|
||||
{
|
||||
private AlchemyArray alchemyArray;
|
||||
private ForgeDirection rotation;
|
||||
private int size;
|
||||
private int ticksSinceSync;
|
||||
|
||||
public TileEntityAlchemyArray()
|
||||
{
|
||||
super();
|
||||
rotation = ForgeDirection.UNKNOWN;
|
||||
size = 0;
|
||||
alchemyArray = AlchemyArrays.basicAlchemyArray;
|
||||
}
|
||||
|
||||
public AlchemyArray getAlchemyArray()
|
||||
{
|
||||
return alchemyArray;
|
||||
}
|
||||
|
||||
public void setAlchemyArray(AlchemyArray alchemyArray)
|
||||
{
|
||||
setAlchemyArray(alchemyArray, 1);
|
||||
}
|
||||
|
||||
public void setAlchemyArray(AlchemyArray alchemyArray, int size)
|
||||
{
|
||||
this.alchemyArray = alchemyArray;
|
||||
this.size = size;
|
||||
}
|
||||
|
||||
public ForgeDirection getRotation()
|
||||
{
|
||||
return rotation;
|
||||
}
|
||||
|
||||
public void setRotation(ForgeDirection rotation)
|
||||
{
|
||||
this.rotation = rotation;
|
||||
}
|
||||
|
||||
public void setRotation(int rotation, int facing)
|
||||
{
|
||||
if (this.orientation == ForgeDirection.UP)
|
||||
{
|
||||
if ((rotation + facing) % 4 == 0)
|
||||
{
|
||||
this.rotation = ForgeDirection.NORTH;
|
||||
}
|
||||
else if ((rotation + facing) % 4 == 1)
|
||||
{
|
||||
this.rotation = ForgeDirection.EAST;
|
||||
}
|
||||
else if ((rotation + facing) % 4 == 2)
|
||||
{
|
||||
this.rotation = ForgeDirection.SOUTH;
|
||||
}
|
||||
else if ((rotation + facing) % 4 == 3)
|
||||
{
|
||||
this.rotation = ForgeDirection.WEST;
|
||||
}
|
||||
|
||||
}
|
||||
else if (this.orientation == ForgeDirection.DOWN)
|
||||
{
|
||||
if ((rotation + facing) % 4 == 0)
|
||||
{
|
||||
this.rotation = ForgeDirection.NORTH;
|
||||
}
|
||||
else if ((rotation + facing) % 4 == 1)
|
||||
{
|
||||
this.rotation = ForgeDirection.EAST;
|
||||
}
|
||||
else if ((rotation + facing) % 4 == 2)
|
||||
{
|
||||
this.rotation = ForgeDirection.SOUTH;
|
||||
}
|
||||
else if ((rotation + facing) % 4 == 3)
|
||||
{
|
||||
this.rotation = ForgeDirection.WEST;
|
||||
}
|
||||
}
|
||||
else if (this.orientation == ForgeDirection.NORTH)
|
||||
{
|
||||
if ((rotation + facing) % 4 == 0)
|
||||
{
|
||||
this.rotation = ForgeDirection.UP;
|
||||
}
|
||||
else if ((rotation + facing) % 4 == 1)
|
||||
{
|
||||
this.rotation = ForgeDirection.EAST;
|
||||
}
|
||||
else if ((rotation + facing) % 4 == 2)
|
||||
{
|
||||
this.rotation = ForgeDirection.DOWN;
|
||||
}
|
||||
else if ((rotation + facing) % 4 == 3)
|
||||
{
|
||||
this.rotation = ForgeDirection.WEST;
|
||||
}
|
||||
}
|
||||
else if (this.orientation == ForgeDirection.SOUTH)
|
||||
{
|
||||
if ((rotation + facing) % 4 == 0)
|
||||
{
|
||||
this.rotation = ForgeDirection.DOWN;
|
||||
}
|
||||
else if ((rotation + facing) % 4 == 1)
|
||||
{
|
||||
this.rotation = ForgeDirection.EAST;
|
||||
}
|
||||
else if ((rotation + facing) % 4 == 2)
|
||||
{
|
||||
this.rotation = ForgeDirection.UP;
|
||||
}
|
||||
else if ((rotation + facing) % 4 == 3)
|
||||
{
|
||||
this.rotation = ForgeDirection.WEST;
|
||||
}
|
||||
}
|
||||
else if (this.orientation == ForgeDirection.EAST)
|
||||
{
|
||||
if ((rotation + facing) % 4 == 0)
|
||||
{
|
||||
this.rotation = ForgeDirection.NORTH;
|
||||
}
|
||||
else if ((rotation + facing) % 4 == 1)
|
||||
{
|
||||
this.rotation = ForgeDirection.UP;
|
||||
}
|
||||
else if ((rotation + facing) % 4 == 2)
|
||||
{
|
||||
this.rotation = ForgeDirection.SOUTH;
|
||||
}
|
||||
else if ((rotation + facing) % 4 == 3)
|
||||
{
|
||||
this.rotation = ForgeDirection.DOWN;
|
||||
}
|
||||
}
|
||||
else if (this.orientation == ForgeDirection.WEST)
|
||||
{
|
||||
if ((rotation + facing) % 4 == 0)
|
||||
{
|
||||
this.rotation = ForgeDirection.NORTH;
|
||||
}
|
||||
else if ((rotation + facing) % 4 == 1)
|
||||
{
|
||||
this.rotation = ForgeDirection.DOWN;
|
||||
}
|
||||
else if ((rotation + facing) % 4 == 2)
|
||||
{
|
||||
this.rotation = ForgeDirection.SOUTH;
|
||||
}
|
||||
else if ((rotation + facing) % 4 == 3)
|
||||
{
|
||||
this.rotation = ForgeDirection.UP;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int getSize()
|
||||
{
|
||||
return size;
|
||||
}
|
||||
|
||||
public void setSize(int size)
|
||||
{
|
||||
this.size = size;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public AxisAlignedBB getRenderBoundingBox()
|
||||
{
|
||||
if (this.orientation == ForgeDirection.UP || this.orientation == ForgeDirection.DOWN)
|
||||
{
|
||||
return AxisAlignedBB.getBoundingBox(xCoord - size, yCoord - 1, zCoord - size, xCoord + size, yCoord + 1, zCoord + size);
|
||||
}
|
||||
else if (this.orientation == ForgeDirection.NORTH || this.orientation == ForgeDirection.SOUTH)
|
||||
{
|
||||
return AxisAlignedBB.getBoundingBox(xCoord - size, yCoord - size, zCoord - 1, xCoord + size, yCoord + size, zCoord + 1);
|
||||
}
|
||||
else if (this.orientation == ForgeDirection.EAST || this.orientation == ForgeDirection.WEST)
|
||||
{
|
||||
return AxisAlignedBB.getBoundingBox(xCoord - 1, yCoord - size, zCoord - size, xCoord + 1, yCoord + size, zCoord + size);
|
||||
}
|
||||
|
||||
return super.getRenderBoundingBox();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity()
|
||||
{
|
||||
super.updateEntity();
|
||||
|
||||
if (!worldObj.isRemote)
|
||||
{
|
||||
if (++ticksSinceSync % 100 == 0)
|
||||
{
|
||||
if (!areDummyBlocksValid())
|
||||
{
|
||||
this.invalidate();
|
||||
worldObj.setBlockToAir(xCoord, yCoord, zCoord);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void onBlockActivated(World world, int x, int y, int z, EntityPlayer entityPlayer, int sideHit, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
if (!world.isRemote)
|
||||
{
|
||||
alchemyArray.onArrayActivated(world, x, y, z, entityPlayer, sideHit, hitX, hitY, hitZ);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Packet getDescriptionPacket()
|
||||
{
|
||||
return PacketHandler.INSTANCE.getPacketFrom(new MessageTileEntityAlchemyArray(this));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbtTagCompound)
|
||||
{
|
||||
super.readFromNBT(nbtTagCompound);
|
||||
rotation = ForgeDirection.getOrientation(nbtTagCompound.getInteger("rotation"));
|
||||
size = nbtTagCompound.getInteger("size");
|
||||
NBTTagCompound alchemyArrayTagCompound = nbtTagCompound.getCompoundTag("alchemyArray");
|
||||
alchemyArray = AlchemyArray.readArrayFromNBT(alchemyArrayTagCompound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbtTagCompound)
|
||||
{
|
||||
super.writeToNBT(nbtTagCompound);
|
||||
nbtTagCompound.setInteger("rotation", rotation.ordinal());
|
||||
nbtTagCompound.setInteger("size", size);
|
||||
NBTTagCompound alchemyArrayTagCompound = new NBTTagCompound();
|
||||
alchemyArray.writeToNBT(alchemyArrayTagCompound);
|
||||
nbtTagCompound.setTag("alchemyArray", alchemyArrayTagCompound);
|
||||
}
|
||||
|
||||
private boolean areDummyBlocksValid()
|
||||
{
|
||||
boolean validDummyBlocks = true;
|
||||
int coordOffset = this.size / 2;
|
||||
|
||||
if (this.orientation == ForgeDirection.UP || this.orientation == ForgeDirection.DOWN)
|
||||
{
|
||||
for (int i = this.xCoord - coordOffset; i <= this.xCoord + coordOffset; i++)
|
||||
{
|
||||
for (int j = this.zCoord - coordOffset; j <= this.zCoord + coordOffset; j++)
|
||||
{
|
||||
if ((i != this.xCoord || j != this.zCoord) && !isValidDummyBlock(i, this.yCoord, j))
|
||||
{
|
||||
validDummyBlocks = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (this.orientation == ForgeDirection.NORTH || this.orientation == ForgeDirection.SOUTH)
|
||||
{
|
||||
for (int i = this.xCoord - coordOffset; i <= this.xCoord + coordOffset; i++)
|
||||
{
|
||||
for (int j = this.yCoord - coordOffset; j <= this.yCoord + coordOffset; j++)
|
||||
{
|
||||
if ((i != this.xCoord || j != this.yCoord) && !isValidDummyBlock(i, j, this.zCoord))
|
||||
{
|
||||
validDummyBlocks = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (this.orientation == ForgeDirection.EAST || this.orientation == ForgeDirection.WEST)
|
||||
{
|
||||
for (int i = this.yCoord - coordOffset; i <= this.yCoord + coordOffset; i++)
|
||||
{
|
||||
for (int j = this.zCoord - coordOffset; j <= this.zCoord + coordOffset; j++)
|
||||
{
|
||||
if ((i != this.yCoord || j != this.zCoord) && !isValidDummyBlock(this.xCoord, i, j))
|
||||
{
|
||||
validDummyBlocks = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return validDummyBlocks;
|
||||
}
|
||||
|
||||
private boolean isValidDummyBlock(int x, int y, int z)
|
||||
{
|
||||
if (!this.worldObj.isRemote)
|
||||
{
|
||||
if (this.worldObj.getTileEntity(x, y, z) instanceof TileEntityDummyArray)
|
||||
{
|
||||
TileEntityDummyArray tileEntityDummyArray = (TileEntityDummyArray) this.worldObj.getTileEntity(x, y, z);
|
||||
|
||||
return tileEntityDummyArray.getOrientation() == this.orientation &&
|
||||
tileEntityDummyArray.getTrueXCoord() == this.xCoord &&
|
||||
tileEntityDummyArray.getTrueYCoord() == this.yCoord &&
|
||||
tileEntityDummyArray.getTrueZCoord() == this.zCoord;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -4,7 +4,7 @@ import com.pahimar.ee3.item.ItemAlchemicalDust;
|
|||
import com.pahimar.ee3.item.crafting.RecipeAludel;
|
||||
import com.pahimar.ee3.network.PacketHandler;
|
||||
import com.pahimar.ee3.network.message.MessageTileEntityAludel;
|
||||
import com.pahimar.ee3.recipe.RecipesAludel;
|
||||
import com.pahimar.ee3.recipe.AludelRecipeManager;
|
||||
import com.pahimar.ee3.reference.Names;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
|
@ -328,7 +328,7 @@ public class TileEntityAludel extends TileEntityEE implements ISidedInventory
|
|||
}
|
||||
else
|
||||
{
|
||||
ItemStack infusedItemStack = RecipesAludel.getInstance().getResult(inventory[INPUT_INVENTORY_INDEX], inventory[DUST_INVENTORY_INDEX]);
|
||||
ItemStack infusedItemStack = AludelRecipeManager.getInstance().getResult(inventory[INPUT_INVENTORY_INDEX], inventory[DUST_INVENTORY_INDEX]);
|
||||
|
||||
if (infusedItemStack == null)
|
||||
{
|
||||
|
@ -358,7 +358,7 @@ public class TileEntityAludel extends TileEntityEE implements ISidedInventory
|
|||
{
|
||||
if (this.canInfuse())
|
||||
{
|
||||
RecipeAludel recipe = RecipesAludel.getInstance().getRecipe(inventory[INPUT_INVENTORY_INDEX], inventory[DUST_INVENTORY_INDEX]);
|
||||
RecipeAludel recipe = AludelRecipeManager.getInstance().getRecipe(inventory[INPUT_INVENTORY_INDEX], inventory[DUST_INVENTORY_INDEX]);
|
||||
|
||||
if (this.inventory[OUTPUT_INVENTORY_INDEX] == null)
|
||||
{
|
||||
|
|
|
@ -0,0 +1,80 @@
|
|||
package com.pahimar.ee3.tileentity;
|
||||
|
||||
import com.pahimar.ee3.network.PacketHandler;
|
||||
import com.pahimar.ee3.network.message.MessageTileEntityDummy;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.Packet;
|
||||
|
||||
public class TileEntityDummyArray extends TileEntityEE
|
||||
{
|
||||
private int trueXCoord, trueYCoord, trueZCoord;
|
||||
private int ticksSinceSync;
|
||||
|
||||
public TileEntityDummyArray()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public int getTrueXCoord()
|
||||
{
|
||||
return trueXCoord;
|
||||
}
|
||||
|
||||
public int getTrueYCoord()
|
||||
{
|
||||
return trueYCoord;
|
||||
}
|
||||
|
||||
public int getTrueZCoord()
|
||||
{
|
||||
return trueZCoord;
|
||||
}
|
||||
|
||||
public void setTrueCoords(int trueXCoord, int trueYCoord, int trueZCoord)
|
||||
{
|
||||
this.trueXCoord = trueXCoord;
|
||||
this.trueYCoord = trueYCoord;
|
||||
this.trueZCoord = trueZCoord;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity()
|
||||
{
|
||||
super.updateEntity();
|
||||
|
||||
if (++ticksSinceSync % 10 == 0)
|
||||
{
|
||||
if (!worldObj.isRemote && !(worldObj.getTileEntity(trueXCoord, trueYCoord, trueZCoord) instanceof TileEntityEE))
|
||||
{
|
||||
this.invalidate();
|
||||
worldObj.setBlockToAir(xCoord, yCoord, zCoord);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Packet getDescriptionPacket()
|
||||
{
|
||||
return PacketHandler.INSTANCE.getPacketFrom(new MessageTileEntityDummy(this));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbtTagCompound)
|
||||
{
|
||||
super.readFromNBT(nbtTagCompound);
|
||||
|
||||
this.trueXCoord = nbtTagCompound.getInteger("trueXCoord");
|
||||
this.trueYCoord = nbtTagCompound.getInteger("trueYCoord");
|
||||
this.trueZCoord = nbtTagCompound.getInteger("trueZCoord");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbtTagCompound)
|
||||
{
|
||||
super.writeToNBT(nbtTagCompound);
|
||||
|
||||
nbtTagCompound.setInteger("trueXCoord", trueXCoord);
|
||||
nbtTagCompound.setInteger("trueYCoord", trueYCoord);
|
||||
nbtTagCompound.setInteger("trueZCoord", trueZCoord);
|
||||
}
|
||||
}
|
|
@ -12,6 +12,7 @@ import java.util.Comparator;
|
|||
public class FluidHelper
|
||||
{
|
||||
|
||||
// TODO Possible problem with comparator
|
||||
public static Comparator<FluidStack> comparator = new Comparator<FluidStack>()
|
||||
{
|
||||
|
||||
|
|
87
src/main/java/com/pahimar/ee3/util/TileEntityDataHelper.java
Normal file
87
src/main/java/com/pahimar/ee3/util/TileEntityDataHelper.java
Normal file
|
@ -0,0 +1,87 @@
|
|||
package com.pahimar.ee3.util;
|
||||
|
||||
import com.pahimar.ee3.tileentity.TileEntityEE;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public class TileEntityDataHelper
|
||||
{
|
||||
private static TileEntityDataHelper tileEntityDataHelper = null;
|
||||
|
||||
private TileEntityDataHelper()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public static TileEntityDataHelper getInstance()
|
||||
{
|
||||
if (tileEntityDataHelper == null)
|
||||
{
|
||||
tileEntityDataHelper = new TileEntityDataHelper();
|
||||
}
|
||||
|
||||
return tileEntityDataHelper;
|
||||
}
|
||||
|
||||
public Class getTileEntityClass(World world, int xCoord, int yCoord, int zCoord)
|
||||
{
|
||||
if (!world.isRemote)
|
||||
{
|
||||
return world.getTileEntity(xCoord, yCoord, zCoord).getClass();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public ForgeDirection getOrientation(World world, int xCoord, int yCoord, int zCoord)
|
||||
{
|
||||
if (!world.isRemote && world.getTileEntity(xCoord, yCoord, zCoord) instanceof TileEntityEE)
|
||||
{
|
||||
return ((TileEntityEE) world.getTileEntity(xCoord, yCoord, zCoord)).getOrientation();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public short getState(World world, int xCoord, int yCoord, int zCoord)
|
||||
{
|
||||
if (!world.isRemote && world.getTileEntity(xCoord, yCoord, zCoord) instanceof TileEntityEE)
|
||||
{
|
||||
return ((TileEntityEE) world.getTileEntity(xCoord, yCoord, zCoord)).getState();
|
||||
}
|
||||
|
||||
return Short.MIN_VALUE;
|
||||
}
|
||||
|
||||
public String getCustomName(World world, int xCoord, int yCoord, int zCoord)
|
||||
{
|
||||
if (!world.isRemote && world.getTileEntity(xCoord, yCoord, zCoord) instanceof TileEntityEE)
|
||||
{
|
||||
return ((TileEntityEE) world.getTileEntity(xCoord, yCoord, zCoord)).getCustomName();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public UUID getOwnerUUID(World world, int xCoord, int yCoord, int zCoord)
|
||||
{
|
||||
if (!world.isRemote && world.getTileEntity(xCoord, yCoord, zCoord) instanceof TileEntityEE)
|
||||
{
|
||||
return ((TileEntityEE) world.getTileEntity(xCoord, yCoord, zCoord)).getOwnerUUID();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public String getOwnerName(World world, int xCoord, int yCoord, int zCoord)
|
||||
{
|
||||
if (!world.isRemote && world.getTileEntity(xCoord, yCoord, zCoord) instanceof TileEntityEE)
|
||||
{
|
||||
return ((TileEntityEE) world.getTileEntity(xCoord, yCoord, zCoord)).getOwnerName();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -83,6 +83,11 @@ tile.ee3:glassBell.name=Glass Bell
|
|||
tile.ee3:researchStation.name=Research Station
|
||||
tile.ee3:augmentationTable.name=Augmentation Table [WIP]
|
||||
tile.ee3:transmutationSquare.name=Transmutation Square [WIP]
|
||||
tile.ee3:ashInfusedStone.name=Ash Infused Stone
|
||||
tile.ee3:alchemyArray.name=Alchemy Array [WIP]
|
||||
|
||||
# Alchemy Arrays
|
||||
arrays.ee3:basicAlchemyArray=Basic Alchemy Array [WIP]
|
||||
|
||||
# GUIs
|
||||
container.ee3:alchemicalBag=Alchemical Bag
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 14 KiB |
Binary file not shown.
After Width: | Height: | Size: 600 B |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in a new issue