Skip to content

Commit

Permalink
fix signs and enchantments
Browse files Browse the repository at this point in the history
  • Loading branch information
MBatt1 committed Oct 9, 2024
1 parent 841db6a commit f91ba1f
Show file tree
Hide file tree
Showing 18 changed files with 144 additions and 53 deletions.
Original file line number Diff line number Diff line change
@@ -1,22 +1,18 @@
package net.id.paradiselost.blocks.blockentity;

import net.minecraft.block.BlockState;
import net.minecraft.block.entity.BlockEntityType;
import net.minecraft.block.entity.HangingSignBlockEntity;
import net.minecraft.block.entity.SignBlockEntity;
import net.minecraft.util.math.BlockPos;

public class ParadiseHangingSignBlockEntity extends SignBlockEntity {
private static final int MAX_TEXT_WIDTH = 60;
private static final int TEXT_LINE_HEIGHT = 9;
public class ParadiseHangingSignBlockEntity extends HangingSignBlockEntity {

public ParadiseHangingSignBlockEntity(BlockPos blockPos, BlockState blockState) {
super(ParadiseLostBlockEntityTypes.HANGING_SIGN, blockPos, blockState);
super(blockPos, blockState);
}

public int getTextLineHeight() {
return 9;
}

public int getMaxTextWidth() {
return 60;
@Override
public BlockEntityType<?> getType() {
return ParadiseLostBlockEntityTypes.HANGING_SIGN;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ public ParadiseSignBlockEntity(BlockPos pos, BlockState state) {
super(ParadiseLostBlockEntityTypes.SIGN, pos, state);
}

public ParadiseSignBlockEntity(BlockEntityType blockEntityType, BlockPos blockPos, BlockState blockState) {
super(blockEntityType, blockPos, blockState);
@Override
public BlockEntityType<?> getType() {
return ParadiseLostBlockEntityTypes.SIGN;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@
import net.minecraft.block.HangingSignBlock;
import net.minecraft.block.WoodType;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.loot.LootTable;
import net.minecraft.registry.Registries;
import net.minecraft.registry.RegistryKey;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.BlockPos;

Expand All @@ -14,9 +17,10 @@ public ParadiseHangingSignBlock(Settings settings, WoodType woodType) {
super(woodType, settings);
}

// public BlockEntity createBlockEntity(BlockPos pos, BlockState state) {
// Identifier identifier = Registries.BLOCK.getId(this.asBlock()); // this is stupid
// this.lootTableId = identifier.withPrefixedPath("blocks/");
// return new ParadiseHangingSignBlockEntity(pos, state);
// }
public BlockEntity createBlockEntity(BlockPos pos, BlockState state) {
Identifier identifier = Registries.BLOCK.getId(this.asBlock()); // this is stupid
this.lootTableKey = RegistryKey.of(RegistryKeys.LOOT_TABLE, identifier.withPrefixedPath("blocks/"));
return new ParadiseHangingSignBlockEntity(pos, state);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,23 @@
import net.minecraft.block.SignBlock;
import net.minecraft.block.WoodType;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.block.entity.SignBlockEntity;
import net.minecraft.registry.Registries;
import net.minecraft.registry.RegistryKey;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.BlockPos;

public class ParadiseSignBlock extends SignBlock {

public ParadiseSignBlock(Settings settings, WoodType woodType) {
super(woodType, settings);
// this.lootTableId = null;
}

// public BlockEntity createBlockEntity(BlockPos pos, BlockState state) {
// Identifier identifier = Registries.BLOCK.getId(this.asBlock()); // this is stupid
// this.lootTableId = identifier.withPrefixedPath("blocks/");
// return new ParadiseSignBlockEntity(pos, state);
// }
public BlockEntity createBlockEntity(BlockPos pos, BlockState state) {
Identifier identifier = Registries.BLOCK.getId(this.asBlock()); // this is stupid
this.lootTableKey = RegistryKey.of(RegistryKeys.LOOT_TABLE, identifier.withPrefixedPath("blocks/"));
return new ParadiseSignBlockEntity(pos, state);
}

}
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
package net.id.paradiselost.blocks.decorative;

import net.id.paradiselost.blocks.blockentity.ParadiseHangingSignBlockEntity;
import net.id.paradiselost.blocks.blockentity.ParadiseSignBlockEntity;
import net.minecraft.block.BlockState;
import net.minecraft.block.WallHangingSignBlock;
import net.minecraft.block.WoodType;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.registry.Registries;
import net.minecraft.registry.RegistryKey;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.BlockPos;

Expand All @@ -15,10 +18,10 @@ public ParadiseWallHangingSignBlock(Settings settings, WoodType woodType) {
super(woodType, settings);
}

// public BlockEntity createBlockEntity(BlockPos pos, BlockState state) {
// Identifier identifier = Registries.BLOCK.getId(this.asBlock()); // this is stupid
// this.lootTableId = identifier.withPrefixedPath("blocks/");
// return new ParadiseHangingSignBlockEntity(pos, state);
// }
public BlockEntity createBlockEntity(BlockPos pos, BlockState state) {
Identifier identifier = Registries.BLOCK.getId(this.asBlock()); // this is stupid
this.lootTableKey = RegistryKey.of(RegistryKeys.LOOT_TABLE, identifier.withPrefixedPath("blocks/"));
return new ParadiseHangingSignBlockEntity(pos, state);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
import net.minecraft.block.WoodType;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.registry.Registries;
import net.minecraft.registry.RegistryKey;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.BlockPos;

Expand All @@ -14,9 +16,9 @@ public ParadiseWallSignBlock(Settings settings, WoodType woodType) {
super(woodType, settings);
}

// public BlockEntity createBlockEntity(BlockPos pos, BlockState state) {
// Identifier identifier = Registries.BLOCK.getId(this.asBlock()); // this is stupid
// this.lootTableId = identifier.withPrefixedPath("blocks/");
// return new ParadiseSignBlockEntity(pos, state);
// }
public BlockEntity createBlockEntity(BlockPos pos, BlockState state) {
Identifier identifier = Registries.BLOCK.getId(this.asBlock()); // this is stupid
this.lootTableKey = RegistryKey.of(RegistryKeys.LOOT_TABLE, identifier.withPrefixedPath("blocks/"));
return new ParadiseSignBlockEntity(pos, state);
}
}
33 changes: 21 additions & 12 deletions src/main/java/net/id/paradiselost/items/ParadiseLostItems.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import net.minecraft.item.Item.Settings;
import net.minecraft.registry.Registries;
import net.minecraft.registry.Registry;
import net.minecraft.registry.entry.RegistryEntry;
import net.minecraft.text.Text;
import net.minecraft.util.Formatting;
import net.minecraft.util.Identifier;
Expand Down Expand Up @@ -141,23 +142,31 @@ private static Settings wearable() {
private static final Settings WEARABLE = wearable();
private static final Settings RARE_WEARABLE = wearable().rarity(RARE);

private static ArmorItem armorHelper(RegistryEntry<ArmorMaterial> mat, ArmorItem.Type type, int durabilityMultiplier, Item.Settings settings) {
return new ArmorItem(mat, type, WEARABLE.maxDamage(type.getMaxDamage(durabilityMultiplier)));
}

private static ArmorItem armorHelper(RegistryEntry<ArmorMaterial> mat, ArmorItem.Type type, int durabilityMultiplier) {
return armorHelper(mat, type, durabilityMultiplier, WEARABLE);
}

// Olvite
public static final ArmorItem OLVITE_HELMET = add("olvite_helmet", new ArmorItem(ParadiseLostArmorMaterials.OLVITE, ArmorItem.Type.HELMET, WEARABLE));
public static final ArmorItem OLVITE_CHESTPLATE = add("olvite_chestplate", new ArmorItem(ParadiseLostArmorMaterials.OLVITE, ArmorItem.Type.CHESTPLATE, WEARABLE));
public static final ArmorItem OLVITE_LEGGINGS = add("olvite_leggings", new ArmorItem(ParadiseLostArmorMaterials.OLVITE, ArmorItem.Type.LEGGINGS, WEARABLE));
public static final ArmorItem OLVITE_BOOTS = add("olvite_boots", new ArmorItem(ParadiseLostArmorMaterials.OLVITE, ArmorItem.Type.BOOTS, WEARABLE));
public static final ArmorItem OLVITE_HELMET = add("olvite_helmet", armorHelper(ParadiseLostArmorMaterials.OLVITE, ArmorItem.Type.HELMET, 15));
public static final ArmorItem OLVITE_CHESTPLATE = add("olvite_chestplate", armorHelper(ParadiseLostArmorMaterials.OLVITE, ArmorItem.Type.CHESTPLATE, 15));
public static final ArmorItem OLVITE_LEGGINGS = add("olvite_leggings", armorHelper(ParadiseLostArmorMaterials.OLVITE, ArmorItem.Type.LEGGINGS, 15));
public static final ArmorItem OLVITE_BOOTS = add("olvite_boots", armorHelper(ParadiseLostArmorMaterials.OLVITE, ArmorItem.Type.BOOTS, 15));

// Glazed Gold
public static final ArmorItem GLAZED_GOLD_HELMET = add("glazed_gold_helmet", new ArmorItem(ParadiseLostArmorMaterials.GLAZED_GOLD, ArmorItem.Type.HELMET, WEARABLE));
public static final ArmorItem GLAZED_GOLD_CHESTPLATE = add("glazed_gold_chestplate", new ArmorItem(ParadiseLostArmorMaterials.GLAZED_GOLD, ArmorItem.Type.CHESTPLATE, WEARABLE));
public static final ArmorItem GLAZED_GOLD_LEGGINGS = add("glazed_gold_leggings", new ArmorItem(ParadiseLostArmorMaterials.GLAZED_GOLD, ArmorItem.Type.LEGGINGS, WEARABLE));
public static final ArmorItem GLAZED_GOLD_BOOTS = add("glazed_gold_boots", new ArmorItem(ParadiseLostArmorMaterials.GLAZED_GOLD, ArmorItem.Type.BOOTS, WEARABLE));
public static final ArmorItem GLAZED_GOLD_HELMET = add("glazed_gold_helmet", armorHelper(ParadiseLostArmorMaterials.GLAZED_GOLD, ArmorItem.Type.HELMET, 21));
public static final ArmorItem GLAZED_GOLD_CHESTPLATE = add("glazed_gold_chestplate", armorHelper(ParadiseLostArmorMaterials.GLAZED_GOLD, ArmorItem.Type.CHESTPLATE, 21));
public static final ArmorItem GLAZED_GOLD_LEGGINGS = add("glazed_gold_leggings", armorHelper(ParadiseLostArmorMaterials.GLAZED_GOLD, ArmorItem.Type.LEGGINGS, 21));
public static final ArmorItem GLAZED_GOLD_BOOTS = add("glazed_gold_boots", armorHelper(ParadiseLostArmorMaterials.GLAZED_GOLD, ArmorItem.Type.BOOTS, 21));

// Surtrum
public static final ArmorItem SURTRUM_HELMET = add("surtrum_helmet", new ArmorItem(ParadiseLostArmorMaterials.SURTRUM, ArmorItem.Type.HELMET, wearable().fireproof()));
public static final ArmorItem SURTRUM_CHESTPLATE = add("surtrum_chestplate", new ArmorItem(ParadiseLostArmorMaterials.SURTRUM, ArmorItem.Type.CHESTPLATE, wearable().fireproof()));
public static final ArmorItem SURTRUM_LEGGINGS = add("surtrum_leggings", new ArmorItem(ParadiseLostArmorMaterials.SURTRUM, ArmorItem.Type.LEGGINGS, wearable().fireproof()));
public static final ArmorItem SURTRUM_BOOTS = add("surtrum_boots", new ArmorItem(ParadiseLostArmorMaterials.SURTRUM, ArmorItem.Type.BOOTS, wearable().fireproof()));
public static final ArmorItem SURTRUM_HELMET = add("surtrum_helmet", armorHelper(ParadiseLostArmorMaterials.SURTRUM, ArmorItem.Type.HELMET, 27, wearable().fireproof()));
public static final ArmorItem SURTRUM_CHESTPLATE = add("surtrum_chestplate", armorHelper(ParadiseLostArmorMaterials.SURTRUM, ArmorItem.Type.CHESTPLATE, 27, wearable().fireproof()));
public static final ArmorItem SURTRUM_LEGGINGS = add("surtrum_leggings", armorHelper(ParadiseLostArmorMaterials.SURTRUM, ArmorItem.Type.LEGGINGS, 27, wearable().fireproof()));
public static final ArmorItem SURTRUM_BOOTS = add("surtrum_boots", armorHelper(ParadiseLostArmorMaterials.SURTRUM, ArmorItem.Type.BOOTS, 27, wearable().fireproof()));


private static Settings food() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,16 @@
import net.fabricmc.fabric.api.screenhandler.v1.ExtendedScreenHandlerType;
import net.id.paradiselost.entities.passive.moa.MoaEntity;
import net.id.paradiselost.screen.handler.MoaScreenHandler;
import net.minecraft.client.gui.screen.ingame.HandledScreen;
import net.minecraft.client.gui.screen.ingame.HandledScreens;
import net.minecraft.entity.Entity;
import net.minecraft.network.RegistryByteBuf;
import net.minecraft.network.codec.PacketCodec;
import net.minecraft.network.packet.CustomPayload;
import net.minecraft.registry.Registries;
import net.minecraft.registry.Registry;
import net.minecraft.screen.ScreenHandler;
import net.minecraft.screen.ScreenHandlerType;

import static net.id.paradiselost.ParadiseLost.locate;

Expand All @@ -33,12 +36,13 @@ public static void init() {

@Environment(EnvType.CLIENT)
public static void initClient() {
//register(MOA, MoaScreen::new);
register(MOA, MoaScreen::new);
}

@Environment(EnvType.CLIENT)
private static <T extends ScreenHandler, S extends HandledScreen<T>> void register(ScreenHandlerType<T> type, HandledScreens.Provider<T, S> factory) {
HandledScreens.register(type, factory);
}
// @Environment(EnvType.CLIENT)
// private static <T extends ScreenHandler, S extends HandledScreen<T>> void register(ScreenHandlerType<T> type, ScreenRegistry.Factory<T, S> factory) {
// ScreenRegistry.register(type, factory);
// }

private static <T extends ScreenHandler, D extends CustomPayload> ExtendedScreenHandlerType<T, D> register(String name, ExtendedScreenHandlerType.ExtendedFactory<T, D> factory, PacketCodec<RegistryByteBuf, D> codec) {
return Registry.register(Registries.SCREEN_HANDLER, locate(name), new ExtendedScreenHandlerType<>(factory, codec));
Expand Down
8 changes: 8 additions & 0 deletions src/main/resources/data/minecraft/tags/items/axes.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"replace": false,
"values": [
"paradise_lost:surtrum_axe",
"paradise_lost:glazed_gold_axe",
"paradise_lost:olvite_axe"
]
}
8 changes: 8 additions & 0 deletions src/main/resources/data/minecraft/tags/items/chest_armor.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"replace": false,
"values": [
"paradise_lost:glazed_gold_chestplate",
"paradise_lost:olvite_chestplate",
"paradise_lost:surtrum_chestplate"
]
}
2 changes: 0 additions & 2 deletions src/main/resources/data/minecraft/tags/items/fences.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
{
"replace": false,
"values": [
"#minecraft:wooden_fences",
"minecraft:nether_brick_fence",
"#paradise_lost:fences"
]
}
8 changes: 8 additions & 0 deletions src/main/resources/data/minecraft/tags/items/foot_armor.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"replace": false,
"values": [
"paradise_lost:glazed_gold_boots",
"paradise_lost:olvite_boots",
"paradise_lost:surtrum_boots"
]
}
8 changes: 8 additions & 0 deletions src/main/resources/data/minecraft/tags/items/head_armor.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"replace": false,
"values": [
"paradise_lost:glazed_gold_helmet",
"paradise_lost:olvite_helmet",
"paradise_lost:surtrum_helmet"
]
}
8 changes: 8 additions & 0 deletions src/main/resources/data/minecraft/tags/items/hoes.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"replace": false,
"values": [
"paradise_lost:surtrum_hoe",
"paradise_lost:glazed_gold_hoe",
"paradise_lost:olvite_hoe"
]
}
8 changes: 8 additions & 0 deletions src/main/resources/data/minecraft/tags/items/leg_armor.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"replace": false,
"values": [
"paradise_lost:glazed_gold_leggings",
"paradise_lost:olvite_leggings",
"paradise_lost:surtrum_leggings"
]
}
8 changes: 8 additions & 0 deletions src/main/resources/data/minecraft/tags/items/pickaxes.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"replace": false,
"values": [
"paradise_lost:surtrum_pickaxe",
"paradise_lost:glazed_gold_pickaxe",
"paradise_lost:olvite_pickaxe"
]
}
8 changes: 8 additions & 0 deletions src/main/resources/data/minecraft/tags/items/shovels.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"replace": false,
"values": [
"paradise_lost:surtrum_shovel",
"paradise_lost:glazed_gold_shovel",
"paradise_lost:olvite_shovel"
]
}
8 changes: 8 additions & 0 deletions src/main/resources/data/minecraft/tags/items/swords.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"replace": false,
"values": [
"paradise_lost:surtrum_sword",
"paradise_lost:glazed_gold_sword",
"paradise_lost:olvite_sword"
]
}

0 comments on commit f91ba1f

Please sign in to comment.