Kaynağa Gözat

And back to MCP mappings, so people involved in that can still look at it…

malte0811 4 yıl önce
ebeveyn
işleme
f8bd1b1cfb
36 değiştirilmiş dosya ile 239 ekleme ve 319 silme
  1. 5 1
      build.gradle
  2. 1 1
      common/build.gradle
  3. 1 1
      common/src/main/java/com/google/common/collect/FerriteCoreEntrySet.java
  4. 3 3
      common/src/main/java/malte0811/ferritecore/classloading/ClassDefiner.java
  5. 1 1
      common/src/main/java/malte0811/ferritecore/ducks/FastMapStateHolder.java
  6. 2 2
      common/src/main/java/malte0811/ferritecore/fastmap/FastMap.java
  7. 2 2
      common/src/main/java/malte0811/ferritecore/fastmap/FastMapKey.java
  8. 0 37
      common/src/main/java/malte0811/ferritecore/fastmap/FastSubMap.java
  9. 0 45
      common/src/main/java/malte0811/ferritecore/fastmap/FastSubMapEntrySet.java
  10. 13 13
      common/src/main/java/malte0811/ferritecore/hash/VoxelShapeArrayHash.java
  11. 16 16
      common/src/main/java/malte0811/ferritecore/hash/VoxelShapeHash.java
  12. 34 34
      common/src/main/java/malte0811/ferritecore/hash/VoxelShapePartHash.java
  13. 11 11
      common/src/main/java/malte0811/ferritecore/hash/VoxelShapeSplitHash.java
  14. 24 24
      common/src/main/java/malte0811/ferritecore/impl/BlockStateCacheImpl.java
  15. 13 15
      common/src/main/java/malte0811/ferritecore/impl/Deduplicator.java
  16. 8 8
      common/src/main/java/malte0811/ferritecore/impl/PropertyValueConditionImpl.java
  17. 1 1
      common/src/main/java/malte0811/ferritecore/impl/StateHolderImpl.java
  18. 11 12
      common/src/main/java/malte0811/ferritecore/mixin/blockstatecache/BlockStateCacheMixin.java
  19. 8 8
      common/src/main/java/malte0811/ferritecore/mixin/blockstatecache/VSArrayAccess.java
  20. 9 9
      common/src/main/java/malte0811/ferritecore/mixin/blockstatecache/VSPBitSetAccess.java
  21. 4 4
      common/src/main/java/malte0811/ferritecore/mixin/blockstatecache/VSPSplitAccess.java
  22. 6 6
      common/src/main/java/malte0811/ferritecore/mixin/blockstatecache/VSSplitAccess.java
  23. 7 6
      common/src/main/java/malte0811/ferritecore/mixin/blockstatecache/VoxelShapeAccess.java
  24. 6 6
      common/src/main/java/malte0811/ferritecore/mixin/dedupmultipart/MixinMultipartBuilder.java
  25. 7 7
      common/src/main/java/malte0811/ferritecore/mixin/fastmap/FastMapStateHolderMixin.java
  26. 3 3
      common/src/main/java/malte0811/ferritecore/mixin/mrl/ModelResourceLocationMixin.java
  27. 1 1
      common/src/main/java/malte0811/ferritecore/mixin/mrl/ResourceLocationAccess.java
  28. 3 3
      common/src/main/java/malte0811/ferritecore/mixin/nopropertymap/NoPropertyStateHolderMixin.java
  29. 9 7
      common/src/main/java/malte0811/ferritecore/mixin/predicates/AndConditionMixin.java
  30. 9 7
      common/src/main/java/malte0811/ferritecore/mixin/predicates/OrConditionMixin.java
  31. 8 8
      common/src/main/java/malte0811/ferritecore/mixin/predicates/PropertyValueConditionMixin.java
  32. 6 6
      common/src/main/java/malte0811/ferritecore/util/PredicateHelper.java
  33. 1 1
      fabric/build.gradle
  34. 2 2
      fabric/src/main/java/malte0811/ferritecore/mixin/fabric/CacheCallbackMixin.java
  35. 3 3
      fabric/src/main/java/malte0811/ferritecore/mixin/fabric/MinecraftMixin.java
  36. 1 5
      forge/build.gradle

+ 5 - 1
build.gradle

