Skip to content

Commit

Permalink
Moved more necessities to core
Browse files Browse the repository at this point in the history
  • Loading branch information
MrTJP committed Sep 5, 2013
1 parent 549dc8f commit 9443149
Show file tree
Hide file tree
Showing 22 changed files with 76 additions and 105 deletions.
4 changes: 2 additions & 2 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
</condition>
<property name="mc.version" value="1.6.2" />
<property name="forge.version" value="9.10.1.849" />
<property name="ccl.version" value="1.0.0.28" />
<property name="ccl.version" value="1.0.0.29" />
<property name="ccc.version" value="0.9.0.5_d1" />
<property name="fmp.version" value="1.0.0.157" />
<property name="fmp.version" value="1.0.0.158" />
<property name="nei.version" value="1.6.1.3_d1" />

<property name="src.dir" value="ProjectRed" />
Expand Down
4 changes: 3 additions & 1 deletion common/mrtjp/projectred/ProjectRedCore.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import mrtjp.projectred.core.ItemDrawPlate;
import mrtjp.projectred.core.ItemPart;
import mrtjp.projectred.core.ItemScrewdriver;
import mrtjp.projectred.core.ItemWireDebugger;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.MinecraftForge;
Expand Down Expand Up @@ -53,7 +54,9 @@ public ProjectRedCore() {
public static ItemPart itemComponent;
public static ItemDrawPlate itemDrawPlate;
public static ItemScrewdriver itemScrewdriver;
public static ItemWireDebugger itemWireDebugger;


@Instance("ProjRed|Core")
public static ProjectRedCore instance;

Expand All @@ -76,7 +79,6 @@ public ItemStack getIconItemStack() {
}
};


