Skip to content

Commit

Permalink
fix multiple crashes
Browse files Browse the repository at this point in the history
  • Loading branch information
tristankechlo committed Jul 29, 2024
1 parent c6cc46a commit 8dc12de
Show file tree
Hide file tree
Showing 13 changed files with 16 additions and 45 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -208,9 +208,9 @@ public void refreshDimensions() {
@Override
protected EntityDimensions getDefaultDimensions(Pose pose) {
if (this.isBaby()) {
return super.getDimensions(pose);
return super.getDefaultDimensions(pose);
}
return super.getDimensions(pose).scale(0.85F + (0.1F * this.getScaling()));
return super.getDefaultDimensions(pose).scale(0.85F + (0.1F * this.getScaling()));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import com.tristankechlo.livingthings.LivingThings;
import com.tristankechlo.livingthings.platform.RegistrationProvider;
import com.tristankechlo.livingthings.platform.RegistryObject;
import net.minecraft.core.registries.Registries;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.world.item.ArmorItem;
import net.minecraft.world.item.ArmorMaterial;
import net.minecraft.world.item.Items;
Expand All @@ -17,7 +17,7 @@ public final class ModArmorMaterial {

public static void init() {}

private static final RegistrationProvider<ArmorMaterial> MATERIALS = RegistrationProvider.get(Registries.ARMOR_MATERIAL, LivingThings.MOD_ID);
private static final RegistrationProvider<ArmorMaterial> MATERIALS = RegistrationProvider.get(BuiltInRegistries.ARMOR_MATERIAL, LivingThings.MOD_ID);

public static final RegistryObject<ArmorMaterial> ANCIENT = MATERIALS.register("ancient", ModArmorMaterial::makeMaterial);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
import com.tristankechlo.livingthings.block.OstrichNestBlock;
import com.tristankechlo.livingthings.platform.RegistrationProvider;
import com.tristankechlo.livingthings.platform.RegistryObject;
import net.minecraft.core.registries.Registries;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.world.item.BlockItem;
import net.minecraft.world.level.block.Block;

public final class ModBlocks {

public static void init() {}

private static final RegistrationProvider<Block> BLOCKS = RegistrationProvider.get(Registries.BLOCK, LivingThings.MOD_ID);
private static final RegistrationProvider<Block> BLOCKS = RegistrationProvider.get(BuiltInRegistries.BLOCK, LivingThings.MOD_ID);

//BLOCKS
public static final RegistryObject<Block> OSTRICH_NEST = BLOCKS.register("ostrich_nest", OstrichNestBlock::new);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import com.tristankechlo.livingthings.entity.projectile.ThrownOstrichEgg;
import com.tristankechlo.livingthings.platform.RegistrationProvider;
import com.tristankechlo.livingthings.platform.RegistryObject;
import net.minecraft.core.registries.Registries;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.MobCategory;
Expand All @@ -14,7 +14,7 @@ public final class ModEntityTypes {

public static void init() {}

private static final RegistrationProvider<EntityType<?>> ENTITY_TYPES = RegistrationProvider.get(Registries.ENTITY_TYPE, LivingThings.MOD_ID);
private static final RegistrationProvider<EntityType<?>> ENTITY_TYPES = RegistrationProvider.get(BuiltInRegistries.ENTITY_TYPE, LivingThings.MOD_ID);

public static final RegistryObject<EntityType<ElephantEntity>> ELEPHANT = ENTITY_TYPES.register("elephant", () -> create("elephant", ElephantEntity::new, MobCategory.CREATURE, 1.85F, 2.7F, 0.85F));
public static final RegistryObject<EntityType<GiraffeEntity>> GIRAFFE = ENTITY_TYPES.register("giraffe", () -> create("giraffe", GiraffeEntity::new, MobCategory.CREATURE, 1.5F, 3.2F, 0.98F));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import com.tristankechlo.livingthings.platform.IPlatformHelper;
import com.tristankechlo.livingthings.platform.RegistrationProvider;
import com.tristankechlo.livingthings.platform.RegistryObject;
import net.minecraft.core.registries.Registries;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.sounds.SoundEvents;
import net.minecraft.world.item.ArmorItem;
import net.minecraft.world.item.Item;
Expand All @@ -20,7 +20,7 @@ public final class ModItems {

public static void init() {}

public static final RegistrationProvider<Item> ITEMS = RegistrationProvider.get(Registries.ITEM, LivingThings.MOD_ID);
public static final RegistrationProvider<Item> ITEMS = RegistrationProvider.get(BuiltInRegistries.ITEM, LivingThings.MOD_ID);
public static final List<RegistryObject<? extends Item>> ALL_ITEMS = new ArrayList<>();
public static final List<RegistryObject<Item>> SPAWN_EGGS;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
import com.tristankechlo.livingthings.LivingThings;
import com.tristankechlo.livingthings.platform.RegistrationProvider;
import com.tristankechlo.livingthings.platform.RegistryObject;
import net.minecraft.core.registries.Registries;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.sounds.SoundEvent;

public final class ModSounds {

public static void init() {}

private static final RegistrationProvider<SoundEvent> SOUNDS = RegistrationProvider.get(Registries.SOUND_EVENT, LivingThings.MOD_ID);
private static final RegistrationProvider<SoundEvent> SOUNDS = RegistrationProvider.get(BuiltInRegistries.SOUND_EVENT, LivingThings.MOD_ID);

public static final RegistryObject<SoundEvent> LION_AMBIENT = registerSound("lion.ambient");
public static final RegistryObject<SoundEvent> LION_HURT = registerSound("lion.hurt");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import net.minecraft.ChatFormatting;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.MutableComponent;
import net.minecraft.network.protocol.game.ClientboundSetSubtitleTextPacket;
import net.minecraft.network.protocol.game.ClientboundSetTitleTextPacket;
import net.minecraft.resources.ResourceLocation;
Expand All @@ -27,6 +28,7 @@
public class LexiconItem extends Item {

private static final String URL = "https://github.com/tristankechlo/Living-Things/wiki";
private static final MutableComponent SUBTITLE = Component.literal("2nd Edition").withStyle(ChatFormatting.GRAY);

public LexiconItem(Properties properties) {
super(properties);
Expand Down Expand Up @@ -82,16 +84,7 @@ public InteractionResult useOn(UseOnContext context) {
public void appendHoverText(ItemStack stack, TooltipContext context, List<Component> tooltip, TooltipFlag flagIn) {
super.appendHoverText(stack, context, tooltip, flagIn);
// add the subtitle for the item
tooltip.add(getEdition().plainCopy().withStyle(ChatFormatting.GRAY));
}

public static Component getEdition() {
if (IPlatformHelper.INSTANCE.isModLoaded("patchouli")) {
ResourceLocation book = BuiltInRegistries.ITEM.getKey(ModItems.LEXICON.get());
return IPlatformHelper.INSTANCE.getPatchouliSubtitle(book);
}

return Component.literal("2nd Edition");
tooltip.add(SUBTITLE);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ default String getEnvironmentName() {

Path getConfigDirectory();

Component getPatchouliSubtitle(ResourceLocation bookId);

void openBookEntry(ResourceLocation bookId, ResourceLocation entryId, int page);

void openBookGui(ServerPlayer player, ResourceLocation bookId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,6 @@ public Path getConfigDirectory() {
return FabricLoader.getInstance().getConfigDir();
}

@Override
public Component getPatchouliSubtitle(ResourceLocation bookId) {
return vazkii.patchouli.api.PatchouliAPI.get().getSubtitle(bookId);
}

@Override
public void openBookEntry(ResourceLocation bookId, ResourceLocation entryId, int page) {
vazkii.patchouli.api.PatchouliAPI.get().openBookEntry(bookId, entryId, page);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.tristankechlo.livingthings;

import com.mojang.serialization.Codec;
import com.mojang.serialization.MapCodec;
import com.tristankechlo.livingthings.commands.LivingThingsCommand;
import com.tristankechlo.livingthings.config.ConfigManager;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,6 @@ public Path getConfigDirectory() {
return FMLPaths.CONFIGDIR.get();
}

@Override
public Component getPatchouliSubtitle(ResourceLocation bookId) {
// Patchouli no longer available for Forge
return Component.literal("2nd Edition");
}

@Override
public void openBookEntry(ResourceLocation bookId, ResourceLocation entryId, int page) {
// Patchouli no longer available for Forge
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
package com.tristankechlo.livingthings;

import com.mojang.serialization.MapCodec;
import com.tristankechlo.livingthings.util.LivingThingsBiomeModifier;
import com.mojang.serialization.Codec;
import com.tristankechlo.livingthings.commands.LivingThingsCommand;
import com.tristankechlo.livingthings.config.ConfigManager;
import com.tristankechlo.livingthings.events.BlockEvents;
import com.tristankechlo.livingthings.util.LivingThingsBiomeModifier;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.player.Player;
import net.neoforged.bus.api.IEventBus;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

import com.tristankechlo.livingthings.entity.SeahorseEntity;
import com.tristankechlo.livingthings.init.ModItems;
import com.tristankechlo.livingthings.platform.IPlatformHelper;
import com.tristankechlo.livingthings.platform.RegistryObject;
import net.minecraft.core.registries.Registries;
import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceLocation;
Expand Down Expand Up @@ -52,11 +50,6 @@ public Path getConfigDirectory() {
return FMLPaths.CONFIGDIR.get();
}

@Override
public Component getPatchouliSubtitle(ResourceLocation bookId) {
return vazkii.patchouli.api.PatchouliAPI.get().getSubtitle(bookId);
}

@Override
public void openBookEntry(ResourceLocation bookId, ResourceLocation entryId, int page) {
vazkii.patchouli.api.PatchouliAPI.get().openBookEntry(bookId, entryId, page);
Expand Down

0 comments on commit 8dc12de

Please sign in to comment.