Skip to content

Commit b6a3d71

Browse files
committed
Portable Teleporters: DONE! (without texture yet)
1 parent 939f9ac commit b6a3d71

21 files changed

+382
-125
lines changed

makmods/levelstorage/ExperienceRecipe.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,17 @@ public class ExperienceRecipe implements IRecipe {
1717
public boolean matches(InventoryCrafting inventoryCrafting, World world) {
1818
return this.getResInternal(inventoryCrafting) != null;
1919
}
20-
20+
2121
public ItemStack getResInternal(InventoryCrafting inventoryCrafting) {
22-
22+
2323
int bookXp = 0;
2424
ItemStack initialBookStack = null;
2525
boolean seenBook = false;
2626
ArrayList<Boolean> valids = new ArrayList<Boolean>();
2727
int buffXp = 0;
2828
for (int i = 0; i < inventoryCrafting.getSizeInventory(); ++i) {
2929
boolean cycleCompleted = false;
30-
30+
3131
ItemStack currentStack = inventoryCrafting.getStackInSlot(i);
3232
if (currentStack != null && !currentStack.equals(null)) {
3333
if (currentStack.getItem() instanceof ItemLevelStorageBook) {
@@ -69,12 +69,12 @@ public ItemStack getResInternal(InventoryCrafting inventoryCrafting) {
6969
if (!v)
7070
return null;
7171
}
72-
72+
7373
if ((bookXp + buffXp) >= LevelStorage.itemLevelStorageBookSpace)
7474
return null;
7575

7676
int totalXp = bookXp + buffXp;
77-
77+
7878
if (totalXp == 0)
7979
return null;
8080
if (!seenBook)

makmods/levelstorage/LevelStorage.java

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public class LevelStorage {
4141
public static boolean chargerOnlyUUM;
4242
public static boolean experienceRecipesOn;
4343
public static int currentIds = 250;
44-
44+
4545
public static boolean detectedGT = false;
4646

4747
public static int getAndIncrementCurrId() {
@@ -56,17 +56,19 @@ public void preInit(FMLPreInitializationEvent event) {
5656
event.getSuggestedConfigurationFile());
5757
configuration = config;
5858
configuration.load();
59-
this.itemLevelStorageBookSpace = config.get(
59+
LevelStorage.itemLevelStorageBookSpace = config.get(
6060
Configuration.CATEGORY_GENERAL, "bookCapacity",
6161
2 * 2 * 2 * 2 * 2 * 2 * 2 * 2 * 2 * 2 * 2 * 2 * 2 * 2) // 16384
6262
.getInt();
63-
Property p = config.get(Configuration.CATEGORY_GENERAL, "chargerOnlyUsesUUM", true);
63+
Property p = config.get(Configuration.CATEGORY_GENERAL,
64+
"chargerOnlyUsesUUM", true);
6465
p.comment = "If set to true, chargers will consume UUM and only UUM (they will refuse to receive any energy), if set to false, chargers will receive energy and only energy (no UUM)";
65-
this.chargerOnlyUUM = p.getBoolean(true);
66-
67-
Property p2 = config.get(Configuration.CATEGORY_GENERAL, "experienceRecipesEnabled", true);
66+
LevelStorage.chargerOnlyUUM = p.getBoolean(true);
67+
68+
Property p2 = config.get(Configuration.CATEGORY_GENERAL,
69+
"experienceRecipesEnabled", true);
6870
p2.comment = "Whether or not experience recipes are enabled";
69-
this.experienceRecipesOn = p2.getBoolean(true);
71+
LevelStorage.experienceRecipesOn = p2.getBoolean(true);
7072
}
7173

7274
@EventHandler
@@ -99,7 +101,7 @@ public void postInit(FMLPostInitializationEvent event) {
99101
XpStackRegistry.instance.printRegistry();
100102

101103
configuration.save();
102-
104+
103105
if (Loader.isModLoaded("gregtech_addon")) {
104106
FMLLog.info("GregTech detected. Performing needed changes.");
105107
detectedGT = true;

makmods/levelstorage/ModBlocks.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
package makmods.levelstorage;
22

3-
import ic2.api.item.Items;
4-
import ic2.api.recipe.Recipes;
5-
63
import java.lang.reflect.Field;
74
import java.util.logging.Level;
85

@@ -12,9 +9,6 @@
129
import makmods.levelstorage.block.BlockXpGenerator;
1310
import makmods.levelstorage.lib.Reference;
1411
import net.minecraft.block.Block;
15-
import net.minecraft.item.Item;
16-
import net.minecraft.item.ItemStack;
17-
import net.minecraftforge.common.Configuration;
1812
import net.minecraftforge.common.MinecraftForge;
1913
import cpw.mods.fml.common.FMLLog;
2014
import cpw.mods.fml.common.registry.GameRegistry;

makmods/levelstorage/ModItems.java

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,21 @@
11
package makmods.levelstorage;
22

3-
import ic2.api.item.Items;
4-
import ic2.api.recipe.Recipes;
5-
63
import java.lang.reflect.Field;
74
import java.lang.reflect.Modifier;
85
import java.util.Random;
96
import java.util.logging.Level;
107

118
import makmods.levelstorage.item.ItemAdvancedScanner;
9+
import makmods.levelstorage.item.ItemCompactTeleporter;
1210
import makmods.levelstorage.item.ItemFrequencyCard;
1311
import makmods.levelstorage.item.ItemLevelStorageBook;
1412
import makmods.levelstorage.lib.Reference;
15-
import net.minecraft.block.Block;
1613
import net.minecraft.item.Item;
1714
import net.minecraft.item.ItemStack;
18-
import net.minecraft.item.crafting.CraftingManager;
1915
import net.minecraft.nbt.NBTTagCompound;
2016
import net.minecraft.util.WeightedRandomChestContent;
2117
import net.minecraftforge.common.ChestGenHooks;
2218
import cpw.mods.fml.common.FMLLog;
23-
import cpw.mods.fml.common.registry.GameRegistry;
2419
import cpw.mods.fml.common.registry.LanguageRegistry;
2520

2621
public class ModItems {
@@ -29,6 +24,7 @@ public class ModItems {
2924
public ItemLevelStorageBook itemLevelStorageBook;
3025
public ItemAdvancedScanner itemAdvScanner;
3126
public ItemFrequencyCard itemFreqCard;
27+
public ItemCompactTeleporter itemCompactTeleporter;
3228

3329
private int incr = 0;
3430

@@ -80,7 +76,7 @@ private void addCustomFeatures() {
8076
Random rnd = new Random();
8177
rnd.setSeed(rnd.nextInt() + this.incr);
8278

83-
ItemStack bookStack = new ItemStack(itemLevelStorageBook);
79+
ItemStack bookStack = new ItemStack(this.itemLevelStorageBook);
8480
bookStack.stackTagCompound = new NBTTagCompound();
8581
bookStack.stackTagCompound.setInteger(
8682
ItemLevelStorageBook.STORED_XP_NBT,

makmods/levelstorage/api/ItemAPI.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,11 @@ public static ItemStack getItem(String name) {
8686

8787
if (nameCurrent == name) {
8888
System.out.println("name = nameCurrent");
89-
if (objCurrent instanceof Block) {
89+
if (objCurrent instanceof Block)
9090
return new ItemStack((Block) objCurrent);
91-
} else {
92-
if (objCurrent instanceof Item) {
91+
else {
92+
if (objCurrent instanceof Item)
9393
return new ItemStack((Item) objCurrent);
94-
}
9594
}
9695
}
9796

makmods/levelstorage/block/BlockWirelessConductor.java

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
import net.minecraft.block.Block;
1515
import net.minecraft.block.BlockContainer;
1616
import net.minecraft.block.material.Material;
17-
import net.minecraft.client.renderer.texture.IconRegister;
1817
import net.minecraft.entity.item.EntityItem;
1918
import net.minecraft.entity.player.EntityPlayer;
2019
import net.minecraft.inventory.IInventory;
@@ -24,17 +23,13 @@
2423
import net.minecraft.tileentity.TileEntity;
2524
import net.minecraft.util.Icon;
2625
import net.minecraft.world.World;
27-
import net.minecraftforge.common.ForgeDirection;
2826
import cpw.mods.fml.common.FMLCommonHandler;
29-
import cpw.mods.fml.relauncher.Side;
30-
import cpw.mods.fml.relauncher.SideOnly;
3127

3228
public class BlockWirelessConductor extends BlockContainer {
3329

3430
public static final String UNLOCALIZED_NAME = "blockWirelessConductor";
3531
public static final String NAME = "Wireless Conductor";
36-
37-
32+
3833
public BlockWirelessConductor() {
3934
super(LevelStorage.configuration.getBlock(UNLOCALIZED_NAME,
4035
LevelStorage.getAndIncrementCurrId()).getInt(), Material.iron);
@@ -46,18 +41,19 @@ public BlockWirelessConductor() {
4641
this.setHardness(3.0F);
4742
this.setBlockBounds(0F, 0F, 0F, 1F, 0.375F, 1F);
4843
}
49-
44+
5045
public static void addCraftingRecipe() {
5146
ItemStack frequencyTr = Items.getItem("frequencyTransmitter");
5247
ItemStack transformerHv = Items.getItem("hvTransformer");
5348
ItemStack advCircuit = Items.getItem("advancedCircuit");
5449
ItemStack advMachine = Items.getItem("advancedMachine");
5550
ItemStack enderPearl = new ItemStack(Item.enderPearl);
56-
Recipes.advRecipes.addRecipe(new ItemStack(ModBlocks.instance.blockWlessConductor),
57-
"tmt", "cec", "chc", Character.valueOf('t'), frequencyTr,
58-
Character.valueOf('e'), enderPearl, Character.valueOf('c'),
59-
advCircuit, Character.valueOf('h'), transformerHv,
60-
Character.valueOf('m'), advMachine);
51+
Recipes.advRecipes.addRecipe(new ItemStack(
52+
ModBlocks.instance.blockWlessConductor), "tmt", "cec", "chc",
53+
Character.valueOf('t'), frequencyTr, Character.valueOf('e'),
54+
enderPearl, Character.valueOf('c'), advCircuit, Character
55+
.valueOf('h'), transformerHv, Character.valueOf('m'),
56+
advMachine);
6157
}
6258

6359
private Icon down;
@@ -79,6 +75,7 @@ public boolean isOpaqueCube() {
7975
}
8076

8177
// It's not a normal block, so you need this too.
78+
@Override
8279
public boolean renderAsNormalBlock() {
8380
return false;
8481
}

makmods/levelstorage/gui/ContainerXpCharger.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import ic2.api.item.Items;
44
import makmods.levelstorage.LevelStorage;
5-
import makmods.levelstorage.registry.SyncType;
65
import makmods.levelstorage.tileentity.TileEntityXpCharger;
76
import net.minecraft.entity.player.EntityPlayer;
87
import net.minecraft.entity.player.InventoryPlayer;
@@ -35,8 +34,9 @@ public ContainerXpCharger(InventoryPlayer inventoryPlayer,
3534
TileEntityXpCharger te) {
3635
this.tileEntity = te;
3736
this.addSlotToContainer(new SlotBookCharger(this.tileEntity, 0, 80, 35));
38-
if (LevelStorage.chargerOnlyUUM)
37+
if (LevelStorage.chargerOnlyUUM) {
3938
this.addSlotToContainer(new SlotUUM(this.tileEntity, 1, 80, 15));
39+
}
4040

4141
this.bindPlayerInventory(inventoryPlayer);
4242
}

makmods/levelstorage/gui/GuiXpCharger.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import makmods.levelstorage.proxy.ClientProxy;
55
import makmods.levelstorage.tileentity.TileEntityXpCharger;
66
import net.minecraft.client.gui.inventory.GuiContainer;
7-
import net.minecraft.client.renderer.Tessellator;
87
import net.minecraft.entity.player.InventoryPlayer;
98
import net.minecraft.util.StatCollector;
109

@@ -39,16 +38,18 @@ protected void drawGuiContainerBackgroundLayer(float par1, int par2,
3938
// draw your Gui here, only thing you need to change is the path
4039
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
4140
// this.mc.renderEngine.bindTexture(ClientProxy.GUI_SINGLE_SLOT);
42-
if (LevelStorage.chargerOnlyUUM)
41+
if (LevelStorage.chargerOnlyUUM) {
4342
this.mc.func_110434_K().func_110577_a(ClientProxy.GUI_CHARGER);
44-
else
43+
} else {
4544
this.mc.func_110434_K().func_110577_a(
4645
ClientProxy.GUI_CHARGER_NO_UUM);
46+
}
4747
int x = (this.width - this.xSize) / 2;
4848
int y = (this.height - this.ySize) / 2;
4949
this.drawTexturedModalRect(x, y, 0, 0, this.xSize, this.ySize);
50-
if (LevelStorage.chargerOnlyUUM)
51-
drawTexturedModalRect(x + 69, y + 55, 176, 3,
52-
tileEntity.getProgress() + 1, 5);
50+
if (LevelStorage.chargerOnlyUUM) {
51+
this.drawTexturedModalRect(x + 69, y + 55, 176, 3,
52+
this.tileEntity.getProgress() + 1, 5);
53+
}
5354
}
5455
}

0 commit comments

Comments
 (0)