From 011edac67f1e51128a4ab1f3e5680e5897962ce3 Mon Sep 17 00:00:00 2001 From: stfwi Date: Fri, 16 Jul 2021 09:48:58 +0200 Subject: [PATCH] Mappings updated to official. --- build.gradle | 3 +- gradle.properties | 2 +- readme.md | 2 + .../java/wile/engineersdecor/ModConfig.java | 1546 ++++---- .../java/wile/engineersdecor/ModContent.java | 2938 +++++++------- .../engineersdecor/ModEngineersDecor.java | 272 +- .../engineersdecor/blocks/DecorBlock.java | 269 +- .../wile/engineersdecor/blocks/EdBreaker.java | 710 ++-- .../engineersdecor/blocks/EdCatwalkBlock.java | 260 +- .../blocks/EdCatwalkStairsBlock.java | 364 +- .../blocks/EdCatwalkTopAlignedBlock.java | 210 +- .../wile/engineersdecor/blocks/EdChair.java | 389 +- .../engineersdecor/blocks/EdChimneyBlock.java | 196 +- .../blocks/EdChimneyTrunkBlock.java | 72 +- .../blocks/EdCornerOrnamentedBlock.java | 140 +- .../blocks/EdCraftingTable.java | 3360 +++++++++-------- .../engineersdecor/blocks/EdDoorBlock.java | 62 +- .../blocks/EdDoubleGateBlock.java | 311 +- .../wile/engineersdecor/blocks/EdDropper.java | 1975 +++++----- .../blocks/EdElectricalFurnace.java | 1462 +++---- .../engineersdecor/blocks/EdFenceBlock.java | 58 +- .../blocks/EdFloorGratingBlock.java | 144 +- .../engineersdecor/blocks/EdFluidBarrel.java | 854 ++--- .../engineersdecor/blocks/EdFluidFunnel.java | 832 ++-- .../wile/engineersdecor/blocks/EdFreezer.java | 789 ++-- .../wile/engineersdecor/blocks/EdFurnace.java | 1916 +++++----- .../engineersdecor/blocks/EdGlassBlock.java | 105 +- .../engineersdecor/blocks/EdGroundBlock.java | 36 +- .../engineersdecor/blocks/EdHatchBlock.java | 266 +- .../wile/engineersdecor/blocks/EdHopper.java | 2038 +++++----- .../blocks/EdHorizontalSupportBlock.java | 330 +- .../engineersdecor/blocks/EdLabeledCrate.java | 1299 +++---- .../engineersdecor/blocks/EdLadderBlock.java | 236 +- .../wile/engineersdecor/blocks/EdMilker.java | 1549 ++++---- .../blocks/EdMineralSmelter.java | 1348 +++---- .../engineersdecor/blocks/EdPipeValve.java | 554 +-- .../wile/engineersdecor/blocks/EdPlacer.java | 1752 ++++----- .../engineersdecor/blocks/EdRailingBlock.java | 191 +- .../engineersdecor/blocks/EdRoofBlock.java | 462 +-- .../engineersdecor/blocks/EdSlabBlock.java | 36 +- .../blocks/EdSlabSliceBlock.java | 38 +- .../engineersdecor/blocks/EdSolarPanel.java | 530 +-- .../engineersdecor/blocks/EdStairsBlock.java | 44 +- .../blocks/EdStraightPoleBlock.java | 166 +- .../engineersdecor/blocks/EdTestBlock.java | 678 ++-- .../engineersdecor/blocks/EdTreeCutter.java | 546 +-- .../engineersdecor/blocks/EdWallBlock.java | 62 +- .../blocks/EdWasteIncinerator.java | 1467 +++---- .../engineersdecor/blocks/EdWindowBlock.java | 175 +- .../engineersdecor/blocks/IDecorBlock.java | 30 +- .../detail/ExternalObjects.java | 44 +- .../engineersdecor/detail/ModRenderers.java | 330 +- .../engineersdecor/detail/TreeCutting.java | 356 +- .../engineersdecor/eapi/jei/JEIPlugin.java | 186 +- .../wile/engineersdecor/items/EdItem.java | 92 +- .../libmc/blocks/SlabSliceBlock.java | 426 +-- .../libmc/blocks/StandardBlocks.java | 1012 ++--- .../libmc/blocks/StandardDoorBlock.java | 324 +- .../libmc/blocks/StandardFenceBlock.java | 388 +- .../libmc/blocks/StandardStairsBlock.java | 110 +- .../libmc/blocks/VariantSlabBlock.java | 400 +- .../libmc/blocks/VariantWallBlock.java | 394 +- .../libmc/client/ContainerGui.java | 84 +- .../libmc/datagen/AssetsDataGen.java | 96 +- .../libmc/datagen/LootTableGen.java | 192 +- .../libmc/detail/Auxiliaries.java | 782 ++-- .../libmc/detail/DataFixing.java | 132 +- .../engineersdecor/libmc/detail/Fluidics.java | 770 ++-- .../libmc/detail/Inventories.java | 1597 ++++---- .../libmc/detail/Networking.java | 618 +-- .../libmc/detail/OptionalRecipeCondition.java | 398 +- .../engineersdecor/libmc/detail/Overlay.java | 234 +- .../engineersdecor/libmc/detail/RfEnergy.java | 316 +- .../libmc/detail/SidedProxy.java | 134 +- .../libmc/detail/TooltipDisplay.java | 230 +- 75 files changed, 21383 insertions(+), 21336 deletions(-) diff --git a/build.gradle b/build.gradle index e31f602..26fa61c 100644 --- a/build.gradle +++ b/build.gradle @@ -26,7 +26,8 @@ repositories { } minecraft { - mappings channel: 'snapshot', version: "${version_fml_mappings}" + // mappings channel: 'snapshot', version: "${version_fml_mappings}" + mappings channel: "official", version: "1.16.5" // accessTransformer = file('build/resources/main/META-INF/accesstransformer.cfg') runs { client { diff --git a/gradle.properties b/gradle.properties index 20aa2c0..84161e9 100644 --- a/gradle.properties +++ b/gradle.properties @@ -5,4 +5,4 @@ version_minecraft=1.16.4 version_forge_minecraft=1.16.4-35.1.10 version_fml_mappings=20201028-1.16.3 version_jei=1.16.4:7.6.1.63 -version_engineersdecor=1.1.14 +version_engineersdecor=1.1.15-b1 diff --git a/readme.md b/readme.md index d68b197..253aac8 100644 --- a/readme.md +++ b/readme.md @@ -11,6 +11,8 @@ Mod sources for Minecraft version 1.16.x. ## Version history + ~ v1.1.15-b1 [F] + - v1.1.14 [R] Release build v1.1.14. - v1.1.14-b3 [A] Spanish language support added (PR#180, thx FrannDzs). diff --git a/src/main/java/wile/engineersdecor/ModConfig.java b/src/main/java/wile/engineersdecor/ModConfig.java index af99135..4aad364 100644 --- a/src/main/java/wile/engineersdecor/ModConfig.java +++ b/src/main/java/wile/engineersdecor/ModConfig.java @@ -1,773 +1,773 @@ -/* - * @file ModConfig.java - * @author Stefan Wilhelm (wile) - * @copyright (C) 2020 Stefan Wilhelm - * @license MIT (see https://opensource.org/licenses/MIT) - * - * Main class for module settings. Handles reading and - * saving the config file. - */ -package wile.engineersdecor; - -import net.minecraft.nbt.CompoundNBT; -import net.minecraft.block.Block; -import net.minecraft.item.Item; -import net.minecraftforge.common.ForgeConfigSpec; -import org.apache.commons.lang3.tuple.Pair; -import org.apache.logging.log4j.Logger; -import wile.engineersdecor.blocks.*; -import wile.engineersdecor.libmc.blocks.StandardBlocks; -import wile.engineersdecor.libmc.detail.Auxiliaries; -import wile.engineersdecor.libmc.detail.OptionalRecipeCondition; - -import javax.annotation.Nullable; -import java.util.ArrayList; -import java.util.HashSet; - -public class ModConfig -{ - //-------------------------------------------------------------------------------------------------------------------- - private static final Logger LOGGER = ModEngineersDecor.logger(); - private static final String MODID = ModEngineersDecor.MODID; - public static final CommonConfig COMMON; - public static final ServerConfig SERVER; - public static final ClientConfig CLIENT; - public static final ForgeConfigSpec COMMON_CONFIG_SPEC; - public static final ForgeConfigSpec SERVER_CONFIG_SPEC; - public static final ForgeConfigSpec CLIENT_CONFIG_SPEC; - - static { - final Pair common_ = (new ForgeConfigSpec.Builder()).configure(CommonConfig::new); - COMMON_CONFIG_SPEC = common_.getRight(); - COMMON = common_.getLeft(); - final Pair server_ = (new ForgeConfigSpec.Builder()).configure(ServerConfig::new); - SERVER_CONFIG_SPEC = server_.getRight(); - SERVER = server_.getLeft(); - final Pair client_ = (new ForgeConfigSpec.Builder()).configure(ClientConfig::new); - CLIENT_CONFIG_SPEC = client_.getRight(); - CLIENT = client_.getLeft(); - } - - //-------------------------------------------------------------------------------------------------------------------- - - public static class ClientConfig - { - public final ForgeConfigSpec.BooleanValue without_tooltips; - public final ForgeConfigSpec.BooleanValue without_ters; - - ClientConfig(ForgeConfigSpec.Builder builder) - { - builder.comment("Settings not loaded on servers.") - .push("client"); - // --- OPTOUTS ------------------------------------------------------------ - { - builder.comment("Opt-out settings") - .push("optout"); - without_tooltips = builder - .translation(MODID + ".config.without_tooltips") - .comment("Disable CTRL-SHIFT item tooltip display.") - .define("without_tooltips", false); - without_ters = builder - .translation(MODID + ".config.without_ters") - .comment("Disable all TERs (tile entity renderers).") - .define("without_ters", false); - } - builder.pop(); - } - } - - //-------------------------------------------------------------------------------------------------------------------- - - public static class CommonConfig - { - // Optout - public final ForgeConfigSpec.ConfigValue pattern_excludes; - public final ForgeConfigSpec.ConfigValue pattern_includes; - // MISC - public final ForgeConfigSpec.BooleanValue with_creative_mode_device_drops; - public final ForgeConfigSpec.BooleanValue with_experimental; - public final ForgeConfigSpec.BooleanValue with_config_logging; - public final ForgeConfigSpec.BooleanValue with_debug_logging; - - CommonConfig(ForgeConfigSpec.Builder builder) - { - builder.comment("Settings affecting the logical server side.") - .push("server"); - // --- OPTOUTS ------------------------------------------------------------ - { - builder.comment("Opt-out settings") - .push("optout"); - pattern_excludes = builder - .translation(MODID + ".config.pattern_excludes") - .comment("Opt-out any block by its registry name ('*' wildcard matching, " - + "comma separated list, whitespaces ignored. You must match the whole name, " - + "means maybe add '*' also at the begin and end. Example: '*wood*,*steel*' " - + "excludes everything that has 'wood' or 'steel' in the registry name. " - + "The matching result is also traced in the log file. ") - .define("pattern_excludes", ""); - pattern_includes = builder - .translation(MODID + ".config.pattern_includes") - .comment("Prevent blocks from being opt'ed by registry name ('*' wildcard matching, " - + "comma separated list, whitespaces ignored. Evaluated before all other opt-out checks. " - + "You must match the whole name, means maybe add '*' also at the begin and end. Example: " - + "'*wood*,*steel*' includes everything that has 'wood' or 'steel' in the registry name." - + "The matching result is also traced in the log file.") - .define("pattern_includes", ""); - builder.pop(); - } - // --- MISC --------------------------------------------------------------- - { - builder.comment("Miscellaneous settings") - .push("miscellaneous"); - with_experimental = builder - .translation(MODID + ".config.with_experimental") - .comment("Enables experimental features. Use at own risk.") - .define("with_experimental", false); - with_creative_mode_device_drops = builder - .translation(MODID + ".config.with_creative_mode_device_drops") - .comment("Enable that devices are dropped as item also in creative mode, allowing " + - " to relocate them with contents and settings.") - .define("with_creative_mode_device_drops", false); - with_config_logging = builder - .translation(MODID + ".config.with_debug_logging") - .comment("Enable detailed logging of the config values and resulting calculations in each mod feature config.") - .define("with_debug_logging", false); - with_debug_logging = builder - .translation(MODID + ".config.with_debug_logging") - .comment("Enable debug log messages for trouble shooting. Don't activate if not really needed, this can spam the log file.") - .define("with_debug_logging", false); - builder.pop(); - } - } - } - - //-------------------------------------------------------------------------------------------------------------------- - - public static class ServerConfig - { - // Optout - public final ForgeConfigSpec.BooleanValue without_chair_sitting; - public final ForgeConfigSpec.BooleanValue without_mob_chair_sitting; - public final ForgeConfigSpec.BooleanValue without_ladder_speed_boost; - public final ForgeConfigSpec.BooleanValue without_crafting_table_history; - - /// ---------- @todo: remove these settings for MC1.17 / 1.16.5 - public final ForgeConfigSpec.ConfigValue pattern_excludes; - public final ForgeConfigSpec.ConfigValue pattern_includes; - public final ForgeConfigSpec.BooleanValue without_clinker_bricks; - public final ForgeConfigSpec.BooleanValue without_slag_bricks; - public final ForgeConfigSpec.BooleanValue without_rebar_concrete; - public final ForgeConfigSpec.BooleanValue without_gas_concrete; - public final ForgeConfigSpec.BooleanValue without_walls; - public final ForgeConfigSpec.BooleanValue without_stairs; - public final ForgeConfigSpec.BooleanValue without_panzer_glass; - public final ForgeConfigSpec.BooleanValue without_ladders; - public final ForgeConfigSpec.BooleanValue without_treated_wood_furniture; - public final ForgeConfigSpec.BooleanValue without_metal_furniture; - public final ForgeConfigSpec.BooleanValue without_windows; - public final ForgeConfigSpec.BooleanValue without_light_sources; - public final ForgeConfigSpec.BooleanValue without_slabs; - public final ForgeConfigSpec.BooleanValue without_halfslabs; - public final ForgeConfigSpec.BooleanValue without_poles; - public final ForgeConfigSpec.BooleanValue without_hsupports; - public final ForgeConfigSpec.BooleanValue without_sign_plates; - public final ForgeConfigSpec.BooleanValue without_floor_grating; - public final ForgeConfigSpec.BooleanValue without_crafting_table; - public final ForgeConfigSpec.BooleanValue without_lab_furnace; - public final ForgeConfigSpec.BooleanValue without_electrical_furnace; - public final ForgeConfigSpec.BooleanValue without_valves; - public final ForgeConfigSpec.BooleanValue without_waste_incinerator; - public final ForgeConfigSpec.BooleanValue without_factory_dropper; - public final ForgeConfigSpec.BooleanValue without_factory_hopper; - public final ForgeConfigSpec.BooleanValue without_factory_placer; - public final ForgeConfigSpec.BooleanValue without_block_breaker; - public final ForgeConfigSpec.BooleanValue without_solar_panel; - public final ForgeConfigSpec.BooleanValue without_fluid_funnel; - public final ForgeConfigSpec.BooleanValue without_mineral_smelter; - public final ForgeConfigSpec.BooleanValue without_milking_machine; - public final ForgeConfigSpec.BooleanValue without_tree_cutter; - public final ForgeConfigSpec.BooleanValue without_labeled_crate; - public final ForgeConfigSpec.BooleanValue without_fences; - /// ----------------------- - - // Misc - public final ForgeConfigSpec.BooleanValue without_direct_slab_pickup; - // Tweaks - public final ForgeConfigSpec.IntValue furnace_smelting_speed_percent; - public final ForgeConfigSpec.IntValue furnace_fuel_efficiency_percent; - public final ForgeConfigSpec.IntValue furnace_boost_energy_consumption; - public final ForgeConfigSpec.ConfigValue furnace_accepted_heaters; - public final ForgeConfigSpec.IntValue e_furnace_speed_percent; - public final ForgeConfigSpec.IntValue e_furnace_power_consumption; - public final ForgeConfigSpec.IntValue small_solar_panel_peak_production; - public final ForgeConfigSpec.BooleanValue e_furnace_automatic_pulling; - public final ForgeConfigSpec.DoubleValue chair_mob_sitting_probability_percent; - public final ForgeConfigSpec.DoubleValue chair_mob_standup_probability_percent; - public final ForgeConfigSpec.BooleanValue without_crafting_mouse_scrolling; - public final ForgeConfigSpec.IntValue pipevalve_max_flowrate; - public final ForgeConfigSpec.IntValue pipevalve_redstone_gain; - public final ForgeConfigSpec.IntValue block_breaker_power_consumption; - public final ForgeConfigSpec.IntValue block_breaker_reluctance; - public final ForgeConfigSpec.IntValue block_breaker_min_breaking_time; - public final ForgeConfigSpec.BooleanValue block_breaker_requires_power; - public final ForgeConfigSpec.IntValue tree_cutter_energy_consumption; - public final ForgeConfigSpec.IntValue tree_cutter_cutting_time_needed; - public final ForgeConfigSpec.BooleanValue tree_cutter_requires_power; - public final ForgeConfigSpec.IntValue milking_machine_energy_consumption; - public final ForgeConfigSpec.IntValue milking_machine_milking_delay; - - ServerConfig(ForgeConfigSpec.Builder builder) - { - builder.comment("Settings affecting the logical server side.") - .push("server"); - // --- OPTOUTS ------------------------------------------------------------ - { - builder.comment("Server dev opt-out settings !WARNING THE OPT-OUTs will be moved to common-config.toml in the next MC version!") - .push("optout"); - pattern_excludes = builder - .translation(MODID + ".config.pattern_excludes") - .comment("Opt-out any block by its registry name ('*' wildcard matching, " - + "comma separated list, whitespaces ignored. You must match the whole name, " - + "means maybe add '*' also at the begin and end. Example: '*wood*,*steel*' " - + "excludes everything that has 'wood' or 'steel' in the registry name. " - + "The matching result is also traced in the log file. ") - .define("pattern_excludes", ""); - pattern_includes = builder - .translation(MODID + ".config.pattern_includes") - .comment("Prevent blocks from being opt'ed by registry name ('*' wildcard matching, " - + "comma separated list, whitespaces ignored. Evaluated before all other opt-out checks. " - + "You must match the whole name, means maybe add '*' also at the begin and end. Example: " - + "'*wood*,*steel*' includes everything that has 'wood' or 'steel' in the registry name." - + "The matching result is also traced in the log file.") - .define("pattern_includes", ""); - without_clinker_bricks = builder - .translation(MODID + ".config.without_clinker_bricks") - .comment("Disable clinker bricks and derived blocks.") - .define("without_clinker_bricks", false); - without_slag_bricks = builder - .translation(MODID + ".config.without_slag_bricks") - .comment("Disable slag bricks and derived blocks.") - .define("without_slag_bricks", false); - without_rebar_concrete = builder - .translation(MODID + ".config.without_rebar_concrete") - .comment("Disable rebar concrete and derived blocks.") - .define("without_rebar_concrete", false); - without_gas_concrete = builder - .translation(MODID + ".config.without_gas_concrete") - .comment("Disable gas concrete and derived blocks.") - .define("without_gas_concrete", false); - without_walls = builder - .translation(MODID + ".config.without_walls") - .comment("Disable all mod wall blocks.") - .define("without_walls", false); - without_stairs = builder - .translation(MODID + ".config.without_stairs") - .comment("Disable all mod stairs blocks.") - .define("without_stairs", false); - without_panzer_glass = builder - .translation(MODID + ".config.without_panzer_glass") - .comment("Disable panzer glass and derived blocks.") - .define("without_panzer_glass", false); - without_crafting_table = builder - .translation(MODID + ".config.without_crafting_table") - .comment("Disable crafting table.") - .define("without_crafting_table", false); - without_lab_furnace = builder - .translation(MODID + ".config.without_lab_furnace") - .comment("Disable small lab furnace.") - .define("without_lab_furnace", false); - without_electrical_furnace = builder - .translation(MODID + ".config.without_electrical_furnace") - .comment("Disable small electrical pass-through furnace.") - .define("without_electrical_furnace", false); - without_treated_wood_furniture = builder - .translation(MODID + ".config.without_treated_wood_furniture") - .comment("Disable treated wood table, stool, windowsill, etc.") - .define("without_treated_wood_furniture", false); - without_metal_furniture = builder - .translation(MODID + ".config.without_metal_furniture") - .comment("Disable metal tables, etc.") - .define("without_metal_furniture", false); - without_windows = builder - .translation(MODID + ".config.without_windows") - .comment("Disable treated wood window, etc.") - .define("without_windows", false); - without_light_sources = builder - .translation(MODID + ".config.without_light_sources") - .comment("Disable light sources") - .define("without_light_sources", false); - without_ladders = builder - .translation(MODID + ".config.without_ladders") - .comment("Disable ladders") - .define("without_ladders", false); - without_chair_sitting = builder - .translation(MODID + ".config.without_chair_sitting") - .comment("Disable possibility to sit on stools and chairs.") - .define("without_chair_sitting", false); - without_mob_chair_sitting = builder - .translation(MODID + ".config.without_mob_chair_sitting") - .comment("Disable that mobs will sit on chairs and stools.") - .define("without_mob_chair_sitting", false); - without_ladder_speed_boost = builder - .translation(MODID + ".config.without_ladder_speed_boost") - .comment("Disable the speed boost of ladders in this mod.") - .define("without_ladder_speed_boost", false); - without_crafting_table_history = builder - .translation(MODID + ".config.without_crafting_table_history") - .comment("Disable history refabrication feature of the crafting table.") - .define("without_crafting_table_history", false); - without_valves = builder - .translation(MODID + ".config.without_valves") - .comment("Disable check valve, and redstone controlled valves.") - .define("without_valves", false); - without_waste_incinerator = builder - .translation(MODID + ".config.without_waste_incinerator") - .comment("Disable item disposal/trash/void incinerator device.") - .define("without_waste_incinerator", false); - without_sign_plates = builder - .translation(MODID + ".config.without_sign_plates") - .comment("Disable decorative sign plates (caution, hazards, etc).") - .define("without_sign_plates", false); - without_floor_grating = builder - .translation(MODID + ".config.without_floor_grating") - .comment("Disable floor gratings.") - .define("without_floor_grating", false); - without_factory_dropper = builder - .translation(MODID + ".config.without_factory_dropper") - .comment("Disable the factory dropper.") - .define("without_factory_dropper", false); - without_factory_hopper = builder - .translation(MODID + ".config.without_factory_hopper") - .comment("Disable the factory hopper.") - .define("without_factory_hopper", false); - without_factory_placer = builder - .translation(MODID + ".config.without_factory_placer") - .comment("Disable the factory placer.") - .define("without_factory_placer", false); - without_block_breaker = builder - .translation(MODID + ".config.without_block_breaker") - .comment("Disable the small block breaker.") - .define("without_block_breaker", false); - without_solar_panel = builder - .translation(MODID + ".config.without_solar_panel") - .comment("Disable the small solar panel.") - .define("without_solar_panel", false); - without_fluid_funnel = builder - .translation(MODID + ".config.without_fluid_funnel") - .comment("Disable the small fluid collection funnel.") - .define("without_fluid_funnel", false); - without_mineral_smelter = builder - .translation(MODID + ".config.without_mineral_smelter") - .comment("Disable the small mineral smelter.") - .define("without_mineral_smelter", false); - without_milking_machine = builder - .translation(MODID + ".config.without_milking_machine") - .comment("Disable the small milking machine.") - .define("without_milking_machine", false); - without_tree_cutter = builder - .translation(MODID + ".config.without_tree_cutter") - .comment("Disable the small tree cutter.") - .define("without_tree_cutter", false); - without_labeled_crate = builder - .translation(MODID + ".config.without_labeled_crate") - .comment("Disable labeled crate.") - .define("without_labeled_crate", false); - without_slabs = builder - .translation(MODID + ".config.without_slabs") - .comment("Disable horizontal half-block slab.") - .define("without_slabs", false); - without_halfslabs = builder - .translation(MODID + ".config.without_halfslabs") - .comment("Disable stackable 1/8 block slices.") - .define("without_halfslabs", false); - without_poles = builder - .translation(MODID + ".config.without_poles") - .comment("Disable poles of any material.") - .define("without_poles", false); - without_hsupports = builder - .translation(MODID + ".config.without_hsupports") - .comment("Disable horizontal supports like the double-T support.") - .define("without_hsupports", false); - without_fences = builder - .translation(MODID + ".config.without_fences") - .comment("Disable all fences and fence gates.") - .define("without_fences", false); - builder.pop(); - } - // --- MISC --------------------------------------------------------------- - { - builder.comment("Miscellaneous settings") - .push("miscellaneous"); - without_direct_slab_pickup = builder - .translation(MODID + ".config.without_direct_slab_pickup") - .comment("Disable directly picking up layers from slabs and slab " + - " slices by left clicking while looking up/down.") - .define("without_direct_slab_pickup", false); - builder.pop(); - } - // --- TWEAKS ------------------------------------------------------------- - { - builder.comment("Tweaks") - .push("tweaks"); - furnace_smelting_speed_percent = builder - .translation(MODID + ".config.furnace_smelting_speed_percent") - .comment("Defines, in percent, how fast the lab furnace smelts compared to " + - "a vanilla furnace. 100% means vanilla furnace speed, 150% means the " + - "lab furnace is faster. The value can be changed on-the-fly for tuning.") - .defineInRange("furnace_smelting_speed_percent", 130, 50, 800); - furnace_fuel_efficiency_percent = builder - .translation(MODID + ".config.furnace_fuel_efficiency_percent") - .comment("Defines, in percent, how fuel efficient the lab furnace is, compared " + - "to a vanilla furnace. 100% means vanilla furnace consumiton, 200% means " + - "the lab furnace needs about half the fuel of a vanilla furnace, " + - "The value can be changed on-the-fly for tuning.") - .defineInRange("furnace_fuel_efficiency_percent", 100, 50, 400); - furnace_boost_energy_consumption = builder - .translation(MODID + ".config.furnace_boost_energy_consumption") - .comment("Defines the energy consumption (per tick) for speeding up the smelting process. " + - "If IE is installed, an external heater has to be inserted into an auxiliary slot " + - "of the lab furnace. The power source needs to be able to provide at least 4 times " + - "this consumption (fixed threshold value). The value can be changed on-the-fly for tuning. " + - "The default value corresponds to the IE heater consumption.") - .defineInRange("furnace_boost_energy_consumption", 24, 2, 1024); - furnace_accepted_heaters = builder - .translation(MODID + ".config.furnace_accepted_heaters") - .comment("Defines (as comma separated list of full registry names) which items are allowed as external " + - "heaters in the Aux slot for powered speed boosting.") - .define("furnace_accepted_heaters", "immersiveengineering:furnace_heater"); - chair_mob_sitting_probability_percent = builder - .translation(MODID + ".config.chair_mob_sitting_probability_percent") - .comment("Defines, in percent, how high the probability is that a mob sits on a chair " + - "when colliding with it. Can be changed on-the-fly for tuning.") - .defineInRange("chair_mob_sitting_probability_percent", 10.0, 0.0, 80.0); - chair_mob_standup_probability_percent = builder - .translation(MODID + ".config.chair_mob_standup_probability_percent") - .comment("Defines, in percent, probable it is that a mob leaves a chair when sitting " + - "on it. The 'dice is rolled' about every 20 ticks. There is also a minimum " + - "Sitting time of about 3s. The config value can be changed on-the-fly for tuning.") - .defineInRange("chair_mob_standup_probability_percent", 1.0, 1e-3, 10.0); - without_crafting_mouse_scrolling = builder - .translation(MODID + ".config.without_crafting_mouse_scrolling") - .comment("Disables increasing/decreasing the crafting grid items by scrolling over the crafting result slot.") - .define("without_crafting_mouse_scrolling", false); - pipevalve_max_flowrate = builder - .translation(MODID + ".config.pipevalve_max_flowrate") - .comment("Defines how many millibuckets can be transferred (per tick) through the valves. " + - "That is technically the 'storage size' specified for blocks that want to fill " + - "fluids into the valve (the valve has no container and forward that to the output " + - "block), The value can be changed on-the-fly for tuning. ") - .defineInRange("pipevalve_max_flowrate", 1000, 1, 32000); - pipevalve_redstone_gain = builder - .translation(MODID + ".config.pipevalve_redstone_gain") - .comment("Defines how many millibuckets per redstone signal strength can be transferred per tick " + - "through the analog redstone controlled valves. Note: power 0 is always off, power 15 is always " + - "the max flow rate. Between power 1 and 14 this scaler will result in a flow = 'redstone slope' * 'current redstone power'. " + - "The value can be changed on-the-fly for tuning. ") - .defineInRange("pipevalve_redstone_gain", 20, 1, 32000); - e_furnace_speed_percent = builder - .translation(MODID + ".config.e_furnace_speed_percent") - .comment("Defines, in percent, how fast the electrical furnace smelts compared to " + - "a vanilla furnace. 100% means vanilla furnace speed, 150% means the " + - "electrical furnace is faster. The value can be changed on-the-fly for tuning.") - .defineInRange("e_furnace_speed_percent", EdElectricalFurnace.ElectricalFurnaceTileEntity.DEFAULT_SPEED_PERCENT, 50, 800); - e_furnace_power_consumption = builder - .translation(MODID + ".config.e_furnace_power_consumption") - .comment("Defines how much RF per tick the the electrical furnace consumed (average) for smelting. " + - "The feeders transferring items from/to adjacent have this consumption/8 for each stack transaction. " + - "The default value is only slightly higher than a furnace with an IE external heater (and no burning fuel inside)." + - "The config value can be changed on-the-fly for tuning.") - .defineInRange("e_furnace_power_consumption", EdElectricalFurnace.ElectricalFurnaceTileEntity.DEFAULT_ENERGY_CONSUMPTION, 8, 4096); - e_furnace_automatic_pulling = builder - .translation(MODID + ".config.e_furnace_automatic_pulling") - .comment("Defines if the electrical furnace automatically pulls items from an inventory at the input side." + - "The config value can be changed on-the-fly for tuning.") - .define("e_furnace_automatic_pulling", false); - small_solar_panel_peak_production = builder - .translation(MODID + ".config.small_solar_panel_peak_production") - .comment("Defines the peak power production (at noon) of the Small Solar Panel. " + - "Note that the agerage power is much less, as no power is produced at all during the night, " + - "and the power curve is nonlinear rising/falling during the day. Bad weather conditions also " + - "decrease the production. The config value can be changed on-the-fly for tuning.") - .defineInRange("small_solar_panel_peak_production", EdSolarPanel.SolarPanelTileEntity.DEFAULT_PEAK_POWER, 2, 4096); - block_breaker_power_consumption = builder - .translation(MODID + ".config.block_breaker_power_consumption") - .comment("Defines how much RF power the Small Block Breaker requires to magnificently increase the processing speed. " + - "The config value can be changed on-the-fly for tuning.") - .defineInRange("block_breaker_power_consumption", EdBreaker.BreakerTileEntity.DEFAULT_BOOST_ENERGY, 4, 1024); - block_breaker_reluctance = builder - .translation(MODID + ".config.block_breaker_reluctance") - .comment("Defines how much time the Small Block Breaker needs per block hardness, " + - "means: 'reluctance' * hardness + min_time, you change the 'reluctance' here." + - "The unit is ticks/hardness. " + "The config value can be changed on-the-fly for tuning.") - .defineInRange("block_breaker_reluctance", EdBreaker.BreakerTileEntity.DEFAULT_BREAKING_RELUCTANCE, 5, 50); - block_breaker_min_breaking_time = builder - .translation(MODID + ".config.block_breaker_min_breaking_time") - .comment("Defines how much time the Small Block Breaker needs at least, better said it's an offset: " + - "'reluctance' * hardness + min_time, you change the 'min_time' here, value " + - "in ticks." + "The config value can be changed on-the-fly for tuning.") - .defineInRange("block_breaker_min_breaking_time", EdBreaker.BreakerTileEntity.DEFAULT_MIN_BREAKING_TIME, 10, 100); - block_breaker_requires_power = builder - .translation(MODID + ".config.block_breaker_requires_power") - .comment("Defines if the Small Block Breaker does not work without RF power.") - .define("block_breaker_requires_power", false); - tree_cutter_energy_consumption = builder - .translation(MODID + ".config.tree_cutter_energy_consumption") - .comment("Defines how much RF power the Small Tree Cutter requires to magnificently increase the processing speed. " + - "The config value can be changed on-the-fly for tuning.") - .defineInRange("tree_cutter_energy_consumption", EdTreeCutter.TreeCutterTileEntity.DEFAULT_BOOST_ENERGY, 4, 1024); - tree_cutter_cutting_time_needed = builder - .translation(MODID + ".config.tree_cutter_cutting_time_needed") - .comment("Defines how much time the Small Tree Cutter needs to cut a tree without RF power. " + - "The value is in seconds. With energy it is 6 times faster. " + - "The config value can be changed on-the-fly for tuning.") - .defineInRange("tree_cutter_cutting_time_needed", EdTreeCutter.TreeCutterTileEntity.DEFAULT_CUTTING_TIME_NEEDED, 10, 240); - tree_cutter_requires_power = builder - .translation(MODID + ".config.tree_cutter_requires_power") - .comment("Defines if the Small Tree Cutter does not work without RF power.") - .define("tree_cutter_requires_power", false); - milking_machine_energy_consumption = builder - .translation(MODID + ".config.milking_machine_energy_consumption") - .comment("Defines how much time the Small Milking Machine needs work. " + - "Note this is a permanent standby power, not only when the device does something. " + - "Use zero to disable energy dependency and energy handling of the machine. " + - "The config value can be changed on-the-fly for tuning.") - .defineInRange("milking_machine_energy_consumption", EdMilker.MilkerTileEntity.DEFAULT_ENERGY_CONSUMPTION, 0, 1024); - milking_machine_milking_delay = builder - .translation(MODID + ".config.milking_machine_milking_delay") - .comment("Defines (for each individual cow) the minimum time between milking." ) - .defineInRange("milking_machine_milking_delay", EdMilker.MilkerTileEntity.DEFAULT_MILKING_DELAY_PER_COW, 1000, 24000); - builder.pop(); - } - } - } - - //-------------------------------------------------------------------------------------------------------------------- - // Optout checks - //-------------------------------------------------------------------------------------------------------------------- - - public static final boolean isOptedOut(final @Nullable Block block) - { return isOptedOut(block.asItem()); } - - public static final boolean isOptedOut(final @Nullable Item item) - { return (item!=null) && optouts_.contains(item.getRegistryName().getPath()); } - - public static boolean withExperimental() - { return with_experimental_features_; } - - public static boolean withoutRecipes() - { return false; } - - public static boolean withDebug() - { return with_debug_logs_; } - - //-------------------------------------------------------------------------------------------------------------------- - // Cache - //-------------------------------------------------------------------------------------------------------------------- - - private static final CompoundNBT server_config_ = new CompoundNBT(); - private static HashSet optouts_ = new HashSet<>(); - private static boolean with_experimental_features_ = false; - private static boolean with_config_logging_ = false; - private static boolean with_debug_logs_ = false; - public static boolean immersiveengineering_installed = false; - public static boolean without_direct_slab_pickup = false; - public static boolean with_creative_mode_device_drops = false; - - public static final CompoundNBT getServerConfig() // config that may be synchronized from server to client via net pkg. - { return server_config_; } - - private static final void updateOptouts() - { - final ArrayList includes = new ArrayList<>(); - final ArrayList excludes = new ArrayList<>(); - { - String inc = COMMON.pattern_includes.get().toLowerCase().replaceAll(MODID+":", "").replaceAll("[^*_,a-z0-9]", ""); - if(COMMON.pattern_includes.get() != inc) COMMON.pattern_includes.set(inc); - String[] incl = inc.split(","); - for(int i=0; i< incl.length; ++i) { - incl[i] = incl[i].replaceAll("[*]", ".*?"); - if(!incl[i].isEmpty()) includes.add(incl[i]); - } - } - { - String exc = COMMON.pattern_excludes.get().toLowerCase().replaceAll(MODID+":", "").replaceAll("[^*_,a-z0-9]", ""); - String[] excl = exc.split(","); - for(int i=0; i< excl.length; ++i) { - excl[i] = excl[i].replaceAll("[*]", ".*?"); - if(!excl[i].isEmpty()) excludes.add(excl[i]); - } - } - if(SERVER_CONFIG_SPEC.isLoaded()) { - /// @todo: remove for MC1.17/1.16.5 - String inc = SERVER.pattern_includes.get().toLowerCase().replaceAll(MODID+":", "").replaceAll("[^*_,a-z0-9]", ""); - String[] incl = inc.split(","); - for(int i=0; i< incl.length; ++i) { - incl[i] = incl[i].replaceAll("[*]", ".*?"); - if(!incl[i].isEmpty()) includes.add(incl[i]); - } - } - if(SERVER_CONFIG_SPEC.isLoaded()) { - /// @todo: remove for MC1.17/1.16.5 - String exc = SERVER.pattern_excludes.get().toLowerCase().replaceAll(MODID+":", "").replaceAll("[^*_,a-z0-9]", ""); - String[] excl = exc.split(","); - for(int i=0; i< excl.length; ++i) { - excl[i] = excl[i].replaceAll("[*]", ".*?"); - if(!excl[i].isEmpty()) excludes.add(excl[i]); - } - } - if(!excludes.isEmpty()) log("Config pattern excludes: '" + String.join(",", excludes) + "'"); - if(!includes.isEmpty()) log("Config pattern includes: '" + String.join(",", includes) + "'"); - { - HashSet optouts = new HashSet<>(); - ModContent.getRegisteredItems().stream().filter((item)->(item!=null)).forEach( - e -> optouts.add(e.getRegistryName().getPath()) - ); - ModContent.getRegisteredBlocks().stream().filter((Block block) -> { - if(block==null) return true; - if(block==ModContent.SIGN_MODLOGO) return true; - try { - if(!with_experimental_features_) { - if(block instanceof Auxiliaries.IExperimentalFeature) return true; - if(ModContent.isExperimentalBlock(block)) return true; - } - // Hard IE dependent blocks - if(!immersiveengineering_installed) { - if((block instanceof IDecorBlock) && ((((IDecorBlock)block).config() & DecorBlock.CFG_HARD_IE_DEPENDENT)!=0)) return true; - if((block instanceof DecorBlock.Normal) && ((((DecorBlock.Normal)block).config & DecorBlock.CFG_HARD_IE_DEPENDENT)!=0)) return true; - if((block instanceof StandardBlocks.BaseBlock) && ((((StandardBlocks.BaseBlock)block).config & DecorBlock.CFG_HARD_IE_DEPENDENT)!=0)) return true; - } - // Force-include/exclude pattern matching - final String rn = block.getRegistryName().getPath(); - try { - for(String e : includes) { - if(rn.matches(e)) { - log("Optout force include: "+rn); - return false; - } - } - for(String e : excludes) { - if(rn.matches(e)) { - log("Optout force exclude: "+rn); - return true; - } - } - } catch(Throwable ex) { - LOGGER.error("optout include pattern failed, disabling."); - includes.clear(); - excludes.clear(); - } - // Early non-opt out type based evaluation - if(SERVER==null) return false; - if(block instanceof EdCraftingTable.CraftingTableBlock) return SERVER.without_crafting_table.get(); - if(block instanceof EdElectricalFurnace.ElectricalFurnaceBlock) return SERVER.without_electrical_furnace.get(); - if((block instanceof EdFurnace.FurnaceBlock)&&(!(block instanceof EdElectricalFurnace.ElectricalFurnaceBlock))) return SERVER.without_lab_furnace.get(); - if(block instanceof EdWasteIncinerator.WasteIncineratorBlock) return SERVER.without_waste_incinerator.get(); - if(block instanceof EdDropper.DropperBlock) return SERVER.without_factory_dropper.get(); - if(block instanceof EdPlacer.PlacerBlock) return SERVER.without_factory_placer.get(); - if(block instanceof EdBreaker.BreakerBlock) return SERVER.without_block_breaker.get(); - if(block instanceof EdSlabSliceBlock) return SERVER.without_halfslabs.get(); - if(block instanceof EdLadderBlock) return SERVER.without_ladders.get(); - if(block instanceof EdWindowBlock) return SERVER.without_windows.get(); - if(block instanceof EdPipeValve.PipeValveBlock) return SERVER.without_valves.get(); - if(block instanceof EdHorizontalSupportBlock) return SERVER.without_hsupports.get(); - if(block instanceof EdFloorGratingBlock) return SERVER.without_floor_grating.get(); - if(block instanceof EdHopper.HopperBlock) return SERVER.without_factory_hopper.get(); - if(block instanceof EdFluidFunnel.FluidFunnelBlock) return SERVER.without_fluid_funnel.get(); - if(block instanceof EdSolarPanel.SolarPanelBlock) return SERVER.without_solar_panel.get(); - if(block instanceof EdMineralSmelter.MineralSmelterBlock) return SERVER.without_mineral_smelter.get(); - if(block instanceof EdMilker.MilkerBlock) return SERVER.without_milking_machine.get(); - if(block instanceof EdTreeCutter.TreeCutterBlock) return SERVER.without_tree_cutter.get(); - if(block instanceof EdLabeledCrate.LabeledCrateBlock) return SERVER.without_labeled_crate.get(); - // Type based evaluation where later filters may match, too - if(SERVER.without_slabs.get()&&(block instanceof EdSlabBlock)) return true; - if(SERVER.without_stairs.get()&&(block instanceof EdStairsBlock)) return true; - if(SERVER.without_walls.get()&&(block instanceof EdWallBlock)) return true; - if(SERVER.without_poles.get()&&(block instanceof EdStraightPoleBlock)) return true; - // String matching based evaluation - if(SERVER.without_clinker_bricks.get()&&(rn.startsWith("clinker_brick_"))) return true; - if(SERVER.without_slag_bricks.get()&&rn.startsWith("slag_brick_")) return true; - if(SERVER.without_rebar_concrete.get()&&rn.startsWith("rebar_concrete")) return true; - if(SERVER.without_gas_concrete.get()&&rn.startsWith("gas_concrete")) return true; - if(SERVER.without_panzer_glass.get()&&rn.startsWith("panzerglass_")) return true; - if(SERVER.without_light_sources.get()&&rn.endsWith("_light")) return true; - if(SERVER.without_sign_plates.get()&&rn.startsWith("sign_")) return true; - if(SERVER.without_treated_wood_furniture.get()) { - if(block instanceof EdChair.ChairBlock) return true; - if(rn.equals("treated_wood_table")) return true; - if(rn.equals("treated_wood_stool")) return true; - if(rn.equals("treated_wood_windowsill")) return true; - if(rn.equals("treated_wood_broad_windowsill")) return true; - if(rn.equals("treated_wood_side_table")) return true; - } - if(SERVER.without_metal_furniture.get()) { - if(rn.equals("steel_table")) return true; - } - if(SERVER.without_fences.get()) { - if(block instanceof EdFenceBlock) return true; - if(block instanceof EdDoubleGateBlock) return true; - } - } catch(Exception ex) { - LOGGER.error("Exception evaluating the optout config: '"+ex.getMessage()+"'"); - } - return false; - }).forEach( - e -> optouts.add(e.getRegistryName().getPath()) - ); - optouts_ = optouts; - } - OptionalRecipeCondition.on_config(withExperimental(), withoutRecipes(), ModConfig::isOptedOut, ModConfig::isOptedOut); - } - - public static final void apply() - { - with_config_logging_ = COMMON.with_config_logging.get(); - with_experimental_features_ = COMMON.with_experimental.get(); - with_debug_logs_ = COMMON.with_debug_logging.get(); - if(with_experimental_features_) LOGGER.info("Config: EXPERIMENTAL FEATURES ENABLED."); - if(with_debug_logs_) LOGGER.info("Config: DEBUG LOGGING ENABLED, WARNING, THIS MAY SPAM THE LOG."); - immersiveengineering_installed = Auxiliaries.isModLoaded("immersiveengineering"); - updateOptouts(); - if(!SERVER_CONFIG_SPEC.isLoaded()) return; - without_direct_slab_pickup = SERVER.without_direct_slab_pickup.get(); - // ----------------------------------------------------------------------------------------------------------------- - EdChair.on_config(SERVER.without_chair_sitting.get(), SERVER.without_mob_chair_sitting.get(), SERVER.chair_mob_sitting_probability_percent.get(), SERVER.chair_mob_standup_probability_percent.get()); - EdLadderBlock.on_config(SERVER.without_ladder_speed_boost.get()); - EdSlabBlock.on_config(!SERVER.without_direct_slab_pickup.get()); - EdSlabSliceBlock.on_config(!SERVER.without_direct_slab_pickup.get()); - EdLabeledCrate.on_config(false); - EdCraftingTable.on_config(SERVER.without_crafting_table_history.get(), false, SERVER.without_crafting_mouse_scrolling.get()); - EdFluidBarrel.on_config(12000, 1000); - EdFluidFunnel.on_config(with_experimental_features_); - EdPipeValve.on_config(SERVER.pipevalve_max_flowrate.get(), SERVER.pipevalve_redstone_gain.get()); - EdHopper.on_config(); - EdDropper.on_config(true); - EdPlacer.on_config(); - EdBreaker.on_config(SERVER.block_breaker_power_consumption.get(), SERVER.block_breaker_reluctance.get(), SERVER.block_breaker_min_breaking_time.get(), SERVER.block_breaker_requires_power.get()); - EdTreeCutter.on_config(SERVER.tree_cutter_energy_consumption.get(), SERVER.tree_cutter_cutting_time_needed.get(), SERVER.tree_cutter_requires_power.get()); - EdFurnace.on_config(SERVER.furnace_smelting_speed_percent.get(), SERVER.furnace_fuel_efficiency_percent.get(), SERVER.furnace_boost_energy_consumption.get(), SERVER.furnace_accepted_heaters.get()); - EdElectricalFurnace.on_config(SERVER.e_furnace_speed_percent.get(), SERVER.e_furnace_power_consumption.get(), SERVER.e_furnace_automatic_pulling.get()); - EdSolarPanel.on_config(SERVER.small_solar_panel_peak_production.get()); - EdMilker.on_config(SERVER.milking_machine_energy_consumption.get(), SERVER.milking_machine_milking_delay.get()); - EdFreezer.on_config(92, 2); - EdMineralSmelter.on_config(92, 2); - EdWasteIncinerator.on_config(8); - // ----------------------------------------------------------------------------------------------------------------- - { - // Check if the config is already synchronized or has to be synchronised. - server_config_.putBoolean("tree_cutter_requires_power", SERVER.tree_cutter_requires_power.get()); - server_config_.putBoolean("block_breaker_requires_power", SERVER.block_breaker_requires_power.get()); - { - String s = String.join(",", optouts_); - server_config_.putString("optout", s); - if(!s.isEmpty()) log("Opt-outs:" + s); - } - } - } - - public static final void log(String config_message) - { - if(!with_config_logging_) return; - LOGGER.info(config_message); - } - -} +/* + * @file ModConfig.java + * @author Stefan Wilhelm (wile) + * @copyright (C) 2020 Stefan Wilhelm + * @license MIT (see https://opensource.org/licenses/MIT) + * + * Main class for module settings. Handles reading and + * saving the config file. + */ +package wile.engineersdecor; + +import net.minecraft.nbt.CompoundNBT; +import net.minecraft.block.Block; +import net.minecraft.item.Item; +import net.minecraftforge.common.ForgeConfigSpec; +import org.apache.commons.lang3.tuple.Pair; +import org.apache.logging.log4j.Logger; +import wile.engineersdecor.blocks.*; +import wile.engineersdecor.libmc.blocks.StandardBlocks; +import wile.engineersdecor.libmc.detail.Auxiliaries; +import wile.engineersdecor.libmc.detail.OptionalRecipeCondition; + +import javax.annotation.Nullable; +import java.util.ArrayList; +import java.util.HashSet; + +public class ModConfig +{ + //-------------------------------------------------------------------------------------------------------------------- + private static final Logger LOGGER = ModEngineersDecor.logger(); + private static final String MODID = ModEngineersDecor.MODID; + public static final CommonConfig COMMON; + public static final ServerConfig SERVER; + public static final ClientConfig CLIENT; + public static final ForgeConfigSpec COMMON_CONFIG_SPEC; + public static final ForgeConfigSpec SERVER_CONFIG_SPEC; + public static final ForgeConfigSpec CLIENT_CONFIG_SPEC; + + static { + final Pair common_ = (new ForgeConfigSpec.Builder()).configure(CommonConfig::new); + COMMON_CONFIG_SPEC = common_.getRight(); + COMMON = common_.getLeft(); + final Pair server_ = (new ForgeConfigSpec.Builder()).configure(ServerConfig::new); + SERVER_CONFIG_SPEC = server_.getRight(); + SERVER = server_.getLeft(); + final Pair client_ = (new ForgeConfigSpec.Builder()).configure(ClientConfig::new); + CLIENT_CONFIG_SPEC = client_.getRight(); + CLIENT = client_.getLeft(); + } + + //-------------------------------------------------------------------------------------------------------------------- + + public static class ClientConfig + { + public final ForgeConfigSpec.BooleanValue without_tooltips; + public final ForgeConfigSpec.BooleanValue without_ters; + + ClientConfig(ForgeConfigSpec.Builder builder) + { + builder.comment("Settings not loaded on servers.") + .push("client"); + // --- OPTOUTS ------------------------------------------------------------ + { + builder.comment("Opt-out settings") + .push("optout"); + without_tooltips = builder + .translation(MODID + ".config.without_tooltips") + .comment("Disable CTRL-SHIFT item tooltip display.") + .define("without_tooltips", false); + without_ters = builder + .translation(MODID + ".config.without_ters") + .comment("Disable all TERs (tile entity renderers).") + .define("without_ters", false); + } + builder.pop(); + } + } + + //-------------------------------------------------------------------------------------------------------------------- + + public static class CommonConfig + { + // Optout + public final ForgeConfigSpec.ConfigValue pattern_excludes; + public final ForgeConfigSpec.ConfigValue pattern_includes; + // MISC + public final ForgeConfigSpec.BooleanValue with_creative_mode_device_drops; + public final ForgeConfigSpec.BooleanValue with_experimental; + public final ForgeConfigSpec.BooleanValue with_config_logging; + public final ForgeConfigSpec.BooleanValue with_debug_logging; + + CommonConfig(ForgeConfigSpec.Builder builder) + { + builder.comment("Settings affecting the logical server side.") + .push("server"); + // --- OPTOUTS ------------------------------------------------------------ + { + builder.comment("Opt-out settings") + .push("optout"); + pattern_excludes = builder + .translation(MODID + ".config.pattern_excludes") + .comment("Opt-out any block by its registry name ('*' wildcard matching, " + + "comma separated list, whitespaces ignored. You must match the whole name, " + + "means maybe add '*' also at the begin and end. Example: '*wood*,*steel*' " + + "excludes everything that has 'wood' or 'steel' in the registry name. " + + "The matching result is also traced in the log file. ") + .define("pattern_excludes", ""); + pattern_includes = builder + .translation(MODID + ".config.pattern_includes") + .comment("Prevent blocks from being opt'ed by registry name ('*' wildcard matching, " + + "comma separated list, whitespaces ignored. Evaluated before all other opt-out checks. " + + "You must match the whole name, means maybe add '*' also at the begin and end. Example: " + + "'*wood*,*steel*' includes everything that has 'wood' or 'steel' in the registry name." + + "The matching result is also traced in the log file.") + .define("pattern_includes", ""); + builder.pop(); + } + // --- MISC --------------------------------------------------------------- + { + builder.comment("Miscellaneous settings") + .push("miscellaneous"); + with_experimental = builder + .translation(MODID + ".config.with_experimental") + .comment("Enables experimental features. Use at own risk.") + .define("with_experimental", false); + with_creative_mode_device_drops = builder + .translation(MODID + ".config.with_creative_mode_device_drops") + .comment("Enable that devices are dropped as item also in creative mode, allowing " + + " to relocate them with contents and settings.") + .define("with_creative_mode_device_drops", false); + with_config_logging = builder + .translation(MODID + ".config.with_debug_logging") + .comment("Enable detailed logging of the config values and resulting calculations in each mod feature config.") + .define("with_debug_logging", false); + with_debug_logging = builder + .translation(MODID + ".config.with_debug_logging") + .comment("Enable debug log messages for trouble shooting. Don't activate if not really needed, this can spam the log file.") + .define("with_debug_logging", false); + builder.pop(); + } + } + } + + //-------------------------------------------------------------------------------------------------------------------- + + public static class ServerConfig + { + // Optout + public final ForgeConfigSpec.BooleanValue without_chair_sitting; + public final ForgeConfigSpec.BooleanValue without_mob_chair_sitting; + public final ForgeConfigSpec.BooleanValue without_ladder_speed_boost; + public final ForgeConfigSpec.BooleanValue without_crafting_table_history; + + /// ---------- @todo: remove these settings for MC1.17 / 1.16.5 + public final ForgeConfigSpec.ConfigValue pattern_excludes; + public final ForgeConfigSpec.ConfigValue pattern_includes; + public final ForgeConfigSpec.BooleanValue without_clinker_bricks; + public final ForgeConfigSpec.BooleanValue without_slag_bricks; + public final ForgeConfigSpec.BooleanValue without_rebar_concrete; + public final ForgeConfigSpec.BooleanValue without_gas_concrete; + public final ForgeConfigSpec.BooleanValue without_walls; + public final ForgeConfigSpec.BooleanValue without_stairs; + public final ForgeConfigSpec.BooleanValue without_panzer_glass; + public final ForgeConfigSpec.BooleanValue without_ladders; + public final ForgeConfigSpec.BooleanValue without_treated_wood_furniture; + public final ForgeConfigSpec.BooleanValue without_metal_furniture; + public final ForgeConfigSpec.BooleanValue without_windows; + public final ForgeConfigSpec.BooleanValue without_light_sources; + public final ForgeConfigSpec.BooleanValue without_slabs; + public final ForgeConfigSpec.BooleanValue without_halfslabs; + public final ForgeConfigSpec.BooleanValue without_poles; + public final ForgeConfigSpec.BooleanValue without_hsupports; + public final ForgeConfigSpec.BooleanValue without_sign_plates; + public final ForgeConfigSpec.BooleanValue without_floor_grating; + public final ForgeConfigSpec.BooleanValue without_crafting_table; + public final ForgeConfigSpec.BooleanValue without_lab_furnace; + public final ForgeConfigSpec.BooleanValue without_electrical_furnace; + public final ForgeConfigSpec.BooleanValue without_valves; + public final ForgeConfigSpec.BooleanValue without_waste_incinerator; + public final ForgeConfigSpec.BooleanValue without_factory_dropper; + public final ForgeConfigSpec.BooleanValue without_factory_hopper; + public final ForgeConfigSpec.BooleanValue without_factory_placer; + public final ForgeConfigSpec.BooleanValue without_block_breaker; + public final ForgeConfigSpec.BooleanValue without_solar_panel; + public final ForgeConfigSpec.BooleanValue without_fluid_funnel; + public final ForgeConfigSpec.BooleanValue without_mineral_smelter; + public final ForgeConfigSpec.BooleanValue without_milking_machine; + public final ForgeConfigSpec.BooleanValue without_tree_cutter; + public final ForgeConfigSpec.BooleanValue without_labeled_crate; + public final ForgeConfigSpec.BooleanValue without_fences; + /// ----------------------- + + // Misc + public final ForgeConfigSpec.BooleanValue without_direct_slab_pickup; + // Tweaks + public final ForgeConfigSpec.IntValue furnace_smelting_speed_percent; + public final ForgeConfigSpec.IntValue furnace_fuel_efficiency_percent; + public final ForgeConfigSpec.IntValue furnace_boost_energy_consumption; + public final ForgeConfigSpec.ConfigValue furnace_accepted_heaters; + public final ForgeConfigSpec.IntValue e_furnace_speed_percent; + public final ForgeConfigSpec.IntValue e_furnace_power_consumption; + public final ForgeConfigSpec.IntValue small_solar_panel_peak_production; + public final ForgeConfigSpec.BooleanValue e_furnace_automatic_pulling; + public final ForgeConfigSpec.DoubleValue chair_mob_sitting_probability_percent; + public final ForgeConfigSpec.DoubleValue chair_mob_standup_probability_percent; + public final ForgeConfigSpec.BooleanValue without_crafting_mouse_scrolling; + public final ForgeConfigSpec.IntValue pipevalve_max_flowrate; + public final ForgeConfigSpec.IntValue pipevalve_redstone_gain; + public final ForgeConfigSpec.IntValue block_breaker_power_consumption; + public final ForgeConfigSpec.IntValue block_breaker_reluctance; + public final ForgeConfigSpec.IntValue block_breaker_min_breaking_time; + public final ForgeConfigSpec.BooleanValue block_breaker_requires_power; + public final ForgeConfigSpec.IntValue tree_cutter_energy_consumption; + public final ForgeConfigSpec.IntValue tree_cutter_cutting_time_needed; + public final ForgeConfigSpec.BooleanValue tree_cutter_requires_power; + public final ForgeConfigSpec.IntValue milking_machine_energy_consumption; + public final ForgeConfigSpec.IntValue milking_machine_milking_delay; + + ServerConfig(ForgeConfigSpec.Builder builder) + { + builder.comment("Settings affecting the logical server side.") + .push("server"); + // --- OPTOUTS ------------------------------------------------------------ + { + builder.comment("Server dev opt-out settings !WARNING THE OPT-OUTs will be moved to common-config.toml in the next MC version!") + .push("optout"); + pattern_excludes = builder + .translation(MODID + ".config.pattern_excludes") + .comment("Opt-out any block by its registry name ('*' wildcard matching, " + + "comma separated list, whitespaces ignored. You must match the whole name, " + + "means maybe add '*' also at the begin and end. Example: '*wood*,*steel*' " + + "excludes everything that has 'wood' or 'steel' in the registry name. " + + "The matching result is also traced in the log file. ") + .define("pattern_excludes", ""); + pattern_includes = builder + .translation(MODID + ".config.pattern_includes") + .comment("Prevent blocks from being opt'ed by registry name ('*' wildcard matching, " + + "comma separated list, whitespaces ignored. Evaluated before all other opt-out checks. " + + "You must match the whole name, means maybe add '*' also at the begin and end. Example: " + + "'*wood*,*steel*' includes everything that has 'wood' or 'steel' in the registry name." + + "The matching result is also traced in the log file.") + .define("pattern_includes", ""); + without_clinker_bricks = builder + .translation(MODID + ".config.without_clinker_bricks") + .comment("Disable clinker bricks and derived blocks.") + .define("without_clinker_bricks", false); + without_slag_bricks = builder + .translation(MODID + ".config.without_slag_bricks") + .comment("Disable slag bricks and derived blocks.") + .define("without_slag_bricks", false); + without_rebar_concrete = builder + .translation(MODID + ".config.without_rebar_concrete") + .comment("Disable rebar concrete and derived blocks.") + .define("without_rebar_concrete", false); + without_gas_concrete = builder + .translation(MODID + ".config.without_gas_concrete") + .comment("Disable gas concrete and derived blocks.") + .define("without_gas_concrete", false); + without_walls = builder + .translation(MODID + ".config.without_walls") + .comment("Disable all mod wall blocks.") + .define("without_walls", false); + without_stairs = builder + .translation(MODID + ".config.without_stairs") + .comment("Disable all mod stairs blocks.") + .define("without_stairs", false); + without_panzer_glass = builder + .translation(MODID + ".config.without_panzer_glass") + .comment("Disable panzer glass and derived blocks.") + .define("without_panzer_glass", false); + without_crafting_table = builder + .translation(MODID + ".config.without_crafting_table") + .comment("Disable crafting table.") + .define("without_crafting_table", false); + without_lab_furnace = builder + .translation(MODID + ".config.without_lab_furnace") + .comment("Disable small lab furnace.") + .define("without_lab_furnace", false); + without_electrical_furnace = builder + .translation(MODID + ".config.without_electrical_furnace") + .comment("Disable small electrical pass-through furnace.") + .define("without_electrical_furnace", false); + without_treated_wood_furniture = builder + .translation(MODID + ".config.without_treated_wood_furniture") + .comment("Disable treated wood table, stool, windowsill, etc.") + .define("without_treated_wood_furniture", false); + without_metal_furniture = builder + .translation(MODID + ".config.without_metal_furniture") + .comment("Disable metal tables, etc.") + .define("without_metal_furniture", false); + without_windows = builder + .translation(MODID + ".config.without_windows") + .comment("Disable treated wood window, etc.") + .define("without_windows", false); + without_light_sources = builder + .translation(MODID + ".config.without_light_sources") + .comment("Disable light sources") + .define("without_light_sources", false); + without_ladders = builder + .translation(MODID + ".config.without_ladders") + .comment("Disable ladders") + .define("without_ladders", false); + without_chair_sitting = builder + .translation(MODID + ".config.without_chair_sitting") + .comment("Disable possibility to sit on stools and chairs.") + .define("without_chair_sitting", false); + without_mob_chair_sitting = builder + .translation(MODID + ".config.without_mob_chair_sitting") + .comment("Disable that mobs will sit on chairs and stools.") + .define("without_mob_chair_sitting", false); + without_ladder_speed_boost = builder + .translation(MODID + ".config.without_ladder_speed_boost") + .comment("Disable the speed boost of ladders in this mod.") + .define("without_ladder_speed_boost", false); + without_crafting_table_history = builder + .translation(MODID + ".config.without_crafting_table_history") + .comment("Disable history refabrication feature of the crafting table.") + .define("without_crafting_table_history", false); + without_valves = builder + .translation(MODID + ".config.without_valves") + .comment("Disable check valve, and redstone controlled valves.") + .define("without_valves", false); + without_waste_incinerator = builder + .translation(MODID + ".config.without_waste_incinerator") + .comment("Disable item disposal/trash/void incinerator device.") + .define("without_waste_incinerator", false); + without_sign_plates = builder + .translation(MODID + ".config.without_sign_plates") + .comment("Disable decorative sign plates (caution, hazards, etc).") + .define("without_sign_plates", false); + without_floor_grating = builder + .translation(MODID + ".config.without_floor_grating") + .comment("Disable floor gratings.") + .define("without_floor_grating", false); + without_factory_dropper = builder + .translation(MODID + ".config.without_factory_dropper") + .comment("Disable the factory dropper.") + .define("without_factory_dropper", false); + without_factory_hopper = builder + .translation(MODID + ".config.without_factory_hopper") + .comment("Disable the factory hopper.") + .define("without_factory_hopper", false); + without_factory_placer = builder + .translation(MODID + ".config.without_factory_placer") + .comment("Disable the factory placer.") + .define("without_factory_placer", false); + without_block_breaker = builder + .translation(MODID + ".config.without_block_breaker") + .comment("Disable the small block breaker.") + .define("without_block_breaker", false); + without_solar_panel = builder + .translation(MODID + ".config.without_solar_panel") + .comment("Disable the small solar panel.") + .define("without_solar_panel", false); + without_fluid_funnel = builder + .translation(MODID + ".config.without_fluid_funnel") + .comment("Disable the small fluid collection funnel.") + .define("without_fluid_funnel", false); + without_mineral_smelter = builder + .translation(MODID + ".config.without_mineral_smelter") + .comment("Disable the small mineral smelter.") + .define("without_mineral_smelter", false); + without_milking_machine = builder + .translation(MODID + ".config.without_milking_machine") + .comment("Disable the small milking machine.") + .define("without_milking_machine", false); + without_tree_cutter = builder + .translation(MODID + ".config.without_tree_cutter") + .comment("Disable the small tree cutter.") + .define("without_tree_cutter", false); + without_labeled_crate = builder + .translation(MODID + ".config.without_labeled_crate") + .comment("Disable labeled crate.") + .define("without_labeled_crate", false); + without_slabs = builder + .translation(MODID + ".config.without_slabs") + .comment("Disable horizontal half-block slab.") + .define("without_slabs", false); + without_halfslabs = builder + .translation(MODID + ".config.without_halfslabs") + .comment("Disable stackable 1/8 block slices.") + .define("without_halfslabs", false); + without_poles = builder + .translation(MODID + ".config.without_poles") + .comment("Disable poles of any material.") + .define("without_poles", false); + without_hsupports = builder + .translation(MODID + ".config.without_hsupports") + .comment("Disable horizontal supports like the double-T support.") + .define("without_hsupports", false); + without_fences = builder + .translation(MODID + ".config.without_fences") + .comment("Disable all fences and fence gates.") + .define("without_fences", false); + builder.pop(); + } + // --- MISC --------------------------------------------------------------- + { + builder.comment("Miscellaneous settings") + .push("miscellaneous"); + without_direct_slab_pickup = builder + .translation(MODID + ".config.without_direct_slab_pickup") + .comment("Disable directly picking up layers from slabs and slab " + + " slices by left clicking while looking up/down.") + .define("without_direct_slab_pickup", false); + builder.pop(); + } + // --- TWEAKS ------------------------------------------------------------- + { + builder.comment("Tweaks") + .push("tweaks"); + furnace_smelting_speed_percent = builder + .translation(MODID + ".config.furnace_smelting_speed_percent") + .comment("Defines, in percent, how fast the lab furnace smelts compared to " + + "a vanilla furnace. 100% means vanilla furnace speed, 150% means the " + + "lab furnace is faster. The value can be changed on-the-fly for tuning.") + .defineInRange("furnace_smelting_speed_percent", 130, 50, 800); + furnace_fuel_efficiency_percent = builder + .translation(MODID + ".config.furnace_fuel_efficiency_percent") + .comment("Defines, in percent, how fuel efficient the lab furnace is, compared " + + "to a vanilla furnace. 100% means vanilla furnace consumiton, 200% means " + + "the lab furnace needs about half the fuel of a vanilla furnace, " + + "The value can be changed on-the-fly for tuning.") + .defineInRange("furnace_fuel_efficiency_percent", 100, 50, 400); + furnace_boost_energy_consumption = builder + .translation(MODID + ".config.furnace_boost_energy_consumption") + .comment("Defines the energy consumption (per tick) for speeding up the smelting process. " + + "If IE is installed, an external heater has to be inserted into an auxiliary slot " + + "of the lab furnace. The power source needs to be able to provide at least 4 times " + + "this consumption (fixed threshold value). The value can be changed on-the-fly for tuning. " + + "The default value corresponds to the IE heater consumption.") + .defineInRange("furnace_boost_energy_consumption", 24, 2, 1024); + furnace_accepted_heaters = builder + .translation(MODID + ".config.furnace_accepted_heaters") + .comment("Defines (as comma separated list of full registry names) which items are allowed as external " + + "heaters in the Aux slot for powered speed boosting.") + .define("furnace_accepted_heaters", "immersiveengineering:furnace_heater"); + chair_mob_sitting_probability_percent = builder + .translation(MODID + ".config.chair_mob_sitting_probability_percent") + .comment("Defines, in percent, how high the probability is that a mob sits on a chair " + + "when colliding with it. Can be changed on-the-fly for tuning.") + .defineInRange("chair_mob_sitting_probability_percent", 10.0, 0.0, 80.0); + chair_mob_standup_probability_percent = builder + .translation(MODID + ".config.chair_mob_standup_probability_percent") + .comment("Defines, in percent, probable it is that a mob leaves a chair when sitting " + + "on it. The 'dice is rolled' about every 20 ticks. There is also a minimum " + + "Sitting time of about 3s. The config value can be changed on-the-fly for tuning.") + .defineInRange("chair_mob_standup_probability_percent", 1.0, 1e-3, 10.0); + without_crafting_mouse_scrolling = builder + .translation(MODID + ".config.without_crafting_mouse_scrolling") + .comment("Disables increasing/decreasing the crafting grid items by scrolling over the crafting result slot.") + .define("without_crafting_mouse_scrolling", false); + pipevalve_max_flowrate = builder + .translation(MODID + ".config.pipevalve_max_flowrate") + .comment("Defines how many millibuckets can be transferred (per tick) through the valves. " + + "That is technically the 'storage size' specified for blocks that want to fill " + + "fluids into the valve (the valve has no container and forward that to the output " + + "block), The value can be changed on-the-fly for tuning. ") + .defineInRange("pipevalve_max_flowrate", 1000, 1, 32000); + pipevalve_redstone_gain = builder + .translation(MODID + ".config.pipevalve_redstone_gain") + .comment("Defines how many millibuckets per redstone signal strength can be transferred per tick " + + "through the analog redstone controlled valves. Note: power 0 is always off, power 15 is always " + + "the max flow rate. Between power 1 and 14 this scaler will result in a flow = 'redstone slope' * 'current redstone power'. " + + "The value can be changed on-the-fly for tuning. ") + .defineInRange("pipevalve_redstone_gain", 20, 1, 32000); + e_furnace_speed_percent = builder + .translation(MODID + ".config.e_furnace_speed_percent") + .comment("Defines, in percent, how fast the electrical furnace smelts compared to " + + "a vanilla furnace. 100% means vanilla furnace speed, 150% means the " + + "electrical furnace is faster. The value can be changed on-the-fly for tuning.") + .defineInRange("e_furnace_speed_percent", EdElectricalFurnace.ElectricalFurnaceTileEntity.DEFAULT_SPEED_PERCENT, 50, 800); + e_furnace_power_consumption = builder + .translation(MODID + ".config.e_furnace_power_consumption") + .comment("Defines how much RF per tick the the electrical furnace consumed (average) for smelting. " + + "The feeders transferring items from/to adjacent have this consumption/8 for each stack transaction. " + + "The default value is only slightly higher than a furnace with an IE external heater (and no burning fuel inside)." + + "The config value can be changed on-the-fly for tuning.") + .defineInRange("e_furnace_power_consumption", EdElectricalFurnace.ElectricalFurnaceTileEntity.DEFAULT_ENERGY_CONSUMPTION, 8, 4096); + e_furnace_automatic_pulling = builder + .translation(MODID + ".config.e_furnace_automatic_pulling") + .comment("Defines if the electrical furnace automatically pulls items from an inventory at the input side." + + "The config value can be changed on-the-fly for tuning.") + .define("e_furnace_automatic_pulling", false); + small_solar_panel_peak_production = builder + .translation(MODID + ".config.small_solar_panel_peak_production") + .comment("Defines the peak power production (at noon) of the Small Solar Panel. " + + "Note that the agerage power is much less, as no power is produced at all during the night, " + + "and the power curve is nonlinear rising/falling during the day. Bad weather conditions also " + + "decrease the production. The config value can be changed on-the-fly for tuning.") + .defineInRange("small_solar_panel_peak_production", EdSolarPanel.SolarPanelTileEntity.DEFAULT_PEAK_POWER, 2, 4096); + block_breaker_power_consumption = builder + .translation(MODID + ".config.block_breaker_power_consumption") + .comment("Defines how much RF power the Small Block Breaker requires to magnificently increase the processing speed. " + + "The config value can be changed on-the-fly for tuning.") + .defineInRange("block_breaker_power_consumption", EdBreaker.BreakerTileEntity.DEFAULT_BOOST_ENERGY, 4, 1024); + block_breaker_reluctance = builder + .translation(MODID + ".config.block_breaker_reluctance") + .comment("Defines how much time the Small Block Breaker needs per block hardness, " + + "means: 'reluctance' * hardness + min_time, you change the 'reluctance' here." + + "The unit is ticks/hardness. " + "The config value can be changed on-the-fly for tuning.") + .defineInRange("block_breaker_reluctance", EdBreaker.BreakerTileEntity.DEFAULT_BREAKING_RELUCTANCE, 5, 50); + block_breaker_min_breaking_time = builder + .translation(MODID + ".config.block_breaker_min_breaking_time") + .comment("Defines how much time the Small Block Breaker needs at least, better said it's an offset: " + + "'reluctance' * hardness + min_time, you change the 'min_time' here, value " + + "in ticks." + "The config value can be changed on-the-fly for tuning.") + .defineInRange("block_breaker_min_breaking_time", EdBreaker.BreakerTileEntity.DEFAULT_MIN_BREAKING_TIME, 10, 100); + block_breaker_requires_power = builder + .translation(MODID + ".config.block_breaker_requires_power") + .comment("Defines if the Small Block Breaker does not work without RF power.") + .define("block_breaker_requires_power", false); + tree_cutter_energy_consumption = builder + .translation(MODID + ".config.tree_cutter_energy_consumption") + .comment("Defines how much RF power the Small Tree Cutter requires to magnificently increase the processing speed. " + + "The config value can be changed on-the-fly for tuning.") + .defineInRange("tree_cutter_energy_consumption", EdTreeCutter.TreeCutterTileEntity.DEFAULT_BOOST_ENERGY, 4, 1024); + tree_cutter_cutting_time_needed = builder + .translation(MODID + ".config.tree_cutter_cutting_time_needed") + .comment("Defines how much time the Small Tree Cutter needs to cut a tree without RF power. " + + "The value is in seconds. With energy it is 6 times faster. " + + "The config value can be changed on-the-fly for tuning.") + .defineInRange("tree_cutter_cutting_time_needed", EdTreeCutter.TreeCutterTileEntity.DEFAULT_CUTTING_TIME_NEEDED, 10, 240); + tree_cutter_requires_power = builder + .translation(MODID + ".config.tree_cutter_requires_power") + .comment("Defines if the Small Tree Cutter does not work without RF power.") + .define("tree_cutter_requires_power", false); + milking_machine_energy_consumption = builder + .translation(MODID + ".config.milking_machine_energy_consumption") + .comment("Defines how much time the Small Milking Machine needs work. " + + "Note this is a permanent standby power, not only when the device does something. " + + "Use zero to disable energy dependency and energy handling of the machine. " + + "The config value can be changed on-the-fly for tuning.") + .defineInRange("milking_machine_energy_consumption", EdMilker.MilkerTileEntity.DEFAULT_ENERGY_CONSUMPTION, 0, 1024); + milking_machine_milking_delay = builder + .translation(MODID + ".config.milking_machine_milking_delay") + .comment("Defines (for each individual cow) the minimum time between milking." ) + .defineInRange("milking_machine_milking_delay", EdMilker.MilkerTileEntity.DEFAULT_MILKING_DELAY_PER_COW, 1000, 24000); + builder.pop(); + } + } + } + + //-------------------------------------------------------------------------------------------------------------------- + // Optout checks + //-------------------------------------------------------------------------------------------------------------------- + + public static final boolean isOptedOut(final @Nullable Block block) + { return isOptedOut(block.asItem()); } + + public static final boolean isOptedOut(final @Nullable Item item) + { return (item!=null) && optouts_.contains(item.getRegistryName().getPath()); } + + public static boolean withExperimental() + { return with_experimental_features_; } + + public static boolean withoutRecipes() + { return false; } + + public static boolean withDebug() + { return with_debug_logs_; } + + //-------------------------------------------------------------------------------------------------------------------- + // Cache + //-------------------------------------------------------------------------------------------------------------------- + + private static final CompoundNBT server_config_ = new CompoundNBT(); + private static HashSet optouts_ = new HashSet<>(); + private static boolean with_experimental_features_ = false; + private static boolean with_config_logging_ = false; + private static boolean with_debug_logs_ = false; + public static boolean immersiveengineering_installed = false; + public static boolean without_direct_slab_pickup = false; + public static boolean with_creative_mode_device_drops = false; + + public static final CompoundNBT getServerConfig() // config that may be synchronized from server to client via net pkg. + { return server_config_; } + + private static final void updateOptouts() + { + final ArrayList includes = new ArrayList<>(); + final ArrayList excludes = new ArrayList<>(); + { + String inc = COMMON.pattern_includes.get().toLowerCase().replaceAll(MODID+":", "").replaceAll("[^*_,a-z0-9]", ""); + if(COMMON.pattern_includes.get() != inc) COMMON.pattern_includes.set(inc); + String[] incl = inc.split(","); + for(int i=0; i< incl.length; ++i) { + incl[i] = incl[i].replaceAll("[*]", ".*?"); + if(!incl[i].isEmpty()) includes.add(incl[i]); + } + } + { + String exc = COMMON.pattern_excludes.get().toLowerCase().replaceAll(MODID+":", "").replaceAll("[^*_,a-z0-9]", ""); + String[] excl = exc.split(","); + for(int i=0; i< excl.length; ++i) { + excl[i] = excl[i].replaceAll("[*]", ".*?"); + if(!excl[i].isEmpty()) excludes.add(excl[i]); + } + } + if(SERVER_CONFIG_SPEC.isLoaded()) { + /// @todo: remove for MC1.17/1.16.5 + String inc = SERVER.pattern_includes.get().toLowerCase().replaceAll(MODID+":", "").replaceAll("[^*_,a-z0-9]", ""); + String[] incl = inc.split(","); + for(int i=0; i< incl.length; ++i) { + incl[i] = incl[i].replaceAll("[*]", ".*?"); + if(!incl[i].isEmpty()) includes.add(incl[i]); + } + } + if(SERVER_CONFIG_SPEC.isLoaded()) { + /// @todo: remove for MC1.17/1.16.5 + String exc = SERVER.pattern_excludes.get().toLowerCase().replaceAll(MODID+":", "").replaceAll("[^*_,a-z0-9]", ""); + String[] excl = exc.split(","); + for(int i=0; i< excl.length; ++i) { + excl[i] = excl[i].replaceAll("[*]", ".*?"); + if(!excl[i].isEmpty()) excludes.add(excl[i]); + } + } + if(!excludes.isEmpty()) log("Config pattern excludes: '" + String.join(",", excludes) + "'"); + if(!includes.isEmpty()) log("Config pattern includes: '" + String.join(",", includes) + "'"); + { + HashSet optouts = new HashSet<>(); + ModContent.getRegisteredItems().stream().filter((item)->(item!=null)).forEach( + e -> optouts.add(e.getRegistryName().getPath()) + ); + ModContent.getRegisteredBlocks().stream().filter((Block block) -> { + if(block==null) return true; + if(block==ModContent.SIGN_MODLOGO) return true; + try { + if(!with_experimental_features_) { + if(block instanceof Auxiliaries.IExperimentalFeature) return true; + if(ModContent.isExperimentalBlock(block)) return true; + } + // Hard IE dependent blocks + if(!immersiveengineering_installed) { + if((block instanceof IDecorBlock) && ((((IDecorBlock)block).config() & DecorBlock.CFG_HARD_IE_DEPENDENT)!=0)) return true; + if((block instanceof DecorBlock.Normal) && ((((DecorBlock.Normal)block).config & DecorBlock.CFG_HARD_IE_DEPENDENT)!=0)) return true; + if((block instanceof StandardBlocks.BaseBlock) && ((((StandardBlocks.BaseBlock)block).config & DecorBlock.CFG_HARD_IE_DEPENDENT)!=0)) return true; + } + // Force-include/exclude pattern matching + final String rn = block.getRegistryName().getPath(); + try { + for(String e : includes) { + if(rn.matches(e)) { + log("Optout force include: "+rn); + return false; + } + } + for(String e : excludes) { + if(rn.matches(e)) { + log("Optout force exclude: "+rn); + return true; + } + } + } catch(Throwable ex) { + LOGGER.error("optout include pattern failed, disabling."); + includes.clear(); + excludes.clear(); + } + // Early non-opt out type based evaluation + if(SERVER==null) return false; + if(block instanceof EdCraftingTable.CraftingTableBlock) return SERVER.without_crafting_table.get(); + if(block instanceof EdElectricalFurnace.ElectricalFurnaceBlock) return SERVER.without_electrical_furnace.get(); + if((block instanceof EdFurnace.FurnaceBlock)&&(!(block instanceof EdElectricalFurnace.ElectricalFurnaceBlock))) return SERVER.without_lab_furnace.get(); + if(block instanceof EdWasteIncinerator.WasteIncineratorBlock) return SERVER.without_waste_incinerator.get(); + if(block instanceof EdDropper.DropperBlock) return SERVER.without_factory_dropper.get(); + if(block instanceof EdPlacer.PlacerBlock) return SERVER.without_factory_placer.get(); + if(block instanceof EdBreaker.BreakerBlock) return SERVER.without_block_breaker.get(); + if(block instanceof EdSlabSliceBlock) return SERVER.without_halfslabs.get(); + if(block instanceof EdLadderBlock) return SERVER.without_ladders.get(); + if(block instanceof EdWindowBlock) return SERVER.without_windows.get(); + if(block instanceof EdPipeValve.PipeValveBlock) return SERVER.without_valves.get(); + if(block instanceof EdHorizontalSupportBlock) return SERVER.without_hsupports.get(); + if(block instanceof EdFloorGratingBlock) return SERVER.without_floor_grating.get(); + if(block instanceof EdHopper.HopperBlock) return SERVER.without_factory_hopper.get(); + if(block instanceof EdFluidFunnel.FluidFunnelBlock) return SERVER.without_fluid_funnel.get(); + if(block instanceof EdSolarPanel.SolarPanelBlock) return SERVER.without_solar_panel.get(); + if(block instanceof EdMineralSmelter.MineralSmelterBlock) return SERVER.without_mineral_smelter.get(); + if(block instanceof EdMilker.MilkerBlock) return SERVER.without_milking_machine.get(); + if(block instanceof EdTreeCutter.TreeCutterBlock) return SERVER.without_tree_cutter.get(); + if(block instanceof EdLabeledCrate.LabeledCrateBlock) return SERVER.without_labeled_crate.get(); + // Type based evaluation where later filters may match, too + if(SERVER.without_slabs.get()&&(block instanceof EdSlabBlock)) return true; + if(SERVER.without_stairs.get()&&(block instanceof EdStairsBlock)) return true; + if(SERVER.without_walls.get()&&(block instanceof EdWallBlock)) return true; + if(SERVER.without_poles.get()&&(block instanceof EdStraightPoleBlock)) return true; + // String matching based evaluation + if(SERVER.without_clinker_bricks.get()&&(rn.startsWith("clinker_brick_"))) return true; + if(SERVER.without_slag_bricks.get()&&rn.startsWith("slag_brick_")) return true; + if(SERVER.without_rebar_concrete.get()&&rn.startsWith("rebar_concrete")) return true; + if(SERVER.without_gas_concrete.get()&&rn.startsWith("gas_concrete")) return true; + if(SERVER.without_panzer_glass.get()&&rn.startsWith("panzerglass_")) return true; + if(SERVER.without_light_sources.get()&&rn.endsWith("_light")) return true; + if(SERVER.without_sign_plates.get()&&rn.startsWith("sign_")) return true; + if(SERVER.without_treated_wood_furniture.get()) { + if(block instanceof EdChair.ChairBlock) return true; + if(rn.equals("treated_wood_table")) return true; + if(rn.equals("treated_wood_stool")) return true; + if(rn.equals("treated_wood_windowsill")) return true; + if(rn.equals("treated_wood_broad_windowsill")) return true; + if(rn.equals("treated_wood_side_table")) return true; + } + if(SERVER.without_metal_furniture.get()) { + if(rn.equals("steel_table")) return true; + } + if(SERVER.without_fences.get()) { + if(block instanceof EdFenceBlock) return true; + if(block instanceof EdDoubleGateBlock) return true; + } + } catch(Exception ex) { + LOGGER.error("Exception evaluating the optout config: '"+ex.getMessage()+"'"); + } + return false; + }).forEach( + e -> optouts.add(e.getRegistryName().getPath()) + ); + optouts_ = optouts; + } + OptionalRecipeCondition.on_config(withExperimental(), withoutRecipes(), ModConfig::isOptedOut, ModConfig::isOptedOut); + } + + public static final void apply() + { + with_config_logging_ = COMMON.with_config_logging.get(); + with_experimental_features_ = COMMON.with_experimental.get(); + with_debug_logs_ = COMMON.with_debug_logging.get(); + if(with_experimental_features_) LOGGER.info("Config: EXPERIMENTAL FEATURES ENABLED."); + if(with_debug_logs_) LOGGER.info("Config: DEBUG LOGGING ENABLED, WARNING, THIS MAY SPAM THE LOG."); + immersiveengineering_installed = Auxiliaries.isModLoaded("immersiveengineering"); + updateOptouts(); + if(!SERVER_CONFIG_SPEC.isLoaded()) return; + without_direct_slab_pickup = SERVER.without_direct_slab_pickup.get(); + // ----------------------------------------------------------------------------------------------------------------- + EdChair.on_config(SERVER.without_chair_sitting.get(), SERVER.without_mob_chair_sitting.get(), SERVER.chair_mob_sitting_probability_percent.get(), SERVER.chair_mob_standup_probability_percent.get()); + EdLadderBlock.on_config(SERVER.without_ladder_speed_boost.get()); + EdSlabBlock.on_config(!SERVER.without_direct_slab_pickup.get()); + EdSlabSliceBlock.on_config(!SERVER.without_direct_slab_pickup.get()); + EdLabeledCrate.on_config(false); + EdCraftingTable.on_config(SERVER.without_crafting_table_history.get(), false, SERVER.without_crafting_mouse_scrolling.get()); + EdFluidBarrel.on_config(12000, 1000); + EdFluidFunnel.on_config(with_experimental_features_); + EdPipeValve.on_config(SERVER.pipevalve_max_flowrate.get(), SERVER.pipevalve_redstone_gain.get()); + EdHopper.on_config(); + EdDropper.on_config(true); + EdPlacer.on_config(); + EdBreaker.on_config(SERVER.block_breaker_power_consumption.get(), SERVER.block_breaker_reluctance.get(), SERVER.block_breaker_min_breaking_time.get(), SERVER.block_breaker_requires_power.get()); + EdTreeCutter.on_config(SERVER.tree_cutter_energy_consumption.get(), SERVER.tree_cutter_cutting_time_needed.get(), SERVER.tree_cutter_requires_power.get()); + EdFurnace.on_config(SERVER.furnace_smelting_speed_percent.get(), SERVER.furnace_fuel_efficiency_percent.get(), SERVER.furnace_boost_energy_consumption.get(), SERVER.furnace_accepted_heaters.get()); + EdElectricalFurnace.on_config(SERVER.e_furnace_speed_percent.get(), SERVER.e_furnace_power_consumption.get(), SERVER.e_furnace_automatic_pulling.get()); + EdSolarPanel.on_config(SERVER.small_solar_panel_peak_production.get()); + EdMilker.on_config(SERVER.milking_machine_energy_consumption.get(), SERVER.milking_machine_milking_delay.get()); + EdFreezer.on_config(92, 2); + EdMineralSmelter.on_config(92, 2); + EdWasteIncinerator.on_config(8); + // ----------------------------------------------------------------------------------------------------------------- + { + // Check if the config is already synchronized or has to be synchronised. + server_config_.putBoolean("tree_cutter_requires_power", SERVER.tree_cutter_requires_power.get()); + server_config_.putBoolean("block_breaker_requires_power", SERVER.block_breaker_requires_power.get()); + { + String s = String.join(",", optouts_); + server_config_.putString("optout", s); + if(!s.isEmpty()) log("Opt-outs:" + s); + } + } + } + + public static final void log(String config_message) + { + if(!with_config_logging_) return; + LOGGER.info(config_message); + } + +} diff --git a/src/main/java/wile/engineersdecor/ModContent.java b/src/main/java/wile/engineersdecor/ModContent.java index 659116d..13e1910 100644 --- a/src/main/java/wile/engineersdecor/ModContent.java +++ b/src/main/java/wile/engineersdecor/ModContent.java @@ -1,1468 +1,1470 @@ -/* - * @file ModContent.java - * @author Stefan Wilhelm (wile) - * @copyright (C) 2020 Stefan Wilhelm - * @license MIT (see https://opensource.org/licenses/MIT) - * - * Definition and initialisation of blocks of this - * module, along with their tile entities if applicable. - * - * Note: Straight forward definition of different blocks/entities - * to make recipes, models and texture definitions easier. - */ -package wile.engineersdecor; - -import net.minecraft.block.BlockState; -import net.minecraft.util.SoundEvents; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.shapes.IBooleanFunction; -import net.minecraft.world.IBlockReader; -import net.minecraft.block.material.MaterialColor; -import net.minecraft.block.Block; -import net.minecraft.block.SoundType; -import net.minecraft.block.material.Material; -import net.minecraft.tileentity.TileEntityType; -import net.minecraft.item.Item; -import net.minecraft.item.BlockItem; -import net.minecraft.entity.EntityClassification; -import net.minecraft.entity.EntityType; -import net.minecraft.inventory.container.ContainerType; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.Direction; -import net.minecraft.util.math.AxisAlignedBB; -import net.minecraft.util.math.shapes.VoxelShape; -import net.minecraft.util.math.shapes.VoxelShapes; -import net.minecraft.client.renderer.RenderType; -import net.minecraft.client.renderer.RenderTypeLookup; -import net.minecraft.client.gui.ScreenManager; -import net.minecraftforge.common.ToolType; -import net.minecraftforge.event.RegistryEvent; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; -import net.minecraftforge.fml.client.registry.RenderingRegistry; -import net.minecraftforge.fml.client.registry.ClientRegistry; -import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent; -import org.apache.commons.lang3.ArrayUtils; -import wile.engineersdecor.blocks.*; -import wile.engineersdecor.blocks.EdFurnace.FurnaceBlock; -import wile.engineersdecor.blocks.EdFurnace.FurnaceContainer; -import wile.engineersdecor.blocks.EdFurnace.FurnaceGui; -import wile.engineersdecor.blocks.EdFurnace.FurnaceTileEntity; -import wile.engineersdecor.items.EdItem; -import wile.engineersdecor.libmc.blocks.StandardBlocks; -import wile.engineersdecor.libmc.blocks.StandardBlocks.IStandardBlock; -import wile.engineersdecor.libmc.detail.Auxiliaries; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.stream.Collectors; -import java.util.Collections; -import javax.annotation.Nonnull; - - -@SuppressWarnings("unused") -public class ModContent -{ - private static final String MODID = ModEngineersDecor.MODID; - - //-------------------------------------------------------------------------------------------------------------------- - - private static Boolean disallowSpawn(BlockState state, IBlockReader reader, BlockPos pos, EntityType entity) { return false; } - - //-------------------------------------------------------------------------------------------------------------------- - // Blocks - //-------------------------------------------------------------------------------------------------------------------- - - public static final DecorBlock.Normal CLINKER_BRICK_BLOCK = (DecorBlock.Normal)(new DecorBlock.Normal( - DecorBlock.CFG_DEFAULT, - Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(3f, 10f).sound(SoundType.STONE) - )).setRegistryName(new ResourceLocation(MODID, "clinker_brick_block")); - - public static final EdSlabBlock CLINKER_BRICK_SLAB = (EdSlabBlock)(new EdSlabBlock( - DecorBlock.CFG_DEFAULT, - Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(3f, 10f).sound(SoundType.STONE) - )).setRegistryName(new ResourceLocation(MODID, "clinker_brick_slab")); - - public static final EdStairsBlock CLINKER_BRICK_STAIRS = (EdStairsBlock)(new EdStairsBlock( - DecorBlock.CFG_DEFAULT, - CLINKER_BRICK_BLOCK.getDefaultState(), - Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(3f, 10f).sound(SoundType.STONE) - )).setRegistryName(new ResourceLocation(MODID, "clinker_brick_stairs")); - - public static final EdWallBlock CLINKER_BRICK_WALL = (EdWallBlock)(new EdWallBlock( - DecorBlock.CFG_DEFAULT, - Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(3f, 10f).sound(SoundType.STONE) - )).setRegistryName(new ResourceLocation(MODID, "clinker_brick_wall")); - - public static final DecorBlock.Normal CLINKER_BRICK_STAINED_BLOCK = (DecorBlock.Normal)(new DecorBlock.Normal( - DecorBlock.CFG_DEFAULT, - Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(3f, 10f).sound(SoundType.STONE) - )).setRegistryName(new ResourceLocation(MODID, "clinker_brick_stained_block")); - - public static final EdSlabBlock CLINKER_BRICK_STAINED_SLAB = (EdSlabBlock)(new EdSlabBlock( - DecorBlock.CFG_DEFAULT, - Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(3f, 10f).sound(SoundType.STONE) - )).setRegistryName(new ResourceLocation(MODID, "clinker_brick_stained_slab")); - - public static final EdStairsBlock CLINKER_BRICK_STAINED_STAIRS = (EdStairsBlock)(new EdStairsBlock( - DecorBlock.CFG_DEFAULT, - CLINKER_BRICK_BLOCK.getDefaultState(), - Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(3f, 10f).sound(SoundType.STONE) - )).setRegistryName(new ResourceLocation(MODID, "clinker_brick_stained_stairs")); - - public static final EdCornerOrnamentedBlock CLINKER_BRICK_SASTOR_CORNER = (EdCornerOrnamentedBlock)(new EdCornerOrnamentedBlock( - DecorBlock.CFG_DEFAULT, - Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(3f, 10f).sound(SoundType.STONE), - new Block[]{CLINKER_BRICK_BLOCK, CLINKER_BRICK_STAINED_BLOCK, CLINKER_BRICK_SLAB, CLINKER_BRICK_STAIRS, CLINKER_BRICK_STAINED_SLAB, CLINKER_BRICK_STAINED_STAIRS} - )).setRegistryName(new ResourceLocation(MODID, "clinker_brick_sastor_corner_block")); - - public static final DecorBlock.HorizontalWaterLoggable CLINKER_BRICK_RECESSED = (DecorBlock.HorizontalWaterLoggable)(new DecorBlock.HorizontalWaterLoggable( - DecorBlock.CFG_CUTOUT|DecorBlock.CFG_HORIZIONTAL|DecorBlock.CFG_LOOK_PLACEMENT, - Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(3f, 10f).sound(SoundType.STONE), - new AxisAlignedBB[] { - Auxiliaries.getPixeledAABB( 3,0, 0, 13,16, 1), - Auxiliaries.getPixeledAABB( 0,0, 1, 16,16,11), - Auxiliaries.getPixeledAABB( 4,0,11, 12,16,13) - } - )).setRegistryName(new ResourceLocation(MODID, "clinker_brick_recessed")); - - public static final DecorBlock.HorizontalWaterLoggable CLINKER_BRICK_SASTOR_VERTICAL_SLOTTED = (DecorBlock.HorizontalWaterLoggable)(new DecorBlock.HorizontalWaterLoggable( - DecorBlock.CFG_CUTOUT|DecorBlock.CFG_HORIZIONTAL|DecorBlock.CFG_LOOK_PLACEMENT, - Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(3f, 10f).sound(SoundType.STONE), - new AxisAlignedBB[] { - Auxiliaries.getPixeledAABB( 3,0, 0, 13,16, 1), - Auxiliaries.getPixeledAABB( 3,0,15, 13,16,16), - Auxiliaries.getPixeledAABB( 0,0, 1, 16,16,15) - } - )).setRegistryName(new ResourceLocation(MODID, "clinker_brick_vertically_slit")); - - public static final DecorBlock.HorizontalWaterLoggable CLINKER_BRICK_VERTICAL_SLAB_STRUCTURED = (DecorBlock.HorizontalWaterLoggable)(new DecorBlock.HorizontalWaterLoggable( - DecorBlock.CFG_CUTOUT|DecorBlock.CFG_HORIZIONTAL|DecorBlock.CFG_LOOK_PLACEMENT, - Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(3f, 10f).sound(SoundType.STONE), - new AxisAlignedBB[] { - Auxiliaries.getPixeledAABB( 0,0, 0, 16,16, 8), - } - )).setRegistryName(new ResourceLocation(MODID, "clinker_brick_vertical_slab_structured")); - - // ------------------------------------------------------------------------------------------------------------------- - - public static final DecorBlock.Normal SLAG_BRICK_BLOCK = (DecorBlock.Normal)(new DecorBlock.Normal( - DecorBlock.CFG_DEFAULT, - Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(3f, 10f).sound(SoundType.STONE) - )).setRegistryName(new ResourceLocation(MODID, "slag_brick_block")); - - public static final EdSlabBlock SLAG_BRICK_SLAB = (EdSlabBlock)(new EdSlabBlock( - DecorBlock.CFG_DEFAULT, - Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(3f, 10f).sound(SoundType.STONE) - )).setRegistryName(new ResourceLocation(MODID, "slag_brick_slab")); - - public static final EdStairsBlock SLAG_BRICK_STAIRS = (EdStairsBlock)(new EdStairsBlock( - DecorBlock.CFG_DEFAULT, - SLAG_BRICK_BLOCK.getDefaultState(), - Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(3f, 10f).sound(SoundType.STONE) - )).setRegistryName(new ResourceLocation(MODID, "slag_brick_stairs")); - - public static final EdWallBlock SLAG_BRICK_WALL = (EdWallBlock)(new EdWallBlock( - DecorBlock.CFG_DEFAULT, - Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(3f, 10f).sound(SoundType.STONE) - )).setRegistryName(new ResourceLocation(MODID, "slag_brick_wall")); - - // ------------------------------------------------------------------------------------------------------------------- - - public static final DecorBlock.Normal REBAR_CONCRETE_BLOCK = (DecorBlock.Normal)(new DecorBlock.Normal( - DecorBlock.CFG_DEFAULT, - Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(5f, 2000f).sound(SoundType.STONE).setAllowsSpawn(ModContent::disallowSpawn) - )).setRegistryName(new ResourceLocation(MODID, "rebar_concrete")); - - public static final EdSlabBlock REBAR_CONCRETE_SLAB = (EdSlabBlock)(new EdSlabBlock( - DecorBlock.CFG_DEFAULT, - Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(5f, 2000f).sound(SoundType.STONE).setAllowsSpawn(ModContent::disallowSpawn) - )).setRegistryName(new ResourceLocation(MODID, "rebar_concrete_slab")); - - public static final EdStairsBlock REBAR_CONCRETE_STAIRS = (EdStairsBlock)(new EdStairsBlock( - DecorBlock.CFG_DEFAULT, - REBAR_CONCRETE_BLOCK.getDefaultState(), - Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(5f, 2000f).sound(SoundType.STONE).setAllowsSpawn(ModContent::disallowSpawn) - )).setRegistryName(new ResourceLocation(MODID, "rebar_concrete_stairs")); - - public static final EdWallBlock REBAR_CONCRETE_WALL = (EdWallBlock)(new EdWallBlock( - DecorBlock.CFG_DEFAULT, - Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(5f, 2000f).sound(SoundType.STONE).setAllowsSpawn(ModContent::disallowSpawn) - )).setRegistryName(new ResourceLocation(MODID, "rebar_concrete_wall")); - - public static final EdSlabSliceBlock HALFSLAB_REBARCONCRETE = (EdSlabSliceBlock)(new EdSlabSliceBlock( - DecorBlock.CFG_CUTOUT, - Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(5f, 2000f).sound(SoundType.STONE).setAllowsSpawn(ModContent::disallowSpawn) - )).setRegistryName(new ResourceLocation(MODID, "halfslab_rebar_concrete")); - - // ------------------------------------------------------------------------------------------------------------------- - - public static final DecorBlock.Normal GAS_CONCRETE_BLOCK = (DecorBlock.Normal)(new DecorBlock.Normal( - DecorBlock.CFG_DEFAULT, - Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(1.5f, 10f).sound(SoundType.STONE).setAllowsSpawn(ModContent::disallowSpawn) - )).setRegistryName(new ResourceLocation(MODID, "gas_concrete")); - - public static final EdSlabBlock GAS_CONCRETE_SLAB = (EdSlabBlock)(new EdSlabBlock( - DecorBlock.CFG_DEFAULT, - Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(1.5f, 10f).sound(SoundType.STONE).setAllowsSpawn(ModContent::disallowSpawn) - )).setRegistryName(new ResourceLocation(MODID, "gas_concrete_slab")); - - public static final EdStairsBlock GAS_CONCRETE_STAIRS = (EdStairsBlock)(new EdStairsBlock( - DecorBlock.CFG_DEFAULT, - REBAR_CONCRETE_BLOCK.getDefaultState(), - Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(1.5f, 10f).sound(SoundType.STONE).setAllowsSpawn(ModContent::disallowSpawn) - )).setRegistryName(new ResourceLocation(MODID, "gas_concrete_stairs")); - - public static final EdWallBlock GAS_CONCRETE_WALL = (EdWallBlock)(new EdWallBlock( - DecorBlock.CFG_DEFAULT, - Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(1.5f, 10f).sound(SoundType.STONE).setAllowsSpawn(ModContent::disallowSpawn) - )).setRegistryName(new ResourceLocation(MODID, "gas_concrete_wall")); - - public static final EdSlabSliceBlock HALFSLAB_GASCONCRETE = (EdSlabSliceBlock)(new EdSlabSliceBlock( - DecorBlock.CFG_CUTOUT, - Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(1.5f, 10f).sound(SoundType.STONE).setAllowsSpawn(ModContent::disallowSpawn) - )).setRegistryName(new ResourceLocation(MODID, "halfslab_gas_concrete")); - - // ------------------------------------------------------------------------------------------------------------------- - - public static final DecorBlock.Normal REBAR_CONCRETE_TILE = (DecorBlock.Normal)(new DecorBlock.Normal( - DecorBlock.CFG_DEFAULT, - Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(5f, 2000f).sound(SoundType.STONE).setAllowsSpawn(ModContent::disallowSpawn) - )).setRegistryName(new ResourceLocation(MODID, "rebar_concrete_tile")); - - public static final EdSlabBlock REBAR_CONCRETE_TILE_SLAB = (EdSlabBlock)(new EdSlabBlock( - DecorBlock.CFG_DEFAULT, - Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(5f, 2000f).sound(SoundType.STONE).setAllowsSpawn(ModContent::disallowSpawn) - )).setRegistryName(new ResourceLocation(MODID, "rebar_concrete_tile_slab")); - - public static final EdStairsBlock REBAR_CONCRETE_TILE_STAIRS = (EdStairsBlock)(new EdStairsBlock( - DecorBlock.CFG_DEFAULT, - REBAR_CONCRETE_TILE.getDefaultState(), - Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(5f, 2000f).sound(SoundType.STONE).setAllowsSpawn(ModContent::disallowSpawn) - )).setRegistryName(new ResourceLocation(MODID, "rebar_concrete_tile_stairs")); - - // ------------------------------------------------------------------------------------------------------------------- - - public static final EdGlassBlock PANZERGLASS_BLOCK = (EdGlassBlock)(new EdGlassBlock( - DecorBlock.CFG_TRANSLUCENT, - Block.Properties.create(Material.GLASS, MaterialColor.AIR).hardnessAndResistance(0.7f, 2000f).sound(SoundType.METAL).notSolid().setAllowsSpawn(ModContent::disallowSpawn) - )).setRegistryName(new ResourceLocation(MODID, "panzerglass_block")); - - public static final EdSlabBlock PANZERGLASS_SLAB = (EdSlabBlock)(new EdSlabBlock( - DecorBlock.CFG_TRANSLUCENT, - Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(0.7f, 2000f).sound(SoundType.METAL).notSolid().setAllowsSpawn(ModContent::disallowSpawn) - )).setRegistryName(new ResourceLocation(MODID, "panzerglass_slab")); - - // ------------------------------------------------------------------------------------------------------------------- - - public static final EdRoofBlock DARK_CERAMIC_SHINGLE_ROOF = (EdRoofBlock)(new EdRoofBlock( - DecorBlock.CFG_CUTOUT, - Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(2f, 6f).sound(SoundType.STONE).notSolid().variableOpacity().setAllowsSpawn(ModContent::disallowSpawn) - )).setRegistryName(new ResourceLocation(MODID, "dark_shingle_roof")); - - public static final EdRoofBlock DARK_CERAMIC_SHINGLE_ROOF_METALIZED = (EdRoofBlock)(new EdRoofBlock( - DecorBlock.CFG_CUTOUT, - Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(2f, 6f).sound(SoundType.STONE).notSolid().variableOpacity().setAllowsSpawn(ModContent::disallowSpawn) - )).setRegistryName(new ResourceLocation(MODID, "dark_shingle_roof_metallized")); - - public static final EdRoofBlock DARK_CERAMIC_SHINGLE_ROOF_SKYLIGHT = (EdRoofBlock)(new EdRoofBlock( - DecorBlock.CFG_TRANSLUCENT, - Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(2f, 6f).sound(SoundType.STONE).notSolid().variableOpacity().setAllowsSpawn(ModContent::disallowSpawn) - )).setRegistryName(new ResourceLocation(MODID, "dark_shingle_roof_skylight")); - - public static final EdChimneyTrunkBlock DARK_CERAMIC_SHINGLE_ROOF_CHIMNEYTRUNK = (EdChimneyTrunkBlock)(new EdChimneyTrunkBlock( - DecorBlock.CFG_CUTOUT, - Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(2f, 6f).sound(SoundType.STONE).notSolid().variableOpacity().setAllowsSpawn(ModContent::disallowSpawn), - VoxelShapes.create(Auxiliaries.getPixeledAABB(3, 0, 3, 13, 16, 13)), - VoxelShapes.create(Auxiliaries.getPixeledAABB(5, 0, 5, 11, 16, 11)) - )).setRegistryName(new ResourceLocation(MODID, "dark_shingle_roof_chimneytrunk")); - - public static final EdChimneyTrunkBlock DARK_CERAMIC_SHINGLE_ROOF_WIRECONDUIT = (EdChimneyTrunkBlock)(new EdChimneyTrunkBlock( - DecorBlock.CFG_CUTOUT, - Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(2f, 6f).sound(SoundType.STONE).notSolid().variableOpacity().setAllowsSpawn(ModContent::disallowSpawn), - VoxelShapes.combineAndSimplify( - VoxelShapes.create(Auxiliaries.getPixeledAABB(3, 0, 3, 13, 13, 13)), - VoxelShapes.create(Auxiliaries.getPixeledAABB(5, 13, 5, 11, 16, 11)), - IBooleanFunction.OR - ), - VoxelShapes.combineAndSimplify( - VoxelShapes.create(Auxiliaries.getPixeledAABB(5, 0, 5, 11, 15, 11)), - VoxelShapes.create(Auxiliaries.getPixeledAABB(7, 15, 7, 9, 16, 9)), - IBooleanFunction.OR - ) - )).setRegistryName(new ResourceLocation(MODID, "dark_shingle_roof_wireconduit")); - - public static final EdChimneyBlock DARK_CERAMIC_SHINGLE_ROOF_CHIMNEY = (EdChimneyBlock)(new EdChimneyBlock( - DecorBlock.CFG_CUTOUT|DecorBlock.CFG_AI_PASSABLE, - Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(5f, 6f).sound(SoundType.STONE).variableOpacity().setAllowsSpawn(ModContent::disallowSpawn), - Auxiliaries.getPixeledAABB(3, 0, 3, 13, 6, 13) - )).setRegistryName(new ResourceLocation(MODID, "dark_shingle_roof_chimney")); - - public static final DecorBlock.Normal DARK_CERAMIC_SHINGLE_ROOF_BLOCK = (DecorBlock.Normal)(new DecorBlock.Normal( - DecorBlock.CFG_DEFAULT, - Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(2f, 6f).sound(SoundType.STONE) - )).setRegistryName(new ResourceLocation(MODID, "dark_shingle_roof_block")); - - public static final EdSlabBlock DARK_CERAMIC_SHINGLE_ROOF_SLAB = (EdSlabBlock)(new EdSlabBlock( - DecorBlock.CFG_DEFAULT, - Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(2f, 6f).sound(SoundType.STONE) - )).setRegistryName(new ResourceLocation(MODID, "dark_shingle_roof_slab")); - - // ------------------------------------------------------------------------------------------------------------------- - - public static final EdGroundBlock DENSE_GRIT_SAND = (EdGroundBlock)(new EdGroundBlock( - DecorBlock.CFG_DEFAULT, - Block.Properties.create(Material.EARTH, MaterialColor.DIRT).hardnessAndResistance(0.5f, 3f).sound(SoundType.GROUND).harvestTool(ToolType.SHOVEL) - )).setRegistryName(new ResourceLocation(MODID, "dense_grit_sand_block")); - - public static final EdGroundBlock DENSE_GRIT_DIRT = (EdGroundBlock)(new EdGroundBlock( - DecorBlock.CFG_DEFAULT, - Block.Properties.create(Material.EARTH, MaterialColor.DIRT).hardnessAndResistance(0.5f, 3f).sound(SoundType.GROUND).harvestTool(ToolType.SHOVEL) - )).setRegistryName(new ResourceLocation(MODID, "dense_grit_dirt_block")); - - public static final EdSlabSliceBlock HALFSLAB_DARK_CERAMIC_SHINGLE_ROOF = (EdSlabSliceBlock)(new EdSlabSliceBlock( - DecorBlock.CFG_DEFAULT, - Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(2f, 15f).sound(SoundType.STONE) - )).setRegistryName(new ResourceLocation(MODID, "dark_shingle_roof_slabslice")); - - // ------------------------------------------------------------------------------------------------------------------- - - public static final EdLadderBlock METAL_RUNG_LADDER = (EdLadderBlock)(new EdLadderBlock( - DecorBlock.CFG_DEFAULT, - Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(1.0f, 8f).sound(SoundType.METAL).notSolid() - )).setRegistryName(new ResourceLocation(MODID, "metal_rung_ladder")); - - public static final EdLadderBlock METAL_RUNG_STEPS = (EdLadderBlock)(new EdLadderBlock( - DecorBlock.CFG_DEFAULT, - Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(1.0f, 8f).sound(SoundType.METAL).notSolid() - )).setRegistryName(new ResourceLocation(MODID, "metal_rung_steps")); - - public static final EdLadderBlock TREATED_WOOD_LADDER = (EdLadderBlock)(new EdLadderBlock( - DecorBlock.CFG_DEFAULT, - Block.Properties.create(Material.WOOD, MaterialColor.WOOD).hardnessAndResistance(1.0f, 8f).sound(SoundType.WOOD).notSolid() - )).setRegistryName(new ResourceLocation(MODID, "treated_wood_ladder")); - - public static final EdHatchBlock IRON_HATCH = (EdHatchBlock)(new EdHatchBlock( - DecorBlock.CFG_LOOK_PLACEMENT, - Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 2000f).sound(SoundType.METAL).notSolid(), - Auxiliaries.getPixeledAABB(0.5,1,0, 15.5,3,14), - Auxiliaries.getPixeledAABB(0.5,1,0, 15.5,14.,2) - )).setRegistryName(new ResourceLocation(MODID, "iron_hatch")); - - public static final EdDoorBlock METAL_SLIDING_DOOR = (EdDoorBlock)(new EdDoorBlock( - DecorBlock.CFG_TRANSLUCENT|DecorBlock.CFG_HORIZIONTAL, - Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(1.5f, 8f).sound(SoundType.METAL).notSolid(), - new AxisAlignedBB[]{ - Auxiliaries.getPixeledAABB(15, 0.0,6, 16,16.0,10), - Auxiliaries.getPixeledAABB( 0,15.5,6, 16,16.0,10), - }, - new AxisAlignedBB[]{ - Auxiliaries.getPixeledAABB(15, 0.0,6, 16,16.0,10), - Auxiliaries.getPixeledAABB( 0, 0.0,6, 16, 0.3,10), - }, - new AxisAlignedBB[]{ - Auxiliaries.getPixeledAABB( 0,0,7, 16,16,9) - }, - new AxisAlignedBB[]{ - Auxiliaries.getPixeledAABB( 0,0,7, 16,16,9) - }, - SoundEvents.BLOCK_IRON_DOOR_OPEN, SoundEvents.BLOCK_IRON_DOOR_CLOSE - )).setRegistryName(new ResourceLocation(MODID, "metal_sliding_door")); - - // ------------------------------------------------------------------------------------------------------------------- - - public static final DecorBlock.Normal OLD_INDUSTRIAL_PLANKS = (DecorBlock.Normal)(new DecorBlock.Normal( - DecorBlock.CFG_DEFAULT, - Block.Properties.create(Material.WOOD, MaterialColor.WOOD).hardnessAndResistance(1.5f, 6f).sound(SoundType.WOOD) - )).setRegistryName(new ResourceLocation(MODID, "old_industrial_wood_planks")); - - public static final EdSlabBlock OLD_INDUSTRIAL_SLAB = (EdSlabBlock)(new EdSlabBlock( - DecorBlock.CFG_DEFAULT, - Block.Properties.create(Material.WOOD, MaterialColor.WOOD).hardnessAndResistance(1.5f, 6f).sound(SoundType.WOOD) - )).setRegistryName(new ResourceLocation(MODID, "old_industrial_wood_slab")); - - public static final EdStairsBlock OLD_INDUSTRIAL_STAIRS = (EdStairsBlock)(new EdStairsBlock( - DecorBlock.CFG_DEFAULT, - OLD_INDUSTRIAL_PLANKS.getDefaultState(), - Block.Properties.create(Material.WOOD, MaterialColor.WOOD).hardnessAndResistance(1.5f, 6f).sound(SoundType.WOOD) - )).setRegistryName(new ResourceLocation(MODID, "old_industrial_wood_stairs")); - - public static final EdSlabSliceBlock OLD_INDUSTRIAL_SLABSLICE = (EdSlabSliceBlock)(new EdSlabSliceBlock( - DecorBlock.CFG_CUTOUT, - Block.Properties.create(Material.WOOD, MaterialColor.WOOD).hardnessAndResistance(1.5f, 6f).sound(SoundType.WOOD).notSolid() - )).setRegistryName(new ResourceLocation(MODID, "old_industrial_wood_slabslice")); - - public static final EdDoorBlock OLD_INDUSTRIAL_WOOD_DOOR = (EdDoorBlock)(new EdDoorBlock( - DecorBlock.CFG_DEFAULT, - Block.Properties.create(Material.WOOD, MaterialColor.WOOD).hardnessAndResistance(1.5f, 6f).sound(SoundType.WOOD).notSolid(), - Auxiliaries.getPixeledAABB(15,0, 0, 16,16,16), - Auxiliaries.getPixeledAABB( 0,0,13, 16,16,16), - SoundEvents.BLOCK_WOODEN_DOOR_OPEN, SoundEvents.BLOCK_WOODEN_DOOR_CLOSE - )).setRegistryName(new ResourceLocation(MODID, "old_industrial_wood_door")); - - // ------------------------------------------------------------------------------------------------------------------- - - public static final DecorBlock.WaterLoggable TREATED_WOOD_TABLE = (DecorBlock.WaterLoggable)(new DecorBlock.WaterLoggable( - DecorBlock.CFG_CUTOUT, - Block.Properties.create(Material.WOOD, MaterialColor.WOOD).hardnessAndResistance(2f, 5f).sound(SoundType.WOOD).notSolid(), - Auxiliaries.getPixeledAABB(1,0,1, 15,15.9,15) - )).setRegistryName(new ResourceLocation(MODID, "treated_wood_table")); - - public static final EdChair.ChairBlock TREATED_WOOD_STOOL = (EdChair.ChairBlock)(new EdChair.ChairBlock( - DecorBlock.CFG_CUTOUT|DecorBlock.CFG_HORIZIONTAL|DecorBlock.CFG_LOOK_PLACEMENT, - Block.Properties.create(Material.WOOD, MaterialColor.WOOD).hardnessAndResistance(2f, 5f).sound(SoundType.WOOD).notSolid(), - new AxisAlignedBB[]{ - Auxiliaries.getPixeledAABB(4,7,4, 12,8.8,12), - Auxiliaries.getPixeledAABB(7,0,7, 9,7,9), - Auxiliaries.getPixeledAABB(4,0,7, 12,1,9), - Auxiliaries.getPixeledAABB(7,0,4, 9,1,12), - } - )).setRegistryName(new ResourceLocation(MODID, "treated_wood_stool")); - - public static final DecorBlock.WaterLoggable TREATED_WOOD_SIDE_TABLE = (DecorBlock.WaterLoggable)(new DecorBlock.WaterLoggable( - DecorBlock.CFG_CUTOUT|DecorBlock.CFG_HORIZIONTAL|DecorBlock.CFG_LOOK_PLACEMENT, - Block.Properties.create(Material.WOOD, MaterialColor.WOOD).hardnessAndResistance(2f, 5f).sound(SoundType.WOOD).notSolid(), - new AxisAlignedBB[]{ - Auxiliaries.getPixeledAABB( 2,15, 2, 14,16,14), - Auxiliaries.getPixeledAABB( 3,15, 1, 13,16, 2), - Auxiliaries.getPixeledAABB( 3,15,14, 13,16,15), - Auxiliaries.getPixeledAABB( 1,15, 3, 2,16,13), - Auxiliaries.getPixeledAABB(14,15, 3, 15,16,13), - Auxiliaries.getPixeledAABB( 3,14, 3, 13,15,13), - Auxiliaries.getPixeledAABB( 7, 3, 7, 9,12, 9), - Auxiliaries.getPixeledAABB( 2, 0, 7, 14, 1, 9), - Auxiliaries.getPixeledAABB( 7, 0, 2, 9, 1,14) - } - )).setRegistryName(new ResourceLocation(MODID, "treated_wood_side_table")); - - public static final DecorBlock.DirectedWaterLoggable TREATED_WOOD_WINDOWSILL = (DecorBlock.DirectedWaterLoggable)(new DecorBlock.DirectedWaterLoggable( - DecorBlock.CFG_CUTOUT|DecorBlock.CFG_HORIZIONTAL|DecorBlock.CFG_FACING_PLACEMENT|DecorBlock.CFG_AI_PASSABLE, - Block.Properties.create(Material.WOOD, MaterialColor.WOOD).hardnessAndResistance(2f, 5f).sound(SoundType.WOOD).notSolid(), - Auxiliaries.getPixeledAABB(0.5,15,10.5, 15.5,16,16) - )).setRegistryName(new ResourceLocation(MODID, "treated_wood_windowsill")); - - public static final DecorBlock.DirectedWaterLoggable TREATED_WOOD_BROAD_WINDOWSILL = (DecorBlock.DirectedWaterLoggable)(new DecorBlock.DirectedWaterLoggable( - DecorBlock.CFG_CUTOUT|DecorBlock.CFG_HORIZIONTAL|DecorBlock.CFG_FACING_PLACEMENT, - Block.Properties.create(Material.WOOD, MaterialColor.WOOD).hardnessAndResistance(2f, 5f).sound(SoundType.WOOD).notSolid(), - Auxiliaries.getPixeledAABB(0,14.5,4, 16,16,16) - )).setRegistryName(new ResourceLocation(MODID, "treated_wood_broad_windowsill")); - - // ------------------------------------------------------------------------------------------------------------------- - - public static final DecorBlock.DirectedWaterLoggable INSET_LIGHT_IRON = (DecorBlock.DirectedWaterLoggable)(new DecorBlock.DirectedWaterLoggable( - DecorBlock.CFG_CUTOUT|DecorBlock.CFG_FACING_PLACEMENT|DecorBlock.CFG_OPPOSITE_PLACEMENT|DecorBlock.CFG_AI_PASSABLE, - Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 8f).sound(SoundType.METAL).setLightLevel((state)->15).notSolid(), - Auxiliaries.getPixeledAABB(5.2,5.2,0, 10.8,10.8,0.3) - )).setRegistryName(new ResourceLocation(MODID, "iron_inset_light")); - - public static final DecorBlock.DirectedWaterLoggable FLOOR_EDGE_LIGHT_IRON = (DecorBlock.DirectedWaterLoggable)(new DecorBlock.DirectedWaterLoggable( - DecorBlock.CFG_CUTOUT|DecorBlock.CFG_LOOK_PLACEMENT|DecorBlock.CFG_HORIZIONTAL|DecorBlock.CFG_AI_PASSABLE, - Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 8f).sound(SoundType.METAL).setLightLevel((state)->15).notSolid(), - Auxiliaries.getPixeledAABB(5,0,0, 11,2,0.5) - )).setRegistryName(new ResourceLocation(MODID, "iron_floor_edge_light")); - - public static final DecorBlock.DirectedWaterLoggable CEILING_EDGE_LIGHT_IRON = (DecorBlock.DirectedWaterLoggable)(new DecorBlock.DirectedWaterLoggable( - DecorBlock.CFG_CUTOUT|DecorBlock.CFG_LOOK_PLACEMENT|DecorBlock.CFG_HORIZIONTAL|DecorBlock.CFG_AI_PASSABLE, - Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 8f).sound(SoundType.METAL).setLightLevel((state)->15).notSolid(), - new AxisAlignedBB[]{ - Auxiliaries.getPixeledAABB( 0,15.5,0, 16,16,2.0), - Auxiliaries.getPixeledAABB( 0,14.0,0, 16,16,0.5), - Auxiliaries.getPixeledAABB( 0,14.0,0, 1,16,2.0), - Auxiliaries.getPixeledAABB(15,14.0,0, 16,16,2.0), - } - )).setRegistryName(new ResourceLocation(MODID, "iron_ceiling_edge_light")); - - public static final DecorBlock.DirectedWaterLoggable BULB_LIGHT_IRON = (DecorBlock.DirectedWaterLoggable)(new DecorBlock.DirectedWaterLoggable( - DecorBlock.CFG_CUTOUT|DecorBlock.CFG_FACING_PLACEMENT|DecorBlock.CFG_OPPOSITE_PLACEMENT|DecorBlock.CFG_AI_PASSABLE, - Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 8f).sound(SoundType.METAL).setLightLevel((state)->15).notSolid(), - new AxisAlignedBB[]{ - Auxiliaries.getPixeledAABB(6.5,6.5,1, 9.5,9.5,4), - Auxiliaries.getPixeledAABB(6.0,6.0,0, 10.0,10.0,1.0) - } - )).setRegistryName(new ResourceLocation(MODID, "iron_bulb_light")); - - // ------------------------------------------------------------------------------------------------------------------- - - public static final DecorBlock.WaterLoggable STEEL_TABLE = (DecorBlock.WaterLoggable)(new DecorBlock.WaterLoggable( - DecorBlock.CFG_CUTOUT, - Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 8f).sound(SoundType.METAL).notSolid(), - Auxiliaries.getPixeledAABB(0,0,0, 16,16,16) - )).setRegistryName(new ResourceLocation(MODID, "steel_table")); - - public static final EdFloorGratingBlock STEEL_FLOOR_GRATING = (EdFloorGratingBlock)(new EdFloorGratingBlock( - DecorBlock.CFG_CUTOUT, - Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 8f).sound(SoundType.METAL).notSolid(), - Auxiliaries.getPixeledAABB(0,14,0, 16,15.5,16) - )).setRegistryName(new ResourceLocation(MODID, "steel_floor_grating")); - - // ------------------------------------------------------------------------------------------------------------------- - - public static final EdWindowBlock TREATED_WOOD_WINDOW = (EdWindowBlock)(new EdWindowBlock( - DecorBlock.CFG_LOOK_PLACEMENT, - Block.Properties.create(Material.WOOD, MaterialColor.WOOD).hardnessAndResistance(2f, 8f).sound(SoundType.WOOD).notSolid(), - Auxiliaries.getPixeledAABB(0,0,7, 16,16,9) - )).setRegistryName(new ResourceLocation(MODID, "treated_wood_window")); - - public static final EdWindowBlock STEEL_FRAMED_WINDOW = (EdWindowBlock)(new EdWindowBlock( - DecorBlock.CFG_LOOK_PLACEMENT, - Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 8f).sound(SoundType.METAL).notSolid(), - Auxiliaries.getPixeledAABB(0,0,7.5, 16,16,8.5) - )).setRegistryName(new ResourceLocation(MODID, "steel_framed_window")); - - // ------------------------------------------------------------------------------------------------------------------- - - public static final EdStraightPoleBlock TREATED_WOOD_POLE = (EdStraightPoleBlock)(new EdStraightPoleBlock( - DecorBlock.CFG_CUTOUT|DecorBlock.CFG_FACING_PLACEMENT|DecorBlock.CFG_FLIP_PLACEMENT_IF_SAME, - Block.Properties.create(Material.WOOD, MaterialColor.WOOD).hardnessAndResistance(2f, 5f).sound(SoundType.WOOD).notSolid(), - Auxiliaries.getPixeledAABB(5.8,5.8,0, 10.2,10.2,16), - null - )).setRegistryName(new ResourceLocation(MODID, "treated_wood_pole")); - - public static final EdStraightPoleBlock TREATED_WOOD_POLE_HEAD = (EdStraightPoleBlock)(new EdStraightPoleBlock( - DecorBlock.CFG_CUTOUT|DecorBlock.CFG_FACING_PLACEMENT|DecorBlock.CFG_FLIP_PLACEMENT_IF_SAME, - Block.Properties.create(Material.WOOD, MaterialColor.WOOD).hardnessAndResistance(2f, 5f).sound(SoundType.WOOD).notSolid(), - Auxiliaries.getPixeledAABB(5.8,5.8,0, 10.2,10.2,16), - TREATED_WOOD_POLE - )).setRegistryName(new ResourceLocation(MODID, "treated_wood_pole_head")); - - public static final EdStraightPoleBlock TREATED_WOOD_POLE_SUPPORT = (EdStraightPoleBlock)(new EdStraightPoleBlock( - DecorBlock.CFG_CUTOUT|DecorBlock.CFG_FACING_PLACEMENT|DecorBlock.CFG_FLIP_PLACEMENT_IF_SAME, - Block.Properties.create(Material.WOOD, MaterialColor.WOOD).hardnessAndResistance(2f, 5f).sound(SoundType.WOOD).notSolid(), - Auxiliaries.getPixeledAABB(5.8,5.8,0, 10.2,10.2,16), - TREATED_WOOD_POLE - )).setRegistryName(new ResourceLocation(MODID, "treated_wood_pole_support")); - - public static final EdStraightPoleBlock THIN_STEEL_POLE = (EdStraightPoleBlock)(new EdStraightPoleBlock( - DecorBlock.CFG_CUTOUT|DecorBlock.CFG_FACING_PLACEMENT, - Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 11f).sound(SoundType.METAL).notSolid(), - Auxiliaries.getPixeledAABB(6,6,0, 10,10,16), - null - )).setRegistryName(new ResourceLocation(MODID, "thin_steel_pole")); - - public static final EdStraightPoleBlock THIN_STEEL_POLE_HEAD = (EdStraightPoleBlock)(new EdStraightPoleBlock( - DecorBlock.CFG_CUTOUT|DecorBlock.CFG_FACING_PLACEMENT|DecorBlock.CFG_FLIP_PLACEMENT_IF_SAME, - Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 11f).sound(SoundType.METAL).notSolid(), - Auxiliaries.getPixeledAABB(6,6,0, 10,10,16), - THIN_STEEL_POLE - )).setRegistryName(new ResourceLocation(MODID, "thin_steel_pole_head")); - - public static final EdStraightPoleBlock THICK_STEEL_POLE = (EdStraightPoleBlock)(new EdStraightPoleBlock( - DecorBlock.CFG_CUTOUT|DecorBlock.CFG_FACING_PLACEMENT, - Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 11f).sound(SoundType.METAL).notSolid(), - Auxiliaries.getPixeledAABB(5,5,0, 11,11,16), - null - )).setRegistryName(new ResourceLocation(MODID, "thick_steel_pole")); - - public static final EdStraightPoleBlock THICK_STEEL_POLE_HEAD = (EdStraightPoleBlock)(new EdStraightPoleBlock( - DecorBlock.CFG_CUTOUT|DecorBlock.CFG_FACING_PLACEMENT|DecorBlock.CFG_FLIP_PLACEMENT_IF_SAME, - Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 11f).sound(SoundType.METAL).notSolid(), - Auxiliaries.getPixeledAABB(5,5,0, 11,11,16), - THICK_STEEL_POLE - )).setRegistryName(new ResourceLocation(MODID, "thick_steel_pole_head")); - - public static final EdHorizontalSupportBlock STEEL_DOUBLE_T_SUPPORT = (EdHorizontalSupportBlock)(new EdHorizontalSupportBlock( - DecorBlock.CFG_CUTOUT|DecorBlock.CFG_HORIZIONTAL|DecorBlock.CFG_LOOK_PLACEMENT, - Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 11f).sound(SoundType.METAL).notSolid(), - Auxiliaries.getPixeledAABB( 5,11,0, 11,16,16), // main beam - Auxiliaries.getPixeledAABB(10,11,5, 16,16,11), // east beam (also for west 180deg) - Auxiliaries.getPixeledAABB( 6, 0,6, 10,16,10), // down thin - Auxiliaries.getPixeledAABB( 5, 0,5, 11,16,11) // down thick - )).setRegistryName(new ResourceLocation(MODID, "steel_double_t_support")); - - // ------------------------------------------------------------------------------------------------------------------- - - public static final DecorBlock.DirectedWaterLoggable SIGN_MODLOGO = (DecorBlock.DirectedWaterLoggable)(new DecorBlock.DirectedWaterLoggable( - DecorBlock.CFG_CUTOUT|DecorBlock.CFG_FACING_PLACEMENT|DecorBlock.CFG_HORIZIONTAL|DecorBlock.CFG_AI_PASSABLE, - Block.Properties.create(Material.WOOD, MaterialColor.WOOD).hardnessAndResistance(1f, 1000f).sound(SoundType.WOOD).setLightLevel((state)->1).notSolid(), - Auxiliaries.getPixeledAABB(0,0,15.6, 16,16,16.0) - )).setRegistryName(new ResourceLocation(MODID, "sign_decor")); - - public static final DecorBlock.DirectedWaterLoggable SIGN_HOTWIRE = (DecorBlock.DirectedWaterLoggable)(new DecorBlock.DirectedWaterLoggable( - DecorBlock.CFG_CUTOUT|DecorBlock.CFG_FACING_PLACEMENT|DecorBlock.CFG_HORIZIONTAL|DecorBlock.CFG_AI_PASSABLE, - Block.Properties.create(Material.WOOD, MaterialColor.WOOD).hardnessAndResistance(1f, 1f).sound(SoundType.WOOD).notSolid(), - Auxiliaries.getPixeledAABB(2,2,15.6, 14,14,16) - )).setRegistryName(new ResourceLocation(MODID, "sign_hotwire")); - - public static final DecorBlock.DirectedWaterLoggable SIGN_DANGER = (DecorBlock.DirectedWaterLoggable)(new DecorBlock.DirectedWaterLoggable( - DecorBlock.CFG_CUTOUT|DecorBlock.CFG_FACING_PLACEMENT|DecorBlock.CFG_HORIZIONTAL|DecorBlock.CFG_AI_PASSABLE, - Block.Properties.create(Material.WOOD, MaterialColor.WOOD).hardnessAndResistance(1f, 1f).sound(SoundType.WOOD).notSolid(), - Auxiliaries.getPixeledAABB(2,2,15.6, 14,14,16) - )).setRegistryName(new ResourceLocation(MODID, "sign_danger")); - - public static final DecorBlock.DirectedWaterLoggable SIGN_DEFENSE = (DecorBlock.DirectedWaterLoggable)(new DecorBlock.DirectedWaterLoggable( - DecorBlock.CFG_CUTOUT|DecorBlock.CFG_FACING_PLACEMENT|DecorBlock.CFG_HORIZIONTAL|DecorBlock.CFG_AI_PASSABLE, - Block.Properties.create(Material.WOOD, MaterialColor.WOOD).hardnessAndResistance(1f, 1f).sound(SoundType.WOOD).notSolid(), - Auxiliaries.getPixeledAABB(2,2,15.6, 14,14,16) - )).setRegistryName(new ResourceLocation(MODID, "sign_defense")); - - public static final DecorBlock.DirectedWaterLoggable SIGN_FACTORY_AREA = (DecorBlock.DirectedWaterLoggable)(new DecorBlock.DirectedWaterLoggable( - DecorBlock.CFG_CUTOUT|DecorBlock.CFG_FACING_PLACEMENT|DecorBlock.CFG_HORIZIONTAL|DecorBlock.CFG_AI_PASSABLE, - Block.Properties.create(Material.WOOD, MaterialColor.WOOD).hardnessAndResistance(1f, 1f).sound(SoundType.WOOD).notSolid(), - Auxiliaries.getPixeledAABB(2,2,15.6, 14,14,16) - )).setRegistryName(new ResourceLocation(MODID, "sign_factoryarea")); - - public static final DecorBlock.DirectedWaterLoggable SIGN_EXIT = (DecorBlock.DirectedWaterLoggable)(new DecorBlock.DirectedWaterLoggable( - DecorBlock.CFG_CUTOUT|DecorBlock.CFG_FACING_PLACEMENT|DecorBlock.CFG_HORIZIONTAL|DecorBlock.CFG_AI_PASSABLE, - Block.Properties.create(Material.WOOD, MaterialColor.WOOD).hardnessAndResistance(1f, 1f).sound(SoundType.WOOD).notSolid(), - Auxiliaries.getPixeledAABB(3,7,15.6, 13,13,16) - )).setRegistryName(new ResourceLocation(MODID, "sign_exit")); - - public static final DecorBlock.DirectedWaterLoggable SIGN_RADIOACTIVE = (DecorBlock.DirectedWaterLoggable)(new DecorBlock.DirectedWaterLoggable( - DecorBlock.CFG_CUTOUT|DecorBlock.CFG_FACING_PLACEMENT|DecorBlock.CFG_HORIZIONTAL|DecorBlock.CFG_AI_PASSABLE, - Block.Properties.create(Material.WOOD, MaterialColor.WOOD).hardnessAndResistance(1f, 1f).sound(SoundType.WOOD).notSolid(), - Auxiliaries.getPixeledAABB(2,2,15.6, 14,14,16) - )).setRegistryName(new ResourceLocation(MODID, "sign_radioactive")); - - public static final DecorBlock.DirectedWaterLoggable SIGN_LASER = (DecorBlock.DirectedWaterLoggable)(new DecorBlock.DirectedWaterLoggable( - DecorBlock.CFG_CUTOUT|DecorBlock.CFG_FACING_PLACEMENT|DecorBlock.CFG_HORIZIONTAL|DecorBlock.CFG_AI_PASSABLE, - Block.Properties.create(Material.WOOD, MaterialColor.WOOD).hardnessAndResistance(1f, 1f).sound(SoundType.WOOD).notSolid(), - Auxiliaries.getPixeledAABB(2,2,15.6, 14,14,16) - )).setRegistryName(new ResourceLocation(MODID, "sign_laser")); - - public static final DecorBlock.DirectedWaterLoggable SIGN_CAUTION = (DecorBlock.DirectedWaterLoggable)(new DecorBlock.DirectedWaterLoggable( - DecorBlock.CFG_CUTOUT|DecorBlock.CFG_FACING_PLACEMENT|DecorBlock.CFG_HORIZIONTAL|DecorBlock.CFG_AI_PASSABLE, - Block.Properties.create(Material.WOOD, MaterialColor.WOOD).hardnessAndResistance(1f, 1f).sound(SoundType.WOOD).notSolid(), - Auxiliaries.getPixeledAABB(2,2,15.6, 14,14,16) - )).setRegistryName(new ResourceLocation(MODID, "sign_caution")); - - public static final DecorBlock.DirectedWaterLoggable SIGN_MAGIC_HAZARD = (DecorBlock.DirectedWaterLoggable)(new DecorBlock.DirectedWaterLoggable( - DecorBlock.CFG_CUTOUT|DecorBlock.CFG_FACING_PLACEMENT|DecorBlock.CFG_HORIZIONTAL|DecorBlock.CFG_AI_PASSABLE, - Block.Properties.create(Material.WOOD, MaterialColor.WOOD).hardnessAndResistance(1f, 1f).sound(SoundType.WOOD).notSolid(), - Auxiliaries.getPixeledAABB(2,2,15.6, 14,14,16) - )).setRegistryName(new ResourceLocation(MODID, "sign_magichazard")); - - public static final DecorBlock.DirectedWaterLoggable SIGN_FIRE_HAZARD = (DecorBlock.DirectedWaterLoggable)(new DecorBlock.DirectedWaterLoggable( - DecorBlock.CFG_CUTOUT|DecorBlock.CFG_FACING_PLACEMENT|DecorBlock.CFG_HORIZIONTAL|DecorBlock.CFG_AI_PASSABLE, - Block.Properties.create(Material.WOOD, MaterialColor.WOOD).hardnessAndResistance(1f, 1f).sound(SoundType.WOOD).notSolid(), - Auxiliaries.getPixeledAABB(2,2,15.6, 14,14,16) - )).setRegistryName(new ResourceLocation(MODID, "sign_firehazard")); - - public static final DecorBlock.DirectedWaterLoggable SIGN_HOT_SURFACE = (DecorBlock.DirectedWaterLoggable)(new DecorBlock.DirectedWaterLoggable( - DecorBlock.CFG_CUTOUT|DecorBlock.CFG_FACING_PLACEMENT|DecorBlock.CFG_HORIZIONTAL|DecorBlock.CFG_AI_PASSABLE, - Block.Properties.create(Material.WOOD, MaterialColor.WOOD).hardnessAndResistance(1f, 1f).sound(SoundType.WOOD).notSolid(), - Auxiliaries.getPixeledAABB(2,2,15.6, 14,14,16) - )).setRegistryName(new ResourceLocation(MODID, "sign_hotsurface")); - - public static final DecorBlock.DirectedWaterLoggable SIGN_MAGNETIC_FIELD = (DecorBlock.DirectedWaterLoggable)(new DecorBlock.DirectedWaterLoggable( - DecorBlock.CFG_CUTOUT|DecorBlock.CFG_FACING_PLACEMENT|DecorBlock.CFG_HORIZIONTAL|DecorBlock.CFG_AI_PASSABLE, - Block.Properties.create(Material.WOOD, MaterialColor.WOOD).hardnessAndResistance(1f, 1f).sound(SoundType.WOOD).notSolid(), - Auxiliaries.getPixeledAABB(2,2,15.6, 14,14,16) - )).setRegistryName(new ResourceLocation(MODID, "sign_magneticfield")); - - public static final DecorBlock.DirectedWaterLoggable SIGN_FROST_WARNING = (DecorBlock.DirectedWaterLoggable)(new DecorBlock.DirectedWaterLoggable( - DecorBlock.CFG_CUTOUT|DecorBlock.CFG_FACING_PLACEMENT|DecorBlock.CFG_HORIZIONTAL|DecorBlock.CFG_AI_PASSABLE, - Block.Properties.create(Material.WOOD, MaterialColor.WOOD).hardnessAndResistance(1f, 1f).sound(SoundType.WOOD).notSolid(), - Auxiliaries.getPixeledAABB(2,2,15.6, 14,14,16) - )).setRegistryName(new ResourceLocation(MODID, "sign_frost")); - - // ------------------------------------------------------------------------------------------------------------------- - - public static final EdCraftingTable.CraftingTableBlock CRAFTING_TABLE = (EdCraftingTable.CraftingTableBlock)(new EdCraftingTable.CraftingTableBlock( - DecorBlock.CFG_CUTOUT|DecorBlock.CFG_HORIZIONTAL|DecorBlock.CFG_LOOK_PLACEMENT|DecorBlock.CFG_OPPOSITE_PLACEMENT, - Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(1f, 12f).sound(SoundType.METAL).notSolid(), - new AxisAlignedBB[]{ - Auxiliaries.getPixeledAABB(0,15,0, 16,16,16), - Auxiliaries.getPixeledAABB(1, 0,1, 15,16,15) - } - )).setRegistryName(new ResourceLocation(MODID, "metal_crafting_table")); - - public static final FurnaceBlock SMALL_LAB_FURNACE = (FurnaceBlock)(new FurnaceBlock( - DecorBlock.CFG_CUTOUT|DecorBlock.CFG_HORIZIONTAL|DecorBlock.CFG_LOOK_PLACEMENT|DecorBlock.CFG_OPPOSITE_PLACEMENT, - Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(1f, 12f).sound(SoundType.METAL).notSolid(), - new AxisAlignedBB[]{ - Auxiliaries.getPixeledAABB(1,0,1, 15, 1,15), - Auxiliaries.getPixeledAABB(0,1,1, 16,16,16), - } - )).setRegistryName(new ResourceLocation(MODID, "small_lab_furnace")); - - public static final EdElectricalFurnace.ElectricalFurnaceBlock SMALL_ELECTRICAL_FURNACE = (EdElectricalFurnace.ElectricalFurnaceBlock)(new EdElectricalFurnace.ElectricalFurnaceBlock( - DecorBlock.CFG_CUTOUT|DecorBlock.CFG_HORIZIONTAL|DecorBlock.CFG_LOOK_PLACEMENT|DecorBlock.CFG_OPPOSITE_PLACEMENT, - Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 12f).sound(SoundType.METAL).notSolid(), - new AxisAlignedBB[]{ - Auxiliaries.getPixeledAABB(0, 0,0, 16,11,16), - Auxiliaries.getPixeledAABB(1,11,0, 15,12,16), - Auxiliaries.getPixeledAABB(2,12,0, 14,13,16), - Auxiliaries.getPixeledAABB(3,13,0, 13,14,16), - Auxiliaries.getPixeledAABB(4,14,0, 12,16,16), - } - )).setRegistryName(new ResourceLocation(MODID, "small_electrical_furnace")); - - public static final EdDropper.DropperBlock FACTORY_DROPPER = (EdDropper.DropperBlock)(new EdDropper.DropperBlock( - DecorBlock.CFG_CUTOUT|DecorBlock.CFG_LOOK_PLACEMENT|DecorBlock.CFG_OPPOSITE_PLACEMENT, - Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 12f).sound(SoundType.METAL).notSolid(), - Auxiliaries.getPixeledAABB(0,0,1, 16,16,16) - )).setRegistryName(new ResourceLocation(MODID, "factory_dropper")); - - public static final EdPlacer.PlacerBlock FACTORY_PLACER = (EdPlacer.PlacerBlock)(new EdPlacer.PlacerBlock( - DecorBlock.CFG_CUTOUT|DecorBlock.CFG_LOOK_PLACEMENT|DecorBlock.CFG_FLIP_PLACEMENT_SHIFTCLICK|DecorBlock.CFG_OPPOSITE_PLACEMENT, - Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 12f).sound(SoundType.METAL).notSolid(), - new AxisAlignedBB[]{ - Auxiliaries.getPixeledAABB(0,0,2, 16,16,16), - Auxiliaries.getPixeledAABB( 0,0,0, 1,16, 2), - Auxiliaries.getPixeledAABB(15,0,0,16,16, 2) - } - )).setRegistryName(new ResourceLocation(MODID, "factory_placer")); - - public static final EdBreaker.BreakerBlock SMALL_BLOCK_BREAKER = (EdBreaker.BreakerBlock)(new EdBreaker.BreakerBlock( - DecorBlock.CFG_CUTOUT|DecorBlock.CFG_HORIZIONTAL|DecorBlock.CFG_LOOK_PLACEMENT|DecorBlock.CFG_OPPOSITE_PLACEMENT|DecorBlock.CFG_FLIP_PLACEMENT_SHIFTCLICK, - Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 12f).sound(SoundType.METAL).notSolid(), - new AxisAlignedBB[]{ - Auxiliaries.getPixeledAABB(1,0,0, 15, 4, 7), - Auxiliaries.getPixeledAABB(1,0,7, 15,12,16), - Auxiliaries.getPixeledAABB(0,0,0, 1, 5, 4), - Auxiliaries.getPixeledAABB(0,0,4, 1,12,16), - Auxiliaries.getPixeledAABB(15,0,0, 16, 5, 4), - Auxiliaries.getPixeledAABB(15,0,4, 16,12,16) - } - )).setRegistryName(new ResourceLocation(MODID, "small_block_breaker")); - - public static final EdHopper.HopperBlock FACTORY_HOPPER = (EdHopper.HopperBlock)(new EdHopper.HopperBlock( - DecorBlock.CFG_CUTOUT|DecorBlock.CFG_FACING_PLACEMENT|DecorBlock.CFG_OPPOSITE_PLACEMENT, - Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 12f).sound(SoundType.METAL).notSolid(),()->{ - final AxisAlignedBB[] down_aabbs = new AxisAlignedBB[]{ - Auxiliaries.getPixeledAABB( 5, 0, 5, 11, 1,11), - Auxiliaries.getPixeledAABB( 4, 1, 4, 12, 7,12), - Auxiliaries.getPixeledAABB( 2, 7, 2, 14,10,14), - Auxiliaries.getPixeledAABB( 0,10, 0, 16,16,16), - Auxiliaries.getPixeledAABB( 0, 4, 5, 2,10,11), - Auxiliaries.getPixeledAABB(14, 4, 5, 16,10,11), - Auxiliaries.getPixeledAABB( 5, 4, 0, 11,10, 2), - Auxiliaries.getPixeledAABB( 5, 4,14, 11,10,16), - }; - final AxisAlignedBB[] up_aabbs = new AxisAlignedBB[]{ - Auxiliaries.getPixeledAABB( 5,15, 5, 11,16,11), - Auxiliaries.getPixeledAABB( 4,14, 4, 12, 9,12), - Auxiliaries.getPixeledAABB( 2, 9, 2, 14, 6,14), - Auxiliaries.getPixeledAABB( 0, 6, 0, 16, 0,16), - Auxiliaries.getPixeledAABB( 0,12, 5, 2, 6,11), - Auxiliaries.getPixeledAABB(14,12, 5, 16, 6,11), - Auxiliaries.getPixeledAABB( 5,12, 0, 11, 6, 2), - Auxiliaries.getPixeledAABB( 5,12,14, 11, 6,16), - }; - final AxisAlignedBB[] north_aabbs = new AxisAlignedBB[]{ - Auxiliaries.getPixeledAABB( 5, 0, 5, 11, 1,11), - Auxiliaries.getPixeledAABB( 4, 1, 4, 12, 7,12), - Auxiliaries.getPixeledAABB( 2, 7, 2, 14,10,14), - Auxiliaries.getPixeledAABB( 0,10, 0, 16,16,16), - Auxiliaries.getPixeledAABB( 0, 4, 5, 2,10,11), - Auxiliaries.getPixeledAABB(14, 4, 5, 16,10,11), - Auxiliaries.getPixeledAABB( 5, 1, 0, 11, 7, 4), - Auxiliaries.getPixeledAABB( 5, 4,14, 11,10,16), - }; - return new ArrayList(Arrays.asList( - Auxiliaries.getUnionShape(down_aabbs), - Auxiliaries.getUnionShape(up_aabbs), - Auxiliaries.getUnionShape(Auxiliaries.getRotatedAABB(north_aabbs, Direction.NORTH, false)), - Auxiliaries.getUnionShape(Auxiliaries.getRotatedAABB(north_aabbs, Direction.SOUTH, false)), - Auxiliaries.getUnionShape(Auxiliaries.getRotatedAABB(north_aabbs, Direction.WEST, false)), - Auxiliaries.getUnionShape(Auxiliaries.getRotatedAABB(north_aabbs, Direction.EAST, false)), - VoxelShapes.fullCube(), - VoxelShapes.fullCube() - )); - } - )).setRegistryName(new ResourceLocation(MODID, "factory_hopper")); - - public static final EdWasteIncinerator.WasteIncineratorBlock SMALL_WASTE_INCINERATOR = (EdWasteIncinerator.WasteIncineratorBlock)(new EdWasteIncinerator.WasteIncineratorBlock( - DecorBlock.CFG_DEFAULT, - Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 12f).sound(SoundType.METAL), - Auxiliaries.getPixeledAABB(0,0,0, 16,16,16) - )).setRegistryName(new ResourceLocation(MODID, "small_waste_incinerator")); - - public static final EdMineralSmelter.MineralSmelterBlock SMALL_MINERAL_SMELTER = (EdMineralSmelter.MineralSmelterBlock)(new EdMineralSmelter.MineralSmelterBlock( - DecorBlock.CFG_CUTOUT|DecorBlock.CFG_HORIZIONTAL|DecorBlock.CFG_LOOK_PLACEMENT, - Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 12f).sound(SoundType.METAL).notSolid(), - Auxiliaries.getPixeledAABB(1.1,0,1.1, 14.9,16,14.9) - )).setRegistryName(new ResourceLocation(MODID, "small_mineral_smelter")); - - public static final EdFreezer.FreezerBlock SMALL_FREEZER = (EdFreezer.FreezerBlock)(new EdFreezer.FreezerBlock( - DecorBlock.CFG_CUTOUT|DecorBlock.CFG_HORIZIONTAL|DecorBlock.CFG_LOOK_PLACEMENT, - Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 12f).sound(SoundType.METAL).notSolid(), - Auxiliaries.getPixeledAABB(1.1,0,1.1, 14.9,16,14.9) - )).setRegistryName(new ResourceLocation(MODID, "small_freezer")); - - public static final EdSolarPanel.SolarPanelBlock SMALL_SOLAR_PANEL = (EdSolarPanel.SolarPanelBlock)(new EdSolarPanel.SolarPanelBlock( - DecorBlock.CFG_CUTOUT, - Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 10f).sound(SoundType.METAL).notSolid(), - new AxisAlignedBB[]{ - Auxiliaries.getPixeledAABB(0,0,0, 16,2,16), - Auxiliaries.getPixeledAABB(6,1.5,3, 10,10.5,13), - } - )).setRegistryName(new ResourceLocation(MODID, "small_solar_panel")); - - public static final EdMilker.MilkerBlock SMALL_MILKING_MACHINE = (EdMilker.MilkerBlock)(new EdMilker.MilkerBlock( - DecorBlock.CFG_CUTOUT|DecorBlock.CFG_HORIZIONTAL|DecorBlock.CFG_LOOK_PLACEMENT, - Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 10f).sound(SoundType.METAL).notSolid(), - new AxisAlignedBB[]{ - Auxiliaries.getPixeledAABB( 1, 1,0, 15,14,10), - Auxiliaries.getPixeledAABB( 0,14,0, 16,16,13), - Auxiliaries.getPixeledAABB( 0, 0,0, 16, 1,13), - Auxiliaries.getPixeledAABB( 0, 1,1, 1,14,11), - Auxiliaries.getPixeledAABB(15, 1,1, 16,14,11) - } - )).setRegistryName(new ResourceLocation(MODID, "small_milking_machine")); - - public static final EdTreeCutter.TreeCutterBlock SMALL_TREE_CUTTER = (EdTreeCutter.TreeCutterBlock)(new EdTreeCutter.TreeCutterBlock( - DecorBlock.CFG_CUTOUT|DecorBlock.CFG_HORIZIONTAL|DecorBlock.CFG_LOOK_PLACEMENT|DecorBlock.CFG_FLIP_PLACEMENT_SHIFTCLICK, - Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 10f).sound(SoundType.METAL).notSolid(), - new AxisAlignedBB[]{ - Auxiliaries.getPixeledAABB( 0,0, 0, 16,3,16), - Auxiliaries.getPixeledAABB( 0,3, 0, 3,8,16), - Auxiliaries.getPixeledAABB( 3,7, 0, 5,8,16), - Auxiliaries.getPixeledAABB(15,0, 0, 16,6,16), - Auxiliaries.getPixeledAABB( 0,0,13, 16,8,16), - Auxiliaries.getPixeledAABB( 5,6,12, 16,8,13), - } - )).setRegistryName(new ResourceLocation(MODID, "small_tree_cutter")); - - public static final EdPipeValve.PipeValveBlock STRAIGHT_CHECK_VALVE = (EdPipeValve.PipeValveBlock)(new EdPipeValve.PipeValveBlock( - DecorBlock.CFG_CUTOUT|DecorBlock.CFG_FACING_PLACEMENT|DecorBlock.CFG_OPPOSITE_PLACEMENT|DecorBlock.CFG_FLIP_PLACEMENT_SHIFTCLICK, - EdPipeValve.CFG_CHECK_VALVE, - Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 8f).sound(SoundType.METAL).notSolid(), - new AxisAlignedBB[]{ - Auxiliaries.getPixeledAABB(2,2, 0, 14,14, 2), - Auxiliaries.getPixeledAABB(2,2,14, 14,14,16), - Auxiliaries.getPixeledAABB(3,3, 5, 13,13,11), - Auxiliaries.getPixeledAABB(4,4, 2, 12,12,14), - } - )).setRegistryName(new ResourceLocation(MODID, "straight_pipe_valve")); - - public static final EdPipeValve.PipeValveBlock STRAIGHT_REDSTONE_VALVE = (EdPipeValve.PipeValveBlock)(new EdPipeValve.PipeValveBlock( - DecorBlock.CFG_CUTOUT|DecorBlock.CFG_FACING_PLACEMENT|DecorBlock.CFG_OPPOSITE_PLACEMENT, - EdPipeValve.CFG_REDSTONE_CONTROLLED_VALVE, - Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 8f).sound(SoundType.METAL).notSolid(), - new AxisAlignedBB[]{ - Auxiliaries.getPixeledAABB(2,2, 0, 14,14, 2), - Auxiliaries.getPixeledAABB(2,2,14, 14,14,16), - Auxiliaries.getPixeledAABB(3,3, 5, 13,13,11), - Auxiliaries.getPixeledAABB(4,4, 2, 12,12,14), - } - )).setRegistryName(new ResourceLocation(MODID, "straight_pipe_valve_redstone")); - - public static final EdPipeValve.PipeValveBlock STRAIGHT_REDSTONE_ANALOG_VALVE = (EdPipeValve.PipeValveBlock)(new EdPipeValve.PipeValveBlock( - DecorBlock.CFG_CUTOUT|DecorBlock.CFG_FACING_PLACEMENT|DecorBlock.CFG_OPPOSITE_PLACEMENT, - EdPipeValve.CFG_REDSTONE_CONTROLLED_VALVE|EdPipeValve.CFG_ANALOG_VALVE, - Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 8f).sound(SoundType.METAL).notSolid(), - new AxisAlignedBB[]{ - Auxiliaries.getPixeledAABB(2,2, 0, 14,14, 2), - Auxiliaries.getPixeledAABB(2,2,14, 14,14,16), - Auxiliaries.getPixeledAABB(3,3, 5, 13,13,11), - Auxiliaries.getPixeledAABB(4,4, 2, 12,12,14), - } - )).setRegistryName(new ResourceLocation(MODID, "straight_pipe_valve_redstone_analog")); - - public static final EdFluidBarrel.FluidBarrelBlock FLUID_BARREL = (EdFluidBarrel.FluidBarrelBlock)(new EdFluidBarrel.FluidBarrelBlock( - DecorBlock.CFG_CUTOUT|DecorBlock.CFG_LOOK_PLACEMENT|DecorBlock.CFG_OPPOSITE_PLACEMENT, - Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 10f).sound(SoundType.METAL).notSolid(), - new AxisAlignedBB[]{ - Auxiliaries.getPixeledAABB(2, 0,0, 14, 1,16), - Auxiliaries.getPixeledAABB(1, 1,0, 15, 2,16), - Auxiliaries.getPixeledAABB(0, 2,0, 16,14,16), - Auxiliaries.getPixeledAABB(1,14,0, 15,15,16), - Auxiliaries.getPixeledAABB(2,15,0, 14,16,16), - } - )).setRegistryName(new ResourceLocation(MODID, "fluid_barrel")); - - public static final EdFluidFunnel.FluidFunnelBlock SMALL_FLUID_FUNNEL = (EdFluidFunnel.FluidFunnelBlock)(new EdFluidFunnel.FluidFunnelBlock( - DecorBlock.CFG_CUTOUT, - Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 10f).sound(SoundType.METAL).notSolid(), - new AxisAlignedBB[]{ - Auxiliaries.getPixeledAABB(0, 0,0, 16,14,16), - Auxiliaries.getPixeledAABB(1,14,1, 15,15,15), - Auxiliaries.getPixeledAABB(0,15,0, 16,16,16) - } - )).setRegistryName(new ResourceLocation(MODID, "small_fluid_funnel")); - - public static final EdLabeledCrate.LabeledCrateBlock LABELED_CRATE = (EdLabeledCrate.LabeledCrateBlock)(new EdLabeledCrate.LabeledCrateBlock( - DecorBlock.CFG_HORIZIONTAL|DecorBlock.CFG_LOOK_PLACEMENT|DecorBlock.CFG_OPPOSITE_PLACEMENT, - Block.Properties.create(Material.WOOD, MaterialColor.WOOD).hardnessAndResistance(0.5f, 32f).sound(SoundType.METAL).notSolid(), - Auxiliaries.getPixeledAABB(0,0,0, 16,16,16) - )).setRegistryName(new ResourceLocation(MODID, "labeled_crate")); - - // ------------------------------------------------------------------------------------------------------------------- - - public static final EdSlabSliceBlock HALFSLAB_TREATEDWOOD = (EdSlabSliceBlock)(new EdSlabSliceBlock( - DecorBlock.CFG_CUTOUT|DecorBlock.CFG_HARD_IE_DEPENDENT, - Block.Properties.create(Material.WOOD, MaterialColor.WOOD).hardnessAndResistance(1f, 4f).sound(SoundType.WOOD).notSolid() - )).setRegistryName(new ResourceLocation(MODID, "halfslab_treated_wood")); - - public static final EdSlabSliceBlock HALFSLAB_SHEETMETALIRON = (EdSlabSliceBlock)(new EdSlabSliceBlock( - DecorBlock.CFG_CUTOUT|DecorBlock.CFG_HARD_IE_DEPENDENT, - Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(1f, 8f).sound(SoundType.METAL).notSolid() - )).setRegistryName(new ResourceLocation(MODID, "halfslab_sheetmetal_iron")); - - public static final EdSlabSliceBlock HALFSLAB_SHEETMETALSTEEL = (EdSlabSliceBlock)(new EdSlabSliceBlock( - DecorBlock.CFG_CUTOUT|DecorBlock.CFG_HARD_IE_DEPENDENT, - Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(1f, 8f).sound(SoundType.METAL).notSolid() - )).setRegistryName(new ResourceLocation(MODID, "halfslab_sheetmetal_steel")); - - public static final EdSlabSliceBlock HALFSLAB_SHEETMETALCOPPER = (EdSlabSliceBlock)(new EdSlabSliceBlock( - DecorBlock.CFG_CUTOUT|DecorBlock.CFG_HARD_IE_DEPENDENT, - Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(1f, 8f).sound(SoundType.METAL).notSolid() - )).setRegistryName(new ResourceLocation(MODID, "halfslab_sheetmetal_copper")); - - public static final EdSlabSliceBlock HALFSLAB_SHEETMETALGOLD = (EdSlabSliceBlock)(new EdSlabSliceBlock( - DecorBlock.CFG_CUTOUT|DecorBlock.CFG_HARD_IE_DEPENDENT, - Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(1f, 8f).sound(SoundType.METAL).notSolid() - )).setRegistryName(new ResourceLocation(MODID, "halfslab_sheetmetal_gold")); - - public static final EdSlabSliceBlock HALFSLAB_SHEETMETALALUMINIUM = (EdSlabSliceBlock)(new EdSlabSliceBlock( - DecorBlock.CFG_CUTOUT|DecorBlock.CFG_HARD_IE_DEPENDENT, - Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(1f, 8f).sound(SoundType.METAL).notSolid() - )).setRegistryName(new ResourceLocation(MODID, "halfslab_sheetmetal_aluminum")); - - // ------------------------------------------------------------------------------------------------------------------- - - public static final EdFenceBlock STEEL_MESH_FENCE = (EdFenceBlock)(new EdFenceBlock( - DecorBlock.CFG_CUTOUT, - Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 10f).sound(SoundType.METAL).notSolid(), - 1.5, 16, 0.25, 0, 16, 16 - )).setRegistryName(new ResourceLocation(MODID, "steel_mesh_fence")); - - public static final EdDoubleGateBlock STEEL_MESH_FENCE_GATE = (EdDoubleGateBlock)(new EdDoubleGateBlock( - DecorBlock.CFG_CUTOUT, - Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 10f).sound(SoundType.METAL).notSolid(), - Auxiliaries.getPixeledAABB(0,0,6.5, 16,16,9.5) - )).setRegistryName(new ResourceLocation(MODID, "steel_mesh_fence_gate")); - - public static final EdRailingBlock STEEL_RAILING = (EdRailingBlock)(new EdRailingBlock( - DecorBlock.CFG_CUTOUT, - Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(1f, 10f).sound(SoundType.METAL).notSolid(), - Auxiliaries.getPixeledAABB(0,0,0, 0, 0,0), - Auxiliaries.getPixeledAABB(0,0,0, 16,15.9,1) - )).setRegistryName(new ResourceLocation(MODID, "steel_railing")); - - public static final EdCatwalkBlock STEEL_CATWALK = (EdCatwalkBlock)(new EdCatwalkBlock( - DecorBlock.CFG_CUTOUT, - Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 10f).sound(SoundType.METAL).notSolid(), - Auxiliaries.getPixeledAABB(0,0,0, 16, 2,16), - Auxiliaries.getPixeledAABB(0,0,0, 16,15.9, 1), - STEEL_RAILING - )).setRegistryName(new ResourceLocation(MODID, "steel_catwalk")); - - public static final EdCatwalkTopAlignedBlock STEEL_CATWALK_TOP_ALIGNED = (EdCatwalkTopAlignedBlock)(new EdCatwalkTopAlignedBlock( - DecorBlock.CFG_CUTOUT, - Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 10f).sound(SoundType.METAL).notSolid(), - new VoxelShape[]{ - VoxelShapes.create(Auxiliaries.getPixeledAABB(0,14,0, 16, 16,16)), // only base - Auxiliaries.getUnionShape( // base with thick pole - Auxiliaries.getPixeledAABB(0,14,0, 16, 16,16), - Auxiliaries.getPixeledAABB(5, 0,5, 11,15, 11) - ), - Auxiliaries.getUnionShape( // base with thin pole - Auxiliaries.getPixeledAABB(0,14,0, 16, 16,16), - Auxiliaries.getPixeledAABB(6, 0,6, 10,15, 10) - ), - Auxiliaries.getUnionShape( // structure frame-like - Auxiliaries.getPixeledAABB( 0, 0, 0, 16, 2,16), - Auxiliaries.getPixeledAABB( 0,14, 0, 16, 16,16), - Auxiliaries.getPixeledAABB( 0, 0, 0, 1, 16, 1), - Auxiliaries.getPixeledAABB(15, 0, 0, 16, 16, 1), - Auxiliaries.getPixeledAABB(15, 0,15, 16, 16,16), - Auxiliaries.getPixeledAABB( 0, 0,15, 1, 16,16) - ) - } - )).setRegistryName(new ResourceLocation(MODID, "steel_catwalk_ta")); - - public static final EdCatwalkStairsBlock STEEL_CATWALK_STAIRS = (EdCatwalkStairsBlock)(new EdCatwalkStairsBlock( - DecorBlock.CFG_CUTOUT, - Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(2f, 10f).sound(SoundType.METAL).notSolid(), - new AxisAlignedBB[] { // base - Auxiliaries.getPixeledAABB( 1, 2, 8, 15, 4, 16), - Auxiliaries.getPixeledAABB( 1,10, 0, 15, 12, 8), - }, - new AxisAlignedBB[] { // railing left - Auxiliaries.getPixeledAABB(0.4, 0, 15, 0.6, 15, 16), - Auxiliaries.getPixeledAABB(0.4, 1, 14, 0.6, 16, 15), - Auxiliaries.getPixeledAABB(0.4, 2, 13, 0.6, 17, 14), - Auxiliaries.getPixeledAABB(0.4, 3, 12, 0.6, 18, 13), - Auxiliaries.getPixeledAABB(0.4, 4, 11, 0.6, 19, 12), - Auxiliaries.getPixeledAABB(0.4, 5, 10, 0.6, 20, 11), - Auxiliaries.getPixeledAABB(0.4, 6, 9, 0.6, 21, 10), - Auxiliaries.getPixeledAABB(0.4, 7, 8, 0.6, 22, 9), - Auxiliaries.getPixeledAABB(0.4, 8, 7, 0.6, 23, 8), - Auxiliaries.getPixeledAABB(0.4, 9, 6, 0.6, 24, 7), - Auxiliaries.getPixeledAABB(0.4, 10, 5, 0.6, 25, 6), - Auxiliaries.getPixeledAABB(0.4, 11, 4, 0.6, 26, 5), - Auxiliaries.getPixeledAABB(0.4, 12, 3, 0.6, 27, 4), - Auxiliaries.getPixeledAABB(0.4, 13, 2, 0.6, 28, 3), - Auxiliaries.getPixeledAABB(0.4, 14, 1, 0.6, 29, 2), - Auxiliaries.getPixeledAABB(0.4, 15, 0, 0.6, 30, 1) - } - )).setRegistryName(new ResourceLocation(MODID, "steel_catwalk_stairs")); - - // ------------------------------------------------------------------------------------------------------------------- - - public static final EdTestBlock.TestBlock TEST_BLOCK = (EdTestBlock.TestBlock)(new EdTestBlock.TestBlock( - DecorBlock.CFG_LOOK_PLACEMENT, - Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(0f, 32000f).sound(SoundType.METAL), - Auxiliaries.getPixeledAABB(0,0,0, 16,16,16) - )).setRegistryName(new ResourceLocation(MODID, "test_block")); - - // ------------------------------------------------------------------------------------------------------------------- - - private static final Block modBlocks[] = { - CRAFTING_TABLE, - LABELED_CRATE, - SMALL_LAB_FURNACE, - SMALL_ELECTRICAL_FURNACE, - FACTORY_HOPPER, - FACTORY_DROPPER, - FACTORY_PLACER, - SMALL_BLOCK_BREAKER, - SMALL_TREE_CUTTER, - SMALL_SOLAR_PANEL, - SMALL_WASTE_INCINERATOR, - SMALL_MINERAL_SMELTER, - SMALL_FREEZER, - SMALL_MILKING_MACHINE, - FLUID_BARREL, - STRAIGHT_CHECK_VALVE, - STRAIGHT_REDSTONE_VALVE, - STRAIGHT_REDSTONE_ANALOG_VALVE, - SMALL_FLUID_FUNNEL, - DENSE_GRIT_SAND, - DENSE_GRIT_DIRT, - CLINKER_BRICK_BLOCK, - CLINKER_BRICK_SLAB, - CLINKER_BRICK_STAIRS, - CLINKER_BRICK_WALL, - CLINKER_BRICK_SASTOR_CORNER, - CLINKER_BRICK_STAINED_BLOCK, - CLINKER_BRICK_STAINED_SLAB, - CLINKER_BRICK_STAINED_STAIRS, - CLINKER_BRICK_SASTOR_VERTICAL_SLOTTED, - CLINKER_BRICK_RECESSED, - CLINKER_BRICK_VERTICAL_SLAB_STRUCTURED, - SLAG_BRICK_BLOCK, - SLAG_BRICK_SLAB, - SLAG_BRICK_STAIRS, - SLAG_BRICK_WALL, - REBAR_CONCRETE_BLOCK, - REBAR_CONCRETE_SLAB, - REBAR_CONCRETE_STAIRS, - REBAR_CONCRETE_WALL, - REBAR_CONCRETE_TILE, - REBAR_CONCRETE_TILE_SLAB, - REBAR_CONCRETE_TILE_STAIRS, - GAS_CONCRETE_BLOCK, - GAS_CONCRETE_SLAB, - GAS_CONCRETE_STAIRS, - GAS_CONCRETE_WALL, - HALFSLAB_REBARCONCRETE, - HALFSLAB_GASCONCRETE, - HALFSLAB_TREATEDWOOD, - HALFSLAB_SHEETMETALIRON, - HALFSLAB_SHEETMETALSTEEL, - HALFSLAB_SHEETMETALCOPPER, - HALFSLAB_SHEETMETALGOLD, - HALFSLAB_SHEETMETALALUMINIUM, - PANZERGLASS_BLOCK, - PANZERGLASS_SLAB, - DARK_CERAMIC_SHINGLE_ROOF, - DARK_CERAMIC_SHINGLE_ROOF_METALIZED, - DARK_CERAMIC_SHINGLE_ROOF_SKYLIGHT, - DARK_CERAMIC_SHINGLE_ROOF_CHIMNEYTRUNK, - DARK_CERAMIC_SHINGLE_ROOF_WIRECONDUIT, - DARK_CERAMIC_SHINGLE_ROOF_BLOCK, - DARK_CERAMIC_SHINGLE_ROOF_SLAB, - HALFSLAB_DARK_CERAMIC_SHINGLE_ROOF, - DARK_CERAMIC_SHINGLE_ROOF_CHIMNEY, - METAL_RUNG_LADDER, - METAL_RUNG_STEPS, - TREATED_WOOD_LADDER, - METAL_SLIDING_DOOR, - IRON_HATCH, - OLD_INDUSTRIAL_PLANKS, - OLD_INDUSTRIAL_SLAB, - OLD_INDUSTRIAL_STAIRS, - OLD_INDUSTRIAL_SLABSLICE, - OLD_INDUSTRIAL_WOOD_DOOR, - TREATED_WOOD_TABLE, - TREATED_WOOD_STOOL, - TREATED_WOOD_SIDE_TABLE, - TREATED_WOOD_WINDOWSILL, - TREATED_WOOD_BROAD_WINDOWSILL, - TREATED_WOOD_WINDOW, - STEEL_FRAMED_WINDOW, - STEEL_TABLE, - INSET_LIGHT_IRON, - FLOOR_EDGE_LIGHT_IRON, - CEILING_EDGE_LIGHT_IRON, - BULB_LIGHT_IRON, - STEEL_FLOOR_GRATING, - STEEL_MESH_FENCE, - STEEL_MESH_FENCE_GATE, - STEEL_CATWALK, - STEEL_RAILING, - STEEL_CATWALK_TOP_ALIGNED, - STEEL_CATWALK_STAIRS, - TREATED_WOOD_POLE, - TREATED_WOOD_POLE_HEAD, - TREATED_WOOD_POLE_SUPPORT, - THIN_STEEL_POLE, - THIN_STEEL_POLE_HEAD, - THICK_STEEL_POLE, - THICK_STEEL_POLE_HEAD, - STEEL_DOUBLE_T_SUPPORT, - SIGN_HOTWIRE, - SIGN_DANGER, - SIGN_DEFENSE, - SIGN_FACTORY_AREA, - SIGN_EXIT, - SIGN_RADIOACTIVE, - SIGN_LASER, - SIGN_CAUTION, - SIGN_MAGIC_HAZARD, - SIGN_FIRE_HAZARD, - SIGN_HOT_SURFACE, - SIGN_MAGNETIC_FIELD, - SIGN_FROST_WARNING, - SIGN_MODLOGO, - }; - - private static final Block devBlocks[] = { - TEST_BLOCK - }; - - //-------------------------------------------------------------------------------------------------------------------- - // Tile entities bound exclusively to the blocks above - //-------------------------------------------------------------------------------------------------------------------- - - public static final TileEntityType TET_CRAFTING_TABLE = TileEntityType.Builder - .create(EdCraftingTable.CraftingTableTileEntity::new, CRAFTING_TABLE) - .build(null) - .setRegistryName(MODID, "te_treated_wood_crafting_table"); - - public static final TileEntityType TET_LABELED_CRATE = TileEntityType.Builder - .create(EdLabeledCrate.LabeledCrateTileEntity::new, LABELED_CRATE) - .build(null) - .setRegistryName(MODID, "te_labeled_crate"); - - public static final TileEntityType TET_SMALL_LAB_FURNACE = TileEntityType.Builder - .create(FurnaceTileEntity::new, SMALL_LAB_FURNACE) - .build(null) - .setRegistryName(MODID, "te_small_lab_furnace"); - - public static final TileEntityType TET_SMALL_ELECTRICAL_FURNACE = TileEntityType.Builder - .create(EdElectricalFurnace.ElectricalFurnaceTileEntity::new, SMALL_ELECTRICAL_FURNACE) - .build(null) - .setRegistryName(MODID, "te_small_electrical_furnace"); - - public static final TileEntityType TET_FACTORY_DROPPER = TileEntityType.Builder - .create(EdDropper.DropperTileEntity::new, FACTORY_DROPPER) - .build(null) - .setRegistryName(MODID, "te_factory_dropper"); - - public static final TileEntityType TET_FACTORY_PLACER = TileEntityType.Builder - .create(EdPlacer.PlacerTileEntity::new, FACTORY_PLACER) - .build(null) - .setRegistryName(MODID, "te_factory_placer"); - - public static final TileEntityType TET_SMALL_BLOCK_BREAKER = TileEntityType.Builder - .create(EdBreaker.BreakerTileEntity::new, SMALL_BLOCK_BREAKER) - .build(null) - .setRegistryName(MODID, "te_small_block_breaker"); - - public static final TileEntityType TET_FACTORY_HOPPER = TileEntityType.Builder - .create(EdHopper.HopperTileEntity::new, FACTORY_HOPPER) - .build(null) - .setRegistryName(MODID, "te_factory_hopper"); - - public static final TileEntityType TET_WASTE_INCINERATOR = TileEntityType.Builder - .create(EdWasteIncinerator.WasteIncineratorTileEntity::new, SMALL_WASTE_INCINERATOR) - .build(null) - .setRegistryName(MODID, "te_small_waste_incinerator"); - - public static final TileEntityType TET_STRAIGHT_PIPE_VALVE = TileEntityType.Builder - .create(EdPipeValve.PipeValveTileEntity::new, STRAIGHT_CHECK_VALVE, STRAIGHT_REDSTONE_VALVE, STRAIGHT_REDSTONE_ANALOG_VALVE) - .build(null) - .setRegistryName(MODID, "te_pipe_valve"); - - public static final TileEntityType TET_FLUID_BARREL = TileEntityType.Builder - .create(EdFluidBarrel.FluidBarrelTileEntity::new, FLUID_BARREL) - .build(null) - .setRegistryName(MODID, "te_fluid_barrel"); - - public static final TileEntityType TET_SMALL_FLUID_FUNNEL = TileEntityType.Builder - .create(EdFluidFunnel.FluidFunnelTileEntity::new, SMALL_FLUID_FUNNEL) - .build(null) - .setRegistryName(MODID, "te_small_fluid_funnel"); - - public static final TileEntityType TET_MINERAL_SMELTER = TileEntityType.Builder - .create(EdMineralSmelter.MineralSmelterTileEntity::new, SMALL_MINERAL_SMELTER) - .build(null) - .setRegistryName(MODID, "te_small_mineral_smelter"); - - public static final TileEntityType TET_FREEZER = TileEntityType.Builder - .create(EdFreezer.FreezerTileEntity::new, SMALL_FREEZER) - .build(null) - .setRegistryName(MODID, "te_small_freezer"); - - public static final TileEntityType TET_SMALL_SOLAR_PANEL = TileEntityType.Builder - .create(EdSolarPanel.SolarPanelTileEntity::new, SMALL_SOLAR_PANEL) - .build(null) - .setRegistryName(MODID, "te_small_solar_panel"); - - public static final TileEntityType TET_SMALL_MILKING_MACHINE = TileEntityType.Builder - .create(EdMilker.MilkerTileEntity::new, SMALL_MILKING_MACHINE) - .build(null) - .setRegistryName(MODID, "te_small_milking_machine"); - - public static final TileEntityType TET_SMALL_TREE_CUTTER = TileEntityType.Builder - .create(EdTreeCutter.TreeCutterTileEntity::new, SMALL_TREE_CUTTER) - .build(null) - .setRegistryName(MODID, "te_small_tree_cutter"); - - public static final TileEntityType TET_TEST_BLOCK = TileEntityType.Builder - .create(EdTestBlock.TestTileEntity::new, TEST_BLOCK) - .build(null) - .setRegistryName(MODID, "te_test_block"); - - private static final TileEntityType tile_entity_types[] = { - TET_CRAFTING_TABLE, - TET_LABELED_CRATE, - TET_SMALL_LAB_FURNACE, - TET_SMALL_ELECTRICAL_FURNACE, - TET_FACTORY_HOPPER, - TET_FACTORY_DROPPER, - TET_FACTORY_PLACER, - TET_SMALL_BLOCK_BREAKER, - TET_SMALL_TREE_CUTTER, - TET_WASTE_INCINERATOR, - TET_MINERAL_SMELTER, - TET_FREEZER, - TET_SMALL_SOLAR_PANEL, - TET_SMALL_MILKING_MACHINE, - TET_STRAIGHT_PIPE_VALVE, - TET_FLUID_BARREL, - TET_SMALL_FLUID_FUNNEL, - TET_TEST_BLOCK - }; - - //-------------------------------------------------------------------------------------------------------------------- - // Items - //-------------------------------------------------------------------------------------------------------------------- - - private static Item.Properties default_item_properties() - { return (new Item.Properties()).group(ModEngineersDecor.ITEMGROUP); } - - public static final EdItem METAL_BAR_ITEM = (EdItem)((new EdItem(default_item_properties()).setRegistryName(MODID, "metal_bar"))); - - private static final EdItem modItems[] = { - METAL_BAR_ITEM - }; - - //-------------------------------------------------------------------------------------------------------------------- - // Entities bound exclusively to the blocks above - //-------------------------------------------------------------------------------------------------------------------- - - @SuppressWarnings("unchecked") - public static final EntityType ET_CHAIR = (EntityType)( - EntityType.Builder - .create(EdChair.EntityChair::new, EntityClassification.MISC) - .immuneToFire().size(1e-3f, 1e-3f).disableSerialization() - .setShouldReceiveVelocityUpdates(false).setUpdateInterval(4) - .setCustomClientFactory(EdChair.EntityChair::customClientFactory) - .build(new ResourceLocation(MODID, "et_chair").toString()) - .setRegistryName(new ResourceLocation(MODID, "et_chair")) - ); - - private static final EntityType entity_types[] = { - ET_CHAIR - }; - - //-------------------------------------------------------------------------------------------------------------------- - // Container registration - //-------------------------------------------------------------------------------------------------------------------- - - public static final ContainerType CT_TREATED_WOOD_CRAFTING_TABLE; - public static final ContainerType CT_FACTORY_DROPPER; - public static final ContainerType CT_FACTORY_PLACER; - public static final ContainerType CT_FACTORY_HOPPER; - public static final ContainerType CT_SMALL_LAB_FURNACE; - public static final ContainerType CT_SMALL_ELECTRICAL_FURNACE; - public static final ContainerType CT_WASTE_INCINERATOR; - public static final ContainerType CT_LABELED_CRATE; - - static { - CT_TREATED_WOOD_CRAFTING_TABLE = (new ContainerType(EdCraftingTable.CraftingTableContainer::new)); - CT_TREATED_WOOD_CRAFTING_TABLE.setRegistryName(MODID,"ct_treated_wood_crafting_table"); - CT_FACTORY_DROPPER = (new ContainerType(EdDropper.DropperContainer::new)); - CT_FACTORY_DROPPER.setRegistryName(MODID,"ct_factory_dropper"); - CT_FACTORY_PLACER = (new ContainerType(EdPlacer.PlacerContainer::new)); - CT_FACTORY_PLACER.setRegistryName(MODID,"ct_factory_placer"); - CT_FACTORY_HOPPER = (new ContainerType(EdHopper.HopperContainer::new)); - CT_FACTORY_HOPPER.setRegistryName(MODID,"ct_factory_hopper"); - CT_SMALL_LAB_FURNACE = (new ContainerType(FurnaceContainer::new)); - CT_SMALL_LAB_FURNACE.setRegistryName(MODID,"ct_small_lab_furnace"); - CT_SMALL_ELECTRICAL_FURNACE = (new ContainerType(EdElectricalFurnace.ElectricalFurnaceContainer::new)); - CT_SMALL_ELECTRICAL_FURNACE.setRegistryName(MODID,"ct_small_electrical_furnace"); - CT_WASTE_INCINERATOR = (new ContainerType(EdWasteIncinerator.WasteIncineratorContainer::new)); - CT_WASTE_INCINERATOR.setRegistryName(MODID,"ct_small_waste_incinerator"); - CT_LABELED_CRATE = (new ContainerType(EdLabeledCrate.LabeledCrateContainer::new)); - CT_LABELED_CRATE.setRegistryName(MODID,"ct_labeled_crate"); - } - - private static final ContainerType container_types[] = { - CT_TREATED_WOOD_CRAFTING_TABLE, - CT_LABELED_CRATE, - CT_FACTORY_DROPPER, - CT_FACTORY_PLACER, - CT_FACTORY_HOPPER, - CT_SMALL_LAB_FURNACE, - CT_SMALL_ELECTRICAL_FURNACE, - CT_WASTE_INCINERATOR - }; - - //-------------------------------------------------------------------------------------------------------------------- - // Initialisation events - //-------------------------------------------------------------------------------------------------------------------- - - private static ArrayList registeredBlocks = new ArrayList<>(); - - public static ArrayList allBlocks() - { - ArrayList blocks = new ArrayList<>(); - Collections.addAll(blocks, modBlocks); - Collections.addAll(blocks, devBlocks); - return blocks; - } - - @SuppressWarnings("deprecation") - public static boolean isExperimentalBlock(Block block) - { return ArrayUtils.contains(devBlocks, block) || ((block instanceof IDecorBlock) && ((((IDecorBlock)block).config() & DecorBlock.CFG_EXPERIMENTAL))!=0); } - - @Nonnull - public static List getRegisteredBlocks() - { return Collections.unmodifiableList(registeredBlocks); } - - @Nonnull - public static List getRegisteredItems() - { return new ArrayList<>(); } - - public static final void registerBlocks(final RegistryEvent.Register event) - { - boolean ie_available = Auxiliaries.isModLoaded("immersiveengineering"); - if(ie_available) { - Auxiliaries.logInfo("Immersive Engineering also installed ..."); - registeredBlocks.addAll(allBlocks()); - } else { - registeredBlocks.addAll(allBlocks().stream() - .filter(block-> - ((!(block instanceof IDecorBlock)) || ((((IDecorBlock)block).config() & DecorBlock.CFG_HARD_IE_DEPENDENT)==0)) - ) - .collect(Collectors.toList()) - ); - } - for(Block e:registeredBlocks) event.getRegistry().register(e); - Auxiliaries.logInfo("Registered " + Integer.toString(registeredBlocks.size()) + " blocks."); - } - - public static final void registerBlockItems(final RegistryEvent.Register event) - { - int n = 0; - for(Block e:registeredBlocks) { - ResourceLocation rl = e.getRegistryName(); - if(rl == null) continue; - if(e instanceof StandardBlocks.IBlockItemFactory) { - event.getRegistry().register(((StandardBlocks.IBlockItemFactory)e).getBlockItem(e, (new BlockItem.Properties().group(ModEngineersDecor.ITEMGROUP))).setRegistryName(rl)); - } else { - event.getRegistry().register(new BlockItem(e, (new BlockItem.Properties().group(ModEngineersDecor.ITEMGROUP))).setRegistryName(rl)); - } - ++n; - } - } - - public static final void registerItems(final RegistryEvent.Register event) - { for(Item e:modItems) event.getRegistry().register(e); } - - public static final void registerTileEntities(final RegistryEvent.Register> event) - { - int n_registered = 0; - for(final TileEntityType e:tile_entity_types) { - event.getRegistry().register(e); - ++n_registered; - } - Auxiliaries.logInfo("Registered " + Integer.toString(n_registered) + " tile entities."); - } - - public static final void registerEntities(final RegistryEvent.Register> event) - { - int n_registered = 0; - for(final EntityType e:entity_types) { - if((e==ET_CHAIR) && (!registeredBlocks.contains(TREATED_WOOD_STOOL))) continue; - event.getRegistry().register(e); - ++n_registered; - } - Auxiliaries.logInfo("Registered " + Integer.toString(n_registered) + " entities bound to blocks."); - } - - public static final void registerContainers(final RegistryEvent.Register> event) - { - int n_registered = 0; - for(final ContainerType e:container_types) { - event.getRegistry().register(e); - ++n_registered; - } - Auxiliaries.logInfo("Registered " + Integer.toString(n_registered) + " containers bound to tile entities."); - } - - @OnlyIn(Dist.CLIENT) - public static final void registerContainerGuis(final FMLClientSetupEvent event) - { - ScreenManager.registerFactory(CT_TREATED_WOOD_CRAFTING_TABLE, EdCraftingTable.CraftingTableGui::new); - ScreenManager.registerFactory(CT_LABELED_CRATE, EdLabeledCrate.LabeledCrateGui::new); - ScreenManager.registerFactory(CT_FACTORY_DROPPER, EdDropper.DropperGui::new); - ScreenManager.registerFactory(CT_FACTORY_PLACER, EdPlacer.PlacerGui::new); - ScreenManager.registerFactory(CT_FACTORY_HOPPER, EdHopper.HopperGui::new); - ScreenManager.registerFactory(CT_SMALL_LAB_FURNACE, FurnaceGui::new); - ScreenManager.registerFactory(CT_SMALL_ELECTRICAL_FURNACE, EdElectricalFurnace.ElectricalFurnaceGui::new); - ScreenManager.registerFactory(CT_WASTE_INCINERATOR, EdWasteIncinerator.WasteIncineratorGui::new); - } - - @OnlyIn(Dist.CLIENT) - @SuppressWarnings("unchecked") - public static final void registerTileEntityRenderers(final FMLClientSetupEvent event) - { - ClientRegistry.bindTileEntityRenderer( - (TileEntityType)TET_CRAFTING_TABLE, - wile.engineersdecor.detail.ModRenderers.CraftingTableTer::new - ); - ClientRegistry.bindTileEntityRenderer( - (TileEntityType)TET_LABELED_CRATE, - wile.engineersdecor.detail.ModRenderers.DecorLabeledCrateTer::new - ); - } - - @OnlyIn(Dist.CLIENT) - public static final void processContentClientSide(final FMLClientSetupEvent event) - { - // Block renderer selection - for(Block block: getRegisteredBlocks()) { - if(block instanceof IStandardBlock) { - switch(((IStandardBlock)block).getRenderTypeHint()) { - case CUTOUT: - RenderTypeLookup.setRenderLayer(block, RenderType.getCutout()); - break; - case CUTOUT_MIPPED: - RenderTypeLookup.setRenderLayer(block, RenderType.getCutoutMipped()); - break; - case TRANSLUCENT: - RenderTypeLookup.setRenderLayer(block, RenderType.getTranslucent()); - break; - case TRANSLUCENT_NO_CRUMBLING: - RenderTypeLookup.setRenderLayer(block, RenderType.getTranslucentNoCrumbling()); - break; - case SOLID: - break; - } - } - } - // Entity renderers - RenderingRegistry.registerEntityRenderingHandler(ET_CHAIR, - manager->(new wile.engineersdecor.detail.ModRenderers.InvisibleEntityRenderer(manager)) - ); - } - -} +/* + * @file ModContent.java + * @author Stefan Wilhelm (wile) + * @copyright (C) 2020 Stefan Wilhelm + * @license MIT (see https://opensource.org/licenses/MIT) + * + * Definition and initialisation of blocks of this + * module, along with their tile entities if applicable. + * + * Note: Straight forward definition of different blocks/entities + * to make recipes, models and texture definitions easier. + */ +package wile.engineersdecor; + +import net.minecraft.block.BlockState; +import net.minecraft.util.SoundEvents; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.shapes.IBooleanFunction; +import net.minecraft.world.IBlockReader; +import net.minecraft.block.material.MaterialColor; +import net.minecraft.block.Block; +import net.minecraft.block.SoundType; +import net.minecraft.block.material.Material; +import net.minecraft.tileentity.TileEntityType; +import net.minecraft.item.Item; +import net.minecraft.item.BlockItem; +import net.minecraft.entity.EntityClassification; +import net.minecraft.entity.EntityType; +import net.minecraft.inventory.container.ContainerType; +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.Direction; +import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.math.shapes.VoxelShape; +import net.minecraft.util.math.shapes.VoxelShapes; +import net.minecraft.client.renderer.RenderType; +import net.minecraft.client.renderer.RenderTypeLookup; +import net.minecraft.client.gui.ScreenManager; +import net.minecraftforge.common.ToolType; +import net.minecraftforge.event.RegistryEvent; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; +import net.minecraftforge.fml.client.registry.RenderingRegistry; +import net.minecraftforge.fml.client.registry.ClientRegistry; +import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent; +import org.apache.commons.lang3.ArrayUtils; +import wile.engineersdecor.blocks.*; +import wile.engineersdecor.blocks.EdFurnace.FurnaceBlock; +import wile.engineersdecor.blocks.EdFurnace.FurnaceContainer; +import wile.engineersdecor.blocks.EdFurnace.FurnaceGui; +import wile.engineersdecor.blocks.EdFurnace.FurnaceTileEntity; +import wile.engineersdecor.items.EdItem; +import wile.engineersdecor.libmc.blocks.StandardBlocks; +import wile.engineersdecor.libmc.blocks.StandardBlocks.IStandardBlock; +import wile.engineersdecor.libmc.detail.Auxiliaries; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.stream.Collectors; +import java.util.Collections; +import javax.annotation.Nonnull; + + +import net.minecraft.block.AbstractBlock; + +@SuppressWarnings("unused") +public class ModContent +{ + private static final String MODID = ModEngineersDecor.MODID; + + //-------------------------------------------------------------------------------------------------------------------- + + private static Boolean disallowSpawn(BlockState state, IBlockReader reader, BlockPos pos, EntityType entity) { return false; } + + //-------------------------------------------------------------------------------------------------------------------- + // Blocks + //-------------------------------------------------------------------------------------------------------------------- + + public static final DecorBlock.Normal CLINKER_BRICK_BLOCK = (DecorBlock.Normal)(new DecorBlock.Normal( + DecorBlock.CFG_DEFAULT, + AbstractBlock.Properties.of(Material.STONE, MaterialColor.STONE).strength(3f, 10f).sound(SoundType.STONE) + )).setRegistryName(new ResourceLocation(MODID, "clinker_brick_block")); + + public static final EdSlabBlock CLINKER_BRICK_SLAB = (EdSlabBlock)(new EdSlabBlock( + DecorBlock.CFG_DEFAULT, + AbstractBlock.Properties.of(Material.STONE, MaterialColor.STONE).strength(3f, 10f).sound(SoundType.STONE) + )).setRegistryName(new ResourceLocation(MODID, "clinker_brick_slab")); + + public static final EdStairsBlock CLINKER_BRICK_STAIRS = (EdStairsBlock)(new EdStairsBlock( + DecorBlock.CFG_DEFAULT, + CLINKER_BRICK_BLOCK.defaultBlockState(), + AbstractBlock.Properties.of(Material.STONE, MaterialColor.STONE).strength(3f, 10f).sound(SoundType.STONE) + )).setRegistryName(new ResourceLocation(MODID, "clinker_brick_stairs")); + + public static final EdWallBlock CLINKER_BRICK_WALL = (EdWallBlock)(new EdWallBlock( + DecorBlock.CFG_DEFAULT, + AbstractBlock.Properties.of(Material.STONE, MaterialColor.STONE).strength(3f, 10f).sound(SoundType.STONE) + )).setRegistryName(new ResourceLocation(MODID, "clinker_brick_wall")); + + public static final DecorBlock.Normal CLINKER_BRICK_STAINED_BLOCK = (DecorBlock.Normal)(new DecorBlock.Normal( + DecorBlock.CFG_DEFAULT, + AbstractBlock.Properties.of(Material.STONE, MaterialColor.STONE).strength(3f, 10f).sound(SoundType.STONE) + )).setRegistryName(new ResourceLocation(MODID, "clinker_brick_stained_block")); + + public static final EdSlabBlock CLINKER_BRICK_STAINED_SLAB = (EdSlabBlock)(new EdSlabBlock( + DecorBlock.CFG_DEFAULT, + AbstractBlock.Properties.of(Material.STONE, MaterialColor.STONE).strength(3f, 10f).sound(SoundType.STONE) + )).setRegistryName(new ResourceLocation(MODID, "clinker_brick_stained_slab")); + + public static final EdStairsBlock CLINKER_BRICK_STAINED_STAIRS = (EdStairsBlock)(new EdStairsBlock( + DecorBlock.CFG_DEFAULT, + CLINKER_BRICK_BLOCK.defaultBlockState(), + AbstractBlock.Properties.of(Material.STONE, MaterialColor.STONE).strength(3f, 10f).sound(SoundType.STONE) + )).setRegistryName(new ResourceLocation(MODID, "clinker_brick_stained_stairs")); + + public static final EdCornerOrnamentedBlock CLINKER_BRICK_SASTOR_CORNER = (EdCornerOrnamentedBlock)(new EdCornerOrnamentedBlock( + DecorBlock.CFG_DEFAULT, + AbstractBlock.Properties.of(Material.STONE, MaterialColor.STONE).strength(3f, 10f).sound(SoundType.STONE), + new Block[]{CLINKER_BRICK_BLOCK, CLINKER_BRICK_STAINED_BLOCK, CLINKER_BRICK_SLAB, CLINKER_BRICK_STAIRS, CLINKER_BRICK_STAINED_SLAB, CLINKER_BRICK_STAINED_STAIRS} + )).setRegistryName(new ResourceLocation(MODID, "clinker_brick_sastor_corner_block")); + + public static final DecorBlock.HorizontalWaterLoggable CLINKER_BRICK_RECESSED = (DecorBlock.HorizontalWaterLoggable)(new DecorBlock.HorizontalWaterLoggable( + DecorBlock.CFG_CUTOUT|DecorBlock.CFG_HORIZIONTAL|DecorBlock.CFG_LOOK_PLACEMENT, + AbstractBlock.Properties.of(Material.STONE, MaterialColor.STONE).strength(3f, 10f).sound(SoundType.STONE), + new AxisAlignedBB[] { + Auxiliaries.getPixeledAABB( 3,0, 0, 13,16, 1), + Auxiliaries.getPixeledAABB( 0,0, 1, 16,16,11), + Auxiliaries.getPixeledAABB( 4,0,11, 12,16,13) + } + )).setRegistryName(new ResourceLocation(MODID, "clinker_brick_recessed")); + + public static final DecorBlock.HorizontalWaterLoggable CLINKER_BRICK_SASTOR_VERTICAL_SLOTTED = (DecorBlock.HorizontalWaterLoggable)(new DecorBlock.HorizontalWaterLoggable( + DecorBlock.CFG_CUTOUT|DecorBlock.CFG_HORIZIONTAL|DecorBlock.CFG_LOOK_PLACEMENT, + AbstractBlock.Properties.of(Material.STONE, MaterialColor.STONE).strength(3f, 10f).sound(SoundType.STONE), + new AxisAlignedBB[] { + Auxiliaries.getPixeledAABB( 3,0, 0, 13,16, 1), + Auxiliaries.getPixeledAABB( 3,0,15, 13,16,16), + Auxiliaries.getPixeledAABB( 0,0, 1, 16,16,15) + } + )).setRegistryName(new ResourceLocation(MODID, "clinker_brick_vertically_slit")); + + public static final DecorBlock.HorizontalWaterLoggable CLINKER_BRICK_VERTICAL_SLAB_STRUCTURED = (DecorBlock.HorizontalWaterLoggable)(new DecorBlock.HorizontalWaterLoggable( + DecorBlock.CFG_CUTOUT|DecorBlock.CFG_HORIZIONTAL|DecorBlock.CFG_LOOK_PLACEMENT, + AbstractBlock.Properties.of(Material.STONE, MaterialColor.STONE).strength(3f, 10f).sound(SoundType.STONE), + new AxisAlignedBB[] { + Auxiliaries.getPixeledAABB( 0,0, 0, 16,16, 8), + } + )).setRegistryName(new ResourceLocation(MODID, "clinker_brick_vertical_slab_structured")); + + // ------------------------------------------------------------------------------------------------------------------- + + public static final DecorBlock.Normal SLAG_BRICK_BLOCK = (DecorBlock.Normal)(new DecorBlock.Normal( + DecorBlock.CFG_DEFAULT, + AbstractBlock.Properties.of(Material.STONE, MaterialColor.STONE).strength(3f, 10f).sound(SoundType.STONE) + )).setRegistryName(new ResourceLocation(MODID, "slag_brick_block")); + + public static final EdSlabBlock SLAG_BRICK_SLAB = (EdSlabBlock)(new EdSlabBlock( + DecorBlock.CFG_DEFAULT, + AbstractBlock.Properties.of(Material.STONE, MaterialColor.STONE).strength(3f, 10f).sound(SoundType.STONE) + )).setRegistryName(new ResourceLocation(MODID, "slag_brick_slab")); + + public static final EdStairsBlock SLAG_BRICK_STAIRS = (EdStairsBlock)(new EdStairsBlock( + DecorBlock.CFG_DEFAULT, + SLAG_BRICK_BLOCK.defaultBlockState(), + AbstractBlock.Properties.of(Material.STONE, MaterialColor.STONE).strength(3f, 10f).sound(SoundType.STONE) + )).setRegistryName(new ResourceLocation(MODID, "slag_brick_stairs")); + + public static final EdWallBlock SLAG_BRICK_WALL = (EdWallBlock)(new EdWallBlock( + DecorBlock.CFG_DEFAULT, + AbstractBlock.Properties.of(Material.STONE, MaterialColor.STONE).strength(3f, 10f).sound(SoundType.STONE) + )).setRegistryName(new ResourceLocation(MODID, "slag_brick_wall")); + + // ------------------------------------------------------------------------------------------------------------------- + + public static final DecorBlock.Normal REBAR_CONCRETE_BLOCK = (DecorBlock.Normal)(new DecorBlock.Normal( + DecorBlock.CFG_DEFAULT, + AbstractBlock.Properties.of(Material.STONE, MaterialColor.STONE).strength(5f, 2000f).sound(SoundType.STONE).isValidSpawn(ModContent::disallowSpawn) + )).setRegistryName(new ResourceLocation(MODID, "rebar_concrete")); + + public static final EdSlabBlock REBAR_CONCRETE_SLAB = (EdSlabBlock)(new EdSlabBlock( + DecorBlock.CFG_DEFAULT, + AbstractBlock.Properties.of(Material.STONE, MaterialColor.STONE).strength(5f, 2000f).sound(SoundType.STONE).isValidSpawn(ModContent::disallowSpawn) + )).setRegistryName(new ResourceLocation(MODID, "rebar_concrete_slab")); + + public static final EdStairsBlock REBAR_CONCRETE_STAIRS = (EdStairsBlock)(new EdStairsBlock( + DecorBlock.CFG_DEFAULT, + REBAR_CONCRETE_BLOCK.defaultBlockState(), + AbstractBlock.Properties.of(Material.STONE, MaterialColor.STONE).strength(5f, 2000f).sound(SoundType.STONE).isValidSpawn(ModContent::disallowSpawn) + )).setRegistryName(new ResourceLocation(MODID, "rebar_concrete_stairs")); + + public static final EdWallBlock REBAR_CONCRETE_WALL = (EdWallBlock)(new EdWallBlock( + DecorBlock.CFG_DEFAULT, + AbstractBlock.Properties.of(Material.STONE, MaterialColor.STONE).strength(5f, 2000f).sound(SoundType.STONE).isValidSpawn(ModContent::disallowSpawn) + )).setRegistryName(new ResourceLocation(MODID, "rebar_concrete_wall")); + + public static final EdSlabSliceBlock HALFSLAB_REBARCONCRETE = (EdSlabSliceBlock)(new EdSlabSliceBlock( + DecorBlock.CFG_CUTOUT, + AbstractBlock.Properties.of(Material.STONE, MaterialColor.STONE).strength(5f, 2000f).sound(SoundType.STONE).isValidSpawn(ModContent::disallowSpawn) + )).setRegistryName(new ResourceLocation(MODID, "halfslab_rebar_concrete")); + + // ------------------------------------------------------------------------------------------------------------------- + + public static final DecorBlock.Normal GAS_CONCRETE_BLOCK = (DecorBlock.Normal)(new DecorBlock.Normal( + DecorBlock.CFG_DEFAULT, + AbstractBlock.Properties.of(Material.STONE, MaterialColor.STONE).strength(1.5f, 10f).sound(SoundType.STONE).isValidSpawn(ModContent::disallowSpawn) + )).setRegistryName(new ResourceLocation(MODID, "gas_concrete")); + + public static final EdSlabBlock GAS_CONCRETE_SLAB = (EdSlabBlock)(new EdSlabBlock( + DecorBlock.CFG_DEFAULT, + AbstractBlock.Properties.of(Material.STONE, MaterialColor.STONE).strength(1.5f, 10f).sound(SoundType.STONE).isValidSpawn(ModContent::disallowSpawn) + )).setRegistryName(new ResourceLocation(MODID, "gas_concrete_slab")); + + public static final EdStairsBlock GAS_CONCRETE_STAIRS = (EdStairsBlock)(new EdStairsBlock( + DecorBlock.CFG_DEFAULT, + REBAR_CONCRETE_BLOCK.defaultBlockState(), + AbstractBlock.Properties.of(Material.STONE, MaterialColor.STONE).strength(1.5f, 10f).sound(SoundType.STONE).isValidSpawn(ModContent::disallowSpawn) + )).setRegistryName(new ResourceLocation(MODID, "gas_concrete_stairs")); + + public static final EdWallBlock GAS_CONCRETE_WALL = (EdWallBlock)(new EdWallBlock( + DecorBlock.CFG_DEFAULT, + AbstractBlock.Properties.of(Material.STONE, MaterialColor.STONE).strength(1.5f, 10f).sound(SoundType.STONE).isValidSpawn(ModContent::disallowSpawn) + )).setRegistryName(new ResourceLocation(MODID, "gas_concrete_wall")); + + public static final EdSlabSliceBlock HALFSLAB_GASCONCRETE = (EdSlabSliceBlock)(new EdSlabSliceBlock( + DecorBlock.CFG_CUTOUT, + AbstractBlock.Properties.of(Material.STONE, MaterialColor.STONE).strength(1.5f, 10f).sound(SoundType.STONE).isValidSpawn(ModContent::disallowSpawn) + )).setRegistryName(new ResourceLocation(MODID, "halfslab_gas_concrete")); + + // ------------------------------------------------------------------------------------------------------------------- + + public static final DecorBlock.Normal REBAR_CONCRETE_TILE = (DecorBlock.Normal)(new DecorBlock.Normal( + DecorBlock.CFG_DEFAULT, + AbstractBlock.Properties.of(Material.STONE, MaterialColor.STONE).strength(5f, 2000f).sound(SoundType.STONE).isValidSpawn(ModContent::disallowSpawn) + )).setRegistryName(new ResourceLocation(MODID, "rebar_concrete_tile")); + + public static final EdSlabBlock REBAR_CONCRETE_TILE_SLAB = (EdSlabBlock)(new EdSlabBlock( + DecorBlock.CFG_DEFAULT, + AbstractBlock.Properties.of(Material.STONE, MaterialColor.STONE).strength(5f, 2000f).sound(SoundType.STONE).isValidSpawn(ModContent::disallowSpawn) + )).setRegistryName(new ResourceLocation(MODID, "rebar_concrete_tile_slab")); + + public static final EdStairsBlock REBAR_CONCRETE_TILE_STAIRS = (EdStairsBlock)(new EdStairsBlock( + DecorBlock.CFG_DEFAULT, + REBAR_CONCRETE_TILE.defaultBlockState(), + AbstractBlock.Properties.of(Material.STONE, MaterialColor.STONE).strength(5f, 2000f).sound(SoundType.STONE).isValidSpawn(ModContent::disallowSpawn) + )).setRegistryName(new ResourceLocation(MODID, "rebar_concrete_tile_stairs")); + + // ------------------------------------------------------------------------------------------------------------------- + + public static final EdGlassBlock PANZERGLASS_BLOCK = (EdGlassBlock)(new EdGlassBlock( + DecorBlock.CFG_TRANSLUCENT, + AbstractBlock.Properties.of(Material.GLASS, MaterialColor.NONE).strength(0.7f, 2000f).sound(SoundType.METAL).noOcclusion().isValidSpawn(ModContent::disallowSpawn) + )).setRegistryName(new ResourceLocation(MODID, "panzerglass_block")); + + public static final EdSlabBlock PANZERGLASS_SLAB = (EdSlabBlock)(new EdSlabBlock( + DecorBlock.CFG_TRANSLUCENT, + AbstractBlock.Properties.of(Material.METAL, MaterialColor.METAL).strength(0.7f, 2000f).sound(SoundType.METAL).noOcclusion().isValidSpawn(ModContent::disallowSpawn) + )).setRegistryName(new ResourceLocation(MODID, "panzerglass_slab")); + + // ------------------------------------------------------------------------------------------------------------------- + + public static final EdRoofBlock DARK_CERAMIC_SHINGLE_ROOF = (EdRoofBlock)(new EdRoofBlock( + DecorBlock.CFG_CUTOUT, + AbstractBlock.Properties.of(Material.STONE, MaterialColor.STONE).strength(2f, 6f).sound(SoundType.STONE).noOcclusion().dynamicShape().isValidSpawn(ModContent::disallowSpawn) + )).setRegistryName(new ResourceLocation(MODID, "dark_shingle_roof")); + + public static final EdRoofBlock DARK_CERAMIC_SHINGLE_ROOF_METALIZED = (EdRoofBlock)(new EdRoofBlock( + DecorBlock.CFG_CUTOUT, + AbstractBlock.Properties.of(Material.STONE, MaterialColor.STONE).strength(2f, 6f).sound(SoundType.STONE).noOcclusion().dynamicShape().isValidSpawn(ModContent::disallowSpawn) + )).setRegistryName(new ResourceLocation(MODID, "dark_shingle_roof_metallized")); + + public static final EdRoofBlock DARK_CERAMIC_SHINGLE_ROOF_SKYLIGHT = (EdRoofBlock)(new EdRoofBlock( + DecorBlock.CFG_TRANSLUCENT, + AbstractBlock.Properties.of(Material.STONE, MaterialColor.STONE).strength(2f, 6f).sound(SoundType.STONE).noOcclusion().dynamicShape().isValidSpawn(ModContent::disallowSpawn) + )).setRegistryName(new ResourceLocation(MODID, "dark_shingle_roof_skylight")); + + public static final EdChimneyTrunkBlock DARK_CERAMIC_SHINGLE_ROOF_CHIMNEYTRUNK = (EdChimneyTrunkBlock)(new EdChimneyTrunkBlock( + DecorBlock.CFG_CUTOUT, + AbstractBlock.Properties.of(Material.STONE, MaterialColor.STONE).strength(2f, 6f).sound(SoundType.STONE).noOcclusion().dynamicShape().isValidSpawn(ModContent::disallowSpawn), + VoxelShapes.create(Auxiliaries.getPixeledAABB(3, 0, 3, 13, 16, 13)), + VoxelShapes.create(Auxiliaries.getPixeledAABB(5, 0, 5, 11, 16, 11)) + )).setRegistryName(new ResourceLocation(MODID, "dark_shingle_roof_chimneytrunk")); + + public static final EdChimneyTrunkBlock DARK_CERAMIC_SHINGLE_ROOF_WIRECONDUIT = (EdChimneyTrunkBlock)(new EdChimneyTrunkBlock( + DecorBlock.CFG_CUTOUT, + AbstractBlock.Properties.of(Material.STONE, MaterialColor.STONE).strength(2f, 6f).sound(SoundType.STONE).noOcclusion().dynamicShape().isValidSpawn(ModContent::disallowSpawn), + VoxelShapes.join( + VoxelShapes.create(Auxiliaries.getPixeledAABB(3, 0, 3, 13, 13, 13)), + VoxelShapes.create(Auxiliaries.getPixeledAABB(5, 13, 5, 11, 16, 11)), + IBooleanFunction.OR + ), + VoxelShapes.join( + VoxelShapes.create(Auxiliaries.getPixeledAABB(5, 0, 5, 11, 15, 11)), + VoxelShapes.create(Auxiliaries.getPixeledAABB(7, 15, 7, 9, 16, 9)), + IBooleanFunction.OR + ) + )).setRegistryName(new ResourceLocation(MODID, "dark_shingle_roof_wireconduit")); + + public static final EdChimneyBlock DARK_CERAMIC_SHINGLE_ROOF_CHIMNEY = (EdChimneyBlock)(new EdChimneyBlock( + DecorBlock.CFG_CUTOUT|DecorBlock.CFG_AI_PASSABLE, + AbstractBlock.Properties.of(Material.STONE, MaterialColor.STONE).strength(5f, 6f).sound(SoundType.STONE).dynamicShape().isValidSpawn(ModContent::disallowSpawn), + Auxiliaries.getPixeledAABB(3, 0, 3, 13, 6, 13) + )).setRegistryName(new ResourceLocation(MODID, "dark_shingle_roof_chimney")); + + public static final DecorBlock.Normal DARK_CERAMIC_SHINGLE_ROOF_BLOCK = (DecorBlock.Normal)(new DecorBlock.Normal( + DecorBlock.CFG_DEFAULT, + AbstractBlock.Properties.of(Material.STONE, MaterialColor.STONE).strength(2f, 6f).sound(SoundType.STONE) + )).setRegistryName(new ResourceLocation(MODID, "dark_shingle_roof_block")); + + public static final EdSlabBlock DARK_CERAMIC_SHINGLE_ROOF_SLAB = (EdSlabBlock)(new EdSlabBlock( + DecorBlock.CFG_DEFAULT, + AbstractBlock.Properties.of(Material.STONE, MaterialColor.STONE).strength(2f, 6f).sound(SoundType.STONE) + )).setRegistryName(new ResourceLocation(MODID, "dark_shingle_roof_slab")); + + // ------------------------------------------------------------------------------------------------------------------- + + public static final EdGroundBlock DENSE_GRIT_SAND = (EdGroundBlock)(new EdGroundBlock( + DecorBlock.CFG_DEFAULT, + AbstractBlock.Properties.of(Material.DIRT, MaterialColor.DIRT).strength(0.5f, 3f).sound(SoundType.GRAVEL).harvestTool(ToolType.SHOVEL) + )).setRegistryName(new ResourceLocation(MODID, "dense_grit_sand_block")); + + public static final EdGroundBlock DENSE_GRIT_DIRT = (EdGroundBlock)(new EdGroundBlock( + DecorBlock.CFG_DEFAULT, + AbstractBlock.Properties.of(Material.DIRT, MaterialColor.DIRT).strength(0.5f, 3f).sound(SoundType.GRAVEL).harvestTool(ToolType.SHOVEL) + )).setRegistryName(new ResourceLocation(MODID, "dense_grit_dirt_block")); + + public static final EdSlabSliceBlock HALFSLAB_DARK_CERAMIC_SHINGLE_ROOF = (EdSlabSliceBlock)(new EdSlabSliceBlock( + DecorBlock.CFG_DEFAULT, + AbstractBlock.Properties.of(Material.STONE, MaterialColor.STONE).strength(2f, 15f).sound(SoundType.STONE) + )).setRegistryName(new ResourceLocation(MODID, "dark_shingle_roof_slabslice")); + + // ------------------------------------------------------------------------------------------------------------------- + + public static final EdLadderBlock METAL_RUNG_LADDER = (EdLadderBlock)(new EdLadderBlock( + DecorBlock.CFG_DEFAULT, + AbstractBlock.Properties.of(Material.METAL, MaterialColor.METAL).strength(1.0f, 8f).sound(SoundType.METAL).noOcclusion() + )).setRegistryName(new ResourceLocation(MODID, "metal_rung_ladder")); + + public static final EdLadderBlock METAL_RUNG_STEPS = (EdLadderBlock)(new EdLadderBlock( + DecorBlock.CFG_DEFAULT, + AbstractBlock.Properties.of(Material.METAL, MaterialColor.METAL).strength(1.0f, 8f).sound(SoundType.METAL).noOcclusion() + )).setRegistryName(new ResourceLocation(MODID, "metal_rung_steps")); + + public static final EdLadderBlock TREATED_WOOD_LADDER = (EdLadderBlock)(new EdLadderBlock( + DecorBlock.CFG_DEFAULT, + AbstractBlock.Properties.of(Material.WOOD, MaterialColor.WOOD).strength(1.0f, 8f).sound(SoundType.WOOD).noOcclusion() + )).setRegistryName(new ResourceLocation(MODID, "treated_wood_ladder")); + + public static final EdHatchBlock IRON_HATCH = (EdHatchBlock)(new EdHatchBlock( + DecorBlock.CFG_LOOK_PLACEMENT, + AbstractBlock.Properties.of(Material.METAL, MaterialColor.METAL).strength(2f, 2000f).sound(SoundType.METAL).noOcclusion(), + Auxiliaries.getPixeledAABB(0.5,1,0, 15.5,3,14), + Auxiliaries.getPixeledAABB(0.5,1,0, 15.5,14.,2) + )).setRegistryName(new ResourceLocation(MODID, "iron_hatch")); + + public static final EdDoorBlock METAL_SLIDING_DOOR = (EdDoorBlock)(new EdDoorBlock( + DecorBlock.CFG_TRANSLUCENT|DecorBlock.CFG_HORIZIONTAL, + AbstractBlock.Properties.of(Material.METAL, MaterialColor.METAL).strength(1.5f, 8f).sound(SoundType.METAL).noOcclusion(), + new AxisAlignedBB[]{ + Auxiliaries.getPixeledAABB(15, 0.0,6, 16,16.0,10), + Auxiliaries.getPixeledAABB( 0,15.5,6, 16,16.0,10), + }, + new AxisAlignedBB[]{ + Auxiliaries.getPixeledAABB(15, 0.0,6, 16,16.0,10), + Auxiliaries.getPixeledAABB( 0, 0.0,6, 16, 0.3,10), + }, + new AxisAlignedBB[]{ + Auxiliaries.getPixeledAABB( 0,0,7, 16,16,9) + }, + new AxisAlignedBB[]{ + Auxiliaries.getPixeledAABB( 0,0,7, 16,16,9) + }, + SoundEvents.IRON_DOOR_OPEN, SoundEvents.IRON_DOOR_CLOSE + )).setRegistryName(new ResourceLocation(MODID, "metal_sliding_door")); + + // ------------------------------------------------------------------------------------------------------------------- + + public static final DecorBlock.Normal OLD_INDUSTRIAL_PLANKS = (DecorBlock.Normal)(new DecorBlock.Normal( + DecorBlock.CFG_DEFAULT, + AbstractBlock.Properties.of(Material.WOOD, MaterialColor.WOOD).strength(1.5f, 6f).sound(SoundType.WOOD) + )).setRegistryName(new ResourceLocation(MODID, "old_industrial_wood_planks")); + + public static final EdSlabBlock OLD_INDUSTRIAL_SLAB = (EdSlabBlock)(new EdSlabBlock( + DecorBlock.CFG_DEFAULT, + AbstractBlock.Properties.of(Material.WOOD, MaterialColor.WOOD).strength(1.5f, 6f).sound(SoundType.WOOD) + )).setRegistryName(new ResourceLocation(MODID, "old_industrial_wood_slab")); + + public static final EdStairsBlock OLD_INDUSTRIAL_STAIRS = (EdStairsBlock)(new EdStairsBlock( + DecorBlock.CFG_DEFAULT, + OLD_INDUSTRIAL_PLANKS.defaultBlockState(), + AbstractBlock.Properties.of(Material.WOOD, MaterialColor.WOOD).strength(1.5f, 6f).sound(SoundType.WOOD) + )).setRegistryName(new ResourceLocation(MODID, "old_industrial_wood_stairs")); + + public static final EdSlabSliceBlock OLD_INDUSTRIAL_SLABSLICE = (EdSlabSliceBlock)(new EdSlabSliceBlock( + DecorBlock.CFG_CUTOUT, + AbstractBlock.Properties.of(Material.WOOD, MaterialColor.WOOD).strength(1.5f, 6f).sound(SoundType.WOOD).noOcclusion() + )).setRegistryName(new ResourceLocation(MODID, "old_industrial_wood_slabslice")); + + public static final EdDoorBlock OLD_INDUSTRIAL_WOOD_DOOR = (EdDoorBlock)(new EdDoorBlock( + DecorBlock.CFG_DEFAULT, + AbstractBlock.Properties.of(Material.WOOD, MaterialColor.WOOD).strength(1.5f, 6f).sound(SoundType.WOOD).noOcclusion(), + Auxiliaries.getPixeledAABB(15,0, 0, 16,16,16), + Auxiliaries.getPixeledAABB( 0,0,13, 16,16,16), + SoundEvents.WOODEN_DOOR_OPEN, SoundEvents.WOODEN_DOOR_CLOSE + )).setRegistryName(new ResourceLocation(MODID, "old_industrial_wood_door")); + + // ------------------------------------------------------------------------------------------------------------------- + + public static final DecorBlock.WaterLoggable TREATED_WOOD_TABLE = (DecorBlock.WaterLoggable)(new DecorBlock.WaterLoggable( + DecorBlock.CFG_CUTOUT, + AbstractBlock.Properties.of(Material.WOOD, MaterialColor.WOOD).strength(2f, 5f).sound(SoundType.WOOD).noOcclusion(), + Auxiliaries.getPixeledAABB(1,0,1, 15,15.9,15) + )).setRegistryName(new ResourceLocation(MODID, "treated_wood_table")); + + public static final EdChair.ChairBlock TREATED_WOOD_STOOL = (EdChair.ChairBlock)(new EdChair.ChairBlock( + DecorBlock.CFG_CUTOUT|DecorBlock.CFG_HORIZIONTAL|DecorBlock.CFG_LOOK_PLACEMENT, + AbstractBlock.Properties.of(Material.WOOD, MaterialColor.WOOD).strength(2f, 5f).sound(SoundType.WOOD).noOcclusion(), + new AxisAlignedBB[]{ + Auxiliaries.getPixeledAABB(4,7,4, 12,8.8,12), + Auxiliaries.getPixeledAABB(7,0,7, 9,7,9), + Auxiliaries.getPixeledAABB(4,0,7, 12,1,9), + Auxiliaries.getPixeledAABB(7,0,4, 9,1,12), + } + )).setRegistryName(new ResourceLocation(MODID, "treated_wood_stool")); + + public static final DecorBlock.WaterLoggable TREATED_WOOD_SIDE_TABLE = (DecorBlock.WaterLoggable)(new DecorBlock.WaterLoggable( + DecorBlock.CFG_CUTOUT|DecorBlock.CFG_HORIZIONTAL|DecorBlock.CFG_LOOK_PLACEMENT, + AbstractBlock.Properties.of(Material.WOOD, MaterialColor.WOOD).strength(2f, 5f).sound(SoundType.WOOD).noOcclusion(), + new AxisAlignedBB[]{ + Auxiliaries.getPixeledAABB( 2,15, 2, 14,16,14), + Auxiliaries.getPixeledAABB( 3,15, 1, 13,16, 2), + Auxiliaries.getPixeledAABB( 3,15,14, 13,16,15), + Auxiliaries.getPixeledAABB( 1,15, 3, 2,16,13), + Auxiliaries.getPixeledAABB(14,15, 3, 15,16,13), + Auxiliaries.getPixeledAABB( 3,14, 3, 13,15,13), + Auxiliaries.getPixeledAABB( 7, 3, 7, 9,12, 9), + Auxiliaries.getPixeledAABB( 2, 0, 7, 14, 1, 9), + Auxiliaries.getPixeledAABB( 7, 0, 2, 9, 1,14) + } + )).setRegistryName(new ResourceLocation(MODID, "treated_wood_side_table")); + + public static final DecorBlock.DirectedWaterLoggable TREATED_WOOD_WINDOWSILL = (DecorBlock.DirectedWaterLoggable)(new DecorBlock.DirectedWaterLoggable( + DecorBlock.CFG_CUTOUT|DecorBlock.CFG_HORIZIONTAL|DecorBlock.CFG_FACING_PLACEMENT|DecorBlock.CFG_AI_PASSABLE, + AbstractBlock.Properties.of(Material.WOOD, MaterialColor.WOOD).strength(2f, 5f).sound(SoundType.WOOD).noOcclusion(), + Auxiliaries.getPixeledAABB(0.5,15,10.5, 15.5,16,16) + )).setRegistryName(new ResourceLocation(MODID, "treated_wood_windowsill")); + + public static final DecorBlock.DirectedWaterLoggable TREATED_WOOD_BROAD_WINDOWSILL = (DecorBlock.DirectedWaterLoggable)(new DecorBlock.DirectedWaterLoggable( + DecorBlock.CFG_CUTOUT|DecorBlock.CFG_HORIZIONTAL|DecorBlock.CFG_FACING_PLACEMENT, + AbstractBlock.Properties.of(Material.WOOD, MaterialColor.WOOD).strength(2f, 5f).sound(SoundType.WOOD).noOcclusion(), + Auxiliaries.getPixeledAABB(0,14.5,4, 16,16,16) + )).setRegistryName(new ResourceLocation(MODID, "treated_wood_broad_windowsill")); + + // ------------------------------------------------------------------------------------------------------------------- + + public static final DecorBlock.DirectedWaterLoggable INSET_LIGHT_IRON = (DecorBlock.DirectedWaterLoggable)(new DecorBlock.DirectedWaterLoggable( + DecorBlock.CFG_CUTOUT|DecorBlock.CFG_FACING_PLACEMENT|DecorBlock.CFG_OPPOSITE_PLACEMENT|DecorBlock.CFG_AI_PASSABLE, + AbstractBlock.Properties.of(Material.METAL, MaterialColor.METAL).strength(2f, 8f).sound(SoundType.METAL).lightLevel((state)->15).noOcclusion(), + Auxiliaries.getPixeledAABB(5.2,5.2,0, 10.8,10.8,0.3) + )).setRegistryName(new ResourceLocation(MODID, "iron_inset_light")); + + public static final DecorBlock.DirectedWaterLoggable FLOOR_EDGE_LIGHT_IRON = (DecorBlock.DirectedWaterLoggable)(new DecorBlock.DirectedWaterLoggable( + DecorBlock.CFG_CUTOUT|DecorBlock.CFG_LOOK_PLACEMENT|DecorBlock.CFG_HORIZIONTAL|DecorBlock.CFG_AI_PASSABLE, + AbstractBlock.Properties.of(Material.METAL, MaterialColor.METAL).strength(2f, 8f).sound(SoundType.METAL).lightLevel((state)->15).noOcclusion(), + Auxiliaries.getPixeledAABB(5,0,0, 11,2,0.5) + )).setRegistryName(new ResourceLocation(MODID, "iron_floor_edge_light")); + + public static final DecorBlock.DirectedWaterLoggable CEILING_EDGE_LIGHT_IRON = (DecorBlock.DirectedWaterLoggable)(new DecorBlock.DirectedWaterLoggable( + DecorBlock.CFG_CUTOUT|DecorBlock.CFG_LOOK_PLACEMENT|DecorBlock.CFG_HORIZIONTAL|DecorBlock.CFG_AI_PASSABLE, + AbstractBlock.Properties.of(Material.METAL, MaterialColor.METAL).strength(2f, 8f).sound(SoundType.METAL).lightLevel((state)->15).noOcclusion(), + new AxisAlignedBB[]{ + Auxiliaries.getPixeledAABB( 0,15.5,0, 16,16,2.0), + Auxiliaries.getPixeledAABB( 0,14.0,0, 16,16,0.5), + Auxiliaries.getPixeledAABB( 0,14.0,0, 1,16,2.0), + Auxiliaries.getPixeledAABB(15,14.0,0, 16,16,2.0), + } + )).setRegistryName(new ResourceLocation(MODID, "iron_ceiling_edge_light")); + + public static final DecorBlock.DirectedWaterLoggable BULB_LIGHT_IRON = (DecorBlock.DirectedWaterLoggable)(new DecorBlock.DirectedWaterLoggable( + DecorBlock.CFG_CUTOUT|DecorBlock.CFG_FACING_PLACEMENT|DecorBlock.CFG_OPPOSITE_PLACEMENT|DecorBlock.CFG_AI_PASSABLE, + AbstractBlock.Properties.of(Material.METAL, MaterialColor.METAL).strength(2f, 8f).sound(SoundType.METAL).lightLevel((state)->15).noOcclusion(), + new AxisAlignedBB[]{ + Auxiliaries.getPixeledAABB(6.5,6.5,1, 9.5,9.5,4), + Auxiliaries.getPixeledAABB(6.0,6.0,0, 10.0,10.0,1.0) + } + )).setRegistryName(new ResourceLocation(MODID, "iron_bulb_light")); + + // ------------------------------------------------------------------------------------------------------------------- + + public static final DecorBlock.WaterLoggable STEEL_TABLE = (DecorBlock.WaterLoggable)(new DecorBlock.WaterLoggable( + DecorBlock.CFG_CUTOUT, + AbstractBlock.Properties.of(Material.METAL, MaterialColor.METAL).strength(2f, 8f).sound(SoundType.METAL).noOcclusion(), + Auxiliaries.getPixeledAABB(0,0,0, 16,16,16) + )).setRegistryName(new ResourceLocation(MODID, "steel_table")); + + public static final EdFloorGratingBlock STEEL_FLOOR_GRATING = (EdFloorGratingBlock)(new EdFloorGratingBlock( + DecorBlock.CFG_CUTOUT, + AbstractBlock.Properties.of(Material.METAL, MaterialColor.METAL).strength(2f, 8f).sound(SoundType.METAL).noOcclusion(), + Auxiliaries.getPixeledAABB(0,14,0, 16,15.5,16) + )).setRegistryName(new ResourceLocation(MODID, "steel_floor_grating")); + + // ------------------------------------------------------------------------------------------------------------------- + + public static final EdWindowBlock TREATED_WOOD_WINDOW = (EdWindowBlock)(new EdWindowBlock( + DecorBlock.CFG_LOOK_PLACEMENT, + AbstractBlock.Properties.of(Material.WOOD, MaterialColor.WOOD).strength(2f, 8f).sound(SoundType.WOOD).noOcclusion(), + Auxiliaries.getPixeledAABB(0,0,7, 16,16,9) + )).setRegistryName(new ResourceLocation(MODID, "treated_wood_window")); + + public static final EdWindowBlock STEEL_FRAMED_WINDOW = (EdWindowBlock)(new EdWindowBlock( + DecorBlock.CFG_LOOK_PLACEMENT, + AbstractBlock.Properties.of(Material.METAL, MaterialColor.METAL).strength(2f, 8f).sound(SoundType.METAL).noOcclusion(), + Auxiliaries.getPixeledAABB(0,0,7.5, 16,16,8.5) + )).setRegistryName(new ResourceLocation(MODID, "steel_framed_window")); + + // ------------------------------------------------------------------------------------------------------------------- + + public static final EdStraightPoleBlock TREATED_WOOD_POLE = (EdStraightPoleBlock)(new EdStraightPoleBlock( + DecorBlock.CFG_CUTOUT|DecorBlock.CFG_FACING_PLACEMENT|DecorBlock.CFG_FLIP_PLACEMENT_IF_SAME, + AbstractBlock.Properties.of(Material.WOOD, MaterialColor.WOOD).strength(2f, 5f).sound(SoundType.WOOD).noOcclusion(), + Auxiliaries.getPixeledAABB(5.8,5.8,0, 10.2,10.2,16), + null + )).setRegistryName(new ResourceLocation(MODID, "treated_wood_pole")); + + public static final EdStraightPoleBlock TREATED_WOOD_POLE_HEAD = (EdStraightPoleBlock)(new EdStraightPoleBlock( + DecorBlock.CFG_CUTOUT|DecorBlock.CFG_FACING_PLACEMENT|DecorBlock.CFG_FLIP_PLACEMENT_IF_SAME, + AbstractBlock.Properties.of(Material.WOOD, MaterialColor.WOOD).strength(2f, 5f).sound(SoundType.WOOD).noOcclusion(), + Auxiliaries.getPixeledAABB(5.8,5.8,0, 10.2,10.2,16), + TREATED_WOOD_POLE + )).setRegistryName(new ResourceLocation(MODID, "treated_wood_pole_head")); + + public static final EdStraightPoleBlock TREATED_WOOD_POLE_SUPPORT = (EdStraightPoleBlock)(new EdStraightPoleBlock( + DecorBlock.CFG_CUTOUT|DecorBlock.CFG_FACING_PLACEMENT|DecorBlock.CFG_FLIP_PLACEMENT_IF_SAME, + AbstractBlock.Properties.of(Material.WOOD, MaterialColor.WOOD).strength(2f, 5f).sound(SoundType.WOOD).noOcclusion(), + Auxiliaries.getPixeledAABB(5.8,5.8,0, 10.2,10.2,16), + TREATED_WOOD_POLE + )).setRegistryName(new ResourceLocation(MODID, "treated_wood_pole_support")); + + public static final EdStraightPoleBlock THIN_STEEL_POLE = (EdStraightPoleBlock)(new EdStraightPoleBlock( + DecorBlock.CFG_CUTOUT|DecorBlock.CFG_FACING_PLACEMENT, + AbstractBlock.Properties.of(Material.METAL, MaterialColor.METAL).strength(2f, 11f).sound(SoundType.METAL).noOcclusion(), + Auxiliaries.getPixeledAABB(6,6,0, 10,10,16), + null + )).setRegistryName(new ResourceLocation(MODID, "thin_steel_pole")); + + public static final EdStraightPoleBlock THIN_STEEL_POLE_HEAD = (EdStraightPoleBlock)(new EdStraightPoleBlock( + DecorBlock.CFG_CUTOUT|DecorBlock.CFG_FACING_PLACEMENT|DecorBlock.CFG_FLIP_PLACEMENT_IF_SAME, + AbstractBlock.Properties.of(Material.METAL, MaterialColor.METAL).strength(2f, 11f).sound(SoundType.METAL).noOcclusion(), + Auxiliaries.getPixeledAABB(6,6,0, 10,10,16), + THIN_STEEL_POLE + )).setRegistryName(new ResourceLocation(MODID, "thin_steel_pole_head")); + + public static final EdStraightPoleBlock THICK_STEEL_POLE = (EdStraightPoleBlock)(new EdStraightPoleBlock( + DecorBlock.CFG_CUTOUT|DecorBlock.CFG_FACING_PLACEMENT, + AbstractBlock.Properties.of(Material.METAL, MaterialColor.METAL).strength(2f, 11f).sound(SoundType.METAL).noOcclusion(), + Auxiliaries.getPixeledAABB(5,5,0, 11,11,16), + null + )).setRegistryName(new ResourceLocation(MODID, "thick_steel_pole")); + + public static final EdStraightPoleBlock THICK_STEEL_POLE_HEAD = (EdStraightPoleBlock)(new EdStraightPoleBlock( + DecorBlock.CFG_CUTOUT|DecorBlock.CFG_FACING_PLACEMENT|DecorBlock.CFG_FLIP_PLACEMENT_IF_SAME, + AbstractBlock.Properties.of(Material.METAL, MaterialColor.METAL).strength(2f, 11f).sound(SoundType.METAL).noOcclusion(), + Auxiliaries.getPixeledAABB(5,5,0, 11,11,16), + THICK_STEEL_POLE + )).setRegistryName(new ResourceLocation(MODID, "thick_steel_pole_head")); + + public static final EdHorizontalSupportBlock STEEL_DOUBLE_T_SUPPORT = (EdHorizontalSupportBlock)(new EdHorizontalSupportBlock( + DecorBlock.CFG_CUTOUT|DecorBlock.CFG_HORIZIONTAL|DecorBlock.CFG_LOOK_PLACEMENT, + AbstractBlock.Properties.of(Material.METAL, MaterialColor.METAL).strength(2f, 11f).sound(SoundType.METAL).noOcclusion(), + Auxiliaries.getPixeledAABB( 5,11,0, 11,16,16), // main beam + Auxiliaries.getPixeledAABB(10,11,5, 16,16,11), // east beam (also for west 180deg) + Auxiliaries.getPixeledAABB( 6, 0,6, 10,16,10), // down thin + Auxiliaries.getPixeledAABB( 5, 0,5, 11,16,11) // down thick + )).setRegistryName(new ResourceLocation(MODID, "steel_double_t_support")); + + // ------------------------------------------------------------------------------------------------------------------- + + public static final DecorBlock.DirectedWaterLoggable SIGN_MODLOGO = (DecorBlock.DirectedWaterLoggable)(new DecorBlock.DirectedWaterLoggable( + DecorBlock.CFG_CUTOUT|DecorBlock.CFG_FACING_PLACEMENT|DecorBlock.CFG_HORIZIONTAL|DecorBlock.CFG_AI_PASSABLE, + AbstractBlock.Properties.of(Material.WOOD, MaterialColor.WOOD).strength(1f, 1000f).sound(SoundType.WOOD).lightLevel((state)->1).noOcclusion(), + Auxiliaries.getPixeledAABB(0,0,15.6, 16,16,16.0) + )).setRegistryName(new ResourceLocation(MODID, "sign_decor")); + + public static final DecorBlock.DirectedWaterLoggable SIGN_HOTWIRE = (DecorBlock.DirectedWaterLoggable)(new DecorBlock.DirectedWaterLoggable( + DecorBlock.CFG_CUTOUT|DecorBlock.CFG_FACING_PLACEMENT|DecorBlock.CFG_HORIZIONTAL|DecorBlock.CFG_AI_PASSABLE, + AbstractBlock.Properties.of(Material.WOOD, MaterialColor.WOOD).strength(1f, 1f).sound(SoundType.WOOD).noOcclusion(), + Auxiliaries.getPixeledAABB(2,2,15.6, 14,14,16) + )).setRegistryName(new ResourceLocation(MODID, "sign_hotwire")); + + public static final DecorBlock.DirectedWaterLoggable SIGN_DANGER = (DecorBlock.DirectedWaterLoggable)(new DecorBlock.DirectedWaterLoggable( + DecorBlock.CFG_CUTOUT|DecorBlock.CFG_FACING_PLACEMENT|DecorBlock.CFG_HORIZIONTAL|DecorBlock.CFG_AI_PASSABLE, + AbstractBlock.Properties.of(Material.WOOD, MaterialColor.WOOD).strength(1f, 1f).sound(SoundType.WOOD).noOcclusion(), + Auxiliaries.getPixeledAABB(2,2,15.6, 14,14,16) + )).setRegistryName(new ResourceLocation(MODID, "sign_danger")); + + public static final DecorBlock.DirectedWaterLoggable SIGN_DEFENSE = (DecorBlock.DirectedWaterLoggable)(new DecorBlock.DirectedWaterLoggable( + DecorBlock.CFG_CUTOUT|DecorBlock.CFG_FACING_PLACEMENT|DecorBlock.CFG_HORIZIONTAL|DecorBlock.CFG_AI_PASSABLE, + AbstractBlock.Properties.of(Material.WOOD, MaterialColor.WOOD).strength(1f, 1f).sound(SoundType.WOOD).noOcclusion(), + Auxiliaries.getPixeledAABB(2,2,15.6, 14,14,16) + )).setRegistryName(new ResourceLocation(MODID, "sign_defense")); + + public static final DecorBlock.DirectedWaterLoggable SIGN_FACTORY_AREA = (DecorBlock.DirectedWaterLoggable)(new DecorBlock.DirectedWaterLoggable( + DecorBlock.CFG_CUTOUT|DecorBlock.CFG_FACING_PLACEMENT|DecorBlock.CFG_HORIZIONTAL|DecorBlock.CFG_AI_PASSABLE, + AbstractBlock.Properties.of(Material.WOOD, MaterialColor.WOOD).strength(1f, 1f).sound(SoundType.WOOD).noOcclusion(), + Auxiliaries.getPixeledAABB(2,2,15.6, 14,14,16) + )).setRegistryName(new ResourceLocation(MODID, "sign_factoryarea")); + + public static final DecorBlock.DirectedWaterLoggable SIGN_EXIT = (DecorBlock.DirectedWaterLoggable)(new DecorBlock.DirectedWaterLoggable( + DecorBlock.CFG_CUTOUT|DecorBlock.CFG_FACING_PLACEMENT|DecorBlock.CFG_HORIZIONTAL|DecorBlock.CFG_AI_PASSABLE, + AbstractBlock.Properties.of(Material.WOOD, MaterialColor.WOOD).strength(1f, 1f).sound(SoundType.WOOD).noOcclusion(), + Auxiliaries.getPixeledAABB(3,7,15.6, 13,13,16) + )).setRegistryName(new ResourceLocation(MODID, "sign_exit")); + + public static final DecorBlock.DirectedWaterLoggable SIGN_RADIOACTIVE = (DecorBlock.DirectedWaterLoggable)(new DecorBlock.DirectedWaterLoggable( + DecorBlock.CFG_CUTOUT|DecorBlock.CFG_FACING_PLACEMENT|DecorBlock.CFG_HORIZIONTAL|DecorBlock.CFG_AI_PASSABLE, + AbstractBlock.Properties.of(Material.WOOD, MaterialColor.WOOD).strength(1f, 1f).sound(SoundType.WOOD).noOcclusion(), + Auxiliaries.getPixeledAABB(2,2,15.6, 14,14,16) + )).setRegistryName(new ResourceLocation(MODID, "sign_radioactive")); + + public static final DecorBlock.DirectedWaterLoggable SIGN_LASER = (DecorBlock.DirectedWaterLoggable)(new DecorBlock.DirectedWaterLoggable( + DecorBlock.CFG_CUTOUT|DecorBlock.CFG_FACING_PLACEMENT|DecorBlock.CFG_HORIZIONTAL|DecorBlock.CFG_AI_PASSABLE, + AbstractBlock.Properties.of(Material.WOOD, MaterialColor.WOOD).strength(1f, 1f).sound(SoundType.WOOD).noOcclusion(), + Auxiliaries.getPixeledAABB(2,2,15.6, 14,14,16) + )).setRegistryName(new ResourceLocation(MODID, "sign_laser")); + + public static final DecorBlock.DirectedWaterLoggable SIGN_CAUTION = (DecorBlock.DirectedWaterLoggable)(new DecorBlock.DirectedWaterLoggable( + DecorBlock.CFG_CUTOUT|DecorBlock.CFG_FACING_PLACEMENT|DecorBlock.CFG_HORIZIONTAL|DecorBlock.CFG_AI_PASSABLE, + AbstractBlock.Properties.of(Material.WOOD, MaterialColor.WOOD).strength(1f, 1f).sound(SoundType.WOOD).noOcclusion(), + Auxiliaries.getPixeledAABB(2,2,15.6, 14,14,16) + )).setRegistryName(new ResourceLocation(MODID, "sign_caution")); + + public static final DecorBlock.DirectedWaterLoggable SIGN_MAGIC_HAZARD = (DecorBlock.DirectedWaterLoggable)(new DecorBlock.DirectedWaterLoggable( + DecorBlock.CFG_CUTOUT|DecorBlock.CFG_FACING_PLACEMENT|DecorBlock.CFG_HORIZIONTAL|DecorBlock.CFG_AI_PASSABLE, + AbstractBlock.Properties.of(Material.WOOD, MaterialColor.WOOD).strength(1f, 1f).sound(SoundType.WOOD).noOcclusion(), + Auxiliaries.getPixeledAABB(2,2,15.6, 14,14,16) + )).setRegistryName(new ResourceLocation(MODID, "sign_magichazard")); + + public static final DecorBlock.DirectedWaterLoggable SIGN_FIRE_HAZARD = (DecorBlock.DirectedWaterLoggable)(new DecorBlock.DirectedWaterLoggable( + DecorBlock.CFG_CUTOUT|DecorBlock.CFG_FACING_PLACEMENT|DecorBlock.CFG_HORIZIONTAL|DecorBlock.CFG_AI_PASSABLE, + AbstractBlock.Properties.of(Material.WOOD, MaterialColor.WOOD).strength(1f, 1f).sound(SoundType.WOOD).noOcclusion(), + Auxiliaries.getPixeledAABB(2,2,15.6, 14,14,16) + )).setRegistryName(new ResourceLocation(MODID, "sign_firehazard")); + + public static final DecorBlock.DirectedWaterLoggable SIGN_HOT_SURFACE = (DecorBlock.DirectedWaterLoggable)(new DecorBlock.DirectedWaterLoggable( + DecorBlock.CFG_CUTOUT|DecorBlock.CFG_FACING_PLACEMENT|DecorBlock.CFG_HORIZIONTAL|DecorBlock.CFG_AI_PASSABLE, + AbstractBlock.Properties.of(Material.WOOD, MaterialColor.WOOD).strength(1f, 1f).sound(SoundType.WOOD).noOcclusion(), + Auxiliaries.getPixeledAABB(2,2,15.6, 14,14,16) + )).setRegistryName(new ResourceLocation(MODID, "sign_hotsurface")); + + public static final DecorBlock.DirectedWaterLoggable SIGN_MAGNETIC_FIELD = (DecorBlock.DirectedWaterLoggable)(new DecorBlock.DirectedWaterLoggable( + DecorBlock.CFG_CUTOUT|DecorBlock.CFG_FACING_PLACEMENT|DecorBlock.CFG_HORIZIONTAL|DecorBlock.CFG_AI_PASSABLE, + AbstractBlock.Properties.of(Material.WOOD, MaterialColor.WOOD).strength(1f, 1f).sound(SoundType.WOOD).noOcclusion(), + Auxiliaries.getPixeledAABB(2,2,15.6, 14,14,16) + )).setRegistryName(new ResourceLocation(MODID, "sign_magneticfield")); + + public static final DecorBlock.DirectedWaterLoggable SIGN_FROST_WARNING = (DecorBlock.DirectedWaterLoggable)(new DecorBlock.DirectedWaterLoggable( + DecorBlock.CFG_CUTOUT|DecorBlock.CFG_FACING_PLACEMENT|DecorBlock.CFG_HORIZIONTAL|DecorBlock.CFG_AI_PASSABLE, + AbstractBlock.Properties.of(Material.WOOD, MaterialColor.WOOD).strength(1f, 1f).sound(SoundType.WOOD).noOcclusion(), + Auxiliaries.getPixeledAABB(2,2,15.6, 14,14,16) + )).setRegistryName(new ResourceLocation(MODID, "sign_frost")); + + // ------------------------------------------------------------------------------------------------------------------- + + public static final EdCraftingTable.CraftingTableBlock CRAFTING_TABLE = (EdCraftingTable.CraftingTableBlock)(new EdCraftingTable.CraftingTableBlock( + DecorBlock.CFG_CUTOUT|DecorBlock.CFG_HORIZIONTAL|DecorBlock.CFG_LOOK_PLACEMENT|DecorBlock.CFG_OPPOSITE_PLACEMENT, + AbstractBlock.Properties.of(Material.METAL, MaterialColor.METAL).strength(1f, 12f).sound(SoundType.METAL).noOcclusion(), + new AxisAlignedBB[]{ + Auxiliaries.getPixeledAABB(0,15,0, 16,16,16), + Auxiliaries.getPixeledAABB(1, 0,1, 15,16,15) + } + )).setRegistryName(new ResourceLocation(MODID, "metal_crafting_table")); + + public static final FurnaceBlock SMALL_LAB_FURNACE = (FurnaceBlock)(new FurnaceBlock( + DecorBlock.CFG_CUTOUT|DecorBlock.CFG_HORIZIONTAL|DecorBlock.CFG_LOOK_PLACEMENT|DecorBlock.CFG_OPPOSITE_PLACEMENT, + AbstractBlock.Properties.of(Material.METAL, MaterialColor.METAL).strength(1f, 12f).sound(SoundType.METAL).noOcclusion(), + new AxisAlignedBB[]{ + Auxiliaries.getPixeledAABB(1,0,1, 15, 1,15), + Auxiliaries.getPixeledAABB(0,1,1, 16,16,16), + } + )).setRegistryName(new ResourceLocation(MODID, "small_lab_furnace")); + + public static final EdElectricalFurnace.ElectricalFurnaceBlock SMALL_ELECTRICAL_FURNACE = (EdElectricalFurnace.ElectricalFurnaceBlock)(new EdElectricalFurnace.ElectricalFurnaceBlock( + DecorBlock.CFG_CUTOUT|DecorBlock.CFG_HORIZIONTAL|DecorBlock.CFG_LOOK_PLACEMENT|DecorBlock.CFG_OPPOSITE_PLACEMENT, + AbstractBlock.Properties.of(Material.METAL, MaterialColor.METAL).strength(2f, 12f).sound(SoundType.METAL).noOcclusion(), + new AxisAlignedBB[]{ + Auxiliaries.getPixeledAABB(0, 0,0, 16,11,16), + Auxiliaries.getPixeledAABB(1,11,0, 15,12,16), + Auxiliaries.getPixeledAABB(2,12,0, 14,13,16), + Auxiliaries.getPixeledAABB(3,13,0, 13,14,16), + Auxiliaries.getPixeledAABB(4,14,0, 12,16,16), + } + )).setRegistryName(new ResourceLocation(MODID, "small_electrical_furnace")); + + public static final EdDropper.DropperBlock FACTORY_DROPPER = (EdDropper.DropperBlock)(new EdDropper.DropperBlock( + DecorBlock.CFG_CUTOUT|DecorBlock.CFG_LOOK_PLACEMENT|DecorBlock.CFG_OPPOSITE_PLACEMENT, + AbstractBlock.Properties.of(Material.METAL, MaterialColor.METAL).strength(2f, 12f).sound(SoundType.METAL).noOcclusion(), + Auxiliaries.getPixeledAABB(0,0,1, 16,16,16) + )).setRegistryName(new ResourceLocation(MODID, "factory_dropper")); + + public static final EdPlacer.PlacerBlock FACTORY_PLACER = (EdPlacer.PlacerBlock)(new EdPlacer.PlacerBlock( + DecorBlock.CFG_CUTOUT|DecorBlock.CFG_LOOK_PLACEMENT|DecorBlock.CFG_FLIP_PLACEMENT_SHIFTCLICK|DecorBlock.CFG_OPPOSITE_PLACEMENT, + AbstractBlock.Properties.of(Material.METAL, MaterialColor.METAL).strength(2f, 12f).sound(SoundType.METAL).noOcclusion(), + new AxisAlignedBB[]{ + Auxiliaries.getPixeledAABB(0,0,2, 16,16,16), + Auxiliaries.getPixeledAABB( 0,0,0, 1,16, 2), + Auxiliaries.getPixeledAABB(15,0,0,16,16, 2) + } + )).setRegistryName(new ResourceLocation(MODID, "factory_placer")); + + public static final EdBreaker.BreakerBlock SMALL_BLOCK_BREAKER = (EdBreaker.BreakerBlock)(new EdBreaker.BreakerBlock( + DecorBlock.CFG_CUTOUT|DecorBlock.CFG_HORIZIONTAL|DecorBlock.CFG_LOOK_PLACEMENT|DecorBlock.CFG_OPPOSITE_PLACEMENT|DecorBlock.CFG_FLIP_PLACEMENT_SHIFTCLICK, + AbstractBlock.Properties.of(Material.METAL, MaterialColor.METAL).strength(2f, 12f).sound(SoundType.METAL).noOcclusion(), + new AxisAlignedBB[]{ + Auxiliaries.getPixeledAABB(1,0,0, 15, 4, 7), + Auxiliaries.getPixeledAABB(1,0,7, 15,12,16), + Auxiliaries.getPixeledAABB(0,0,0, 1, 5, 4), + Auxiliaries.getPixeledAABB(0,0,4, 1,12,16), + Auxiliaries.getPixeledAABB(15,0,0, 16, 5, 4), + Auxiliaries.getPixeledAABB(15,0,4, 16,12,16) + } + )).setRegistryName(new ResourceLocation(MODID, "small_block_breaker")); + + public static final EdHopper.HopperBlock FACTORY_HOPPER = (EdHopper.HopperBlock)(new EdHopper.HopperBlock( + DecorBlock.CFG_CUTOUT|DecorBlock.CFG_FACING_PLACEMENT|DecorBlock.CFG_OPPOSITE_PLACEMENT, + AbstractBlock.Properties.of(Material.METAL, MaterialColor.METAL).strength(2f, 12f).sound(SoundType.METAL).noOcclusion(),()->{ + final AxisAlignedBB[] down_aabbs = new AxisAlignedBB[]{ + Auxiliaries.getPixeledAABB( 5, 0, 5, 11, 1,11), + Auxiliaries.getPixeledAABB( 4, 1, 4, 12, 7,12), + Auxiliaries.getPixeledAABB( 2, 7, 2, 14,10,14), + Auxiliaries.getPixeledAABB( 0,10, 0, 16,16,16), + Auxiliaries.getPixeledAABB( 0, 4, 5, 2,10,11), + Auxiliaries.getPixeledAABB(14, 4, 5, 16,10,11), + Auxiliaries.getPixeledAABB( 5, 4, 0, 11,10, 2), + Auxiliaries.getPixeledAABB( 5, 4,14, 11,10,16), + }; + final AxisAlignedBB[] up_aabbs = new AxisAlignedBB[]{ + Auxiliaries.getPixeledAABB( 5,15, 5, 11,16,11), + Auxiliaries.getPixeledAABB( 4,14, 4, 12, 9,12), + Auxiliaries.getPixeledAABB( 2, 9, 2, 14, 6,14), + Auxiliaries.getPixeledAABB( 0, 6, 0, 16, 0,16), + Auxiliaries.getPixeledAABB( 0,12, 5, 2, 6,11), + Auxiliaries.getPixeledAABB(14,12, 5, 16, 6,11), + Auxiliaries.getPixeledAABB( 5,12, 0, 11, 6, 2), + Auxiliaries.getPixeledAABB( 5,12,14, 11, 6,16), + }; + final AxisAlignedBB[] north_aabbs = new AxisAlignedBB[]{ + Auxiliaries.getPixeledAABB( 5, 0, 5, 11, 1,11), + Auxiliaries.getPixeledAABB( 4, 1, 4, 12, 7,12), + Auxiliaries.getPixeledAABB( 2, 7, 2, 14,10,14), + Auxiliaries.getPixeledAABB( 0,10, 0, 16,16,16), + Auxiliaries.getPixeledAABB( 0, 4, 5, 2,10,11), + Auxiliaries.getPixeledAABB(14, 4, 5, 16,10,11), + Auxiliaries.getPixeledAABB( 5, 1, 0, 11, 7, 4), + Auxiliaries.getPixeledAABB( 5, 4,14, 11,10,16), + }; + return new ArrayList(Arrays.asList( + Auxiliaries.getUnionShape(down_aabbs), + Auxiliaries.getUnionShape(up_aabbs), + Auxiliaries.getUnionShape(Auxiliaries.getRotatedAABB(north_aabbs, Direction.NORTH, false)), + Auxiliaries.getUnionShape(Auxiliaries.getRotatedAABB(north_aabbs, Direction.SOUTH, false)), + Auxiliaries.getUnionShape(Auxiliaries.getRotatedAABB(north_aabbs, Direction.WEST, false)), + Auxiliaries.getUnionShape(Auxiliaries.getRotatedAABB(north_aabbs, Direction.EAST, false)), + VoxelShapes.block(), + VoxelShapes.block() + )); + } + )).setRegistryName(new ResourceLocation(MODID, "factory_hopper")); + + public static final EdWasteIncinerator.WasteIncineratorBlock SMALL_WASTE_INCINERATOR = (EdWasteIncinerator.WasteIncineratorBlock)(new EdWasteIncinerator.WasteIncineratorBlock( + DecorBlock.CFG_DEFAULT, + AbstractBlock.Properties.of(Material.METAL, MaterialColor.METAL).strength(2f, 12f).sound(SoundType.METAL), + Auxiliaries.getPixeledAABB(0,0,0, 16,16,16) + )).setRegistryName(new ResourceLocation(MODID, "small_waste_incinerator")); + + public static final EdMineralSmelter.MineralSmelterBlock SMALL_MINERAL_SMELTER = (EdMineralSmelter.MineralSmelterBlock)(new EdMineralSmelter.MineralSmelterBlock( + DecorBlock.CFG_CUTOUT|DecorBlock.CFG_HORIZIONTAL|DecorBlock.CFG_LOOK_PLACEMENT, + AbstractBlock.Properties.of(Material.METAL, MaterialColor.METAL).strength(2f, 12f).sound(SoundType.METAL).noOcclusion(), + Auxiliaries.getPixeledAABB(1.1,0,1.1, 14.9,16,14.9) + )).setRegistryName(new ResourceLocation(MODID, "small_mineral_smelter")); + + public static final EdFreezer.FreezerBlock SMALL_FREEZER = (EdFreezer.FreezerBlock)(new EdFreezer.FreezerBlock( + DecorBlock.CFG_CUTOUT|DecorBlock.CFG_HORIZIONTAL|DecorBlock.CFG_LOOK_PLACEMENT, + AbstractBlock.Properties.of(Material.METAL, MaterialColor.METAL).strength(2f, 12f).sound(SoundType.METAL).noOcclusion(), + Auxiliaries.getPixeledAABB(1.1,0,1.1, 14.9,16,14.9) + )).setRegistryName(new ResourceLocation(MODID, "small_freezer")); + + public static final EdSolarPanel.SolarPanelBlock SMALL_SOLAR_PANEL = (EdSolarPanel.SolarPanelBlock)(new EdSolarPanel.SolarPanelBlock( + DecorBlock.CFG_CUTOUT, + AbstractBlock.Properties.of(Material.METAL, MaterialColor.METAL).strength(2f, 10f).sound(SoundType.METAL).noOcclusion(), + new AxisAlignedBB[]{ + Auxiliaries.getPixeledAABB(0,0,0, 16,2,16), + Auxiliaries.getPixeledAABB(6,1.5,3, 10,10.5,13), + } + )).setRegistryName(new ResourceLocation(MODID, "small_solar_panel")); + + public static final EdMilker.MilkerBlock SMALL_MILKING_MACHINE = (EdMilker.MilkerBlock)(new EdMilker.MilkerBlock( + DecorBlock.CFG_CUTOUT|DecorBlock.CFG_HORIZIONTAL|DecorBlock.CFG_LOOK_PLACEMENT, + AbstractBlock.Properties.of(Material.METAL, MaterialColor.METAL).strength(2f, 10f).sound(SoundType.METAL).noOcclusion(), + new AxisAlignedBB[]{ + Auxiliaries.getPixeledAABB( 1, 1,0, 15,14,10), + Auxiliaries.getPixeledAABB( 0,14,0, 16,16,13), + Auxiliaries.getPixeledAABB( 0, 0,0, 16, 1,13), + Auxiliaries.getPixeledAABB( 0, 1,1, 1,14,11), + Auxiliaries.getPixeledAABB(15, 1,1, 16,14,11) + } + )).setRegistryName(new ResourceLocation(MODID, "small_milking_machine")); + + public static final EdTreeCutter.TreeCutterBlock SMALL_TREE_CUTTER = (EdTreeCutter.TreeCutterBlock)(new EdTreeCutter.TreeCutterBlock( + DecorBlock.CFG_CUTOUT|DecorBlock.CFG_HORIZIONTAL|DecorBlock.CFG_LOOK_PLACEMENT|DecorBlock.CFG_FLIP_PLACEMENT_SHIFTCLICK, + AbstractBlock.Properties.of(Material.METAL, MaterialColor.METAL).strength(2f, 10f).sound(SoundType.METAL).noOcclusion(), + new AxisAlignedBB[]{ + Auxiliaries.getPixeledAABB( 0,0, 0, 16,3,16), + Auxiliaries.getPixeledAABB( 0,3, 0, 3,8,16), + Auxiliaries.getPixeledAABB( 3,7, 0, 5,8,16), + Auxiliaries.getPixeledAABB(15,0, 0, 16,6,16), + Auxiliaries.getPixeledAABB( 0,0,13, 16,8,16), + Auxiliaries.getPixeledAABB( 5,6,12, 16,8,13), + } + )).setRegistryName(new ResourceLocation(MODID, "small_tree_cutter")); + + public static final EdPipeValve.PipeValveBlock STRAIGHT_CHECK_VALVE = (EdPipeValve.PipeValveBlock)(new EdPipeValve.PipeValveBlock( + DecorBlock.CFG_CUTOUT|DecorBlock.CFG_FACING_PLACEMENT|DecorBlock.CFG_OPPOSITE_PLACEMENT|DecorBlock.CFG_FLIP_PLACEMENT_SHIFTCLICK, + EdPipeValve.CFG_CHECK_VALVE, + AbstractBlock.Properties.of(Material.METAL, MaterialColor.METAL).strength(2f, 8f).sound(SoundType.METAL).noOcclusion(), + new AxisAlignedBB[]{ + Auxiliaries.getPixeledAABB(2,2, 0, 14,14, 2), + Auxiliaries.getPixeledAABB(2,2,14, 14,14,16), + Auxiliaries.getPixeledAABB(3,3, 5, 13,13,11), + Auxiliaries.getPixeledAABB(4,4, 2, 12,12,14), + } + )).setRegistryName(new ResourceLocation(MODID, "straight_pipe_valve")); + + public static final EdPipeValve.PipeValveBlock STRAIGHT_REDSTONE_VALVE = (EdPipeValve.PipeValveBlock)(new EdPipeValve.PipeValveBlock( + DecorBlock.CFG_CUTOUT|DecorBlock.CFG_FACING_PLACEMENT|DecorBlock.CFG_OPPOSITE_PLACEMENT, + EdPipeValve.CFG_REDSTONE_CONTROLLED_VALVE, + AbstractBlock.Properties.of(Material.METAL, MaterialColor.METAL).strength(2f, 8f).sound(SoundType.METAL).noOcclusion(), + new AxisAlignedBB[]{ + Auxiliaries.getPixeledAABB(2,2, 0, 14,14, 2), + Auxiliaries.getPixeledAABB(2,2,14, 14,14,16), + Auxiliaries.getPixeledAABB(3,3, 5, 13,13,11), + Auxiliaries.getPixeledAABB(4,4, 2, 12,12,14), + } + )).setRegistryName(new ResourceLocation(MODID, "straight_pipe_valve_redstone")); + + public static final EdPipeValve.PipeValveBlock STRAIGHT_REDSTONE_ANALOG_VALVE = (EdPipeValve.PipeValveBlock)(new EdPipeValve.PipeValveBlock( + DecorBlock.CFG_CUTOUT|DecorBlock.CFG_FACING_PLACEMENT|DecorBlock.CFG_OPPOSITE_PLACEMENT, + EdPipeValve.CFG_REDSTONE_CONTROLLED_VALVE|EdPipeValve.CFG_ANALOG_VALVE, + AbstractBlock.Properties.of(Material.METAL, MaterialColor.METAL).strength(2f, 8f).sound(SoundType.METAL).noOcclusion(), + new AxisAlignedBB[]{ + Auxiliaries.getPixeledAABB(2,2, 0, 14,14, 2), + Auxiliaries.getPixeledAABB(2,2,14, 14,14,16), + Auxiliaries.getPixeledAABB(3,3, 5, 13,13,11), + Auxiliaries.getPixeledAABB(4,4, 2, 12,12,14), + } + )).setRegistryName(new ResourceLocation(MODID, "straight_pipe_valve_redstone_analog")); + + public static final EdFluidBarrel.FluidBarrelBlock FLUID_BARREL = (EdFluidBarrel.FluidBarrelBlock)(new EdFluidBarrel.FluidBarrelBlock( + DecorBlock.CFG_CUTOUT|DecorBlock.CFG_LOOK_PLACEMENT|DecorBlock.CFG_OPPOSITE_PLACEMENT, + AbstractBlock.Properties.of(Material.METAL, MaterialColor.METAL).strength(2f, 10f).sound(SoundType.METAL).noOcclusion(), + new AxisAlignedBB[]{ + Auxiliaries.getPixeledAABB(2, 0,0, 14, 1,16), + Auxiliaries.getPixeledAABB(1, 1,0, 15, 2,16), + Auxiliaries.getPixeledAABB(0, 2,0, 16,14,16), + Auxiliaries.getPixeledAABB(1,14,0, 15,15,16), + Auxiliaries.getPixeledAABB(2,15,0, 14,16,16), + } + )).setRegistryName(new ResourceLocation(MODID, "fluid_barrel")); + + public static final EdFluidFunnel.FluidFunnelBlock SMALL_FLUID_FUNNEL = (EdFluidFunnel.FluidFunnelBlock)(new EdFluidFunnel.FluidFunnelBlock( + DecorBlock.CFG_CUTOUT, + AbstractBlock.Properties.of(Material.METAL, MaterialColor.METAL).strength(2f, 10f).sound(SoundType.METAL).noOcclusion(), + new AxisAlignedBB[]{ + Auxiliaries.getPixeledAABB(0, 0,0, 16,14,16), + Auxiliaries.getPixeledAABB(1,14,1, 15,15,15), + Auxiliaries.getPixeledAABB(0,15,0, 16,16,16) + } + )).setRegistryName(new ResourceLocation(MODID, "small_fluid_funnel")); + + public static final EdLabeledCrate.LabeledCrateBlock LABELED_CRATE = (EdLabeledCrate.LabeledCrateBlock)(new EdLabeledCrate.LabeledCrateBlock( + DecorBlock.CFG_HORIZIONTAL|DecorBlock.CFG_LOOK_PLACEMENT|DecorBlock.CFG_OPPOSITE_PLACEMENT, + AbstractBlock.Properties.of(Material.WOOD, MaterialColor.WOOD).strength(0.5f, 32f).sound(SoundType.METAL).noOcclusion(), + Auxiliaries.getPixeledAABB(0,0,0, 16,16,16) + )).setRegistryName(new ResourceLocation(MODID, "labeled_crate")); + + // ------------------------------------------------------------------------------------------------------------------- + + public static final EdSlabSliceBlock HALFSLAB_TREATEDWOOD = (EdSlabSliceBlock)(new EdSlabSliceBlock( + DecorBlock.CFG_CUTOUT|DecorBlock.CFG_HARD_IE_DEPENDENT, + AbstractBlock.Properties.of(Material.WOOD, MaterialColor.WOOD).strength(1f, 4f).sound(SoundType.WOOD).noOcclusion() + )).setRegistryName(new ResourceLocation(MODID, "halfslab_treated_wood")); + + public static final EdSlabSliceBlock HALFSLAB_SHEETMETALIRON = (EdSlabSliceBlock)(new EdSlabSliceBlock( + DecorBlock.CFG_CUTOUT|DecorBlock.CFG_HARD_IE_DEPENDENT, + AbstractBlock.Properties.of(Material.METAL, MaterialColor.METAL).strength(1f, 8f).sound(SoundType.METAL).noOcclusion() + )).setRegistryName(new ResourceLocation(MODID, "halfslab_sheetmetal_iron")); + + public static final EdSlabSliceBlock HALFSLAB_SHEETMETALSTEEL = (EdSlabSliceBlock)(new EdSlabSliceBlock( + DecorBlock.CFG_CUTOUT|DecorBlock.CFG_HARD_IE_DEPENDENT, + AbstractBlock.Properties.of(Material.METAL, MaterialColor.METAL).strength(1f, 8f).sound(SoundType.METAL).noOcclusion() + )).setRegistryName(new ResourceLocation(MODID, "halfslab_sheetmetal_steel")); + + public static final EdSlabSliceBlock HALFSLAB_SHEETMETALCOPPER = (EdSlabSliceBlock)(new EdSlabSliceBlock( + DecorBlock.CFG_CUTOUT|DecorBlock.CFG_HARD_IE_DEPENDENT, + AbstractBlock.Properties.of(Material.METAL, MaterialColor.METAL).strength(1f, 8f).sound(SoundType.METAL).noOcclusion() + )).setRegistryName(new ResourceLocation(MODID, "halfslab_sheetmetal_copper")); + + public static final EdSlabSliceBlock HALFSLAB_SHEETMETALGOLD = (EdSlabSliceBlock)(new EdSlabSliceBlock( + DecorBlock.CFG_CUTOUT|DecorBlock.CFG_HARD_IE_DEPENDENT, + AbstractBlock.Properties.of(Material.METAL, MaterialColor.METAL).strength(1f, 8f).sound(SoundType.METAL).noOcclusion() + )).setRegistryName(new ResourceLocation(MODID, "halfslab_sheetmetal_gold")); + + public static final EdSlabSliceBlock HALFSLAB_SHEETMETALALUMINIUM = (EdSlabSliceBlock)(new EdSlabSliceBlock( + DecorBlock.CFG_CUTOUT|DecorBlock.CFG_HARD_IE_DEPENDENT, + AbstractBlock.Properties.of(Material.METAL, MaterialColor.METAL).strength(1f, 8f).sound(SoundType.METAL).noOcclusion() + )).setRegistryName(new ResourceLocation(MODID, "halfslab_sheetmetal_aluminum")); + + // ------------------------------------------------------------------------------------------------------------------- + + public static final EdFenceBlock STEEL_MESH_FENCE = (EdFenceBlock)(new EdFenceBlock( + DecorBlock.CFG_CUTOUT, + AbstractBlock.Properties.of(Material.METAL, MaterialColor.METAL).strength(2f, 10f).sound(SoundType.METAL).noOcclusion(), + 1.5, 16, 0.25, 0, 16, 16 + )).setRegistryName(new ResourceLocation(MODID, "steel_mesh_fence")); + + public static final EdDoubleGateBlock STEEL_MESH_FENCE_GATE = (EdDoubleGateBlock)(new EdDoubleGateBlock( + DecorBlock.CFG_CUTOUT, + AbstractBlock.Properties.of(Material.METAL, MaterialColor.METAL).strength(2f, 10f).sound(SoundType.METAL).noOcclusion(), + Auxiliaries.getPixeledAABB(0,0,6.5, 16,16,9.5) + )).setRegistryName(new ResourceLocation(MODID, "steel_mesh_fence_gate")); + + public static final EdRailingBlock STEEL_RAILING = (EdRailingBlock)(new EdRailingBlock( + DecorBlock.CFG_CUTOUT, + AbstractBlock.Properties.of(Material.METAL, MaterialColor.METAL).strength(1f, 10f).sound(SoundType.METAL).noOcclusion(), + Auxiliaries.getPixeledAABB(0,0,0, 0, 0,0), + Auxiliaries.getPixeledAABB(0,0,0, 16,15.9,1) + )).setRegistryName(new ResourceLocation(MODID, "steel_railing")); + + public static final EdCatwalkBlock STEEL_CATWALK = (EdCatwalkBlock)(new EdCatwalkBlock( + DecorBlock.CFG_CUTOUT, + AbstractBlock.Properties.of(Material.METAL, MaterialColor.METAL).strength(2f, 10f).sound(SoundType.METAL).noOcclusion(), + Auxiliaries.getPixeledAABB(0,0,0, 16, 2,16), + Auxiliaries.getPixeledAABB(0,0,0, 16,15.9, 1), + STEEL_RAILING + )).setRegistryName(new ResourceLocation(MODID, "steel_catwalk")); + + public static final EdCatwalkTopAlignedBlock STEEL_CATWALK_TOP_ALIGNED = (EdCatwalkTopAlignedBlock)(new EdCatwalkTopAlignedBlock( + DecorBlock.CFG_CUTOUT, + AbstractBlock.Properties.of(Material.METAL, MaterialColor.METAL).strength(2f, 10f).sound(SoundType.METAL).noOcclusion(), + new VoxelShape[]{ + VoxelShapes.create(Auxiliaries.getPixeledAABB(0,14,0, 16, 16,16)), // only base + Auxiliaries.getUnionShape( // base with thick pole + Auxiliaries.getPixeledAABB(0,14,0, 16, 16,16), + Auxiliaries.getPixeledAABB(5, 0,5, 11,15, 11) + ), + Auxiliaries.getUnionShape( // base with thin pole + Auxiliaries.getPixeledAABB(0,14,0, 16, 16,16), + Auxiliaries.getPixeledAABB(6, 0,6, 10,15, 10) + ), + Auxiliaries.getUnionShape( // structure frame-like + Auxiliaries.getPixeledAABB( 0, 0, 0, 16, 2,16), + Auxiliaries.getPixeledAABB( 0,14, 0, 16, 16,16), + Auxiliaries.getPixeledAABB( 0, 0, 0, 1, 16, 1), + Auxiliaries.getPixeledAABB(15, 0, 0, 16, 16, 1), + Auxiliaries.getPixeledAABB(15, 0,15, 16, 16,16), + Auxiliaries.getPixeledAABB( 0, 0,15, 1, 16,16) + ) + } + )).setRegistryName(new ResourceLocation(MODID, "steel_catwalk_ta")); + + public static final EdCatwalkStairsBlock STEEL_CATWALK_STAIRS = (EdCatwalkStairsBlock)(new EdCatwalkStairsBlock( + DecorBlock.CFG_CUTOUT, + AbstractBlock.Properties.of(Material.METAL, MaterialColor.METAL).strength(2f, 10f).sound(SoundType.METAL).noOcclusion(), + new AxisAlignedBB[] { // base + Auxiliaries.getPixeledAABB( 1, 2, 8, 15, 4, 16), + Auxiliaries.getPixeledAABB( 1,10, 0, 15, 12, 8), + }, + new AxisAlignedBB[] { // railing left + Auxiliaries.getPixeledAABB(0.4, 0, 15, 0.6, 15, 16), + Auxiliaries.getPixeledAABB(0.4, 1, 14, 0.6, 16, 15), + Auxiliaries.getPixeledAABB(0.4, 2, 13, 0.6, 17, 14), + Auxiliaries.getPixeledAABB(0.4, 3, 12, 0.6, 18, 13), + Auxiliaries.getPixeledAABB(0.4, 4, 11, 0.6, 19, 12), + Auxiliaries.getPixeledAABB(0.4, 5, 10, 0.6, 20, 11), + Auxiliaries.getPixeledAABB(0.4, 6, 9, 0.6, 21, 10), + Auxiliaries.getPixeledAABB(0.4, 7, 8, 0.6, 22, 9), + Auxiliaries.getPixeledAABB(0.4, 8, 7, 0.6, 23, 8), + Auxiliaries.getPixeledAABB(0.4, 9, 6, 0.6, 24, 7), + Auxiliaries.getPixeledAABB(0.4, 10, 5, 0.6, 25, 6), + Auxiliaries.getPixeledAABB(0.4, 11, 4, 0.6, 26, 5), + Auxiliaries.getPixeledAABB(0.4, 12, 3, 0.6, 27, 4), + Auxiliaries.getPixeledAABB(0.4, 13, 2, 0.6, 28, 3), + Auxiliaries.getPixeledAABB(0.4, 14, 1, 0.6, 29, 2), + Auxiliaries.getPixeledAABB(0.4, 15, 0, 0.6, 30, 1) + } + )).setRegistryName(new ResourceLocation(MODID, "steel_catwalk_stairs")); + + // ------------------------------------------------------------------------------------------------------------------- + + public static final EdTestBlock.TestBlock TEST_BLOCK = (EdTestBlock.TestBlock)(new EdTestBlock.TestBlock( + DecorBlock.CFG_LOOK_PLACEMENT, + AbstractBlock.Properties.of(Material.METAL, MaterialColor.METAL).strength(0f, 32000f).sound(SoundType.METAL), + Auxiliaries.getPixeledAABB(0,0,0, 16,16,16) + )).setRegistryName(new ResourceLocation(MODID, "test_block")); + + // ------------------------------------------------------------------------------------------------------------------- + + private static final Block modBlocks[] = { + CRAFTING_TABLE, + LABELED_CRATE, + SMALL_LAB_FURNACE, + SMALL_ELECTRICAL_FURNACE, + FACTORY_HOPPER, + FACTORY_DROPPER, + FACTORY_PLACER, + SMALL_BLOCK_BREAKER, + SMALL_TREE_CUTTER, + SMALL_SOLAR_PANEL, + SMALL_WASTE_INCINERATOR, + SMALL_MINERAL_SMELTER, + SMALL_FREEZER, + SMALL_MILKING_MACHINE, + FLUID_BARREL, + STRAIGHT_CHECK_VALVE, + STRAIGHT_REDSTONE_VALVE, + STRAIGHT_REDSTONE_ANALOG_VALVE, + SMALL_FLUID_FUNNEL, + DENSE_GRIT_SAND, + DENSE_GRIT_DIRT, + CLINKER_BRICK_BLOCK, + CLINKER_BRICK_SLAB, + CLINKER_BRICK_STAIRS, + CLINKER_BRICK_WALL, + CLINKER_BRICK_SASTOR_CORNER, + CLINKER_BRICK_STAINED_BLOCK, + CLINKER_BRICK_STAINED_SLAB, + CLINKER_BRICK_STAINED_STAIRS, + CLINKER_BRICK_SASTOR_VERTICAL_SLOTTED, + CLINKER_BRICK_RECESSED, + CLINKER_BRICK_VERTICAL_SLAB_STRUCTURED, + SLAG_BRICK_BLOCK, + SLAG_BRICK_SLAB, + SLAG_BRICK_STAIRS, + SLAG_BRICK_WALL, + REBAR_CONCRETE_BLOCK, + REBAR_CONCRETE_SLAB, + REBAR_CONCRETE_STAIRS, + REBAR_CONCRETE_WALL, + REBAR_CONCRETE_TILE, + REBAR_CONCRETE_TILE_SLAB, + REBAR_CONCRETE_TILE_STAIRS, + GAS_CONCRETE_BLOCK, + GAS_CONCRETE_SLAB, + GAS_CONCRETE_STAIRS, + GAS_CONCRETE_WALL, + HALFSLAB_REBARCONCRETE, + HALFSLAB_GASCONCRETE, + HALFSLAB_TREATEDWOOD, + HALFSLAB_SHEETMETALIRON, + HALFSLAB_SHEETMETALSTEEL, + HALFSLAB_SHEETMETALCOPPER, + HALFSLAB_SHEETMETALGOLD, + HALFSLAB_SHEETMETALALUMINIUM, + PANZERGLASS_BLOCK, + PANZERGLASS_SLAB, + DARK_CERAMIC_SHINGLE_ROOF, + DARK_CERAMIC_SHINGLE_ROOF_METALIZED, + DARK_CERAMIC_SHINGLE_ROOF_SKYLIGHT, + DARK_CERAMIC_SHINGLE_ROOF_CHIMNEYTRUNK, + DARK_CERAMIC_SHINGLE_ROOF_WIRECONDUIT, + DARK_CERAMIC_SHINGLE_ROOF_BLOCK, + DARK_CERAMIC_SHINGLE_ROOF_SLAB, + HALFSLAB_DARK_CERAMIC_SHINGLE_ROOF, + DARK_CERAMIC_SHINGLE_ROOF_CHIMNEY, + METAL_RUNG_LADDER, + METAL_RUNG_STEPS, + TREATED_WOOD_LADDER, + METAL_SLIDING_DOOR, + IRON_HATCH, + OLD_INDUSTRIAL_PLANKS, + OLD_INDUSTRIAL_SLAB, + OLD_INDUSTRIAL_STAIRS, + OLD_INDUSTRIAL_SLABSLICE, + OLD_INDUSTRIAL_WOOD_DOOR, + TREATED_WOOD_TABLE, + TREATED_WOOD_STOOL, + TREATED_WOOD_SIDE_TABLE, + TREATED_WOOD_WINDOWSILL, + TREATED_WOOD_BROAD_WINDOWSILL, + TREATED_WOOD_WINDOW, + STEEL_FRAMED_WINDOW, + STEEL_TABLE, + INSET_LIGHT_IRON, + FLOOR_EDGE_LIGHT_IRON, + CEILING_EDGE_LIGHT_IRON, + BULB_LIGHT_IRON, + STEEL_FLOOR_GRATING, + STEEL_MESH_FENCE, + STEEL_MESH_FENCE_GATE, + STEEL_CATWALK, + STEEL_RAILING, + STEEL_CATWALK_TOP_ALIGNED, + STEEL_CATWALK_STAIRS, + TREATED_WOOD_POLE, + TREATED_WOOD_POLE_HEAD, + TREATED_WOOD_POLE_SUPPORT, + THIN_STEEL_POLE, + THIN_STEEL_POLE_HEAD, + THICK_STEEL_POLE, + THICK_STEEL_POLE_HEAD, + STEEL_DOUBLE_T_SUPPORT, + SIGN_HOTWIRE, + SIGN_DANGER, + SIGN_DEFENSE, + SIGN_FACTORY_AREA, + SIGN_EXIT, + SIGN_RADIOACTIVE, + SIGN_LASER, + SIGN_CAUTION, + SIGN_MAGIC_HAZARD, + SIGN_FIRE_HAZARD, + SIGN_HOT_SURFACE, + SIGN_MAGNETIC_FIELD, + SIGN_FROST_WARNING, + SIGN_MODLOGO, + }; + + private static final Block devBlocks[] = { + TEST_BLOCK + }; + + //-------------------------------------------------------------------------------------------------------------------- + // Tile entities bound exclusively to the blocks above + //-------------------------------------------------------------------------------------------------------------------- + + public static final TileEntityType TET_CRAFTING_TABLE = TileEntityType.Builder + .of(EdCraftingTable.CraftingTableTileEntity::new, CRAFTING_TABLE) + .build(null) + .setRegistryName(MODID, "te_treated_wood_crafting_table"); + + public static final TileEntityType TET_LABELED_CRATE = TileEntityType.Builder + .of(EdLabeledCrate.LabeledCrateTileEntity::new, LABELED_CRATE) + .build(null) + .setRegistryName(MODID, "te_labeled_crate"); + + public static final TileEntityType TET_SMALL_LAB_FURNACE = TileEntityType.Builder + .of(FurnaceTileEntity::new, SMALL_LAB_FURNACE) + .build(null) + .setRegistryName(MODID, "te_small_lab_furnace"); + + public static final TileEntityType TET_SMALL_ELECTRICAL_FURNACE = TileEntityType.Builder + .of(EdElectricalFurnace.ElectricalFurnaceTileEntity::new, SMALL_ELECTRICAL_FURNACE) + .build(null) + .setRegistryName(MODID, "te_small_electrical_furnace"); + + public static final TileEntityType TET_FACTORY_DROPPER = TileEntityType.Builder + .of(EdDropper.DropperTileEntity::new, FACTORY_DROPPER) + .build(null) + .setRegistryName(MODID, "te_factory_dropper"); + + public static final TileEntityType TET_FACTORY_PLACER = TileEntityType.Builder + .of(EdPlacer.PlacerTileEntity::new, FACTORY_PLACER) + .build(null) + .setRegistryName(MODID, "te_factory_placer"); + + public static final TileEntityType TET_SMALL_BLOCK_BREAKER = TileEntityType.Builder + .of(EdBreaker.BreakerTileEntity::new, SMALL_BLOCK_BREAKER) + .build(null) + .setRegistryName(MODID, "te_small_block_breaker"); + + public static final TileEntityType TET_FACTORY_HOPPER = TileEntityType.Builder + .of(EdHopper.HopperTileEntity::new, FACTORY_HOPPER) + .build(null) + .setRegistryName(MODID, "te_factory_hopper"); + + public static final TileEntityType TET_WASTE_INCINERATOR = TileEntityType.Builder + .of(EdWasteIncinerator.WasteIncineratorTileEntity::new, SMALL_WASTE_INCINERATOR) + .build(null) + .setRegistryName(MODID, "te_small_waste_incinerator"); + + public static final TileEntityType TET_STRAIGHT_PIPE_VALVE = TileEntityType.Builder + .of(EdPipeValve.PipeValveTileEntity::new, STRAIGHT_CHECK_VALVE, STRAIGHT_REDSTONE_VALVE, STRAIGHT_REDSTONE_ANALOG_VALVE) + .build(null) + .setRegistryName(MODID, "te_pipe_valve"); + + public static final TileEntityType TET_FLUID_BARREL = TileEntityType.Builder + .of(EdFluidBarrel.FluidBarrelTileEntity::new, FLUID_BARREL) + .build(null) + .setRegistryName(MODID, "te_fluid_barrel"); + + public static final TileEntityType TET_SMALL_FLUID_FUNNEL = TileEntityType.Builder + .of(EdFluidFunnel.FluidFunnelTileEntity::new, SMALL_FLUID_FUNNEL) + .build(null) + .setRegistryName(MODID, "te_small_fluid_funnel"); + + public static final TileEntityType TET_MINERAL_SMELTER = TileEntityType.Builder + .of(EdMineralSmelter.MineralSmelterTileEntity::new, SMALL_MINERAL_SMELTER) + .build(null) + .setRegistryName(MODID, "te_small_mineral_smelter"); + + public static final TileEntityType TET_FREEZER = TileEntityType.Builder + .of(EdFreezer.FreezerTileEntity::new, SMALL_FREEZER) + .build(null) + .setRegistryName(MODID, "te_small_freezer"); + + public static final TileEntityType TET_SMALL_SOLAR_PANEL = TileEntityType.Builder + .of(EdSolarPanel.SolarPanelTileEntity::new, SMALL_SOLAR_PANEL) + .build(null) + .setRegistryName(MODID, "te_small_solar_panel"); + + public static final TileEntityType TET_SMALL_MILKING_MACHINE = TileEntityType.Builder + .of(EdMilker.MilkerTileEntity::new, SMALL_MILKING_MACHINE) + .build(null) + .setRegistryName(MODID, "te_small_milking_machine"); + + public static final TileEntityType TET_SMALL_TREE_CUTTER = TileEntityType.Builder + .of(EdTreeCutter.TreeCutterTileEntity::new, SMALL_TREE_CUTTER) + .build(null) + .setRegistryName(MODID, "te_small_tree_cutter"); + + public static final TileEntityType TET_TEST_BLOCK = TileEntityType.Builder + .of(EdTestBlock.TestTileEntity::new, TEST_BLOCK) + .build(null) + .setRegistryName(MODID, "te_test_block"); + + private static final TileEntityType tile_entity_types[] = { + TET_CRAFTING_TABLE, + TET_LABELED_CRATE, + TET_SMALL_LAB_FURNACE, + TET_SMALL_ELECTRICAL_FURNACE, + TET_FACTORY_HOPPER, + TET_FACTORY_DROPPER, + TET_FACTORY_PLACER, + TET_SMALL_BLOCK_BREAKER, + TET_SMALL_TREE_CUTTER, + TET_WASTE_INCINERATOR, + TET_MINERAL_SMELTER, + TET_FREEZER, + TET_SMALL_SOLAR_PANEL, + TET_SMALL_MILKING_MACHINE, + TET_STRAIGHT_PIPE_VALVE, + TET_FLUID_BARREL, + TET_SMALL_FLUID_FUNNEL, + TET_TEST_BLOCK + }; + + //-------------------------------------------------------------------------------------------------------------------- + // Items + //-------------------------------------------------------------------------------------------------------------------- + + private static Item.Properties default_item_properties() + { return (new Item.Properties()).tab(ModEngineersDecor.ITEMGROUP); } + + public static final EdItem METAL_BAR_ITEM = (EdItem)((new EdItem(default_item_properties()).setRegistryName(MODID, "metal_bar"))); + + private static final EdItem modItems[] = { + METAL_BAR_ITEM + }; + + //-------------------------------------------------------------------------------------------------------------------- + // Entities bound exclusively to the blocks above + //-------------------------------------------------------------------------------------------------------------------- + + @SuppressWarnings("unchecked") + public static final EntityType ET_CHAIR = (EntityType)( + EntityType.Builder + .of(EdChair.EntityChair::new, EntityClassification.MISC) + .fireImmune().sized(1e-3f, 1e-3f).noSave() + .setShouldReceiveVelocityUpdates(false).setUpdateInterval(4) + .setCustomClientFactory(EdChair.EntityChair::customClientFactory) + .build(new ResourceLocation(MODID, "et_chair").toString()) + .setRegistryName(new ResourceLocation(MODID, "et_chair")) + ); + + private static final EntityType entity_types[] = { + ET_CHAIR + }; + + //-------------------------------------------------------------------------------------------------------------------- + // Container registration + //-------------------------------------------------------------------------------------------------------------------- + + public static final ContainerType CT_TREATED_WOOD_CRAFTING_TABLE; + public static final ContainerType CT_FACTORY_DROPPER; + public static final ContainerType CT_FACTORY_PLACER; + public static final ContainerType CT_FACTORY_HOPPER; + public static final ContainerType CT_SMALL_LAB_FURNACE; + public static final ContainerType CT_SMALL_ELECTRICAL_FURNACE; + public static final ContainerType CT_WASTE_INCINERATOR; + public static final ContainerType CT_LABELED_CRATE; + + static { + CT_TREATED_WOOD_CRAFTING_TABLE = (new ContainerType(EdCraftingTable.CraftingTableUiContainer::new)); + CT_TREATED_WOOD_CRAFTING_TABLE.setRegistryName(MODID,"ct_treated_wood_crafting_table"); + CT_FACTORY_DROPPER = (new ContainerType(EdDropper.DropperUiContainer::new)); + CT_FACTORY_DROPPER.setRegistryName(MODID,"ct_factory_dropper"); + CT_FACTORY_PLACER = (new ContainerType(EdPlacer.PlacerContainer::new)); + CT_FACTORY_PLACER.setRegistryName(MODID,"ct_factory_placer"); + CT_FACTORY_HOPPER = (new ContainerType(EdHopper.HopperContainer::new)); + CT_FACTORY_HOPPER.setRegistryName(MODID,"ct_factory_hopper"); + CT_SMALL_LAB_FURNACE = (new ContainerType(FurnaceContainer::new)); + CT_SMALL_LAB_FURNACE.setRegistryName(MODID,"ct_small_lab_furnace"); + CT_SMALL_ELECTRICAL_FURNACE = (new ContainerType(EdElectricalFurnace.ElectricalFurnaceContainer::new)); + CT_SMALL_ELECTRICAL_FURNACE.setRegistryName(MODID,"ct_small_electrical_furnace"); + CT_WASTE_INCINERATOR = (new ContainerType(EdWasteIncinerator.WasteIncineratorContainer::new)); + CT_WASTE_INCINERATOR.setRegistryName(MODID,"ct_small_waste_incinerator"); + CT_LABELED_CRATE = (new ContainerType(EdLabeledCrate.LabeledCrateContainer::new)); + CT_LABELED_CRATE.setRegistryName(MODID,"ct_labeled_crate"); + } + + private static final ContainerType container_types[] = { + CT_TREATED_WOOD_CRAFTING_TABLE, + CT_LABELED_CRATE, + CT_FACTORY_DROPPER, + CT_FACTORY_PLACER, + CT_FACTORY_HOPPER, + CT_SMALL_LAB_FURNACE, + CT_SMALL_ELECTRICAL_FURNACE, + CT_WASTE_INCINERATOR + }; + + //-------------------------------------------------------------------------------------------------------------------- + // Initialisation events + //-------------------------------------------------------------------------------------------------------------------- + + private static ArrayList registeredBlocks = new ArrayList<>(); + + public static ArrayList allBlocks() + { + ArrayList blocks = new ArrayList<>(); + Collections.addAll(blocks, modBlocks); + Collections.addAll(blocks, devBlocks); + return blocks; + } + + @SuppressWarnings("deprecation") + public static boolean isExperimentalBlock(Block block) + { return ArrayUtils.contains(devBlocks, block) || ((block instanceof IDecorBlock) && ((((IDecorBlock)block).config() & DecorBlock.CFG_EXPERIMENTAL))!=0); } + + @Nonnull + public static List getRegisteredBlocks() + { return Collections.unmodifiableList(registeredBlocks); } + + @Nonnull + public static List getRegisteredItems() + { return new ArrayList<>(); } + + public static final void registerBlocks(final RegistryEvent.Register event) + { + boolean ie_available = Auxiliaries.isModLoaded("immersiveengineering"); + if(ie_available) { + Auxiliaries.logInfo("Immersive Engineering also installed ..."); + registeredBlocks.addAll(allBlocks()); + } else { + registeredBlocks.addAll(allBlocks().stream() + .filter(block-> + ((!(block instanceof IDecorBlock)) || ((((IDecorBlock)block).config() & DecorBlock.CFG_HARD_IE_DEPENDENT)==0)) + ) + .collect(Collectors.toList()) + ); + } + for(Block e:registeredBlocks) event.getRegistry().register(e); + Auxiliaries.logInfo("Registered " + Integer.toString(registeredBlocks.size()) + " blocks."); + } + + public static final void registerBlockItems(final RegistryEvent.Register event) + { + int n = 0; + for(Block e:registeredBlocks) { + ResourceLocation rl = e.getRegistryName(); + if(rl == null) continue; + if(e instanceof StandardBlocks.IBlockItemFactory) { + event.getRegistry().register(((StandardBlocks.IBlockItemFactory)e).getBlockItem(e, (new Item.Properties().tab(ModEngineersDecor.ITEMGROUP))).setRegistryName(rl)); + } else { + event.getRegistry().register(new BlockItem(e, (new Item.Properties().tab(ModEngineersDecor.ITEMGROUP))).setRegistryName(rl)); + } + ++n; + } + } + + public static final void registerItems(final RegistryEvent.Register event) + { for(Item e:modItems) event.getRegistry().register(e); } + + public static final void registerTileEntities(final RegistryEvent.Register> event) + { + int n_registered = 0; + for(final TileEntityType e:tile_entity_types) { + event.getRegistry().register(e); + ++n_registered; + } + Auxiliaries.logInfo("Registered " + Integer.toString(n_registered) + " tile entities."); + } + + public static final void registerEntities(final RegistryEvent.Register> event) + { + int n_registered = 0; + for(final EntityType e:entity_types) { + if((e==ET_CHAIR) && (!registeredBlocks.contains(TREATED_WOOD_STOOL))) continue; + event.getRegistry().register(e); + ++n_registered; + } + Auxiliaries.logInfo("Registered " + Integer.toString(n_registered) + " entities bound to blocks."); + } + + public static final void registerContainers(final RegistryEvent.Register> event) + { + int n_registered = 0; + for(final ContainerType e:container_types) { + event.getRegistry().register(e); + ++n_registered; + } + Auxiliaries.logInfo("Registered " + Integer.toString(n_registered) + " containers bound to tile entities."); + } + + @OnlyIn(Dist.CLIENT) + public static final void registerContainerGuis(final FMLClientSetupEvent event) + { + ScreenManager.register(CT_TREATED_WOOD_CRAFTING_TABLE, EdCraftingTable.CraftingTableGui::new); + ScreenManager.register(CT_LABELED_CRATE, EdLabeledCrate.LabeledCrateGui::new); + ScreenManager.register(CT_FACTORY_DROPPER, EdDropper.DropperGui::new); + ScreenManager.register(CT_FACTORY_PLACER, EdPlacer.PlacerGui::new); + ScreenManager.register(CT_FACTORY_HOPPER, EdHopper.HopperGui::new); + ScreenManager.register(CT_SMALL_LAB_FURNACE, FurnaceGui::new); + ScreenManager.register(CT_SMALL_ELECTRICAL_FURNACE, EdElectricalFurnace.ElectricalFurnaceGui::new); + ScreenManager.register(CT_WASTE_INCINERATOR, EdWasteIncinerator.WasteIncineratorGui::new); + } + + @OnlyIn(Dist.CLIENT) + @SuppressWarnings("unchecked") + public static final void registerTileEntityRenderers(final FMLClientSetupEvent event) + { + ClientRegistry.bindTileEntityRenderer( + (TileEntityType)TET_CRAFTING_TABLE, + wile.engineersdecor.detail.ModRenderers.CraftingTableTer::new + ); + ClientRegistry.bindTileEntityRenderer( + (TileEntityType)TET_LABELED_CRATE, + wile.engineersdecor.detail.ModRenderers.DecorLabeledCrateTer::new + ); + } + + @OnlyIn(Dist.CLIENT) + public static final void processContentClientSide(final FMLClientSetupEvent event) + { + // Block renderer selection + for(Block block: getRegisteredBlocks()) { + if(block instanceof IStandardBlock) { + switch(((IStandardBlock)block).getRenderTypeHint()) { + case CUTOUT: + RenderTypeLookup.setRenderLayer(block, RenderType.cutout()); + break; + case CUTOUT_MIPPED: + RenderTypeLookup.setRenderLayer(block, RenderType.cutoutMipped()); + break; + case TRANSLUCENT: + RenderTypeLookup.setRenderLayer(block, RenderType.translucent()); + break; + case TRANSLUCENT_NO_CRUMBLING: + RenderTypeLookup.setRenderLayer(block, RenderType.translucentNoCrumbling()); + break; + case SOLID: + break; + } + } + } + // Entity renderers + RenderingRegistry.registerEntityRenderingHandler(ET_CHAIR, + manager->(new wile.engineersdecor.detail.ModRenderers.InvisibleEntityRenderer(manager)) + ); + } + +} diff --git a/src/main/java/wile/engineersdecor/ModEngineersDecor.java b/src/main/java/wile/engineersdecor/ModEngineersDecor.java index a6adf1b..b500264 100644 --- a/src/main/java/wile/engineersdecor/ModEngineersDecor.java +++ b/src/main/java/wile/engineersdecor/ModEngineersDecor.java @@ -1,136 +1,136 @@ -package wile.engineersdecor; - -import wile.engineersdecor.blocks.*; -import wile.engineersdecor.libmc.detail.Auxiliaries; -import wile.engineersdecor.libmc.detail.OptionalRecipeCondition; -import net.minecraft.entity.EntityType; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.inventory.container.ContainerType; -import net.minecraft.item.ItemGroup; -import net.minecraft.tileentity.TileEntityType; -import net.minecraft.block.Block; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraftforge.common.crafting.CraftingHelper; -import net.minecraftforge.event.entity.living.LivingEvent; -import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.event.RegistryEvent; -import net.minecraftforge.eventbus.api.SubscribeEvent; -import net.minecraftforge.fml.ModLoadingContext; -import net.minecraftforge.fml.common.Mod; -import net.minecraftforge.fml.event.lifecycle.*; -import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; - - -@Mod("engineersdecor") -public class ModEngineersDecor -{ - public static final String MODID = "engineersdecor"; - public static final String MODNAME = "Engineer's Decor"; - public static final int VERSION_DATAFIXER = 0; - private static final Logger LOGGER = LogManager.getLogger(); - - public ModEngineersDecor() - { - Auxiliaries.init(MODID, LOGGER, ModConfig::getServerConfig); - Auxiliaries.logGitVersion(MODNAME); - OptionalRecipeCondition.init(MODID, LOGGER); - FMLJavaModLoadingContext.get().getModEventBus().addListener(this::onSetup); - FMLJavaModLoadingContext.get().getModEventBus().addListener(this::onClientSetup); - FMLJavaModLoadingContext.get().getModEventBus().addListener(ForgeEvents::onConfigLoad); - FMLJavaModLoadingContext.get().getModEventBus().addListener(ForgeEvents::onConfigReload); - ModLoadingContext.get().registerConfig(net.minecraftforge.fml.config.ModConfig.Type.SERVER, ModConfig.SERVER_CONFIG_SPEC); - ModLoadingContext.get().registerConfig(net.minecraftforge.fml.config.ModConfig.Type.COMMON, ModConfig.COMMON_CONFIG_SPEC); - ModLoadingContext.get().registerConfig(net.minecraftforge.fml.config.ModConfig.Type.CLIENT, ModConfig.CLIENT_CONFIG_SPEC); - MinecraftForge.EVENT_BUS.register(this); - } - - public static final Logger logger() { return LOGGER; } - - // - // Events - // - - private void onSetup(final FMLCommonSetupEvent event) - { - LOGGER.info("Registering recipe condition processor ..."); - CraftingHelper.register(OptionalRecipeCondition.Serializer.INSTANCE); - wile.engineersdecor.libmc.detail.Networking.init(MODID); - } - - private void onClientSetup(final FMLClientSetupEvent event) - { - ModContent.registerContainerGuis(event); - ModContent.registerTileEntityRenderers(event); - ModContent.processContentClientSide(event); - wile.engineersdecor.libmc.detail.Overlay.register(); - } - - @Mod.EventBusSubscriber(bus=Mod.EventBusSubscriber.Bus.MOD) - public static class ForgeEvents - { - @SubscribeEvent - public static void onBlocksRegistry(final RegistryEvent.Register event) - { ModContent.registerBlocks(event); } - - @SubscribeEvent - public static void onItemRegistry(final RegistryEvent.Register event) - { ModContent.registerItems(event); ModContent.registerBlockItems(event); } - - @SubscribeEvent - public static void onTileEntityRegistry(final RegistryEvent.Register> event) - { ModContent.registerTileEntities(event); } - - @SubscribeEvent - public static void onRegisterEntityTypes(final RegistryEvent.Register> event) - { ModContent.registerEntities(event); } - - @SubscribeEvent - public static void onRegisterContainerTypes(final RegistryEvent.Register> event) - { ModContent.registerContainers(event); } - - public static void onConfigLoad(net.minecraftforge.fml.config.ModConfig.Loading configEvent) - { ModConfig.apply(); } - - public static void onConfigReload(net.minecraftforge.fml.config.ModConfig.Reloading configEvent) - { - try { - ModEngineersDecor.logger().info("Config file changed {}", configEvent.getConfig().getFileName()); - ModConfig.apply(); - } catch(Throwable e) { - ModEngineersDecor.logger().error("Failed to load changed config: " + e.getMessage()); - } - } - - @SubscribeEvent - public static void onDataGeneration(GatherDataEvent event) - { - event.getGenerator().addProvider(new wile.engineersdecor.libmc.datagen.LootTableGen(event.getGenerator(), ModContent::allBlocks)); - } - } - - // - // Item group / creative tab - // - public static final ItemGroup ITEMGROUP = (new ItemGroup("tab" + MODID) { - @OnlyIn(Dist.CLIENT) - public ItemStack createIcon() - { return new ItemStack(ModContent.SIGN_MODLOGO); } - }); - - // - // Player update event - // - @SubscribeEvent - public void onPlayerEvent(final LivingEvent.LivingUpdateEvent event) - { - if((event.getEntity().world == null) || (!(event.getEntity() instanceof PlayerEntity))) return; - final PlayerEntity player = (PlayerEntity)event.getEntity(); - if(player.isOnLadder()) EdLadderBlock.onPlayerUpdateEvent(player); - } - -} +package wile.engineersdecor; + +import wile.engineersdecor.blocks.*; +import wile.engineersdecor.libmc.detail.Auxiliaries; +import wile.engineersdecor.libmc.detail.OptionalRecipeCondition; +import net.minecraft.entity.EntityType; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.inventory.container.ContainerType; +import net.minecraft.item.ItemGroup; +import net.minecraft.tileentity.TileEntityType; +import net.minecraft.block.Block; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraftforge.common.crafting.CraftingHelper; +import net.minecraftforge.event.entity.living.LivingEvent; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.event.RegistryEvent; +import net.minecraftforge.eventbus.api.SubscribeEvent; +import net.minecraftforge.fml.ModLoadingContext; +import net.minecraftforge.fml.common.Mod; +import net.minecraftforge.fml.event.lifecycle.*; +import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + + +@Mod("engineersdecor") +public class ModEngineersDecor +{ + public static final String MODID = "engineersdecor"; + public static final String MODNAME = "Engineer's Decor"; + public static final int VERSION_DATAFIXER = 0; + private static final Logger LOGGER = LogManager.getLogger(); + + public ModEngineersDecor() + { + Auxiliaries.init(MODID, LOGGER, ModConfig::getServerConfig); + Auxiliaries.logGitVersion(MODNAME); + OptionalRecipeCondition.init(MODID, LOGGER); + FMLJavaModLoadingContext.get().getModEventBus().addListener(this::onSetup); + FMLJavaModLoadingContext.get().getModEventBus().addListener(this::onClientSetup); + FMLJavaModLoadingContext.get().getModEventBus().addListener(ForgeEvents::onConfigLoad); + FMLJavaModLoadingContext.get().getModEventBus().addListener(ForgeEvents::onConfigReload); + ModLoadingContext.get().registerConfig(net.minecraftforge.fml.config.ModConfig.Type.SERVER, ModConfig.SERVER_CONFIG_SPEC); + ModLoadingContext.get().registerConfig(net.minecraftforge.fml.config.ModConfig.Type.COMMON, ModConfig.COMMON_CONFIG_SPEC); + ModLoadingContext.get().registerConfig(net.minecraftforge.fml.config.ModConfig.Type.CLIENT, ModConfig.CLIENT_CONFIG_SPEC); + MinecraftForge.EVENT_BUS.register(this); + } + + public static final Logger logger() { return LOGGER; } + + // + // Events + // + + private void onSetup(final FMLCommonSetupEvent event) + { + LOGGER.info("Registering recipe condition processor ..."); + CraftingHelper.register(OptionalRecipeCondition.Serializer.INSTANCE); + wile.engineersdecor.libmc.detail.Networking.init(MODID); + } + + private void onClientSetup(final FMLClientSetupEvent event) + { + ModContent.registerContainerGuis(event); + ModContent.registerTileEntityRenderers(event); + ModContent.processContentClientSide(event); + wile.engineersdecor.libmc.detail.Overlay.register(); + } + + @Mod.EventBusSubscriber(bus=Mod.EventBusSubscriber.Bus.MOD) + public static class ForgeEvents + { + @SubscribeEvent + public static void onBlocksRegistry(final RegistryEvent.Register event) + { ModContent.registerBlocks(event); } + + @SubscribeEvent + public static void onItemRegistry(final RegistryEvent.Register event) + { ModContent.registerItems(event); ModContent.registerBlockItems(event); } + + @SubscribeEvent + public static void onTileEntityRegistry(final RegistryEvent.Register> event) + { ModContent.registerTileEntities(event); } + + @SubscribeEvent + public static void onRegisterEntityTypes(final RegistryEvent.Register> event) + { ModContent.registerEntities(event); } + + @SubscribeEvent + public static void onRegisterContainerTypes(final RegistryEvent.Register> event) + { ModContent.registerContainers(event); } + + public static void onConfigLoad(net.minecraftforge.fml.config.ModConfig.Loading configEvent) + { ModConfig.apply(); } + + public static void onConfigReload(net.minecraftforge.fml.config.ModConfig.Reloading configEvent) + { + try { + ModEngineersDecor.logger().info("Config file changed {}", configEvent.getConfig().getFileName()); + ModConfig.apply(); + } catch(Throwable e) { + ModEngineersDecor.logger().error("Failed to load changed config: " + e.getMessage()); + } + } + + @SubscribeEvent + public static void onDataGeneration(GatherDataEvent event) + { + event.getGenerator().addProvider(new wile.engineersdecor.libmc.datagen.LootTableGen(event.getGenerator(), ModContent::allBlocks)); + } + } + + // + // Item group / creative tab + // + public static final ItemGroup ITEMGROUP = (new ItemGroup("tab" + MODID) { + @OnlyIn(Dist.CLIENT) + public ItemStack makeIcon() + { return new ItemStack(ModContent.SIGN_MODLOGO); } + }); + + // + // Player update event + // + @SubscribeEvent + public void onPlayerEvent(final LivingEvent.LivingUpdateEvent event) + { + if((event.getEntity().level == null) || (!(event.getEntity() instanceof PlayerEntity))) return; + final PlayerEntity player = (PlayerEntity)event.getEntity(); + if(player.onClimbable()) EdLadderBlock.onPlayerUpdateEvent(player); + } + +} diff --git a/src/main/java/wile/engineersdecor/blocks/DecorBlock.java b/src/main/java/wile/engineersdecor/blocks/DecorBlock.java index d5a596b..d0739af 100644 --- a/src/main/java/wile/engineersdecor/blocks/DecorBlock.java +++ b/src/main/java/wile/engineersdecor/blocks/DecorBlock.java @@ -1,134 +1,135 @@ -/* - * @file DecorBlock.java - * @author Stefan Wilhelm (wile) - * @copyright (C) 2020 Stefan Wilhelm - * @license MIT (see https://opensource.org/licenses/MIT) - * - * Common functionality class for decor blocks. - * Mainly needed for: - * - MC block defaults. - * - Tooltip functionality - * - Model initialisation - */ -package wile.engineersdecor.blocks; - -import wile.engineersdecor.libmc.blocks.StandardBlocks; -import wile.engineersdecor.libmc.blocks.StandardBlocks.IStandardBlock; -import wile.engineersdecor.libmc.detail.Auxiliaries; -import net.minecraft.block.IWaterLoggable; -import net.minecraft.util.math.AxisAlignedBB; -import net.minecraft.util.math.shapes.VoxelShape; -import net.minecraft.block.Block; -import java.util.ArrayList; -import java.util.function.Supplier; - - -public class DecorBlock -{ - public static final long CFG_DEFAULT = StandardBlocks.CFG_DEFAULT; - public static final long CFG_CUTOUT = StandardBlocks.CFG_CUTOUT; - public static final long CFG_MIPPED = StandardBlocks.CFG_MIPPED; - public static final long CFG_TRANSLUCENT = StandardBlocks.CFG_TRANSLUCENT; - public static final long CFG_WATERLOGGABLE = StandardBlocks.CFG_WATERLOGGABLE; - public static final long CFG_HORIZIONTAL = StandardBlocks.CFG_HORIZIONTAL; - public static final long CFG_LOOK_PLACEMENT = StandardBlocks.CFG_LOOK_PLACEMENT; - public static final long CFG_FACING_PLACEMENT = StandardBlocks.CFG_FACING_PLACEMENT; - public static final long CFG_OPPOSITE_PLACEMENT = StandardBlocks.CFG_OPPOSITE_PLACEMENT; - public static final long CFG_FLIP_PLACEMENT_IF_SAME = StandardBlocks.CFG_FLIP_PLACEMENT_IF_SAME; - public static final long CFG_FLIP_PLACEMENT_SHIFTCLICK = StandardBlocks.CFG_FLIP_PLACEMENT_SHIFTCLICK; - public static final long CFG_STRICT_CONNECTIONS = StandardBlocks.CFG_STRICT_CONNECTIONS; - public static final long CFG_AI_PASSABLE = StandardBlocks.CFG_AI_PASSABLE; - public static final long CFG_HARD_IE_DEPENDENT = 0x8000000000000000L; - @Deprecated public static final long CFG_EXPERIMENTAL = 0x4000000000000000L; - - public static class Normal extends StandardBlocks.BaseBlock implements IDecorBlock - { - public Normal(long conf, Block.Properties properties) - { super(conf, properties); } - } - - public static class Cutout extends StandardBlocks.Cutout implements IDecorBlock - { - public Cutout(long conf, Block.Properties properties) - { super(conf, properties, Auxiliaries.getPixeledAABB(0, 0, 0, 16, 16,16 )); } - - public Cutout(long conf, Block.Properties properties, AxisAlignedBB aabb) - { super(conf, properties, aabb);} - - public Cutout(long conf, Block.Properties properties, VoxelShape voxel_shape) - { super(conf, properties, voxel_shape); } - - public Cutout(long conf, Block.Properties properties, AxisAlignedBB[] aabbs) - { super(conf, properties, aabbs); } - } - - public static class WaterLoggable extends StandardBlocks.WaterLoggable implements IStandardBlock, IWaterLoggable - { - public WaterLoggable(long config, Block.Properties properties) - { super(config, properties); } - - public WaterLoggable(long config, Block.Properties properties, AxisAlignedBB aabb) - { super(config, properties, aabb); } - - public WaterLoggable(long config, Block.Properties properties, AxisAlignedBB[] aabbs) - { super(config, properties, aabbs); } - - public WaterLoggable(long config, Block.Properties properties, VoxelShape voxel_shape) - { super(config, properties, voxel_shape); } - } - - public static class Directed extends StandardBlocks.Directed implements IDecorBlock - { - public Directed(long config, Block.Properties properties, final AxisAlignedBB unrotatedAABB) - { super(config, properties, unrotatedAABB); } - - public Directed(long config, Block.Properties properties, final AxisAlignedBB[] unrotatedAABBs) - { super(config, properties, unrotatedAABBs); } - - public Directed(long config, Block.Properties properties, final Supplier> shape_supplier) - { super(config, properties, shape_supplier); } - } - - public static class DirectedWaterLoggable extends StandardBlocks.DirectedWaterLoggable implements IDecorBlock,IWaterLoggable - { - public DirectedWaterLoggable(long config, Block.Properties properties, AxisAlignedBB aabb) - { super(config, properties, aabb); } - - public DirectedWaterLoggable(long config, Block.Properties properties, AxisAlignedBB[] aabbs) - { super(config, properties, aabbs); } - - public DirectedWaterLoggable(long config, Block.Properties properties, final Supplier> shape_supplier) - { super(config, properties, shape_supplier); } - } - - public static class Horizontal extends StandardBlocks.Horizontal implements IDecorBlock - { - public Horizontal(long config, Block.Properties properties, final AxisAlignedBB unrotatedAABB) - { super(config, properties, unrotatedAABB); } - - public Horizontal(long config, Block.Properties properties, final AxisAlignedBB[] unrotatedAABBs) - { super(config, properties, unrotatedAABBs); } - - public Horizontal(long config, Block.Properties properties, final Supplier> shape_supplier) - { super(config, properties, shape_supplier); } - } - - public static class HorizontalWaterLoggable extends StandardBlocks.HorizontalWaterLoggable implements IWaterLoggable - { - public HorizontalWaterLoggable(long config, Block.Properties properties, AxisAlignedBB aabb) - { super(config, properties, aabb); } - - public HorizontalWaterLoggable(long config, Block.Properties properties, AxisAlignedBB[] aabbs) - { super(config, properties, aabbs); } - - public HorizontalWaterLoggable(long config, Block.Properties properties, final Supplier> shape_supplier) - { super(config, properties, shape_supplier); } - } - - public static class HorizontalFourWayWaterLoggable extends StandardBlocks.HorizontalFourWayWaterLoggable implements IWaterLoggable - { - public HorizontalFourWayWaterLoggable(long config, Block.Properties properties, AxisAlignedBB base_aabb, AxisAlignedBB side_aabb, int railing_height_extension) - { super(config, properties, base_aabb, side_aabb, railing_height_extension); } - } - -} +/* + * @file DecorBlock.java + * @author Stefan Wilhelm (wile) + * @copyright (C) 2020 Stefan Wilhelm + * @license MIT (see https://opensource.org/licenses/MIT) + * + * Common functionality class for decor blocks. + * Mainly needed for: + * - MC block defaults. + * - Tooltip functionality + * - Model initialisation + */ +package wile.engineersdecor.blocks; + +import net.minecraft.block.AbstractBlock; +import wile.engineersdecor.libmc.blocks.StandardBlocks; +import wile.engineersdecor.libmc.blocks.StandardBlocks.IStandardBlock; +import wile.engineersdecor.libmc.detail.Auxiliaries; +import net.minecraft.block.IWaterLoggable; +import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.math.shapes.VoxelShape; +import java.util.ArrayList; +import java.util.function.Supplier; + + + +public class DecorBlock +{ + public static final long CFG_DEFAULT = StandardBlocks.CFG_DEFAULT; + public static final long CFG_CUTOUT = StandardBlocks.CFG_CUTOUT; + public static final long CFG_MIPPED = StandardBlocks.CFG_MIPPED; + public static final long CFG_TRANSLUCENT = StandardBlocks.CFG_TRANSLUCENT; + public static final long CFG_WATERLOGGABLE = StandardBlocks.CFG_WATERLOGGABLE; + public static final long CFG_HORIZIONTAL = StandardBlocks.CFG_HORIZIONTAL; + public static final long CFG_LOOK_PLACEMENT = StandardBlocks.CFG_LOOK_PLACEMENT; + public static final long CFG_FACING_PLACEMENT = StandardBlocks.CFG_FACING_PLACEMENT; + public static final long CFG_OPPOSITE_PLACEMENT = StandardBlocks.CFG_OPPOSITE_PLACEMENT; + public static final long CFG_FLIP_PLACEMENT_IF_SAME = StandardBlocks.CFG_FLIP_PLACEMENT_IF_SAME; + public static final long CFG_FLIP_PLACEMENT_SHIFTCLICK = StandardBlocks.CFG_FLIP_PLACEMENT_SHIFTCLICK; + public static final long CFG_STRICT_CONNECTIONS = StandardBlocks.CFG_STRICT_CONNECTIONS; + public static final long CFG_AI_PASSABLE = StandardBlocks.CFG_AI_PASSABLE; + public static final long CFG_HARD_IE_DEPENDENT = 0x8000000000000000L; + @Deprecated public static final long CFG_EXPERIMENTAL = 0x4000000000000000L; + + public static class Normal extends StandardBlocks.BaseBlock implements IDecorBlock + { + public Normal(long conf, AbstractBlock.Properties properties) + { super(conf, properties); } + } + + public static class Cutout extends StandardBlocks.Cutout implements IDecorBlock + { + public Cutout(long conf, AbstractBlock.Properties properties) + { super(conf, properties, Auxiliaries.getPixeledAABB(0, 0, 0, 16, 16,16 )); } + + public Cutout(long conf, AbstractBlock.Properties properties, AxisAlignedBB aabb) + { super(conf, properties, aabb);} + + public Cutout(long conf, AbstractBlock.Properties properties, VoxelShape voxel_shape) + { super(conf, properties, voxel_shape); } + + public Cutout(long conf, AbstractBlock.Properties properties, AxisAlignedBB[] aabbs) + { super(conf, properties, aabbs); } + } + + public static class WaterLoggable extends StandardBlocks.WaterLoggable implements IStandardBlock, IWaterLoggable + { + public WaterLoggable(long config, AbstractBlock.Properties properties) + { super(config, properties); } + + public WaterLoggable(long config, AbstractBlock.Properties properties, AxisAlignedBB aabb) + { super(config, properties, aabb); } + + public WaterLoggable(long config, AbstractBlock.Properties properties, AxisAlignedBB[] aabbs) + { super(config, properties, aabbs); } + + public WaterLoggable(long config, AbstractBlock.Properties properties, VoxelShape voxel_shape) + { super(config, properties, voxel_shape); } + } + + public static class Directed extends StandardBlocks.Directed implements IDecorBlock + { + public Directed(long config, AbstractBlock.Properties properties, final AxisAlignedBB unrotatedAABB) + { super(config, properties, unrotatedAABB); } + + public Directed(long config, AbstractBlock.Properties properties, final AxisAlignedBB[] unrotatedAABBs) + { super(config, properties, unrotatedAABBs); } + + public Directed(long config, AbstractBlock.Properties properties, final Supplier> shape_supplier) + { super(config, properties, shape_supplier); } + } + + public static class DirectedWaterLoggable extends StandardBlocks.DirectedWaterLoggable implements IDecorBlock,IWaterLoggable + { + public DirectedWaterLoggable(long config, AbstractBlock.Properties properties, AxisAlignedBB aabb) + { super(config, properties, aabb); } + + public DirectedWaterLoggable(long config, AbstractBlock.Properties properties, AxisAlignedBB[] aabbs) + { super(config, properties, aabbs); } + + public DirectedWaterLoggable(long config, AbstractBlock.Properties properties, final Supplier> shape_supplier) + { super(config, properties, shape_supplier); } + } + + public static class Horizontal extends StandardBlocks.Horizontal implements IDecorBlock + { + public Horizontal(long config, AbstractBlock.Properties properties, final AxisAlignedBB unrotatedAABB) + { super(config, properties, unrotatedAABB); } + + public Horizontal(long config, AbstractBlock.Properties properties, final AxisAlignedBB[] unrotatedAABBs) + { super(config, properties, unrotatedAABBs); } + + public Horizontal(long config, AbstractBlock.Properties properties, final Supplier> shape_supplier) + { super(config, properties, shape_supplier); } + } + + public static class HorizontalWaterLoggable extends StandardBlocks.HorizontalWaterLoggable implements IWaterLoggable + { + public HorizontalWaterLoggable(long config, AbstractBlock.Properties properties, AxisAlignedBB aabb) + { super(config, properties, aabb); } + + public HorizontalWaterLoggable(long config, AbstractBlock.Properties properties, AxisAlignedBB[] aabbs) + { super(config, properties, aabbs); } + + public HorizontalWaterLoggable(long config, AbstractBlock.Properties properties, final Supplier> shape_supplier) + { super(config, properties, shape_supplier); } + } + + public static class HorizontalFourWayWaterLoggable extends StandardBlocks.HorizontalFourWayWaterLoggable implements IWaterLoggable + { + public HorizontalFourWayWaterLoggable(long config, AbstractBlock.Properties properties, AxisAlignedBB base_aabb, AxisAlignedBB side_aabb, int railing_height_extension) + { super(config, properties, base_aabb, side_aabb, railing_height_extension); } + } + +} diff --git a/src/main/java/wile/engineersdecor/blocks/EdBreaker.java b/src/main/java/wile/engineersdecor/blocks/EdBreaker.java index c61183c..fc31b41 100644 --- a/src/main/java/wile/engineersdecor/blocks/EdBreaker.java +++ b/src/main/java/wile/engineersdecor/blocks/EdBreaker.java @@ -1,354 +1,356 @@ -/* - * @file EdBreaker.java - * @author Stefan Wilhelm (wile) - * @copyright (C) 2020 Stefan Wilhelm - * @license MIT (see https://opensource.org/licenses/MIT) - * - * Small Block Breaker - */ -package wile.engineersdecor.blocks; - -import wile.engineersdecor.ModConfig; -import wile.engineersdecor.ModContent; -import wile.engineersdecor.libmc.detail.Auxiliaries; -import wile.engineersdecor.libmc.detail.Inventories; -import wile.engineersdecor.libmc.detail.Overlay; -import net.minecraft.world.World; -import net.minecraft.world.IBlockReader; -import net.minecraft.world.GameRules; -import net.minecraft.world.server.ServerWorld; -import net.minecraft.state.BooleanProperty; -import net.minecraft.state.StateContainer; -import net.minecraft.block.Blocks; -import net.minecraft.block.SoundType; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.tileentity.ITickableTileEntity; -import net.minecraft.tileentity.TileEntityType; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.entity.item.ItemEntity; -import net.minecraft.item.BlockItemUseContext; -import net.minecraft.item.ItemStack; -import net.minecraft.particles.ParticleTypes; -import net.minecraft.nbt.CompoundNBT; -import net.minecraft.util.*; -import net.minecraft.util.math.BlockRayTraceResult; -import net.minecraft.util.math.AxisAlignedBB; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.MathHelper; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; -import net.minecraftforge.common.util.LazyOptional; -import net.minecraftforge.energy.CapabilityEnergy; -import net.minecraftforge.energy.IEnergyStorage; -import wile.engineersdecor.libmc.detail.RfEnergy; - -import javax.annotation.Nullable; -import java.util.HashSet; -import java.util.List; -import java.util.Random; - - -public class EdBreaker -{ - public static void on_config(int boost_energy_per_tick, int breaking_time_per_hardness, int min_breaking_time_ticks, boolean power_required) - { BreakerTileEntity.on_config(boost_energy_per_tick, breaking_time_per_hardness, min_breaking_time_ticks, power_required); } - - //-------------------------------------------------------------------------------------------------------------------- - // Block - //-------------------------------------------------------------------------------------------------------------------- - - public static class BreakerBlock extends DecorBlock.HorizontalWaterLoggable implements IDecorBlock - { - public static final BooleanProperty ACTIVE = BooleanProperty.create("active"); - - public BreakerBlock(long config, Block.Properties builder, final AxisAlignedBB[] unrotatedAABBs) - { super(config, builder, unrotatedAABBs); } - - @Override - protected void fillStateContainer(StateContainer.Builder builder) - { super.fillStateContainer(builder); builder.add(ACTIVE); } - - @Override - @Nullable - public BlockState getStateForPlacement(BlockItemUseContext context) - { return super.getStateForPlacement(context).with(ACTIVE, false); } - - @Override - public boolean hasTileEntity(BlockState state) - { return true; } - - @Override - @Nullable - public TileEntity createTileEntity(BlockState state, IBlockReader world) - { return new BreakerTileEntity(); } - - @OnlyIn(Dist.CLIENT) - public void animateTick(BlockState state, World world, BlockPos pos, Random rnd) - { - if((state.getBlock()!=this) || (!state.get(ACTIVE))) return; - final double rv = rnd.nextDouble(); - if(rv > 0.8) return; - final double x=0.5+pos.getX(), y=0.5+pos.getY(), z=0.5+pos.getZ(); - final double xc=0.52, xr=rnd.nextDouble()*0.4-0.2, yr=(y-0.3+rnd.nextDouble()*0.2); - switch(state.get(HORIZONTAL_FACING)) { - case WEST: world.addParticle(ParticleTypes.SMOKE, x-xc, yr, z+xr, 0.0, 0.0, 0.0); break; - case EAST: world.addParticle(ParticleTypes.SMOKE, x+xc, yr, z+xr, 0.0, 0.0, 0.0); break; - case NORTH: world.addParticle(ParticleTypes.SMOKE, x+xr, yr, z-xc, 0.0, 0.0, 0.0); break; - default: world.addParticle(ParticleTypes.SMOKE, x+xr, yr, z+xc, 0.0, 0.0, 0.0); break; - } - } - - @Override - @SuppressWarnings("deprecation") - public void neighborChanged(BlockState state, World world, BlockPos pos, Block block, BlockPos fromPos, boolean unused) - { - if(!(world instanceof World) || (((World) world).isRemote)) return; - TileEntity te = world.getTileEntity(pos); - if(!(te instanceof BreakerTileEntity)) return; - ((BreakerTileEntity)te).block_updated(); - } - - @Override - @SuppressWarnings("deprecation") - public boolean canProvidePower(BlockState state) - { return true; } - - @Override - @SuppressWarnings("deprecation") - public int getWeakPower(BlockState blockState, IBlockReader blockAccess, BlockPos pos, Direction side) - { return 0; } - - @Override - @SuppressWarnings("deprecation") - public int getStrongPower(BlockState blockState, IBlockReader blockAccess, BlockPos pos, Direction side) - { return 0; } - - @Override - @SuppressWarnings("deprecation") - public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) - { - if(world.isRemote()) return ActionResultType.SUCCESS; - TileEntity te = world.getTileEntity(pos); - if(te instanceof BreakerTileEntity) ((BreakerTileEntity)te).state_message(player); - return ActionResultType.CONSUME; - } - } - - //-------------------------------------------------------------------------------------------------------------------- - // Tile entity - //-------------------------------------------------------------------------------------------------------------------- - - public static class BreakerTileEntity extends TileEntity implements ITickableTileEntity - { - public static final int IDLE_TICK_INTERVAL = 40; - public static final int TICK_INTERVAL = 5; - public static final int BOOST_FACTOR = 8; - public static final int DEFAULT_BOOST_ENERGY = 64; - public static final int DEFAULT_BREAKING_RELUCTANCE = 17; - public static final int DEFAULT_MIN_BREAKING_TIME = 15; - public static final int MAX_BREAKING_TIME = 800; - private static int boost_energy_consumption = DEFAULT_BOOST_ENERGY; - private static int energy_max = 32000; - private static int breaking_reluctance = DEFAULT_BREAKING_RELUCTANCE; - private static int min_breaking_time = DEFAULT_MIN_BREAKING_TIME; - private static boolean requires_power = false; - private int tick_timer_; - private int active_timer_; - private int proc_time_elapsed_; - private int time_needed_; - private final RfEnergy.Battery battery_; - private final LazyOptional energy_handler_; - - public static void on_config(int boost_energy_per_tick, int breaking_time_per_hardness, int min_breaking_time_ticks, boolean power_required) - { - boost_energy_consumption = TICK_INTERVAL * MathHelper.clamp(boost_energy_per_tick, 4, 4096); - energy_max = Math.max(boost_energy_consumption * 10, 100000); - breaking_reluctance = MathHelper.clamp(breaking_time_per_hardness, 5, 50); - min_breaking_time = MathHelper.clamp(min_breaking_time_ticks, 10, 100); - requires_power = power_required; - ModConfig.log("Config block breaker: Boost energy consumption:" + (boost_energy_consumption/TICK_INTERVAL) + "rf/t, reluctance=" + breaking_reluctance + "t/hrdn, break time offset=" + min_breaking_time + "t."); - } - - public BreakerTileEntity() - { this(ModContent.TET_SMALL_BLOCK_BREAKER); } - - public BreakerTileEntity(TileEntityType te_type) - { - super(te_type); - battery_ = new RfEnergy.Battery(energy_max, boost_energy_consumption, 0); - energy_handler_ = battery_.createEnergyHandler(); - } - - public void block_updated() - { if(tick_timer_ > 2) tick_timer_ = 2; } - - public void readnbt(CompoundNBT nbt) - { battery_.load(nbt); } - - private void writenbt(CompoundNBT nbt) - { battery_.save(nbt); } - - public void state_message(PlayerEntity player) - { - String progress = "0"; - if((proc_time_elapsed_ > 0) && (time_needed_ > 0)) { - progress = Integer.toString((int)MathHelper.clamp((((double)proc_time_elapsed_) / ((double)time_needed_) * 100), 0, 100)); - } - Overlay.show(player, Auxiliaries.localizable("block.engineersdecor.small_block_breaker.status", new Object[]{battery_.getSOC(), energy_max, progress })); - } - - // TileEntity ------------------------------------------------------------------------------ - - @Override - public void read(BlockState state, CompoundNBT nbt) - { super.read(state, nbt); readnbt(nbt); } - - @Override - public CompoundNBT write(CompoundNBT nbt) - { super.write(nbt); writenbt(nbt); return nbt; } - - @Override - public void remove() - { - super.remove(); - energy_handler_.invalidate(); - } - - // Capability export ---------------------------------------------------------------------------- - - @Override - public LazyOptional getCapability(net.minecraftforge.common.capabilities.Capability capability, @Nullable Direction facing) - { - if(capability == CapabilityEnergy.ENERGY) return energy_handler_.cast(); - return super.getCapability(capability, facing); - } - - // ITickable ------------------------------------------------------------------------------------ - - private static HashSet blacklist = new HashSet<>(); - static { - blacklist.add(Blocks.AIR); - blacklist.add(Blocks.BEDROCK); - blacklist.add(Blocks.FIRE); - blacklist.add(Blocks.END_PORTAL); - blacklist.add(Blocks.END_GATEWAY); - blacklist.add(Blocks.END_PORTAL_FRAME); - blacklist.add(Blocks.NETHER_PORTAL); - blacklist.add(Blocks.BARRIER); - } - - private static boolean isBreakable(BlockState state, BlockPos pos, World world) - { - final Block block = state.getBlock(); - if(blacklist.contains(block)) return false; - if(state.getMaterial().isLiquid()) return false; - if(block.isAir(state, world, pos)) return false; - float bh = state.getBlockHardness(world, pos); - if((bh<0) || (bh>55)) return false; - return true; - } - - private static void spawnBlockAsEntity(World world, BlockPos pos, ItemStack stack) { - if(world.isRemote || stack.isEmpty() || (!world.getGameRules().getBoolean(GameRules.DO_TILE_DROPS)) || world.restoringBlockSnapshots) return; - ItemEntity e = new ItemEntity(world, - ((world.rand.nextFloat()*0.1)+0.5) + pos.getX(), - ((world.rand.nextFloat()*0.1)+0.5) + pos.getY(), - ((world.rand.nextFloat()*0.1)+0.5) + pos.getZ(), - stack - ); - e.setDefaultPickupDelay(); - e.setMotion((world.rand.nextFloat()*0.1-0.05), (world.rand.nextFloat()*0.1-0.03), (world.rand.nextFloat()*0.1-0.05)); - world.addEntity(e); - } - - private static boolean canInsertInto(World world, BlockPos pos) - { - // Maybe make a tag for that. The question is if it is actually worth it, or if that would be only - // tag spamming the game. So for now only FH and VH. - final BlockState state = world.getBlockState(pos); - return (state.getBlock() == ModContent.FACTORY_HOPPER) || (state.getBlock() == Blocks.HOPPER); - } - - private boolean breakBlock(BlockState state, BlockPos pos, World world) - { - if(world.isRemote || (!(world instanceof ServerWorld)) || world.restoringBlockSnapshots) return false; // retry next cycle - List drops; - final Block block = state.getBlock(); - final boolean insert = canInsertInto(world, getPos().down()); - drops = Block.getDrops(state, (ServerWorld)world, pos, world.getTileEntity(pos)); - world.removeBlock(pos, false); - for(ItemStack drop:drops) { - if(!insert) { - spawnBlockAsEntity(world, pos, drop); - } else { - final ItemStack remaining = Inventories.insert(world, getPos().down(), Direction.UP, drop, false); - if(!remaining.isEmpty()) spawnBlockAsEntity(world, pos, remaining); - } - } - SoundType stype = state.getBlock().getSoundType(state, world, pos, null); - if(stype != null) world.playSound(null, pos, stype.getPlaceSound(), SoundCategory.BLOCKS, stype.getVolume()*0.6f, stype.getPitch()); - return true; - } - - @Override - @SuppressWarnings("deprecation") - public void tick() - { - if(--tick_timer_ > 0) return; - final BlockState device_state = world.getBlockState(pos); - if(!(device_state.getBlock() instanceof BreakerBlock)) return; - if(world.isRemote) { - if(!device_state.get(BreakerBlock.ACTIVE)) { - tick_timer_ = TICK_INTERVAL; - } else { - tick_timer_ = 1; - // not sure if is so cool to do this each tick ... may be simplified/removed again. - SoundEvent sound = SoundEvents.BLOCK_WOOD_HIT; - BlockState target_state = world.getBlockState(pos.offset(device_state.get(BreakerBlock.HORIZONTAL_FACING))); - SoundType stype = target_state.getBlock().getSoundType(target_state); - if((stype == SoundType.CLOTH) || (stype == SoundType.PLANT) || (stype == SoundType.SNOW)) { - sound = SoundEvents.BLOCK_WOOL_HIT; - } else if((stype == SoundType.GROUND) || (stype == SoundType.SAND)) { - sound = SoundEvents.BLOCK_GRAVEL_HIT; - } - world.playSound(pos.getX(), pos.getY(), pos.getZ(), sound, SoundCategory.BLOCKS, 0.1f, 1.2f, false); - } - } else { - tick_timer_ = TICK_INTERVAL; - final BlockPos target_pos = pos.offset(device_state.get(BreakerBlock.HORIZONTAL_FACING)); - final BlockState target_state = world.getBlockState(target_pos); - if((world.isBlockPowered(pos)) || (!isBreakable(target_state, target_pos, world))) { - if(device_state.get(BreakerBlock.ACTIVE)) world.setBlockState(pos, device_state.with(BreakerBlock.ACTIVE, false), 1|2); - proc_time_elapsed_ = 0; - tick_timer_ = IDLE_TICK_INTERVAL; - return; - } - time_needed_ = MathHelper.clamp((int)(target_state.getBlockHardness(world, pos) * breaking_reluctance) + min_breaking_time, min_breaking_time, MAX_BREAKING_TIME); - if(battery_.draw(boost_energy_consumption)) { - proc_time_elapsed_ += TICK_INTERVAL * (1+BOOST_FACTOR); - time_needed_ += min_breaking_time * (3*BOOST_FACTOR/5); - active_timer_ = 2; - } else if(!requires_power) { - proc_time_elapsed_ += TICK_INTERVAL; - active_timer_ = 1024; - } else if(active_timer_ > 0) { - --active_timer_; - } - boolean active = (active_timer_ > 0); - if(requires_power && !active) { - proc_time_elapsed_ = Math.max(0, proc_time_elapsed_ - 2*TICK_INTERVAL); - } - if(proc_time_elapsed_ >= time_needed_) { - proc_time_elapsed_ = 0; - breakBlock(target_state, target_pos, world); - active = false; - } - if(device_state.get(BreakerBlock.ACTIVE) != active) { - world.setBlockState(pos, device_state.with(BreakerBlock.ACTIVE, active), 1|2); - } - } - } - } -} +/* + * @file EdBreaker.java + * @author Stefan Wilhelm (wile) + * @copyright (C) 2020 Stefan Wilhelm + * @license MIT (see https://opensource.org/licenses/MIT) + * + * Small Block Breaker + */ +package wile.engineersdecor.blocks; + +import wile.engineersdecor.ModConfig; +import wile.engineersdecor.ModContent; +import wile.engineersdecor.libmc.detail.Auxiliaries; +import wile.engineersdecor.libmc.detail.Inventories; +import wile.engineersdecor.libmc.detail.Overlay; +import net.minecraft.world.World; +import net.minecraft.world.IBlockReader; +import net.minecraft.world.GameRules; +import net.minecraft.world.server.ServerWorld; +import net.minecraft.state.BooleanProperty; +import net.minecraft.state.StateContainer; +import net.minecraft.block.AbstractBlock; +import net.minecraft.block.Blocks; +import net.minecraft.block.SoundType; +import net.minecraft.block.Block; +import net.minecraft.block.BlockState; +import net.minecraft.tileentity.ITickableTileEntity; +import net.minecraft.tileentity.TileEntityType; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.entity.item.ItemEntity; +import net.minecraft.item.BlockItemUseContext; +import net.minecraft.item.ItemStack; +import net.minecraft.particles.ParticleTypes; +import net.minecraft.nbt.CompoundNBT; +import net.minecraft.util.*; +import net.minecraft.util.math.BlockRayTraceResult; +import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.MathHelper; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; +import net.minecraftforge.common.util.LazyOptional; +import net.minecraftforge.energy.CapabilityEnergy; +import net.minecraftforge.energy.IEnergyStorage; +import wile.engineersdecor.libmc.detail.RfEnergy; + +import javax.annotation.Nullable; +import java.util.HashSet; +import java.util.List; +import java.util.Random; + + + +public class EdBreaker +{ + public static void on_config(int boost_energy_per_tick, int breaking_time_per_hardness, int min_breaking_time_ticks, boolean power_required) + { BreakerTileEntity.on_config(boost_energy_per_tick, breaking_time_per_hardness, min_breaking_time_ticks, power_required); } + + //-------------------------------------------------------------------------------------------------------------------- + // Block + //-------------------------------------------------------------------------------------------------------------------- + + public static class BreakerBlock extends DecorBlock.HorizontalWaterLoggable implements IDecorBlock + { + public static final BooleanProperty ACTIVE = BooleanProperty.create("active"); + + public BreakerBlock(long config, AbstractBlock.Properties builder, final AxisAlignedBB[] unrotatedAABBs) + { super(config, builder, unrotatedAABBs); } + + @Override + protected void createBlockStateDefinition(StateContainer.Builder builder) + { super.createBlockStateDefinition(builder); builder.add(ACTIVE); } + + @Override + @Nullable + public BlockState getStateForPlacement(BlockItemUseContext context) + { return super.getStateForPlacement(context).setValue(ACTIVE, false); } + + @Override + public boolean hasTileEntity(BlockState state) + { return true; } + + @Override + @Nullable + public TileEntity createTileEntity(BlockState state, IBlockReader world) + { return new BreakerTileEntity(); } + + @OnlyIn(Dist.CLIENT) + public void animateTick(BlockState state, World world, BlockPos pos, Random rnd) + { + if((state.getBlock()!=this) || (!state.getValue(ACTIVE))) return; + final double rv = rnd.nextDouble(); + if(rv > 0.8) return; + final double x=0.5+pos.getX(), y=0.5+pos.getY(), z=0.5+pos.getZ(); + final double xc=0.52, xr=rnd.nextDouble()*0.4-0.2, yr=(y-0.3+rnd.nextDouble()*0.2); + switch(state.getValue(HORIZONTAL_FACING)) { + case WEST: world.addParticle(ParticleTypes.SMOKE, x-xc, yr, z+xr, 0.0, 0.0, 0.0); break; + case EAST: world.addParticle(ParticleTypes.SMOKE, x+xc, yr, z+xr, 0.0, 0.0, 0.0); break; + case NORTH: world.addParticle(ParticleTypes.SMOKE, x+xr, yr, z-xc, 0.0, 0.0, 0.0); break; + default: world.addParticle(ParticleTypes.SMOKE, x+xr, yr, z+xc, 0.0, 0.0, 0.0); break; + } + } + + @Override + @SuppressWarnings("deprecation") + public void neighborChanged(BlockState state, World world, BlockPos pos, Block block, BlockPos fromPos, boolean unused) + { + if(!(world instanceof World) || (((World) world).isClientSide)) return; + TileEntity te = world.getBlockEntity(pos); + if(!(te instanceof BreakerTileEntity)) return; + ((BreakerTileEntity)te).block_updated(); + } + + @Override + @SuppressWarnings("deprecation") + public boolean isSignalSource(BlockState state) + { return true; } + + @Override + @SuppressWarnings("deprecation") + public int getSignal(BlockState blockState, IBlockReader blockAccess, BlockPos pos, Direction side) + { return 0; } + + @Override + @SuppressWarnings("deprecation") + public int getDirectSignal(BlockState blockState, IBlockReader blockAccess, BlockPos pos, Direction side) + { return 0; } + + @Override + @SuppressWarnings("deprecation") + public ActionResultType use(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) + { + if(world.isClientSide()) return ActionResultType.SUCCESS; + TileEntity te = world.getBlockEntity(pos); + if(te instanceof BreakerTileEntity) ((BreakerTileEntity)te).state_message(player); + return ActionResultType.CONSUME; + } + } + + //-------------------------------------------------------------------------------------------------------------------- + // Tile entity + //-------------------------------------------------------------------------------------------------------------------- + + public static class BreakerTileEntity extends TileEntity implements ITickableTileEntity + { + public static final int IDLE_TICK_INTERVAL = 40; + public static final int TICK_INTERVAL = 5; + public static final int BOOST_FACTOR = 8; + public static final int DEFAULT_BOOST_ENERGY = 64; + public static final int DEFAULT_BREAKING_RELUCTANCE = 17; + public static final int DEFAULT_MIN_BREAKING_TIME = 15; + public static final int MAX_BREAKING_TIME = 800; + private static int boost_energy_consumption = DEFAULT_BOOST_ENERGY; + private static int energy_max = 32000; + private static int breaking_reluctance = DEFAULT_BREAKING_RELUCTANCE; + private static int min_breaking_time = DEFAULT_MIN_BREAKING_TIME; + private static boolean requires_power = false; + private int tick_timer_; + private int active_timer_; + private int proc_time_elapsed_; + private int time_needed_; + private final RfEnergy.Battery battery_; + private final LazyOptional energy_handler_; + + public static void on_config(int boost_energy_per_tick, int breaking_time_per_hardness, int min_breaking_time_ticks, boolean power_required) + { + boost_energy_consumption = TICK_INTERVAL * MathHelper.clamp(boost_energy_per_tick, 4, 4096); + energy_max = Math.max(boost_energy_consumption * 10, 100000); + breaking_reluctance = MathHelper.clamp(breaking_time_per_hardness, 5, 50); + min_breaking_time = MathHelper.clamp(min_breaking_time_ticks, 10, 100); + requires_power = power_required; + ModConfig.log("Config block breaker: Boost energy consumption:" + (boost_energy_consumption/TICK_INTERVAL) + "rf/t, reluctance=" + breaking_reluctance + "t/hrdn, break time offset=" + min_breaking_time + "t."); + } + + public BreakerTileEntity() + { this(ModContent.TET_SMALL_BLOCK_BREAKER); } + + public BreakerTileEntity(TileEntityType te_type) + { + super(te_type); + battery_ = new RfEnergy.Battery(energy_max, boost_energy_consumption, 0); + energy_handler_ = battery_.createEnergyHandler(); + } + + public void block_updated() + { if(tick_timer_ > 2) tick_timer_ = 2; } + + public void readnbt(CompoundNBT nbt) + { battery_.load(nbt); } + + private void writenbt(CompoundNBT nbt) + { battery_.save(nbt); } + + public void state_message(PlayerEntity player) + { + String progress = "0"; + if((proc_time_elapsed_ > 0) && (time_needed_ > 0)) { + progress = Integer.toString((int)MathHelper.clamp((((double)proc_time_elapsed_) / ((double)time_needed_) * 100), 0, 100)); + } + Overlay.show(player, Auxiliaries.localizable("block.engineersdecor.small_block_breaker.status", new Object[]{battery_.getSOC(), energy_max, progress })); + } + + // TileEntity ------------------------------------------------------------------------------ + + @Override + public void load(BlockState state, CompoundNBT nbt) + { super.load(state, nbt); readnbt(nbt); } + + @Override + public CompoundNBT save(CompoundNBT nbt) + { super.save(nbt); writenbt(nbt); return nbt; } + + @Override + public void setRemoved() + { + super.setRemoved(); + energy_handler_.invalidate(); + } + + // Capability export ---------------------------------------------------------------------------- + + @Override + public LazyOptional getCapability(net.minecraftforge.common.capabilities.Capability capability, @Nullable Direction facing) + { + if(capability == CapabilityEnergy.ENERGY) return energy_handler_.cast(); + return super.getCapability(capability, facing); + } + + // ITickable ------------------------------------------------------------------------------------ + + private static final HashSet blacklist = new HashSet<>(); + static { + blacklist.add(Blocks.AIR); + blacklist.add(Blocks.BEDROCK); + blacklist.add(Blocks.FIRE); + blacklist.add(Blocks.END_PORTAL); + blacklist.add(Blocks.END_GATEWAY); + blacklist.add(Blocks.END_PORTAL_FRAME); + blacklist.add(Blocks.NETHER_PORTAL); + blacklist.add(Blocks.BARRIER); + } + + private static boolean isBreakable(BlockState state, BlockPos pos, World world) + { + final Block block = state.getBlock(); + if(blacklist.contains(block)) return false; + if(state.getMaterial().isLiquid()) return false; + if(block.isAir(state, world, pos)) return false; + float bh = state.getDestroySpeed(world, pos); + if((bh<0) || (bh>55)) return false; + return true; + } + + private static void spawnBlockAsEntity(World world, BlockPos pos, ItemStack stack) { + if(world.isClientSide || stack.isEmpty() || (!world.getGameRules().getBoolean(GameRules.RULE_DOBLOCKDROPS)) || world.restoringBlockSnapshots) return; + ItemEntity e = new ItemEntity(world, + ((world.random.nextFloat()*0.1)+0.5) + pos.getX(), + ((world.random.nextFloat()*0.1)+0.5) + pos.getY(), + ((world.random.nextFloat()*0.1)+0.5) + pos.getZ(), + stack + ); + e.setDefaultPickUpDelay(); + e.setDeltaMovement((world.random.nextFloat()*0.1-0.05), (world.random.nextFloat()*0.1-0.03), (world.random.nextFloat()*0.1-0.05)); + world.addFreshEntity(e); + } + + private static boolean canInsertInto(World world, BlockPos pos) + { + // Maybe make a tag for that. The question is if it is actually worth it, or if that would be only + // tag spamming the game. So for now only FH and VH. + final BlockState state = world.getBlockState(pos); + return (state.getBlock() == ModContent.FACTORY_HOPPER) || (state.getBlock() == Blocks.HOPPER); + } + + private boolean breakBlock(BlockState state, BlockPos pos, World world) + { + if(world.isClientSide || (!(world instanceof ServerWorld)) || world.restoringBlockSnapshots) return false; // retry next cycle + List drops; + final Block block = state.getBlock(); + final boolean insert = canInsertInto(world, getBlockPos().below()); + drops = Block.getDrops(state, (ServerWorld)world, pos, world.getBlockEntity(pos)); + world.removeBlock(pos, false); + for(ItemStack drop:drops) { + if(!insert) { + spawnBlockAsEntity(world, pos, drop); + } else { + final ItemStack remaining = Inventories.insert(world, getBlockPos().below(), Direction.UP, drop, false); + if(!remaining.isEmpty()) spawnBlockAsEntity(world, pos, remaining); + } + } + SoundType stype = state.getBlock().getSoundType(state, world, pos, null); + if(stype != null) world.playSound(null, pos, stype.getPlaceSound(), SoundCategory.BLOCKS, stype.getVolume()*0.6f, stype.getPitch()); + return true; + } + + @Override + @SuppressWarnings("deprecation") + public void tick() + { + if(--tick_timer_ > 0) return; + final BlockState device_state = level.getBlockState(worldPosition); + if(!(device_state.getBlock() instanceof BreakerBlock)) return; + if(level.isClientSide) { + if(!device_state.getValue(BreakerBlock.ACTIVE)) { + tick_timer_ = TICK_INTERVAL; + } else { + tick_timer_ = 1; + // not sure if is so cool to do this each tick ... may be simplified/removed again. + SoundEvent sound = SoundEvents.WOOD_HIT; + BlockState target_state = level.getBlockState(worldPosition.relative(device_state.getValue(BreakerBlock.HORIZONTAL_FACING))); + SoundType stype = target_state.getBlock().getSoundType(target_state); + if((stype == SoundType.WOOL) || (stype == SoundType.GRASS) || (stype == SoundType.SNOW)) { + sound = SoundEvents.WOOL_HIT; + } else if((stype == SoundType.GRAVEL) || (stype == SoundType.SAND)) { + sound = SoundEvents.GRAVEL_HIT; + } + level.playLocalSound(worldPosition.getX(), worldPosition.getY(), worldPosition.getZ(), sound, SoundCategory.BLOCKS, 0.1f, 1.2f, false); + } + } else { + tick_timer_ = TICK_INTERVAL; + final BlockPos target_pos = worldPosition.relative(device_state.getValue(BreakerBlock.HORIZONTAL_FACING)); + final BlockState target_state = level.getBlockState(target_pos); + if((level.hasNeighborSignal(worldPosition)) || (!isBreakable(target_state, target_pos, level))) { + if(device_state.getValue(BreakerBlock.ACTIVE)) level.setBlock(worldPosition, device_state.setValue(BreakerBlock.ACTIVE, false), 1|2); + proc_time_elapsed_ = 0; + tick_timer_ = IDLE_TICK_INTERVAL; + return; + } + time_needed_ = MathHelper.clamp((int)(target_state.getDestroySpeed(level, worldPosition) * breaking_reluctance) + min_breaking_time, min_breaking_time, MAX_BREAKING_TIME); + if(battery_.draw(boost_energy_consumption)) { + proc_time_elapsed_ += TICK_INTERVAL * (1+BOOST_FACTOR); + time_needed_ += min_breaking_time * (3*BOOST_FACTOR/5); + active_timer_ = 2; + } else if(!requires_power) { + proc_time_elapsed_ += TICK_INTERVAL; + active_timer_ = 1024; + } else if(active_timer_ > 0) { + --active_timer_; + } + boolean active = (active_timer_ > 0); + if(requires_power && !active) { + proc_time_elapsed_ = Math.max(0, proc_time_elapsed_ - 2*TICK_INTERVAL); + } + if(proc_time_elapsed_ >= time_needed_) { + proc_time_elapsed_ = 0; + breakBlock(target_state, target_pos, level); + active = false; + } + if(device_state.getValue(BreakerBlock.ACTIVE) != active) { + level.setBlock(worldPosition, device_state.setValue(BreakerBlock.ACTIVE, active), 1|2); + } + } + } + } +} diff --git a/src/main/java/wile/engineersdecor/blocks/EdCatwalkBlock.java b/src/main/java/wile/engineersdecor/blocks/EdCatwalkBlock.java index ae4e329..4422980 100644 --- a/src/main/java/wile/engineersdecor/blocks/EdCatwalkBlock.java +++ b/src/main/java/wile/engineersdecor/blocks/EdCatwalkBlock.java @@ -1,129 +1,131 @@ -/* - * @file EdCatwalkBlock.java - * @author Stefan Wilhelm (wile) - * @copyright (C) 2020 Stefan Wilhelm - * @license MIT (see https://opensource.org/licenses/MIT) - * - * Bottom aligned platforms with railings. - */ -package wile.engineersdecor.blocks; - -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.fluid.Fluids; -import net.minecraft.item.*; -import net.minecraft.state.BooleanProperty; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.*; -import net.minecraft.util.math.AxisAlignedBB; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.BlockRayTraceResult; -import net.minecraft.util.math.vector.Vector3d; -import net.minecraft.world.IBlockReader; -import net.minecraft.world.World; -import wile.engineersdecor.ModContent; -import wile.engineersdecor.libmc.detail.Inventories; - -import javax.annotation.Nullable; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; -import java.util.stream.Collectors; - -public class EdCatwalkBlock extends DecorBlock.HorizontalFourWayWaterLoggable implements IDecorBlock -{ - final Block railing_block; - final AxisAlignedBB base_aabb; - - public EdCatwalkBlock(long config, Block.Properties properties, final AxisAlignedBB base_aabb, final AxisAlignedBB railing_aabb, final Block railing_block) - { super(config, properties, base_aabb, railing_aabb, 0); this.railing_block = railing_block; this.base_aabb=base_aabb; } - - @Override - public boolean propagatesSkylightDown(BlockState state, IBlockReader reader, BlockPos pos) - { return true; } - - @Override - @Nullable - public BlockState getStateForPlacement(BlockItemUseContext context) - { return super.getStateForPlacement(context).with(NORTH, false).with(EAST, false).with(SOUTH, false).with(WEST, false); } - - public static boolean place_consume(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, int shrink) - { - if(!world.setBlockState(pos, state, 1|2)) return false; - world.playSound(player, pos, SoundEvents.BLOCK_METAL_PLACE, SoundCategory.BLOCKS, 1f, 1f); - if((!player.isCreative()) && (!world.isRemote())) { - ItemStack stack = player.getHeldItem(hand); - if(shrink >= 0) { - stack.shrink(shrink); - } else if(stack.getCount() < stack.getMaxStackSize()) { - stack.grow(Math.abs(shrink)); - } else { - Inventories.give(player, new ItemStack(stack.getItem(), Math.abs(shrink))); - } - Inventories.setItemInPlayerHand(player, hand, stack); - } - return true; - } - - @Override - @SuppressWarnings("deprecation") - public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) - { - final Item item = player.getHeldItem(hand).getItem(); - if((!(item instanceof BlockItem))) return ActionResultType.PASS; - final Block block = ((BlockItem)item).getBlock(); - if(block == this) { - if(hit.getFace().getAxis().isHorizontal()) return ActionResultType.PASS; // place new block on the clicked side. - BlockPos adjacent_pos = pos.offset(player.getHorizontalFacing()); - BlockState adjacent_state = world.getBlockState(adjacent_pos); - if(adjacent_state.isReplaceable(new DirectionalPlaceContext(world, adjacent_pos, hit.getFace().getOpposite(), player.getHeldItem(hand), hit.getFace()))) { - BlockState place_state = getDefaultState(); - place_state = place_state.with(WATERLOGGED,adjacent_state.getFluidState().getFluid()==Fluids.WATER); - place_consume(place_state, world, adjacent_pos, player, hand, 1); - } - return world.isRemote() ? ActionResultType.SUCCESS : ActionResultType.CONSUME; - } - if(block == railing_block) { - Direction face = hit.getFace(); - final Vector3d rhv = hit.getHitVec().subtract(Vector3d.copyCentered(hit.getPos())); - if(face.getAxis().isHorizontal()) { - // Side or railing clicked - if(rhv.mul(Vector3d.copy(face.getDirectionVec())).scale(2).lengthSquared() < 0.99) face = face.getOpposite(); // click on railing, not the outer side. - } else if(player.getDistanceSq(Vector3d.copyCentered(pos)) < 3) { - // near accurate placement - face = Direction.getFacingFromVector(rhv.x, 0, rhv.z); - } else { - // far automatic placement - face = Direction.getFacingFromVector(player.getLookVec().x, 0, player.getLookVec().z); - List free_sides = Arrays.stream(Direction.values()).filter(d->d.getAxis().isHorizontal() && (world.getBlockState(pos.offset(d)).getBlock()!=this)).collect(Collectors.toList()); - if(free_sides.isEmpty()) return world.isRemote() ? ActionResultType.SUCCESS : ActionResultType.CONSUME; - if(!free_sides.contains(face)) face = free_sides.get(0); - } - BooleanProperty railing = getDirectionProperty(face); - boolean add = (!state.get(railing)); - place_consume(state.with(railing, add), world, pos, player, hand, add ? 1 : -1); - return world.isRemote() ? ActionResultType.SUCCESS : ActionResultType.CONSUME; - } - return ActionResultType.PASS; - } - - // -- IDecorBlock - - @Override - public boolean hasDynamicDropList() - { return true; } - - @Override - public List dropList(BlockState state, World world, @Nullable TileEntity te, boolean explosion) - { - if(world.isRemote()) return Collections.singletonList(ItemStack.EMPTY); - List drops = new ArrayList<>(); - drops.add(new ItemStack(state.getBlock().asItem())); - int n = (state.get(NORTH)?1:0)+(state.get(EAST)?1:0)+(state.get(SOUTH)?1:0)+(state.get(WEST)?1:0); - if(n > 0) drops.add(new ItemStack(ModContent.STEEL_RAILING, n)); - return drops; - } - -} +/* + * @file EdCatwalkBlock.java + * @author Stefan Wilhelm (wile) + * @copyright (C) 2020 Stefan Wilhelm + * @license MIT (see https://opensource.org/licenses/MIT) + * + * Bottom aligned platforms with railings. + */ +package wile.engineersdecor.blocks; + +import net.minecraft.block.AbstractBlock; +import net.minecraft.block.Block; +import net.minecraft.block.BlockState; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.fluid.Fluids; +import net.minecraft.item.*; +import net.minecraft.state.BooleanProperty; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.*; +import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.BlockRayTraceResult; +import net.minecraft.util.math.vector.Vector3d; +import net.minecraft.world.IBlockReader; +import net.minecraft.world.World; +import wile.engineersdecor.ModContent; +import wile.engineersdecor.libmc.detail.Inventories; + +import javax.annotation.Nullable; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + + +public class EdCatwalkBlock extends DecorBlock.HorizontalFourWayWaterLoggable implements IDecorBlock +{ + final Block railing_block; + final AxisAlignedBB base_aabb; + + public EdCatwalkBlock(long config, AbstractBlock.Properties properties, final AxisAlignedBB base_aabb, final AxisAlignedBB railing_aabb, final Block railing_block) + { super(config, properties, base_aabb, railing_aabb, 0); this.railing_block = railing_block; this.base_aabb=base_aabb; } + + @Override + public boolean propagatesSkylightDown(BlockState state, IBlockReader reader, BlockPos pos) + { return true; } + + @Override + @Nullable + public BlockState getStateForPlacement(BlockItemUseContext context) + { return super.getStateForPlacement(context).setValue(NORTH, false).setValue(EAST, false).setValue(SOUTH, false).setValue(WEST, false); } + + public static boolean place_consume(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, int shrink) + { + if(!world.setBlock(pos, state, 1|2)) return false; + world.playSound(player, pos, SoundEvents.METAL_PLACE, SoundCategory.BLOCKS, 1f, 1f); + if((!player.isCreative()) && (!world.isClientSide())) { + ItemStack stack = player.getItemInHand(hand); + if(shrink >= 0) { + stack.shrink(shrink); + } else if(stack.getCount() < stack.getMaxStackSize()) { + stack.grow(Math.abs(shrink)); + } else { + Inventories.give(player, new ItemStack(stack.getItem(), Math.abs(shrink))); + } + Inventories.setItemInPlayerHand(player, hand, stack); + } + return true; + } + + @Override + @SuppressWarnings("deprecation") + public ActionResultType use(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) + { + final Item item = player.getItemInHand(hand).getItem(); + if((!(item instanceof BlockItem))) return ActionResultType.PASS; + final Block block = ((BlockItem)item).getBlock(); + if(block == this) { + if(hit.getDirection().getAxis().isHorizontal()) return ActionResultType.PASS; // place new block on the clicked side. + BlockPos adjacent_pos = pos.relative(player.getDirection()); + BlockState adjacent_state = world.getBlockState(adjacent_pos); + if(adjacent_state.canBeReplaced(new DirectionalPlaceContext(world, adjacent_pos, hit.getDirection().getOpposite(), player.getItemInHand(hand), hit.getDirection()))) { + BlockState place_state = defaultBlockState(); + place_state = place_state.setValue(WATERLOGGED,adjacent_state.getFluidState().getType()==Fluids.WATER); + place_consume(place_state, world, adjacent_pos, player, hand, 1); + } + return world.isClientSide() ? ActionResultType.SUCCESS : ActionResultType.CONSUME; + } + if(block == railing_block) { + Direction face = hit.getDirection(); + final Vector3d rhv = hit.getLocation().subtract(Vector3d.atCenterOf(hit.getBlockPos())); + if(face.getAxis().isHorizontal()) { + // Side or railing clicked + if(rhv.multiply(Vector3d.atLowerCornerOf(face.getNormal())).scale(2).lengthSqr() < 0.99) face = face.getOpposite(); // click on railing, not the outer side. + } else if(player.distanceToSqr(Vector3d.atCenterOf(pos)) < 3) { + // near accurate placement + face = Direction.getNearest(rhv.x, 0, rhv.z); + } else { + // far automatic placement + face = Direction.getNearest(player.getLookAngle().x, 0, player.getLookAngle().z); + List free_sides = Arrays.stream(Direction.values()).filter(d->d.getAxis().isHorizontal() && (world.getBlockState(pos.relative(d)).getBlock()!=this)).collect(Collectors.toList()); + if(free_sides.isEmpty()) return world.isClientSide() ? ActionResultType.SUCCESS : ActionResultType.CONSUME; + if(!free_sides.contains(face)) face = free_sides.get(0); + } + BooleanProperty railing = getDirectionProperty(face); + boolean add = (!state.getValue(railing)); + place_consume(state.setValue(railing, add), world, pos, player, hand, add ? 1 : -1); + return world.isClientSide() ? ActionResultType.SUCCESS : ActionResultType.CONSUME; + } + return ActionResultType.PASS; + } + + // -- IDecorBlock + + @Override + public boolean hasDynamicDropList() + { return true; } + + @Override + public List dropList(BlockState state, World world, @Nullable TileEntity te, boolean explosion) + { + if(world.isClientSide()) return Collections.singletonList(ItemStack.EMPTY); + List drops = new ArrayList<>(); + drops.add(new ItemStack(state.getBlock().asItem())); + int n = (state.getValue(NORTH)?1:0)+(state.getValue(EAST)?1:0)+(state.getValue(SOUTH)?1:0)+(state.getValue(WEST)?1:0); + if(n > 0) drops.add(new ItemStack(ModContent.STEEL_RAILING, n)); + return drops; + } + +} diff --git a/src/main/java/wile/engineersdecor/blocks/EdCatwalkStairsBlock.java b/src/main/java/wile/engineersdecor/blocks/EdCatwalkStairsBlock.java index 821e6ff..dc440bc 100644 --- a/src/main/java/wile/engineersdecor/blocks/EdCatwalkStairsBlock.java +++ b/src/main/java/wile/engineersdecor/blocks/EdCatwalkStairsBlock.java @@ -1,181 +1,183 @@ -/* - * @file EdCatwalkStairsBlock.java - * @author Stefan Wilhelm (wile) - * @copyright (C) 2020 Stefan Wilhelm - * @license MIT (see https://opensource.org/licenses/MIT) - * - * Stair version of the catwalk block, optional left/right railings. - */ -package wile.engineersdecor.blocks; - -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.fluid.Fluids; -import net.minecraft.item.*; -import net.minecraft.state.BooleanProperty; -import net.minecraft.state.StateContainer; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.*; -import net.minecraft.util.Direction.Axis; -import net.minecraft.util.math.AxisAlignedBB; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.BlockRayTraceResult; -import net.minecraft.util.math.shapes.IBooleanFunction; -import net.minecraft.util.math.shapes.ISelectionContext; -import net.minecraft.util.math.shapes.VoxelShape; -import net.minecraft.util.math.shapes.VoxelShapes; -import net.minecraft.util.math.vector.Vector3d; -import net.minecraft.world.IBlockReader; -import net.minecraft.world.World; -import wile.engineersdecor.ModContent; -import wile.engineersdecor.libmc.detail.Auxiliaries; - -import javax.annotation.Nullable; -import java.util.*; - - -public class EdCatwalkStairsBlock extends DecorBlock.HorizontalWaterLoggable implements IDecorBlock -{ - public static final BooleanProperty RIGHT_RAILING = BooleanProperty.create("right_railing"); - public static final BooleanProperty LEFT_RAILING = BooleanProperty.create("left_railing"); - protected final Map shapes; - protected final Map collision_shapes; - protected final Map y_rotations; - - public EdCatwalkStairsBlock(long config, Block.Properties properties, final AxisAlignedBB[] base_aabb, final AxisAlignedBB[] railing_aabbs) - { - super(config, properties, base_aabb); - Map sh = new HashMap<>(); - Map csh = new HashMap<>(); - getStateContainer().getValidStates().forEach(state->{ - Direction facing = state.get(HORIZONTAL_FACING); - VoxelShape base_shape = Auxiliaries.getUnionShape(Auxiliaries.getRotatedAABB(base_aabb, facing, true)); - if(state.get(RIGHT_RAILING)) { - VoxelShape right_shape = Auxiliaries.getUnionShape(Auxiliaries.getRotatedAABB(Auxiliaries.getMirroredAABB(railing_aabbs, Axis.X), facing, true)); - base_shape = VoxelShapes.combine(base_shape, right_shape, IBooleanFunction.OR); - } - if(state.get(LEFT_RAILING)) { - VoxelShape left_shape = Auxiliaries.getUnionShape(Auxiliaries.getRotatedAABB(railing_aabbs, facing, true)); - base_shape = VoxelShapes.combine(base_shape, left_shape, IBooleanFunction.OR); - } - sh.put(state, base_shape); - csh.put(state, base_shape); - }); - shapes = sh; - collision_shapes = csh; - y_rotations = new HashMap<>(); - y_rotations.put(Direction.NORTH, 0); - y_rotations.put(Direction.EAST, 1); - y_rotations.put(Direction.SOUTH, 2); - y_rotations.put(Direction.WEST, 3); - y_rotations.put(Direction.UP, 0); - y_rotations.put(Direction.DOWN, 0); - setDefaultState(super.getDefaultState().with(LEFT_RAILING, false).with(RIGHT_RAILING, false)); - } - - @Override - public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) - { return shapes.getOrDefault(state, VoxelShapes.fullCube()); } - - @Override - public VoxelShape getCollisionShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) - { return collision_shapes.getOrDefault(state, VoxelShapes.fullCube()); } - - @Override - protected void fillStateContainer(StateContainer.Builder builder) - { super.fillStateContainer(builder); builder.add(RIGHT_RAILING, LEFT_RAILING); } - - @Override - public boolean propagatesSkylightDown(BlockState state, IBlockReader reader, BlockPos pos) - { return true; } - - @Override - @Nullable - public BlockState getStateForPlacement(BlockItemUseContext context) - { return super.getStateForPlacement(context); } - - @Override - @SuppressWarnings("deprecation") - public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) - { - final Item item = player.getHeldItem(hand).getItem(); - if((!(item instanceof BlockItem))) return ActionResultType.PASS; - final Block block = ((BlockItem)item).getBlock(); - final Direction facing = state.get(HORIZONTAL_FACING); - if(block == this) { - final Direction hlv = Arrays.stream(Direction.getFacingDirections(player)).filter(d->d.getAxis().isHorizontal()).findFirst().orElse(Direction.NORTH); - BlockPos adjacent_pos; - if(hlv == facing) { - adjacent_pos = pos.up().offset(hlv); - } else if(hlv == facing.getOpposite()) { - adjacent_pos = pos.down().offset(hlv); - } else { - return world.isRemote() ? ActionResultType.SUCCESS : ActionResultType.CONSUME; - } - final BlockState adjacent_state = world.getBlockState(adjacent_pos); - if(adjacent_state == null) return world.isRemote() ? ActionResultType.SUCCESS : ActionResultType.CONSUME; - if(!adjacent_state.isReplaceable(new DirectionalPlaceContext(world, adjacent_pos, hit.getFace().getOpposite(), player.getHeldItem(hand), hit.getFace()))) return ActionResultType.CONSUME; - BlockState place_state = getDefaultState().with(HORIZONTAL_FACING, facing); - place_state = place_state.with(WATERLOGGED,adjacent_state.getFluidState().getFluid()==Fluids.WATER); - EdCatwalkBlock.place_consume(place_state, world, adjacent_pos, player, hand, 1); - return world.isRemote() ? ActionResultType.SUCCESS : ActionResultType.CONSUME; - } else if((block == ModContent.STEEL_CATWALK) || (block == ModContent.STEEL_CATWALK_TOP_ALIGNED)) { - BlockPos adjacent_pos; - adjacent_pos = pos.offset(facing); - final BlockState adjacent_state = world.getBlockState(adjacent_pos); - if(adjacent_state == null) return ActionResultType.CONSUME; - if(!adjacent_state.isReplaceable(new DirectionalPlaceContext(world, adjacent_pos, hit.getFace().getOpposite(), player.getHeldItem(hand), hit.getFace()))) return ActionResultType.CONSUME; - BlockState place_state = ModContent.STEEL_CATWALK_TOP_ALIGNED.getDefaultState(); - place_state = place_state.with(WATERLOGGED,adjacent_state.getFluidState().getFluid()==Fluids.WATER); - EdCatwalkBlock.place_consume(place_state, world, adjacent_pos, player, hand, 1); - return world.isRemote() ? ActionResultType.SUCCESS : ActionResultType.CONSUME; - } else if(block == ModContent.STEEL_RAILING) { - Direction face = hit.getFace(); - int shrink = 0; - BlockState place_state = state; - if(face == Direction.UP) { - Vector3d rhv = hit.getHitVec().subtract(Vector3d.copyCentered(hit.getPos())).mul(new Vector3d(1,0,1)).crossProduct(Vector3d.copy(facing.getDirectionVec())); - face = (rhv.y > 0) ? (facing.rotateY()) : (facing.rotateYCCW()); - } - if(face == facing.rotateY()) { - if(state.get(RIGHT_RAILING)) { - place_state = state.with(RIGHT_RAILING, false); - shrink = -1; - } else { - place_state = state.with(RIGHT_RAILING, true); - shrink = 1; - } - } else if(face == facing.rotateYCCW()) { - if(state.get(LEFT_RAILING)) { - place_state = state.with(LEFT_RAILING, false); - shrink = -1; - } else { - place_state = state.with(LEFT_RAILING, true); - shrink = 1; - } - } - if(shrink != 0) EdCatwalkBlock.place_consume(place_state, world, pos, player, hand, shrink); - return world.isRemote() ? ActionResultType.SUCCESS : ActionResultType.CONSUME; - } - return ActionResultType.PASS; - } - - // -- IDecorBlock - - @Override - public boolean hasDynamicDropList() - { return true; } - - @Override - public List dropList(BlockState state, World world, @Nullable TileEntity te, boolean explosion) - { - if(world.isRemote()) return Collections.singletonList(ItemStack.EMPTY); - List drops = new ArrayList<>(); - drops.add(new ItemStack(state.getBlock().asItem())); - int n = (state.get(LEFT_RAILING)?1:0)+(state.get(RIGHT_RAILING)?1:0); - if(n > 0) drops.add(new ItemStack(ModContent.STEEL_RAILING, n)); - return drops; - } - -} +/* + * @file EdCatwalkStairsBlock.java + * @author Stefan Wilhelm (wile) + * @copyright (C) 2020 Stefan Wilhelm + * @license MIT (see https://opensource.org/licenses/MIT) + * + * Stair version of the catwalk block, optional left/right railings. + */ +package wile.engineersdecor.blocks; + +import net.minecraft.block.AbstractBlock; +import net.minecraft.block.Block; +import net.minecraft.block.BlockState; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.fluid.Fluids; +import net.minecraft.item.*; +import net.minecraft.state.BooleanProperty; +import net.minecraft.state.StateContainer; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.*; +import net.minecraft.util.Direction.Axis; +import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.BlockRayTraceResult; +import net.minecraft.util.math.shapes.IBooleanFunction; +import net.minecraft.util.math.shapes.ISelectionContext; +import net.minecraft.util.math.shapes.VoxelShape; +import net.minecraft.util.math.shapes.VoxelShapes; +import net.minecraft.util.math.vector.Vector3d; +import net.minecraft.world.IBlockReader; +import net.minecraft.world.World; +import wile.engineersdecor.ModContent; +import wile.engineersdecor.libmc.detail.Auxiliaries; + +import javax.annotation.Nullable; +import java.util.*; + + + +public class EdCatwalkStairsBlock extends DecorBlock.HorizontalWaterLoggable implements IDecorBlock +{ + public static final BooleanProperty RIGHT_RAILING = BooleanProperty.create("right_railing"); + public static final BooleanProperty LEFT_RAILING = BooleanProperty.create("left_railing"); + protected final Map shapes; + protected final Map collision_shapes; + protected final Map y_rotations; + + public EdCatwalkStairsBlock(long config, AbstractBlock.Properties properties, final AxisAlignedBB[] base_aabb, final AxisAlignedBB[] railing_aabbs) + { + super(config, properties, base_aabb); + Map sh = new HashMap<>(); + Map csh = new HashMap<>(); + getStateDefinition().getPossibleStates().forEach(state->{ + Direction facing = state.getValue(HORIZONTAL_FACING); + VoxelShape base_shape = Auxiliaries.getUnionShape(Auxiliaries.getRotatedAABB(base_aabb, facing, true)); + if(state.getValue(RIGHT_RAILING)) { + VoxelShape right_shape = Auxiliaries.getUnionShape(Auxiliaries.getRotatedAABB(Auxiliaries.getMirroredAABB(railing_aabbs, Axis.X), facing, true)); + base_shape = VoxelShapes.joinUnoptimized(base_shape, right_shape, IBooleanFunction.OR); + } + if(state.getValue(LEFT_RAILING)) { + VoxelShape left_shape = Auxiliaries.getUnionShape(Auxiliaries.getRotatedAABB(railing_aabbs, facing, true)); + base_shape = VoxelShapes.joinUnoptimized(base_shape, left_shape, IBooleanFunction.OR); + } + sh.put(state, base_shape); + csh.put(state, base_shape); + }); + shapes = sh; + collision_shapes = csh; + y_rotations = new HashMap<>(); + y_rotations.put(Direction.NORTH, 0); + y_rotations.put(Direction.EAST, 1); + y_rotations.put(Direction.SOUTH, 2); + y_rotations.put(Direction.WEST, 3); + y_rotations.put(Direction.UP, 0); + y_rotations.put(Direction.DOWN, 0); + registerDefaultState(super.defaultBlockState().setValue(LEFT_RAILING, false).setValue(RIGHT_RAILING, false)); + } + + @Override + public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) + { return shapes.getOrDefault(state, VoxelShapes.block()); } + + @Override + public VoxelShape getCollisionShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) + { return collision_shapes.getOrDefault(state, VoxelShapes.block()); } + + @Override + protected void createBlockStateDefinition(StateContainer.Builder builder) + { super.createBlockStateDefinition(builder); builder.add(RIGHT_RAILING, LEFT_RAILING); } + + @Override + public boolean propagatesSkylightDown(BlockState state, IBlockReader reader, BlockPos pos) + { return true; } + + @Override + @Nullable + public BlockState getStateForPlacement(BlockItemUseContext context) + { return super.getStateForPlacement(context); } + + @Override + @SuppressWarnings("deprecation") + public ActionResultType use(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) + { + final Item item = player.getItemInHand(hand).getItem(); + if((!(item instanceof BlockItem))) return ActionResultType.PASS; + final Block block = ((BlockItem)item).getBlock(); + final Direction facing = state.getValue(HORIZONTAL_FACING); + if(block == this) { + final Direction hlv = Arrays.stream(Direction.orderedByNearest(player)).filter(d->d.getAxis().isHorizontal()).findFirst().orElse(Direction.NORTH); + BlockPos adjacent_pos; + if(hlv == facing) { + adjacent_pos = pos.above().relative(hlv); + } else if(hlv == facing.getOpposite()) { + adjacent_pos = pos.below().relative(hlv); + } else { + return world.isClientSide() ? ActionResultType.SUCCESS : ActionResultType.CONSUME; + } + final BlockState adjacent_state = world.getBlockState(adjacent_pos); + if(adjacent_state == null) return world.isClientSide() ? ActionResultType.SUCCESS : ActionResultType.CONSUME; + if(!adjacent_state.canBeReplaced(new DirectionalPlaceContext(world, adjacent_pos, hit.getDirection().getOpposite(), player.getItemInHand(hand), hit.getDirection()))) return ActionResultType.CONSUME; + BlockState place_state = defaultBlockState().setValue(HORIZONTAL_FACING, facing); + place_state = place_state.setValue(WATERLOGGED,adjacent_state.getFluidState().getType()==Fluids.WATER); + EdCatwalkBlock.place_consume(place_state, world, adjacent_pos, player, hand, 1); + return world.isClientSide() ? ActionResultType.SUCCESS : ActionResultType.CONSUME; + } else if((block == ModContent.STEEL_CATWALK) || (block == ModContent.STEEL_CATWALK_TOP_ALIGNED)) { + BlockPos adjacent_pos; + adjacent_pos = pos.relative(facing); + final BlockState adjacent_state = world.getBlockState(adjacent_pos); + if(adjacent_state == null) return ActionResultType.CONSUME; + if(!adjacent_state.canBeReplaced(new DirectionalPlaceContext(world, adjacent_pos, hit.getDirection().getOpposite(), player.getItemInHand(hand), hit.getDirection()))) return ActionResultType.CONSUME; + BlockState place_state = ModContent.STEEL_CATWALK_TOP_ALIGNED.defaultBlockState(); + place_state = place_state.setValue(WATERLOGGED,adjacent_state.getFluidState().getType()==Fluids.WATER); + EdCatwalkBlock.place_consume(place_state, world, adjacent_pos, player, hand, 1); + return world.isClientSide() ? ActionResultType.SUCCESS : ActionResultType.CONSUME; + } else if(block == ModContent.STEEL_RAILING) { + Direction face = hit.getDirection(); + int shrink = 0; + BlockState place_state = state; + if(face == Direction.UP) { + Vector3d rhv = hit.getLocation().subtract(Vector3d.atCenterOf(hit.getBlockPos())).multiply(new Vector3d(1,0,1)).cross(Vector3d.atLowerCornerOf(facing.getNormal())); + face = (rhv.y > 0) ? (facing.getClockWise()) : (facing.getCounterClockWise()); + } + if(face == facing.getClockWise()) { + if(state.getValue(RIGHT_RAILING)) { + place_state = state.setValue(RIGHT_RAILING, false); + shrink = -1; + } else { + place_state = state.setValue(RIGHT_RAILING, true); + shrink = 1; + } + } else if(face == facing.getCounterClockWise()) { + if(state.getValue(LEFT_RAILING)) { + place_state = state.setValue(LEFT_RAILING, false); + shrink = -1; + } else { + place_state = state.setValue(LEFT_RAILING, true); + shrink = 1; + } + } + if(shrink != 0) EdCatwalkBlock.place_consume(place_state, world, pos, player, hand, shrink); + return world.isClientSide() ? ActionResultType.SUCCESS : ActionResultType.CONSUME; + } + return ActionResultType.PASS; + } + + // -- IDecorBlock + + @Override + public boolean hasDynamicDropList() + { return true; } + + @Override + public List dropList(BlockState state, World world, @Nullable TileEntity te, boolean explosion) + { + if(world.isClientSide()) return Collections.singletonList(ItemStack.EMPTY); + List drops = new ArrayList<>(); + drops.add(new ItemStack(state.getBlock().asItem())); + int n = (state.getValue(LEFT_RAILING)?1:0)+(state.getValue(RIGHT_RAILING)?1:0); + if(n > 0) drops.add(new ItemStack(ModContent.STEEL_RAILING, n)); + return drops; + } + +} diff --git a/src/main/java/wile/engineersdecor/blocks/EdCatwalkTopAlignedBlock.java b/src/main/java/wile/engineersdecor/blocks/EdCatwalkTopAlignedBlock.java index ca6cd79..838b89b 100644 --- a/src/main/java/wile/engineersdecor/blocks/EdCatwalkTopAlignedBlock.java +++ b/src/main/java/wile/engineersdecor/blocks/EdCatwalkTopAlignedBlock.java @@ -1,104 +1,106 @@ -/* - * @file EdCatwalkTopAlignedBlock.java - * @author Stefan Wilhelm (wile) - * @copyright (C) 2020 Stefan Wilhelm - * @license MIT (see https://opensource.org/licenses/MIT) - * - * Top aligned platforms, down-connection to poles. - */ -package wile.engineersdecor.blocks; - -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.fluid.Fluids; -import net.minecraft.item.*; -import net.minecraft.state.IntegerProperty; -import net.minecraft.state.StateContainer; -import net.minecraft.util.*; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.BlockRayTraceResult; -import net.minecraft.util.math.shapes.ISelectionContext; -import net.minecraft.util.math.shapes.VoxelShape; -import net.minecraft.util.math.shapes.VoxelShapes; -import net.minecraft.world.IBlockReader; -import net.minecraft.world.IWorld; -import net.minecraft.world.World; -import wile.engineersdecor.ModContent; - -import javax.annotation.Nullable; -import java.util.*; -import java.util.stream.Collectors; - -public class EdCatwalkTopAlignedBlock extends DecorBlock.WaterLoggable implements IDecorBlock -{ - public static final IntegerProperty VARIANT = IntegerProperty.create("variant", 0, 3); - protected final List variant_shapes; - - public EdCatwalkTopAlignedBlock(long config, Block.Properties properties, final VoxelShape[] variant_shapes) - { - super(config, properties, variant_shapes[0]); - setDefaultState(super.getDefaultState().with(VARIANT, 0)); - this.variant_shapes = VARIANT.getAllowedValues().stream().map(i->(i builder) - { super.fillStateContainer(builder); builder.add(VARIANT); } - - @Override - @Nullable - public BlockState getStateForPlacement(BlockItemUseContext context) - { - BlockState state = adapted_state(super.getStateForPlacement(context), context.getWorld(), context.getPos()); - if(context.getFace() != Direction.UP) return state; - BlockState below = context.getWorld().getBlockState(context.getPos().down()); - if((state.get(VARIANT)==0) && (below.isSolidSide(context.getWorld(), context.getPos().down(), Direction.UP))) return state.with(VARIANT, 3); - return state; - } - - @Override - @SuppressWarnings("deprecation") - public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) - { - final Item item = player.getHeldItem(hand).getItem(); - if(item != this.asItem()) return ActionResultType.PASS; - if(hit.getFace().getAxis().isHorizontal()) return ActionResultType.PASS; - BlockPos adjacent_pos = pos.offset(player.getHorizontalFacing()); - BlockState adjacent_state = world.getBlockState(adjacent_pos); - if(adjacent_state.isReplaceable(new DirectionalPlaceContext(world, adjacent_pos, hit.getFace().getOpposite(), player.getHeldItem(hand), hit.getFace()))) { - BlockState place_state = getDefaultState(); - place_state = place_state.with(WATERLOGGED,adjacent_state.getFluidState().getFluid()==Fluids.WATER); - EdCatwalkBlock.place_consume(adapted_state(place_state, world, adjacent_pos), world, adjacent_pos, player, hand, 1); - } - return world.isRemote() ? ActionResultType.SUCCESS : ActionResultType.CONSUME; - } - - @Override - public BlockState updatePostPlacement(BlockState state, Direction facing, BlockState facingState, IWorld world, BlockPos pos, BlockPos facingPos) - { return adapted_state(super.updatePostPlacement(state, facing, facingState, world, pos, facingPos), world, pos); } - - // --- - - private BlockState adapted_state(BlockState state, IWorld world, BlockPos pos) - { - BlockState below = world.getBlockState(pos.down()); - if((below == null) || (state == null)) return state; - if((below.getBlock() == ModContent.THICK_STEEL_POLE) || (below.getBlock() == ModContent.THICK_STEEL_POLE_HEAD)) return state.with(VARIANT, 1); - if((below.getBlock() == ModContent.THIN_STEEL_POLE) || (below.getBlock() == ModContent.THIN_STEEL_POLE_HEAD)) return state.with(VARIANT, 2); - return state; - } - -} +/* + * @file EdCatwalkTopAlignedBlock.java + * @author Stefan Wilhelm (wile) + * @copyright (C) 2020 Stefan Wilhelm + * @license MIT (see https://opensource.org/licenses/MIT) + * + * Top aligned platforms, down-connection to poles. + */ +package wile.engineersdecor.blocks; + +import net.minecraft.block.AbstractBlock; +import net.minecraft.block.Block; +import net.minecraft.block.BlockState; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.fluid.Fluids; +import net.minecraft.item.*; +import net.minecraft.state.IntegerProperty; +import net.minecraft.state.StateContainer; +import net.minecraft.util.*; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.BlockRayTraceResult; +import net.minecraft.util.math.shapes.ISelectionContext; +import net.minecraft.util.math.shapes.VoxelShape; +import net.minecraft.util.math.shapes.VoxelShapes; +import net.minecraft.world.IBlockReader; +import net.minecraft.world.IWorld; +import net.minecraft.world.World; +import wile.engineersdecor.ModContent; + +import javax.annotation.Nullable; +import java.util.*; +import java.util.stream.Collectors; + + +public class EdCatwalkTopAlignedBlock extends DecorBlock.WaterLoggable implements IDecorBlock +{ + public static final IntegerProperty VARIANT = IntegerProperty.create("variant", 0, 3); + protected final List variant_shapes; + + public EdCatwalkTopAlignedBlock(long config, AbstractBlock.Properties properties, final VoxelShape[] variant_shapes) + { + super(config, properties, variant_shapes[0]); + registerDefaultState(super.defaultBlockState().setValue(VARIANT, 0)); + this.variant_shapes = VARIANT.getPossibleValues().stream().map(i->(i builder) + { super.createBlockStateDefinition(builder); builder.add(VARIANT); } + + @Override + @Nullable + public BlockState getStateForPlacement(BlockItemUseContext context) + { + BlockState state = adapted_state(super.getStateForPlacement(context), context.getLevel(), context.getClickedPos()); + if(context.getClickedFace() != Direction.UP) return state; + BlockState below = context.getLevel().getBlockState(context.getClickedPos().below()); + if((state.getValue(VARIANT)==0) && (below.isFaceSturdy(context.getLevel(), context.getClickedPos().below(), Direction.UP))) return state.setValue(VARIANT, 3); + return state; + } + + @Override + @SuppressWarnings("deprecation") + public ActionResultType use(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) + { + final Item item = player.getItemInHand(hand).getItem(); + if(item != this.asItem()) return ActionResultType.PASS; + if(hit.getDirection().getAxis().isHorizontal()) return ActionResultType.PASS; + BlockPos adjacent_pos = pos.relative(player.getDirection()); + BlockState adjacent_state = world.getBlockState(adjacent_pos); + if(adjacent_state.canBeReplaced(new DirectionalPlaceContext(world, adjacent_pos, hit.getDirection().getOpposite(), player.getItemInHand(hand), hit.getDirection()))) { + BlockState place_state = defaultBlockState(); + place_state = place_state.setValue(WATERLOGGED,adjacent_state.getFluidState().getType()==Fluids.WATER); + EdCatwalkBlock.place_consume(adapted_state(place_state, world, adjacent_pos), world, adjacent_pos, player, hand, 1); + } + return world.isClientSide() ? ActionResultType.SUCCESS : ActionResultType.CONSUME; + } + + @Override + public BlockState updateShape(BlockState state, Direction facing, BlockState facingState, IWorld world, BlockPos pos, BlockPos facingPos) + { return adapted_state(super.updateShape(state, facing, facingState, world, pos, facingPos), world, pos); } + + // --- + + private BlockState adapted_state(BlockState state, IWorld world, BlockPos pos) + { + BlockState below = world.getBlockState(pos.below()); + if((below == null) || (state == null)) return state; + if((below.getBlock() == ModContent.THICK_STEEL_POLE) || (below.getBlock() == ModContent.THICK_STEEL_POLE_HEAD)) return state.setValue(VARIANT, 1); + if((below.getBlock() == ModContent.THIN_STEEL_POLE) || (below.getBlock() == ModContent.THIN_STEEL_POLE_HEAD)) return state.setValue(VARIANT, 2); + return state; + } + +} diff --git a/src/main/java/wile/engineersdecor/blocks/EdChair.java b/src/main/java/wile/engineersdecor/blocks/EdChair.java index f0fc775..bc9cba2 100644 --- a/src/main/java/wile/engineersdecor/blocks/EdChair.java +++ b/src/main/java/wile/engineersdecor/blocks/EdChair.java @@ -1,194 +1,195 @@ -/* - * @file EdChair.java - * @author Stefan Wilhelm (wile) - * @copyright (C) 2020 Stefan Wilhelm - * @license MIT (see https://opensource.org/licenses/MIT) - * - * Full block characteristics class. - */ -package wile.engineersdecor.blocks; - -import net.minecraft.entity.monster.piglin.PiglinEntity; -import net.minecraft.util.math.vector.Vector3d; -import wile.engineersdecor.ModConfig; -import wile.engineersdecor.ModContent; -import net.minecraft.world.server.ServerWorld; -import net.minecraft.world.World; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.entity.*; -import net.minecraft.entity.monster.*; -import net.minecraft.nbt.CompoundNBT; -import net.minecraft.network.IPacket; -import net.minecraft.util.math.*; -import net.minecraft.util.*; -import net.minecraftforge.fml.network.FMLPlayMessages; -import net.minecraftforge.fml.network.NetworkHooks; -import java.util.List; -import java.util.Random; - - -public class EdChair -{ - private static boolean sitting_enabled = true; - private static double sitting_probability = 0.1; - private static double standup_probability = 0.01; - - public static void on_config(boolean without_sitting, boolean without_mob_sitting, double sitting_probability_percent, double standup_probability_percent) - { - sitting_enabled = (!without_sitting); - sitting_probability = (without_sitting||without_mob_sitting) ? 0.0 : MathHelper.clamp(sitting_probability_percent/100, 0, 0.9); - standup_probability = (without_sitting||without_mob_sitting) ? 1.0 : MathHelper.clamp(standup_probability_percent/100, 1e-6, 1e-2); - ModConfig.log("Config chairs: sit:" + sitting_enabled + ", mob-sit: " + (sitting_probability*100) + "%, standup: " + (standup_probability) + "%."); - } - - //-------------------------------------------------------------------------------------------------------------------- - // Block - //-------------------------------------------------------------------------------------------------------------------- - - public static class ChairBlock extends DecorBlock.HorizontalWaterLoggable implements IDecorBlock - { - public ChairBlock(long config, Block.Properties builder, final AxisAlignedBB[] unrotatedAABBs) - { super(config, builder.tickRandomly(), unrotatedAABBs); } - - @Override - @SuppressWarnings("deprecation") - public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult rayTraceResult) - { - if(!sitting_enabled) return ActionResultType.PASS; - if(world.isRemote()) return ActionResultType.SUCCESS; - EntityChair.sit(world, player, pos); - return ActionResultType.CONSUME; - } - - @Override - @SuppressWarnings("deprecation") - public void onEntityCollision(BlockState state, World world, BlockPos pos, Entity entity) - { - if(sitting_enabled && (Math.random() < sitting_probability) && (entity instanceof MobEntity)) EntityChair.sit(world, (LivingEntity)entity, pos); - } - - @Override - @SuppressWarnings("deprecation") - public void tick(BlockState state, ServerWorld world, BlockPos pos, Random rnd) - { - if((!sitting_enabled) || (sitting_probability < 1e-6)) return; - final List entities = world.getEntitiesWithinAABB(MobEntity.class, new AxisAlignedBB(pos).grow(2,1,2).expand(0,1,0), e->true); - if(entities.isEmpty()) return; - int index = rnd.nextInt(entities.size()); - if((index < 0) || (index >= entities.size())) return; - EntityChair.sit(world, entities.get(index), pos); - } - } - - //-------------------------------------------------------------------------------------------------------------------- - // Entity - //-------------------------------------------------------------------------------------------------------------------- - - public static class EntityChair extends Entity - { - public static final double x_offset = 0.5d; - public static final double y_offset = 0.4d; - public static final double z_offset = 0.5d; - private int t_sit = 0; - public BlockPos chair_pos = new BlockPos(0,0,0); - - public EntityChair(EntityType entityType, World world) - { - super(entityType, world); - preventEntitySpawning=true; - setMotion(Vector3d.ZERO); - canUpdate(true); - noClip=true; - } - - public EntityChair(World world) - { this(ModContent.ET_CHAIR, world); } - - public static EntityChair customClientFactory(FMLPlayMessages.SpawnEntity spkt, World world) - { return new EntityChair(world); } - - public IPacket createSpawnPacket() - { return NetworkHooks.getEntitySpawningPacket(this); } - - public static boolean accepts_mob(LivingEntity entity) - { - if(!(entity instanceof net.minecraft.entity.monster.MonsterEntity)) return false; - if((entity.getType().getSize().height > 2.5) || (entity.getType().getSize().height > 2.0)) return false; - if(entity instanceof ZombieEntity) return true; - if(entity instanceof ZombieVillagerEntity) return true; - if(entity instanceof ZombifiedPiglinEntity) return true; - if(entity instanceof PiglinEntity) return true; - if(entity instanceof HuskEntity) return true; - if(entity instanceof StrayEntity) return true; - if(entity instanceof SkeletonEntity) return true; - if(entity instanceof WitherSkeletonEntity) return true; - return false; - } - - public static void sit(World world, LivingEntity sitter, BlockPos pos) - { - if(!sitting_enabled) return; - if((world==null) || (world.isRemote) || (sitter==null) || (pos==null)) return; - if((!(sitter instanceof PlayerEntity)) && (!accepts_mob(sitter))) return; - if(!world.getEntitiesWithinAABB(EntityChair.class, new AxisAlignedBB(pos)).isEmpty()) return; - if(sitter.isBeingRidden() || (!sitter.isAlive()) || (sitter.isPassenger()) ) return; - if((!world.isAirBlock(pos.up())) || (!world.isAirBlock(pos.up(2)))) return; - boolean on_top_of_block_position = true; - boolean use_next_negative_y_position = false; - EntityChair chair = new EntityChair(world); - BlockPos chair_pos = chair.getPosition(); - chair.chair_pos = pos; - chair.t_sit = 5; - chair.prevPosX = chair_pos.getX(); - chair.prevPosY = chair_pos.getY(); - chair.prevPosZ = chair_pos.getZ(); - chair.setPosition(pos.getX()+x_offset,pos.getY()+y_offset,pos.getZ()+z_offset); - world.addEntity(chair); - sitter.startRiding(chair, true); - } - - @Override - protected void registerData() {} - - @Override - protected void readAdditional(CompoundNBT compound) {} - - @Override - protected void writeAdditional(CompoundNBT compound) {} - - @Override - public boolean canBePushed() - { return false; } - - @Override - public double getMountedYOffset() - { return 0.0; } - - @Override - public void tick() - { - if(world.isRemote) return; - super.tick(); - if(--t_sit > 0) return; - Entity sitter = getPassengers().isEmpty() ? null : getPassengers().get(0); - if((sitter==null) || (!sitter.isAlive())) { - this.remove(); - return; - } - boolean abort = (!sitting_enabled); - final BlockState state = world.getBlockState(chair_pos); - if((state==null) || (!(state.getBlock() instanceof ChairBlock))) abort = true; - if(!world.isAirBlock(chair_pos.up())) abort = true; - if((!(sitter instanceof PlayerEntity)) && (Math.random() < standup_probability)) abort = true; - if(abort) { - for(Entity e:getPassengers()) { - if(e.isAlive()) e.stopRiding(); - } - this.remove(); - } - } - } - -} +/* + * @file EdChair.java + * @author Stefan Wilhelm (wile) + * @copyright (C) 2020 Stefan Wilhelm + * @license MIT (see https://opensource.org/licenses/MIT) + * + * Full block characteristics class. + */ +package wile.engineersdecor.blocks; + +import net.minecraft.entity.monster.piglin.PiglinEntity; +import net.minecraft.util.math.vector.Vector3d; +import net.minecraft.block.AbstractBlock; +import net.minecraft.world.server.ServerWorld; +import net.minecraft.world.World; +import net.minecraft.block.BlockState; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.entity.*; +import net.minecraft.entity.monster.*; +import net.minecraft.nbt.CompoundNBT; +import net.minecraft.network.IPacket; +import net.minecraft.util.math.*; +import net.minecraft.util.*; +import net.minecraftforge.fml.network.FMLPlayMessages; +import net.minecraftforge.fml.network.NetworkHooks; +import wile.engineersdecor.ModConfig; +import wile.engineersdecor.ModContent; +import java.util.List; +import java.util.Random; + + + +public class EdChair +{ + private static boolean sitting_enabled = true; + private static double sitting_probability = 0.1; + private static double standup_probability = 0.01; + + public static void on_config(boolean without_sitting, boolean without_mob_sitting, double sitting_probability_percent, double standup_probability_percent) + { + sitting_enabled = (!without_sitting); + sitting_probability = (without_sitting||without_mob_sitting) ? 0.0 : MathHelper.clamp(sitting_probability_percent/100, 0, 0.9); + standup_probability = (without_sitting||without_mob_sitting) ? 1.0 : MathHelper.clamp(standup_probability_percent/100, 1e-6, 1e-2); + ModConfig.log("Config chairs: sit:" + sitting_enabled + ", mob-sit: " + (sitting_probability*100) + "%, standup: " + (standup_probability) + "%."); + } + + //-------------------------------------------------------------------------------------------------------------------- + // Block + //-------------------------------------------------------------------------------------------------------------------- + + public static class ChairBlock extends DecorBlock.HorizontalWaterLoggable implements IDecorBlock + { + public ChairBlock(long config, AbstractBlock.Properties builder, final AxisAlignedBB[] unrotatedAABBs) + { super(config, builder.randomTicks(), unrotatedAABBs); } + + @Override + @SuppressWarnings("deprecation") + public ActionResultType use(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult rayTraceResult) + { + if(!sitting_enabled) return ActionResultType.PASS; + if(world.isClientSide()) return ActionResultType.SUCCESS; + EntityChair.sit(world, player, pos); + return ActionResultType.CONSUME; + } + + @Override + @SuppressWarnings("deprecation") + public void entityInside(BlockState state, World world, BlockPos pos, Entity entity) + { + if(sitting_enabled && (Math.random() < sitting_probability) && (entity instanceof MobEntity)) EntityChair.sit(world, (LivingEntity)entity, pos); + } + + @Override + @SuppressWarnings("deprecation") + public void tick(BlockState state, ServerWorld world, BlockPos pos, Random rnd) + { + if((!sitting_enabled) || (sitting_probability < 1e-6)) return; + final List entities = world.getEntitiesOfClass(MobEntity.class, new AxisAlignedBB(pos).inflate(2,1,2).expandTowards(0,1,0), e->true); + if(entities.isEmpty()) return; + int index = rnd.nextInt(entities.size()); + if((index < 0) || (index >= entities.size())) return; + EntityChair.sit(world, entities.get(index), pos); + } + } + + //-------------------------------------------------------------------------------------------------------------------- + // Entity + //-------------------------------------------------------------------------------------------------------------------- + + public static class EntityChair extends Entity + { + public static final double x_offset = 0.5d; + public static final double y_offset = 0.4d; + public static final double z_offset = 0.5d; + private int t_sit = 0; + public BlockPos chair_pos = new BlockPos(0,0,0); + + public EntityChair(EntityType entityType, World world) + { + super(entityType, world); + blocksBuilding=true; + setDeltaMovement(Vector3d.ZERO); + canUpdate(true); + noPhysics=true; + } + + public EntityChair(World world) + { this(ModContent.ET_CHAIR, world); } + + public static EntityChair customClientFactory(FMLPlayMessages.SpawnEntity spkt, World world) + { return new EntityChair(world); } + + public IPacket getAddEntityPacket() + { return NetworkHooks.getEntitySpawningPacket(this); } + + public static boolean accepts_mob(LivingEntity entity) + { + if(!(entity instanceof net.minecraft.entity.monster.MonsterEntity)) return false; + if((entity.getType().getDimensions().height > 2.5) || (entity.getType().getDimensions().height > 2.0)) return false; + if(entity instanceof ZombieEntity) return true; + if(entity instanceof ZombieVillagerEntity) return true; + if(entity instanceof ZombifiedPiglinEntity) return true; + if(entity instanceof PiglinEntity) return true; + if(entity instanceof HuskEntity) return true; + if(entity instanceof StrayEntity) return true; + if(entity instanceof SkeletonEntity) return true; + if(entity instanceof WitherSkeletonEntity) return true; + return false; + } + + public static void sit(World world, LivingEntity sitter, BlockPos pos) + { + if(!sitting_enabled) return; + if((world==null) || (world.isClientSide) || (sitter==null) || (pos==null)) return; + if((!(sitter instanceof PlayerEntity)) && (!accepts_mob(sitter))) return; + if(!world.getEntitiesOfClass(EntityChair.class, new AxisAlignedBB(pos)).isEmpty()) return; + if(sitter.isVehicle() || (!sitter.isAlive()) || (sitter.isPassenger()) ) return; + if((!world.isEmptyBlock(pos.above())) || (!world.isEmptyBlock(pos.above(2)))) return; + boolean on_top_of_block_position = true; + boolean use_next_negative_y_position = false; + EntityChair chair = new EntityChair(world); + BlockPos chair_pos = chair.blockPosition(); + chair.chair_pos = pos; + chair.t_sit = 5; + chair.xo = chair_pos.getX(); + chair.yo = chair_pos.getY(); + chair.zo = chair_pos.getZ(); + chair.setPos(pos.getX()+x_offset,pos.getY()+y_offset,pos.getZ()+z_offset); + world.addFreshEntity(chair); + sitter.startRiding(chair, true); + } + + @Override + protected void defineSynchedData() {} + + @Override + protected void readAdditionalSaveData(CompoundNBT compound) {} + + @Override + protected void addAdditionalSaveData(CompoundNBT compound) {} + + @Override + public boolean isPushable() + { return false; } + + @Override + public double getPassengersRidingOffset() + { return 0.0; } + + @Override + public void tick() + { + if(level.isClientSide) return; + super.tick(); + if(--t_sit > 0) return; + Entity sitter = getPassengers().isEmpty() ? null : getPassengers().get(0); + if((sitter==null) || (!sitter.isAlive())) { + this.remove(); + return; + } + boolean abort = (!sitting_enabled); + final BlockState state = level.getBlockState(chair_pos); + if((state==null) || (!(state.getBlock() instanceof ChairBlock))) abort = true; + if(!level.isEmptyBlock(chair_pos.above())) abort = true; + if((!(sitter instanceof PlayerEntity)) && (Math.random() < standup_probability)) abort = true; + if(abort) { + for(Entity e:getPassengers()) { + if(e.isAlive()) e.stopRiding(); + } + this.remove(); + } + } + } + +} diff --git a/src/main/java/wile/engineersdecor/blocks/EdChimneyBlock.java b/src/main/java/wile/engineersdecor/blocks/EdChimneyBlock.java index 6b71904..20b243b 100644 --- a/src/main/java/wile/engineersdecor/blocks/EdChimneyBlock.java +++ b/src/main/java/wile/engineersdecor/blocks/EdChimneyBlock.java @@ -1,98 +1,98 @@ -/* - * @file EdChimneyBlock.java - * @author Stefan Wilhelm (wile) - * @copyright (C) 2020 Stefan Wilhelm - * @license MIT (see https://opensource.org/licenses/MIT) - * - * Block type for smoking chimneys. - */ -package wile.engineersdecor.blocks; - -import net.minecraft.block.*; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.item.BlockItemUseContext; -import net.minecraft.particles.ParticleTypes; -import net.minecraft.state.IntegerProperty; -import net.minecraft.state.StateContainer; -import net.minecraft.state.properties.BlockStateProperties; -import net.minecraft.util.ActionResultType; -import net.minecraft.util.Direction; -import net.minecraft.util.Hand; -import net.minecraft.util.math.AxisAlignedBB; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.BlockRayTraceResult; -import net.minecraft.world.IWorldReader; -import net.minecraft.world.World; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; - -import javax.annotation.Nullable; -import java.util.Random; - -public class EdChimneyBlock extends DecorBlock.Cutout implements IDecorBlock -{ - public static final IntegerProperty POWER = BlockStateProperties.POWER_0_15; - - public EdChimneyBlock(long config, Block.Properties properties, AxisAlignedBB aabb) - { super(config, properties, aabb); } - - public EdChimneyBlock(long config, Block.Properties builder) - { - this(config, builder, new AxisAlignedBB(0,0,0,1,1,1)); - setDefaultState(super.getDefaultState().with(POWER, 0)); // no smoke in JEI - } - - @Override - protected void fillStateContainer(StateContainer.Builder builder) - { super.fillStateContainer(builder); builder.add(POWER); } - - @Override - @Nullable - public BlockState getStateForPlacement(BlockItemUseContext context) - { - BlockState state = super.getStateForPlacement(context); - if(state==null) return state; - int p = context.getWorld().getRedstonePowerFromNeighbors(context.getPos()); - return state.with(POWER, p==0 ? 5 : p); - } - - @Override - @SuppressWarnings("deprecation") - public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult rayTraceResult) - { world.setBlockState(pos, state.with(POWER, (state.get(POWER)+1) & 0xf), 1|2); return ActionResultType.func_233537_a_(world.isRemote()); } - - @Override - @SuppressWarnings("deprecation") - public void neighborChanged(BlockState state, World world, BlockPos pos, Block block, BlockPos fromPos, boolean unused) - { - int p = world.getRedstonePowerFromNeighbors(pos); - if(p != state.get(POWER)) world.setBlockState(pos, state.with(POWER, p), 2); - } - - @Override - public boolean shouldCheckWeakPower(BlockState state, IWorldReader world, BlockPos pos, Direction side) - { return false; } - - @Override - @OnlyIn(Dist.CLIENT) - public void animateTick(BlockState state, World world, BlockPos pos, Random rnd) - { - if(state.getBlock() != this) return; - final int p = state.get(POWER); - if(p==0) return; - int end = 1+rnd.nextInt(10) * p / 15; - for(int i=0; i 0.7 ? ParticleTypes.LARGE_SMOKE : (rv>0.4 ? ParticleTypes.SMOKE : ParticleTypes.CAMPFIRE_COSY_SMOKE)), - 0.5+pos.getX()+(rnd.nextDouble()*0.2), - 0.9+pos.getY()+(rnd.nextDouble()*0.1), - 0.5+pos.getZ()+(rnd.nextDouble()*0.2), - -0.02 + rnd.nextDouble()*0.04, - +0.05 + rnd.nextDouble()*0.1, - -0.02 + rnd.nextDouble()*0.04 - ); - } - } - -} +/* + * @file EdChimneyBlock.java + * @author Stefan Wilhelm (wile) + * @copyright (C) 2020 Stefan Wilhelm + * @license MIT (see https://opensource.org/licenses/MIT) + * + * Block type for smoking chimneys. + */ +package wile.engineersdecor.blocks; + +import net.minecraft.block.*; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.item.BlockItemUseContext; +import net.minecraft.particles.ParticleTypes; +import net.minecraft.state.IntegerProperty; +import net.minecraft.state.StateContainer; +import net.minecraft.state.properties.BlockStateProperties; +import net.minecraft.util.ActionResultType; +import net.minecraft.util.Direction; +import net.minecraft.util.Hand; +import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.BlockRayTraceResult; +import net.minecraft.world.IWorldReader; +import net.minecraft.world.World; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; + +import javax.annotation.Nullable; +import java.util.Random; + +public class EdChimneyBlock extends DecorBlock.Cutout implements IDecorBlock +{ + public static final IntegerProperty POWER = BlockStateProperties.POWER; + + public EdChimneyBlock(long config, AbstractBlock.Properties properties, AxisAlignedBB aabb) + { super(config, properties, aabb); } + + public EdChimneyBlock(long config, AbstractBlock.Properties builder) + { + this(config, builder, new AxisAlignedBB(0,0,0,1,1,1)); + registerDefaultState(super.defaultBlockState().setValue(POWER, 0)); // no smoke in JEI + } + + @Override + protected void createBlockStateDefinition(StateContainer.Builder builder) + { super.createBlockStateDefinition(builder); builder.add(POWER); } + + @Override + @Nullable + public BlockState getStateForPlacement(BlockItemUseContext context) + { + BlockState state = super.getStateForPlacement(context); + if(state==null) return state; + int p = context.getLevel().getBestNeighborSignal(context.getClickedPos()); + return state.setValue(POWER, p==0 ? 5 : p); + } + + @Override + @SuppressWarnings("deprecation") + public ActionResultType use(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult rayTraceResult) + { world.setBlock(pos, state.setValue(POWER, (state.getValue(POWER)+1) & 0xf), 1|2); return ActionResultType.sidedSuccess(world.isClientSide()); } + + @Override + @SuppressWarnings("deprecation") + public void neighborChanged(BlockState state, World world, BlockPos pos, Block block, BlockPos fromPos, boolean unused) + { + int p = world.getBestNeighborSignal(pos); + if(p != state.getValue(POWER)) world.setBlock(pos, state.setValue(POWER, p), 2); + } + + @Override + public boolean shouldCheckWeakPower(BlockState state, IWorldReader world, BlockPos pos, Direction side) + { return false; } + + @Override + @OnlyIn(Dist.CLIENT) + public void animateTick(BlockState state, World world, BlockPos pos, Random rnd) + { + if(state.getBlock() != this) return; + final int p = state.getValue(POWER); + if(p==0) return; + int end = 1+rnd.nextInt(10) * p / 15; + for(int i=0; i 0.7 ? ParticleTypes.LARGE_SMOKE : (rv>0.4 ? ParticleTypes.SMOKE : ParticleTypes.CAMPFIRE_COSY_SMOKE)), + 0.5+pos.getX()+(rnd.nextDouble()*0.2), + 0.9+pos.getY()+(rnd.nextDouble()*0.1), + 0.5+pos.getZ()+(rnd.nextDouble()*0.2), + -0.02 + rnd.nextDouble()*0.04, + +0.05 + rnd.nextDouble()*0.1, + -0.02 + rnd.nextDouble()*0.04 + ); + } + } + +} diff --git a/src/main/java/wile/engineersdecor/blocks/EdChimneyTrunkBlock.java b/src/main/java/wile/engineersdecor/blocks/EdChimneyTrunkBlock.java index ab36fbd..7a0fc2d 100644 --- a/src/main/java/wile/engineersdecor/blocks/EdChimneyTrunkBlock.java +++ b/src/main/java/wile/engineersdecor/blocks/EdChimneyTrunkBlock.java @@ -1,36 +1,36 @@ -/* - * @file EdChimneyTrunkBlock.java - * @author Stefan Wilhelm (wile) - * @copyright (C) 2020 Stefan Wilhelm - * @license MIT (see https://opensource.org/licenses/MIT) - * - * Roof block with chimney trunk, only straight. - */ -package wile.engineersdecor.blocks; - -import net.minecraft.block.*; -import net.minecraft.item.BlockItemUseContext; -import net.minecraft.state.properties.Half; -import net.minecraft.state.properties.StairsShape; -import net.minecraft.util.math.shapes.VoxelShape; -import net.minecraft.util.math.shapes.VoxelShapes; - -import javax.annotation.Nullable; - - -public class EdChimneyTrunkBlock extends EdRoofBlock implements IDecorBlock -{ - public EdChimneyTrunkBlock(long config, Block.Properties properties) - { super(config, properties.variableOpacity(), VoxelShapes.empty(), VoxelShapes.empty()); } - - public EdChimneyTrunkBlock(long config, Block.Properties properties, VoxelShape add, VoxelShape cut) - { super(config, properties, add, cut); } - - @Override - @Nullable - public BlockState getStateForPlacement(BlockItemUseContext context) - { - BlockState state = super.getStateForPlacement(context); - return (state==null) ? (state) : (state.with(EdRoofBlock.SHAPE, StairsShape.STRAIGHT).with(EdRoofBlock.HALF, Half.BOTTOM)); - } -} +/* + * @file EdChimneyTrunkBlock.java + * @author Stefan Wilhelm (wile) + * @copyright (C) 2020 Stefan Wilhelm + * @license MIT (see https://opensource.org/licenses/MIT) + * + * Roof block with chimney trunk, only straight. + */ +package wile.engineersdecor.blocks; + +import net.minecraft.block.*; +import net.minecraft.item.BlockItemUseContext; +import net.minecraft.state.properties.Half; +import net.minecraft.state.properties.StairsShape; +import net.minecraft.util.math.shapes.VoxelShape; +import net.minecraft.util.math.shapes.VoxelShapes; + +import javax.annotation.Nullable; + + +public class EdChimneyTrunkBlock extends EdRoofBlock implements IDecorBlock +{ + public EdChimneyTrunkBlock(long config, AbstractBlock.Properties properties) + { super(config, properties.dynamicShape(), VoxelShapes.empty(), VoxelShapes.empty()); } + + public EdChimneyTrunkBlock(long config, AbstractBlock.Properties properties, VoxelShape add, VoxelShape cut) + { super(config, properties, add, cut); } + + @Override + @Nullable + public BlockState getStateForPlacement(BlockItemUseContext context) + { + BlockState state = super.getStateForPlacement(context); + return (state==null) ? (state) : (state.setValue(EdRoofBlock.SHAPE, StairsShape.STRAIGHT).setValue(EdRoofBlock.HALF, Half.BOTTOM)); + } +} diff --git a/src/main/java/wile/engineersdecor/blocks/EdCornerOrnamentedBlock.java b/src/main/java/wile/engineersdecor/blocks/EdCornerOrnamentedBlock.java index cacadb5..2720229 100644 --- a/src/main/java/wile/engineersdecor/blocks/EdCornerOrnamentedBlock.java +++ b/src/main/java/wile/engineersdecor/blocks/EdCornerOrnamentedBlock.java @@ -1,69 +1,71 @@ -/* - * @file EdCornerOrnamentedBlock.java - * @author Stefan Wilhelm (wile) - * @copyright (C) 2020 Stefan Wilhelm - * @license MIT (see https://opensource.org/licenses/MIT) - * - * Block for corner/quoin ornamentation. - */ -package wile.engineersdecor.blocks; - -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.item.BlockItemUseContext; -import net.minecraft.util.Direction; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.MathHelper; -import net.minecraft.util.math.vector.Vector2f; -import net.minecraft.world.World; -import wile.engineersdecor.libmc.detail.Auxiliaries; - -import javax.annotation.Nullable; -import java.util.*; - - -public class EdCornerOrnamentedBlock extends DecorBlock.Directed -{ - protected final HashSet compatible_blocks; - - public EdCornerOrnamentedBlock(long config, Block.Properties properties, Block[] assigned_wall_blocks) - { - super(config, properties, Auxiliaries.getPixeledAABB(0,0,0,16,16,16)); - compatible_blocks = new HashSet(Arrays.asList(assigned_wall_blocks)); - } - - @Override - @Nullable - public BlockState getStateForPlacement(BlockItemUseContext context) - { - final World world = context.getWorld(); - final BlockPos pos = context.getPos(); - // 1. Placement as below/above for corners, or placement adjacent horizontally if up/down facing. - for(Direction adj: Direction.values()) { - BlockState state = world.getBlockState(pos.offset(adj)); - if(state.getBlock() != this) continue; - Direction facing = state.get(FACING); - if(facing.getAxis().isHorizontal() == (adj.getAxis().isVertical())) { - return super.getStateForPlacement(context).with(FACING, state.get(FACING)); - } - } - // 2. By Player look angles with minimum horizontal diagonal deviation. - { - Direction facing = Direction.WEST; - final Vector2f look = context.getPlayer().getPitchYaw(); - final Direction hit_face = context.getFace(); - if((context.getFace()==Direction.DOWN) && (look.x <= -60)) { - facing = Direction.DOWN; - } else if((context.getFace()==Direction.UP) && (look.x >= 60)) { - facing = Direction.UP; - } else if(MathHelper.degreesDifferenceAbs(look.y, 45) <= 45) { - facing = Direction.NORTH; - } else if(MathHelper.degreesDifferenceAbs(look.y, 45+90) <= 45) { - facing = Direction.EAST; - } else if(MathHelper.degreesDifferenceAbs(look.y, 45+180) <= 45) { - facing = Direction.SOUTH; - } - return super.getStateForPlacement(context).with(FACING, facing); - } - } -} +/* + * @file EdCornerOrnamentedBlock.java + * @author Stefan Wilhelm (wile) + * @copyright (C) 2020 Stefan Wilhelm + * @license MIT (see https://opensource.org/licenses/MIT) + * + * Block for corner/quoin ornamentation. + */ +package wile.engineersdecor.blocks; + +import net.minecraft.block.AbstractBlock; +import net.minecraft.block.Block; +import net.minecraft.block.BlockState; +import net.minecraft.item.BlockItemUseContext; +import net.minecraft.util.Direction; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.MathHelper; +import net.minecraft.util.math.vector.Vector2f; +import net.minecraft.world.World; +import wile.engineersdecor.libmc.detail.Auxiliaries; + +import javax.annotation.Nullable; +import java.util.*; + + + +public class EdCornerOrnamentedBlock extends DecorBlock.Directed +{ + protected final HashSet compatible_blocks; + + public EdCornerOrnamentedBlock(long config, AbstractBlock.Properties properties, Block[] assigned_wall_blocks) + { + super(config, properties, Auxiliaries.getPixeledAABB(0,0,0,16,16,16)); + compatible_blocks = new HashSet(Arrays.asList(assigned_wall_blocks)); + } + + @Override + @Nullable + public BlockState getStateForPlacement(BlockItemUseContext context) + { + final World world = context.getLevel(); + final BlockPos pos = context.getClickedPos(); + // 1. Placement as below/above for corners, or placement adjacent horizontally if up/down facing. + for(Direction adj: Direction.values()) { + BlockState state = world.getBlockState(pos.relative(adj)); + if(state.getBlock() != this) continue; + Direction facing = state.getValue(FACING); + if(facing.getAxis().isHorizontal() == (adj.getAxis().isVertical())) { + return super.getStateForPlacement(context).setValue(FACING, state.getValue(FACING)); + } + } + // 2. By Player look angles with minimum horizontal diagonal deviation. + { + Direction facing = Direction.WEST; + final Vector2f look = context.getPlayer().getRotationVector(); + final Direction hit_face = context.getClickedFace(); + if((context.getClickedFace()==Direction.DOWN) && (look.x <= -60)) { + facing = Direction.DOWN; + } else if((context.getClickedFace()==Direction.UP) && (look.x >= 60)) { + facing = Direction.UP; + } else if(MathHelper.degreesDifferenceAbs(look.y, 45) <= 45) { + facing = Direction.NORTH; + } else if(MathHelper.degreesDifferenceAbs(look.y, 45+90) <= 45) { + facing = Direction.EAST; + } else if(MathHelper.degreesDifferenceAbs(look.y, 45+180) <= 45) { + facing = Direction.SOUTH; + } + return super.getStateForPlacement(context).setValue(FACING, facing); + } + } +} diff --git a/src/main/java/wile/engineersdecor/blocks/EdCraftingTable.java b/src/main/java/wile/engineersdecor/blocks/EdCraftingTable.java index 9e6151e..428ae45 100644 --- a/src/main/java/wile/engineersdecor/blocks/EdCraftingTable.java +++ b/src/main/java/wile/engineersdecor/blocks/EdCraftingTable.java @@ -1,1679 +1,1681 @@ -/* - * @file EdCraftingTable.java - * @author Stefan Wilhelm (wile) - * @copyright (C) 2020 Stefan Wilhelm - * @license MIT (see https://opensource.org/licenses/MIT) - * - * Crafting table - */ -package wile.engineersdecor.blocks; - -import net.minecraft.inventory.container.*; -import net.minecraft.network.NetworkManager; -import net.minecraft.network.play.server.SUpdateTileEntityPacket; -import net.minecraft.world.*; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.tileentity.TileEntityType; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.entity.player.ServerPlayerEntity; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.item.Item; -import net.minecraft.item.Items; -import net.minecraft.item.ItemStack; -import net.minecraft.item.crafting.*; -import net.minecraft.inventory.*; -import net.minecraft.nbt.CompoundNBT; -import net.minecraft.util.*; -import net.minecraft.util.math.AxisAlignedBB; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.MathHelper; -import net.minecraft.util.text.ITextComponent; -import net.minecraft.util.math.BlockRayTraceResult; -import net.minecraft.util.text.StringTextComponent; -import net.minecraft.client.gui.widget.button.ImageButton; -import net.minecraft.client.gui.widget.button.Button; -import net.minecraft.client.renderer.ItemRenderer; -import net.minecraft.world.server.ServerWorld; -import net.minecraftforge.fml.network.NetworkHooks; -import net.minecraftforge.common.util.FakePlayer; -import net.minecraftforge.registries.ForgeRegistries; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; -import com.mojang.blaze3d.systems.RenderSystem; -import com.google.common.collect.ImmutableList; -import com.mojang.blaze3d.matrix.MatrixStack; -import wile.engineersdecor.ModConfig; -import wile.engineersdecor.ModContent; -import wile.engineersdecor.ModEngineersDecor; -import wile.engineersdecor.libmc.client.ContainerGui; -import wile.engineersdecor.libmc.detail.Auxiliaries; -import wile.engineersdecor.libmc.detail.Inventories; -import wile.engineersdecor.libmc.detail.Inventories.InventoryRange; -import wile.engineersdecor.libmc.detail.Inventories.StorageInventory; -import wile.engineersdecor.libmc.detail.Networking; -import wile.engineersdecor.libmc.detail.TooltipDisplay; -import wile.engineersdecor.libmc.detail.TooltipDisplay.TipRange; - -import javax.annotation.Nullable; -import java.util.*; -import java.util.stream.Collectors; -import java.util.Arrays; - - -public class EdCraftingTable -{ - public static boolean with_assist = true; - public static boolean with_assist_direct_history_refab = false; - public static boolean with_crafting_slot_mouse_scrolling = true; - public static boolean with_outslot_defined_refab = true; - - public static final void on_config(boolean without_crafting_assist, boolean with_assist_immediate_history_refab, - boolean without_crafting_slot_mouse_scrolling) - { - with_assist = !without_crafting_assist; - with_assist_direct_history_refab = with_assist_immediate_history_refab; - with_crafting_slot_mouse_scrolling = !without_crafting_slot_mouse_scrolling; - with_outslot_defined_refab = with_assist; - CraftingHistory.max_history_size(32); - ModConfig.log("Config crafting table: assist:" + with_assist + ", direct-refab:" + with_assist_direct_history_refab + - ", scrolling:"+with_crafting_slot_mouse_scrolling); - } - - //-------------------------------------------------------------------------------------------------------------------- - // Block - //-------------------------------------------------------------------------------------------------------------------- - - public static final class CraftingTableBlock extends DecorBlock.HorizontalWaterLoggable implements IDecorBlock - { - public CraftingTableBlock(long config, Block.Properties builder, final AxisAlignedBB[] unrotatedAABBs) - { super(config, builder, unrotatedAABBs); } - - @Override - public boolean shouldCheckWeakPower(BlockState state, IWorldReader world, BlockPos pos, Direction side) - { return false; } - - @Override - public boolean hasTileEntity(BlockState state) - { return true; } - - @Override - @Nullable - public TileEntity createTileEntity(BlockState state, IBlockReader world) - { return new EdCraftingTable.CraftingTableTileEntity(); } - - @Override - @SuppressWarnings("deprecation") - public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult rayTraceResult) - { - if(world.isRemote()) return ActionResultType.SUCCESS; - final TileEntity te = world.getTileEntity(pos); - if(!(te instanceof CraftingTableTileEntity)) return ActionResultType.FAIL; - if((!(player instanceof ServerPlayerEntity) && (!(player instanceof FakePlayer)))) return ActionResultType.FAIL; - NetworkHooks.openGui((ServerPlayerEntity)player,(INamedContainerProvider)te); - return ActionResultType.CONSUME; - } - - @Override - public void onBlockPlacedBy(World world, BlockPos pos, BlockState state, LivingEntity placer, ItemStack stack) - { - if(world.isRemote) return; - if(!stack.hasTag()) return; - if((!stack.hasTag()) || (!stack.getTag().contains("inventory"))) return; - CompoundNBT inventory_nbt = stack.getTag().getCompound("inventory"); - if(inventory_nbt.isEmpty()) return; - final TileEntity te = world.getTileEntity(pos); - if(!(te instanceof CraftingTableTileEntity)) return; - ((CraftingTableTileEntity)te).readnbt(inventory_nbt); - ((CraftingTableTileEntity)te).markDirty(); - } - - @Override - public boolean hasDynamicDropList() - { return true; } - - @Override - public List dropList(BlockState state, World world, final TileEntity te, boolean explosion) - { - final List stacks = new ArrayList(); - if(world.isRemote) return stacks; - if(!(te instanceof CraftingTableTileEntity)) return stacks; - if(!explosion) { - ItemStack stack = new ItemStack(this, 1); - CompoundNBT inventory_nbt = new CompoundNBT(); - ((CraftingTableTileEntity)te).mainInventory().save(inventory_nbt, false); - if(!inventory_nbt.isEmpty()) { - CompoundNBT nbt = new CompoundNBT(); - nbt.put("inventory", inventory_nbt); - stack.setTag(nbt); - } - ((CraftingTableTileEntity) te).mainInventory().clear(); - stacks.add(stack); - } else { - for(ItemStack stack: ((CraftingTableTileEntity)te).mainInventory()) { - if(!stack.isEmpty()) stacks.add(stack); - } - ((CraftingTableTileEntity)te).reset(); - } - return stacks; - } - - @Override - @SuppressWarnings("deprecation") - public void tick(BlockState state, ServerWorld world, BlockPos pos, Random rand) - { - TileEntity te = world.getTileEntity(pos); - if(!(te instanceof CraftingTableTileEntity)) return; - ((CraftingTableTileEntity)te).sync(); - } - } - - //-------------------------------------------------------------------------------------------------------------------- - // Tile entity - //-------------------------------------------------------------------------------------------------------------------- - - public static class CraftingTableTileEntity extends TileEntity implements INameable, INamedContainerProvider, Networking.IPacketTileNotifyReceiver - { - public static final int NUM_OF_STORAGE_SLOTS = 18; - public static final int NUM_OF_STORAGE_ROWS = 2; - public static final int NUM_OF_SLOTS = 9+NUM_OF_STORAGE_SLOTS+1; - public static final int CRAFTING_RESULT_SLOT = NUM_OF_SLOTS-1; - - protected Inventories.StorageInventory inventory_; - protected CompoundNBT history = new CompoundNBT(); - - public CraftingTableTileEntity() - { this(ModContent.TET_CRAFTING_TABLE); } - - public CraftingTableTileEntity(TileEntityType te_type) - { - super(te_type); - inventory_ = new StorageInventory(this, NUM_OF_SLOTS, 1); - inventory_.setCloseAction((player)->{ - if(getWorld() instanceof World) { - scheduleSync(); - BlockState state = getBlockState(); - getWorld().notifyBlockUpdate(getPos(), state, state, 1|2|16); - } - }); - inventory_.setSlotChangeAction((slot_index,stack)-> { - if(slot_index < 9) scheduleSync(); - }); - } - - public void reset() - { inventory_.clear(); } - - public void readnbt(CompoundNBT nbt) - { reset(); inventory_.load(nbt); history = nbt.getCompound("history"); } - - private void writenbt(CompoundNBT nbt) - { - inventory_.save(nbt); - if(!history.isEmpty()) nbt.put("history", history); - } - - public Inventories.StorageInventory mainInventory() - { return inventory_; } - - // TileEntity ------------------------------------------------------------------------------ - - @Override - public void read(BlockState state, CompoundNBT nbt) - { super.read(state, nbt); readnbt(nbt); } - - @Override - public CompoundNBT write(CompoundNBT nbt) - { super.write(nbt); writenbt(nbt); return nbt; } - - @Override - public CompoundNBT getUpdateTag() - { CompoundNBT nbt = super.getUpdateTag(); writenbt(nbt); return nbt; } - - @Override - @Nullable - public SUpdateTileEntityPacket getUpdatePacket() - { return new SUpdateTileEntityPacket(pos, 1, getUpdateTag()); } - - @Override - public void onDataPacket(NetworkManager net, SUpdateTileEntityPacket pkt) // on client - { readnbt(pkt.getNbtCompound()); super.onDataPacket(net, pkt); } - - @Override - public void handleUpdateTag(BlockState state, CompoundNBT tag) // on client - { read(state, tag); } - - @OnlyIn(Dist.CLIENT) - public double getMaxRenderDistanceSquared() - { return 400; } - - // INameable --------------------------------------------------------------------------- - - @Override - public ITextComponent getName() - { final Block block=getBlockState().getBlock(); return new StringTextComponent((block!=null) ? block.getTranslationKey() : "Treated wood crafting table"); } - - @Override - public boolean hasCustomName() - { return false; } - - @Override - public ITextComponent getCustomName() - { return getName(); } - - // INamedContainerProvider ------------------------------------------------------------------------------ - - @Override - public ITextComponent getDisplayName() - { return INameable.super.getDisplayName(); } - - @Override - public Container createMenu( int id, PlayerInventory inventory, PlayerEntity player ) - { return new CraftingTableContainer(id, inventory, inventory_, IWorldPosCallable.of(world, pos)); } - - @Override - public void onServerPacketReceived(CompoundNBT nbt) - { readnbt(nbt); } - - public void sync() - { - if(getWorld().isRemote()) return; - CompoundNBT nbt = new CompoundNBT(); - writenbt(nbt); - Networking.PacketTileNotifyServerToClient.sendToPlayers(this, nbt); - } - - public void scheduleSync() - { - if(world.isRemote()) return; - final Block crafting_table_block = getBlockState().getBlock(); - if(!(crafting_table_block instanceof CraftingTableBlock)) return; - if(world.getPendingBlockTicks().isTickScheduled(getPos(), crafting_table_block)) return; - world.getPendingBlockTicks().scheduleTick(getPos(), crafting_table_block, 10, TickPriority.LOW); - } - } - - //-------------------------------------------------------------------------------------------------------------------- - // Crafting container - //-------------------------------------------------------------------------------------------------------------------- - - public static class CraftingTableContainer extends Container implements Networking.INetworkSynchronisableContainer - { - protected static final String BUTTON_NEXT = "next"; - protected static final String BUTTON_PREV = "prev"; - protected static final String BUTTON_CLEAR_GRID = "clear"; - protected static final String BUTTON_NEXT_COLLISION_RECIPE = "next-recipe"; - protected static final String ACTION_PLACE_CURRENT_HISTORY_SEL = "place-refab"; - protected static final String ACTION_PLACE_SHIFTCLICKED_STACK = "place-stack"; - protected static final String ACTION_MOVE_ALL_STACKS = "move-stacks"; - protected static final String ACTION_MOVE_STACK = "move-stack"; - protected static final String ACTION_INCREASE_CRAFTING_STACKS = "inc-crafting-stacks"; - protected static final String ACTION_DECREASE_CRAFTING_STACKS = "dec-crafting-stacks"; - - public static final int CRAFTING_SLOTS_BEGIN = 0; - public static final int CRAFTING_SLOTS_SIZE = 9; - public static final int NUM_OF_STORAGE_SLOTS = CraftingTableTileEntity.NUM_OF_STORAGE_SLOTS; - public static final int NUM_OF_STORAGE_ROWS = CraftingTableTileEntity.NUM_OF_STORAGE_ROWS; - - public final ImmutableList> CRAFTING_SLOT_COORDINATES; - private final PlayerEntity player_; - private final IInventory inventory_; - private final IWorldPosCallable wpc_; - private final CraftingHistory history_; - private final CraftingTableGrid matrix_; - private final CraftResultInventory result_; - private final CraftingOutputSlot crafting_output_slot_; - private boolean has_recipe_collision_; - private boolean crafting_matrix_changed_now_; - private final InventoryRange crafting_grid_range_; - private final InventoryRange crafting_result_range_; - private final InventoryRange block_storage_range_; - private final InventoryRange player_storage_range_; - private final InventoryRange player_hotbar_range_; - private final InventoryRange player_inventory_range_; - private final @Nullable CraftingTableTileEntity te_; - - public CraftingTableContainer(int cid, PlayerInventory pinv) - { this(cid, pinv, new Inventory(CraftingTableTileEntity.NUM_OF_SLOTS), IWorldPosCallable.DUMMY); } - - private CraftingTableContainer(int cid, PlayerInventory pinv, IInventory block_inventory, IWorldPosCallable wpc) - { - super(ModContent.CT_TREATED_WOOD_CRAFTING_TABLE, cid); - wpc_ = wpc; - player_ = pinv.player; - inventory_ = block_inventory; - inventory_.openInventory(player_); - World world = player_.world; - if((inventory_ instanceof StorageInventory) && ((((StorageInventory)inventory_).getTileEntity()) instanceof CraftingTableTileEntity)) { - te_ = (CraftingTableTileEntity)(((StorageInventory)inventory_).getTileEntity()); - } else { - te_ = null; - } - crafting_grid_range_ = new InventoryRange(inventory_, 0, 9, 3); - block_storage_range_ = new InventoryRange(inventory_, CRAFTING_SLOTS_SIZE, NUM_OF_STORAGE_SLOTS, NUM_OF_STORAGE_ROWS); - crafting_result_range_= new InventoryRange(inventory_, CraftingTableTileEntity.CRAFTING_RESULT_SLOT, 1, 1); - player_storage_range_ = InventoryRange.fromPlayerStorage(player_); - player_hotbar_range_ = InventoryRange.fromPlayerHotbar(player_); - player_inventory_range_= InventoryRange.fromPlayerInventory(player_); - matrix_ = new CraftingTableGrid(this, inventory_); - result_ = new CraftOutputInventory(crafting_result_range_); - history_ = new CraftingHistory(world); - // container slotId 0 === crafting output - addSlot(crafting_output_slot_=(new CraftingOutputSlot(this, pinv.player, matrix_, result_, 0, 118, 27))); - ArrayList> slotpositions = new ArrayList>(); - slotpositions.add(new Tuple<>(118, 27)); - // container slotId 1..9 === TE slots 0..8 - for(int y=0; y<3; ++y) { - for(int x=0; x<3; ++x) { - int xpos = 44+x*18; - int ypos = 9+y*18; - addSlot(new CraftingGridSlot(matrix_, x+y*3, xpos, ypos)); - slotpositions.add(new Tuple<>(xpos, ypos)); - } - } - // container slotId 10..36 === player slots: 9..35 - for(int y=0; y<3; ++y) { - for(int x=0; x<9; ++x) { - addSlot(new Slot(pinv, x+y*9+9, 8+x*18, 110+y*18)); - } - } - // container slotId 37..45 === player slots: 0..8 - for(int x=0; x<9; ++x) { - addSlot(new Slot(pinv, x, 8+x*18, 168)); - } - // container slotId 46..63 === TE slots 9..27 (storage) - for(int y=0; y<2; ++y) { - for(int x=0; x<9; ++x) { - addSlot(new Slot(inventory_, 9+x+y*9, 8+x*18, 65+y*18)); - } - } - if((!player_.world.isRemote()) && (te_ != null)) { - history_.read(te_.history.copy()); - } - CRAFTING_SLOT_COORDINATES = ImmutableList.copyOf(slotpositions); - onCraftMatrixChanged(); - } - - @Override - public boolean canInteractWith(PlayerEntity player) - { return inventory_.isUsableByPlayer(player); } - - public void onCraftMatrixChanged() - { onCraftMatrixChanged(matrix_); } - - @Override - public void onCraftMatrixChanged(IInventory inv) - { - wpc_.consume((world,pos)->{ - if(world.isRemote()) return; - try { - crafting_matrix_changed_now_ = true; - ServerPlayerEntity player = (ServerPlayerEntity) player_; - ItemStack stack = ItemStack.EMPTY; - List recipes = world.getServer().getRecipeManager().getRecipes(IRecipeType.CRAFTING, matrix_, world); - has_recipe_collision_ = false; - if(recipes.size() > 0) { - ICraftingRecipe recipe = recipes.get(0); - IRecipe currently_used = result_.getRecipeUsed(); - has_recipe_collision_ = (recipes.size() > 1); - if((recipes.size() > 1) && (currently_used instanceof ICraftingRecipe) && (recipes.contains(currently_used))) { - recipe = (ICraftingRecipe)currently_used; - } - if(result_.canUseRecipe(world, player, recipe)) { - detectAndSendChanges(); - stack = recipe.getCraftingResult(matrix_); - } - } - result_.setInventorySlotContents(0, stack); - detectAndSendChanges(); - } catch(Throwable exc) { - ModEngineersDecor.logger().error("Recipe failed:", exc); - } - }); - } - - @Override - public void onContainerClosed(PlayerEntity player) - { inventory_.closeInventory(player); } - - @Override - public boolean canMergeSlot(ItemStack stack, Slot slot) - { return (slot.inventory != result_) && (super.canMergeSlot(stack, slot)); } - - @Override - public ItemStack transferStackInSlot(PlayerEntity player, int index) - { - Slot slot = inventorySlots.get(index); - if((slot == null) || (!slot.getHasStack())) return ItemStack.EMPTY; - ItemStack slotstack = slot.getStack(); - ItemStack stack = slotstack.copy(); - if(index == 0) { - if(!this.mergeItemStack(slotstack, 10, 46+NUM_OF_STORAGE_SLOTS, false)) return ItemStack.EMPTY; - wpc_.consume((world, pos)->slotstack.getItem().onCreated(slotstack, world, player)); - slot.onSlotChange(slotstack, stack); - } else if(index >= 10 && (index < 46)) { - if(!this.mergeItemStack(slotstack, 46, 46+NUM_OF_STORAGE_SLOTS, false)) return ItemStack.EMPTY; - } else if((index >= 46) && (index < 46+NUM_OF_STORAGE_SLOTS)) { - if(!this.mergeItemStack(slotstack, 10, 46, false)) return ItemStack.EMPTY; - } else if(!this.mergeItemStack(slotstack, 10, 46, false)) { - return ItemStack.EMPTY; - } - if(slotstack.isEmpty()) slot.putStack(ItemStack.EMPTY); - slot.onSlotChanged(); - if((index != 0) && (slotstack.getCount() == stack.getCount())) return ItemStack.EMPTY; - ItemStack itemstack2 = slot.onTake(player, slotstack); - if(index == 0) player.dropItem(itemstack2, false); - return stack; - } - - @Override - public ItemStack slotClick(int slotId, int button, ClickType clickType, PlayerEntity player) - { - crafting_matrix_changed_now_ = false; - final ItemStack stack = super.slotClick(slotId, button, clickType, player); - if((with_outslot_defined_refab) && (slotId == 0) && (clickType == ClickType.PICKUP)) { - if((!crafting_matrix_changed_now_) && (!player.world.isRemote()) && (crafting_grid_empty())) { - final ItemStack dragged = player.inventory.getItemStack(); - if((dragged != null) && (!dragged.isEmpty())) { - try_result_stack_refab(dragged, player.world); - } else if(!history().current().isEmpty()) { - try_result_stack_refab(history().current_recipe().getRecipeOutput(), player.world); - } - } - } - return stack; - } - - // Container client/server synchronisation -------------------------------------------------- - - @OnlyIn(Dist.CLIENT) - public void onGuiAction(String message, CompoundNBT nbt) - { - nbt.putString("action", message); - Networking.PacketContainerSyncClientToServer.sendToServer(windowId, nbt); - } - - @Override - public void onServerPacketReceived(int windowId, CompoundNBT nbt) - { - if(nbt.contains("history")) { - history_.read(nbt.getCompound("history")); - } - if(nbt.contains("hascollision")) { - has_recipe_collision_ = nbt.getBoolean("hascollision"); - } - if(nbt.contains("inventory")) { - Inventories.readNbtStacks(nbt, "inventory", inventory_); - this.onCraftMatrixChanged(matrix_); - } - } - - @Override - public void onClientPacketReceived(int windowId, PlayerEntity player, CompoundNBT nbt) - { - boolean changed = false; - boolean player_inventory_changed = false; - if(with_assist && nbt.contains("action")) { - switch(nbt.getString("action")) { - case BUTTON_NEXT: { - history_.next(); - // implicitly clear the grid, so that the player can see the refab, and that no recipe is active. - if(crafting_grid_range_.move(block_storage_range_)) changed = true; - if(crafting_grid_range_.move(player_inventory_range_)) { changed = true; player_inventory_changed = true; } - sync(); - } break; - case BUTTON_PREV: { - history_.prev(); - if(crafting_grid_range_.move(block_storage_range_)) changed = true; - if(crafting_grid_range_.move(player_inventory_range_)) { changed = true; player_inventory_changed = true; } - sync(); - } break; - case BUTTON_CLEAR_GRID: { - history_.reset_selection(); - sync(); - if(crafting_grid_range_.move(block_storage_range_)) changed = true; - if(crafting_grid_range_.move(player_inventory_range_)) { changed = true; player_inventory_changed = true; } - } break; - case ACTION_PLACE_CURRENT_HISTORY_SEL: { - if(place_stacks( - new InventoryRange[]{block_storage_range_, player_storage_range_, player_hotbar_range_}, - refab_crafting_stacks()) != PlacementResult.UNCHANGED) { - changed = true; - } - } break; - case ACTION_PLACE_SHIFTCLICKED_STACK: { - final int container_slot_id = nbt.getInt("containerslot"); - if((container_slot_id < 10) || (container_slot_id > (46+NUM_OF_STORAGE_SLOTS))) { - break; // out of range - } - if(container_slot_id >= 46) { - // from storage - PlacementResult stat = distribute_stack(block_storage_range_, container_slot_id-46); - if(stat != PlacementResult.UNCHANGED) changed = true; - } else { - // from player - int player_slot = (container_slot_id >= 37) ? (container_slot_id-37) : (container_slot_id-10+9); - final ItemStack reference_stack = player.inventory.getStackInSlot(player_slot).copy(); - if((!reference_stack.isEmpty()) && (distribute_stack(player.inventory, player_slot) != PlacementResult.UNCHANGED)) { - player_inventory_changed = true; - changed = true; - if(nbt.contains("move-all")) { - for(int i=0; i < player.inventory.getSizeInventory(); ++i) { - final ItemStack stack = player.inventory.getStackInSlot(i); - if(!Inventories.areItemStacksIdentical(reference_stack, stack)) continue; - if(distribute_stack(player.inventory, i) == PlacementResult.UNCHANGED) break; // grid is full - } - } - } - } - } break; - case ACTION_MOVE_STACK: { - final int container_slot_id = nbt.getInt("containerslot"); - if((container_slot_id < 1) || (container_slot_id >= (46+NUM_OF_STORAGE_SLOTS))) { - break; // out of range - } else if(container_slot_id < 10) { - int slot = container_slot_id; - ItemStack remaining = Inventories.insert( - new InventoryRange[] {block_storage_range_, player_storage_range_, player_hotbar_range_}, - inventory_.getStackInSlot(slot-1) - ); - changed = player_inventory_changed = (remaining.getCount()!=inventory_.getStackInSlot(slot-1).getCount()); - inventory_.setInventorySlotContents(slot-1, remaining); - } - } break; - case ACTION_MOVE_ALL_STACKS: { - final int container_slot_id = nbt.getInt("containerslot"); - if((container_slot_id < 1) || (container_slot_id >= (46+NUM_OF_STORAGE_SLOTS))) { - break; // out of range - } else if(container_slot_id < 10) { - // from crafting grid to player inventory, we clear the grid here as this is most likely - // what is wanted in the end. Saves clicking the other grid stacks. - if(crafting_grid_range_.move(player_inventory_range_, true)) { - crafting_grid_range_.move(player_inventory_range_, false, false, true); - changed = true; player_inventory_changed = true; - } - if(crafting_grid_range_.move(block_storage_range_)) changed = true; - if(crafting_grid_range_.move(player_inventory_range_, true)) { changed = true; player_inventory_changed = true; } - break; - } - IInventory from_inventory; - InventoryRange[] to_ranges; - int from_slot; - if(container_slot_id >= 46) { - // from storage to player inventory - from_inventory = inventory_; - from_slot = container_slot_id - 46 + CRAFTING_SLOTS_SIZE; - to_ranges = new InventoryRange[] {player_storage_range_, player_hotbar_range_}; - } else { - // from player to storage (otherwise ACTION_PLACE_SHIFTCLICKED_STACK would have been used) - from_inventory = player.inventory; - from_slot = (container_slot_id >= 37) ? (container_slot_id-37) : (container_slot_id-10+9); - to_ranges = new InventoryRange[]{block_storage_range_}; - } - final ItemStack reference_stack = from_inventory.getStackInSlot(from_slot).copy(); - if(!reference_stack.isEmpty()) { - boolean abort = false; - for(int i=0; (i < from_inventory.getSizeInventory()) && (!abort); ++i) { - final ItemStack stack = from_inventory.getStackInSlot(i); - if(Inventories.areItemStacksDifferent(reference_stack, stack)) continue; - ItemStack remaining = Inventories.insert(to_ranges, from_inventory.getStackInSlot(i)); - changed = player_inventory_changed = (remaining.getCount()!=from_inventory.getStackInSlot(i).getCount()); - from_inventory.setInventorySlotContents(i, remaining); - } - } - } break; - case BUTTON_NEXT_COLLISION_RECIPE: { - select_next_collision_recipe(inventory_); - } break; - case ACTION_DECREASE_CRAFTING_STACKS: { - changed = player_inventory_changed = decrease_grid_stacks( - new InventoryRange[]{block_storage_range_, player_storage_range_, player_hotbar_range_}, - MathHelper.clamp(nbt.getInt("limit"), 1, 8)); - } break; - case ACTION_INCREASE_CRAFTING_STACKS: { - changed = player_inventory_changed = increase_grid_stacks( - new InventoryRange[]{block_storage_range_, player_storage_range_, player_hotbar_range_}, - MathHelper.clamp(nbt.getInt("limit"), 1, 8)); - } break; - } - } - if(changed) inventory_.markDirty(); - if(player_inventory_changed) player.inventory.markDirty(); - if(changed || player_inventory_changed) { - this.onCraftMatrixChanged(); - this.detectAndSendChanges(); - } - } - - public CraftingHistory history() - { return history_; } - - private void sync() - { - this.wpc_.consume((world,pos)->{ - if(world.isRemote()) return; - inventory_.markDirty(); - final CompoundNBT nbt = new CompoundNBT(); - if(te_ != null) nbt.put("inventory", te_.mainInventory().save(false)); - if(with_assist) { - CompoundNBT hist_nbt = history_.write(); - if(te_ != null) { - te_.history = hist_nbt.copy(); - } - nbt.put("history", hist_nbt); - nbt.putBoolean("hascollision", has_recipe_collision_); - } - Networking.PacketContainerSyncServerToClient.sendToListeners(world, this, nbt); - }); - } - - // private aux methods --------------------------------------------------------------------- - - public boolean has_recipe_collision() - { return has_recipe_collision_; } - - public void select_next_collision_recipe(IInventory inv) - { - wpc_.consume((world,pos)->{ - if(world.isRemote) return; - try { - ServerPlayerEntity player = (ServerPlayerEntity) player_; - final List matching_recipes = world.getServer().getRecipeManager().getRecipes(IRecipeType.CRAFTING, matrix_, world); - if(matching_recipes.size() < 2) return; // nothing to change - IRecipe currently_used = result_.getRecipeUsed(); - List usable_recipes = matching_recipes.stream() - .filter((r)->result_.canUseRecipe(world,player,r)) - .sorted((a,b)->Integer.compare(a.getId().hashCode(), b.getId().hashCode())) - .collect(Collectors.toList()); - for(int i=0; i= usable_recipes.size()) i=0; - currently_used = usable_recipes.get(i); - ItemStack stack = ((ICraftingRecipe)currently_used).getCraftingResult(matrix_); - result_.setInventorySlotContents(0, stack); - result_.setRecipeUsed(currently_used); - break; - } - } - onCraftMatrixChanged(); - } catch(Throwable exc) { - ModEngineersDecor.logger().error("Recipe failed:", exc); - } - }); - } - - @Nullable - private ICraftingRecipe find_first_recipe_for(World world, ItemStack stack) - { - return (ICraftingRecipe)world.getServer().getRecipeManager().getRecipes().stream() - .filter(r->(r.getType()==IRecipeType.CRAFTING) && (r.getRecipeOutput().isItemEqual(stack))) - .findFirst().orElse(null); - } - - private Optional search_inventory(ItemStack match_stack) { - InventoryRange search_ranges[] = new InventoryRange[]{block_storage_range_, player_storage_range_, player_hotbar_range_}; - for(InventoryRange range: search_ranges) { - for(int i=0; i search_inventory(ItemStack[] match_stacks) { - for(ItemStack match_stack: match_stacks) { - Optional stack = search_inventory(match_stack); - if(stack.isPresent()) return stack; - } - return Optional.empty(); - } - - private ArrayList placement_stacks(ICraftingRecipe recipe) - { - final World world = player_.world; - final ArrayList grid = new ArrayList(); - if(recipe.getIngredients().size() > 9) { - return grid; - } else if(recipe instanceof ShapedRecipe) { - final int endw = ((ShapedRecipe)recipe).getWidth(); - final int endh = ((ShapedRecipe)recipe).getHeight(); - int ingredient_index = 0; - for(int i=3-endh; i>0; --i) for(int w=0; w<3; ++w) { - grid.add(ItemStack.EMPTY); - } - for(int h=3-endh; h<3; ++h) for(int w=0; w<3; ++w) { - if((w >= endw) || (ingredient_index >= recipe.getIngredients().size())) { grid.add(ItemStack.EMPTY); continue; } - ItemStack[] match_stacks = recipe.getIngredients().get(ingredient_index++).getMatchingStacks(); - if(match_stacks.length == 0) { grid.add(ItemStack.EMPTY); continue; } - ItemStack preferred = search_inventory(match_stacks).orElse(match_stacks[0]); - if(preferred.isEmpty()) { grid.add(ItemStack.EMPTY); continue; } - grid.add(preferred); - } - } else if(recipe instanceof ShapelessRecipe) { - // todo: check if a collision resolver with shaped recipes makes sense here. - for(int ingredient_index=0; ingredient_index grid_stacks) - { - boolean changed = false; - final List ingredients = recipe.getIngredients(); - for(int stack_index=0; stack_index < grid_stacks.size(); ++stack_index) { - ItemStack to_replace = grid_stacks.get(stack_index); - ItemStack replacement = to_replace; - if(to_replace.isEmpty() || (search_inventory(to_replace).isPresent())) continue; // no replacement needed - for(int ingredient_index=0; ingredient_indexInventories.areItemStacksIdentical(s, to_replace))) { - replacement = search_inventory(match_stacks).orElse(to_replace); - changed = true; - break; - } - } - grid_stacks.set(stack_index, replacement); - } - return changed; - } - - private void try_result_stack_refab(ItemStack output_stack, World world) - { - ICraftingRecipe recipe; - int history_index = history().find(output_stack); - if(history_index >= 0) { - history().selection(history_index); - recipe = history().current_recipe(); - List grid_stacks = history().current().subList(1, history().current().size()); - if(adapt_recipe_placement(recipe, grid_stacks)) { - history().stash(grid_stacks, recipe); - recipe = history().current_recipe(); - } - } else if((recipe=find_first_recipe_for(world, output_stack)) != null) { - ArrayList stacks = placement_stacks(recipe); - if(stacks.isEmpty()) { - recipe = null; - } else { - history().stash(stacks, recipe); - recipe = history().current_recipe(); - } - } - if(recipe != null) { - sync(); - onCraftMatrixChanged(); - } - } - - private boolean crafting_grid_empty() - { for(int i=0; i<10; ++i) { if(getSlot(i).getHasStack()) return false; } return true; } - - private boolean itemstack_recipe_match(ItemStack grid_stack, ItemStack history_stack) - { - if(history_.current_recipe()!=null) { - final NonNullList ingredients = history_.current_recipe().getIngredients(); - boolean grid_match, dist_match; - for(int i=0; i refab_crafting_stacks() - { - final ArrayList slots = new ArrayList(); - final List tocraft = history_.current(); - final int stack_sizes[] = {-1,-1,-1,-1,-1,-1,-1,-1,-1}; - if(tocraft.isEmpty()) return slots; - for(int i=0; i<9; ++i) { - if((i+CraftingHistory.INPUT_STACKS_BEGIN) >= tocraft.size()) break; - final ItemStack needed = tocraft.get(i+CraftingHistory.INPUT_STACKS_BEGIN); - final ItemStack palced = inventory_.getStackInSlot(i+CRAFTING_SLOTS_BEGIN); - if(needed.isEmpty() && (!palced.isEmpty())) return slots; // history vs grid mismatch. - if((!palced.isEmpty()) && (!itemstack_recipe_match(needed, palced))) return slots; // also mismatch - if(!needed.isEmpty()) stack_sizes[i] = palced.getCount(); - } - int min_placed = 64, max_placed=0; - for(int i=0; i<9; ++i) { - if(stack_sizes[i] < 0) continue; - min_placed = Math.min(min_placed, stack_sizes[i]); - max_placed = Math.max(max_placed, stack_sizes[i]); - } - int fillup_size = (max_placed <= min_placed) ? (min_placed + 1) : max_placed; - for(int i=0; i<9; ++i) { - if(stack_sizes[i] < 0) continue; - if(fillup_size > inventory_.getStackInSlot(i+CRAFTING_SLOTS_BEGIN).getMaxStackSize()) return slots; // can't fillup all - } - for(int i=0; i<9; ++i) { - if(stack_sizes[i] < 0) { - slots.add(ItemStack.EMPTY); - } else { - ItemStack st = inventory_.getStackInSlot(i+CRAFTING_SLOTS_BEGIN).copy(); - if(st.isEmpty()) { - st = tocraft.get(i+CraftingHistory.INPUT_STACKS_BEGIN).copy(); - st.setCount(Math.min(st.getMaxStackSize(), fillup_size)); - } else { - st.setCount(MathHelper.clamp(fillup_size-st.getCount(), 0, st.getMaxStackSize())); - } - slots.add(st); - } - } - return slots; - } - - private List incr_crafting_grid_stacks(int count) - { - final ArrayList stacks = new ArrayList(); - for(int i=0; i<9; ++i) { - final ItemStack palced = crafting_grid_range_.getStackInSlot(i).copy(); - if(!palced.isEmpty()) palced.setCount(count); - stacks.add(palced); - } - return stacks; - } - - private PlacementResult place_stacks(final InventoryRange[] ranges, final List to_fill) - { - if(history_.current_recipe() != null) result_.setRecipeUsed(history_.current_recipe()); - boolean slots_changed = false; - if(!to_fill.isEmpty()) { - for(InventoryRange slot_range: ranges) { - for(int it_guard=63; it_guard>=0; --it_guard) { - boolean slots_updated = false; - for(int i = 0; i < 9; ++i) { - if(to_fill.get(i).isEmpty()) continue; - ItemStack grid_stack = crafting_grid_range_.getStackInSlot(i).copy(); - if(grid_stack.getCount() >= grid_stack.getMaxStackSize()) continue; - final ItemStack req_stack = to_fill.get(i).copy(); - req_stack.setCount(1); - final ItemStack mv_stack = slot_range.extract(req_stack); - if(mv_stack.isEmpty()) continue; - to_fill.get(i).shrink(1); - if(grid_stack.isEmpty()) { - grid_stack = mv_stack.copy(); - } else { - grid_stack.grow(mv_stack.getCount()); - } - crafting_grid_range_.setInventorySlotContents(i, grid_stack); - slots_changed = true; - slots_updated = true; - } - if(!slots_updated) break; - } - } - } - boolean missing_item = false; - for(ItemStack st:to_fill) { - if(!st.isEmpty()) { - missing_item = true; - break; - } - } - if(!slots_changed) { - return PlacementResult.UNCHANGED; - } else if(missing_item) { - return PlacementResult.INCOMPLETE; - } else { - return PlacementResult.PLACED; - } - } - - private PlacementResult distribute_stack(IInventory inventory, final int slot_index) - { - List to_refab = refab_crafting_stacks(); - if(history_.current_recipe() != null) result_.setRecipeUsed(history_.current_recipe()); - ItemStack to_distribute = inventory.getStackInSlot(slot_index).copy(); - if(to_distribute.isEmpty()) return PlacementResult.UNCHANGED; - int matching_grid_stack_sizes[] = {-1,-1,-1,-1,-1,-1,-1,-1,-1}; - int max_matching_stack_size = -1; - int min_matching_stack_size = 65; - int total_num_missing_stacks = 0; - for(int i=0; i<9; ++i) { - final ItemStack grid_stack = crafting_grid_range_.getStackInSlot(i); - final ItemStack refab_stack = to_refab.isEmpty() ? ItemStack.EMPTY : to_refab.get(i).copy(); - if((!grid_stack.isEmpty()) && Inventories.areItemStacksIdentical(grid_stack, to_distribute)) { - matching_grid_stack_sizes[i] = grid_stack.getCount(); - total_num_missing_stacks += grid_stack.getMaxStackSize()-grid_stack.getCount(); - if(max_matching_stack_size < matching_grid_stack_sizes[i]) max_matching_stack_size = matching_grid_stack_sizes[i]; - if(min_matching_stack_size > matching_grid_stack_sizes[i]) min_matching_stack_size = matching_grid_stack_sizes[i]; - } else if((!refab_stack.isEmpty()) && (Inventories.areItemStacksIdentical(refab_stack, to_distribute))) { - matching_grid_stack_sizes[i] = 0; - total_num_missing_stacks += grid_stack.getMaxStackSize(); - if(max_matching_stack_size < matching_grid_stack_sizes[i]) max_matching_stack_size = matching_grid_stack_sizes[i]; - if(min_matching_stack_size > matching_grid_stack_sizes[i]) min_matching_stack_size = matching_grid_stack_sizes[i]; - } else if(grid_stack.isEmpty() && (!refab_stack.isEmpty())) { - if(itemstack_recipe_match(to_distribute, refab_stack)) { - matching_grid_stack_sizes[i] = 0; - total_num_missing_stacks += grid_stack.getMaxStackSize(); - if(max_matching_stack_size < matching_grid_stack_sizes[i]) max_matching_stack_size = matching_grid_stack_sizes[i]; - if(min_matching_stack_size > matching_grid_stack_sizes[i]) min_matching_stack_size = matching_grid_stack_sizes[i]; - } - } - } - if(min_matching_stack_size < 0) return PlacementResult.UNCHANGED; - final int stack_limit_size = Math.min(to_distribute.getMaxStackSize(), crafting_grid_range_.getInventoryStackLimit()); - if(min_matching_stack_size >= stack_limit_size) return PlacementResult.UNCHANGED; - int n_to_distribute = to_distribute.getCount(); - for(int it_guard=63; it_guard>=0; --it_guard) { - if(n_to_distribute <= 0) break; - for(int i=0; i<9; ++i) { - if(n_to_distribute <= 0) break; - if(matching_grid_stack_sizes[i] == min_matching_stack_size) { - ++matching_grid_stack_sizes[i]; - --n_to_distribute; - } - } - if(min_matching_stack_size < max_matching_stack_size) { - ++min_matching_stack_size; // distribute short stacks - } else { - ++min_matching_stack_size; // stacks even, increase all - max_matching_stack_size = min_matching_stack_size; - } - if(min_matching_stack_size >= stack_limit_size) break; // all full - } - if(n_to_distribute == to_distribute.getCount()) return PlacementResult.UNCHANGED; // was already full - if(n_to_distribute <= 0) { - inventory.setInventorySlotContents(slot_index, ItemStack.EMPTY); - } else { - to_distribute.setCount(n_to_distribute); - inventory.setInventorySlotContents(slot_index, to_distribute); - } - for(int i=0; i<9; ++i) { - if(matching_grid_stack_sizes[i] < 0) continue; - ItemStack grid_stack = crafting_grid_range_.getStackInSlot(i).copy(); - if(grid_stack.isEmpty()) grid_stack = to_distribute.copy(); - grid_stack.setCount(matching_grid_stack_sizes[i]); - crafting_grid_range_.setInventorySlotContents(i, grid_stack); - } - return PlacementResult.PLACED; - } - - private boolean decrease_grid_stacks(InventoryRange[] ranges, int limit) - { - boolean changed = false; - for(int i=0; i<9; ++i) { - ItemStack stack = crafting_grid_range_.getStackInSlot(i).copy(); - if(stack.isEmpty()) continue; - for(InventoryRange range:ranges) { - ItemStack remaining = range.insert(stack, false, limit, false, false); - if(remaining.getCount() < stack.getCount()) changed = true; - boolean stop = (remaining.getCount() <= Math.max(0, (stack.getCount()-limit))); - stack = remaining; - if(stop) break; - } - crafting_grid_range_.setInventorySlotContents(i, stack.isEmpty() ? ItemStack.EMPTY : stack); - } - return changed; - } - - private boolean increase_grid_stacks(InventoryRange[] ranges, int limit) - { return place_stacks(ranges, incr_crafting_grid_stacks(limit)) != PlacementResult.UNCHANGED; } - - } - - //-------------------------------------------------------------------------------------------------------------------- - // GUI - //-------------------------------------------------------------------------------------------------------------------- - - @OnlyIn(Dist.CLIENT) - public static class CraftingTableGui extends ContainerGui - { - protected static final ResourceLocation BACKGROUND = new ResourceLocation(ModEngineersDecor.MODID, "textures/gui/metal_crafting_table_gui.png"); - protected final PlayerEntity player; - protected final ArrayList