Fully working port to 1.15

This commit is contained in:
Motschen
2020-06-16 18:37:44 +02:00
committed by GitHub
parent 67f47d0135
commit 8525e5bd38
8 changed files with 501 additions and 498 deletions

View File

@@ -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;

View File

@@ -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);
} }
}); });
} }

View File

@@ -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;

View File

@@ -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;