Skip to content

Commit

Permalink
Manual Functioning
Browse files Browse the repository at this point in the history
Almost does all of #14. The handing of the pages should be set all that
needs to be done is the .json files completed
  • Loading branch information
pauljoda committed Mar 1, 2015
1 parent 0f690ab commit 6f0c46f
Show file tree
Hide file tree
Showing 36 changed files with 312 additions and 231 deletions.
44 changes: 22 additions & 22 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
buildscript {
repositories {
mavenCentral()
maven {
name = "forge"
url = "http://files.minecraftforge.net/maven"
repositories {
mavenCentral()
maven {
name = "forge"
url = "http://files.minecraftforge.net/maven"
}
maven {
name = "sonatype"
url = "https://oss.sonatype.org/content/repositories/snapshots/"
}
}
maven {
name = "sonatype"
url = "https://oss.sonatype.org/content/repositories/snapshots/"
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:1.2-SNAPSHOT'
}
}
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:1.2-SNAPSHOT'
}
}

repositories {
maven { // The repo from which to get waila
name "Mobius Repo"
url "http://mobiusstrip.eu/maven"
}
maven { // the repo from which to get NEI and stuff
name 'CB Repo'
url "http://chickenbones.net/maven/"
}
maven { // the repo from which to get NEI and stuff
repositories {
maven { // The repo from which to get waila
name "Mobius Repo"
url "http://mobiusstrip.eu/maven"
}
maven { // the repo from which to get NEI and stuff
name 'CB Repo'
url "http://chickenbones.net/maven/"
}
maven { // the repo from which to get NEI and stuff
name 'TeamBR-Core'
url "http://beyondrealitycore.com/maven2"
}
Expand Down
14 changes: 1 addition & 13 deletions src/main/java/com/dyonovan/modernalchemy/ModernAlchemy.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,23 +59,11 @@ public void preInit(FMLPreInitializationEvent event){
EntityHandler.init();
WorldGeneratorHandler.init();
EventManager.init();
proxy.registerRenderer();
proxy.init();

BucketHandler.INSTANCE.buckets.put(BlockHandler.blockFluidActinium, ItemHandler.itemBucketActinium);
ManualRegistry.instance.init();

ReplicatorUtils.buildDirectory(event.getModConfigurationDirectory().getAbsolutePath() + File.separator + Constants.MODID.toLowerCase() + File.separator + "replicatorValues");

/*//TESTING
ArrayList<ManualComponents> comp = new ArrayList<ManualComponents>();
ArrayList<String> tools = new ArrayList<String>();
tools.add("Test");
ResourceLocation rl = new ResourceLocation(Constants.MODID + ":textures/gui/ma_furnace.png");
comp.add(new ManualComponents("HEADER", 1, 2, 3, 4, 1, "Test", "", "minecraft:diamond", rl, tools));
ArrayList<ManualJson> test = new ArrayList<ManualJson>();
test.add(new ManualJson("Test1", 1, comp));
ManualRegistry.instance.writeManJson(test);*/
}

@SuppressWarnings("unused")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,6 @@ public boolean useWrench(World world, int x, int y, int z) {
return true;
}

public abstract List<ComponentBase> getManualComponents();

@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9) {
if (player.isSneaking() && player.getCurrentEquippedItem() != null && WrenchHelper.isWrench(player.getCurrentEquippedItem().getItem())) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,6 @@ public IIcon getIcon(int i, int j) {
return i != 1 || i != 0 ? front : blockIcon;
}

@Override
public List<ComponentBase> getManualComponents() {
List<ComponentBase> parts = new ArrayList<ComponentBase>();
parts.add(new ComponentItemRender(30, new ItemStack(this)));
return parts;
}

@Override
public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,6 @@ public TileEntity createNewTileEntity(World world, int par2) {
return new TileDummy();
}

@Override
public List<ComponentBase> getManualComponents() {
List<ComponentBase> parts = new ArrayList<ComponentBase>();
parts.add(new ComponentItemRender(30, new ItemStack(this)));
return parts;
}

@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,6 @@ public TileEntity createNewTileEntity(World world, int par2) {
return new TileDummyAirValve();
}

@Override
public List<ComponentBase> getManualComponents() {
List<ComponentBase> parts = new ArrayList<ComponentBase>();
parts.add(new ComponentItemRender(30, new ItemStack(this)));
return parts;
}

@SideOnly(Side.CLIENT)
@Override
public void registerBlockIcons(IIconRegister register) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,6 @@ public TileEntity createNewTileEntity(World world, int par2) {
return new TileDummyEnergyReciever();
}

@Override
public List<ComponentBase> getManualComponents() {
List<ComponentBase> parts = new ArrayList<ComponentBase>();
parts.add(new ComponentItemRender(30, new ItemStack(this)));
return parts;
}

@SideOnly(Side.CLIENT)
@Override
public void registerBlockIcons(IIconRegister register) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,6 @@ public TileEntity createNewTileEntity(World world, int par2) {
return new TileDummyOutputValve();
}

@Override
public List<ComponentBase> getManualComponents() {
List<ComponentBase> parts = new ArrayList<ComponentBase>();
parts.add(new ComponentItemRender(30, new ItemStack(this)));
return parts;
}

@SideOnly(Side.CLIENT)
@Override
public void registerBlockIcons(IIconRegister register) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,6 @@ public TileEntity createNewTileEntity(World world, int par2) {
return new TileDummyItemIO();
}

@Override
public List<ComponentBase> getManualComponents() {
List<ComponentBase> parts = new ArrayList<ComponentBase>();
parts.add(new ComponentItemRender(30, new ItemStack(this)));
return parts;
}

@SideOnly(Side.CLIENT)
@Override
public void registerBlockIcons(IIconRegister register) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,6 @@ public TileEntity createNewTileEntity(World world, int i) {
return new TileAdvancedCrafter();
}

@Override
public List<ComponentBase> getManualComponents() {
List<ComponentBase> parts = new ArrayList<ComponentBase>();
parts.add(new ComponentItemRender(30, new ItemStack(this)));
return parts;
}

@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,6 @@ public TileEntity createNewTileEntity(World world, int i) {
return new TileAmalgamator();
}

@Override
public List<ComponentBase> getManualComponents() {
List<ComponentBase> parts = new ArrayList<ComponentBase>();
parts.add(new ComponentItemRender(30, new ItemStack(this)));
return parts;
}

@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,6 @@ public TileEntity createNewTileEntity(World world, int i) {
return new TileElectricBellows();
}

@Override
public List<ComponentBase> getManualComponents() {
List<ComponentBase> parts = new ArrayList<ComponentBase>();
parts.add(new ComponentItemRender(30, new ItemStack(this)));
return parts;
}

@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,6 @@ public BlockPatternRecorder()
this.setCreativeTab(ModernAlchemy.tabModernAlchemy);
}

@Override
public List<ComponentBase> getManualComponents() {
List<ComponentBase> parts = new ArrayList<ComponentBase>();
parts.add(new ComponentItemRender(30, new ItemStack(this)));
return parts;
}

@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,6 @@ public TileEntity createNewTileEntity(World world, int i) {
return new TileReplicatorCPU();
}

@Override
public List<ComponentBase> getManualComponents() {
List<ComponentBase> parts = new ArrayList<ComponentBase>();
parts.add(new ComponentItemRender(30, new ItemStack(this)));
return parts;
}

@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,13 +232,6 @@ public static void rotate(float[][] targetArray) {
}
}

@Override
public List<ComponentBase> getManualComponents() {
List<ComponentBase> parts = new ArrayList<ComponentBase>();
parts.add(new ComponentItemRender(30, new ItemStack(this)));
return parts;
}

static class RaytraceResult {
public final MovingObjectPosition movingObjectPosition;
public final AxisAlignedBB boundingBox;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,6 @@ public TileEntity createNewTileEntity(World world, int i) {
return new TileReplicatorStand();
}

@Override
public List<ComponentBase> getManualComponents() {
List<ComponentBase> parts = new ArrayList<ComponentBase>();
parts.add(new ComponentItemRender(30, new ItemStack(this)));
return parts;
}

@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9) {
super.onBlockActivated(world, x, y, z, player, par6, par7, par8, par9);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,6 @@ public boolean canPlaceBlockAt(World world, int x, int y, int z) {
world.getBlock(x, y - 1, z) instanceof BlockTeslaStand || world.getBlock(x, y - 1, z) instanceof BlockTeslaCoil);
}

@Override
public List<ComponentBase> getManualComponents() {
List<ComponentBase> parts = new ArrayList<ComponentBase>();
parts.add(new ComponentItemRender(30, new ItemStack(this)));
return parts;
}

@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,18 +74,6 @@ public boolean canPlaceBlockAt(World world, int x, int y, int z) {
return world.getBlock(x, y - 1, z) instanceof BlockTeslaStand;
}

@Override
public List<ComponentBase> getManualComponents() {
List<ComponentBase> parts = new ArrayList<ComponentBase>();
parts.add(new ComponentItemRender(30, new ItemStack(this)));
parts.add(new ComponentTextBox("The Tesla coil is the main method of generating power." +
"Set this block on top of a Tesla Stand and that on top of a Tesla Base to complete the structure."));
parts.add(new ComponentHeader("Crafting"));
parts.add(new ComponentCraftingRecipe(new ItemStack(this)));

return parts;
}

@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,6 @@ public void registerBlockIcons(IIconRegister iconregister) {
this.blockIcon = iconregister.registerIcon("minecraft:iron_block");
}

@Override
public List<ComponentBase> getManualComponents() {
List<ComponentBase> parts = new ArrayList<ComponentBase>();
parts.add(new ComponentItemRender(30, new ItemStack(this)));
return parts;
}

@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9)
{
Expand Down
11 changes: 6 additions & 5 deletions src/main/java/com/dyonovan/modernalchemy/manual/ItemManual.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.dyonovan.modernalchemy.ModernAlchemy;
import com.dyonovan.modernalchemy.handlers.GuiHandler;
import com.dyonovan.modernalchemy.lib.Constants;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.renderer.texture.IIconRegister;
Expand Down Expand Up @@ -47,11 +48,12 @@ public void onUpdate(ItemStack itemstack, World world, Entity entity, int par4,
@Override
public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ) {
if(world.isRemote) {
if(ManualRegistry.instance.getPage(world.getBlock(x, y, z).getUnlocalizedName()) != null) {
if(stack.hasTagCompound())
player.openGui(ModernAlchemy.instance, GuiHandler.MANUAL_GUI_ID, world, (int) player.posX, (int) player.posY, (int) player.posZ);
else
GameRegistry.UniqueIdentifier id = GameRegistry.findUniqueIdentifierFor(world.getBlock(x, y, z));
if(ManualRegistry.instance.getPage(id.name) != null) {
if(ManualRegistry.instance.getOpenPage().getID() == ManualRegistry.instance.getPage(id.name).getID())
ManualRegistry.instance.openManual();
else
ManualRegistry.instance.visitNewPage(id.name);
return true;
}
}
Expand All @@ -63,7 +65,6 @@ public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer
{
if(world.isRemote) {
ManualRegistry.instance.openManual();
//entityPlayer.openGui(ModernAlchemy.instance, GuiHandler.MANUAL_GUI_ID, world, (int) entityPlayer.posX, (int) entityPlayer.posY, (int) entityPlayer.posZ);
}
return itemStack;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.dyonovan.modernalchemy.manual;

import com.dyonovan.modernalchemy.manual.component.IComponent;
import com.google.gson.*;
import net.minecraft.util.ResourceLocation;

Expand Down Expand Up @@ -35,6 +36,7 @@ public ManualJson deserialize(JsonElement json, Type typeOfT, JsonDeserializatio
String destination = je.get("destination").getAsString();
String type = je.get("type").getAsString();
String item = je.get("item").getAsString();
IComponent.ALIGNMENT alignment = IComponent.ALIGNMENT.values()[je.get("alignment").getAsInt()];

JsonObject jo = je.get("resource").getAsJsonObject();
String resourceDomain = jo.get("resourceDomain").getAsString();
Expand All @@ -47,7 +49,7 @@ public ManualJson deserialize(JsonElement json, Type typeOfT, JsonDeserializatio
JsonElement jsonTT = jaTooltips.get(j);
tooltips.add(jsonTT.getAsString());
}
mc.add(new ManualComponents(type, xPos, yPos, width, height, pageNum, text, destination, item, rl, tooltips));
mc.add(new ManualComponents(type, xPos, yPos, width, height, alignment, pageNum, text, destination, item, rl, tooltips));
}
manualJson = new ManualJson(title, pages, mc);
}
Expand Down
Loading

0 comments on commit 6f0c46f

Please sign in to comment.