Composters prototype
This commit is contained in:
parent
2008be1a6b
commit
e2930887e3
8 changed files with 208 additions and 3 deletions
45
src/main/java/ru/betterend/blocks/basis/BlockComposter.java
Normal file
45
src/main/java/ru/betterend/blocks/basis/BlockComposter.java
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
package ru.betterend.blocks.basis;
|
||||||
|
|
||||||
|
import java.io.Reader;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.block.BlockState;
|
||||||
|
import net.minecraft.block.ComposterBlock;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.loot.context.LootContext;
|
||||||
|
import net.minecraft.util.Identifier;
|
||||||
|
import net.minecraft.util.registry.Registry;
|
||||||
|
import ru.betterend.patterns.BlockPatterned;
|
||||||
|
import ru.betterend.patterns.Patterns;
|
||||||
|
|
||||||
|
public class BlockComposter extends ComposterBlock implements BlockPatterned {
|
||||||
|
public BlockComposter(Block source) {
|
||||||
|
super(FabricBlockSettings.copyOf(source));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ItemStack> getDroppedStacks(BlockState state, LootContext.Builder builder) {
|
||||||
|
return Collections.singletonList(new ItemStack(this.asItem()));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getStatesPattern(Reader data) {
|
||||||
|
String blockId = Registry.BLOCK.getId(this).getPath();
|
||||||
|
return Patterns.createJson(data, blockId, blockId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getModelPattern(String block) {
|
||||||
|
Identifier blockId = Registry.BLOCK.getId(this);
|
||||||
|
String blockName = blockId.getPath();
|
||||||
|
return Patterns.createJson(Patterns.BLOCK_COMPOSTER, blockName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Identifier statePatternId() {
|
||||||
|
return Patterns.STATE_COMPOSTER;
|
||||||
|
}
|
||||||
|
}
|
|
@ -16,6 +16,7 @@ import ru.betterend.blocks.basis.BlockBarrel;
|
||||||
import ru.betterend.blocks.basis.BlockBase;
|
import ru.betterend.blocks.basis.BlockBase;
|
||||||
import ru.betterend.blocks.basis.BlockBookshelf;
|
import ru.betterend.blocks.basis.BlockBookshelf;
|
||||||
import ru.betterend.blocks.basis.BlockChest;
|
import ru.betterend.blocks.basis.BlockChest;
|
||||||
|
import ru.betterend.blocks.basis.BlockComposter;
|
||||||
import ru.betterend.blocks.basis.BlockCraftingTable;
|
import ru.betterend.blocks.basis.BlockCraftingTable;
|
||||||
import ru.betterend.blocks.basis.BlockDoor;
|
import ru.betterend.blocks.basis.BlockDoor;
|
||||||
import ru.betterend.blocks.basis.BlockFence;
|
import ru.betterend.blocks.basis.BlockFence;
|
||||||
|
@ -59,6 +60,7 @@ public class WoodenMaterial {
|
||||||
public final Block chest;
|
public final Block chest;
|
||||||
public final Block barrel;
|
public final Block barrel;
|
||||||
public final Block shelf;
|
public final Block shelf;
|
||||||
|
public final Block composter;
|
||||||
|
|
||||||
public final Tag.Identified<Block> logBlockTag;
|
public final Tag.Identified<Block> logBlockTag;
|
||||||
public final Tag.Identified<Item> logItemTag;
|
public final Tag.Identified<Item> logItemTag;
|
||||||
|
@ -89,6 +91,7 @@ public class WoodenMaterial {
|
||||||
chest = EndBlocks.registerBlock(name + "_chest", new BlockChest(planks));
|
chest = EndBlocks.registerBlock(name + "_chest", new BlockChest(planks));
|
||||||
barrel = EndBlocks.registerBlock(name + "_barrel", new BlockBarrel(planks));
|
barrel = EndBlocks.registerBlock(name + "_barrel", new BlockBarrel(planks));
|
||||||
shelf = EndBlocks.registerBlock(name + "_bookshelf", new BlockBookshelf(planks));
|
shelf = EndBlocks.registerBlock(name + "_bookshelf", new BlockBookshelf(planks));
|
||||||
|
composter = EndBlocks.registerBlock(name + "_composter", new BlockComposter(planks));
|
||||||
|
|
||||||
// Recipes //
|
// Recipes //
|
||||||
GridRecipe.make(name + "_planks", planks).setOutputCount(4).setList("#").addMaterial('#', log, bark, log_stripped, bark_stripped).setGroup("end_planks").build();
|
GridRecipe.make(name + "_planks", planks).setOutputCount(4).setList("#").addMaterial('#', log, bark, log_stripped, bark_stripped).setGroup("end_planks").build();
|
||||||
|
@ -108,6 +111,7 @@ public class WoodenMaterial {
|
||||||
GridRecipe.make(name + "_bookshelf", shelf).setShape("###", "PPP", "###").addMaterial('#', planks).addMaterial('P', Items.PAPER).setGroup("end_bookshelves").build();
|
GridRecipe.make(name + "_bookshelf", shelf).setShape("###", "PPP", "###").addMaterial('#', planks).addMaterial('P', Items.PAPER).setGroup("end_bookshelves").build();
|
||||||
GridRecipe.make(name + "_bark", bark).setShape("##", "##").addMaterial('#', log).setOutputCount(3).build();
|
GridRecipe.make(name + "_bark", bark).setShape("##", "##").addMaterial('#', log).setOutputCount(3).build();
|
||||||
GridRecipe.make(name + "_log", log).setShape("##", "##").addMaterial('#', bark).setOutputCount(3).build();
|
GridRecipe.make(name + "_log", log).setShape("##", "##").addMaterial('#', bark).setOutputCount(3).build();
|
||||||
|
GridRecipe.make(name + "_composter", composter).setShape("# #", "# #", "###").addMaterial('#', slab).build();
|
||||||
|
|
||||||
// Item Tags //
|
// Item Tags //
|
||||||
TagHelper.addTag(ItemTags.PLANKS, planks);
|
TagHelper.addTag(ItemTags.PLANKS, planks);
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
package ru.betterend.mixin.common;
|
||||||
|
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.gen.Invoker;
|
||||||
|
|
||||||
|
import net.minecraft.block.ComposterBlock;
|
||||||
|
import net.minecraft.item.ItemConvertible;
|
||||||
|
|
||||||
|
@Mixin(ComposterBlock.class)
|
||||||
|
public interface ComposterBlockAccessor {
|
||||||
|
@Invoker
|
||||||
|
static void callRegisterCompostableItem(float levelIncreaseChance, ItemConvertible item) {
|
||||||
|
throw new AssertionError("@Invoker dummy body called");
|
||||||
|
}
|
||||||
|
}
|
|
@ -37,6 +37,7 @@ public class Patterns {
|
||||||
public final static Identifier STATE_STONE_LANTERN = BetterEnd.makeID("patterns/blockstate/stone_lantern.json");
|
public final static Identifier STATE_STONE_LANTERN = BetterEnd.makeID("patterns/blockstate/stone_lantern.json");
|
||||||
public final static Identifier STATE_DIRECT = BetterEnd.makeID("patterns/blockstate/pattern_direct.json");
|
public final static Identifier STATE_DIRECT = BetterEnd.makeID("patterns/blockstate/pattern_direct.json");
|
||||||
public final static Identifier STATE_BULB_LANTERN = BetterEnd.makeID("patterns/blockstate/bulb_lantern.json");
|
public final static Identifier STATE_BULB_LANTERN = BetterEnd.makeID("patterns/blockstate/bulb_lantern.json");
|
||||||
|
public final static Identifier STATE_COMPOSTER = BetterEnd.makeID("patterns/blockstate/composter.json");
|
||||||
|
|
||||||
//Models Block
|
//Models Block
|
||||||
public final static Identifier BLOCK_EMPTY = BetterEnd.makeID("patterns/block/pattern_empty.json");
|
public final static Identifier BLOCK_EMPTY = BetterEnd.makeID("patterns/block/pattern_empty.json");
|
||||||
|
@ -81,6 +82,7 @@ public class Patterns {
|
||||||
public final static Identifier BLOCK_BULB_LANTERN_COLORED_FLOOR = BetterEnd.makeID("models/block/bulb_lantern_colored_floor.json");
|
public final static Identifier BLOCK_BULB_LANTERN_COLORED_FLOOR = BetterEnd.makeID("models/block/bulb_lantern_colored_floor.json");
|
||||||
public final static Identifier BLOCK_BULB_LANTERN_COLORED_CEIL = BetterEnd.makeID("models/block/bulb_lantern_colored_ceil.json");
|
public final static Identifier BLOCK_BULB_LANTERN_COLORED_CEIL = BetterEnd.makeID("models/block/bulb_lantern_colored_ceil.json");
|
||||||
public final static Identifier BLOCK_PETAL_COLORED = BetterEnd.makeID("models/block/block_petal_colored.json");
|
public final static Identifier BLOCK_PETAL_COLORED = BetterEnd.makeID("models/block/block_petal_colored.json");
|
||||||
|
public final static Identifier BLOCK_COMPOSTER = BetterEnd.makeID("patterns/block/composter.json");
|
||||||
|
|
||||||
//Models Item
|
//Models Item
|
||||||
public final static Identifier ITEM_WALL = BetterEnd.makeID("patterns/item/pattern_wall.json");
|
public final static Identifier ITEM_WALL = BetterEnd.makeID("patterns/item/pattern_wall.json");
|
||||||
|
|
|
@ -25,6 +25,7 @@ import ru.betterend.blocks.BlockTerrain;
|
||||||
import ru.betterend.blocks.basis.BlockPedestal;
|
import ru.betterend.blocks.basis.BlockPedestal;
|
||||||
import ru.betterend.blocks.basis.BlockSimpleLeaves;
|
import ru.betterend.blocks.basis.BlockSimpleLeaves;
|
||||||
import ru.betterend.blocks.basis.BlockVine;
|
import ru.betterend.blocks.basis.BlockVine;
|
||||||
|
import ru.betterend.mixin.common.ComposterBlockAccessor;
|
||||||
import ru.betterend.util.TagHelper;
|
import ru.betterend.util.TagHelper;
|
||||||
|
|
||||||
public class EndTags {
|
public class EndTags {
|
||||||
|
@ -64,11 +65,15 @@ public class EndTags {
|
||||||
if (block instanceof BlockTerrain) {
|
if (block instanceof BlockTerrain) {
|
||||||
addSurfaceBlock(block);
|
addSurfaceBlock(block);
|
||||||
TagHelper.addTag(BlockTags.NYLIUM, block);
|
TagHelper.addTag(BlockTags.NYLIUM, block);
|
||||||
} else if (block instanceof LeavesBlock || block instanceof BlockSimpleLeaves) {
|
}
|
||||||
|
else if (block instanceof LeavesBlock || block instanceof BlockSimpleLeaves) {
|
||||||
TagHelper.addTag(BlockTags.LEAVES, block);
|
TagHelper.addTag(BlockTags.LEAVES, block);
|
||||||
} else if (block instanceof BlockVine) {
|
ComposterBlockAccessor.callRegisterCompostableItem(0.3F, block);
|
||||||
|
}
|
||||||
|
else if (block instanceof BlockVine) {
|
||||||
TagHelper.addTag(BlockTags.CLIMBABLE, block);
|
TagHelper.addTag(BlockTags.CLIMBABLE, block);
|
||||||
} else if (block instanceof BlockPedestal) {
|
}
|
||||||
|
else if (block instanceof BlockPedestal) {
|
||||||
TagHelper.addTag(PEDESTALS, block);
|
TagHelper.addTag(PEDESTALS, block);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -0,0 +1,60 @@
|
||||||
|
{
|
||||||
|
"parent": "block/block",
|
||||||
|
"textures": {
|
||||||
|
"particle": "block/%texture%_side",
|
||||||
|
"top": "block/%texture%_top",
|
||||||
|
"bottom": "block/%texture%_bottom",
|
||||||
|
"side": "block/%texture%_side",
|
||||||
|
"inside": "block/%texture%_bottom"
|
||||||
|
},
|
||||||
|
"elements": [
|
||||||
|
{
|
||||||
|
"from": [ 0, 0, 0 ],
|
||||||
|
"to": [ 16, 2, 16 ],
|
||||||
|
"faces": {
|
||||||
|
"up": { "texture": "#inside", "cullface": "up" },
|
||||||
|
"down": { "texture": "#bottom", "cullface": "down" }
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"from": [ 0, 0, 0 ],
|
||||||
|
"to": [ 2, 16, 16 ],
|
||||||
|
"faces": {
|
||||||
|
"up": { "texture": "#top", "cullface": "up" },
|
||||||
|
"north": { "texture": "#side", "cullface": "north" },
|
||||||
|
"south": { "texture": "#side", "cullface": "south" },
|
||||||
|
"west": { "texture": "#side", "cullface": "west" },
|
||||||
|
"east": { "texture": "#side", "cullface": "up" }
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"from": [ 14, 0, 0 ],
|
||||||
|
"to": [ 16, 16, 16 ],
|
||||||
|
"faces": {
|
||||||
|
"up": { "texture": "#top", "cullface": "up" },
|
||||||
|
"north": { "texture": "#side", "cullface": "north" },
|
||||||
|
"south": { "texture": "#side", "cullface": "south" },
|
||||||
|
"west": { "texture": "#side", "cullface": "up" },
|
||||||
|
"east": { "texture": "#side", "cullface": "east" }
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"from": [ 2, 0, 0 ],
|
||||||
|
"to": [ 14, 16, 2 ],
|
||||||
|
"faces": {
|
||||||
|
"up": { "texture": "#top", "cullface": "up" },
|
||||||
|
"north": { "texture": "#side", "cullface": "north" },
|
||||||
|
"south": { "texture": "#side", "cullface": "up" }
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"from": [ 2, 0, 14 ],
|
||||||
|
"to": [ 14, 16, 16 ],
|
||||||
|
"faces": {
|
||||||
|
"up": { "texture": "#top", "cullface": "up" },
|
||||||
|
"north": { "texture": "#side", "cullface": "up" },
|
||||||
|
"south": { "texture": "#side", "cullface": "south" }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
|
@ -0,0 +1,73 @@
|
||||||
|
{
|
||||||
|
"multipart": [
|
||||||
|
{
|
||||||
|
"apply": {
|
||||||
|
"model": "betterend:pattern/%block%"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"when": {
|
||||||
|
"level": "1"
|
||||||
|
},
|
||||||
|
"apply": {
|
||||||
|
"model": "minecraft:block/composter_contents1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"when": {
|
||||||
|
"level": "2"
|
||||||
|
},
|
||||||
|
"apply": {
|
||||||
|
"model": "minecraft:block/composter_contents2"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"when": {
|
||||||
|
"level": "3"
|
||||||
|
},
|
||||||
|
"apply": {
|
||||||
|
"model": "minecraft:block/composter_contents3"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"when": {
|
||||||
|
"level": "4"
|
||||||
|
},
|
||||||
|
"apply": {
|
||||||
|
"model": "minecraft:block/composter_contents4"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"when": {
|
||||||
|
"level": "5"
|
||||||
|
},
|
||||||
|
"apply": {
|
||||||
|
"model": "minecraft:block/composter_contents5"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"when": {
|
||||||
|
"level": "6"
|
||||||
|
},
|
||||||
|
"apply": {
|
||||||
|
"model": "minecraft:block/composter_contents6"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"when": {
|
||||||
|
"level": "7"
|
||||||
|
},
|
||||||
|
"apply": {
|
||||||
|
"model": "minecraft:block/composter_contents7"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"when": {
|
||||||
|
"level": "8"
|
||||||
|
},
|
||||||
|
"apply": {
|
||||||
|
"model": "minecraft:block/composter_contents_ready"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
|
@ -11,6 +11,7 @@
|
||||||
"AnvilScreenHandlerMixin",
|
"AnvilScreenHandlerMixin",
|
||||||
"ServerPlayerEntityMixin",
|
"ServerPlayerEntityMixin",
|
||||||
"ChorusPlantFeatureMixin",
|
"ChorusPlantFeatureMixin",
|
||||||
|
"ComposterBlockAccessor",
|
||||||
"ChorusFlowerBlockMixin",
|
"ChorusFlowerBlockMixin",
|
||||||
"LandPathNodeMakerMixin",
|
"LandPathNodeMakerMixin",
|
||||||
"ChorusPlantBlockMixin",
|
"ChorusPlantBlockMixin",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue