mirror of
https://github.com/TeamMidnightDust/DeliciousDishes.git
synced 2025-12-16 16:45:09 +01:00
Fully working port to 1.15
This commit is contained in:
@@ -2,6 +2,7 @@ package eu.midnightdust.motschen.dishes;
|
|||||||
|
|
||||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||||
import net.minecraft.block.*;
|
import net.minecraft.block.*;
|
||||||
|
import net.minecraft.entity.EntityContext;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.item.ItemPlacementContext;
|
import net.minecraft.item.ItemPlacementContext;
|
||||||
import net.minecraft.sound.BlockSoundGroup;
|
import net.minecraft.sound.BlockSoundGroup;
|
||||||
@@ -27,7 +28,7 @@ public class Dish extends HorizontalFacingBlock {
|
|||||||
private static final VoxelShape WEST_SHAPE;
|
private static final VoxelShape WEST_SHAPE;
|
||||||
|
|
||||||
public Dish() {
|
public Dish() {
|
||||||
super(FabricBlockSettings.copy(Blocks.CAKE).nonOpaque().sounds(BlockSoundGroup.STONE));
|
super(FabricBlockSettings.copyOf(Blocks.CAKE).nonOpaque().sounds(BlockSoundGroup.STONE));
|
||||||
this.setDefaultState(this.stateManager.getDefaultState().with(FACING, Direction.NORTH).with(BITES, 0));
|
this.setDefaultState(this.stateManager.getDefaultState().with(FACING, Direction.NORTH).with(BITES, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -70,7 +71,7 @@ public class Dish extends HorizontalFacingBlock {
|
|||||||
builder.add(BITES);
|
builder.add(BITES);
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public VoxelShape getOutlineShape(BlockState state, BlockView view, BlockPos pos, ShapeContext context) {
|
public VoxelShape getOutlineShape(BlockState state, BlockView view, BlockPos pos, EntityContext context) {
|
||||||
switch (state.get(FACING)) {
|
switch (state.get(FACING)) {
|
||||||
case NORTH: return NORTH_SHAPE;
|
case NORTH: return NORTH_SHAPE;
|
||||||
case EAST: return EAST_SHAPE;
|
case EAST: return EAST_SHAPE;
|
||||||
|
|||||||
@@ -12,19 +12,19 @@ public class LootModifier {
|
|||||||
LootTableLoadingCallback.EVENT.register((resourceManager, lootManager, id, supplier, setter) -> {
|
LootTableLoadingCallback.EVENT.register((resourceManager, lootManager, id, supplier, setter) -> {
|
||||||
if (id.getPath().contains("chests") && id.getPath().contains("village")) {
|
if (id.getPath().contains("chests") && id.getPath().contains("village")) {
|
||||||
FabricLootPoolBuilder tomato = FabricLootPoolBuilder.builder()
|
FabricLootPoolBuilder tomato = FabricLootPoolBuilder.builder()
|
||||||
.rolls(UniformLootTableRange.between(0, 5))
|
.withRolls(UniformLootTableRange.between(0, 5))
|
||||||
.withCondition(RandomChanceLootCondition.builder(1.0f).build())
|
.withCondition(RandomChanceLootCondition.builder(1.0f).build())
|
||||||
.with(ItemEntry.builder(DishesMain.Tomato));
|
.withEntry(ItemEntry.builder(DishesMain.Tomato));
|
||||||
supplier.pool(tomato);
|
supplier.withPool(tomato);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
LootTableLoadingCallback.EVENT.register((resourceManager, lootManager, id, supplier, setter) -> {
|
LootTableLoadingCallback.EVENT.register((resourceManager, lootManager, id, supplier, setter) -> {
|
||||||
if (id.getPath().contains("chests") && id.getPath().contains("village")) {
|
if (id.getPath().contains("chests") && id.getPath().contains("village")) {
|
||||||
FabricLootPoolBuilder lettuce = FabricLootPoolBuilder.builder()
|
FabricLootPoolBuilder lettuce = FabricLootPoolBuilder.builder()
|
||||||
.rolls(UniformLootTableRange.between(0, 5))
|
.withRolls(UniformLootTableRange.between(0, 5))
|
||||||
.withCondition(RandomChanceLootCondition.builder(1.0f).build())
|
.withCondition(RandomChanceLootCondition.builder(1.0f).build())
|
||||||
.with(ItemEntry.builder(DishesMain.Lettuce));
|
.withEntry(ItemEntry.builder(DishesMain.Lettuce));
|
||||||
supplier.pool(lettuce);
|
supplier.withPool(lettuce);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package eu.midnightdust.motschen.dishes;
|
|||||||
|
|
||||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||||
import net.minecraft.block.*;
|
import net.minecraft.block.*;
|
||||||
|
import net.minecraft.entity.EntityContext;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.item.ItemPlacementContext;
|
import net.minecraft.item.ItemPlacementContext;
|
||||||
import net.minecraft.sound.BlockSoundGroup;
|
import net.minecraft.sound.BlockSoundGroup;
|
||||||
@@ -28,7 +29,7 @@ public class Pizza extends HorizontalFacingBlock {
|
|||||||
private static final VoxelShape WEST_SHAPE;
|
private static final VoxelShape WEST_SHAPE;
|
||||||
|
|
||||||
public Pizza() {
|
public Pizza() {
|
||||||
super(FabricBlockSettings.copy(Blocks.CAKE).nonOpaque().sounds(BlockSoundGroup.STONE));
|
super(FabricBlockSettings.copyOf(Blocks.CAKE).nonOpaque().sounds(BlockSoundGroup.STONE));
|
||||||
this.setDefaultState(this.stateManager.getDefaultState().with(FACING, Direction.NORTH).with(BITES, 0));
|
this.setDefaultState(this.stateManager.getDefaultState().with(FACING, Direction.NORTH).with(BITES, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -77,7 +78,7 @@ public class Pizza extends HorizontalFacingBlock {
|
|||||||
builder.add(BITES);
|
builder.add(BITES);
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public VoxelShape getOutlineShape(BlockState state, BlockView view, BlockPos pos, ShapeContext context) {
|
public VoxelShape getOutlineShape(BlockState state, BlockView view, BlockPos pos, EntityContext context) {
|
||||||
switch (state.get(FACING)) {
|
switch (state.get(FACING)) {
|
||||||
case NORTH: return NORTH_SHAPE;
|
case NORTH: return NORTH_SHAPE;
|
||||||
case EAST: return EAST_SHAPE;
|
case EAST: return EAST_SHAPE;
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package eu.midnightdust.motschen.dishes;
|
|||||||
|
|
||||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||||
import net.minecraft.block.*;
|
import net.minecraft.block.*;
|
||||||
|
import net.minecraft.entity.EntityContext;
|
||||||
import net.minecraft.item.ItemPlacementContext;
|
import net.minecraft.item.ItemPlacementContext;
|
||||||
import net.minecraft.sound.BlockSoundGroup;
|
import net.minecraft.sound.BlockSoundGroup;
|
||||||
import net.minecraft.state.StateManager;
|
import net.minecraft.state.StateManager;
|
||||||
@@ -20,7 +21,7 @@ public class Plate extends HorizontalFacingBlock {
|
|||||||
private static final VoxelShape WEST_SHAPE;
|
private static final VoxelShape WEST_SHAPE;
|
||||||
|
|
||||||
public Plate() {
|
public Plate() {
|
||||||
super(FabricBlockSettings.copy(Blocks.CAKE).nonOpaque().sounds(BlockSoundGroup.STONE));
|
super(FabricBlockSettings.copyOf(Blocks.CAKE).nonOpaque().sounds(BlockSoundGroup.STONE));
|
||||||
this.setDefaultState(this.stateManager.getDefaultState().with(FACING, Direction.NORTH));
|
this.setDefaultState(this.stateManager.getDefaultState().with(FACING, Direction.NORTH));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -35,7 +36,7 @@ public class Plate extends HorizontalFacingBlock {
|
|||||||
builder.add(FACING);
|
builder.add(FACING);
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public VoxelShape getOutlineShape(BlockState state, BlockView view, BlockPos pos, ShapeContext context) {
|
public VoxelShape getOutlineShape(BlockState state, BlockView view, BlockPos pos, EntityContext context) {
|
||||||
switch (state.get(FACING)) {
|
switch (state.get(FACING)) {
|
||||||
case NORTH: return NORTH_SHAPE;
|
case NORTH: return NORTH_SHAPE;
|
||||||
case EAST: return EAST_SHAPE;
|
case EAST: return EAST_SHAPE;
|
||||||
|
|||||||
Reference in New Issue
Block a user