Started Recycler
This commit is contained in:
parent
e6c510bbea
commit
02ac62a180
13 changed files with 513 additions and 3 deletions
|
@ -4,6 +4,8 @@ import java.io.File;
|
||||||
|
|
||||||
import org.apache.commons.lang3.time.StopWatch;
|
import org.apache.commons.lang3.time.StopWatch;
|
||||||
|
|
||||||
|
import net.minecraft.init.Items;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraftforge.common.MinecraftForge;
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
import net.minecraftforge.fml.client.event.ConfigChangedEvent;
|
import net.minecraftforge.fml.client.event.ConfigChangedEvent;
|
||||||
import net.minecraftforge.fml.common.FMLCommonHandler;
|
import net.minecraftforge.fml.common.FMLCommonHandler;
|
||||||
|
@ -22,6 +24,7 @@ import reborncore.common.packets.AddDiscriminatorEvent;
|
||||||
import reborncore.common.util.LogHelper;
|
import reborncore.common.util.LogHelper;
|
||||||
import reborncore.common.util.VersionChecker;
|
import reborncore.common.util.VersionChecker;
|
||||||
import techreborn.achievement.TRAchievements;
|
import techreborn.achievement.TRAchievements;
|
||||||
|
import techreborn.api.ScrapboxList;
|
||||||
import techreborn.api.TechRebornAPI;
|
import techreborn.api.TechRebornAPI;
|
||||||
import techreborn.api.recipe.RecipeHandler;
|
import techreborn.api.recipe.RecipeHandler;
|
||||||
import techreborn.api.recipe.recipeConfig.RecipeConfigManager;
|
import techreborn.api.recipe.recipeConfig.RecipeConfigManager;
|
||||||
|
@ -87,6 +90,7 @@ public class Core {
|
||||||
RecipeConfigManager.load(event.getModConfigurationDirectory());
|
RecipeConfigManager.load(event.getModConfigurationDirectory());
|
||||||
versionChecker = new VersionChecker("TechReborn", new ModInfo());
|
versionChecker = new VersionChecker("TechReborn", new ModInfo());
|
||||||
versionChecker.checkVersionThreaded();
|
versionChecker.checkVersionThreaded();
|
||||||
|
|
||||||
logHelper.info("PreInitialization Complete");
|
logHelper.info("PreInitialization Complete");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
15
src/main/java/techreborn/api/ScrapboxList.java
Normal file
15
src/main/java/techreborn/api/ScrapboxList.java
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
package techreborn.api;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
|
public class ScrapboxList {
|
||||||
|
|
||||||
|
public static List<ItemStack> stacks = new ArrayList<ItemStack>();
|
||||||
|
|
||||||
|
public static void addItemStackToList(ItemStack stack){
|
||||||
|
stacks.add(stack);
|
||||||
|
}
|
||||||
|
}
|
62
src/main/java/techreborn/blocks/teir1/BlockRecycler.java
Normal file
62
src/main/java/techreborn/blocks/teir1/BlockRecycler.java
Normal file
|
@ -0,0 +1,62 @@
|
||||||
|
package techreborn.blocks.teir1;
|
||||||
|
|
||||||
|
import net.minecraft.block.material.Material;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import reborncore.common.blocks.BlockMachineBase;
|
||||||
|
import reborncore.common.blocks.IRotationTexture;
|
||||||
|
import techreborn.Core;
|
||||||
|
import techreborn.client.GuiHandler;
|
||||||
|
import techreborn.client.TechRebornCreativeTab;
|
||||||
|
import techreborn.tiles.teir1.TileCompressor;
|
||||||
|
import techreborn.tiles.teir1.TileRecycler;
|
||||||
|
|
||||||
|
public class BlockRecycler extends BlockMachineBase implements IRotationTexture{
|
||||||
|
|
||||||
|
public BlockRecycler(Material material) {
|
||||||
|
super();
|
||||||
|
setUnlocalizedName("techreborn.recycler");
|
||||||
|
setCreativeTab(TechRebornCreativeTab.instance);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
|
||||||
|
return new TileRecycler();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
||||||
|
if (!player.isSneaking()){
|
||||||
|
player.openGui(Core.INSTANCE, GuiHandler.recyclerID, world, x, y, z);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private final String prefix = "techreborn:blocks/machine/";
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getFrontOff() {
|
||||||
|
return prefix + "recycler_front_off";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getFrontOn() {
|
||||||
|
return prefix + "recycler_front_on";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getSide() {
|
||||||
|
return prefix + "machine_side";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getTop() {
|
||||||
|
return prefix + "machine_top";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getBottom() {
|
||||||
|
return prefix + "machine_bottom";
|
||||||
|
}
|
||||||
|
}
|
|
@ -33,6 +33,7 @@ import techreborn.client.container.ContainerLesu;
|
||||||
import techreborn.client.container.ContainerMatterFabricator;
|
import techreborn.client.container.ContainerMatterFabricator;
|
||||||
import techreborn.client.container.ContainerQuantumChest;
|
import techreborn.client.container.ContainerQuantumChest;
|
||||||
import techreborn.client.container.ContainerQuantumTank;
|
import techreborn.client.container.ContainerQuantumTank;
|
||||||
|
import techreborn.client.container.ContainerRecycler;
|
||||||
import techreborn.client.container.ContainerRollingMachine;
|
import techreborn.client.container.ContainerRollingMachine;
|
||||||
import techreborn.client.container.ContainerSemifluidGenerator;
|
import techreborn.client.container.ContainerSemifluidGenerator;
|
||||||
import techreborn.client.container.ContainerThermalGenerator;
|
import techreborn.client.container.ContainerThermalGenerator;
|
||||||
|
@ -66,6 +67,7 @@ import techreborn.client.gui.GuiLesu;
|
||||||
import techreborn.client.gui.GuiMatterFabricator;
|
import techreborn.client.gui.GuiMatterFabricator;
|
||||||
import techreborn.client.gui.GuiQuantumChest;
|
import techreborn.client.gui.GuiQuantumChest;
|
||||||
import techreborn.client.gui.GuiQuantumTank;
|
import techreborn.client.gui.GuiQuantumTank;
|
||||||
|
import techreborn.client.gui.GuiRecycler;
|
||||||
import techreborn.client.gui.GuiRollingMachine;
|
import techreborn.client.gui.GuiRollingMachine;
|
||||||
import techreborn.client.gui.GuiSemifluidGenerator;
|
import techreborn.client.gui.GuiSemifluidGenerator;
|
||||||
import techreborn.client.gui.GuiThermalGenerator;
|
import techreborn.client.gui.GuiThermalGenerator;
|
||||||
|
@ -103,6 +105,7 @@ import techreborn.tiles.teir1.TileCompressor;
|
||||||
import techreborn.tiles.teir1.TileElectricFurnace;
|
import techreborn.tiles.teir1.TileElectricFurnace;
|
||||||
import techreborn.tiles.teir1.TileExtractor;
|
import techreborn.tiles.teir1.TileExtractor;
|
||||||
import techreborn.tiles.teir1.TileGrinder;
|
import techreborn.tiles.teir1.TileGrinder;
|
||||||
|
import techreborn.tiles.teir1.TileRecycler;
|
||||||
|
|
||||||
public class GuiHandler implements IGuiHandler {
|
public class GuiHandler implements IGuiHandler {
|
||||||
|
|
||||||
|
@ -140,6 +143,7 @@ public class GuiHandler implements IGuiHandler {
|
||||||
public static final int compressorID = 34;
|
public static final int compressorID = 34;
|
||||||
public static final int electricFurnaceID = 35;
|
public static final int electricFurnaceID = 35;
|
||||||
public static final int ironFurnace = 36;
|
public static final int ironFurnace = 36;
|
||||||
|
public static final int recyclerID = 37;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||||
|
@ -232,6 +236,8 @@ public class GuiHandler implements IGuiHandler {
|
||||||
return new ContainerElectricFurnace((TileElectricFurnace) world.getTileEntity(new BlockPos(x, y, z)), player);
|
return new ContainerElectricFurnace((TileElectricFurnace) world.getTileEntity(new BlockPos(x, y, z)), player);
|
||||||
}else if (ID == ironFurnace) {
|
}else if (ID == ironFurnace) {
|
||||||
return new ContainerIronFurnace((TileIronFurnace) world.getTileEntity(new BlockPos(x, y, z)), player);
|
return new ContainerIronFurnace((TileIronFurnace) world.getTileEntity(new BlockPos(x, y, z)), player);
|
||||||
|
}else if (ID == recyclerID) {
|
||||||
|
return new ContainerRecycler((TileRecycler) world.getTileEntity(new BlockPos(x, y, z)), player);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -328,8 +334,9 @@ public class GuiHandler implements IGuiHandler {
|
||||||
return new GuiElectricFurnace(player, (TileElectricFurnace) world.getTileEntity(new BlockPos(x, y, z)));
|
return new GuiElectricFurnace(player, (TileElectricFurnace) world.getTileEntity(new BlockPos(x, y, z)));
|
||||||
}else if (ID == ironFurnace) {
|
}else if (ID == ironFurnace) {
|
||||||
return new GuiIronFurnace(player, (TileIronFurnace) world.getTileEntity(new BlockPos(x, y, z)));
|
return new GuiIronFurnace(player, (TileIronFurnace) world.getTileEntity(new BlockPos(x, y, z)));
|
||||||
}
|
}else if (ID == recyclerID) {
|
||||||
|
return new GuiRecycler(player, (TileRecycler) world.getTileEntity(new BlockPos(x, y, z)));
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,64 @@
|
||||||
|
package techreborn.client.container;
|
||||||
|
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.inventory.Slot;
|
||||||
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
import reborncore.client.gui.SlotOutput;
|
||||||
|
import reborncore.common.container.RebornContainer;
|
||||||
|
import techreborn.api.SlotUpgrade;
|
||||||
|
import techreborn.tiles.teir1.TileCompressor;
|
||||||
|
import techreborn.tiles.teir1.TileRecycler;
|
||||||
|
|
||||||
|
public class ContainerRecycler extends RebornContainer {
|
||||||
|
|
||||||
|
EntityPlayer player;
|
||||||
|
|
||||||
|
TileRecycler tile;
|
||||||
|
|
||||||
|
public int connectionStatus;
|
||||||
|
|
||||||
|
public ContainerRecycler(TileRecycler tileGrinder, EntityPlayer player) {
|
||||||
|
super();
|
||||||
|
tile = tileGrinder;
|
||||||
|
this.player = player;
|
||||||
|
|
||||||
|
// input
|
||||||
|
this.addSlotToContainer(new Slot(tileGrinder.inventory, 0, 56, 34));
|
||||||
|
this.addSlotToContainer(new SlotOutput(tileGrinder.inventory, 1, 116, 34));
|
||||||
|
|
||||||
|
|
||||||
|
// upgrades
|
||||||
|
this.addSlotToContainer(new SlotUpgrade(tileGrinder.inventory, 2, 152, 8));
|
||||||
|
this.addSlotToContainer(new SlotUpgrade(tileGrinder.inventory, 3, 152, 26));
|
||||||
|
this.addSlotToContainer(new SlotUpgrade(tileGrinder.inventory, 4, 152, 44));
|
||||||
|
this.addSlotToContainer(new SlotUpgrade(tileGrinder.inventory, 5, 152, 62));
|
||||||
|
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < 3; ++i) {
|
||||||
|
for (int j = 0; j < 9; ++j) {
|
||||||
|
this.addSlotToContainer(new Slot(player.inventory, j + i * 9
|
||||||
|
+ 9, 8 + j * 18, 84 + i * 18));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < 9; ++i) {
|
||||||
|
this.addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18,
|
||||||
|
142));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canInteractWith(EntityPlayer p_75145_1_) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
@Override
|
||||||
|
public void updateProgressBar(int id, int value) {
|
||||||
|
if (id == 10) {
|
||||||
|
this.connectionStatus = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
53
src/main/java/techreborn/client/gui/GuiRecycler.java
Normal file
53
src/main/java/techreborn/client/gui/GuiRecycler.java
Normal file
|
@ -0,0 +1,53 @@
|
||||||
|
package techreborn.client.gui;
|
||||||
|
|
||||||
|
import org.lwjgl.util.Color;
|
||||||
|
|
||||||
|
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||||
|
import net.minecraft.client.renderer.GlStateManager;
|
||||||
|
import net.minecraft.client.resources.I18n;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
import net.minecraft.util.StatCollector;
|
||||||
|
import techreborn.client.container.ContainerCompressor;
|
||||||
|
import techreborn.client.container.ContainerRecycler;
|
||||||
|
import techreborn.tiles.teir1.TileCompressor;
|
||||||
|
import techreborn.tiles.teir1.TileRecycler;
|
||||||
|
|
||||||
|
public class GuiRecycler extends GuiContainer {
|
||||||
|
|
||||||
|
public static final ResourceLocation texture = new ResourceLocation("techreborn", "textures/gui/compressor.png");
|
||||||
|
|
||||||
|
TileRecycler compressor;
|
||||||
|
ContainerRecycler containerGrinder;
|
||||||
|
|
||||||
|
public GuiRecycler(EntityPlayer player, TileRecycler tilegrinder) {
|
||||||
|
super(new ContainerRecycler(tilegrinder, player));
|
||||||
|
this.xSize = 176;
|
||||||
|
this.ySize = 167;
|
||||||
|
compressor = tilegrinder;
|
||||||
|
containerGrinder = (ContainerRecycler) this.inventorySlots;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) {
|
||||||
|
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
|
||||||
|
this.mc.getTextureManager().bindTexture(texture);
|
||||||
|
int k = (this.width - this.xSize) / 2;
|
||||||
|
int l = (this.height - this.ySize) / 2;
|
||||||
|
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
|
||||||
|
|
||||||
|
int j = 0;
|
||||||
|
|
||||||
|
j = compressor.getEnergyScaled(12);
|
||||||
|
if (j > 0) {
|
||||||
|
this.drawTexturedModalRect(k + 24, l + 36 + 12 - j, 176, 12 - j, 14, j + 2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_) {
|
||||||
|
String name = StatCollector.translateToLocal("tile.techreborn.recycler.name");
|
||||||
|
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752);
|
||||||
|
this.fontRendererObj.drawString(I18n.format("container.inventory", new Object[0]), 8, this.ySize - 96 + 2, 4210752);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -41,6 +41,7 @@ import techreborn.client.gui.GuiBlastFurnace;
|
||||||
import techreborn.client.gui.GuiCentrifuge;
|
import techreborn.client.gui.GuiCentrifuge;
|
||||||
import techreborn.client.gui.GuiChemicalReactor;
|
import techreborn.client.gui.GuiChemicalReactor;
|
||||||
import techreborn.client.gui.GuiCompressor;
|
import techreborn.client.gui.GuiCompressor;
|
||||||
|
import techreborn.client.gui.GuiElectricFurnace;
|
||||||
import techreborn.client.gui.GuiExtractor;
|
import techreborn.client.gui.GuiExtractor;
|
||||||
import techreborn.client.gui.GuiFusionReactor;
|
import techreborn.client.gui.GuiFusionReactor;
|
||||||
import techreborn.client.gui.GuiGrinder;
|
import techreborn.client.gui.GuiGrinder;
|
||||||
|
@ -160,6 +161,8 @@ public class TechRebornJeiPlugin extends BlankModPlugin {
|
||||||
registry.addRecipeClickArea(GuiExtractor.class, 78, 36, 24, 16, RecipeCategoryUids.EXTRACTOR);
|
registry.addRecipeClickArea(GuiExtractor.class, 78, 36, 24, 16, RecipeCategoryUids.EXTRACTOR);
|
||||||
registry.addRecipeClickArea(GuiCompressor.class, 78, 36, 24, 16, RecipeCategoryUids.COMPRESSOR);
|
registry.addRecipeClickArea(GuiCompressor.class, 78, 36, 24, 16, RecipeCategoryUids.COMPRESSOR);
|
||||||
registry.addRecipeClickArea(GuiIronFurnace.class, 78, 36, 24, 16, VanillaRecipeCategoryUid.SMELTING, VanillaRecipeCategoryUid.FUEL);
|
registry.addRecipeClickArea(GuiIronFurnace.class, 78, 36, 24, 16, VanillaRecipeCategoryUid.SMELTING, VanillaRecipeCategoryUid.FUEL);
|
||||||
|
registry.addRecipeClickArea(GuiElectricFurnace.class, 78, 36, 24, 16, VanillaRecipeCategoryUid.SMELTING, VanillaRecipeCategoryUid.FUEL);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
IRecipeTransferRegistry recipeTransferRegistry = registry.getRecipeTransferRegistry();
|
IRecipeTransferRegistry recipeTransferRegistry = registry.getRecipeTransferRegistry();
|
||||||
|
|
|
@ -46,6 +46,7 @@ import techreborn.blocks.teir1.BlockCompressor;
|
||||||
import techreborn.blocks.teir1.BlockElectricFurnace;
|
import techreborn.blocks.teir1.BlockElectricFurnace;
|
||||||
import techreborn.blocks.teir1.BlockExtractor;
|
import techreborn.blocks.teir1.BlockExtractor;
|
||||||
import techreborn.blocks.teir1.BlockGrinder;
|
import techreborn.blocks.teir1.BlockGrinder;
|
||||||
|
import techreborn.blocks.teir1.BlockRecycler;
|
||||||
import techreborn.itemblocks.ItemBlockAesu;
|
import techreborn.itemblocks.ItemBlockAesu;
|
||||||
import techreborn.itemblocks.ItemBlockDigitalChest;
|
import techreborn.itemblocks.ItemBlockDigitalChest;
|
||||||
import techreborn.itemblocks.ItemBlockMachineCasing;
|
import techreborn.itemblocks.ItemBlockMachineCasing;
|
||||||
|
@ -76,6 +77,7 @@ import techreborn.tiles.teir1.TileCompressor;
|
||||||
import techreborn.tiles.teir1.TileElectricFurnace;
|
import techreborn.tiles.teir1.TileElectricFurnace;
|
||||||
import techreborn.tiles.teir1.TileExtractor;
|
import techreborn.tiles.teir1.TileExtractor;
|
||||||
import techreborn.tiles.teir1.TileGrinder;
|
import techreborn.tiles.teir1.TileGrinder;
|
||||||
|
import techreborn.tiles.teir1.TileRecycler;
|
||||||
|
|
||||||
public class ModBlocks {
|
public class ModBlocks {
|
||||||
|
|
||||||
|
@ -128,6 +130,7 @@ public class ModBlocks {
|
||||||
public static Block solarPanel;
|
public static Block solarPanel;
|
||||||
public static Block waterMill;
|
public static Block waterMill;
|
||||||
public static Block windMill;
|
public static Block windMill;
|
||||||
|
public static Block recycler;
|
||||||
|
|
||||||
public static BlockOre ore;
|
public static BlockOre ore;
|
||||||
public static BlockOre2 ore2;
|
public static BlockOre2 ore2;
|
||||||
|
@ -366,6 +369,10 @@ public class ModBlocks {
|
||||||
reinforcedglass = new BlockReinforcedGlass(Material.glass);
|
reinforcedglass = new BlockReinforcedGlass(Material.glass);
|
||||||
GameRegistry.registerBlock(reinforcedglass, "reinforcedglass");
|
GameRegistry.registerBlock(reinforcedglass, "reinforcedglass");
|
||||||
|
|
||||||
|
recycler = new BlockRecycler(Material.iron);
|
||||||
|
GameRegistry.registerBlock(recycler, "recycler");
|
||||||
|
GameRegistry.registerTileEntity(TileRecycler.class, "TileRecyclerTR");
|
||||||
|
|
||||||
ironFurnace = new BlockIronFurnace();
|
ironFurnace = new BlockIronFurnace();
|
||||||
GameRegistry.registerBlock(ironFurnace, "ironfurnace");
|
GameRegistry.registerBlock(ironFurnace, "ironfurnace");
|
||||||
GameRegistry.registerTileEntity(TileIronFurnace.class, "TileIronFurnaceTR");
|
GameRegistry.registerTileEntity(TileIronFurnace.class, "TileIronFurnaceTR");
|
||||||
|
|
|
@ -87,6 +87,7 @@ public class ModItems {
|
||||||
public static Item wrench;
|
public static Item wrench;
|
||||||
public static Item lapatronCrystal;
|
public static Item lapatronCrystal;
|
||||||
public static Item energyCrystal;
|
public static Item energyCrystal;
|
||||||
|
public static Item scrapBox;
|
||||||
|
|
||||||
public static Item upgrades;
|
public static Item upgrades;
|
||||||
|
|
||||||
|
@ -172,6 +173,9 @@ public class ModItems {
|
||||||
|
|
||||||
wrench = new ItemWrench();
|
wrench = new ItemWrench();
|
||||||
GameRegistry.registerItem(wrench, "wrench");
|
GameRegistry.registerItem(wrench, "wrench");
|
||||||
|
|
||||||
|
scrapBox = new ItemScrapBox();
|
||||||
|
GameRegistry.registerItem(scrapBox, "scrapbox");
|
||||||
|
|
||||||
// upgrades = new ItemUpgrade();
|
// upgrades = new ItemUpgrade();
|
||||||
// GameRegistry.registerItem(upgrades, "upgrades");
|
// GameRegistry.registerItem(upgrades, "upgrades");
|
||||||
|
|
|
@ -4,6 +4,7 @@ import java.security.InvalidParameterException;
|
||||||
|
|
||||||
import org.apache.commons.lang3.ArrayUtils;
|
import org.apache.commons.lang3.ArrayUtils;
|
||||||
|
|
||||||
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.init.Blocks;
|
import net.minecraft.init.Blocks;
|
||||||
import net.minecraft.init.Items;
|
import net.minecraft.init.Items;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
|
@ -15,6 +16,7 @@ import net.minecraftforge.oredict.OreDictionary;
|
||||||
import reborncore.common.util.CraftingHelper;
|
import reborncore.common.util.CraftingHelper;
|
||||||
import reborncore.common.util.OreUtil;
|
import reborncore.common.util.OreUtil;
|
||||||
import techreborn.Core;
|
import techreborn.Core;
|
||||||
|
import techreborn.api.ScrapboxList;
|
||||||
import techreborn.api.TechRebornAPI;
|
import techreborn.api.TechRebornAPI;
|
||||||
import techreborn.api.reactor.FusionReactorRecipe;
|
import techreborn.api.reactor.FusionReactorRecipe;
|
||||||
import techreborn.api.reactor.FusionReactorRecipeHelper;
|
import techreborn.api.reactor.FusionReactorRecipeHelper;
|
||||||
|
@ -78,9 +80,49 @@ public class ModRecipes {
|
||||||
addExtractorRecipes();
|
addExtractorRecipes();
|
||||||
addCompressorRecipes();
|
addCompressorRecipes();
|
||||||
addWireRecipes();
|
addWireRecipes();
|
||||||
|
addScrapBoxloot();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void addWireRecipes() {
|
static void addScrapBoxloot() {
|
||||||
|
ScrapboxList.addItemStackToList(new ItemStack(Items.diamond));
|
||||||
|
ScrapboxList.addItemStackToList(new ItemStack(Items.coal));
|
||||||
|
ScrapboxList.addItemStackToList(new ItemStack(Items.apple));
|
||||||
|
ScrapboxList.addItemStackToList(new ItemStack(Items.baked_potato));
|
||||||
|
ScrapboxList.addItemStackToList(new ItemStack(Items.blaze_powder));
|
||||||
|
ScrapboxList.addItemStackToList(new ItemStack(Items.carrot));
|
||||||
|
ScrapboxList.addItemStackToList(new ItemStack(Items.boat));
|
||||||
|
ScrapboxList.addItemStackToList(new ItemStack(Items.blaze_rod));
|
||||||
|
ScrapboxList.addItemStackToList(new ItemStack(Items.compass));
|
||||||
|
ScrapboxList.addItemStackToList(new ItemStack(Items.map));
|
||||||
|
ScrapboxList.addItemStackToList(new ItemStack(Items.leather_leggings));
|
||||||
|
ScrapboxList.addItemStackToList(new ItemStack(Items.bow));
|
||||||
|
ScrapboxList.addItemStackToList(new ItemStack(Items.cooked_chicken));
|
||||||
|
ScrapboxList.addItemStackToList(new ItemStack(Items.paper));
|
||||||
|
ScrapboxList.addItemStackToList(new ItemStack(Items.book));
|
||||||
|
|
||||||
|
ScrapboxList.addItemStackToList(new ItemStack(Blocks.acacia_door));
|
||||||
|
ScrapboxList.addItemStackToList(new ItemStack(Blocks.bed));
|
||||||
|
ScrapboxList.addItemStackToList(new ItemStack(Blocks.brick_block));
|
||||||
|
ScrapboxList.addItemStackToList(new ItemStack(Blocks.cake));
|
||||||
|
ScrapboxList.addItemStackToList(new ItemStack(Blocks.carpet));
|
||||||
|
ScrapboxList.addItemStackToList(new ItemStack(Blocks.crafting_table));
|
||||||
|
ScrapboxList.addItemStackToList(new ItemStack(Blocks.dirt));
|
||||||
|
ScrapboxList.addItemStackToList(new ItemStack(Blocks.dark_oak_door));
|
||||||
|
ScrapboxList.addItemStackToList(new ItemStack(Blocks.glass));
|
||||||
|
ScrapboxList.addItemStackToList(new ItemStack(Blocks.glass_pane));
|
||||||
|
ScrapboxList.addItemStackToList(new ItemStack(Blocks.glowstone));
|
||||||
|
ScrapboxList.addItemStackToList(new ItemStack(Blocks.wooden_slab));
|
||||||
|
ScrapboxList.addItemStackToList(new ItemStack(Blocks.skull));
|
||||||
|
ScrapboxList.addItemStackToList(new ItemStack(Blocks.leaves));
|
||||||
|
ScrapboxList.addItemStackToList(new ItemStack(Blocks.gravel));
|
||||||
|
ScrapboxList.addItemStackToList(new ItemStack(Blocks.hardened_clay));
|
||||||
|
ScrapboxList.addItemStackToList(new ItemStack(Blocks.cactus));
|
||||||
|
ScrapboxList.addItemStackToList(new ItemStack(Blocks.cocoa));
|
||||||
|
ScrapboxList.addItemStackToList(new ItemStack(Blocks.tallgrass));
|
||||||
|
ScrapboxList.addItemStackToList(new ItemStack(Blocks.chest));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void addWireRecipes() {
|
||||||
CraftingHelper.addShapedOreRecipe(ItemStandaloneCables.getCableByName("copper", 6),
|
CraftingHelper.addShapedOreRecipe(ItemStandaloneCables.getCableByName("copper", 6),
|
||||||
"XXX","CCC", "XXX",
|
"XXX","CCC", "XXX",
|
||||||
'C', "ingotCopper");
|
'C', "ingotCopper");
|
||||||
|
|
41
src/main/java/techreborn/items/ItemScrapBox.java
Normal file
41
src/main/java/techreborn/items/ItemScrapBox.java
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
package techreborn.items;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
import net.minecraft.entity.item.EntityItem;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.init.Blocks;
|
||||||
|
import net.minecraft.init.Items;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.util.ChatComponentText;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import techreborn.api.ScrapboxList;
|
||||||
|
import techreborn.client.TechRebornCreativeTabMisc;
|
||||||
|
|
||||||
|
public class ItemScrapBox extends ItemTR {
|
||||||
|
|
||||||
|
public ItemScrapBox() {
|
||||||
|
setUnlocalizedName("techreborn.scrapbox");
|
||||||
|
setCreativeTab(TechRebornCreativeTabMisc.instance);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer player) {
|
||||||
|
if(!world.isRemote) {
|
||||||
|
int random = world.rand.nextInt(ScrapboxList.stacks.size());
|
||||||
|
ItemStack out = ScrapboxList.stacks.get(random).copy();
|
||||||
|
player.addChatComponentMessage(new ChatComponentText("int " + random + " stack " + out.getDisplayName()));
|
||||||
|
float xOffset = world.rand.nextFloat() * 0.8F + 0.1F;
|
||||||
|
float yOffset = world.rand.nextFloat() * 0.8F + 0.1F;
|
||||||
|
float zOffset = world.rand.nextFloat() * 0.8F + 0.1F;
|
||||||
|
EntityItem entityitem = new EntityItem(world, player.getPosition().getX() + xOffset, player.getPosition().getY() + yOffset, player.getPosition().getZ() + zOffset, out);
|
||||||
|
|
||||||
|
entityitem.setPickupDelay(20);
|
||||||
|
world.spawnEntityInWorld(entityitem);
|
||||||
|
|
||||||
|
itemStack.stackSize--;
|
||||||
|
}
|
||||||
|
return itemStack;
|
||||||
|
}
|
||||||
|
}
|
206
src/main/java/techreborn/tiles/teir1/TileRecycler.java
Normal file
206
src/main/java/techreborn/tiles/teir1/TileRecycler.java
Normal file
|
@ -0,0 +1,206 @@
|
||||||
|
package techreborn.tiles.teir1;
|
||||||
|
|
||||||
|
import ic2.api.tile.IWrenchable;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.inventory.IInventory;
|
||||||
|
import net.minecraft.inventory.ISidedInventory;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import net.minecraft.util.EnumFacing;
|
||||||
|
import net.minecraft.util.IChatComponent;
|
||||||
|
import reborncore.common.powerSystem.TilePowerAcceptor;
|
||||||
|
import reborncore.common.util.Inventory;
|
||||||
|
import techreborn.api.recipe.RecipeCrafter;
|
||||||
|
import techreborn.init.ModBlocks;
|
||||||
|
import techreborn.lib.Reference;
|
||||||
|
|
||||||
|
public class TileRecycler extends TilePowerAcceptor implements IWrenchable, IInventory, ISidedInventory{
|
||||||
|
|
||||||
|
public Inventory inventory = new Inventory(6, "TileRecycler", 64, this);
|
||||||
|
public int capacity = 1000;
|
||||||
|
|
||||||
|
public TileRecycler() {
|
||||||
|
super(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateEntity() {
|
||||||
|
super.updateEntity();
|
||||||
|
charge(3);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, EnumFacing side) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public EnumFacing getFacing() {
|
||||||
|
return getFacingEnum();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean wrenchCanRemove(EntityPlayer entityPlayer) {
|
||||||
|
if (entityPlayer.isSneaking()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float getWrenchDropRate() {
|
||||||
|
return 1.0F;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ItemStack getWrenchDrop(EntityPlayer entityPlayer) {
|
||||||
|
return new ItemStack(ModBlocks.Compressor, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isComplete() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void readFromNBT(NBTTagCompound tagCompound) {
|
||||||
|
super.readFromNBT(tagCompound);
|
||||||
|
inventory.readFromNBT(tagCompound);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeToNBT(NBTTagCompound tagCompound) {
|
||||||
|
super.writeToNBT(tagCompound);
|
||||||
|
inventory.writeToNBT(tagCompound);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getSizeInventory() {
|
||||||
|
return inventory.getSizeInventory();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ItemStack getStackInSlot(int slot) {
|
||||||
|
return inventory.getStackInSlot(slot);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ItemStack decrStackSize(int slot, int amount) {
|
||||||
|
return inventory.decrStackSize(slot, amount);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ItemStack removeStackFromSlot(int slot) {
|
||||||
|
return inventory.removeStackFromSlot(slot);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setInventorySlotContents(int slot, ItemStack stack) {
|
||||||
|
inventory.setInventorySlotContents(slot, stack);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getInventoryStackLimit() {
|
||||||
|
return inventory.getInventoryStackLimit();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isUseableByPlayer(EntityPlayer player) {
|
||||||
|
return inventory.isUseableByPlayer(player);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isItemValidForSlot(int slot, ItemStack stack) {
|
||||||
|
return inventory.isItemValidForSlot(slot, stack);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ISidedInventory
|
||||||
|
@Override
|
||||||
|
public int[] getSlotsForFace(EnumFacing side) {
|
||||||
|
return side == EnumFacing.DOWN ? new int[]{0, 1, 2} : new int[]{0, 1, 2};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canInsertItem(int slotIndex, ItemStack itemStack, EnumFacing side) {
|
||||||
|
if (slotIndex == 2)
|
||||||
|
return false;
|
||||||
|
return isItemValidForSlot(slotIndex, itemStack);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canExtractItem(int slotIndex, ItemStack itemStack, EnumFacing side) {
|
||||||
|
return slotIndex == 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public double getMaxPower() {
|
||||||
|
return capacity;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canAcceptEnergy(EnumFacing direction) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canProvideEnergy(EnumFacing direction) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public double getMaxOutput() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public double getMaxInput() {
|
||||||
|
return 32;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void openInventory(EntityPlayer player) {
|
||||||
|
inventory.openInventory(player);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void closeInventory(EntityPlayer player) {
|
||||||
|
inventory.closeInventory(player);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getField(int id) {
|
||||||
|
return inventory.getField(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setField(int id, int value) {
|
||||||
|
inventory.setField(id, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getFieldCount() {
|
||||||
|
return inventory.getFieldCount();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void clear() {
|
||||||
|
inventory.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return inventory.getName();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasCustomName() {
|
||||||
|
return inventory.hasCustomName();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IChatComponent getDisplayName() {
|
||||||
|
return inventory.getDisplayName();
|
||||||
|
}
|
||||||
|
}
|
|
@ -68,6 +68,7 @@ tile.techreborn.solarpanel.name=Solar panel
|
||||||
tile.techreborn.watermill.name=Water Mill
|
tile.techreborn.watermill.name=Water Mill
|
||||||
tile.techreborn.windmill.name=Wind Mill
|
tile.techreborn.windmill.name=Wind Mill
|
||||||
tile.techreborn.ironfurnace.name=Iron Furnace
|
tile.techreborn.ironfurnace.name=Iron Furnace
|
||||||
|
tile.techreborn.recycler.name=Recycler
|
||||||
|
|
||||||
#Blocks
|
#Blocks
|
||||||
tile.techreborn.rubberlog.name=Rubber Wood
|
tile.techreborn.rubberlog.name=Rubber Wood
|
||||||
|
@ -281,6 +282,7 @@ item.techreborn.cable.GLASSFIBER.name=Glass Fiber Cable
|
||||||
item.techreborn.cable.ICOPPER.name=Insulated Copper Cable
|
item.techreborn.cable.ICOPPER.name=Insulated Copper Cable
|
||||||
item.techreborn.cable.IGOLD.name=Insulated Gold Cable
|
item.techreborn.cable.IGOLD.name=Insulated Gold Cable
|
||||||
item.techreborn.cable.IHV.name=Insulated HV Cable
|
item.techreborn.cable.IHV.name=Insulated HV Cable
|
||||||
|
item.techreborn.scrapbox.name=Scrap Box
|
||||||
|
|
||||||
|
|
||||||
#Small Dusts
|
#Small Dusts
|
||||||
|
|
Loading…
Reference in a new issue