More glyph stuff

This commit is contained in:
Pahimar 2014-10-05 19:29:54 -04:00
parent 699a624c8a
commit bce498695e
21 changed files with 143 additions and 26 deletions

View file

@ -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;

View file

@ -15,6 +15,11 @@ public class Glyph implements Comparable<Glyph>
}
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<Glyph>
@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

View file

@ -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);

View file

@ -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);
}
}

View file

@ -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)
{

View file

@ -11,7 +11,7 @@ import net.minecraft.tileentity.TileEntity;
public class MessageTileEntityEE implements IMessage, IMessageHandler<MessageTileEntityEE, IMessage>
{
// 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;

View file

@ -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";
}
}

View file

@ -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");
}
}

View file

@ -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 <set-value|sync-values>
command.ee3.set-value.usage=/ee3-set-value <pre|post> <item> <value> [data] [dataTag]

View file

Before

Width:  |  Height:  |  Size: 3 KiB

After

Width:  |  Height:  |  Size: 3 KiB

View file

Before

Width:  |  Height:  |  Size: 3.4 KiB

After

Width:  |  Height:  |  Size: 3.4 KiB

View file

Before

Width:  |  Height:  |  Size: 3 KiB

After

Width:  |  Height:  |  Size: 3 KiB

View file

Before

Width:  |  Height:  |  Size: 3 KiB

After

Width:  |  Height:  |  Size: 3 KiB

View file

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

View file

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

View file

Before

Width:  |  Height:  |  Size: 3 KiB

After

Width:  |  Height:  |  Size: 3 KiB

View file

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

View file

Before

Width:  |  Height:  |  Size: 3 KiB

After

Width:  |  Height:  |  Size: 3 KiB

View file

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

View file

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB