Skip to content

Commit

Permalink
Remove fallbacks
Browse files Browse the repository at this point in the history
  • Loading branch information
Matyrobbrt committed Jun 11, 2024
1 parent d1302e8 commit 00ab975
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
6 changes: 4 additions & 2 deletions patches/net/minecraft/world/entity/animal/Parrot.java.patch
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,14 @@
return getImitatedSound(list.get(p_218240_.nextInt(list.size())));
} else {
return SoundEvents.PARROT_AMBIENT;
@@ -329,6 +_,8 @@
@@ -329,7 +_,9 @@
}

private static SoundEvent getImitatedSound(EntityType<?> p_29409_) {
- return MOB_SOUND_MAP.getOrDefault(p_29409_, SoundEvents.PARROT_AMBIENT);
+ var imitation = p_29409_.builtInRegistryHolder().getData(net.neoforged.neoforge.registries.datamaps.builtin.NeoForgeDataMaps.PARROT_IMITATIONS);
+ if (imitation != null) return imitation.sound();
return MOB_SOUND_MAP.getOrDefault(p_29409_, SoundEvents.PARROT_AMBIENT);
+ return SoundEvents.PARROT_AMBIENT;
}

@Override
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
public static final int MIN_LEVEL = 0;
public static final int MAX_LEVEL = 7;
public static final IntegerProperty LEVEL = BlockStateProperties.LEVEL_COMPOSTER;
+ /** @deprecated Neo: Use the {@link net.neoforged.neoforge.registries.datamaps.builtin.NeoForgeDataMaps#COMPOSTABLES compostable} data map instead, as this field will be ignored starting with 1.20.5. */
+ /** @deprecated Neo: Use the {@link net.neoforged.neoforge.registries.datamaps.builtin.NeoForgeDataMaps#COMPOSTABLES compostable} data map instead */
+ @Deprecated
public static final Object2FloatMap<ItemLike> COMPOSTABLES = new Object2FloatOpenHashMap<>();
private static final int AABB_SIDE_THICKNESS = 2;
Expand Down Expand Up @@ -70,6 +70,6 @@
+ public static float getValue(ItemStack item) {
+ var value = item.getItemHolder().getData(net.neoforged.neoforge.registries.datamaps.builtin.NeoForgeDataMaps.COMPOSTABLES);
+ if (value != null) return value.chance();
+ return COMPOSTABLES.getFloat(item.getItem());
+ return -1f;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
static int getGameEventFrequency(ResourceKey<GameEvent> p_316800_) {
- return VIBRATION_FREQUENCY_FOR_EVENT.applyAsInt(p_316800_);
+ var holder = net.minecraft.core.registries.BuiltInRegistries.GAME_EVENT.getHolder(p_316800_);
+ return holder.isPresent() ? getGameEventFrequency(holder.get()) : VIBRATION_FREQUENCY_FOR_EVENT.applyAsInt(p_316800_);
+ return holder.map(VibrationSystem::getGameEventFrequency).orElse(0);
}

static ResourceKey<GameEvent> getResonanceEventByFrequency(int p_282105_) {

0 comments on commit 00ab975

Please sign in to comment.