All machines are now in enum.

This commit is contained in:
drcrazy 2018-09-25 13:39:41 +03:00
parent 20a385f6ca
commit f600432f05
9 changed files with 25 additions and 97 deletions

View file

@ -57,7 +57,6 @@ import reborncore.common.util.ArrayUtils;
import reborncore.common.util.ChatUtils;
import reborncore.common.util.StringUtils;
import techreborn.TechReborn;
import techreborn.init.TRContent;
import techreborn.utils.MessageIDs;
import techreborn.tiles.machine.tier1.TilePlayerDectector;
import techreborn.utils.TechRebornCreativeTab;
@ -176,7 +175,7 @@ public class BlockPlayerDetector extends BlockMachineBase {
// Block
@Override
public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player) {
return new ItemStack(TRContent.PLAYER_DETECTOR, 1, typeNamesList.indexOf(state.getValue(TYPE)));
return new ItemStack(this);
}
@Override

View file

@ -103,7 +103,6 @@ import techreborn.blocks.transformers.BlockMVTransformer;
import techreborn.config.ConfigTechReborn;
import techreborn.itemblocks.ItemBlockAdjustableSU;
import techreborn.itemblocks.ItemBlockDigitalChest;
import techreborn.itemblocks.ItemBlockPlayerDetector;
import techreborn.itemblocks.ItemBlockQuantumChest;
import techreborn.itemblocks.ItemBlockQuantumTank;
import techreborn.itemblocks.ItemBlockRubberSapling;
@ -167,25 +166,6 @@ public class TRContent {
public static Block RUBBER_PLANKS;
public static Block RUBBER_SAPLING;
// Machines - machines
// Machines - generators
// Machines - storage
// Machines - energy storage & transformers
// Machines - misc
public static Block ALARM;
public static Block CHUNK_LOADER;
public static Block LAMP_INCANDESCENT;
public static Block LAMP_LED;
public static Block MAGICAL_ABSORBER;
public static Block MAGIC_ENERGY_CONVERTER;
public static Block PLAYER_DETECTOR;
// Armor
public static Item CLOAKING_DEVICE;
public static Item LAPOTRONIC_ORBPACK;
@ -365,6 +345,10 @@ public class TRContent {
InitUtils.setup(block, name + "_cable");
}
public ItemStack getStack() {
return new ItemStack(block);
}
@Override
public Item asItem() {
return Item.getItemFromBlock(block);
@ -468,9 +452,11 @@ public class TRContent {
FUSION_CONTROL_COMPUTER(new BlockFusionControlComputer()),
GAS_TURBINE(new BlockGasTurbine()),
LIGHTNING_ROD(new BlockLightningRod()),
MAGIC_ENERGY_ABSORBER (new BlockMagicEnergyAbsorber()),
MAGIC_ENERGY_CONVERTER(new BlockMagicEnergyConverter()),
PLASMA_GENERATOR(new BlockPlasmaGenerator()),
SEMI_FLUID_GENERATOR(new BlockSemiFluidGenerator()),
SOLID_FUEL_GENEREATOR(new BlockSolidFuelGenerator()),
SOLID_FUEL_GENERATOR(new BlockSolidFuelGenerator()),
THERMAL_GENERATOR(new BlockThermalGenerator()),
WATER_MILL(new BlockWaterMill()),
WIND_MILL(new BlockWindMill()),
@ -491,11 +477,13 @@ public class TRContent {
HIGH_VOLTAGE_SU(new BlockHighVoltageSU()),
LV_TRANSFORMER(new BlockLVTransformer()),
MV_TRANSFORMER(new BlockMVTransformer()),
HV_TRANSFORMER(new BlockHVTransformer())
HV_TRANSFORMER(new BlockHVTransformer()),
;
ALARM(new BlockAlarm()),
CHUNK_LOADER(new BlockChunkLoader()),
LAMP_INCANDESCENT(new BlockLamp(14, 4, 0.625, 0.25)),
LAMP_LED(new BlockLamp(15, 1, 0.0625, 0.125)),
PLAYER_DETECTOR(new BlockPlayerDetector());
public final String name;
public final Block block;
@ -516,7 +504,7 @@ public class TRContent {
return new ItemStack(block);
}
}
public static enum Dusts implements IItemProvider {
ALMANDINE, ALUMINUM, ANDESITE, ANDRADITE, ASHES, BASALT, BAUXITE, BRASS, BRONZE, CALCITE, CHARCOAL, CHROME,
CINNABAR, CLAY, COAL, COPPER, DARK_ASHES, DIAMOND, DIORITE, ELECTRUM, EMERALD, ENDER_EYE, ENDER_PEARL, ENDSTONE,
@ -856,28 +844,6 @@ public class TRContent {
RUBBER_SAPLING = new BlockRubberSapling();
registerBlock(RUBBER_SAPLING, ItemBlockRubberSapling.class, "rubber_sapling");
// Machines - misc
ALARM = new BlockAlarm();
registerBlock(ALARM, "alarm");
CHUNK_LOADER = new BlockChunkLoader();
registerBlock(CHUNK_LOADER, "chunk_loader");
LAMP_INCANDESCENT = new BlockLamp( 14, 4, 0.625, 0.25);
registerBlock(LAMP_INCANDESCENT, "lamp_incandescent");
LAMP_LED = new BlockLamp( 15, 1, 0.0625, 0.125);
registerBlock(LAMP_LED, "lamp_led");
MAGICAL_ABSORBER = new BlockMagicEnergyAbsorber();
registerBlock(MAGICAL_ABSORBER, "magic_energy_absorber");
MAGIC_ENERGY_CONVERTER = new BlockMagicEnergyConverter();
registerBlock(MAGIC_ENERGY_CONVERTER, "magic_energy_converter");
PLAYER_DETECTOR = new BlockPlayerDetector();
registerBlock(PLAYER_DETECTOR, ItemBlockPlayerDetector.class, "player_detector");
//TODO enable when done
// flare = new BlockFlare();
// registerBlock(flare, "flare");
@ -1086,7 +1052,6 @@ public class TRContent {
}
}
/**
* Wrapper method for RebornRegistry
* @param block Block to register

View file

@ -135,7 +135,7 @@ public class CraftingTableRecipes extends RecipeMethods {
// registerShaped(getStack(TRContent.DIGITAL_CHEST), "PPP", "PDP", "PCP", 'P', "plateSteel", 'D', TRContent.Parts.DATA_STORAGE_CORE.getStack(), 'C', TRContent.Parts.DIGITAL_DISPLAY.getStack());
// registerShaped(getStack(TRContent.MATTER_FABRICATOR), "ETE", "AOA", "ETE", 'E', "circuitMaster", 'T', getStack(TRContent.EXTRACTOR), 'A', "machineBlockElite", 'O', getStack(TRContent.LAPOTRONIC_ORB));
registerShaped(getStack(TRContent.COMPUTER_CUBE), "OMC", "MFM", "CMO", 'O', TRContent.Parts.DATA_STORAGE_CORE.getStack(), 'M', TRContent.Parts.DIGITAL_DISPLAY.getStack(), 'C', "circuitMaster", 'F', "machineBlockAdvanced");
registerShaped(getStack(TRContent.PLAYER_DETECTOR, true), " D ", "CFC", " D ", 'D', "circuitStorage", 'C', "circuitAdvanced", 'F', getStack(TRContent.COMPUTER_CUBE));
// registerShaped(getStack(TRContent.PLAYER_DETECTOR, true), " D ", "CFC", " D ", 'D', "circuitStorage", 'C', "circuitAdvanced", 'F', getStack(TRContent.COMPUTER_CUBE));
// registerShaped(getStack(TRContent.DRAGON_EGG_SYPHON), "CTC", "PSP", "CBC", 'C', "circuitMaster", 'T', getStack(TRContent.MEDIUM_VOLTAGE_SU), 'P', "plateIridiumAlloy", 'S', "craftingSuperconductor", 'B', getStack(TRContent.LAPOTRONIC_ORB));
// registerShaped(getStack(TRContent.PLASMA_GENERATOR), "PPP", "PTP", "CGC", 'P', "plateTungstensteel", 'T', getStack(TRContent.HV_TRANSFORMER), 'C', "circuitMaster", 'G', getStack(TRContent.SOLID_FUEL_GENEREATOR));
// registerShaped(getStack(ModBlocks.SOLAR_PANEL, 1, 0), "DLD", "LDL", "CGC", 'D', "dustCoal", 'L', "paneGlass", 'G', getStack(ModBlocks.SOLID_FUEL_GENEREATOR), 'C', "circuitBasic");
@ -164,8 +164,8 @@ public class CraftingTableRecipes extends RecipeMethods {
// registerShaped(getStack(TRContent.GRINDER), "FFF", "SMS", " C ", 'F', Items.FLINT, 'S', getStack(Blocks.COBBLESTONE), 'M', "machineBlockBasic", 'C', "circuitBasic");
// registerShaped(getStack(TRContent.QUANTUM_CHEST), "DCD", "ATA", "DQD", 'D', TRContent.Parts.DATA_STORAGE_CORE.getStack(), 'C', TRContent.Parts.DIGITAL_DISPLAY.getStack(), 'A', "machineBlockElite", 'Q', getStack(TRContent.DIGITAL_CHEST), 'T', getStack(TRContent.COMPRESSOR));
// registerShaped(getStack(TRContent.QUANTUM_TANK), "EPE", "PCP", "EPE", 'P', "platePlatinum", 'E', "circuitAdvanced", 'C', getStack(TRContent.QUANTUM_CHEST));
registerShaped(getStack(TRContent.LAMP_INCANDESCENT), "GGG", "TCT", "GGG", 'G', "paneGlass", 'T', getMaterial("copper", Type.CABLE), 'C', TRContent.Parts.CARBON_FIBER.getStack());
registerShaped(getStack(TRContent.LAMP_LED), "GGG", "TLT", "GGG", 'G', "paneGlass", 'T', getMaterial("tin", Type.CABLE), 'L', "dustGlowstone");
// registerShaped(getStack(TRContent.LAMP_INCANDESCENT), "GGG", "TCT", "GGG", 'G', "paneGlass", 'T', getMaterial("copper", Type.CABLE), 'C', TRContent.Parts.CARBON_FIBER.getStack());
registerShaped(TRContent.Machine.LAMP_LED.getStack(), "GGG", "TLT", "GGG", 'G', "paneGlass", 'T', TRContent.Cables.TIN.getStack(), 'L', "dustGlowstone");
// Machine Frames

View file

@ -1,36 +0,0 @@
/*
* This file is part of TechReborn, licensed under the MIT License (MIT).
*
* Copyright (c) 2018 TechReborn
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package techreborn.itemblocks;
import net.minecraft.block.Block;
import reborncore.common.itemblock.ItemBlockBase;
import techreborn.blocks.tier1.BlockPlayerDetector;
import techreborn.init.TRContent;
public class ItemBlockPlayerDetector extends ItemBlockBase {
public ItemBlockPlayerDetector(Block block) {
super(TRContent.PLAYER_DETECTOR, TRContent.PLAYER_DETECTOR, BlockPlayerDetector.types);
}
}

View file

@ -106,6 +106,6 @@ public class TileAlarm extends TileEntity
// IToolDrop
@Override
public ItemStack getToolDrop(final EntityPlayer entityPlayer) {
return new ItemStack(TRContent.ALARM, 1);
return TRContent.Machine.ALARM.getStack();
}
}

View file

@ -60,7 +60,7 @@ public class TileChunkLoader extends TilePowerAcceptor implements IToolDrop, Ite
@Override
public ItemStack getToolDrop(final EntityPlayer entityPlayer) {
return new ItemStack(TRContent.CHUNK_LOADER, 1);
return TRContent.Machine.CHUNK_LOADER.getStack();
}
public boolean isComplete() {

View file

@ -147,7 +147,7 @@ public class TileSolidFuelGenerator extends TilePowerAcceptor implements IToolDr
@Override
public ItemStack getToolDrop(EntityPlayer playerIn) {
return TRContent.Machine.SOLID_FUEL_GENEREATOR.getStack();
return TRContent.Machine.SOLID_FUEL_GENERATOR.getStack();
}
@Override

View file

@ -138,6 +138,6 @@ public class TilePlayerDectector extends TilePowerAcceptor implements IToolDrop
// IToolDrop
@Override
public ItemStack getToolDrop(EntityPlayer p0) {
return new ItemStack(TRContent.PLAYER_DETECTOR, 1, 0);
return TRContent.Machine.PLAYER_DETECTOR.getStack();
}
}

View file

@ -46,9 +46,9 @@ public class StackWIPHandler {
public static ArrayList<ItemStack> devHeads = new ArrayList<>();
public StackWIPHandler() {
wipBlocks.add(TRContent.MAGICAL_ABSORBER);
wipBlocks.add(TRContent.CHUNK_LOADER);
wipBlocks.add(TRContent.MAGIC_ENERGY_CONVERTER);
wipBlocks.add(TRContent.Machine.MAGIC_ENERGY_ABSORBER.block);
wipBlocks.add(TRContent.Machine.CHUNK_LOADER.block);
wipBlocks.add(TRContent.Machine.MAGIC_ENERGY_CONVERTER.block);
addHead("modmuss50");
addHead("Gigabit101");