@Mod.EventHandler
public void preInit(FMLPreInitializationEvent event) {
Configurator.initConfig(event);
Expand Down
5 changes: 1 addition & 4 deletions common/mrtjp/projectred/ProjectRedTransmission.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

import mrtjp.projectred.core.Configurator;
import mrtjp.projectred.core.IProxy;
import mrtjp.projectred.core.ItemWireDebugger;
import mrtjp.projectred.transmission.ItemPartFramedWire;
import mrtjp.projectred.transmission.ItemPartWire;
import mrtjp.projectred.transmission.ItemWireDebugger;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.MinecraftForge;
Expand All @@ -24,9 +24,6 @@ public class ProjectRedTransmission {
public static ItemPartWire itemPartWire;
public static ItemPartFramedWire itemPartFramedWire;

/** Items **/
public static ItemWireDebugger itemWireDebugger;

@Instance("ProjRed|Transmission")
public static ProjectRedTransmission instance;

Expand Down
2 changes: 2 additions & 0 deletions common/mrtjp/projectred/core/CoreClientProxy.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import static mrtjp.projectred.ProjectRedCore.itemComponent;
import static mrtjp.projectred.ProjectRedCore.itemDrawPlate;
import static mrtjp.projectred.ProjectRedCore.itemScrewdriver;
import static mrtjp.projectred.ProjectRedCore.itemWireDebugger;
import mrtjp.projectred.core.BlockBasics.EnumBasics;
import mrtjp.projectred.core.ItemPart.EnumPart;
import net.minecraft.item.ItemStack;
Expand All @@ -26,6 +27,7 @@ public void init() {

LanguageRegistry.addName(itemDrawPlate, "Draw Plate");
LanguageRegistry.addName(itemScrewdriver, "Screwdriver");
LanguageRegistry.addName(new ItemStack(itemWireDebugger, 1, 0), "Wire debugger");

MinecraftForge.EVENT_BUS.register(new Messenger());
PacketCustom.assignHandler(Configurator.corePacketChannel, 1, 32, new CoreCPH());
Expand Down
2 changes: 2 additions & 0 deletions common/mrtjp/projectred/core/CoreProxy.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import static mrtjp.projectred.ProjectRedCore.itemComponent;
import static mrtjp.projectred.ProjectRedCore.itemDrawPlate;
import static mrtjp.projectred.ProjectRedCore.itemScrewdriver;
import static mrtjp.projectred.ProjectRedCore.itemWireDebugger;
import mrtjp.projectred.core.BlockBasics.EnumBasics;
import mrtjp.projectred.core.ItemPart.EnumPart;
import cpw.mods.fml.common.registry.GameRegistry;
Expand All @@ -21,6 +22,7 @@ public void init() {
itemComponent = new ItemPart(Configurator.item_componentsID.getInt());
itemDrawPlate = new ItemDrawPlate(Configurator.item_drawplateID.getInt());
itemScrewdriver = new ItemScrewdriver(Configurator.item_screwdriverID.getInt());
itemWireDebugger = new ItemWireDebugger(Configurator.item_wireDebuggerID.getInt());

blockMachines = new BlockBasics(Configurator.block_machinesID.getInt());
GameRegistry.registerBlock(blockMachines, ItemBlockBasics.class, "projectred.expansion.machines");
Expand Down
17 changes: 15 additions & 2 deletions common/mrtjp/projectred/core/CoreRecipes.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import mrtjp.projectred.ProjectRedCore;
import mrtjp.projectred.ProjectRedExploration;
import mrtjp.projectred.ProjectRedIntegration;
import mrtjp.projectred.core.BlockBasics.EnumBasics;
import mrtjp.projectred.core.ItemPart.EnumPart;
import net.minecraft.block.Block;
Expand Down Expand Up @@ -51,7 +50,21 @@ private static void initToolRecipes() {
" bi",
'i', Item.ingotIron,
'b', new ItemStack(Item.dyePowder, 1, PRColors.BLUE.dyeId())
);
);

/** Wire debugger **/
GameRegistry.addRecipe(new ItemStack(ProjectRedCore.itemWireDebugger),
"a a",
"ber",
"bgr",
'a', EnumPart.REDINGOT.getItemStack(),
'b', new ItemStack(Item.dyePowder, 1, PRColors.BLACK.dyeId()),
'e', Item.emerald,
'l', new ItemStack(Item.dyePowder, 1, PRColors.BLUE.dyeId()),
'r', new ItemStack(Item.dyePowder, 1, PRColors.RED.dyeId()),
'g', Item.glowstone
);

}

private static void initPartRecipes() {
Expand Down
72 changes: 23 additions & 49 deletions common/mrtjp/projectred/core/ItemBlockBasics.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package mrtjp.projectred.core;

import mrtjp.projectred.ProjectRedCore;
import mrtjp.projectred.ProjectRedExpansion;
import mrtjp.projectred.core.BlockBasics.EnumBasics;
import net.minecraft.entity.player.EntityPlayer;
Expand All @@ -9,54 +10,27 @@

public class ItemBlockBasics extends ItemBlock {

public ItemBlockBasics(int par1) {
super(par1);
setHasSubtypes(true);
setCreativeTab(ProjectRedExpansion.tabExpansion);
}

/**
* Returns the metadata of the block which this Item (ItemBlock) can place
*/
public int getMetadata(int md) {
return md;
}

/**
* Returns the unlocalized name of this item. This version accepts an
* ItemStack so different stacks can have different names based on their
* damage or NBT.
*/
@Override
public String getUnlocalizedName(ItemStack itemstack) {
return EnumBasics.get(itemstack.getItemDamage()).unlocalname;
}

@Override
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) {
return super.placeBlockAt(stack, player, world, x, y, z, side, hitX, hitY, hitZ, metadata);
// let the actual block do this, we will worry about this once
// we have more than 16 machines in EnumMachine.

/*
int meta = stack.getItemDamage();
if (meta < 0 || meta > EnumMachine.VALID_MACHINES.length - 1) {
return false;
}
if (!super.placeBlockAt(stack, player, world, x, y, z, side, hitX, hitY, hitZ, metadata)) {
return false;
}
if (world.getBlockId(x, y, z) == itemID) {
try {
// world.setBlockTileEntity(x, y, z,
// EnumMachine.get(meta).clazz.newInstance());
} catch (Exception e) {
e.printStackTrace();
}
return true;
}
return false;
*/
}
public ItemBlockBasics(int par1) {
super(par1);
setHasSubtypes(true);
setCreativeTab(ProjectRedCore.tabCore);
}

/**
* Returns the metadata of the block which this Item (ItemBlock) can place
*/
public int getMetadata(int md) {
return md;
}

/**
* Returns the unlocalized name of this item. This version accepts an
* ItemStack so different stacks can have different names based on their
* damage or NBT.
*/
@Override
public String getUnlocalizedName(ItemStack itemstack) {
return EnumBasics.get(itemstack.getItemDamage()).unlocalname;
}

}
2 changes: 1 addition & 1 deletion common/mrtjp/projectred/core/ItemDrawPlate.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ public class ItemDrawPlate extends ItemCraftingDamage {

public ItemDrawPlate(int par1) {
super(par1);
setUnlocalizedName("projectred.items.drawplate");
setUnlocalizedName("projectred.core.drawplate");
setMaxDamage(512);
setCreativeTab(ProjectRedCore.tabCore);
}
Expand Down
2 changes: 1 addition & 1 deletion common/mrtjp/projectred/core/ItemScrewdriver.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
public class ItemScrewdriver extends Item {
public ItemScrewdriver(int id) {
super(id);
setUnlocalizedName("projectred:screwdriver");
setUnlocalizedName("projectred.core.screwdriver");
setMaxStackSize(1);
setMaxDamage(64);
setNoRepair();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package mrtjp.projectred.transmission;
package mrtjp.projectred.core;

import mrtjp.projectred.ProjectRedCore;
import mrtjp.projectred.ProjectRedTransmission;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.entity.player.EntityPlayer;
Expand All @@ -16,8 +17,8 @@ public ItemWireDebugger(int par1) {
setMaxStackSize(1);
setMaxDamage(256);
setNoRepair();
setUnlocalizedName("projectred.transmission.wiredebugger");
setCreativeTab(ProjectRedTransmission.tabTransmission);
setUnlocalizedName("projectred.core.wiredebugger");
setCreativeTab(ProjectRedCore.tabCore);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public ItemPartPressurizedTube(int id) {
super(id);
setHasSubtypes(true);
setCreativeTab(ProjectRedExpansion.tabExpansion);
setUnlocalizedName("projred.expansion.ptube");
setUnlocalizedName("projectred.expansion.ptube");
}

@Override
Expand Down
19 changes: 11 additions & 8 deletions common/mrtjp/projectred/exploration/GeneratorOre.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
import net.minecraft.world.gen.feature.WorldGenerator;
import codechicken.lib.math.MathHelper;

/**
* Generic world ore generator, pretty much direct copy from WorldGenMinable
*/
public class GeneratorOre extends WorldGenerator {

protected int id;
Expand All @@ -28,17 +31,17 @@ public void swapStoneBlock(World world, Random random, int x, int y, int z) {
@Override
public boolean generate(World world, Random random, int x, int y, int z) {
// Randomly space out blocks in vein
float f = random.nextFloat() * 3.141593F;
double d = x + 8 + MathHelper.sin(f) * this.veinSize / 8.0F;
double d1 = x + 8 - MathHelper.sin(f) * this.veinSize / 8.0F;
double d2 = z + 8 + MathHelper.cos(f) * this.veinSize / 8.0F;
double d3 = z + 8 - MathHelper.cos(f) * this.veinSize / 8.0F;
double d4 = y + random.nextInt(3) + 2;
double d5 = y + random.nextInt(3) + 2;
float f = (float) (random.nextFloat() * Math.PI);
double d0 = (double)((float)(x + 8) + MathHelper.sin(f) * (float)this.veinSize / 8.0F);
double d1 = (double)((float)(x + 8) - MathHelper.sin(f) * (float)this.veinSize / 8.0F);
double d2 = (double)((float)(z + 8) + MathHelper.cos(f) * (float)this.veinSize / 8.0F);
double d3 = (double)((float)(z + 8) - MathHelper.cos(f) * (float)this.veinSize / 8.0F);
double d4 = (double)(y + random.nextInt(3) - 2);
double d5 = (double)(y + random.nextInt(3) - 2);

// Do this once for every block of ore we need to generate.
for (int l = 0; l <= this.veinSize; l++) {
double d6 = d + (d1 - d) * l / this.veinSize;
double d6 = d0 + (d1 - d0) * l / this.veinSize;
double d7 = d4 + (d5 - d4) * l / this.veinSize;
double d8 = d2 + (d3 - d2) * l / this.veinSize;
double d9 = random.nextDouble() * this.veinSize / 16.0D;
Expand Down
2 changes: 1 addition & 1 deletion common/mrtjp/projectred/illumination/ItemPartLamp.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public ItemPartLamp(int id, boolean isInverted) {
super(id);
inverted = isInverted;
this.setHasSubtypes(true);
this.setUnlocalizedName("projred.illumination.lamp");
this.setUnlocalizedName("projectred.illumination.lamp");
this.setCreativeTab(ProjectRedIllumination.tabLighting);
}

Expand Down
2 changes: 1 addition & 1 deletion common/mrtjp/projectred/illumination/ItemPartLantern.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public ItemPartLantern(int id, boolean isInverted) {
super(id);
inverted = isInverted;
this.setHasSubtypes(true);
this.setUnlocalizedName("projred.illumination.lantern");
this.setUnlocalizedName("projectred.illumination.lantern");
this.setCreativeTab(ProjectRedIllumination.tabLighting);
}

Expand Down
2 changes: 1 addition & 1 deletion common/mrtjp/projectred/integration/ItemPartGate.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public ItemPartGate(int id) {
super(id);
setHasSubtypes(true);
setCreativeTab(ProjectRedIntegration.tabIntegration);
setUnlocalizedName("projred.integration.gate");
setUnlocalizedName("projectred.integration.gate");
}

@Override
Expand Down
4 changes: 2 additions & 2 deletions common/mrtjp/projectred/transmission/FramedWirePart.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import java.util.Arrays;
import java.util.LinkedList;

import mrtjp.projectred.ProjectRedTransmission;
import mrtjp.projectred.ProjectRedCore;
import mrtjp.projectred.api.IConnectable;
import mrtjp.projectred.core.BasicUtils;
import net.minecraft.client.renderer.RenderBlocks;
Expand Down Expand Up @@ -534,7 +534,7 @@ public boolean activate(EntityPlayer player, MovingObjectPosition hit, ItemStack
}
return true;
}
if (held.itemID == ProjectRedTransmission.itemWireDebugger.itemID) {
if (held.itemID == ProjectRedCore.itemWireDebugger.itemID) {
held.damageItem(1, player);
player.swingItem();
return test(player, hit);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public ItemPartFramedWire(int id) {
super(id);
setHasSubtypes(true);
setCreativeTab(ProjectRedTransmission.tabTransmission);
setUnlocalizedName("projred.transmission.jacwire");
setUnlocalizedName("projectred.transmission.framewire");
}

@Override
Expand Down
2 changes: 1 addition & 1 deletion common/mrtjp/projectred/transmission/ItemPartWire.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public ItemPartWire(int id) {
super(id);
setHasSubtypes(true);
setCreativeTab(ProjectRedTransmission.tabTransmission);
setUnlocalizedName("projred.transmission.wire");
setUnlocalizedName("projectred.transmission.wire");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

import static mrtjp.projectred.ProjectRedTransmission.itemPartFramedWire;
import static mrtjp.projectred.ProjectRedTransmission.itemPartWire;
import static mrtjp.projectred.ProjectRedTransmission.itemWireDebugger;
import net.minecraft.item.ItemStack;
import net.minecraftforge.client.MinecraftForgeClient;
import codechicken.microblock.MicroMaterialRegistry;
import cpw.mods.fml.common.registry.LanguageRegistry;
Expand All @@ -18,7 +16,6 @@ public void init() {
if (w.hasFramedForm())
LanguageRegistry.addName(w.getFramedItemStack(), "Framed " + w.name);
}
LanguageRegistry.addName(new ItemStack(itemWireDebugger, 1, 0), "Wire debugger");
MinecraftForgeClient.registerItemRenderer(itemPartWire.itemID, WireItemRenderer.instance);
MinecraftForgeClient.registerItemRenderer(itemPartFramedWire.itemID, FramedWireItemRenderer.instance);
MicroMaterialRegistry.registerHighlightRenderer(new JacketedHighlightRenderer());
Expand Down
3 changes: 0 additions & 3 deletions common/mrtjp/projectred/transmission/TransmissionProxy.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import static mrtjp.projectred.ProjectRedTransmission.itemPartFramedWire;
import static mrtjp.projectred.ProjectRedTransmission.itemPartWire;
import static mrtjp.projectred.ProjectRedTransmission.itemWireDebugger;
import mrtjp.projectred.core.Configurator;
import mrtjp.projectred.core.IProxy;
import codechicken.multipart.MultiPartRegistry;
Expand All @@ -24,8 +23,6 @@ public void init() {

itemPartWire = new ItemPartWire(Configurator.part_wire.getInt());
itemPartFramedWire = new ItemPartFramedWire(Configurator.part_jwire.getInt());

itemWireDebugger = new ItemWireDebugger(Configurator.item_wireDebuggerID.getInt());

EnumWire.initOreDictDefinitions();
}
Expand Down
Loading

0 comments on commit 9443149

Please sign in to comment.