Skip to content

Commit

Permalink
Update to 1.21.2/1.21.3
Browse files Browse the repository at this point in the history
  • Loading branch information
DragonEggBedrockBreaking committed Oct 28, 2024
1 parent 6884b62 commit e551d92
Show file tree
Hide file tree
Showing 33 changed files with 223 additions and 238 deletions.
10 changes: 5 additions & 5 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ val MAVEN_GROUP by extra { "uk.debb" }
val LICENSE by extra { "MPL-2.0" }
val MOD_VERSION by extra { "4.0.3" }

val MINECRAFT_VERSION by extra { "1.21.1" }
val MINECRAFT_VERSION_RANGE_FABRIC by extra { ">=1.21" }
val MINECRAFT_VERSION_RANGE_NEOFORGE by extra { "[1.21,1.22)" }
val MINECRAFT_VERSION by extra { "1.21.3" }
val MINECRAFT_VERSION_RANGE_FABRIC by extra { ">=1.21.2" }
val MINECRAFT_VERSION_RANGE_NEOFORGE by extra { "[1.21.2,1.22)" }
val H2_VERSION by extra { "2.3.232" }
val ASM_VERSION by extra { "9.7.1" }
val PARCHMENT_MC_VERSION by extra { "1.21" }
Expand All @@ -25,8 +25,8 @@ val MIXIN_EXTRAS_VERSION by extra { "0.4.1" }
val FABRIC_MIXIN_VERSION by extra { "0.15.4+mixin.0.8.7" }
val FABRIC_LOADER_VERSION by extra { "0.16.8" }
val FABRIC_LOADER_VERSION_RANGE by extra { ">=0.15.10" }
val NEOFORGE_VERSION by extra { "21.1.72"}
val NEOFORGE_LOADER_VERSION_RANGE by extra { ">=21.1.0" }
val NEOFORGE_VERSION by extra { "21.3.4-beta"}
val NEOFORGE_LOADER_VERSION_RANGE by extra { ">=21.2.0-beta" }

