disable regressed mixin and doggy pls check the commented mixins

This commit is contained in:
Taiyou06
2024-07-10 07:48:04 +03:00
parent cd9e06fea7
commit eb47da2772
5 changed files with 126 additions and 2 deletions

View File

@@ -0,0 +1,12 @@
package net.gensokyoreimagined.nitori.common.util;
import net.minecraft.world.entity.EquipmentSlot;
/**
* Pre-initialized constants to avoid unnecessary allocations.
*/
public final class EquipmentSlotConstants {
private EquipmentSlotConstants() {}
public static final EquipmentSlot[] ALL = EquipmentSlot.values();
}

View File

@@ -0,0 +1,23 @@
package net.gensokyoreimagined.nitori.mixin.alloc.enum_values.living_entity;
//import net.gensokyoreimagined.nitori.common.util.EquipmentSlotConstants;
//import net.minecraft.world.entity.EquipmentSlot;
//import net.minecraft.world.entity.LivingEntity;
//import org.spongepowered.asm.mixin.Mixin;
//import org.spongepowered.asm.mixin.injection.At;
//import org.spongepowered.asm.mixin.injection.Redirect;
//
//@Mixin(LivingEntity.class)
//public class LivingEntityMixin {
//
// @Redirect(
// method = "collectEquipmentChanges()Ljava/util/Map;",
// at = @At(
// value = "INVOKE",
// target = "Lnet/minecraft/world/entity/LivingEntity;equipmentHasChanged(Lnet/minecraft/world/item/ItemStack;Lnet/minecraft/world/item/ItemStack;)Z"
// )
// )
// private EquipmentSlot[] removeAllocation() {
// return EquipmentSlotConstants.ALL;
// }
//}

View File

@@ -0,0 +1,90 @@
package net.gensokyoreimagined.nitori.mixin.alloc.nbt;
//import com.google.common.collect.Maps;
//import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap;
//import net.minecraft.nbt.CompoundTag;
//import net.minecraft.nbt.Tag;
//import org.spongepowered.asm.mixin.Final;
//import org.spongepowered.asm.mixin.Mixin;
//import org.spongepowered.asm.mixin.Overwrite;
//import org.spongepowered.asm.mixin.Shadow;
//import org.spongepowered.asm.mixin.injection.At;
//import org.spongepowered.asm.mixin.injection.ModifyArg;
//import org.spongepowered.asm.mixin.injection.ModifyVariable;
//import org.spongepowered.asm.mixin.injection.Redirect;
//
//import java.util.HashMap;
//import java.util.Map;
//
///**
// * Use {@link Object2ObjectOpenHashMap} instead of {@link HashMap} to reduce NBT memory consumption and improve
// * iteration speed.
// *
// * @author Maity
// */
//@Mixin(CompoundTag.class)
//public class CompoundTagMixin {
//
// @Shadow
// @Final
// private Map<String, Tag> entries;
//
// @ModifyArg(
// method = "<init>()V",
// at = @At(value = "INVOKE", target = "Lnet/minecraft/nbt/CompoundTag;<init>(Ljava/util/Map;)V")
// )
// private static Map<String, Tag> useFasterCollection(Map<String, Tag> oldMap) {
// return new Object2ObjectOpenHashMap<>();
// }
//
// @Redirect(
// method = "<init>()V",
// at = @At(
// value = "INVOKE",
// target = "Lcom/google/common/collect/Maps;newHashMap()Ljava/util/HashMap;",
// remap = false
// )
// )
// private static HashMap<?, ?> removeOldMapAlloc() {
// return null;
// }
//
// /**
// * @reason Use faster collection
// * @author Maity
// */
// @Overwrite
// public CompoundTag copy() {
// // [VanillaCopy] HashMap is replaced with Object2ObjectOpenHashMap
// var map = new Object2ObjectOpenHashMap<>(Maps.transformValues(this.entries, Tag::copy));
// return new CompoundTag(map);
// }
//
// @Mixin(targets = "net.minecraft.nbt.CompoundTag$1")
// static class Type {
//
// @ModifyVariable(
// method = "loadCompound",
// at = @At(
// value = "INVOKE_ASSIGN",
// target = "Lcom/google/common/collect/Maps;newHashMap()Ljava/util/HashMap;",
// remap = false
// )
// )
// private static Map<String, Tag> useFasterCollection(Map<String, Tag> map) {
// return new Object2ObjectOpenHashMap<>();
// }
//
// @Redirect(
// method = "loadCompound",
// at = @At(
// value = "INVOKE",
// target = "Lcom/google/common/collect/Maps;newHashMap()Ljava/util/HashMap;",
// remap = false
// )
// )
// private static HashMap<?, ?> removeOldMapAlloc() {
// return null;
// }
// }
//}

View File

@@ -12,7 +12,7 @@
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
package net.gensokyoreimagined.nitori.mixin;
package net.gensokyoreimagined.nitori.mixin.needs_testing;
import com.google.common.collect.Lists;
import net.gensokyoreimagined.nitori.common.util.collections.HashedReferenceList;

View File

@@ -17,7 +17,6 @@
"MixinEntitySectionStorage",
"MixinGameRules",
"MixinIteratorSafeOrderedReferenceSet",
"MixinLevel",
"MixinLevelStorageAccess",
"MixinMob",
"math.sine_lut.MixinMth",