Start migration

This commit is contained in:
Aleksey 2021-04-08 21:55:07 +03:00
parent 6630ce0cab
commit 47ed597358
491 changed files with 12045 additions and 11953 deletions

View file

@ -8,21 +8,21 @@ import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.FurnaceBlock;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.loot.context.LootContext;
import net.minecraft.loot.context.LootContextParameters;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.FurnaceBlock;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.entity.player.PlayerEntity;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.storage.loot.LootContext;
import net.minecraft.world.level.storage.loot.parameters.LootContextParams;
import net.minecraft.screen.NamedScreenHandlerFactory;
import net.minecraft.stat.Stats;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.registry.Registry;
import net.minecraft.world.BlockView;
import net.minecraft.world.World;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Registry;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level;
import ru.betterend.blocks.entities.EFurnaceBlockEntity;
import ru.betterend.client.render.ERenderLayer;
import ru.betterend.interfaces.IRenderTypeable;
@ -32,7 +32,7 @@ import ru.betterend.patterns.Patterns;
public class EndFurnaceBlock extends FurnaceBlock implements BlockPatterned, IRenderTypeable {
public EndFurnaceBlock(Block source) {
super(FabricBlockSettings.copyOf(source).luminance((state) -> {
return state.get(LIT) ? 13 : 0;
return state.getValue(LIT) ? 13 : 0;
}));
}
@ -40,25 +40,25 @@ public class EndFurnaceBlock extends FurnaceBlock implements BlockPatterned, IRe
public BlockEntity createBlockEntity(BlockView world) {
return new EFurnaceBlockEntity();
}
@Override
protected void openScreen(World world, BlockPos pos, PlayerEntity player) {
protected void openScreen(Level world, BlockPos pos, PlayerEntity player) {
BlockEntity blockEntity = world.getBlockEntity(pos);
if (blockEntity instanceof EFurnaceBlockEntity) {
player.openHandledScreen((NamedScreenHandlerFactory) blockEntity);
player.incrementStat(Stats.INTERACT_WITH_FURNACE);
}
}
@Override
public String getStatesPattern(Reader data) {
Identifier blockId = Registry.BLOCK.getId(this);
ResourceLocation blockId = Registry.BLOCK.getKey(this);
return Patterns.createJson(data, blockId.getPath(), blockId.getPath());
}
@Override
public String getModelPattern(String block) {
Identifier blockId = Registry.BLOCK.getId(this);
ResourceLocation blockId = Registry.BLOCK.getKey(this);
Map<String, String> map = Maps.newHashMap();
map.put("%top%", blockId.getPath() + "_top");
map.put("%side%", blockId.getPath() + "_side");
@ -66,15 +66,14 @@ public class EndFurnaceBlock extends FurnaceBlock implements BlockPatterned, IRe
map.put("%front%", blockId.getPath() + "_front_on");
map.put("%glow%", blockId.getPath() + "_glow");
return Patterns.createJson(Patterns.BLOCK_FURNACE_GLOW, map);
}
else {
} else {
map.put("%front%", blockId.getPath() + "_front");
return Patterns.createJson(Patterns.BLOCK_FURNACE, map);
}
}
@Override
public Identifier statePatternId() {
public ResourceLocation statePatternId() {
return Patterns.STATE_FURNACE;
}
@ -82,11 +81,11 @@ public class EndFurnaceBlock extends FurnaceBlock implements BlockPatterned, IRe
public ERenderLayer getRenderLayer() {
return ERenderLayer.CUTOUT;
}
@Override
public List<ItemStack> getDroppedStacks(BlockState state, LootContext.Builder builder) {
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
List<ItemStack> drop = Lists.newArrayList(new ItemStack(this));
BlockEntity blockEntity = builder.getNullable(LootContextParameters.BLOCK_ENTITY);
BlockEntity blockEntity = builder.getNullable(LootContextParams.BLOCK_ENTITY);
if (blockEntity instanceof EFurnaceBlockEntity) {
EFurnaceBlockEntity entity = (EFurnaceBlockEntity) blockEntity;
for (int i = 0; i < entity.size(); i++) {