allprojects {
apply(plugin = "java")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,16 @@
import net.minecraft.server.MinecraftServer;
import net.minecraft.stats.StatType;
import net.minecraft.stats.Stats;
import net.minecraft.tags.ItemTags;
import net.minecraft.world.damagesource.DamageType;
import net.minecraft.world.effect.MobEffect;
import net.minecraft.world.effect.MobEffects;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.MobCategory;
import net.minecraft.world.entity.*;
import net.minecraft.world.entity.animal.Animal;
import net.minecraft.world.entity.decoration.PaintingVariant;
import net.minecraft.world.entity.npc.Villager;
import net.minecraft.world.entity.npc.VillagerProfession;
import net.minecraft.world.entity.npc.VillagerType;
import net.minecraft.world.entity.vehicle.AbstractBoat;
import net.minecraft.world.food.FoodProperties;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
Expand All @@ -42,8 +40,8 @@
import net.minecraft.world.item.enchantment.Enchantment;
import net.minecraft.world.level.biome.Biome;
import net.minecraft.world.level.block.*;
import net.minecraft.world.level.block.entity.AbstractFurnaceBlockEntity;
import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraft.world.level.block.entity.FuelValues;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.levelgen.placement.PlacedFeature;
import net.minecraft.world.level.levelgen.structure.Structure;
Expand All @@ -52,7 +50,6 @@

import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.Objects;

import static uk.debb.vanilla_disable.config.data.DataType.*;
Expand Down Expand Up @@ -87,22 +84,22 @@ public class DataDefinitions {

public static void populateRegistries() {
RegistryAccess registryAccess = server.registryAccess();
blockRegistry = registryAccess.registryOrThrow(Registries.BLOCK);
biomeRegistry = registryAccess.registryOrThrow(Registries.BIOME);
blockEntityRegistry = registryAccess.registryOrThrow(Registries.BLOCK_ENTITY_TYPE);
customStatRegistry = registryAccess.registryOrThrow(Registries.CUSTOM_STAT);
damageTypeRegistry = registryAccess.registryOrThrow(Registries.DAMAGE_TYPE);
enchantmentRegistry = registryAccess.registryOrThrow(Registries.ENCHANTMENT);
entityTypeRegistry = registryAccess.registryOrThrow(Registries.ENTITY_TYPE);
itemRegistry = registryAccess.registryOrThrow(Registries.ITEM);
mobEffectRegistry = registryAccess.registryOrThrow(Registries.MOB_EFFECT);
paintingVariantRegistry = registryAccess.registryOrThrow(Registries.PAINTING_VARIANT);
placedFeatureRegistry = registryAccess.registryOrThrow(Registries.PLACED_FEATURE);
potionRegistry = registryAccess.registryOrThrow(Registries.POTION);
statTypeRegistry = registryAccess.registryOrThrow(Registries.STAT_TYPE);
structureRegistry = registryAccess.registryOrThrow(Registries.STRUCTURE);
villagerProfessionRegistry = registryAccess.registryOrThrow(Registries.VILLAGER_PROFESSION);
villagerTypeRegistry = registryAccess.registryOrThrow(Registries.VILLAGER_TYPE);
blockRegistry = registryAccess.lookupOrThrow(Registries.BLOCK);
biomeRegistry = registryAccess.lookupOrThrow(Registries.BIOME);
blockEntityRegistry = registryAccess.lookupOrThrow(Registries.BLOCK_ENTITY_TYPE);
customStatRegistry = registryAccess.lookupOrThrow(Registries.CUSTOM_STAT);
damageTypeRegistry = registryAccess.lookupOrThrow(Registries.DAMAGE_TYPE);
enchantmentRegistry = registryAccess.lookupOrThrow(Registries.ENCHANTMENT);
entityTypeRegistry = registryAccess.lookupOrThrow(Registries.ENTITY_TYPE);
itemRegistry = registryAccess.lookupOrThrow(Registries.ITEM);
mobEffectRegistry = registryAccess.lookupOrThrow(Registries.MOB_EFFECT);
paintingVariantRegistry = registryAccess.lookupOrThrow(Registries.PAINTING_VARIANT);
placedFeatureRegistry = registryAccess.lookupOrThrow(Registries.PLACED_FEATURE);
potionRegistry = registryAccess.lookupOrThrow(Registries.POTION);
statTypeRegistry = registryAccess.lookupOrThrow(Registries.STAT_TYPE);
structureRegistry = registryAccess.lookupOrThrow(Registries.STRUCTURE);
villagerProfessionRegistry = registryAccess.lookupOrThrow(Registries.VILLAGER_PROFESSION);
villagerTypeRegistry = registryAccess.lookupOrThrow(Registries.VILLAGER_TYPE);
}

public static void populateCols() {
Expand Down Expand Up @@ -306,7 +303,7 @@ private static void populateRows() {
put(Objects.requireNonNull(entityTypeRegistry.getKey(entityType)).toString(), new Object2ObjectOpenHashMap<>() {{
Entity entity = null;
if (!entityType.equals(EntityType.ENDER_DRAGON)) {
entity = entityType.create(server.overworld());
entity = entityType.create(server.overworld(), EntitySpawnReason.COMMAND);
}

put("can_player_interact", "true");
Expand Down Expand Up @@ -376,7 +373,7 @@ private static void populateRows() {
villagerTypeRegistry.keySet().forEach(type -> put(lightCleanup(type) + "_type", "true"));
put("can_breed", "true");
itemRegistry.forEach(item -> {
boolean villagerWants = Villager.WANTED_ITEMS.contains(item);
boolean villagerWants = item.getDefaultInstance().is(ItemTags.VILLAGER_PICKS_UP);
put("can_breed_with_" +
lightCleanup(Objects.requireNonNull(itemRegistry.getKey(item)).toString()),
String.valueOf(villagerWants));
Expand Down Expand Up @@ -431,7 +428,7 @@ private static void populateRows() {

put("can_exist", "true");

if (entityType.equals(EntityType.BOAT)) {
if (entity instanceof AbstractBoat) {
put("alpha_behaviour", "false");
}

Expand Down Expand Up @@ -561,6 +558,7 @@ private static void populateRows() {
put("can_be_placed_by_command", "true");
}}));
}});
FuelValues fuelValues = server.overworld().fuelValues();
rowData.put("items", new Object2ObjectOpenHashMap<>() {{
itemRegistry.forEach((item) ->
put(Objects.requireNonNull(itemRegistry.getKey(item)).toString(), new Object2ObjectOpenHashMap<>() {{
Expand Down Expand Up @@ -602,8 +600,7 @@ private static void populateRows() {
put("cauldron_interaction", "true");
}

Map<Item, Integer> fuels = AbstractFurnaceBlockEntity.getFuel();
put("fuel_duration", String.valueOf(fuels.getOrDefault(item, 0)));
put("fuel_duration", String.valueOf(fuelValues.values.getOrDefault(item, 0)));

put("can_break_blocks_in_creative", String.valueOf(!(item instanceof SwordItem)));
put("can_be_given_by_command", "true");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,13 @@ private static boolean hasBiome(ResourceKey<Level> level, Holder<Biome> biome) {
}

public static Holder<Biome> getDefaultBiome(Holder<Biome> biome) {
if (server == null) return biomeRegistry.getHolderOrThrow(Biomes.PLAINS);
if (server == null) return Holder.direct(biomeRegistry.getValueOrThrow(Biomes.PLAINS));
if (hasBiome(Level.NETHER, biome)) {
return biomeRegistry.getHolderOrThrow(Biomes.NETHER_WASTES);
return Holder.direct(biomeRegistry.getValueOrThrow(Biomes.NETHER_WASTES));
} else if (hasBiome(Level.END, biome)) {
return biomeRegistry.getHolderOrThrow(Biomes.THE_END);
return Holder.direct(biomeRegistry.getValueOrThrow(Biomes.THE_END));
}
return biomeRegistry.getHolderOrThrow(Biomes.PLAINS);
return Holder.direct(biomeRegistry.getValueOrThrow(Biomes.PLAINS));
}

public static Holder<Biome> getBiome(Holder<Biome> original) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import java.sql.*;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.Scanner;
import java.util.stream.Collectors;

Expand Down Expand Up @@ -229,8 +229,9 @@ private static List<ItemStack> getRawBreedingItems(String row) {
String columnName = resultSetMetaData.getColumnName(i);
if (columnName.startsWith("can_breed_with_")) {
if (resultSet.getBoolean(columnName)) {
items.add(Objects.requireNonNull(itemRegistry.get(ResourceLocation.bySeparator(
columnName.replace("can_breed_with_", "minecraft:"), ':'))));
Optional<Item> item = itemRegistry.getOptional(ResourceLocation.bySeparator(
columnName.replace("can_breed_with_", "minecraft:"), ':'));
item.ifPresent(items::add);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ public WorldgenConfigScreen(CreateWorldScreen lastScreen) {
@Override
protected void init() {
RegistryAccess.Frozen registryAccess = this.lastScreen.getUiState().getSettings().worldgenRegistries().compositeAccess();
DataDefinitions.biomeRegistry = registryAccess.registryOrThrow(Registries.BIOME);
DataDefinitions.structureRegistry = registryAccess.registryOrThrow(Registries.STRUCTURE);
DataDefinitions.placedFeatureRegistry = registryAccess.registryOrThrow(Registries.PLACED_FEATURE);
DataDefinitions.biomeRegistry = registryAccess.lookupOrThrow(Registries.BIOME);
DataDefinitions.structureRegistry = registryAccess.lookupOrThrow(Registries.STRUCTURE);
DataDefinitions.placedFeatureRegistry = registryAccess.lookupOrThrow(Registries.PLACED_FEATURE);

tabNavigationBar = TabNavigationBar.builder(this.tabManager, this.width)
.addTabs(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@

@Mixin(RedStoneWireBlock.class)
public abstract class MixinRedstoneWireBlock {
@ModifyReturnValue(method = "getWireSignal", at = @At("RETURN"))
private int vanillaDisable$getWireSignal(int original) {
@ModifyReturnValue(method = "getBlockSignal", at = @At("RETURN"))
private int vanillaDisable$getBlockSignal(int original) {
if (!SqlManager.getBoolean("blocks", "minecraft:redstone_wire", "works")) {
return 0;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.ItemInteractionResult;
import net.minecraft.world.MenuProvider;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
Expand Down Expand Up @@ -40,12 +39,12 @@ public abstract class MixinBlockStateBase {
}

@WrapMethod(method = "useItemOn")
private ItemInteractionResult vanillaDisable$useItemOn(ItemStack stack, Level level, Player player, InteractionHand hand, BlockHitResult hitResult, Operation<ItemInteractionResult> original) {
private InteractionResult vanillaDisable$useItemOn(ItemStack stack, Level level, Player player, InteractionHand hand, BlockHitResult hitResult, Operation<InteractionResult> original) {
String block = DataUtils.getKeyFromBlockRegistry(this.getBlock());
if (SqlManager.getBoolean("blocks", block, "can_interact")) {
return original.call(stack, level, player, hand, hitResult);
}
return ItemInteractionResult.FAIL;
return InteractionResult.FAIL;
}

@ModifyReturnValue(method = "getMenuProvider", at = @At("RETURN"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public abstract class MixinObserverBlock {
method = "startSignal",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/world/level/LevelAccessor;scheduleTick(Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/Block;I)V"
target = "Lnet/minecraft/world/level/ScheduledTickAccess;scheduleTick(Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/Block;I)V"
),
index = 2
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public abstract class MixinBlock {
method = "getDrops(Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/server/level/ServerLevel;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/entity/BlockEntity;Lnet/minecraft/world/entity/Entity;Lnet/minecraft/world/item/ItemStack;)Ljava/util/List;",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/world/level/storage/loot/LootParams$Builder;withParameter(Lnet/minecraft/world/level/storage/loot/parameters/LootContextParam;Ljava/lang/Object;)Lnet/minecraft/world/level/storage/loot/LootParams$Builder;",
target = "Lnet/minecraft/world/level/storage/loot/LootParams$Builder;withParameter(Lnet/minecraft/util/context/ContextKey;Ljava/lang/Object;)Lnet/minecraft/world/level/storage/loot/LootParams$Builder;",
ordinal = 1
),
index = 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,26 @@

package uk.debb.vanilla_disable.mixin.feature.entity.breeding;

import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
import com.llamalad7.mixinextras.injector.ModifyReturnValue;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.entity.npc.Villager;
import net.minecraft.world.entity.npc.VillagerData;
import net.minecraft.world.item.ItemStack;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import uk.debb.vanilla_disable.config.data.DataUtils;
import uk.debb.vanilla_disable.config.data.SqlManager;

@Mixin(Villager.class)
public abstract class MixinVillager {
@ModifyExpressionValue(
method = "wantsToPickUp",
at = @At(
value = "INVOKE",
target = "Ljava/util/Set;contains(Ljava/lang/Object;)Z"
)
)
private boolean vanillaDisable$contains(boolean original, ItemStack stack) {
String name = "can_breed_with_" + DataUtils.lightCleanup(DataUtils.getKeyFromItemRegistry(stack.getItem()));
return SqlManager.getBoolean("entities", "minecraft:villager", name)
&& ((Villager) (Object) this).getInventory().canAddItem(stack);
@Shadow public abstract VillagerData getVillagerData();

@ModifyReturnValue(method = "wantsToPickUp", at = @At("RETURN"))
private boolean vanillaDisable$wantsToPickUp(boolean original, ServerLevel serverLevel, ItemStack itemStack) {
String name = "can_breed_with_" + DataUtils.lightCleanup(DataUtils.getKeyFromItemRegistry(itemStack.getItem()));
return (SqlManager.getBoolean("entities", "minecraft:villager", name) ||
this.getVillagerData().getProfession().requestedItems().contains(itemStack.getItem())) &&
((Villager) (Object) this).getInventory().canAddItem(itemStack);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import com.llamalad7.mixinextras.injector.wrapmethod.WrapMethod;
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.LivingEntity;
import org.spongepowered.asm.mixin.Mixin;
Expand All @@ -17,10 +18,10 @@
@Mixin(LivingEntity.class)
public abstract class MixinLivingEntity {
@WrapMethod(method = "dropExperience")
private void vanillaDisable$dropExperience(Entity entity, Operation<Void> original) {
private void vanillaDisable$dropExperience(ServerLevel serverLevel, Entity entity, Operation<Void> original) {
String entity_str = DataUtils.getKeyFromEntityTypeRegistry(((LivingEntity) (Object) this).getType());
if (SqlManager.getBoolean("entities", entity_str, "can_drop_xp")) {
original.call(entity);
original.call(serverLevel, entity);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
package uk.debb.vanilla_disable.mixin.feature.entity.other;

import com.llamalad7.mixinextras.injector.v2.WrapWithCondition;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.boss.enderdragon.phases.DragonStrafePlayerPhase;
import net.minecraft.world.level.Level;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import uk.debb.vanilla_disable.config.data.SqlManager;
Expand All @@ -20,10 +20,10 @@ public abstract class MixinDragonStrafePlayerPhase {
method = "doServerTick",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/world/level/Level;addFreshEntity(Lnet/minecraft/world/entity/Entity;)Z"
target = "Lnet/minecraft/server/level/ServerLevel;addFreshEntity(Lnet/minecraft/world/entity/Entity;)Z"
)
)
private boolean vanillaDisable$addFreshEntity(Level instance, Entity entity) {
private boolean vanillaDisable$addFreshEntity(ServerLevel instance, Entity entity) {
return SqlManager.getBoolean("entities", "minecraft:ender_dragon", "can_shoot_fireballs");
}
}
Loading

0 comments on commit e551d92

Please sign in to comment.