Fix 1
This commit is contained in:
parent
cf956fad5c
commit
f06f07a534
@ -5,61 +5,45 @@ import eu.pb4.polymer.blocks.api.PolymerBlockModel;
|
|||||||
import eu.pb4.polymer.blocks.api.PolymerBlockResourceUtils;
|
import eu.pb4.polymer.blocks.api.PolymerBlockResourceUtils;
|
||||||
import eu.pb4.polymer.blocks.api.PolymerTexturedBlock;
|
import eu.pb4.polymer.blocks.api.PolymerTexturedBlock;
|
||||||
import eu.pb4.polymer.core.api.block.PolymerBlockUtils;
|
import eu.pb4.polymer.core.api.block.PolymerBlockUtils;
|
||||||
|
import eu.pb4.polymer.core.api.block.SimplePolymerBlock;
|
||||||
import net.fabricmc.fabric.api.event.player.UseBlockCallback;
|
import net.fabricmc.fabric.api.event.player.UseBlockCallback;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.*;
|
||||||
import net.minecraft.block.BlockEntityProvider;
|
|
||||||
import net.minecraft.block.BlockState;
|
|
||||||
import net.minecraft.block.Blocks;
|
|
||||||
import net.minecraft.block.entity.BlockEntity;
|
import net.minecraft.block.entity.BlockEntity;
|
||||||
import net.minecraft.block.entity.BlockEntityType;
|
import net.minecraft.block.entity.BlockEntityType;
|
||||||
import net.minecraft.component.DataComponentTypes;
|
|
||||||
import net.minecraft.component.type.WrittenBookContentComponent;
|
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.item.Items;
|
|
||||||
import net.minecraft.registry.Registries;
|
import net.minecraft.registry.Registries;
|
||||||
import net.minecraft.registry.Registry;
|
import net.minecraft.registry.Registry;
|
||||||
import net.minecraft.server.network.ServerPlayerEntity;
|
import net.minecraft.server.network.ServerPlayerEntity;
|
||||||
import net.minecraft.text.RawFilteredPair;
|
|
||||||
import net.minecraft.text.Text;
|
|
||||||
import net.minecraft.util.ActionResult;
|
import net.minecraft.util.ActionResult;
|
||||||
import net.minecraft.util.Hand;
|
import net.minecraft.util.Hand;
|
||||||
|
import net.minecraft.util.Identifier;
|
||||||
import net.minecraft.util.hit.BlockHitResult;
|
import net.minecraft.util.hit.BlockHitResult;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import systems.brn.server_storage.ServerStorage;
|
|
||||||
import systems.brn.server_storage.blockentities.HardDriveContainerBlockEntity;
|
import systems.brn.server_storage.blockentities.HardDriveContainerBlockEntity;
|
||||||
import systems.brn.server_storage.blockentities.StorageBlockEntity;
|
|
||||||
import systems.brn.server_storage.screens.DriveScreen;
|
import systems.brn.server_storage.screens.DriveScreen;
|
||||||
import systems.brn.server_storage.screens.StorageScreen;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import static systems.brn.server_storage.ServerStorage.*;
|
import static systems.brn.server_storage.ServerStorage.*;
|
||||||
import static systems.brn.server_storage.lib.Util.generateBookContent;
|
|
||||||
|
|
||||||
public class HardDriveContainerBlock extends Block implements PolymerTexturedBlock, BlockEntityProvider {
|
public class HardDriveContainerBlock extends SimplePolymerBlock implements PolymerTexturedBlock, BlockEntityProvider {
|
||||||
|
|
||||||
String modelID;
|
final Identifier identifier;
|
||||||
|
|
||||||
BlockModelType blockModelType;
|
public HardDriveContainerBlock(AbstractBlock.Settings settings, Identifier identifier) {
|
||||||
|
super(settings, Blocks.NOTE_BLOCK);
|
||||||
public HardDriveContainerBlock(Settings settings, BlockModelType type, String modelId) {
|
this.identifier = identifier;
|
||||||
super(settings);
|
|
||||||
this.modelID = modelId;
|
|
||||||
this.blockModelType = type;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BlockState getPolymerBlockState(BlockState state) {
|
public BlockState getPolymerBlockState(BlockState state) {
|
||||||
return PolymerBlockResourceUtils.requestBlock(BlockModelType.FULL_BLOCK, PolymerBlockModel.of(id(this.modelID)));
|
return PolymerBlockResourceUtils.requestBlock(BlockModelType.FULL_BLOCK, PolymerBlockModel.of(identifier));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void register() {
|
public static void register() {
|
||||||
var modId = id(HARD_DRIVE_CONTAINER_BLOCK_MODEL_ID);
|
var modId = id(HARD_DRIVE_CONTAINER_BLOCK_MODEL_ID);
|
||||||
HARD_DRIVE_CONTAINER_BLOCK = Registry.register(Registries.BLOCK, modId,
|
HARD_DRIVE_CONTAINER_BLOCK = Registry.register(Registries.BLOCK, modId,
|
||||||
new HardDriveContainerBlock(Settings.copy(Blocks.WHITE_WOOL), BlockModelType.FULL_BLOCK, ServerStorage.HARD_DRIVE_CONTAINER_BLOCK_MODEL_ID));
|
new HardDriveContainerBlock(Settings.copy(Blocks.WHITE_WOOL), modId));
|
||||||
UseBlockCallback.EVENT.register(HardDriveContainerBlock::onUse);
|
UseBlockCallback.EVENT.register(HardDriveContainerBlock::onUse);
|
||||||
|
|
||||||
HARD_DRIVE_CONTAINER_BLOCK_ENTITY = Registry.register(
|
HARD_DRIVE_CONTAINER_BLOCK_ENTITY = Registry.register(
|
||||||
|
@ -4,6 +4,7 @@ import eu.pb4.polymer.blocks.api.BlockModelType;
|
|||||||
import eu.pb4.polymer.blocks.api.PolymerBlockModel;
|
import eu.pb4.polymer.blocks.api.PolymerBlockModel;
|
||||||
import eu.pb4.polymer.blocks.api.PolymerBlockResourceUtils;
|
import eu.pb4.polymer.blocks.api.PolymerBlockResourceUtils;
|
||||||
import eu.pb4.polymer.blocks.api.PolymerTexturedBlock;
|
import eu.pb4.polymer.blocks.api.PolymerTexturedBlock;
|
||||||
|
import eu.pb4.polymer.core.api.block.SimplePolymerBlock;
|
||||||
import net.fabricmc.fabric.api.event.player.UseBlockCallback;
|
import net.fabricmc.fabric.api.event.player.UseBlockCallback;
|
||||||
import net.minecraft.block.*;
|
import net.minecraft.block.*;
|
||||||
import net.minecraft.block.entity.BlockEntity;
|
import net.minecraft.block.entity.BlockEntity;
|
||||||
@ -24,7 +25,6 @@ import net.minecraft.util.hit.BlockHitResult;
|
|||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import systems.brn.server_storage.ServerStorage;
|
|
||||||
import systems.brn.server_storage.blockentities.StorageBlockEntity;
|
import systems.brn.server_storage.blockentities.StorageBlockEntity;
|
||||||
import systems.brn.server_storage.screens.StorageScreen;
|
import systems.brn.server_storage.screens.StorageScreen;
|
||||||
|
|
||||||
@ -33,21 +33,23 @@ import java.util.List;
|
|||||||
import static systems.brn.server_storage.ServerStorage.*;
|
import static systems.brn.server_storage.ServerStorage.*;
|
||||||
import static systems.brn.server_storage.lib.Util.generateBookContent;
|
import static systems.brn.server_storage.lib.Util.generateBookContent;
|
||||||
|
|
||||||
public class StorageBlock extends Block implements PolymerTexturedBlock, BlockEntityProvider {
|
public class StorageBlock extends SimplePolymerBlock implements PolymerTexturedBlock, BlockEntityProvider {
|
||||||
|
final Identifier identifier;
|
||||||
|
|
||||||
public StorageBlock(Settings settings, BlockModelType type, String modelId) {
|
public StorageBlock(Settings settings, Identifier identifier) {
|
||||||
super(settings);
|
super(settings, Blocks.NOTE_BLOCK);
|
||||||
|
this.identifier = identifier;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BlockState getPolymerBlockState(BlockState state) {
|
public BlockState getPolymerBlockState(BlockState state) {
|
||||||
return PolymerBlockResourceUtils.requestBlock(BlockModelType.FULL_BLOCK, PolymerBlockModel.of(Identifier.of(MOD_ID, STORAGE_MODEL_ID)));
|
return PolymerBlockResourceUtils.requestBlock(BlockModelType.FULL_BLOCK, PolymerBlockModel.of(identifier));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void register() {
|
public static void register() {
|
||||||
var modId = id(STORAGE_MODEL_ID);
|
var modId = id(STORAGE_MODEL_ID);
|
||||||
STORAGE_BLOCK = Registry.register(Registries.BLOCK, modId,
|
STORAGE_BLOCK = Registry.register(Registries.BLOCK, modId,
|
||||||
new StorageBlock(AbstractBlock.Settings.copy(Blocks.WHITE_WOOL), BlockModelType.FULL_BLOCK, ServerStorage.STORAGE_MODEL_ID));
|
new StorageBlock(AbstractBlock.Settings.copy(Blocks.WHITE_WOOL), modId));
|
||||||
UseBlockCallback.EVENT.register(StorageBlock::onUse);
|
UseBlockCallback.EVENT.register(StorageBlock::onUse);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,25 +1,28 @@
|
|||||||
package systems.brn.server_storage.items;
|
package systems.brn.server_storage.items;
|
||||||
|
|
||||||
|
import eu.pb4.polymer.core.api.item.PolymerBlockItem;
|
||||||
import eu.pb4.polymer.core.api.item.PolymerItem;
|
import eu.pb4.polymer.core.api.item.PolymerItem;
|
||||||
import eu.pb4.polymer.resourcepack.api.PolymerModelData;
|
import eu.pb4.polymer.resourcepack.api.PolymerModelData;
|
||||||
import eu.pb4.polymer.resourcepack.api.PolymerResourcePackUtils;
|
import eu.pb4.polymer.resourcepack.api.PolymerResourcePackUtils;
|
||||||
import net.fabricmc.fabric.api.itemgroup.v1.ItemGroupEvents;
|
import net.fabricmc.fabric.api.itemgroup.v1.ItemGroupEvents;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.item.*;
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.item.ItemGroups;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.item.Items;
|
||||||
import net.minecraft.registry.Registries;
|
import net.minecraft.registry.Registries;
|
||||||
import net.minecraft.registry.Registry;
|
import net.minecraft.registry.Registry;
|
||||||
import net.minecraft.server.network.ServerPlayerEntity;
|
import net.minecraft.server.network.ServerPlayerEntity;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import systems.brn.server_storage.ServerStorage;
|
|
||||||
|
|
||||||
import static systems.brn.server_storage.ServerStorage.*;
|
import static systems.brn.server_storage.ServerStorage.id;
|
||||||
|
|
||||||
public class SimpleBlockItem extends BlockItem implements PolymerItem {
|
public class SimpleBlockItem extends PolymerBlockItem implements PolymerItem {
|
||||||
private final PolymerModelData polymerModel;
|
private final PolymerModelData polymerModel;
|
||||||
|
|
||||||
public SimpleBlockItem(Item.Settings settings, Block block, Identifier identifier) {
|
public SimpleBlockItem(Item.Settings settings, Block block, Identifier identifier) {
|
||||||
super(block, settings);
|
super(block, settings, Items.BARRIER);
|
||||||
this.polymerModel = PolymerResourcePackUtils.requestModel(Items.BARRIER, identifier);
|
this.polymerModel = PolymerResourcePackUtils.requestModel(Items.BARRIER, identifier);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package systems.brn.server_storage.items;
|
package systems.brn.server_storage.items;
|
||||||
|
|
||||||
import eu.pb4.polymer.core.api.item.PolymerItem;
|
import eu.pb4.polymer.core.api.item.PolymerItem;
|
||||||
|
import eu.pb4.polymer.core.api.item.SimplePolymerItem;
|
||||||
import eu.pb4.polymer.resourcepack.api.PolymerModelData;
|
import eu.pb4.polymer.resourcepack.api.PolymerModelData;
|
||||||
import eu.pb4.polymer.resourcepack.api.PolymerResourcePackUtils;
|
import eu.pb4.polymer.resourcepack.api.PolymerResourcePackUtils;
|
||||||
import net.fabricmc.fabric.api.itemgroup.v1.ItemGroupEvents;
|
import net.fabricmc.fabric.api.itemgroup.v1.ItemGroupEvents;
|
||||||
@ -15,13 +16,12 @@ import net.minecraft.util.Identifier;
|
|||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
import static systems.brn.server_storage.ServerStorage.id;
|
import static systems.brn.server_storage.ServerStorage.id;
|
||||||
import static systems.brn.server_storage.ServerStorage.tiers;
|
|
||||||
|
|
||||||
public class SimpleItem extends Item implements PolymerItem {
|
public class SimpleItem extends SimplePolymerItem implements PolymerItem {
|
||||||
private final PolymerModelData polymerModel;
|
private final PolymerModelData polymerModel;
|
||||||
|
|
||||||
public SimpleItem(Settings settings, Identifier identifier) {
|
public SimpleItem(Settings settings, Identifier identifier) {
|
||||||
super(settings);
|
super(settings, Items.BARRIER);
|
||||||
this.polymerModel = PolymerResourcePackUtils.requestModel(Items.BARRIER, identifier);
|
this.polymerModel = PolymerResourcePackUtils.requestModel(Items.BARRIER, identifier);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user