Flower pot plant overriding
This commit is contained in:
parent
5341daf326
commit
01238800ed
9 changed files with 59 additions and 28 deletions
|
@ -18,6 +18,8 @@ import net.minecraft.client.resources.model.UnbakedModel;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.core.Registry;
|
import net.minecraft.core.Registry;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
|
import net.minecraft.server.packs.PackResources;
|
||||||
|
import net.minecraft.server.packs.PackType;
|
||||||
import net.minecraft.sounds.SoundEvents;
|
import net.minecraft.sounds.SoundEvents;
|
||||||
import net.minecraft.sounds.SoundSource;
|
import net.minecraft.sounds.SoundSource;
|
||||||
import net.minecraft.world.InteractionHand;
|
import net.minecraft.world.InteractionHand;
|
||||||
|
@ -58,6 +60,8 @@ import ru.betterend.interfaces.PottablePlant;
|
||||||
import ru.betterend.registry.EndBlocks;
|
import ru.betterend.registry.EndBlocks;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -65,6 +69,7 @@ import java.util.Map;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.SplittableRandom;
|
import java.util.SplittableRandom;
|
||||||
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
public class FlowerPotBlock extends BaseBlockNotFull implements IRenderTyped, IPostInit {
|
public class FlowerPotBlock extends BaseBlockNotFull implements IRenderTyped, IPostInit {
|
||||||
private static final IntegerProperty PLANT_ID = EndBlockProperties.PLANT_ID;
|
private static final IntegerProperty PLANT_ID = EndBlockProperties.PLANT_ID;
|
||||||
|
@ -243,12 +248,6 @@ public class FlowerPotBlock extends BaseBlockNotFull implements IRenderTyped, IP
|
||||||
@Override
|
@Override
|
||||||
@Environment(EnvType.CLIENT)
|
@Environment(EnvType.CLIENT)
|
||||||
public UnbakedModel getModelVariant(ResourceLocation stateId, BlockState blockState, Map<ResourceLocation, UnbakedModel> modelCache) {
|
public UnbakedModel getModelVariant(ResourceLocation stateId, BlockState blockState, Map<ResourceLocation, UnbakedModel> modelCache) {
|
||||||
ModelResourceLocation key = new ModelResourceLocation(stateId.getNamespace(), stateId.getPath(), "plant_age=0");
|
|
||||||
|
|
||||||
if (modelCache.containsKey(key)) {
|
|
||||||
return modelCache.get(key);
|
|
||||||
}
|
|
||||||
|
|
||||||
MultiPartBuilder model = MultiPartBuilder.create(stateDefinition);
|
MultiPartBuilder model = MultiPartBuilder.create(stateDefinition);
|
||||||
model.part(new ModelResourceLocation(stateId.getNamespace(), stateId.getPath(), "inventory")).add();
|
model.part(new ModelResourceLocation(stateId.getNamespace(), stateId.getPath(), "inventory")).add();
|
||||||
Transformation offset = new Transformation(new Vector3f(0, 7.5F / 16F, 0), null, null, null);
|
Transformation offset = new Transformation(new Vector3f(0, 7.5F / 16F, 0), null, null, null);
|
||||||
|
@ -260,9 +259,10 @@ public class FlowerPotBlock extends BaseBlockNotFull implements IRenderTyped, IP
|
||||||
|
|
||||||
final int compareID = i + 1;
|
final int compareID = i + 1;
|
||||||
ResourceLocation modelPath = Registry.BLOCK.getKey(plants[i]);
|
ResourceLocation modelPath = Registry.BLOCK.getKey(plants[i]);
|
||||||
ResourceLocation objSource = new ResourceLocation(modelPath.getNamespace(), "block/potted_" + modelPath.getPath() + ".json");
|
ResourceLocation objSource = new ResourceLocation(modelPath.getNamespace(), "models/block/" + modelPath.getPath() + "_potted.json");
|
||||||
|
|
||||||
if (Minecraft.getInstance().getResourceManager().hasResource(objSource)) {
|
if (Minecraft.getInstance().getResourceManager().hasResource(objSource)) {
|
||||||
objSource = new ResourceLocation(modelPath.getNamespace(), "block/potted_" + modelPath.getPath());
|
objSource = new ResourceLocation(modelPath.getNamespace(), "block/" + modelPath.getPath() + "_potted");
|
||||||
model.part(objSource).setTransformation(offset).setCondition(state -> state.getValue(PLANT_ID) == compareID).add();
|
model.part(objSource).setTransformation(offset).setCondition(state -> state.getValue(PLANT_ID) == compareID).add();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -335,7 +335,7 @@ public class FlowerPotBlock extends BaseBlockNotFull implements IRenderTyped, IP
|
||||||
}
|
}
|
||||||
|
|
||||||
UnbakedModel result = model.build();
|
UnbakedModel result = model.build();
|
||||||
modelCache.put(key, result);
|
modelCache.put(stateId, result);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,14 +36,14 @@ public class StoneMaterial {
|
||||||
public final Block slab;
|
public final Block slab;
|
||||||
public final Block wall;
|
public final Block wall;
|
||||||
public final Block button;
|
public final Block button;
|
||||||
public final Block pressure_plate;
|
public final Block pressurePlate;
|
||||||
public final Block pedestal;
|
public final Block pedestal;
|
||||||
public final Block lantern;
|
public final Block lantern;
|
||||||
|
|
||||||
public final Block bricks;
|
public final Block bricks;
|
||||||
public final Block brick_stairs;
|
public final Block brickStairs;
|
||||||
public final Block brick_slab;
|
public final Block brickSlab;
|
||||||
public final Block brick_wall;
|
public final Block brickWall;
|
||||||
public final Block furnace;
|
public final Block furnace;
|
||||||
public final Block flowerPot;
|
public final Block flowerPot;
|
||||||
|
|
||||||
|
@ -58,14 +58,14 @@ public class StoneMaterial {
|
||||||
slab = EndBlocks.registerBlock(name + "_slab", new BaseSlabBlock(stone));
|
slab = EndBlocks.registerBlock(name + "_slab", new BaseSlabBlock(stone));
|
||||||
wall = EndBlocks.registerBlock(name + "_wall", new BaseWallBlock(stone));
|
wall = EndBlocks.registerBlock(name + "_wall", new BaseWallBlock(stone));
|
||||||
button = EndBlocks.registerBlock(name + "_button", new BaseStoneButtonBlock(stone));
|
button = EndBlocks.registerBlock(name + "_button", new BaseStoneButtonBlock(stone));
|
||||||
pressure_plate = EndBlocks.registerBlock(name + "_plate", new StonePressurePlateBlock(stone));
|
pressurePlate = EndBlocks.registerBlock(name + "_plate", new StonePressurePlateBlock(stone));
|
||||||
pedestal = EndBlocks.registerBlock(name + "_pedestal", new EndPedestal(stone));
|
pedestal = EndBlocks.registerBlock(name + "_pedestal", new EndPedestal(stone));
|
||||||
lantern = EndBlocks.registerBlock(name + "_lantern", new StoneLanternBlock(stone));
|
lantern = EndBlocks.registerBlock(name + "_lantern", new StoneLanternBlock(stone));
|
||||||
|
|
||||||
bricks = EndBlocks.registerBlock(name + "_bricks", new BaseBlock(material));
|
bricks = EndBlocks.registerBlock(name + "_bricks", new BaseBlock(material));
|
||||||
brick_stairs = EndBlocks.registerBlock(name + "_bricks_stairs", new BaseStairsBlock(bricks));
|
brickStairs = EndBlocks.registerBlock(name + "_bricks_stairs", new BaseStairsBlock(bricks));
|
||||||
brick_slab = EndBlocks.registerBlock(name + "_bricks_slab", new BaseSlabBlock(bricks));
|
brickSlab = EndBlocks.registerBlock(name + "_bricks_slab", new BaseSlabBlock(bricks));
|
||||||
brick_wall = EndBlocks.registerBlock(name + "_bricks_wall", new BaseWallBlock(bricks));
|
brickWall = EndBlocks.registerBlock(name + "_bricks_wall", new BaseWallBlock(bricks));
|
||||||
furnace = EndBlocks.registerBlock(name + "_furnace", new BaseFurnaceBlock(bricks));
|
furnace = EndBlocks.registerBlock(name + "_furnace", new BaseFurnaceBlock(bricks));
|
||||||
flowerPot = EndBlocks.registerBlock(name + "_flower_pot", new FlowerPotBlock(bricks));
|
flowerPot = EndBlocks.registerBlock(name + "_flower_pot", new FlowerPotBlock(bricks));
|
||||||
|
|
||||||
|
@ -77,21 +77,22 @@ public class StoneMaterial {
|
||||||
|
|
||||||
GridRecipe.make(BetterEnd.MOD_ID, name + "_stairs", stairs).checkConfig(Configs.RECIPE_CONFIG).setOutputCount(4).setShape("# ", "## ", "###").addMaterial('#', stone).setGroup("end_stone_stairs").build();
|
GridRecipe.make(BetterEnd.MOD_ID, name + "_stairs", stairs).checkConfig(Configs.RECIPE_CONFIG).setOutputCount(4).setShape("# ", "## ", "###").addMaterial('#', stone).setGroup("end_stone_stairs").build();
|
||||||
GridRecipe.make(BetterEnd.MOD_ID, name + "_slab", slab).checkConfig(Configs.RECIPE_CONFIG).setOutputCount(6).setShape("###").addMaterial('#', stone).setGroup("end_stone_slabs").build();
|
GridRecipe.make(BetterEnd.MOD_ID, name + "_slab", slab).checkConfig(Configs.RECIPE_CONFIG).setOutputCount(6).setShape("###").addMaterial('#', stone).setGroup("end_stone_slabs").build();
|
||||||
GridRecipe.make(BetterEnd.MOD_ID, name + "_bricks_stairs", brick_stairs).checkConfig(Configs.RECIPE_CONFIG).setOutputCount(4).setShape("# ", "## ", "###").addMaterial('#', bricks).setGroup("end_stone_stairs").build();
|
GridRecipe.make(BetterEnd.MOD_ID, name + "_bricks_stairs", brickStairs).checkConfig(Configs.RECIPE_CONFIG).setOutputCount(4).setShape("# ", "## ", "###").addMaterial('#', bricks).setGroup("end_stone_stairs").build();
|
||||||
GridRecipe.make(BetterEnd.MOD_ID, name + "_bricks_slab", brick_slab).checkConfig(Configs.RECIPE_CONFIG).setOutputCount(6).setShape("###").addMaterial('#', bricks).setGroup("end_stone_slabs").build();
|
GridRecipe.make(BetterEnd.MOD_ID, name + "_bricks_slab", brickSlab).checkConfig(Configs.RECIPE_CONFIG).setOutputCount(6).setShape("###").addMaterial('#', bricks).setGroup("end_stone_slabs").build();
|
||||||
|
|
||||||
GridRecipe.make(BetterEnd.MOD_ID, name + "_wall", wall).checkConfig(Configs.RECIPE_CONFIG).setOutputCount(6).setShape("###", "###").addMaterial('#', stone).setGroup("end_wall").build();
|
GridRecipe.make(BetterEnd.MOD_ID, name + "_wall", wall).checkConfig(Configs.RECIPE_CONFIG).setOutputCount(6).setShape("###", "###").addMaterial('#', stone).setGroup("end_wall").build();
|
||||||
GridRecipe.make(BetterEnd.MOD_ID, name + "_bricks_wall", brick_wall).checkConfig(Configs.RECIPE_CONFIG).setOutputCount(6).setShape("###", "###").addMaterial('#', bricks).setGroup("end_wall").build();
|
GridRecipe.make(BetterEnd.MOD_ID, name + "_bricks_wall", brickWall).checkConfig(Configs.RECIPE_CONFIG).setOutputCount(6).setShape("###", "###").addMaterial('#', bricks).setGroup("end_wall").build();
|
||||||
|
|
||||||
GridRecipe.make(BetterEnd.MOD_ID, name + "_button", button).checkConfig(Configs.RECIPE_CONFIG).setList("#").addMaterial('#', stone).setGroup("end_stone_buttons").build();
|
GridRecipe.make(BetterEnd.MOD_ID, name + "_button", button).checkConfig(Configs.RECIPE_CONFIG).setList("#").addMaterial('#', stone).setGroup("end_stone_buttons").build();
|
||||||
GridRecipe.make(BetterEnd.MOD_ID, name + "_pressure_plate", pressure_plate).checkConfig(Configs.RECIPE_CONFIG).setShape("##").addMaterial('#', stone).setGroup("end_stone_plates").build();
|
GridRecipe.make(BetterEnd.MOD_ID, name + "_pressure_plate", pressurePlate).checkConfig(Configs.RECIPE_CONFIG).setShape("##").addMaterial('#', stone).setGroup("end_stone_plates").build();
|
||||||
GridRecipe.make(BetterEnd.MOD_ID, name + "_lantern", lantern).checkConfig(Configs.RECIPE_CONFIG).setShape("S", "#", "S").addMaterial('#', EndItems.CRYSTAL_SHARDS).addMaterial('S', slab, brick_slab).setGroup("end_stone_lanterns").build();
|
GridRecipe.make(BetterEnd.MOD_ID, name + "_lantern", lantern).checkConfig(Configs.RECIPE_CONFIG).setShape("S", "#", "S").addMaterial('#', EndItems.CRYSTAL_SHARDS).addMaterial('S', slab, brickSlab).setGroup("end_stone_lanterns").build();
|
||||||
GridRecipe.make(BetterEnd.MOD_ID, name + "_furnace", furnace).checkConfig(Configs.RECIPE_CONFIG).setShape("###", "# #", "###").addMaterial('#', stone).setGroup("end_stone_furnaces").build();
|
GridRecipe.make(BetterEnd.MOD_ID, name + "_furnace", furnace).checkConfig(Configs.RECIPE_CONFIG).setShape("###", "# #", "###").addMaterial('#', stone).setGroup("end_stone_furnaces").build();
|
||||||
|
GridRecipe.make(BetterEnd.MOD_ID, name + "_flower_pot", flowerPot).checkConfig(Configs.RECIPE_CONFIG).setOutputCount(3).setShape("# #", " # ").addMaterial('#', bricks).setGroup("end_pots").build();
|
||||||
|
|
||||||
CraftingRecipes.registerPedestal(name + "_pedestal", pedestal, slab, pillar);
|
CraftingRecipes.registerPedestal(name + "_pedestal", pedestal, slab, pillar);
|
||||||
|
|
||||||
// Item Tags //
|
// Item Tags //
|
||||||
TagHelper.addTag(ItemTags.SLABS, slab, brick_slab);
|
TagHelper.addTag(ItemTags.SLABS, slab, brickSlab);
|
||||||
TagHelper.addTag(ItemTags.STONE_BRICKS, bricks);
|
TagHelper.addTag(ItemTags.STONE_BRICKS, bricks);
|
||||||
TagHelper.addTag(ItemTags.STONE_CRAFTING_MATERIALS, stone);
|
TagHelper.addTag(ItemTags.STONE_CRAFTING_MATERIALS, stone);
|
||||||
TagHelper.addTag(ItemTags.STONE_TOOL_MATERIALS, stone);
|
TagHelper.addTag(ItemTags.STONE_TOOL_MATERIALS, stone);
|
||||||
|
@ -99,9 +100,9 @@ public class StoneMaterial {
|
||||||
|
|
||||||
// Block Tags //
|
// Block Tags //
|
||||||
TagHelper.addTag(BlockTags.STONE_BRICKS, bricks);
|
TagHelper.addTag(BlockTags.STONE_BRICKS, bricks);
|
||||||
TagHelper.addTag(BlockTags.WALLS, wall, brick_wall);
|
TagHelper.addTag(BlockTags.WALLS, wall, brickWall);
|
||||||
TagHelper.addTag(BlockTags.SLABS, slab, brick_slab);
|
TagHelper.addTag(BlockTags.SLABS, slab, brickSlab);
|
||||||
TagHelper.addTags(pressure_plate, BlockTags.PRESSURE_PLATES, BlockTags.STONE_PRESSURE_PLATES);
|
TagHelper.addTags(pressurePlate, BlockTags.PRESSURE_PLATES, BlockTags.STONE_PRESSURE_PLATES);
|
||||||
TagHelper.addTag(TagAPI.END_STONES, stone);
|
TagHelper.addTag(TagAPI.END_STONES, stone);
|
||||||
|
|
||||||
TagHelper.addTag(TagAPI.DRAGON_IMMUNE, stone, stairs, slab, wall);
|
TagHelper.addTag(TagAPI.DRAGON_IMMUNE, stone, stairs, slab, wall);
|
||||||
|
|
|
@ -122,6 +122,7 @@ public class CraftingRecipes {
|
||||||
GridRecipe.make(BetterEnd.MOD_ID, "neon_cactus_block_stairs", EndBlocks.NEON_CACTUS_BLOCK_STAIRS).checkConfig(Configs.RECIPE_CONFIG).setShape("# ", "## ", "###").setOutputCount(4).addMaterial('#', EndBlocks.NEON_CACTUS_BLOCK).build();
|
GridRecipe.make(BetterEnd.MOD_ID, "neon_cactus_block_stairs", EndBlocks.NEON_CACTUS_BLOCK_STAIRS).checkConfig(Configs.RECIPE_CONFIG).setShape("# ", "## ", "###").setOutputCount(4).addMaterial('#', EndBlocks.NEON_CACTUS_BLOCK).build();
|
||||||
|
|
||||||
GridRecipe.make(BetterEnd.MOD_ID, "sugar_from_root", Items.SUGAR).checkConfig(Configs.RECIPE_CONFIG).setList("###").addMaterial('#', EndItems.AMBER_ROOT_RAW).build();
|
GridRecipe.make(BetterEnd.MOD_ID, "sugar_from_root", Items.SUGAR).checkConfig(Configs.RECIPE_CONFIG).setList("###").addMaterial('#', EndItems.AMBER_ROOT_RAW).build();
|
||||||
|
GridRecipe.make(BetterEnd.MOD_ID, "endstone_flower_pot", EndBlocks.ENDSTONE_FLOWER_POT).checkConfig(Configs.RECIPE_CONFIG).setOutputCount(3).setShape("# #", " # ").addMaterial('#', Blocks.END_STONE_BRICKS).setGroup("end_pots").build();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void registerLantern(String name, Block lantern, Block slab) {
|
private static void registerLantern(String name, Block lantern, Block slab) {
|
||||||
|
|
|
@ -874,5 +874,14 @@
|
||||||
|
|
||||||
"tooltip.armor.crystalite_set": "Set bonus: Regeneration I",
|
"tooltip.armor.crystalite_set": "Set bonus: Regeneration I",
|
||||||
"tooltip.armor.crystalite_chest": "Effect: Dig Speed I",
|
"tooltip.armor.crystalite_chest": "Effect: Dig Speed I",
|
||||||
"tooltip.armor.crystalite_boots": "Effect: Swiftness I"
|
"tooltip.armor.crystalite_boots": "Effect: Swiftness I",
|
||||||
|
|
||||||
|
"block.betterend.azure_jadestone_flower_pot": "Azure Jadestone Flower Pot",
|
||||||
|
"block.betterend.endstone_flower_pot": "Endstone Flower Pot",
|
||||||
|
"block.betterend.flavolite_flower_pot": "Flavolite Flower Pot",
|
||||||
|
"block.betterend.sandy_jadestone_flower_pot": "Sandy Jadestone Flower Pot",
|
||||||
|
"block.betterend.sulphuric_rock_flower_pot": "Sulphuric Rock Flower Pot",
|
||||||
|
"block.betterend.violecite_flower_pot": "Violecite Flower Pot",
|
||||||
|
"block.betterend.virid_jadestone_flower_pot": "Virid Jadestone Flower Pot",
|
||||||
|
"block.betterend.virid_jadestone_flower_pot": "Virid Jadestone Flower Pot"
|
||||||
}
|
}
|
||||||
|
|
|
@ -890,5 +890,13 @@
|
||||||
|
|
||||||
"tooltip.armor.crystalite_set": "Бонус сета: Регенерация I",
|
"tooltip.armor.crystalite_set": "Бонус сета: Регенерация I",
|
||||||
"tooltip.armor.crystalite_chest": "Эффект: Ускорение I",
|
"tooltip.armor.crystalite_chest": "Эффект: Ускорение I",
|
||||||
"tooltip.armor.crystalite_boots": "Эффект: Стремительность I"
|
"tooltip.armor.crystalite_boots": "Эффект: Стремительность I",
|
||||||
|
|
||||||
|
"block.betterend.azure_jadestone_flower_pot": "Цветочный горшок из лазурного нефрита",
|
||||||
|
"block.betterend.endstone_flower_pot": "Цветочный горшок из эндерняка",
|
||||||
|
"block.betterend.flavolite_flower_pot": "Цветочный горшок из флаволита",
|
||||||
|
"block.betterend.sandy_jadestone_flower_pot": "Цветочный горшок из песчаного нефрита",
|
||||||
|
"block.betterend.sulphuric_rock_flower_pot": "Цветочный горшок из серного камня",
|
||||||
|
"block.betterend.violecite_flower_pot": "Цветочный горшок из виолецита",
|
||||||
|
"block.betterend.virid_jadestone_flower_pot": "Цветочный горшок из зелёного нефрита"
|
||||||
}
|
}
|
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"parent": "block/cross",
|
||||||
|
"textures": {
|
||||||
|
"cross": "betterend:block/cave_grass_potted"
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"parent": "block/cross",
|
||||||
|
"textures": {
|
||||||
|
"cross": "betterend:block/chorus_grass_potted"
|
||||||
|
}
|
||||||
|
}
|
Binary file not shown.
After Width: | Height: | Size: 195 B |
Binary file not shown.
After Width: | Height: | Size: 447 B |
Loading…
Add table
Add a link
Reference in a new issue