diff --git a/src/main/java/com/pahimar/ee3/EquivalentExchange3.java b/src/main/java/com/pahimar/ee3/EquivalentExchange3.java index c65217b7..6408ec83 100644 --- a/src/main/java/com/pahimar/ee3/EquivalentExchange3.java +++ b/src/main/java/com/pahimar/ee3/EquivalentExchange3.java @@ -98,6 +98,7 @@ public class EquivalentExchange3 // Register our fuels GameRegistry.registerFuelHandler(new FuelHandler()); + // Register the Waila data provider FMLInterModComms.sendMessage("Waila", "register", "com.pahimar.ee3.waila.WailaDataProvider.callbackRegister"); } @@ -113,7 +114,7 @@ public class EquivalentExchange3 { if (EnergyValueRegistry.getInstance().getShouldRegenNextRestart()) { - File dataDirectory = new File(FMLCommonHandler.instance().getMinecraftServerInstance().getEntityWorld().getSaveHandler().getWorldDirectory(), "data" + File.separator + "ee3"); + File dataDirectory = new File(FMLCommonHandler.instance().getMinecraftServerInstance().getEntityWorld().getSaveHandler().getWorldDirectory(), "data" + File.separator + Reference.MOD_ID.toLowerCase()); File energyValueRegistryFile = new File(dataDirectory, SerializationHelper.getModListMD5() + ".ee3"); if (energyValueRegistryFile.exists()) @@ -123,7 +124,7 @@ public class EquivalentExchange3 } else { - SerializationHelper.writeEnergyValueRegistryToFile(SerializationHelper.getModListMD5() + ".ee3"); + SerializationHelper.writeEnergyValueRegistryToFile(SerializationHelper.getModListMD5() + Reference.MOD_ID.toLowerCase()); } WorldEventHandler.hasInitilialized = false; diff --git a/src/main/java/com/pahimar/ee3/api/Glyph.java b/src/main/java/com/pahimar/ee3/api/Glyph.java index 5ea01ee8..afe5de2f 100644 --- a/src/main/java/com/pahimar/ee3/api/Glyph.java +++ b/src/main/java/com/pahimar/ee3/api/Glyph.java @@ -15,6 +15,11 @@ public class Glyph implements Comparable } + public Glyph(ResourceLocation texture, String unLocalizedName) + { + this(texture, unLocalizedName, 1); + } + public Glyph(String texture, String unLocalizedName) { this(texture, unLocalizedName, 1); @@ -88,7 +93,7 @@ public class Glyph implements Comparable @Override public String toString() { - return String.format("texture: %s, unLocalizedName: %s, size: %s", texture.getResourcePath() + ":" + texture.getResourcePath(), unLocalizedName, size); + return String.format("texture: %s, unLocalizedName: %s, size: %s", texture.getResourceDomain() + ":" + texture.getResourcePath(), unLocalizedName, size); } @Override diff --git a/src/main/java/com/pahimar/ee3/block/BlockAlchemyArray.java b/src/main/java/com/pahimar/ee3/block/BlockAlchemyArray.java index e1fb3f5a..ad53c7d6 100644 --- a/src/main/java/com/pahimar/ee3/block/BlockAlchemyArray.java +++ b/src/main/java/com/pahimar/ee3/block/BlockAlchemyArray.java @@ -1,5 +1,6 @@ package com.pahimar.ee3.block; +import com.pahimar.ee3.init.Glyphs; import com.pahimar.ee3.reference.Names; import com.pahimar.ee3.reference.RenderIds; import com.pahimar.ee3.tileentity.TileEntityAlchemyArray; @@ -8,6 +9,7 @@ import net.minecraft.block.material.Material; import net.minecraft.entity.EntityLivingBase; 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.World; @@ -57,16 +59,71 @@ public class BlockAlchemyArray extends BlockEE implements ITileEntityProvider super.onBlockPlacedBy(world, x, y, z, entityLiving, itemStack); if (world.getTileEntity(x, y, z) instanceof TileEntityAlchemyArray) { - // TODO: Place the first glyph of the alchemy array from the player's currently selected glyph + // TODO: Place the first glyph of the alchemy glyphs from the player's currently selected glyph + ((TileEntityAlchemyArray) world.getTileEntity(x, y, z)).addGlyphToAlchemyArray(Glyphs.BASE_CIRCLE); } } + @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 AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) + { + return null; + } + + /** + * Ray traces through the blocks collision from start vector to end vector returning a ray trace hit. Args: world, + * x, y, z, startVec, endVec + */ @Override public MovingObjectPosition collisionRayTrace(World world, int x, int y, int z, Vec3 startVec, Vec3 endVec) { if (world.getTileEntity(x, y, z) instanceof TileEntityAlchemyArray) { - return super.collisionRayTrace(world, x, y, z, startVec, endVec); + TileEntityAlchemyArray tileEntityAlchemyArray = (TileEntityAlchemyArray) world.getTileEntity(x, y, z); + + switch (tileEntityAlchemyArray.getOrientation()) + { + case DOWN: + { + this.setBlockBounds(0.125F, 0.33F, 0.125F, 0.875F, 1.0F, 0.875F); + break; + } + case UP: + { + this.setBlockBounds(0.125F, 0.0F, 0.125F, 0.875F, 0.66F, 0.875F); + break; + } + case NORTH: + { + this.setBlockBounds(0.125F, 0.125F, 0.33F, 0.875F, 0.875F, 1.0F); + break; + } + case SOUTH: + { + this.setBlockBounds(0.125F, 0.125F, 0.0F, 0.875F, 0.875F, 0.66F); + break; + } + case EAST: + { + this.setBlockBounds(0.0F, 0.125F, 0.125F, 0.66F, 0.875F, 0.875F); + break; + } + case WEST: + { + this.setBlockBounds(0.33F, 0.125F, 0.125F, 1.0F, 0.875F, 0.875F); + break; + } + case UNKNOWN: + { + break; + } + } } return super.collisionRayTrace(world, x, y, z, startVec, endVec); diff --git a/src/main/java/com/pahimar/ee3/init/Glyphs.java b/src/main/java/com/pahimar/ee3/init/Glyphs.java index ac44f822..fee287e7 100644 --- a/src/main/java/com/pahimar/ee3/init/Glyphs.java +++ b/src/main/java/com/pahimar/ee3/init/Glyphs.java @@ -2,23 +2,25 @@ package com.pahimar.ee3.init; import com.pahimar.ee3.api.Glyph; import com.pahimar.ee3.api.GlyphRegistryProxy; +import com.pahimar.ee3.reference.Names; +import com.pahimar.ee3.reference.Textures; public class Glyphs { - private static final String SYMBOL_TEXTURE_LOCATION = "textures/array/"; + private static final String SYMBOL_TEXTURE_LOCATION = "textures/glyphs/"; - public static final Glyph BASE_CIRCLE = new Glyph(SYMBOL_TEXTURE_LOCATION + "transBaseCircle.png", ""); - public static final Glyph DOT = new Glyph(SYMBOL_TEXTURE_LOCATION + "transDot.png", ""); - public static final Glyph LINE = new Glyph(SYMBOL_TEXTURE_LOCATION + "transLine.png", ""); - public static final Glyph CIRCLE = new Glyph(SYMBOL_TEXTURE_LOCATION + "transCircle.png", ""); - public static final Glyph TRIANGLE = new Glyph(SYMBOL_TEXTURE_LOCATION + "transTriangle.png", ""); - public static final Glyph INVERTED_TRIANGLE = new Glyph(SYMBOL_TEXTURE_LOCATION + "transInvertedTriangle.png", ""); - public static final Glyph SQUARE = new Glyph(SYMBOL_TEXTURE_LOCATION + "transSquare.png", ""); - public static final Glyph DIAMOND = new Glyph(SYMBOL_TEXTURE_LOCATION + "transDiamond.png", ""); - public static final Glyph PENTAGON = new Glyph(SYMBOL_TEXTURE_LOCATION + "transPentagon.png", ""); - public static final Glyph HEXAGON = new Glyph(SYMBOL_TEXTURE_LOCATION + "transHexagon.png", ""); - public static final Glyph HEPTGON = new Glyph(SYMBOL_TEXTURE_LOCATION + "transHeptagon.png", ""); - public static final Glyph OCTAGON = new Glyph(SYMBOL_TEXTURE_LOCATION + "transOctagon.png", ""); + public static final Glyph BASE_CIRCLE = new Glyph(Textures.Glyph.BASE_CIRCLE, Names.Glyphs.BASE_CIRCLE); + public static final Glyph DOT = new Glyph(Textures.Glyph.DOT, Names.Glyphs.DOT); + public static final Glyph LINE = new Glyph(Textures.Glyph.LINE, Names.Glyphs.LINE); + public static final Glyph CIRCLE = new Glyph(Textures.Glyph.CIRCLE, Names.Glyphs.CIRCLE); + public static final Glyph TRIANGLE = new Glyph(Textures.Glyph.TRIANGLE, Names.Glyphs.TRIANGLE); + public static final Glyph INVERTED_TRIANGLE = new Glyph(Textures.Glyph.INVERTED_TRIANGLE, Names.Glyphs.INVERTED_TRIANGLE); + public static final Glyph SQUARE = new Glyph(Textures.Glyph.SQUARE, Names.Glyphs.SQUARE); + public static final Glyph DIAMOND = new Glyph(Textures.Glyph.DIAMOND, Names.Glyphs.DIAMOND); + public static final Glyph PENTAGON = new Glyph(Textures.Glyph.PENTAGON, Names.Glyphs.PENTAGON); + public static final Glyph HEXAGON = new Glyph(Textures.Glyph.HEXAGON, Names.Glyphs.HEXAGON); + public static final Glyph HEPTAGON = new Glyph(Textures.Glyph.HEPTAGON, Names.Glyphs.HEPTAGON); + public static final Glyph OCTAGON = new Glyph(Textures.Glyph.OCTAGON, Names.Glyphs.OCTAGON); public static void init() { @@ -32,7 +34,7 @@ public class Glyphs GlyphRegistryProxy.addGlyph(DIAMOND); GlyphRegistryProxy.addGlyph(PENTAGON); GlyphRegistryProxy.addGlyph(HEXAGON); - GlyphRegistryProxy.addGlyph(HEPTGON); + GlyphRegistryProxy.addGlyph(HEPTAGON); GlyphRegistryProxy.addGlyph(OCTAGON); } } diff --git a/src/main/java/com/pahimar/ee3/item/ItemChalk.java b/src/main/java/com/pahimar/ee3/item/ItemChalk.java index 993f6cde..819f0c6a 100644 --- a/src/main/java/com/pahimar/ee3/item/ItemChalk.java +++ b/src/main/java/com/pahimar/ee3/item/ItemChalk.java @@ -59,7 +59,8 @@ public class ItemChalk extends ItemEE implements IKeyBound, IChargeable, IOverla if (world.canPlaceEntityOnSide(ModBlocks.alchemyArray, x, y, z, false, side, entityPlayer, itemStack)) { - if (placeBlockAt(itemStack, entityPlayer, world, x, y, z, side, hitX, hitY, hitZ, 0)) + int sideHit = ModBlocks.alchemyArray.onBlockPlaced(world, x, y, z, side, hitX, hitY, hitZ, itemStack.getItemDamage()); + if (placeBlockAt(itemStack, entityPlayer, world, x, y, z, side, hitX, hitY, hitZ, sideHit)) { world.playSoundEffect(x + 0.5d, y + 0.5d, z + 0.5d, ModBlocks.alchemyArray.stepSound.func_150496_b(), (ModBlocks.alchemyArray.stepSound.getVolume() + 1.0F) / 2.0F, ModBlocks.alchemyArray.stepSound.getPitch() * 0.8F); --itemStack.stackSize; @@ -71,12 +72,14 @@ public class ItemChalk extends ItemEE implements IKeyBound, IChargeable, IOverla } /** - * Called to actually place the block, after the location is determined - * and all permission checks have been made. + * Called to actually place the block, after the location is determined and all permission checks have been made. * - * @param stack The item stack that was used to place the block. This can be changed inside the method. - * @param player The player who is placing the block. Can be null if the block is not being placed by a player. - * @param side The side the player (or machine) right-clicked on. + * @param stack + * The item stack that was used to place the block. This can be changed inside the method. + * @param player + * The player who is placing the block. Can be null if the block is not being placed by a player. + * @param side + * The side the player (or machine) right-clicked on. */ public boolean placeBlockAt(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ, int metadata) { diff --git a/src/main/java/com/pahimar/ee3/network/message/MessageTileEntityEE.java b/src/main/java/com/pahimar/ee3/network/message/MessageTileEntityEE.java index 46a71ddb..400c66f9 100644 --- a/src/main/java/com/pahimar/ee3/network/message/MessageTileEntityEE.java +++ b/src/main/java/com/pahimar/ee3/network/message/MessageTileEntityEE.java @@ -11,7 +11,7 @@ import net.minecraft.tileentity.TileEntity; public class MessageTileEntityEE implements IMessage, IMessageHandler { // TODO: Investigate using compressed NBT data to unify tile entity packets into this single one - // We would only need x, y, z, and the compressed nbt byte array to do this + // We would only need x, y, z, and the compressed nbt byte glyphs to do this public int x, y, z; public byte orientation, state; diff --git a/src/main/java/com/pahimar/ee3/reference/Names.java b/src/main/java/com/pahimar/ee3/reference/Names.java index de5a45bb..736ff29b 100644 --- a/src/main/java/com/pahimar/ee3/reference/Names.java +++ b/src/main/java/com/pahimar/ee3/reference/Names.java @@ -121,4 +121,20 @@ public class Names public static final String RELEASE = "key.release"; public static final String TOGGLE = "key.toggle"; } + + public static final class Glyphs + { + public static final String BASE_CIRCLE = "glyph.ee3:baseCircle"; + public static final String CIRCLE = "glyph.ee3:circle"; + public static final String DIAMOND = "glyph.ee3:diamond"; + public static final String DOT = "glyph.ee3:dot"; + public static final String HEPTAGON = "glyph.ee3:heptagon"; + public static final String HEXAGON = "glyph.ee3:hexagon"; + public static final String INVERTED_TRIANGLE = "glyph.ee3:invertedTriangle"; + public static final String LINE = "glyph.ee3:line"; + public static final String OCTAGON = "glyph.ee3:octagon"; + public static final String PENTAGON = "glyph.ee3:pentagon"; + public static final String SQUARE = "glyph.ee3:square"; + public static final String TRIANGLE = "glyph.ee3:triangle"; + } } diff --git a/src/main/java/com/pahimar/ee3/reference/Textures.java b/src/main/java/com/pahimar/ee3/reference/Textures.java index 5eefa92a..5a9029c1 100644 --- a/src/main/java/com/pahimar/ee3/reference/Textures.java +++ b/src/main/java/com/pahimar/ee3/reference/Textures.java @@ -50,4 +50,23 @@ public final class Textures private static final String EFFECTS_LOCATION = "textures/effects/"; public static final ResourceLocation WORLD_TRANSMUTATION = ResourceLocationHelper.getResourceLocation(EFFECTS_LOCATION + "noise.png"); } + + public static final class Glyph + { + private static final String SYMBOL_TEXTURE_LOCATION = "textures/glyphs/"; + + + 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 INVERTED_TRIANGLE = ResourceLocationHelper.getResourceLocation(SYMBOL_TEXTURE_LOCATION + "transInvertedTriangle.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"); + } } diff --git a/src/main/resources/assets/ee3/lang/en_US.lang b/src/main/resources/assets/ee3/lang/en_US.lang index efd0d34e..3803ac7e 100644 --- a/src/main/resources/assets/ee3/lang/en_US.lang +++ b/src/main/resources/assets/ee3/lang/en_US.lang @@ -99,6 +99,20 @@ container.ee3:augmentationTable=Augmentation Table [WIP] container.ee3:alchemicalTome=Tome of Alchemical Knowledge [WIP] container.ee3:transmutationSquare=Transmutation Square [WIP] +# Glyphs +glyph.ee3:baseCircle=Circle (Base) +glyph.ee3:circle=Circle +glyph.ee3:diamond=Diamond +glyph.ee3:dot=Dot +glyph.ee3:heptagon=Heptagon +glyph.ee3:hexagon=Hexagon +glyph.ee3:invertedTriangle=Triangle (Inverted) +glyph.ee3:line=Line +glyph.ee3:octagon=Octagon +glyph.ee3:pentagon=Pentagon +glyph.ee3:square=Square +glyph.ee3:triangle=Triangle + # Commands command.ee3.usage=/ee3 command.ee3.set-value.usage=/ee3-set-value [data] [dataTag] diff --git a/src/main/resources/assets/ee3/textures/array/transBaseCircle.png b/src/main/resources/assets/ee3/textures/glyphs/transBaseCircle.png similarity index 100% rename from src/main/resources/assets/ee3/textures/array/transBaseCircle.png rename to src/main/resources/assets/ee3/textures/glyphs/transBaseCircle.png diff --git a/src/main/resources/assets/ee3/textures/array/transCircle.png b/src/main/resources/assets/ee3/textures/glyphs/transCircle.png similarity index 100% rename from src/main/resources/assets/ee3/textures/array/transCircle.png rename to src/main/resources/assets/ee3/textures/glyphs/transCircle.png diff --git a/src/main/resources/assets/ee3/textures/array/transDiamond.png b/src/main/resources/assets/ee3/textures/glyphs/transDiamond.png similarity index 100% rename from src/main/resources/assets/ee3/textures/array/transDiamond.png rename to src/main/resources/assets/ee3/textures/glyphs/transDiamond.png diff --git a/src/main/resources/assets/ee3/textures/array/transDot.png b/src/main/resources/assets/ee3/textures/glyphs/transDot.png similarity index 100% rename from src/main/resources/assets/ee3/textures/array/transDot.png rename to src/main/resources/assets/ee3/textures/glyphs/transDot.png diff --git a/src/main/resources/assets/ee3/textures/array/transHeptagon.png b/src/main/resources/assets/ee3/textures/glyphs/transHeptagon.png similarity index 100% rename from src/main/resources/assets/ee3/textures/array/transHeptagon.png rename to src/main/resources/assets/ee3/textures/glyphs/transHeptagon.png diff --git a/src/main/resources/assets/ee3/textures/array/transHexagon.png b/src/main/resources/assets/ee3/textures/glyphs/transHexagon.png similarity index 100% rename from src/main/resources/assets/ee3/textures/array/transHexagon.png rename to src/main/resources/assets/ee3/textures/glyphs/transHexagon.png diff --git a/src/main/resources/assets/ee3/textures/array/transInvertedTriangle.png b/src/main/resources/assets/ee3/textures/glyphs/transInvertedTriangle.png similarity index 100% rename from src/main/resources/assets/ee3/textures/array/transInvertedTriangle.png rename to src/main/resources/assets/ee3/textures/glyphs/transInvertedTriangle.png diff --git a/src/main/resources/assets/ee3/textures/array/transLine.png b/src/main/resources/assets/ee3/textures/glyphs/transLine.png similarity index 100% rename from src/main/resources/assets/ee3/textures/array/transLine.png rename to src/main/resources/assets/ee3/textures/glyphs/transLine.png diff --git a/src/main/resources/assets/ee3/textures/array/transOctagon.png b/src/main/resources/assets/ee3/textures/glyphs/transOctagon.png similarity index 100% rename from src/main/resources/assets/ee3/textures/array/transOctagon.png rename to src/main/resources/assets/ee3/textures/glyphs/transOctagon.png diff --git a/src/main/resources/assets/ee3/textures/array/transPentagon.png b/src/main/resources/assets/ee3/textures/glyphs/transPentagon.png similarity index 100% rename from src/main/resources/assets/ee3/textures/array/transPentagon.png rename to src/main/resources/assets/ee3/textures/glyphs/transPentagon.png diff --git a/src/main/resources/assets/ee3/textures/array/transSquare.png b/src/main/resources/assets/ee3/textures/glyphs/transSquare.png similarity index 100% rename from src/main/resources/assets/ee3/textures/array/transSquare.png rename to src/main/resources/assets/ee3/textures/glyphs/transSquare.png diff --git a/src/main/resources/assets/ee3/textures/array/transTriangle.png b/src/main/resources/assets/ee3/textures/glyphs/transTriangle.png similarity index 100% rename from src/main/resources/assets/ee3/textures/array/transTriangle.png rename to src/main/resources/assets/ee3/textures/glyphs/transTriangle.png