@@ -1,6 +1,6 @@
 plugins {
     id "architectury-plugin" version "2.0.65"
-    id "forgified-fabric-loom" version "0.6.55" apply false
+    id "forgified-fabric-loom" version "0.6.59" apply false
 }
 
 architectury {
@@ -9,6 +9,10 @@ architectury {
 
 subprojects {
     apply plugin: "forgified-fabric-loom"
+
+    loom {
+        silentMojangMappingsLicense()
+    }
 }
 
 allprojects {

+ 1 - 1
common/build.gradle

@@ -2,7 +2,7 @@ import java.util.stream.Collectors
 
 dependencies {
     minecraft "com.mojang:minecraft:${rootProject.minecraft_version}"
-    mappings minecraft.officialMojangMappings()
+    mappings "de.oceanlabs.mcp:mcp_snapshot:20201028-1.16.3"
     compileOnly "com.google.code.findbugs:jsr305:3.+"
     // We depend on fabric loader here to use the fabric @Environment annotations
     // Do NOT use other classes from fabric loader

+ 1 - 1
common/src/main/java/com/google/common/collect/FerriteCoreEntrySet.java

@@ -1,6 +1,6 @@
 package com.google.common.collect;
 
-import net.minecraft.world.level.block.state.properties.Property;
+import net.minecraft.state.Property;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 

+ 3 - 3
common/src/main/java/malte0811/ferritecore/classloading/ClassDefiner.java

@@ -2,7 +2,7 @@ package malte0811.ferritecore.classloading;
 
 import com.google.common.base.Preconditions;
 import com.google.common.collect.ImmutableMap;
-import net.minecraft.util.LazyLoadedValue;
+import net.minecraft.util.LazyValue;
 
 import java.io.InputStream;
 import java.lang.invoke.MethodHandle;
@@ -14,7 +14,7 @@ import java.util.function.Function;
 import java.util.function.IntFunction;
 
 public class ClassDefiner {
-    private static final LazyLoadedValue<MethodHandle> MAKE_IMMUTABLE_FAST_MAP = new LazyLoadedValue<>(() -> {
+    private static final LazyValue<MethodHandle> MAKE_IMMUTABLE_FAST_MAP = new LazyValue<>(() -> {
         try {
             define("com.google.common.collect.FerriteCoreIterator");
             define("com.google.common.collect.FerriteCoreEntrySet");
@@ -32,7 +32,7 @@ public class ClassDefiner {
     public static <K, V> ImmutableMap<K, V> makeMap(
             int numProperties, Function<Object, V> getValue, IntFunction<Map.Entry<K, V>> getIth
     ) throws Throwable {
-        return (ImmutableMap<K, V>) MAKE_IMMUTABLE_FAST_MAP.get().invoke(numProperties, getValue, getIth);
+        return (ImmutableMap<K, V>) MAKE_IMMUTABLE_FAST_MAP.getValue().invoke(numProperties, getValue, getIth);
     }
 
     private static Class<?> define(String name) throws Exception {

+ 1 - 1
common/src/main/java/malte0811/ferritecore/ducks/FastMapStateHolder.java

@@ -2,7 +2,7 @@ package malte0811.ferritecore.ducks;
 
 import com.google.common.collect.ImmutableMap;
 import malte0811.ferritecore.fastmap.FastMap;
-import net.minecraft.world.level.block.state.properties.Property;
+import net.minecraft.state.Property;
 
 public interface FastMapStateHolder<S> {
     FastMap<S> getStateMap();

+ 2 - 2
common/src/main/java/malte0811/ferritecore/fastmap/FastMap.java

@@ -3,7 +3,7 @@ package malte0811.ferritecore.fastmap;
 import com.google.common.collect.ImmutableList;
 import com.google.common.collect.ImmutableMap;
 import malte0811.ferritecore.classloading.ClassDefiner;
-import net.minecraft.world.level.block.state.properties.Property;
+import net.minecraft.state.Property;
 
 import javax.annotation.Nullable;
 import java.util.*;
@@ -27,7 +27,7 @@ public class FastMap<Value> {
         for (Property<?> prop : rawKeys) {
             toKeyIndex.put(prop, keys.size());
             keys.add(new FastMapKey<>(prop, factorUpTo));
-            factorUpTo *= prop.getPossibleValues().size();
+            factorUpTo *= prop.getAllowedValues().size();
         }
         this.keys = ImmutableList.copyOf(keys);
         this.toKeyIndex = toKeyIndex.build();

+ 2 - 2
common/src/main/java/malte0811/ferritecore/fastmap/FastMapKey.java

@@ -2,7 +2,7 @@ package malte0811.ferritecore.fastmap;
 
 import com.google.common.collect.ImmutableList;
 import com.google.common.collect.ImmutableMap;
-import net.minecraft.world.level.block.state.properties.Property;
+import net.minecraft.state.Property;
 
 import java.util.List;
 import java.util.Map;
@@ -15,7 +15,7 @@ class FastMapKey<T extends Comparable<T>> {
 
     FastMapKey(Property<T> property, int mapFactor) {
         this.property = property;
-        this.values = ImmutableList.copyOf(property.getPossibleValues());
+        this.values = ImmutableList.copyOf(property.getAllowedValues());
         this.mapFactor = mapFactor;
         ImmutableMap.Builder<Comparable<?>, Integer> toValueIndex = ImmutableMap.builder();
         for (int i = 0; i < this.values.size(); i++) {

+ 0 - 37
common/src/main/java/malte0811/ferritecore/fastmap/FastSubMap.java

@@ -1,37 +0,0 @@
-package malte0811.ferritecore.fastmap;
-
-import net.minecraft.world.level.block.state.properties.Property;
-
-import javax.annotation.Nonnull;
-import java.util.AbstractMap;
-import java.util.Set;
-
-public class FastSubMap extends AbstractMap<Property<?>, Comparable<?>> {
-    final FastMap<?> baseMap;
-    final int indexInBaseMap;
-
-    public FastSubMap(FastMap<?> baseMap, int indexInBaseMap) {
-        this.baseMap = baseMap;
-        this.indexInBaseMap = indexInBaseMap;
-    }
-
-    @Nonnull
-    @Override
-    public Set<Entry<Property<?>, Comparable<?>>> entrySet() {
-        return new FastSubMapEntrySet(this);
-    }
-
-    @Override
-    public Comparable<?> get(Object key) {
-        if (!(key instanceof Property<?>)) {
-            return null;
-        }
-        Property<?> prop = (Property<?>) key;
-        return baseMap.getValue(indexInBaseMap, prop);
-    }
-
-    @Override
-    public boolean containsKey(Object key) {
-        return get(key) != null;
-    }
-}

+ 0 - 45
common/src/main/java/malte0811/ferritecore/fastmap/FastSubMapEntrySet.java

@@ -1,45 +0,0 @@
-package malte0811.ferritecore.fastmap;
-
-import net.minecraft.world.level.block.state.properties.Property;
-import org.apache.commons.lang3.tuple.Pair;
-
-import javax.annotation.Nonnull;
-import java.util.AbstractSet;
-import java.util.Iterator;
-import java.util.Map;
-
-class FastSubMapEntrySet extends AbstractSet<Map.Entry<Property<?>, Comparable<?>>> {
-    private final FastMap<?> fastMap;
-    private final int mapIndex;
-
-    public FastSubMapEntrySet(FastSubMap fastSubMap) {
-        this.fastMap = fastSubMap.baseMap;
-        this.mapIndex = fastSubMap.indexInBaseMap;
-    }
-
-    @Nonnull
-    @Override
-    public Iterator<Map.Entry<Property<?>, Comparable<?>>> iterator() {
-        return new Iterator<Map.Entry<Property<?>, Comparable<?>>>() {
-            private int iteratorIndex = 0;
-
-            @Override
-            public boolean hasNext() {
-                return iteratorIndex < fastMap.numProperties();
-            }
-
-            @Override
-            public Map.Entry<Property<?>, Comparable<?>> next() {
-                Property<?> nextProp = fastMap.getProperties().get(iteratorIndex);
-                Comparable<?> nextValue = fastMap.getKey(iteratorIndex).getValue(mapIndex);
-                ++iteratorIndex;
-                return Pair.of(nextProp, nextValue);
-            }
-        };
-    }
-
-    @Override
-    public int size() {
-        return fastMap.numProperties();
-    }
-}

+ 13 - 13
common/src/main/java/malte0811/ferritecore/hash/VoxelShapeArrayHash.java

@@ -3,24 +3,24 @@ package malte0811.ferritecore.hash;
 import it.unimi.dsi.fastutil.Hash;
 import malte0811.ferritecore.mixin.blockstatecache.VSArrayAccess;
 import malte0811.ferritecore.mixin.blockstatecache.VoxelShapeAccess;
-import net.minecraft.world.phys.shapes.ArrayVoxelShape;
-import net.minecraft.world.phys.shapes.DiscreteVoxelShape;
-import net.minecraft.world.phys.shapes.VoxelShape;
+import net.minecraft.util.math.shapes.VoxelShape;
+import net.minecraft.util.math.shapes.VoxelShapeArray;
+import net.minecraft.util.math.shapes.VoxelShapePart;
 
 import java.util.Objects;
 
-public class VoxelShapeArrayHash implements Hash.Strategy<ArrayVoxelShape> {
+public class VoxelShapeArrayHash implements Hash.Strategy<VoxelShapeArray> {
     public static final VoxelShapeArrayHash INSTANCE = new VoxelShapeArrayHash();
 
     @Override
-    public int hashCode(ArrayVoxelShape o) {
+    public int hashCode(VoxelShapeArray o) {
         VSArrayAccess access = access(o);
-        return 31 * Objects.hash(access.getXs(), access.getYs(), access.getZs())
+        return 31 * Objects.hash(access.getXPoints(), access.getYPoints(), access.getZPoints())
                 + VoxelShapePartHash.INSTANCE.hashCode(getPart(o));
     }
 
     @Override
-    public boolean equals(ArrayVoxelShape a, ArrayVoxelShape b) {
+    public boolean equals(VoxelShapeArray a, VoxelShapeArray b) {
         if (a == b) {
             return true;
         } else if (a == null || b == null) {
@@ -28,18 +28,18 @@ public class VoxelShapeArrayHash implements Hash.Strategy<ArrayVoxelShape> {
         }
         VSArrayAccess accessA = access(a);
         VSArrayAccess accessB = access(b);
-        return Objects.equals(accessA.getXs(), accessB.getXs()) &&
-                Objects.equals(accessA.getYs(), accessB.getYs()) &&
-                Objects.equals(accessA.getZs(), accessB.getZs()) &&
+        return Objects.equals(accessA.getXPoints(), accessB.getXPoints()) &&
+                Objects.equals(accessA.getYPoints(), accessB.getYPoints()) &&
+                Objects.equals(accessA.getZPoints(), accessB.getZPoints()) &&
                 VoxelShapePartHash.INSTANCE.equals(getPart(a), getPart(b));
     }
 
     @SuppressWarnings("ConstantConditions")
-    private static VSArrayAccess access(ArrayVoxelShape a) {
+    private static VSArrayAccess access(VoxelShapeArray a) {
         return (VSArrayAccess) (Object) a;
     }
 
-    private static DiscreteVoxelShape getPart(VoxelShape a) {
-        return ((VoxelShapeAccess) a).getShape();
+    private static VoxelShapePart getPart(VoxelShape a) {
+        return ((VoxelShapeAccess) a).getPart();
     }
 }

+ 16 - 16
common/src/main/java/malte0811/ferritecore/hash/VoxelShapeHash.java

@@ -2,22 +2,22 @@ package malte0811.ferritecore.hash;
 
 import it.unimi.dsi.fastutil.Hash;
 import malte0811.ferritecore.mixin.blockstatecache.VoxelShapeAccess;
-import net.minecraft.world.phys.shapes.ArrayVoxelShape;
-import net.minecraft.world.phys.shapes.CubeVoxelShape;
-import net.minecraft.world.phys.shapes.SliceShape;
-import net.minecraft.world.phys.shapes.VoxelShape;
+import net.minecraft.util.math.shapes.SplitVoxelShape;
+import net.minecraft.util.math.shapes.VoxelShape;
+import net.minecraft.util.math.shapes.VoxelShapeArray;
+import net.minecraft.util.math.shapes.VoxelShapeCube;
 
 public class VoxelShapeHash implements Hash.Strategy<VoxelShape> {
     public static final VoxelShapeHash INSTANCE = new VoxelShapeHash();
 
     @Override
     public int hashCode(VoxelShape o) {
-        if (o instanceof SliceShape) {
-            return VoxelShapeSplitHash.INSTANCE.hashCode((SliceShape) o);
-        } else if (o instanceof ArrayVoxelShape) {
-            return VoxelShapeArrayHash.INSTANCE.hashCode((ArrayVoxelShape) o);
-        } else if (o instanceof CubeVoxelShape) {
-            return VoxelShapePartHash.INSTANCE.hashCode(((VoxelShapeAccess) o).getShape());
+        if (o instanceof SplitVoxelShape) {
+            return VoxelShapeSplitHash.INSTANCE.hashCode((SplitVoxelShape) o);
+        } else if (o instanceof VoxelShapeArray) {
+            return VoxelShapeArrayHash.INSTANCE.hashCode((VoxelShapeArray) o);
+        } else if (o instanceof VoxelShapeCube) {
+            return VoxelShapePartHash.INSTANCE.hashCode(((VoxelShapeAccess) o).getPart());
         } else {
             //TODO VSCube?
             return o.hashCode();
@@ -32,13 +32,13 @@ public class VoxelShapeHash implements Hash.Strategy<VoxelShape> {
             return false;
         } else if (a.getClass() != b.getClass()) {
             return false;
-        } else if (a instanceof SliceShape) {
-            return VoxelShapeSplitHash.INSTANCE.equals((SliceShape) a, (SliceShape) b);
-        } else if (a instanceof ArrayVoxelShape) {
-            return VoxelShapeArrayHash.INSTANCE.equals((ArrayVoxelShape) a, (ArrayVoxelShape) b);
-        } else if (a instanceof CubeVoxelShape) {
+        } else if (a instanceof SplitVoxelShape) {
+            return VoxelShapeSplitHash.INSTANCE.equals((SplitVoxelShape) a, (SplitVoxelShape) b);
+        } else if (a instanceof VoxelShapeArray) {
+            return VoxelShapeArrayHash.INSTANCE.equals((VoxelShapeArray) a, (VoxelShapeArray) b);
+        } else if (a instanceof VoxelShapeCube) {
             return VoxelShapePartHash.INSTANCE.equals(
-                    ((VoxelShapeAccess) a).getShape(), ((VoxelShapeAccess) b).getShape()
+                    ((VoxelShapeAccess) a).getPart(), ((VoxelShapeAccess) b).getPart()
             );
         } else {
             return a.equals(b);

+ 34 - 34
common/src/main/java/malte0811/ferritecore/hash/VoxelShapePartHash.java

@@ -3,36 +3,36 @@ package malte0811.ferritecore.hash;
 import it.unimi.dsi.fastutil.Hash;
 import malte0811.ferritecore.mixin.blockstatecache.VSPBitSetAccess;
 import malte0811.ferritecore.mixin.blockstatecache.VSPSplitAccess;
-import net.minecraft.world.phys.shapes.BitSetDiscreteVoxelShape;
-import net.minecraft.world.phys.shapes.DiscreteVoxelShape;
-import net.minecraft.world.phys.shapes.SubShape;
+import net.minecraft.util.math.shapes.BitSetVoxelShapePart;
+import net.minecraft.util.math.shapes.PartSplitVoxelShape;
+import net.minecraft.util.math.shapes.VoxelShapePart;
 
 import java.util.Objects;
 
-public class VoxelShapePartHash implements Hash.Strategy<DiscreteVoxelShape> {
+public class VoxelShapePartHash implements Hash.Strategy<VoxelShapePart> {
     public static final VoxelShapePartHash INSTANCE = new VoxelShapePartHash();
 
     @Override
-    public int hashCode(DiscreteVoxelShape o) {
-        if (o instanceof SubShape) {
-            VSPSplitAccess access = access((SubShape) o);
+    public int hashCode(VoxelShapePart o) {
+        if (o instanceof PartSplitVoxelShape) {
+            VSPSplitAccess access = access((PartSplitVoxelShape) o);
             int result = access.getStartX();
             result = 31 * result + access.getStartY();
             result = 31 * result + access.getStartZ();
             result = 31 * result + access.getEndX();
             result = 31 * result + access.getEndY();
             result = 31 * result + access.getEndZ();
-            result = 31 * result + hashCode(access.getParent());
+            result = 31 * result + hashCode(access.getPart());
             return result;
-        } else if (o instanceof BitSetDiscreteVoxelShape) {
-            VSPBitSetAccess access = access((BitSetDiscreteVoxelShape) o);
-            int result = access.getXMin();
-            result = 31 * result + access.getYMin();
-            result = 31 * result + access.getZMin();
-            result = 31 * result + access.getXMax();
-            result = 31 * result + access.getYMax();
-            result = 31 * result + access.getZMax();
-            result = 31 * result + Objects.hashCode(access.getStorage());
+        } else if (o instanceof BitSetVoxelShapePart) {
+            VSPBitSetAccess access = access((BitSetVoxelShapePart) o);
+            int result = access.getStartX();
+            result = 31 * result + access.getStartY();
+            result = 31 * result + access.getStartZ();
+            result = 31 * result + access.getEndX();
+            result = 31 * result + access.getEndY();
+            result = 31 * result + access.getEndZ();
+            result = 31 * result + Objects.hashCode(access.getBitSet());
             return result;
         } else {
             return Objects.hashCode(o);
@@ -40,45 +40,45 @@ public class VoxelShapePartHash implements Hash.Strategy<DiscreteVoxelShape> {
     }
 
     @Override
-    public boolean equals(DiscreteVoxelShape a, DiscreteVoxelShape b) {
+    public boolean equals(VoxelShapePart a, VoxelShapePart b) {
         if (a == b) {
             return true;
         } else if (a == null || b == null) {
             return false;
         } else if (a.getClass() != b.getClass()) {
             return false;
-        } else if (a instanceof SubShape) {
-            VSPSplitAccess accessA = access((SubShape) a);
-            VSPSplitAccess accessB = access((SubShape) b);
+        } else if (a instanceof PartSplitVoxelShape) {
+            VSPSplitAccess accessA = access((PartSplitVoxelShape) a);
+            VSPSplitAccess accessB = access((PartSplitVoxelShape) b);
+            return accessA.getEndX() == accessB.getEndX() &&
+                    accessA.getEndY() == accessB.getEndY() &&
+                    accessA.getEndZ() == accessB.getEndZ() &&
+                    accessA.getStartX() == accessB.getStartX() &&
+                    accessA.getStartY() == accessB.getStartY() &&
+                    accessA.getStartZ() == accessB.getStartZ() &&
+                    equals(accessA.getPart(), accessB.getPart());
+        } else if (a instanceof BitSetVoxelShapePart) {
+            VSPBitSetAccess accessA = access((BitSetVoxelShapePart) a);
+            VSPBitSetAccess accessB = access((BitSetVoxelShapePart) b);
             return accessA.getEndX() == accessB.getEndX() &&
                     accessA.getEndY() == accessB.getEndY() &&
                     accessA.getEndZ() == accessB.getEndZ() &&
                     accessA.getStartX() == accessB.getStartX() &&
                     accessA.getStartY() == accessB.getStartY() &&
                     accessA.getStartZ() == accessB.getStartZ() &&
-                    equals(accessA.getParent(), accessB.getParent());
-        } else if (a instanceof BitSetDiscreteVoxelShape) {
-            VSPBitSetAccess accessA = access((BitSetDiscreteVoxelShape) a);
-            VSPBitSetAccess accessB = access((BitSetDiscreteVoxelShape) b);
-            return accessA.getXMax() == accessB.getXMax() &&
-                    accessA.getYMax() == accessB.getYMax() &&
-                    accessA.getZMax() == accessB.getZMax() &&
-                    accessA.getXMin() == accessB.getXMin() &&
-                    accessA.getYMin() == accessB.getYMin() &&
-                    accessA.getZMin() == accessB.getZMin() &&
-                    accessA.getStorage().equals(accessB.getStorage());
+                    accessA.getBitSet().equals(accessB.getBitSet());
         } else {
             return a.equals(b);
         }
     }
 
     @SuppressWarnings("ConstantConditions")
-    private static VSPSplitAccess access(SubShape part) {
+    private static VSPSplitAccess access(PartSplitVoxelShape part) {
         return (VSPSplitAccess) (Object) part;
     }
 
     @SuppressWarnings("ConstantConditions")
-    private static VSPBitSetAccess access(BitSetDiscreteVoxelShape part) {
+    private static VSPBitSetAccess access(BitSetVoxelShapePart part) {
         return (VSPBitSetAccess) (Object) part;
     }
 }

+ 11 - 11
common/src/main/java/malte0811/ferritecore/hash/VoxelShapeSplitHash.java

@@ -3,26 +3,26 @@ package malte0811.ferritecore.hash;
 import it.unimi.dsi.fastutil.Hash;
 import malte0811.ferritecore.mixin.blockstatecache.VSSplitAccess;
 import malte0811.ferritecore.mixin.blockstatecache.VoxelShapeAccess;
-import net.minecraft.world.phys.shapes.DiscreteVoxelShape;
-import net.minecraft.world.phys.shapes.SliceShape;
-import net.minecraft.world.phys.shapes.VoxelShape;
+import net.minecraft.util.math.shapes.SplitVoxelShape;
+import net.minecraft.util.math.shapes.VoxelShape;
+import net.minecraft.util.math.shapes.VoxelShapePart;
 
 import java.util.Objects;
 
-public class VoxelShapeSplitHash implements Hash.Strategy<SliceShape> {
+public class VoxelShapeSplitHash implements Hash.Strategy<SplitVoxelShape> {
     public static final VoxelShapeSplitHash INSTANCE = new VoxelShapeSplitHash();
 
     @Override
-    public int hashCode(SliceShape o) {
+    public int hashCode(SplitVoxelShape o) {
         VSSplitAccess access = access(o);
         int result = Objects.hashCode(access.getAxis());
         result = 31 * result + VoxelShapePartHash.INSTANCE.hashCode(getPart(o));
-        result = 31 * result + VoxelShapeHash.INSTANCE.hashCode(access.getDelegate());
+        result = 31 * result + VoxelShapeHash.INSTANCE.hashCode(access.getShape());
         return result;
     }
 
     @Override
-    public boolean equals(SliceShape a, SliceShape b) {
+    public boolean equals(SplitVoxelShape a, SplitVoxelShape b) {
         if (a == b) {
             return true;
         } else if (a == null || b == null) {
@@ -31,15 +31,15 @@ public class VoxelShapeSplitHash implements Hash.Strategy<SliceShape> {
         VSSplitAccess accessA = access(a);
         VSSplitAccess accessB = access(b);
         return Objects.equals(accessA.getAxis(), accessB.getAxis()) &&
-                VoxelShapeHash.INSTANCE.equals(accessA.getDelegate(), accessB.getDelegate()) &&
+                VoxelShapeHash.INSTANCE.equals(accessA.getShape(), accessB.getShape()) &&
                 VoxelShapePartHash.INSTANCE.equals(getPart(a), getPart(b));
     }
 
-    private static VSSplitAccess access(SliceShape a) {
+    private static VSSplitAccess access(SplitVoxelShape a) {
         return (VSSplitAccess) a;
     }
 
-    private static DiscreteVoxelShape getPart(VoxelShape a) {
-        return ((VoxelShapeAccess) a).getShape();
+    private static VoxelShapePart getPart(VoxelShape a) {
+        return ((VoxelShapeAccess) a).getPart();
     }
 }

+ 24 - 24
common/src/main/java/malte0811/ferritecore/impl/BlockStateCacheImpl.java

@@ -7,15 +7,15 @@ import malte0811.ferritecore.hash.VoxelShapeHash;
 import malte0811.ferritecore.mixin.blockstatecache.VSArrayAccess;
 import malte0811.ferritecore.mixin.blockstatecache.VoxelShapeAccess;
 import malte0811.ferritecore.util.LastAccessedCache;
-import net.minecraft.core.BlockPos;
-import net.minecraft.core.Direction;
-import net.minecraft.world.level.BlockGetter;
-import net.minecraft.world.level.block.state.BlockBehaviour;
-import net.minecraft.world.level.block.state.BlockState;
-import net.minecraft.world.phys.shapes.ArrayVoxelShape;
-import net.minecraft.world.phys.shapes.CollisionContext;
-import net.minecraft.world.phys.shapes.Shapes;
-import net.minecraft.world.phys.shapes.VoxelShape;
+import net.minecraft.block.AbstractBlock;
+import net.minecraft.block.BlockState;
+import net.minecraft.util.Direction;
+import net.minecraft.util.math.BlockPos;
+import net.minecraft.util.math.shapes.ISelectionContext;
+import net.minecraft.util.math.shapes.VoxelShape;
+import net.minecraft.util.math.shapes.VoxelShapeArray;
+import net.minecraft.util.math.shapes.VoxelShapes;
+import net.minecraft.world.IBlockReader;
 import org.apache.logging.log4j.LogManager;
 import org.apache.logging.log4j.Logger;
 
@@ -23,13 +23,13 @@ import java.util.function.Function;
 
 public class BlockStateCacheImpl {
     private static final Direction[] DIRECTIONS = Direction.values();
-    public static final Object2ObjectOpenCustomHashMap<ArrayVoxelShape, ArrayVoxelShape> CACHE_COLLIDE =
+    public static final Object2ObjectOpenCustomHashMap<VoxelShapeArray, VoxelShapeArray> CACHE_COLLIDE =
             new Object2ObjectOpenCustomHashMap<>(VoxelShapeArrayHash.INSTANCE);
     public static final LastAccessedCache<VoxelShape, VoxelShape[]> CACHE_PROJECT = new LastAccessedCache<>(
             VoxelShapeHash.INSTANCE, vs -> {
         VoxelShape[] result = new VoxelShape[DIRECTIONS.length];
         for (Direction d : DIRECTIONS) {
-            result[d.ordinal()] = Shapes.getFaceShape(vs, d);
+            result[d.ordinal()] = VoxelShapes.getFaceShape(vs, d);
         }
         return result;
     }
@@ -51,15 +51,15 @@ public class BlockStateCacheImpl {
     }
 
     public static VoxelShape redirectGetCollisionShape(
-            BlockBehaviour block, BlockState state, BlockGetter worldIn, BlockPos pos, CollisionContext context
+            AbstractBlock block, BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context
     ) {
         VoxelShape baseResult = block.getCollisionShape(state, worldIn, pos, context);
-        if (!(baseResult instanceof ArrayVoxelShape)) {
+        if (!(baseResult instanceof VoxelShapeArray)) {
             return baseResult;
         }
-        ArrayVoxelShape baseArray = (ArrayVoxelShape) baseResult;
+        VoxelShapeArray baseArray = (VoxelShapeArray) baseResult;
         ++collideCalls;
-        ArrayVoxelShape resultArray = CACHE_COLLIDE.computeIfAbsent(baseArray, Function.identity());
+        VoxelShapeArray resultArray = CACHE_COLLIDE.computeIfAbsent(baseArray, Function.identity());
         replaceInternals(resultArray, baseArray);
         return resultArray;
     }
@@ -67,13 +67,13 @@ public class BlockStateCacheImpl {
     public static VoxelShape redirectFaceShape(VoxelShape shape, Direction face) {
         ++projectCalls;
         Pair<VoxelShape, VoxelShape[]> sides = CACHE_PROJECT.get(shape);
-        if (sides.getFirst() instanceof ArrayVoxelShape && shape instanceof ArrayVoxelShape) {
-            replaceInternals((ArrayVoxelShape) sides.getFirst(), (ArrayVoxelShape) shape);
+        if (sides.getFirst() instanceof VoxelShapeArray && shape instanceof VoxelShapeArray) {
+            replaceInternals((VoxelShapeArray) sides.getFirst(), (VoxelShapeArray) shape);
         }
         return sides.getSecond()[face.ordinal()];
     }
 
-    public static void replaceInternals(ArrayVoxelShape toKeep, ArrayVoxelShape toReplace) {
+    public static void replaceInternals(VoxelShapeArray toKeep, VoxelShapeArray toReplace) {
         if (toKeep == toReplace) {
             return;
         }
@@ -83,15 +83,15 @@ public class BlockStateCacheImpl {
         // that we can't do anything about shallow size and replace the internals with those used in the cache. This is
         // not theoretically 100% safe since VSs can technically be modified after they are created, but handing out VSs
         // that will be modified is unsafe in any case since a lot of vanilla code relies on VSs being immutable.
-        access(toReplace).setXs(access(toKeep).getXs());
-        access(toReplace).setYs(access(toKeep).getYs());
-        access(toReplace).setZs(access(toKeep).getZs());
-        accessVS(toReplace).setFaces(accessVS(toKeep).getFaces());
-        accessVS(toReplace).setShape(accessVS(toKeep).getShape());
+        access(toReplace).setXPoints(access(toKeep).getXPoints());
+        access(toReplace).setYPoints(access(toKeep).getYPoints());
+        access(toReplace).setZPoints(access(toKeep).getZPoints());
+        accessVS(toReplace).setProjectionCache(accessVS(toKeep).getProjectionCache());
+        accessVS(toReplace).setPart(accessVS(toKeep).getPart());
     }
 
     @SuppressWarnings("ConstantConditions")
-    private static VSArrayAccess access(ArrayVoxelShape a) {
+    private static VSArrayAccess access(VoxelShapeArray a) {
         return (VSArrayAccess) (Object) a;
     }
 

+ 13 - 15
common/src/main/java/malte0811/ferritecore/impl/Deduplicator.java

@@ -1,14 +1,14 @@
 package malte0811.ferritecore.impl;
 
 import com.mojang.datafixers.util.Unit;
+import net.minecraft.block.BlockState;
 import net.minecraft.client.Minecraft;
-import net.minecraft.client.resources.model.BakedModel;
-import net.minecraft.client.resources.model.MultiPartBakedModel;
-import net.minecraft.server.packs.resources.ReloadableResourceManager;
-import net.minecraft.server.packs.resources.ResourceManager;
-import net.minecraft.server.packs.resources.SimplePreparableReloadListener;
-import net.minecraft.util.profiling.ProfilerFiller;
-import net.minecraft.world.level.block.state.BlockState;
+import net.minecraft.client.renderer.model.IBakedModel;
+import net.minecraft.client.renderer.model.MultipartBakedModel;
+import net.minecraft.client.resources.ReloadListener;
+import net.minecraft.profiler.IProfiler;
+import net.minecraft.resources.IReloadableResourceManager;
+import net.minecraft.resources.IResourceManager;
 import org.apache.commons.lang3.tuple.Pair;
 
 import java.util.List;
@@ -20,7 +20,7 @@ import java.util.function.Predicate;
 public class Deduplicator {
     private static final Map<String, String> VARIANT_IDENTITIES = new ConcurrentHashMap<>();
     // Typedefs would be a nice thing to have
-    private static final Map<List<Pair<Predicate<BlockState>, BakedModel>>, MultiPartBakedModel> KNOWN_MULTIPART_MODELS = new ConcurrentHashMap<>();
+    private static final Map<List<Pair<Predicate<BlockState>, IBakedModel>>, MultipartBakedModel> KNOWN_MULTIPART_MODELS = new ConcurrentHashMap<>();
     private static final Map<List<Predicate<BlockState>>, Predicate<BlockState>> OR_PREDICATE_CACHE = new ConcurrentHashMap<>();
     private static final Map<List<Predicate<BlockState>>, Predicate<BlockState>> AND_PREDICATE_CACHE = new ConcurrentHashMap<>();
 
@@ -28,8 +28,8 @@ public class Deduplicator {
         return VARIANT_IDENTITIES.computeIfAbsent(variant, Function.identity());
     }
 
-    public static MultiPartBakedModel makeMultipartModel(List<Pair<Predicate<BlockState>, BakedModel>> selectors) {
-        return KNOWN_MULTIPART_MODELS.computeIfAbsent(selectors, MultiPartBakedModel::new);
+    public static MultipartBakedModel makeMultipartModel(List<Pair<Predicate<BlockState>, IBakedModel>> selectors) {
+        return KNOWN_MULTIPART_MODELS.computeIfAbsent(selectors, MultipartBakedModel::new);
     }
 
     public static Predicate<BlockState> or(List<Predicate<BlockState>> list) {
@@ -48,16 +48,14 @@ public class Deduplicator {
 
     public static void registerReloadListener() {
         // Register the reload listener s.t. its "sync" part runs after the model loader reload
-        ((ReloadableResourceManager) Minecraft.getInstance().getResourceManager()).registerReloadListener(new SimplePreparableReloadListener<Unit>() {
+        ((IReloadableResourceManager) Minecraft.getInstance().getResourceManager()).addReloadListener(new ReloadListener<Unit>() {
             @Override
-            protected Unit prepare(ResourceManager resourceManager, ProfilerFiller profilerFiller) {
+            protected Unit prepare(IResourceManager iResourceManager, IProfiler iProfiler) {
                 return Unit.INSTANCE;
             }
 
             @Override
-            protected void apply(
-                    Unit object, ResourceManager resourceManager, ProfilerFiller profilerFiller
-            ) {
+            protected void apply(Unit object, IResourceManager iResourceManager, IProfiler iProfiler) {
                 VARIANT_IDENTITIES.clear();
                 KNOWN_MULTIPART_MODELS.clear();
                 OR_PREDICATE_CACHE.clear();

+ 8 - 8
common/src/main/java/malte0811/ferritecore/impl/PropertyValueConditionImpl.java

@@ -2,10 +2,10 @@ package malte0811.ferritecore.impl;
 
 import com.google.common.base.Splitter;
 import malte0811.ferritecore.util.PredicateHelper;
-import net.minecraft.world.level.block.Block;
-import net.minecraft.world.level.block.state.BlockState;
-import net.minecraft.world.level.block.state.StateDefinition;
-import net.minecraft.world.level.block.state.properties.Property;
+import net.minecraft.block.Block;
+import net.minecraft.block.BlockState;
+import net.minecraft.state.Property;
+import net.minecraft.state.StateContainer;
 import org.apache.commons.lang3.tuple.Pair;
 
 import java.util.List;
@@ -19,7 +19,7 @@ public class PropertyValueConditionImpl {
     private static final Map<Pair<Property<?>, Comparable<?>>, Predicate<BlockState>> STATE_HAS_PROPERTY_CACHE = new ConcurrentHashMap<>();
 
     public static Predicate<BlockState> getPredicate(
-            StateDefinition<Block, BlockState> stateContainer, String key, String value, Splitter splitter
+            StateContainer<Block, BlockState> stateContainer, String key, String value, Splitter splitter
     ) {
         Property<?> property = stateContainer.getProperty(key);
         if (property == null) {
@@ -59,9 +59,9 @@ public class PropertyValueConditionImpl {
 
     private static <T extends Comparable<T>>
     Predicate<BlockState> makePropertyPredicate(
-            StateDefinition<Block, BlockState> container, Property<T> property, String subValue, String key, String value
+            StateContainer<Block, BlockState> container, Property<T> property, String subValue, String key, String value
     ) {
-        Optional<T> optional = property.getValue(subValue);
+        Optional<T> optional = property.parseValue(subValue);
         if (!optional.isPresent()) {
             throw new RuntimeException(String.format(
                     "Unknown value '%s' for property '%s' on '%s' in '%s'",
@@ -74,7 +74,7 @@ public class PropertyValueConditionImpl {
                     pair -> {
                         Comparable<?> valueInt = pair.getRight();
                         Property<?> propInt = pair.getLeft();
-                        return state -> state.getValue(propInt).equals(valueInt);
+                        return state -> state.get(propInt).equals(valueInt);
                     }
             );
         }

+ 1 - 1
common/src/main/java/malte0811/ferritecore/impl/StateHolderImpl.java

@@ -3,7 +3,7 @@ package malte0811.ferritecore.impl;
 import malte0811.ferritecore.ducks.FastMapStateHolder;
 import malte0811.ferritecore.ducks.NoPropertyStateHolder;
 import malte0811.ferritecore.fastmap.FastMap;
-import net.minecraft.world.level.block.state.properties.Property;
+import net.minecraft.state.Property;
 
 import java.util.Map;
 

+ 11 - 12
common/src/main/java/malte0811/ferritecore/mixin/blockstatecache/BlockStateCacheMixin.java

@@ -1,25 +1,24 @@
 package malte0811.ferritecore.mixin.blockstatecache;
 
 import malte0811.ferritecore.impl.BlockStateCacheImpl;
-import net.minecraft.core.BlockPos;
-import net.minecraft.core.Direction;
-import net.minecraft.world.level.BlockGetter;
-import net.minecraft.world.level.block.Block;
-import net.minecraft.world.level.block.state.BlockBehaviour;
-import net.minecraft.world.level.block.state.BlockState;
-import net.minecraft.world.phys.shapes.CollisionContext;
-import net.minecraft.world.phys.shapes.VoxelShape;
+import net.minecraft.block.Block;
+import net.minecraft.block.BlockState;
+import net.minecraft.util.Direction;
+import net.minecraft.util.math.BlockPos;
+import net.minecraft.util.math.shapes.ISelectionContext;
+import net.minecraft.util.math.shapes.VoxelShape;
+import net.minecraft.world.IBlockReader;
 import org.spongepowered.asm.mixin.Mixin;
 import org.spongepowered.asm.mixin.injection.At;
 import org.spongepowered.asm.mixin.injection.Redirect;
 
-@Mixin(targets = "net.minecraft.world.level.block.state.BlockBehaviour$BlockStateBase$Cache")
+@Mixin(targets = "net.minecraft.block.AbstractBlock$AbstractBlockState$Cache")
 public class BlockStateCacheMixin {
     @Redirect(
             method = "<init>",
             at = @At(
                     value = "INVOKE",
-                    target = "Lnet/minecraft/world/phys/shapes/Shapes;getFaceShape(Lnet/minecraft/world/phys/shapes/VoxelShape;Lnet/minecraft/core/Direction;)Lnet/minecraft/world/phys/shapes/VoxelShape;"
+                    target = "Lnet/minecraft/util/math/shapes/VoxelShapes;getFaceShape(Lnet/minecraft/util/math/shapes/VoxelShape;Lnet/minecraft/util/Direction;)Lnet/minecraft/util/math/shapes/VoxelShape;"
             )
     )
     private VoxelShape redirectFaceShape(VoxelShape shape, Direction face) {
@@ -30,11 +29,11 @@ public class BlockStateCacheMixin {
             method = "<init>",
             at = @At(
                     value = "INVOKE",
-                    target = "Lnet/minecraft/world/level/block/Block;getCollisionShape(Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/world/level/BlockGetter;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/phys/shapes/CollisionContext;)Lnet/minecraft/world/phys/shapes/VoxelShape;"
+                    target = "Lnet/minecraft/block/Block;getCollisionShape(Lnet/minecraft/block/BlockState;Lnet/minecraft/world/IBlockReader;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/util/math/shapes/ISelectionContext;)Lnet/minecraft/util/math/shapes/VoxelShape;"
             )
     )
     private VoxelShape redirectGetCollisionShape(
-            Block block, BlockState state, BlockGetter worldIn, BlockPos pos, CollisionContext context
+            Block block, BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context
     ) {
         return BlockStateCacheImpl.redirectGetCollisionShape(block, state, worldIn, pos, context);
     }

+ 8 - 8
common/src/main/java/malte0811/ferritecore/mixin/blockstatecache/VSArrayAccess.java

@@ -1,27 +1,27 @@
 package malte0811.ferritecore.mixin.blockstatecache;
 
 import it.unimi.dsi.fastutil.doubles.DoubleList;
-import net.minecraft.world.phys.shapes.ArrayVoxelShape;
+import net.minecraft.util.math.shapes.VoxelShapeArray;
 import org.spongepowered.asm.mixin.Mixin;
 import org.spongepowered.asm.mixin.gen.Accessor;
 
-@Mixin(ArrayVoxelShape.class)
+@Mixin(VoxelShapeArray.class)
 public interface VSArrayAccess {
     @Accessor
-    void setXs(DoubleList newPoints);
+    void setXPoints(DoubleList newPoints);
 
     @Accessor
-    void setYs(DoubleList newPoints);
+    void setYPoints(DoubleList newPoints);
 
     @Accessor
-    void setZs(DoubleList newPoints);
+    void setZPoints(DoubleList newPoints);
 
     @Accessor
-    DoubleList getXs();
+    DoubleList getXPoints();
 
     @Accessor
-    DoubleList getYs();
+    DoubleList getYPoints();
 
     @Accessor
-    DoubleList getZs();
+    DoubleList getZPoints();
 }

+ 9 - 9
common/src/main/java/malte0811/ferritecore/mixin/blockstatecache/VSPBitSetAccess.java

@@ -1,31 +1,31 @@
 package malte0811.ferritecore.mixin.blockstatecache;
 
-import net.minecraft.world.phys.shapes.BitSetDiscreteVoxelShape;
+import net.minecraft.util.math.shapes.BitSetVoxelShapePart;
 import org.spongepowered.asm.mixin.Mixin;
 import org.spongepowered.asm.mixin.gen.Accessor;
 
 import java.util.BitSet;
 
-@Mixin(BitSetDiscreteVoxelShape.class)
+@Mixin(BitSetVoxelShapePart.class)
 public interface VSPBitSetAccess {
     @Accessor
-    BitSet getStorage();
+    BitSet getBitSet();
 
     @Accessor
-    int getXMin();
+    int getStartX();
 
     @Accessor
-    int getYMin();
+    int getStartY();
 
     @Accessor
-    int getZMin();
+    int getStartZ();
 
     @Accessor
-    int getXMax();
+    int getEndX();
 
     @Accessor
-    int getYMax();
+    int getEndY();
 
     @Accessor
-    int getZMax();
+    int getEndZ();
 }

+ 4 - 4
common/src/main/java/malte0811/ferritecore/mixin/blockstatecache/VSPSplitAccess.java

@@ -1,14 +1,14 @@
 package malte0811.ferritecore.mixin.blockstatecache;
 
-import net.minecraft.world.phys.shapes.DiscreteVoxelShape;
-import net.minecraft.world.phys.shapes.SubShape;
+import net.minecraft.util.math.shapes.PartSplitVoxelShape;
+import net.minecraft.util.math.shapes.VoxelShapePart;
 import org.spongepowered.asm.mixin.Mixin;
 import org.spongepowered.asm.mixin.gen.Accessor;
 
-@Mixin(SubShape.class)
+@Mixin(PartSplitVoxelShape.class)
 public interface VSPSplitAccess {
     @Accessor
-    DiscreteVoxelShape getParent();
+    VoxelShapePart getPart();
 
     @Accessor
     int getStartX();

+ 6 - 6
common/src/main/java/malte0811/ferritecore/mixin/blockstatecache/VSSplitAccess.java

@@ -1,20 +1,20 @@
 package malte0811.ferritecore.mixin.blockstatecache;
 
-import net.minecraft.core.Direction;
-import net.minecraft.world.phys.shapes.SliceShape;
-import net.minecraft.world.phys.shapes.VoxelShape;
+import net.minecraft.util.Direction;
+import net.minecraft.util.math.shapes.SplitVoxelShape;
+import net.minecraft.util.math.shapes.VoxelShape;
 import org.spongepowered.asm.mixin.Mixin;
 import org.spongepowered.asm.mixin.Mutable;
 import org.spongepowered.asm.mixin.gen.Accessor;
 
-@Mixin(SliceShape.class)
+@Mixin(SplitVoxelShape.class)
 public interface VSSplitAccess {
     @Accessor
     @Mutable
-    void setDelegate(VoxelShape newShape);
+    void setShape(VoxelShape newShape);
 
     @Accessor
-    VoxelShape getDelegate();
+    VoxelShape getShape();
 
     @Accessor
     Direction.Axis getAxis();

+ 7 - 6
common/src/main/java/malte0811/ferritecore/mixin/blockstatecache/VoxelShapeAccess.java

@@ -1,7 +1,7 @@
 package malte0811.ferritecore.mixin.blockstatecache;
 
-import net.minecraft.world.phys.shapes.DiscreteVoxelShape;
-import net.minecraft.world.phys.shapes.VoxelShape;
+import net.minecraft.util.math.shapes.VoxelShape;
+import net.minecraft.util.math.shapes.VoxelShapePart;
 import org.spongepowered.asm.mixin.Mixin;
 import org.spongepowered.asm.mixin.Mutable;
 import org.spongepowered.asm.mixin.gen.Accessor;
@@ -11,15 +11,16 @@ import javax.annotation.Nullable;
 @Mixin(VoxelShape.class)
 public interface VoxelShapeAccess {
     @Accessor
-    DiscreteVoxelShape getShape();
+    VoxelShapePart getPart();
 
     @Accessor
-    VoxelShape[] getFaces();
+    @Nullable
+    VoxelShape[] getProjectionCache();
 
     @Accessor
     @Mutable
-    void setShape(DiscreteVoxelShape newPart);
+    void setPart(VoxelShapePart newPart);
 
     @Accessor
-    void setFaces(@Nullable VoxelShape[] newCache);
+    void setProjectionCache(@Nullable VoxelShape[] newCache);
 }

+ 6 - 6
common/src/main/java/malte0811/ferritecore/mixin/dedupmultipart/MixinMultipartBuilder.java

@@ -1,9 +1,9 @@
 package malte0811.ferritecore.mixin.dedupmultipart;
 
 import malte0811.ferritecore.impl.Deduplicator;
-import net.minecraft.client.resources.model.BakedModel;
-import net.minecraft.client.resources.model.MultiPartBakedModel;
-import net.minecraft.world.level.block.state.BlockState;
+import net.minecraft.block.BlockState;
+import net.minecraft.client.renderer.model.IBakedModel;
+import net.minecraft.client.renderer.model.MultipartBakedModel;
 import org.apache.commons.lang3.tuple.Pair;
 import org.spongepowered.asm.mixin.Mixin;
 import org.spongepowered.asm.mixin.injection.At;
@@ -12,13 +12,13 @@ import org.spongepowered.asm.mixin.injection.Redirect;
 import java.util.List;
 import java.util.function.Predicate;
 
-@Mixin(MultiPartBakedModel.Builder.class)
+@Mixin(MultipartBakedModel.Builder.class)
 public class MixinMultipartBuilder {
     @Redirect(
             method = "build",
-            at = @At(value = "NEW", target = "net/minecraft/client/resources/model/MultiPartBakedModel")
+            at = @At(value = "NEW", target = "(Ljava/util/List;)Lnet/minecraft/client/renderer/model/MultipartBakedModel;")
     )
-    public MultiPartBakedModel build(List<Pair<Predicate<BlockState>, BakedModel>> selectors) {
+    public MultipartBakedModel build(List<Pair<Predicate<BlockState>, IBakedModel>> selectors) {
         return Deduplicator.makeMultipartModel(selectors);
     }
 }

+ 7 - 7
common/src/main/java/malte0811/ferritecore/mixin/fastmap/FastMapStateHolderMixin.java

@@ -5,8 +5,8 @@ import com.google.common.collect.Table;
 import malte0811.ferritecore.ducks.FastMapStateHolder;
 import malte0811.ferritecore.fastmap.FastMap;
 import malte0811.ferritecore.impl.StateHolderImpl;
-import net.minecraft.world.level.block.state.StateHolder;
-import net.minecraft.world.level.block.state.properties.Property;
+import net.minecraft.state.Property;
+import net.minecraft.state.StateHolder;
 import org.spongepowered.asm.mixin.*;
 import org.spongepowered.asm.mixin.injection.At;
 import org.spongepowered.asm.mixin.injection.Redirect;
@@ -18,13 +18,13 @@ public abstract class FastMapStateHolderMixin<O, S> implements FastMapStateHolde
     @Mutable
     @Shadow
     @Final
-    private ImmutableMap<Property<?>, Comparable<?>> values;
+    private ImmutableMap<Property<?>, Comparable<?>> properties;
 
     private int globalTableIndex;
     private FastMap<S> globalTable;
 
     @Redirect(
-            method = "setValue",
+            method = "with",
             at = @At(
                     value = "INVOKE",
                     target = "Lcom/google/common/collect/Table;get(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;",
@@ -41,7 +41,7 @@ public abstract class FastMapStateHolderMixin<O, S> implements FastMapStateHolde
      * @author malte0811
      */
     @Overwrite
-    public void populateNeighbours(Map<Map<Property<?>, Comparable<?>>, S> states) {
+    public void func_235899_a_(Map<Map<Property<?>, Comparable<?>>, S> states) {
         StateHolderImpl.populateNeighbors(states, this);
     }
 
@@ -57,12 +57,12 @@ public abstract class FastMapStateHolderMixin<O, S> implements FastMapStateHolde
 
     @Override
     public ImmutableMap<Property<?>, Comparable<?>> getVanillaPropertyMap() {
-        return values;
+        return properties;
     }
 
     @Override
     public void deleteVanillaPropertyMap() {
-        values = null;
+        properties = null;
     }
 
     @Override

+ 3 - 3
common/src/main/java/malte0811/ferritecore/mixin/mrl/ModelResourceLocationMixin.java

@@ -1,8 +1,8 @@
 package malte0811.ferritecore.mixin.mrl;
 
 import malte0811.ferritecore.impl.Deduplicator;
-import net.minecraft.client.resources.model.ModelResourceLocation;
-import net.minecraft.resources.ResourceLocation;
+import net.minecraft.client.renderer.model.ModelResourceLocation;
+import net.minecraft.util.ResourceLocation;
 import org.spongepowered.asm.mixin.Final;
 import org.spongepowered.asm.mixin.Mixin;
 import org.spongepowered.asm.mixin.Mutable;
@@ -19,7 +19,7 @@ public class ModelResourceLocationMixin {
     private String variant;
 
     @Inject(
-            method = "<init>(Lnet/minecraft/resources/ResourceLocation;Ljava/lang/String;)V",
+            method = "<init>(Lnet/minecraft/util/ResourceLocation;Ljava/lang/String;)V",
             at = @At("TAIL")
     )
     private void constructTail(ResourceLocation location, String variantIn, CallbackInfo ci) {

+ 1 - 1
common/src/main/java/malte0811/ferritecore/mixin/mrl/ResourceLocationAccess.java

@@ -1,6 +1,6 @@
 package malte0811.ferritecore.mixin.mrl;
 
-import net.minecraft.resources.ResourceLocation;
+import net.minecraft.util.ResourceLocation;
 import org.spongepowered.asm.mixin.Mixin;
 import org.spongepowered.asm.mixin.Mutable;
 import org.spongepowered.asm.mixin.gen.Accessor;

+ 3 - 3
common/src/main/java/malte0811/ferritecore/mixin/nopropertymap/NoPropertyStateHolderMixin.java

@@ -4,8 +4,8 @@ import com.google.common.collect.ImmutableMap;
 import malte0811.ferritecore.ducks.FastMapStateHolder;
 import malte0811.ferritecore.ducks.NoPropertyStateHolder;
 import malte0811.ferritecore.fastmap.FastMap;
-import net.minecraft.world.level.block.state.StateHolder;
-import net.minecraft.world.level.block.state.properties.Property;
+import net.minecraft.state.Property;
+import net.minecraft.state.StateHolder;
 import org.spongepowered.asm.mixin.Mixin;
 import org.spongepowered.asm.mixin.Shadow;
 import org.spongepowered.asm.mixin.injection.At;
@@ -24,7 +24,7 @@ public abstract class NoPropertyStateHolderMixin implements NoPropertyStateHolde
     // All other Mixins: If the new data structures are initialized, use those. Otherwise (if populateNeighbors didn't
     // run yet) use the vanilla code using `properties`
     @Redirect(
-            method = {"getValue", "getOptionalValue", "setValue"},
+            method = {"get", "func_235903_d_", "with"},
             at = @At(
                     value = "INVOKE",
                     target = "Lcom/google/common/collect/ImmutableMap;get(Ljava/lang/Object;)Ljava/lang/Object;",

+ 9 - 7
common/src/main/java/malte0811/ferritecore/mixin/predicates/AndConditionMixin.java

@@ -2,11 +2,11 @@ package malte0811.ferritecore.mixin.predicates;
 
 import malte0811.ferritecore.impl.Deduplicator;
 import malte0811.ferritecore.util.PredicateHelper;
-import net.minecraft.client.renderer.block.model.multipart.AndCondition;
-import net.minecraft.client.renderer.block.model.multipart.Condition;
-import net.minecraft.world.level.block.Block;
-import net.minecraft.world.level.block.state.BlockState;
-import net.minecraft.world.level.block.state.StateDefinition;
+import net.minecraft.block.Block;
+import net.minecraft.block.BlockState;
+import net.minecraft.client.renderer.model.multipart.AndCondition;
+import net.minecraft.client.renderer.model.multipart.ICondition;
+import net.minecraft.state.StateContainer;
 import org.spongepowered.asm.mixin.Final;
 import org.spongepowered.asm.mixin.Mixin;
 import org.spongepowered.asm.mixin.Overwrite;
@@ -16,14 +16,16 @@ import java.util.function.Predicate;
 
 @Mixin(AndCondition.class)
 public class AndConditionMixin {
-    @Shadow @Final private Iterable<? extends Condition> conditions;
+    @Shadow
+    @Final
+    private Iterable<? extends ICondition> conditions;
 
     /**
      * @reason Use cached result predicates
      * @author malte0811
      */
     @Overwrite
-    public Predicate<BlockState> getPredicate(StateDefinition<Block, BlockState> stateContainer) {
+    public Predicate<BlockState> getPredicate(StateContainer<Block, BlockState> stateContainer) {
         return Deduplicator.and(PredicateHelper.toCanonicalList(conditions, stateContainer));
     }
 }

+ 9 - 7
common/src/main/java/malte0811/ferritecore/mixin/predicates/OrConditionMixin.java

@@ -2,11 +2,11 @@ package malte0811.ferritecore.mixin.predicates;
 
 import malte0811.ferritecore.impl.Deduplicator;
 import malte0811.ferritecore.util.PredicateHelper;
-import net.minecraft.client.renderer.block.model.multipart.Condition;
-import net.minecraft.client.renderer.block.model.multipart.OrCondition;
-import net.minecraft.world.level.block.Block;
-import net.minecraft.world.level.block.state.BlockState;
-import net.minecraft.world.level.block.state.StateDefinition;
+import net.minecraft.block.Block;
+import net.minecraft.block.BlockState;
+import net.minecraft.client.renderer.model.multipart.ICondition;
+import net.minecraft.client.renderer.model.multipart.OrCondition;
+import net.minecraft.state.StateContainer;
 import org.spongepowered.asm.mixin.Final;
 import org.spongepowered.asm.mixin.Mixin;
 import org.spongepowered.asm.mixin.Overwrite;
@@ -16,14 +16,16 @@ import java.util.function.Predicate;
 
 @Mixin(OrCondition.class)
 public class OrConditionMixin {
-    @Shadow @Final private Iterable<? extends Condition> conditions;
+    @Shadow
+    @Final
+    private Iterable<? extends ICondition> conditions;
 
     /**
      * @reason Use cached result predicates
      * @author malte0811
      */
     @Overwrite
-    public Predicate<BlockState> getPredicate(StateDefinition<Block, BlockState> stateContainer) {
+    public Predicate<BlockState> getPredicate(StateContainer<Block, BlockState> stateContainer) {
         return Deduplicator.or(PredicateHelper.toCanonicalList(conditions, stateContainer));
     }
 }

+ 8 - 8
common/src/main/java/malte0811/ferritecore/mixin/predicates/PropertyValueConditionMixin.java

@@ -2,10 +2,10 @@ package malte0811.ferritecore.mixin.predicates;
 
 import com.google.common.base.Splitter;
 import malte0811.ferritecore.impl.PropertyValueConditionImpl;
-import net.minecraft.client.renderer.block.model.multipart.KeyValueCondition;
-import net.minecraft.world.level.block.Block;
-import net.minecraft.world.level.block.state.BlockState;
-import net.minecraft.world.level.block.state.StateDefinition;
+import net.minecraft.block.Block;
+import net.minecraft.block.BlockState;
+import net.minecraft.client.renderer.model.multipart.PropertyValueCondition;
+import net.minecraft.state.StateContainer;
 import org.spongepowered.asm.mixin.Final;
 import org.spongepowered.asm.mixin.Mixin;
 import org.spongepowered.asm.mixin.Overwrite;
@@ -13,7 +13,7 @@ import org.spongepowered.asm.mixin.Shadow;
 
 import java.util.function.Predicate;
 
-@Mixin(KeyValueCondition.class)
+@Mixin(PropertyValueCondition.class)
 public class PropertyValueConditionMixin {
     @Shadow
     @Final
@@ -23,7 +23,7 @@ public class PropertyValueConditionMixin {
     private String value;
     @Shadow
     @Final
-    private static Splitter PIPE_SPLITTER;
+    private static Splitter SPLITTER;
 
     /**
      * @reason Use cached predicates in the case of multiple specified values
@@ -33,7 +33,7 @@ public class PropertyValueConditionMixin {
      * @author malte0811
      */
     @Overwrite
-    public Predicate<BlockState> getPredicate(StateDefinition<Block, BlockState> stateContainer) {
-        return PropertyValueConditionImpl.getPredicate(stateContainer, key, value, PIPE_SPLITTER);
+    public Predicate<BlockState> getPredicate(StateContainer<Block, BlockState> stateContainer) {
+        return PropertyValueConditionImpl.getPredicate(stateContainer, key, value, SPLITTER);
     }
 }

+ 6 - 6
common/src/main/java/malte0811/ferritecore/util/PredicateHelper.java

@@ -1,9 +1,9 @@
 package malte0811.ferritecore.util;
 
-import net.minecraft.client.renderer.block.model.multipart.Condition;
-import net.minecraft.world.level.block.Block;
-import net.minecraft.world.level.block.state.BlockState;
-import net.minecraft.world.level.block.state.StateDefinition;
+import net.minecraft.block.Block;
+import net.minecraft.block.BlockState;
+import net.minecraft.client.renderer.model.multipart.ICondition;
+import net.minecraft.state.StateContainer;
 
 import java.util.ArrayList;
 import java.util.Comparator;
@@ -12,10 +12,10 @@ import java.util.function.Predicate;
 
 public class PredicateHelper {
     public static List<Predicate<BlockState>> toCanonicalList(
-            Iterable<? extends Condition> conditions, StateDefinition<Block, BlockState> stateContainer
+            Iterable<? extends ICondition> conditions, StateContainer<Block, BlockState> stateContainer
     ) {
         ArrayList<Predicate<BlockState>> list = new ArrayList<>();
-        for (Condition cond : conditions) {
+        for (ICondition cond : conditions) {
             list.add(cond.getPredicate(stateContainer));
         }
         return canonize(list);

+ 1 - 1
fabric/build.gradle

@@ -14,7 +14,7 @@ architectury {
 
 dependencies {
     minecraft("com.mojang:minecraft:${rootProject.minecraft_version}")
-    mappings(minecraft.officialMojangMappings())
+    mappings "de.oceanlabs.mcp:mcp_snapshot:20201028-1.16.3"
     modCompile("net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}")
     modCompile("net.fabricmc.fabric-api:fabric-api:${rootProject.fabric_api_version}")
 

+ 2 - 2
fabric/src/main/java/malte0811/ferritecore/mixin/fabric/CacheCallbackMixin.java

@@ -1,7 +1,7 @@
 package malte0811.ferritecore.mixin.fabric;
 
 import malte0811.ferritecore.impl.BlockStateCacheImpl;
-import net.minecraft.world.level.block.Blocks;
+import net.minecraft.block.Blocks;
 import org.spongepowered.asm.mixin.Mixin;
 import org.spongepowered.asm.mixin.injection.At;
 import org.spongepowered.asm.mixin.injection.Inject;
@@ -9,7 +9,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
 
 @Mixin(Blocks.class)
 public class CacheCallbackMixin {
-    @Inject(method = "rebuildCache", at = @At("TAIL"))
+    @Inject(method = "cacheBlockStates", at = @At("TAIL"))
     private static void afterCacheRebuild(CallbackInfo ci) {
         BlockStateCacheImpl.resetCaches();
     }

+ 3 - 3
fabric/src/main/java/malte0811/ferritecore/mixin/fabric/MinecraftMixin.java

@@ -1,8 +1,8 @@
 package malte0811.ferritecore.mixin.fabric;
 
 import malte0811.ferritecore.impl.Deduplicator;
+import net.minecraft.client.GameConfiguration;
 import net.minecraft.client.Minecraft;
-import net.minecraft.client.main.GameConfig;
 import org.spongepowered.asm.mixin.Mixin;
 import org.spongepowered.asm.mixin.injection.At;
 import org.spongepowered.asm.mixin.injection.Inject;
@@ -14,10 +14,10 @@ public class MinecraftMixin {
             method = "<init>",
             at = @At(
                     value = "INVOKE",
-                    target = "Lnet/minecraft/client/renderer/entity/ItemRenderer;<init>(Lnet/minecraft/client/renderer/texture/TextureManager;Lnet/minecraft/client/resources/model/ModelManager;Lnet/minecraft/client/color/item/ItemColors;)V"
+                    target = "Lnet/minecraft/client/renderer/ItemRenderer;<init>(Lnet/minecraft/client/renderer/texture/TextureManager;Lnet/minecraft/client/renderer/model/ModelManager;Lnet/minecraft/client/renderer/color/ItemColors;)V"
             )
     )
-    private static void injectAfterModels(GameConfig gameConfig, CallbackInfo ci) {
+    private void injectAfterModels(GameConfiguration gameConfig, CallbackInfo ci) {
         Deduplicator.registerReloadListener();
     }
 }

+ 1 - 5
forge/build.gradle

@@ -12,13 +12,9 @@ architectury {
     platformSetupLoomIde()
 }
 
-loom {
-     useFabricMixin = true
-}
-
 dependencies {
     minecraft("com.mojang:minecraft:${rootProject.minecraft_version}")
-    mappings(minecraft.officialMojangMappings())
+    mappings "de.oceanlabs.mcp:mcp_snapshot:20201028-1.16.3"
     forge("net.minecraftforge:forge:${rootProject.minecraft_version}-${rootProject.forge_version}")
 
     compileOnly(project(path: ":common")) {