use of net.minecraft.resources.ResourceLocation in project Tropicraft by Tropicraft.
the class TropicraftRenderLayers method registerMain.
private static ModelLayerLocation registerMain(String id, Supplier<LayerDefinition> layerDefinition, EntityRenderersEvent.RegisterLayerDefinitions event) {
ModelLayerLocation modelLayer = new ModelLayerLocation(new ResourceLocation(Constants.MODID, id), "main");
event.registerLayerDefinition(modelLayer, layerDefinition);
return modelLayer;
}
use of net.minecraft.resources.ResourceLocation in project Tropicraft by Tropicraft.
the class TropicraftTrees method create.
private static AbstractTreeGrower create(String id) {
ResourceKey<ConfiguredFeature<?, ?>> key = ResourceKey.create(Registry.CONFIGURED_FEATURE_REGISTRY, new ResourceLocation(net.tropicraft.Constants.MODID, id));
return create((server, random, beehive) -> {
RegistryAccess registries = server.registryAccess();
Registry<ConfiguredFeature<?, ?>> features = registries.registryOrThrow(Registry.CONFIGURED_FEATURE_REGISTRY);
return features.get(key);
});
}
use of net.minecraft.resources.ResourceLocation in project Tropicraft by Tropicraft.
the class MapBiomesCommand method execute.
private static int execute(CommandSourceStack source) {
if (!source.getLevel().dimension().equals(TropicraftDimension.WORLD)) {
source.sendFailure(new TextComponent("Can't execute this in non-tropicraft world!"));
}
BufferedImage img = new BufferedImage(SIZE, SIZE, BufferedImage.TYPE_INT_RGB);
Optional<? extends Registry<Biome>> biomes = source.getLevel().registryAccess().registry(Registry.BIOME_REGISTRY);
if (biomes.isPresent()) {
for (int x = -SIZE2; x < SIZE2; x++) {
if (x % SIZE8 == 0) {
source.sendSuccess(new TextComponent(((x + SIZE2) / (double) SIZE) * 100 + "%"), false);
}
for (int z = -SIZE2; z < SIZE2; z++) {
Biome biome = source.getLevel().getUncachedNoiseBiome(x, 0, z);
ResourceLocation name = biomes.get().getKey(biome);
img.setRGB(x + SIZE2, z + SIZE2, COLORS.getOrDefault(name, 0xFFFFFF));
}
}
} else {
source.sendFailure(new TextComponent("Biomes Registry was null!"));
}
Path p = Paths.get("biome_colors.png");
try {
ImageIO.write(img, "png", p.toAbsolutePath().toFile());
source.sendSuccess(new TextComponent("Mapped biome colors!"), false);
} catch (IOException e) {
source.sendFailure(new TextComponent("Something went wrong, check the log!"));
e.printStackTrace();
}
return 0;
}
use of net.minecraft.resources.ResourceLocation in project Tropicraft by Tropicraft.
the class TropicraftRecipeProvider method buildCraftingRecipes.
@Override
protected void buildCraftingRecipes(Consumer<FinishedRecipe> consumer) {
ore(TropicraftTags.Items.AZURITE_ORE, AZURITE, 0.3F, consumer);
ore(TropicraftTags.Items.EUDIALYTE_ORE, EUDIALYTE, 0.5F, consumer);
ore(TropicraftTags.Items.ZIRCON_ORE, ZIRCON, 0.5F, consumer);
ore(TropicraftTags.Items.MANGANESE_ORE, MANGANESE, 0.5F, consumer);
ore(TropicraftTags.Items.SHAKA_ORE, SHAKA, 0.7F, consumer);
storage(AZURITE, AZURITE_BLOCK, consumer);
storage(EUDIALYTE, EUDIALYTE_BLOCK, consumer);
storage(ZIRCON, ZIRCON_BLOCK, consumer);
storage(ZIRCONIUM, ZIRCONIUM_BLOCK, consumer);
storage(MANGANESE, MANGANESE_BLOCK, consumer);
storage(SHAKA, SHAKA_BLOCK, consumer);
pickaxe(ZIRCON, ZIRCON_PICKAXE, consumer);
pickaxe(ZIRCONIUM, ZIRCONIUM_PICKAXE, consumer);
pickaxe(EUDIALYTE, EUDIALYTE_PICKAXE, consumer);
axe(ZIRCON, ZIRCON_AXE, consumer);
axe(ZIRCONIUM, ZIRCONIUM_AXE, consumer);
axe(EUDIALYTE, EUDIALYTE_AXE, consumer);
shovel(ZIRCON, ZIRCON_SHOVEL, consumer);
shovel(ZIRCONIUM, ZIRCONIUM_SHOVEL, consumer);
shovel(EUDIALYTE, EUDIALYTE_SHOVEL, consumer);
hoe(ZIRCON, ZIRCON_HOE, consumer);
hoe(ZIRCONIUM, ZIRCONIUM_HOE, consumer);
hoe(EUDIALYTE, EUDIALYTE_HOE, consumer);
sword(ZIRCON, ZIRCON_SWORD, consumer);
sword(ZIRCONIUM, ZIRCONIUM_SWORD, consumer);
sword(EUDIALYTE, EUDIALYTE_SWORD, consumer);
helmet(SCALE, SCALE_HELMET, consumer);
chestplate(SCALE, SCALE_CHESTPLATE, consumer);
leggings(SCALE, SCALE_LEGGINGS, consumer);
boots(SCALE, SCALE_BOOTS, consumer);
for (DyeColor color : DyeColor.values()) {
ItemLike wool = Sheep.ITEM_BY_DYE.get(color);
ShapedRecipeBuilder.shaped(UMBRELLAS.get(color).get()).pattern("WWW").pattern(" B ").pattern(" B ").group(Constants.MODID + ":umbrellas").define('W', wool).define('B', BAMBOO_STICK.get()).unlockedBy("has_" + color.getSerializedName() + "_wool", has(wool)).save(consumer);
ShapedRecipeBuilder.shaped(CHAIRS.get(color).get()).pattern("BWB").pattern("BWB").pattern("BWB").group(Constants.MODID + ":chairs").define('W', wool).define('B', BAMBOO_STICK.get()).unlockedBy("has_" + color.getSerializedName() + "_wool", has(wool)).save(consumer);
ShapedRecipeBuilder.shaped(BEACH_FLOATS.get(color).get()).pattern("WWW").pattern("BBB").group(Constants.MODID + ":beach_floats").define('W', wool).define('B', Blocks.BAMBOO).unlockedBy("has_" + color.getSerializedName() + "_wool", has(wool)).save(consumer);
// TODO other colored items
}
// Override the vanilla recipe to output ours, it's tagged so it will behave the same
ShapedRecipeBuilder.shaped(BAMBOO_STICK.get()).pattern("X").pattern("X").define('X', Items.BAMBOO).unlockedBy("has_bamboo", has(Items.BAMBOO)).save(consumer, new ResourceLocation("stick_from_bamboo_item"));
ShapedRecipeBuilder.shaped(BAMBOO_SPEAR.get()).pattern("X ").pattern(" X").define('X', BAMBOO_STICK.get()).unlockedBy("has_bamboo_stick", has(BAMBOO_STICK.get())).save(consumer);
ShapelessRecipeBuilder.shapeless(RAW_COFFEE_BEAN.get()).requires(COFFEE_BERRY.get()).unlockedBy("has_coffee_bean", has(COFFEE_BERRY.get())).save(consumer);
ShapelessRecipeBuilder.shapeless(ZIRCONIUM.get()).requires(AZURITE.get(), 2).requires(ZIRCON.get(), 2).unlockedBy("has_zircon", has(ZIRCON.get())).unlockedBy("has_azurite", has(AZURITE.get())).save(consumer);
food(RAW_COFFEE_BEAN, ROASTED_COFFEE_BEAN, 0.1F, consumer);
ShapedRecipeBuilder.shaped(BAMBOO_MUG.get()).pattern("X X").pattern("X X").pattern("XXX").define('X', Items.BAMBOO).unlockedBy("has_bamboo", has(Items.BAMBOO)).save(consumer);
food(Items.SEAGRASS.delegate, TOASTED_NORI, 0.1F, consumer);
food(FRESH_MARLIN, SEARED_MARLIN, 0.15F, consumer);
food(RAW_RAY, COOKED_RAY, 0.15F, consumer);
food(FROG_LEG, COOKED_FROG_LEG, 0.1F, consumer);
food(RAW_FISH, COOKED_FISH, 0.1F, consumer);
// Flowers to dye
dye(COMMELINA_DIFFUSA, Items.LIGHT_BLUE_DYE.delegate, 1, 2, consumer);
dye(CANNA, Items.YELLOW_DYE.delegate, 1, 2, consumer);
dye(ORANGE_ANTHURIUM, Items.ORANGE_DYE.delegate, 1, 2, consumer);
dye(RED_ANTHURIUM, Items.RED_DYE.delegate, 1, 2, consumer);
dye(DRACAENA, Items.GREEN_DYE.delegate, 1, 2, consumer);
dye(IRIS, Items.PURPLE_DYE.delegate, 1, 4, consumer);
// Bundles
singleItem(Blocks.BAMBOO.delegate, BAMBOO_BUNDLE, 9, 1, consumer);
singleItem(Blocks.SUGAR_CANE.delegate, THATCH_BUNDLE, 9, 1, consumer);
// Planks
planks(MAHOGANY_LOG, MAHOGANY_PLANKS, consumer);
planks(PALM_LOG, PALM_PLANKS, consumer);
bark(MAHOGANY_LOG, MAHOGANY_WOOD, consumer);
bark(PALM_LOG, PALM_WOOD, consumer);
// Papaya log -> Jungle log
ShapelessRecipeBuilder.shapeless(Blocks.JUNGLE_LOG).requires(PAPAYA_LOG.get()).unlockedBy("has_papaya_log", has(PAPAYA_LOG.get())).save(consumer);
bark(PAPAYA_LOG, PAPAYA_WOOD, consumer);
bark(RED_MANGROVE_LOG, RED_MANGROVE_WOOD, consumer);
bark(LIGHT_MANGROVE_LOG, LIGHT_MANGROVE_WOOD, consumer);
bark(BLACK_MANGROVE_LOG, BLACK_MANGROVE_WOOD, consumer);
bark(STRIPPED_MANGROVE_LOG, STRIPPED_MANGROVE_WOOD, consumer);
// Stairs
stairs(PALM_PLANKS, PALM_STAIRS, "wooden_stairs", false, consumer);
stairs(MAHOGANY_PLANKS, MAHOGANY_STAIRS, "wooden_stairs", false, consumer);
stairs(MANGROVE_PLANKS, MANGROVE_STAIRS, "wooden_stairs", false, consumer);
stairs(THATCH_BUNDLE, THATCH_STAIRS, null, false, consumer);
stairs(BAMBOO_BUNDLE, BAMBOO_STAIRS, null, false, consumer);
stairs(CHUNK, CHUNK_STAIRS, null, true, consumer);
ShapedRecipeBuilder.shaped(THATCH_STAIRS_FUZZY.get(), 4).pattern("C ").pattern("XC ").pattern("XXC").define('X', THATCH_BUNDLE.get()).define('C', Items.SUGAR_CANE).unlockedBy("has_thatch_bundle", has(THATCH_BUNDLE.get())).save(consumer);
// Slabs
slab(PALM_PLANKS, PALM_SLAB, "wooden_slab", false, consumer);
slab(MAHOGANY_PLANKS, MAHOGANY_SLAB, "wooden_slab", false, consumer);
slab(MANGROVE_PLANKS, MANGROVE_SLAB, "wooden_slab", false, consumer);
slab(THATCH_BUNDLE, THATCH_SLAB, null, false, consumer);
slab(BAMBOO_BUNDLE, BAMBOO_SLAB, null, false, consumer);
slab(CHUNK, CHUNK_SLAB, null, true, consumer);
// Fences
fence(PALM_PLANKS, PALM_FENCE, "wooden_fence", consumer);
fence(MAHOGANY_PLANKS, MAHOGANY_FENCE, "wooden_fence", consumer);
fence(MANGROVE_PLANKS, MANGROVE_FENCE, "wooden_fence", consumer);
fence(THATCH_BUNDLE, THATCH_FENCE, null, consumer);
fence(BAMBOO_BUNDLE, BAMBOO_FENCE, null, consumer);
fence(CHUNK, CHUNK_FENCE, null, consumer);
// Fence Gates
fenceGate(PALM_PLANKS, PALM_FENCE_GATE, "wooden_fence_gate", consumer);
fenceGate(MAHOGANY_PLANKS, MAHOGANY_FENCE_GATE, "wooden_fence_gate", consumer);
fenceGate(MANGROVE_PLANKS, MANGROVE_FENCE_GATE, "wooden_fence_gate", consumer);
fenceGate(THATCH_BUNDLE, THATCH_FENCE_GATE, null, consumer);
fenceGate(BAMBOO_BUNDLE, BAMBOO_FENCE_GATE, null, consumer);
fenceGate(CHUNK, CHUNK_FENCE_GATE, null, consumer);
// Walls
wall(CHUNK, CHUNK_WALL, consumer);
// Doors
door(PALM_PLANKS, PALM_DOOR, "wooden_door", consumer);
door(MAHOGANY_PLANKS, MAHOGANY_DOOR, "wooden_door", consumer);
door(MANGROVE_PLANKS, MANGROVE_DOOR, "wooden_door", consumer);
door(THATCH_BUNDLE, THATCH_DOOR, null, consumer);
door(BAMBOO_BUNDLE, BAMBOO_DOOR, null, consumer);
// Trap doors
trapDoor(PALM_PLANKS, PALM_TRAPDOOR, "wooden_trapdoor", consumer);
trapDoor(MAHOGANY_PLANKS, MAHOGANY_TRAPDOOR, "wooden_trapdoor", consumer);
trapDoor(MANGROVE_PLANKS, MANGROVE_TRAPDOOR, "wooden_trapdoor", consumer);
trapDoor(THATCH_BUNDLE, THATCH_TRAPDOOR, null, consumer);
trapDoor(BAMBOO_BUNDLE, BAMBOO_TRAPDOOR, null, consumer);
// Bongos
bongo(IGUANA_LEATHER, MAHOGANY_PLANKS, 1, SMALL_BONGO_DRUM, consumer);
bongo(IGUANA_LEATHER, MAHOGANY_PLANKS, 2, MEDIUM_BONGO_DRUM, consumer);
bongo(IGUANA_LEATHER, MAHOGANY_PLANKS, 3, LARGE_BONGO_DRUM, consumer);
// Scuba gear
goggles(PINK_SCUBA_GOGGLES, Items.PINK_DYE.delegate, consumer);
goggles(YELLOW_SCUBA_GOGGLES, Items.YELLOW_DYE.delegate, consumer);
flippers(PINK_SCUBA_FLIPPERS, Items.PINK_DYE.delegate, consumer);
flippers(YELLOW_SCUBA_FLIPPERS, Items.YELLOW_DYE.delegate, consumer);
harness(PINK_SCUBA_HARNESS, Items.PINK_DYE.delegate, consumer);
harness(YELLOW_SCUBA_HARNESS, Items.YELLOW_DYE.delegate, consumer);
ponyBottle(PINK_PONY_BOTTLE, Items.PINK_DYE.delegate, consumer);
ponyBottle(YELLOW_PONY_BOTTLE, Items.YELLOW_DYE.delegate, consumer);
ShapedRecipeBuilder.shaped(WATER_WAND.get(), 1).pattern(" X").pattern(" Y ").pattern("Y ").define('X', AZURITE.get()).define('Y', Items.GOLD_INGOT).unlockedBy("has_" + safeName(AZURITE.get()), has(AZURITE.get())).unlockedBy("has_gold_ingot", has(Items.GOLD_INGOT)).save(consumer);
ShapedRecipeBuilder.shaped(BAMBOO_ITEM_FRAME.get(), 1).pattern("XXX").pattern("XYX").pattern("XXX").define('X', Items.BAMBOO).define('Y', Items.LEATHER).unlockedBy("has_bamboo", has(Items.BAMBOO)).unlockedBy("has_leather", has(Items.LEATHER)).save(consumer);
ShapedRecipeBuilder.shaped(AIR_COMPRESSOR.get(), 1).pattern("XXX").pattern("XYX").pattern("XXX").define('X', CHUNK.get()).define('Y', AZURITE.get()).unlockedBy("has_" + safeName(CHUNK.get()), has(CHUNK.get())).unlockedBy("has_" + safeName(AZURITE.get()), has(AZURITE.get())).save(consumer);
ShapedRecipeBuilder.shaped(BAMBOO_LADDER.get(), 4).pattern("S S").pattern("BSB").pattern("S S").define('S', BAMBOO_STICK.get()).define('B', Items.BAMBOO).unlockedBy("has_bamboo", has(Items.BAMBOO)).save(consumer);
boardwalk(BAMBOO_SLAB, BAMBOO_BOARDWALK, consumer);
boardwalk(PALM_SLAB, PALM_BOARDWALK, consumer);
boardwalk(MAHOGANY_SLAB, MAHOGANY_BOARDWALK, consumer);
boardwalk(MANGROVE_SLAB, MANGROVE_BOARDWALK, consumer);
ShapedRecipeBuilder.shaped(BAMBOO_CHEST.get()).pattern("BBB").pattern("B B").pattern("BBB").define('B', Items.BAMBOO).unlockedBy("has_bamboo", has(Items.BAMBOO)).save(consumer);
ShapedRecipeBuilder.shaped(SIFTER.get()).pattern("XXX").pattern("XIX").pattern("XXX").define('X', ItemTags.PLANKS).define('I', Tags.Items.GLASS).group("tropicraft:sifter").unlockedBy("has_glass", has(Tags.Items.GLASS)).save(consumer);
ShapedRecipeBuilder.shaped(SIFTER.get()).pattern("XXX").pattern("XIX").pattern("XXX").define('X', ItemTags.PLANKS).define('I', Tags.Items.GLASS_PANES).group("tropicraft:sifter").unlockedBy("has_glass_pane", has(Tags.Items.GLASS_PANES)).save(consumer, new ResourceLocation(Constants.MODID, "sifter_with_glass_pane"));
ShapedRecipeBuilder.shaped(DRINK_MIXER.get()).pattern("XXX").pattern("XYX").pattern("XXX").define('X', CHUNK.get()).define('Y', BAMBOO_MUG.get()).unlockedBy("has_bamboo_mug", has(BAMBOO_MUG.get())).save(consumer);
ShapedRecipeBuilder.shaped(TIKI_TORCH.get()).pattern("Y").pattern("X").pattern("X").define('X', BAMBOO_STICK.get()).define('Y', ItemTags.COALS).unlockedBy("has_bamboo_stick", has(BAMBOO_STICK.get())).save(consumer);
ShapedRecipeBuilder.shaped(BAMBOO_FLOWER_POT.get()).pattern("# #").pattern(" # ").define('#', Items.BAMBOO).unlockedBy("has_bamboo", has(Items.BAMBOO)).save(consumer);
ShapelessRecipeBuilder.shapeless(COCKTAILS.get(Drink.PINA_COLADA).get()).requires(BAMBOO_MUG.get()).requires(COCONUT_CHUNK.get()).requires(PINEAPPLE_CUBES.get()).unlockedBy("has_bamboo_mug", has(BAMBOO_MUG.get())).save(consumer);
ShapelessRecipeBuilder.shapeless(TROPICAL_FERTILIZER.get()).requires(TropicraftFlower.MAGIC_MUSHROOM.get()).requires(TropicraftFlower.CROTON.get()).unlockedBy("has_magic_mushroom", has(TropicraftFlower.MAGIC_MUSHROOM.get())).save(consumer);
ShapedRecipeBuilder.shaped(DAGGER.get()).pattern("X").pattern("I").define('X', CHUNK.get()).define('I', BAMBOO_STICK.get()).unlockedBy("has_" + safeName(CHUNK.get()), has(CHUNK.get())).unlockedBy("has_bamboo", has(Items.BAMBOO)).save(consumer);
ShapedRecipeBuilder.shaped(BLOW_GUN.get()).pattern("X ").pattern(" I ").pattern(" X").define('X', BAMBOO_STICK.get()).define('I', ZIRCON.get()).unlockedBy("has_" + safeName(ZIRCON.get()), has(ZIRCON.get())).unlockedBy("has_" + safeName(BAMBOO_STICK.get()), has(BAMBOO_STICK.get())).save(consumer);
}
use of net.minecraft.resources.ResourceLocation in project Tropicraft by Tropicraft.
the class EntityKoaBase method readAdditionalSaveData.
@Override
public void readAdditionalSaveData(CompoundTag compound) {
super.readAdditionalSaveData(compound);
if (compound.contains("home_X")) {
this.restrictTo(new BlockPos(compound.getInt("home_X"), compound.getInt("home_Y"), compound.getInt("home_Z")), MAX_HOME_DISTANCE);
}
if (compound.contains("fireplace_X")) {
this.setFirelacePos(new BlockPos(compound.getInt("fireplace_X"), compound.getInt("fireplace_Y"), compound.getInt("fireplace_Z")));
}
lastTimeFished = compound.getLong("lastTimeFished");
if (compound.contains("koa_inventory", 9)) {
ListTag nbttaglist = compound.getList("koa_inventory", 10);
for (int i = 0; i < nbttaglist.size(); ++i) {
CompoundTag nbttagcompound = nbttaglist.getCompound(i);
int j = nbttagcompound.getByte("Slot") & 255;
this.inventory.setItem(j, ItemStack.of(nbttagcompound));
}
}
this.villageID = compound.getInt("village_id");
// backwards compat
if (!compound.contains("village_dimension")) {
this.villageDimension = level.dimension();
} else {
this.villageDimension = ResourceKey.create(Registry.DIMENSION_REGISTRY, new ResourceLocation(compound.getString("village_dim_id")));
}
if (compound.contains("role_id")) {
this.getEntityData().set(ROLE, compound.getInt("role_id"));
} else {
rollDiceRole();
}
if (compound.contains("gender_id")) {
this.getEntityData().set(GENDER, compound.getInt("gender_id"));
} else {
rollDiceGender();
}
this.lastTradeTime = compound.getLong("lastTradeTime");
for (int i = 0; i < MAX_DRUMS; i++) {
if (compound.contains("drum_" + i + "_X")) {
this.listPosDrums.add(new BlockPos(compound.getInt("drum_" + i + "_X"), compound.getInt("drum_" + i + "_Y"), compound.getInt("drum_" + i + "_Z")));
}
}
druggedTime = compound.getInt("druggedTime");
updateUniqueEntityAI();
}
Aggregations