Use newer Java features in places where it makes sense and more (#1009)
This commit is contained in:
1 parent
28cb136c6b
commit
7fb5e47da5
34 files changed
+338
-399
No files matched your search
@@ -2,7 +2,6 @@ package carpet.helpers;
|
||||
|
||||
import carpet.CarpetSettings;
|
||||
import carpet.fakes.StructureFeatureInterface;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.mojang.datafixers.util.Pair;
|
||||
import net.minecraft.server.world.ServerWorld;
|
||||
import net.minecraft.structure.StructureManager;
|
||||
@@ -36,6 +35,7 @@ import net.minecraft.world.gen.feature.StructurePoolFeatureConfig;
|
||||
import net.minecraft.world.gen.feature.TreeFeatureConfig;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class FeatureGenerator
|
||||
@@ -175,13 +175,13 @@ public class FeatureGenerator
|
||||
}
|
||||
|
||||
public static final Map<String, Thing> featureMap = new HashMap<String, Thing>() {{
|
||||
put("oak_bees", simpleTree(ConfiguredFeatures.OAK.getConfig().setTreeDecorators(ImmutableList.of(new BeehiveTreeDecorator(1.0F)))));
|
||||
put("fancy_oak_bees", simpleTree(ConfiguredFeatures.FANCY_OAK.getConfig().setTreeDecorators(ImmutableList.of(new BeehiveTreeDecorator(1.0F)))));
|
||||
put("birch_bees", simpleTree(ConfiguredFeatures.BIRCH.getConfig().setTreeDecorators(ImmutableList.of(new BeehiveTreeDecorator(1.0F)))));
|
||||
put("oak_bees", simpleTree(ConfiguredFeatures.OAK.getConfig().setTreeDecorators(List.of(new BeehiveTreeDecorator(1.0F)))));
|
||||
put("fancy_oak_bees", simpleTree(ConfiguredFeatures.FANCY_OAK.getConfig().setTreeDecorators(List.of(new BeehiveTreeDecorator(1.0F)))));
|
||||
put("birch_bees", simpleTree(ConfiguredFeatures.BIRCH.getConfig().setTreeDecorators(List.of(new BeehiveTreeDecorator(1.0F)))));
|
||||
put("coral_tree", simplePlop(Feature.CORAL_TREE.configure(FeatureConfig.DEFAULT)));
|
||||
put("coral_claw", simplePlop(Feature.CORAL_CLAW.configure(FeatureConfig.DEFAULT)));
|
||||
put("coral_mushroom", simplePlop(Feature.CORAL_MUSHROOM.configure(FeatureConfig.DEFAULT)));
|
||||
put("coral", simplePlop(Feature.SIMPLE_RANDOM_SELECTOR.configure(new SimpleRandomFeatureConfig(ImmutableList.of(
|
||||
put("coral", simplePlop(Feature.SIMPLE_RANDOM_SELECTOR.configure(new SimpleRandomFeatureConfig(List.of(
|
||||
() -> Feature.CORAL_TREE.configure(FeatureConfig.DEFAULT),
|
||||
() -> Feature.CORAL_CLAW.configure(FeatureConfig.DEFAULT),
|
||||
() -> Feature.CORAL_MUSHROOM.configure(FeatureConfig.DEFAULT)
|
||||
@@ -191,7 +191,7 @@ public class FeatureGenerator
|
||||
new StructurePoolFeatureConfig(() -> new StructurePool(
|
||||
new Identifier("bastion/starts"),
|
||||
new Identifier("empty"),
|
||||
ImmutableList.of(
|
||||
List.of(
|
||||
Pair.of(StructurePoolElement.ofProcessedSingle("bastion/units/air_base", StructureProcessorLists.BASTION_GENERIC_DEGRADATION), 1)
|
||||
),
|
||||
StructurePool.Projection.RIGID
|
||||
@@ -203,7 +203,7 @@ public class FeatureGenerator
|
||||
new StructurePoolFeatureConfig(() -> new StructurePool(
|
||||
new Identifier("bastion/starts"),
|
||||
new Identifier("empty"),
|
||||
ImmutableList.of(
|
||||
List.of(
|
||||
Pair.of(StructurePoolElement.ofProcessedSingle("bastion/hoglin_stable/air_base", StructureProcessorLists.BASTION_GENERIC_DEGRADATION), 1)
|
||||
),
|
||||
StructurePool.Projection.RIGID
|
||||
@@ -215,7 +215,7 @@ public class FeatureGenerator
|
||||
new StructurePoolFeatureConfig(() -> new StructurePool(
|
||||
new Identifier("bastion/starts"),
|
||||
new Identifier("empty"),
|
||||
ImmutableList.of(
|
||||
List.of(
|
||||
Pair.of(StructurePoolElement.ofProcessedSingle("bastion/treasure/big_air_full", StructureProcessorLists.BASTION_GENERIC_DEGRADATION), 1)
|
||||
),
|
||||
StructurePool.Projection.RIGID
|
||||
@@ -227,7 +227,7 @@ public class FeatureGenerator
|
||||
new StructurePoolFeatureConfig(() -> new StructurePool(
|
||||
new Identifier("bastion/starts"),
|
||||
new Identifier("empty"),
|
||||
ImmutableList.of(
|
||||
List.of(
|
||||
Pair.of(StructurePoolElement.ofProcessedSingle("bastion/bridge/starting_pieces/entrance_base", StructureProcessorLists.BASTION_GENERIC_DEGRADATION), 1)
|
||||
),
|
||||
StructurePool.Projection.RIGID
|
||||
|
||||
@@ -5,8 +5,6 @@ import carpet.fakes.IngredientInterface;
|
||||
import carpet.fakes.RecipeManagerInterface;
|
||||
import carpet.utils.WoolTool;
|
||||
import carpet.utils.Messenger;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.Maps;
|
||||
import it.unimi.dsi.fastutil.objects.Object2LongLinkedOpenHashMap;
|
||||
import it.unimi.dsi.fastutil.objects.Object2LongMap;
|
||||
import net.minecraft.block.AbstractBannerBlock;
|
||||
@@ -42,6 +40,8 @@ import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static java.util.Map.entry;
|
||||
|
||||
/**
|
||||
* The actual object residing in each hopper counter which makes them count the items and saves them. There is one for each
|
||||
* colour in MC.
|
||||
@@ -67,7 +67,7 @@ public class HopperCounter
|
||||
{
|
||||
counterMap.put(color, new HopperCounter(color));
|
||||
}
|
||||
COUNTERS = Maps.immutableEnumMap(counterMap);
|
||||
COUNTERS = Collections.unmodifiableMap(counterMap);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -243,92 +243,91 @@ public class HopperCounter
|
||||
* Maps items that don't get a good block to reference for colour, or those that colour is wrong to a number of blocks, so we can get their colours easily with the
|
||||
* {@link Block#getDefaultMaterialColor()} method as these items have those same colours.
|
||||
*/
|
||||
private static final ImmutableMap<Item, Block> DEFAULTS = new ImmutableMap.Builder<Item, Block>()
|
||||
.put(Items.DANDELION, Blocks.YELLOW_WOOL)
|
||||
.put(Items.POPPY, Blocks.RED_WOOL)
|
||||
.put(Items.BLUE_ORCHID, Blocks.LIGHT_BLUE_WOOL)
|
||||
.put(Items.ALLIUM, Blocks.MAGENTA_WOOL)
|
||||
.put(Items.AZURE_BLUET, Blocks.SNOW_BLOCK)
|
||||
.put(Items.RED_TULIP, Blocks.RED_WOOL)
|
||||
.put(Items.ORANGE_TULIP, Blocks.ORANGE_WOOL)
|
||||
.put(Items.WHITE_TULIP, Blocks.SNOW_BLOCK)
|
||||
.put(Items.PINK_TULIP, Blocks.PINK_WOOL)
|
||||
.put(Items.OXEYE_DAISY, Blocks.SNOW_BLOCK)
|
||||
.put(Items.CORNFLOWER, Blocks.BLUE_WOOL)
|
||||
.put(Items.WITHER_ROSE, Blocks.BLACK_WOOL)
|
||||
.put(Items.LILY_OF_THE_VALLEY, Blocks.WHITE_WOOL)
|
||||
.put(Items.BROWN_MUSHROOM, Blocks.BROWN_MUSHROOM_BLOCK)
|
||||
.put(Items.RED_MUSHROOM, Blocks.RED_MUSHROOM_BLOCK)
|
||||
.put(Items.STICK, Blocks.OAK_PLANKS)
|
||||
.put(Items.GOLD_INGOT, Blocks.GOLD_BLOCK)
|
||||
.put(Items.IRON_INGOT, Blocks.IRON_BLOCK)
|
||||
.put(Items.DIAMOND, Blocks.DIAMOND_BLOCK)
|
||||
.put(Items.NETHERITE_INGOT, Blocks.NETHERITE_BLOCK)
|
||||
.put(Items.SUNFLOWER, Blocks.YELLOW_WOOL)
|
||||
.put(Items.LILAC, Blocks.MAGENTA_WOOL)
|
||||
.put(Items.ROSE_BUSH, Blocks.RED_WOOL)
|
||||
.put(Items.PEONY, Blocks.PINK_WOOL)
|
||||
.put(Items.CARROT, Blocks.ORANGE_WOOL)
|
||||
.put(Items.APPLE,Blocks.RED_WOOL)
|
||||
.put(Items.WHEAT,Blocks.HAY_BLOCK)
|
||||
.put(Items.PORKCHOP, Blocks.PINK_WOOL)
|
||||
.put(Items.RABBIT,Blocks.PINK_WOOL)
|
||||
.put(Items.CHICKEN,Blocks.WHITE_TERRACOTTA)
|
||||
.put(Items.BEEF,Blocks.NETHERRACK)
|
||||
.put(Items.ENCHANTED_GOLDEN_APPLE,Blocks.GOLD_BLOCK)
|
||||
.put(Items.COD,Blocks.WHITE_TERRACOTTA)
|
||||
.put(Items.SALMON,Blocks.ACACIA_PLANKS)
|
||||
.put(Items.ROTTEN_FLESH,Blocks.BROWN_WOOL)
|
||||
.put(Items.PUFFERFISH,Blocks.YELLOW_TERRACOTTA)
|
||||
.put(Items.TROPICAL_FISH,Blocks.ORANGE_WOOL)
|
||||
.put(Items.POTATO,Blocks.WHITE_TERRACOTTA)
|
||||
.put(Items.MUTTON, Blocks.RED_WOOL)
|
||||
.put(Items.BEETROOT,Blocks.NETHERRACK)
|
||||
.put(Items.MELON_SLICE,Blocks.MELON)
|
||||
.put(Items.POISONOUS_POTATO,Blocks.SLIME_BLOCK)
|
||||
.put(Items.SPIDER_EYE,Blocks.NETHERRACK)
|
||||
.put(Items.GUNPOWDER,Blocks.GRAY_WOOL)
|
||||
.put(Items.SCUTE,Blocks.LIME_WOOL)
|
||||
.put(Items.FEATHER,Blocks.WHITE_WOOL)
|
||||
.put(Items.FLINT,Blocks.BLACK_WOOL)
|
||||
.put(Items.LEATHER,Blocks.SPRUCE_PLANKS)
|
||||
.put(Items.GLOWSTONE_DUST,Blocks.GLOWSTONE)
|
||||
.put(Items.PAPER,Blocks.WHITE_WOOL)
|
||||
.put(Items.BRICK,Blocks.BRICKS)
|
||||
.put(Items.INK_SAC,Blocks.BLACK_WOOL)
|
||||
.put(Items.SNOWBALL,Blocks.SNOW_BLOCK)
|
||||
.put(Items.WATER_BUCKET,Blocks.WATER)
|
||||
.put(Items.LAVA_BUCKET,Blocks.LAVA)
|
||||
.put(Items.MILK_BUCKET,Blocks.WHITE_WOOL)
|
||||
.put(Items.CLAY_BALL, Blocks.CLAY)
|
||||
.put(Items.COCOA_BEANS,Blocks.COCOA)
|
||||
.put(Items.BONE,Blocks.BONE_BLOCK)
|
||||
.put(Items.COD_BUCKET,Blocks.BROWN_TERRACOTTA)
|
||||
.put(Items.PUFFERFISH_BUCKET,Blocks.YELLOW_TERRACOTTA)
|
||||
.put(Items.SALMON_BUCKET,Blocks.PINK_TERRACOTTA)
|
||||
.put(Items.TROPICAL_FISH_BUCKET,Blocks.ORANGE_TERRACOTTA)
|
||||
.put(Items.SUGAR,Blocks.WHITE_WOOL)
|
||||
.put(Items.BLAZE_POWDER,Blocks.GOLD_BLOCK)
|
||||
.put(Items.ENDER_PEARL,Blocks.WARPED_PLANKS)
|
||||
.put(Items.NETHER_STAR,Blocks.DIAMOND_BLOCK)
|
||||
.put(Items.PRISMARINE_CRYSTALS,Blocks.SEA_LANTERN)
|
||||
.put(Items.PRISMARINE_SHARD,Blocks.PRISMARINE)
|
||||
.put(Items.RABBIT_HIDE,Blocks.OAK_PLANKS)
|
||||
.put(Items.CHORUS_FRUIT,Blocks.PURPUR_BLOCK)
|
||||
.put(Items.SHULKER_SHELL,Blocks.SHULKER_BOX)
|
||||
.put(Items.NAUTILUS_SHELL,Blocks.BONE_BLOCK)
|
||||
.put(Items.HEART_OF_THE_SEA,Blocks.CONDUIT)
|
||||
.put(Items.HONEYCOMB,Blocks.HONEYCOMB_BLOCK)
|
||||
.put(Items.NAME_TAG,Blocks.BONE_BLOCK)
|
||||
.put(Items.TOTEM_OF_UNDYING,Blocks.YELLOW_TERRACOTTA)
|
||||
.put(Items.TRIDENT,Blocks.PRISMARINE)
|
||||
.put(Items.GHAST_TEAR,Blocks.WHITE_WOOL)
|
||||
.put(Items.PHANTOM_MEMBRANE,Blocks.BONE_BLOCK)
|
||||
.put(Items.EGG,Blocks.BONE_BLOCK)
|
||||
//.put(Items.,Blocks.)
|
||||
.put(Items.COPPER_INGOT,Blocks.COPPER_BLOCK)
|
||||
.put(Items.AMETHYST_SHARD, Blocks.AMETHYST_BLOCK)
|
||||
.build();
|
||||
private static final Map<Item, Block> DEFAULTS = Map.ofEntries(
|
||||
entry(Items.DANDELION, Blocks.YELLOW_WOOL),
|
||||
entry(Items.POPPY, Blocks.RED_WOOL),
|
||||
entry(Items.BLUE_ORCHID, Blocks.LIGHT_BLUE_WOOL),
|
||||
entry(Items.ALLIUM, Blocks.MAGENTA_WOOL),
|
||||
entry(Items.AZURE_BLUET, Blocks.SNOW_BLOCK),
|
||||
entry(Items.RED_TULIP, Blocks.RED_WOOL),
|
||||
entry(Items.ORANGE_TULIP, Blocks.ORANGE_WOOL),
|
||||
entry(Items.WHITE_TULIP, Blocks.SNOW_BLOCK),
|
||||
entry(Items.PINK_TULIP, Blocks.PINK_WOOL),
|
||||
entry(Items.OXEYE_DAISY, Blocks.SNOW_BLOCK),
|
||||
entry(Items.CORNFLOWER, Blocks.BLUE_WOOL),
|
||||
entry(Items.WITHER_ROSE, Blocks.BLACK_WOOL),
|
||||
entry(Items.LILY_OF_THE_VALLEY, Blocks.WHITE_WOOL),
|
||||
entry(Items.BROWN_MUSHROOM, Blocks.BROWN_MUSHROOM_BLOCK),
|
||||
entry(Items.RED_MUSHROOM, Blocks.RED_MUSHROOM_BLOCK),
|
||||
entry(Items.STICK, Blocks.OAK_PLANKS),
|
||||
entry(Items.GOLD_INGOT, Blocks.GOLD_BLOCK),
|
||||
entry(Items.IRON_INGOT, Blocks.IRON_BLOCK),
|
||||
entry(Items.DIAMOND, Blocks.DIAMOND_BLOCK),
|
||||
entry(Items.NETHERITE_INGOT, Blocks.NETHERITE_BLOCK),
|
||||
entry(Items.SUNFLOWER, Blocks.YELLOW_WOOL),
|
||||
entry(Items.LILAC, Blocks.MAGENTA_WOOL),
|
||||
entry(Items.ROSE_BUSH, Blocks.RED_WOOL),
|
||||
entry(Items.PEONY, Blocks.PINK_WOOL),
|
||||
entry(Items.CARROT, Blocks.ORANGE_WOOL),
|
||||
entry(Items.APPLE,Blocks.RED_WOOL),
|
||||
entry(Items.WHEAT,Blocks.HAY_BLOCK),
|
||||
entry(Items.PORKCHOP, Blocks.PINK_WOOL),
|
||||
entry(Items.RABBIT,Blocks.PINK_WOOL),
|
||||
entry(Items.CHICKEN,Blocks.WHITE_TERRACOTTA),
|
||||
entry(Items.BEEF,Blocks.NETHERRACK),
|
||||
entry(Items.ENCHANTED_GOLDEN_APPLE,Blocks.GOLD_BLOCK),
|
||||
entry(Items.COD,Blocks.WHITE_TERRACOTTA),
|
||||
entry(Items.SALMON,Blocks.ACACIA_PLANKS),
|
||||
entry(Items.ROTTEN_FLESH,Blocks.BROWN_WOOL),
|
||||
entry(Items.PUFFERFISH,Blocks.YELLOW_TERRACOTTA),
|
||||
entry(Items.TROPICAL_FISH,Blocks.ORANGE_WOOL),
|
||||
entry(Items.POTATO,Blocks.WHITE_TERRACOTTA),
|
||||
entry(Items.MUTTON, Blocks.RED_WOOL),
|
||||
entry(Items.BEETROOT,Blocks.NETHERRACK),
|
||||
entry(Items.MELON_SLICE,Blocks.MELON),
|
||||
entry(Items.POISONOUS_POTATO,Blocks.SLIME_BLOCK),
|
||||
entry(Items.SPIDER_EYE,Blocks.NETHERRACK),
|
||||
entry(Items.GUNPOWDER,Blocks.GRAY_WOOL),
|
||||
entry(Items.SCUTE,Blocks.LIME_WOOL),
|
||||
entry(Items.FEATHER,Blocks.WHITE_WOOL),
|
||||
entry(Items.FLINT,Blocks.BLACK_WOOL),
|
||||
entry(Items.LEATHER,Blocks.SPRUCE_PLANKS),
|
||||
entry(Items.GLOWSTONE_DUST,Blocks.GLOWSTONE),
|
||||
entry(Items.PAPER,Blocks.WHITE_WOOL),
|
||||
entry(Items.BRICK,Blocks.BRICKS),
|
||||
entry(Items.INK_SAC,Blocks.BLACK_WOOL),
|
||||
entry(Items.SNOWBALL,Blocks.SNOW_BLOCK),
|
||||
entry(Items.WATER_BUCKET,Blocks.WATER),
|
||||
entry(Items.LAVA_BUCKET,Blocks.LAVA),
|
||||
entry(Items.MILK_BUCKET,Blocks.WHITE_WOOL),
|
||||
entry(Items.CLAY_BALL, Blocks.CLAY),
|
||||
entry(Items.COCOA_BEANS,Blocks.COCOA),
|
||||
entry(Items.BONE,Blocks.BONE_BLOCK),
|
||||
entry(Items.COD_BUCKET,Blocks.BROWN_TERRACOTTA),
|
||||
entry(Items.PUFFERFISH_BUCKET,Blocks.YELLOW_TERRACOTTA),
|
||||
entry(Items.SALMON_BUCKET,Blocks.PINK_TERRACOTTA),
|
||||
entry(Items.TROPICAL_FISH_BUCKET,Blocks.ORANGE_TERRACOTTA),
|
||||
entry(Items.SUGAR,Blocks.WHITE_WOOL),
|
||||
entry(Items.BLAZE_POWDER,Blocks.GOLD_BLOCK),
|
||||
entry(Items.ENDER_PEARL,Blocks.WARPED_PLANKS),
|
||||
entry(Items.NETHER_STAR,Blocks.DIAMOND_BLOCK),
|
||||
entry(Items.PRISMARINE_CRYSTALS,Blocks.SEA_LANTERN),
|
||||
entry(Items.PRISMARINE_SHARD,Blocks.PRISMARINE),
|
||||
entry(Items.RABBIT_HIDE,Blocks.OAK_PLANKS),
|
||||
entry(Items.CHORUS_FRUIT,Blocks.PURPUR_BLOCK),
|
||||
entry(Items.SHULKER_SHELL,Blocks.SHULKER_BOX),
|
||||
entry(Items.NAUTILUS_SHELL,Blocks.BONE_BLOCK),
|
||||
entry(Items.HEART_OF_THE_SEA,Blocks.CONDUIT),
|
||||
entry(Items.HONEYCOMB,Blocks.HONEYCOMB_BLOCK),
|
||||
entry(Items.NAME_TAG,Blocks.BONE_BLOCK),
|
||||
entry(Items.TOTEM_OF_UNDYING,Blocks.YELLOW_TERRACOTTA),
|
||||
entry(Items.TRIDENT,Blocks.PRISMARINE),
|
||||
entry(Items.GHAST_TEAR,Blocks.WHITE_WOOL),
|
||||
entry(Items.PHANTOM_MEMBRANE,Blocks.BONE_BLOCK),
|
||||
entry(Items.EGG,Blocks.BONE_BLOCK),
|
||||
//entry(Items.,Blocks.),
|
||||
entry(Items.COPPER_INGOT,Blocks.COPPER_BLOCK),
|
||||
entry(Items.AMETHYST_SHARD, Blocks.AMETHYST_BLOCK));
|
||||
|
||||
/**
|
||||
* Gets the colour to print an item in when printing its count in a hopper counter.
|
||||
|
||||
Reference in new issue
Block a user