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

package com.thebrokenrail.energonrelics;
import com.thebrokenrail.energonrelics.block.BlockBreakerBlock;
import com.thebrokenrail.energonrelics.block.CreativeEnergySourceBlock;
import com.thebrokenrail.energonrelics.block.DefensiveLaserBlock;
import com.thebrokenrail.energonrelics.block.HolographicSkyBlock;
import com.thebrokenrail.energonrelics.block.InfuserBlock;
import com.thebrokenrail.energonrelics.block.PhaseShifterBlock;
import com.thebrokenrail.energonrelics.block.lightning.LightningRodBaseBlock;
import com.thebrokenrail.energonrelics.block.forcefield.ForcefieldProjectorBlock;
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;
import com.thebrokenrail.energonrelics.block.forcefield.ForcefieldBlock;
import com.thebrokenrail.energonrelics.block.lightning.LightningRodBlock;
import com.thebrokenrail.energonrelics.block.misc.VeridiumBlockBlock;
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;
import com.thebrokenrail.energonrelics.block.structure.StructureGeneratorBlock;
import com.thebrokenrail.energonrelics.block.misc.ThermalGlassBlock;
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;
import com.thebrokenrail.energonrelics.block.misc.ThermalCasingBlock;
import com.thebrokenrail.energonrelics.block.battery.PassiveBatteryControllerBlock;
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;
import com.thebrokenrail.energonrelics.api.block.SimpleBlock;
import com.thebrokenrail.energonrelics.item.MultimeterItem;
import com.thebrokenrail.energonrelics.item.NetworkChipItem;
import com.thebrokenrail.energonrelics.potion.CustomPotions;
import com.thebrokenrail.energonrelics.recipe.DuplicateNetworkChipRecipe;
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;
import net.minecraft.block.MaterialColor;
import net.minecraft.item.Item;
import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemStack;
import net.minecraft.recipe.SpecialRecipeSerializer;
import net.minecraft.sound.SoundCategory;
import net.minecraft.sound.SoundEvent;
import net.minecraft.util.Identifier;
import net.minecraft.util.Rarity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.registry.BuiltinRegistries;
import net.minecraft.util.registry.Registry;
import net.minecraft.world.World;
import net.minecraft.world.gen.feature.ConfiguredFeature;
import net.minecraft.world.gen.feature.Feature;
import net.minecraft.world.gen.feature.OreFeatureConfig;
public final class EnergonRelics implements ModInitializer {
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();
public static final BatteryCoreBlock BATTERY_CORE_BLOCk = new BatteryCoreBlock();
public static final PassiveBatteryControllerBlock PASSIVE_BATTERY_CONTROLLER_BLOCk = new PassiveBatteryControllerBlock();
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();
public static final Item VERIDIUM_INGOT_ITEM = new Item(new Item.Settings().group(ITEM_GROUP));
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();
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);
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));
public static final DefensiveLaserBlock DEFENSIVE_LASER_BLOCK = new DefensiveLaserBlock();
public static final BlockBreakerBlock BLOCK_BREAKER_BLOCK = new BlockBreakerBlock();
public static final Item VERIDIUM_POWDER_ITEM = new Item(new Item.Settings().group(ITEM_GROUP));
public static final LightningRodBaseBlock LIGHTNING_ROD_BASE_BLOCK = new LightningRodBaseBlock();
public static final LightningRodBlock LIGHTNING_ROD_BLOCK = new LightningRodBlock();
public static final SpecialRecipeSerializer<DuplicateNetworkChipRecipe> DUPLICATE_NETWORK_CHIP_RECIPE = new SpecialRecipeSerializer<>(DuplicateNetworkChipRecipe::new);
public static final Material FIELD_MATERIAL = new Material.Builder(MaterialColor.CLEAR).replaceable().build();
public static final ForcefieldBlock FORCEFIELD_BLOCK = new ForcefieldBlock();
public static final ForcefieldProjectorBlock FORCEFIELD_PROJECTOR_BLOCK = new ForcefieldProjectorBlock();
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();
public static final IndustrialLaserBlock INDUSTRIAL_LASER_BLOCK = new IndustrialLaserBlock();
public static final IndustrialLaserProjectorBlock INDUSTRIAL_LASER_PROJECTOR_BLOCK = new IndustrialLaserProjectorBlock();
private static final Identifier BEEP_SOUND_ID = new Identifier(NAMESPACE, "beep");
private static final SoundEvent BEEP_SOUND_EVENT = new SoundEvent(BEEP_SOUND_ID);
public static final CreativeEnergySourceBlock CREATIVE_ENERGY_SOURCE_BLOCK = new CreativeEnergySourceBlock();
public static final HolographicSkyBlock HOLOGRAPHIC_SKY_BLOCK = new HolographicSkyBlock();
public static final InfuserBlock INFUSER_BLOCK = new InfuserBlock();
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();
public static final Item VERIDIUM_ORB_ITEM = new Item(new Item.Settings().group(ITEM_GROUP).rarity(Rarity.UNCOMMON));
public static final PhaseShifterBlock PHASE_SHIFTER_BLOCK = new PhaseShifterBlock();
@Override
public void onInitialize() {
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);
Registry.register(Registry.ITEM, new Identifier(NAMESPACE, "veridium_powder"), VERIDIUM_POWDER_ITEM);
Registry.register(Registry.ITEM, new Identifier(NAMESPACE, "veridium_orb"), VERIDIUM_ORB_ITEM);
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");
BATTERY_CORE_BLOCk.register("battery_core");
PASSIVE_BATTERY_CONTROLLER_BLOCk.register("passive_battery_controller");
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");
Registry.register(Registry.ITEM, new Identifier(NAMESPACE, "defensive_laser_core"), DEFENSIVE_LASER_CORE_ITEM);
DEFENSIVE_LASER_BLOCK.register("defensive_laser");
StructureGeneratorBlock.registerBlocks();
BLOCK_BREAKER_BLOCK.register("block_breaker");
CustomPotions.register();
LIGHTNING_ROD_BASE_BLOCK.register("lightning_rod_base");
LIGHTNING_ROD_BLOCK.register("lightning_rod");
Registry.register(Registry.RECIPE_SERIALIZER, new Identifier(NAMESPACE, "duplicate_network_chip"), DUPLICATE_NETWORK_CHIP_RECIPE);
FORCEFIELD_BLOCK.register("forcefield");
FORCEFIELD_PROJECTOR_BLOCK.register("forcefield_projector");
TRACTOR_BEAM_BLOCK.register("tractor_beam");
REPULSOR_BEAM_BLOCK.register("repulsor_beam");
TRACTOR_BEAM_PROJECTOR_BLOCK.register("tractor_beam_projector");
INDUSTRIAL_LASER_BLOCK.register("industrial_laser");
INDUSTRIAL_LASER_PROJECTOR_BLOCK.register("industrial_laser_projector");
Registry.register(Registry.SOUND_EVENT, BEEP_SOUND_ID, BEEP_SOUND_EVENT);
CREATIVE_ENERGY_SOURCE_BLOCK.register("creative_energy_source");
HOLOGRAPHIC_SKY_BLOCK.register("holographic_sky");
INFUSER_BLOCK.register("infuser");
ENERGIZED_OBSIDIAN_BLOCK.register("energized_obsidian");
ENERGY_BEAM_BLOCK.register("energy_beam");
ENERGY_PORTAL_BLOCK.register("energy_portal");
ENERGY_PROJECTOR_BLOCK.register("energy_projector");
PHASE_SHIFTER_BLOCK.register("phase_shifter");
}
public static void playBeep(World world, BlockPos pos) {
if (!world.isClient()) {
world.playSound(null, pos, BEEP_SOUND_EVENT, SoundCategory.BLOCKS, 0.3f, 1f);
}
}
}