This repository has been archived on 2023-11-26. You can view files and clone it, but cannot push or open issues or pull requests.
EnergonRelics/src/main/java/com/thebrokenrail/energonrelics/EnergonRelics.java

206 lines
12 KiB
Java
Raw Normal View History

2020-07-13 20:37:21 +00:00
package com.thebrokenrail.energonrelics;
2020-07-22 18:07:29 +00:00
import com.thebrokenrail.energonrelics.block.BlockBreakerBlock;
2020-07-26 00:09:03 +00:00
import com.thebrokenrail.energonrelics.block.CreativeEnergySourceBlock;
2020-07-15 22:44:49 +00:00
import com.thebrokenrail.energonrelics.block.DefensiveLaserBlock;
2020-07-26 16:14:51 +00:00
import com.thebrokenrail.energonrelics.block.HolographicSkyBlock;
2020-07-30 02:51:29 +00:00
import com.thebrokenrail.energonrelics.block.InfuserBlock;
2020-08-16 03:01:24 +00:00
import com.thebrokenrail.energonrelics.block.PhaseShifterBlock;
2020-07-29 01:46:04 +00:00
import com.thebrokenrail.energonrelics.block.lightning.LightningRodBaseBlock;
2020-07-23 23:31:02 +00:00
import com.thebrokenrail.energonrelics.block.forcefield.ForcefieldProjectorBlock;
2020-07-28 20:46:34 +00:00
import com.thebrokenrail.energonrelics.block.forcefield.laser.IndustrialLaserProjectorBlock;
import com.thebrokenrail.energonrelics.block.forcefield.laser.IndustrialLaserBlock;
import com.thebrokenrail.energonrelics.block.forcefield.beam.RepulsorBeamBlock;
import com.thebrokenrail.energonrelics.block.forcefield.beam.TractorBeamBlock;
import com.thebrokenrail.energonrelics.block.forcefield.beam.TractorBeamProjectorBlock;
2020-07-28 03:10:16 +00:00
import com.thebrokenrail.energonrelics.block.forcefield.ForcefieldBlock;
2020-07-29 01:46:04 +00:00
import com.thebrokenrail.energonrelics.block.lightning.LightningRodBlock;
2020-07-28 03:10:16 +00:00
import com.thebrokenrail.energonrelics.block.misc.VeridiumBlockBlock;
2020-08-01 20:22:32 +00:00
import com.thebrokenrail.energonrelics.block.portal.EnergizedObsidianBlock;
import com.thebrokenrail.energonrelics.block.portal.EnergyBeamBlock;
import com.thebrokenrail.energonrelics.block.portal.EnergyPortalBlock;
import com.thebrokenrail.energonrelics.block.portal.EnergyProjectorBlock;
2020-07-22 01:23:33 +00:00
import com.thebrokenrail.energonrelics.block.structure.StructureGeneratorBlock;
2020-07-26 23:05:59 +00:00
import com.thebrokenrail.energonrelics.block.misc.ThermalGlassBlock;
2020-07-13 20:37:21 +00:00
import com.thebrokenrail.energonrelics.block.battery.ActiveBatteryControllerBlock;
import com.thebrokenrail.energonrelics.block.reactor.ReactorControllerBlock;
import com.thebrokenrail.energonrelics.block.reactor.ReactorCoreBlock;
import com.thebrokenrail.energonrelics.block.reactor.ReactorInputBlock;
2020-07-26 23:05:59 +00:00
import com.thebrokenrail.energonrelics.block.misc.ThermalCasingBlock;
2020-07-14 01:49:40 +00:00
import com.thebrokenrail.energonrelics.block.battery.PassiveBatteryControllerBlock;
2020-07-13 20:37:21 +00:00
import com.thebrokenrail.energonrelics.block.battery.BatteryCoreBlock;
import com.thebrokenrail.energonrelics.block.EnergonLightBlock;
import com.thebrokenrail.energonrelics.block.SolarPanelBlock;
import com.thebrokenrail.energonrelics.block.SwitchBlock;
2020-08-04 17:06:11 +00:00
import com.thebrokenrail.energonrelics.api.block.SimpleBlock;
2020-07-13 20:37:21 +00:00
import com.thebrokenrail.energonrelics.item.MultimeterItem;
import com.thebrokenrail.energonrelics.item.NetworkChipItem;
2020-07-22 22:31:22 +00:00
import com.thebrokenrail.energonrelics.potion.CustomPotions;
2020-07-23 20:02:24 +00:00
import com.thebrokenrail.energonrelics.recipe.DuplicateNetworkChipRecipe;
2020-07-13 20:37:21 +00:00
import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.client.itemgroup.FabricItemGroupBuilder;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.minecraft.block.Material;
2020-07-28 20:38:21 +00:00
import net.minecraft.block.MaterialColor;
2020-07-13 20:37:21 +00:00
import net.minecraft.item.Item;
import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemStack;
2020-07-23 20:02:24 +00:00
import net.minecraft.recipe.SpecialRecipeSerializer;
2020-07-25 17:34:16 +00:00
import net.minecraft.sound.SoundCategory;
import net.minecraft.sound.SoundEvent;
2020-07-13 20:37:21 +00:00
import net.minecraft.util.Identifier;
2020-08-04 00:15:17 +00:00
import net.minecraft.util.Rarity;
2020-07-25 17:34:16 +00:00
import net.minecraft.util.math.BlockPos;
2020-07-13 23:33:38 +00:00
import net.minecraft.util.registry.BuiltinRegistries;
2020-07-13 20:37:21 +00:00
import net.minecraft.util.registry.Registry;
2020-07-25 17:34:16 +00:00
import net.minecraft.world.World;
2020-07-13 23:33:38 +00:00
import net.minecraft.world.gen.feature.ConfiguredFeature;
import net.minecraft.world.gen.feature.Feature;
import net.minecraft.world.gen.feature.OreFeatureConfig;
2020-07-13 20:37:21 +00:00
2020-08-04 18:15:24 +00:00
public final class EnergonRelics implements ModInitializer {
2020-07-13 20:37:21 +00:00
public static final String NAMESPACE = "energonrelics";
public static NetworkChipItem NETWORK_CHIP_ITEM;
public static final ItemGroup ITEM_GROUP = FabricItemGroupBuilder.build(new Identifier(NAMESPACE, "item_group"), () -> new ItemStack(NETWORK_CHIP_ITEM));
public static final EnergonLightBlock ENERGON_LIGHT_BLOCK = new EnergonLightBlock();
public static final SolarPanelBlock SOLAR_PANEL_BLOCK = new SolarPanelBlock();
public static final SwitchBlock SWITCH_BLOCk = new SwitchBlock();
public static final MultimeterItem MULTIMETER_ITEM = new MultimeterItem();
public static final ThermalCasingBlock THERMAL_CASING_BLOCK = new ThermalCasingBlock();
public static final ThermalGlassBlock THERMAL_GLASS_BLOCK = new ThermalGlassBlock();
2020-07-13 20:37:21 +00:00
public static final BatteryCoreBlock BATTERY_CORE_BLOCk = new BatteryCoreBlock();
2020-07-14 01:49:40 +00:00
public static final PassiveBatteryControllerBlock PASSIVE_BATTERY_CONTROLLER_BLOCk = new PassiveBatteryControllerBlock();
2020-07-13 20:37:21 +00:00
public static final ActiveBatteryControllerBlock ACTIVE_BATTERY_CONTROLLER_BLOCK = new ActiveBatteryControllerBlock();
public static final ReactorCoreBlock REACTOR_CORE_BLOCK = new ReactorCoreBlock();
public static final ReactorInputBlock REACTOR_INPUT_BLOCK = new ReactorInputBlock();
public static final ReactorControllerBlock REACTOR_CONTROLLER_BLOCK = new ReactorControllerBlock();
2020-07-13 23:33:38 +00:00
public static final Item VERIDIUM_INGOT_ITEM = new Item(new Item.Settings().group(ITEM_GROUP));
2020-07-22 22:57:51 +00:00
public static final SimpleBlock VERIDIUM_ORE_BLOCK = new SimpleBlock(FabricBlockSettings.of(Material.STONE).requiresTool().strength(3f, 3f));
public static final SimpleBlock VERIDIUM_BLOCK_BLOCK = new VeridiumBlockBlock();
2020-07-25 17:34:16 +00:00
public static final ConfiguredFeature<?, ?> VERIDIUM_ORE_FEATURE = Feature.ORE.configure(new OreFeatureConfig(OreFeatureConfig.Rules.BASE_STONE_OVERWORLD, EnergonRelics.VERIDIUM_ORE_BLOCK.getDefaultState(), 9)).method_30377(32).spreadHorizontally().repeat(2);
2020-07-13 20:37:21 +00:00
public static final Item CIRCUIT_BOARD_ITEM = new Item(new Item.Settings().group(ITEM_GROUP));
public static final Item DEFENSIVE_LASER_CORE_ITEM = new Item(new Item.Settings().group(ITEM_GROUP));
2020-07-15 22:44:49 +00:00
public static final DefensiveLaserBlock DEFENSIVE_LASER_BLOCK = new DefensiveLaserBlock();
2020-07-22 18:07:29 +00:00
public static final BlockBreakerBlock BLOCK_BREAKER_BLOCK = new BlockBreakerBlock();
2020-07-22 21:03:32 +00:00
public static final Item VERIDIUM_POWDER_ITEM = new Item(new Item.Settings().group(ITEM_GROUP));
2020-07-29 01:46:04 +00:00
public static final LightningRodBaseBlock LIGHTNING_ROD_BASE_BLOCK = new LightningRodBaseBlock();
2020-07-23 17:39:40 +00:00
public static final LightningRodBlock LIGHTNING_ROD_BLOCK = new LightningRodBlock();
2020-07-23 20:02:24 +00:00
public static final SpecialRecipeSerializer<DuplicateNetworkChipRecipe> DUPLICATE_NETWORK_CHIP_RECIPE = new SpecialRecipeSerializer<>(DuplicateNetworkChipRecipe::new);
2020-08-03 22:00:22 +00:00
public static final Material FIELD_MATERIAL = new Material.Builder(MaterialColor.CLEAR).replaceable().build();
2020-07-28 20:38:21 +00:00
2020-07-23 23:31:02 +00:00
public static final ForcefieldBlock FORCEFIELD_BLOCK = new ForcefieldBlock();
public static final ForcefieldProjectorBlock FORCEFIELD_PROJECTOR_BLOCK = new ForcefieldProjectorBlock();
2020-07-28 03:10:16 +00:00
public static final TractorBeamBlock TRACTOR_BEAM_BLOCK = new TractorBeamBlock();
public static final RepulsorBeamBlock REPULSOR_BEAM_BLOCK = new RepulsorBeamBlock();
public static final TractorBeamProjectorBlock TRACTOR_BEAM_PROJECTOR_BLOCK = new TractorBeamProjectorBlock();
2020-07-28 20:38:21 +00:00
public static final IndustrialLaserBlock INDUSTRIAL_LASER_BLOCK = new IndustrialLaserBlock();
public static final IndustrialLaserProjectorBlock INDUSTRIAL_LASER_PROJECTOR_BLOCK = new IndustrialLaserProjectorBlock();
2020-07-25 17:34:16 +00:00
private static final Identifier BEEP_SOUND_ID = new Identifier(NAMESPACE, "beep");
private static final SoundEvent BEEP_SOUND_EVENT = new SoundEvent(BEEP_SOUND_ID);
2020-07-26 00:09:03 +00:00
public static final CreativeEnergySourceBlock CREATIVE_ENERGY_SOURCE_BLOCK = new CreativeEnergySourceBlock();
2020-07-26 16:14:51 +00:00
public static final HolographicSkyBlock HOLOGRAPHIC_SKY_BLOCK = new HolographicSkyBlock();
2020-07-30 02:51:29 +00:00
public static final InfuserBlock INFUSER_BLOCK = new InfuserBlock();
2020-08-01 20:22:32 +00:00
public static final EnergizedObsidianBlock ENERGIZED_OBSIDIAN_BLOCK = new EnergizedObsidianBlock();
public static final EnergyBeamBlock ENERGY_BEAM_BLOCK = new EnergyBeamBlock();
public static final EnergyPortalBlock ENERGY_PORTAL_BLOCK = new EnergyPortalBlock();
public static final EnergyProjectorBlock ENERGY_PROJECTOR_BLOCK = new EnergyProjectorBlock();
2020-08-04 00:15:17 +00:00
public static final Item VERIDIUM_ORB_ITEM = new Item(new Item.Settings().group(ITEM_GROUP).rarity(Rarity.UNCOMMON));
2020-08-01 20:22:32 +00:00
2020-08-16 03:01:24 +00:00
public static final PhaseShifterBlock PHASE_SHIFTER_BLOCK = new PhaseShifterBlock();
2020-07-13 20:37:21 +00:00
@Override
public void onInitialize() {
2020-08-01 20:54:23 +00:00
Registry.register(Registry.ITEM, new Identifier(NAMESPACE, "veridium_ingot"), VERIDIUM_INGOT_ITEM);
VERIDIUM_ORE_BLOCK.register("veridium_ore");
VERIDIUM_BLOCK_BLOCK.register("veridium_block");
Registry.register(BuiltinRegistries.CONFIGURED_FEATURE, new Identifier(NAMESPACE, "veridium_ore"), VERIDIUM_ORE_FEATURE);
2020-08-01 21:01:30 +00:00
Registry.register(Registry.ITEM, new Identifier(NAMESPACE, "veridium_powder"), VERIDIUM_POWDER_ITEM);
2020-08-01 20:54:23 +00:00
Registry.register(Registry.ITEM, new Identifier(NAMESPACE, "veridium_orb"), VERIDIUM_ORB_ITEM);
2020-07-13 20:37:21 +00:00
NETWORK_CHIP_ITEM = Registry.register(Registry.ITEM, new Identifier(NAMESPACE, "network_chip"), new NetworkChipItem());
Registry.register(Registry.ITEM, new Identifier(NAMESPACE, "multimeter"), MULTIMETER_ITEM);
Registry.register(Registry.ITEM, new Identifier(NAMESPACE, "circuit_board"), CIRCUIT_BOARD_ITEM);
ENERGON_LIGHT_BLOCK.register("energon_light");
SOLAR_PANEL_BLOCK.register("solar_panel");
SWITCH_BLOCk.register("switch");
THERMAL_CASING_BLOCK.register("thermal_casing");
THERMAL_GLASS_BLOCK.register("thermal_glass");
2020-07-13 20:37:21 +00:00
BATTERY_CORE_BLOCk.register("battery_core");
2020-07-14 01:49:40 +00:00
PASSIVE_BATTERY_CONTROLLER_BLOCk.register("passive_battery_controller");
2020-07-13 20:37:21 +00:00
ACTIVE_BATTERY_CONTROLLER_BLOCK.register("active_battery_controller");
REACTOR_CORE_BLOCK.register("reactor_core");
REACTOR_INPUT_BLOCK.register("reactor_input");
REACTOR_CONTROLLER_BLOCK.register("reactor_controller");
2020-07-15 22:44:49 +00:00
Registry.register(Registry.ITEM, new Identifier(NAMESPACE, "defensive_laser_core"), DEFENSIVE_LASER_CORE_ITEM);
DEFENSIVE_LASER_BLOCK.register("defensive_laser");
2020-07-19 19:12:39 +00:00
2020-08-15 18:26:33 +00:00
StructureGeneratorBlock.registerBlocks();
2020-07-22 21:03:32 +00:00
2020-07-22 18:07:29 +00:00
BLOCK_BREAKER_BLOCK.register("block_breaker");
2020-07-22 22:31:22 +00:00
CustomPotions.register();
2020-07-23 17:39:40 +00:00
2020-07-29 01:46:04 +00:00
LIGHTNING_ROD_BASE_BLOCK.register("lightning_rod_base");
2020-07-23 17:39:40 +00:00
LIGHTNING_ROD_BLOCK.register("lightning_rod");
2020-07-23 20:02:24 +00:00
Registry.register(Registry.RECIPE_SERIALIZER, new Identifier(NAMESPACE, "duplicate_network_chip"), DUPLICATE_NETWORK_CHIP_RECIPE);
2020-07-23 23:31:02 +00:00
FORCEFIELD_BLOCK.register("forcefield");
FORCEFIELD_PROJECTOR_BLOCK.register("forcefield_projector");
2020-07-25 17:34:16 +00:00
2020-07-28 03:10:16 +00:00
TRACTOR_BEAM_BLOCK.register("tractor_beam");
REPULSOR_BEAM_BLOCK.register("repulsor_beam");
TRACTOR_BEAM_PROJECTOR_BLOCK.register("tractor_beam_projector");
2020-07-28 20:38:21 +00:00
INDUSTRIAL_LASER_BLOCK.register("industrial_laser");
INDUSTRIAL_LASER_PROJECTOR_BLOCK.register("industrial_laser_projector");
2020-07-25 17:34:16 +00:00
Registry.register(Registry.SOUND_EVENT, BEEP_SOUND_ID, BEEP_SOUND_EVENT);
2020-07-26 00:09:03 +00:00
CREATIVE_ENERGY_SOURCE_BLOCK.register("creative_energy_source");
2020-07-26 16:14:51 +00:00
HOLOGRAPHIC_SKY_BLOCK.register("holographic_sky");
2020-07-30 02:51:29 +00:00
INFUSER_BLOCK.register("infuser");
2020-08-01 20:22:32 +00:00
ENERGIZED_OBSIDIAN_BLOCK.register("energized_obsidian");
ENERGY_BEAM_BLOCK.register("energy_beam");
ENERGY_PORTAL_BLOCK.register("energy_portal");
ENERGY_PROJECTOR_BLOCK.register("energy_projector");
2020-08-16 03:01:24 +00:00
PHASE_SHIFTER_BLOCK.register("phase_shifter");
2020-07-25 17:34:16 +00:00
}
public static void playBeep(World world, BlockPos pos) {
if (!world.isClient()) {
2020-07-26 00:09:03 +00:00
world.playSound(null, pos, BEEP_SOUND_EVENT, SoundCategory.BLOCKS, 0.3f, 1f);
2020-07-25 17:34:16 +00:00
}
2020-07-13 20:37:21 +00:00
}
}