mirror of
https://github.com/FabricMC/fabric.git
synced 2025-07-29 15:39:55 -04:00
20w21a initial port
This commit is contained in:
parent
6d41837a96
commit
4a08d6b285
16 changed files with 44 additions and 36 deletions
build.gradle
fabric-biomes-v1
build.gradle
src/main/java/net/fabricmc/fabric/mixin/biome
fabric-content-registries-v0
fabric-keybindings-v0
build.gradle
src/main/java/net/fabricmc/fabric
api/client/keybinding
impl/client/keybinding
mixin/client/keybinding
fabric-particles-v1
fabric-registry-sync-v0
build.gradle
settings.gradlesrc/main/java/net/fabricmc/fabric
|
@ -12,9 +12,9 @@ plugins {
|
|||
def ENV = System.getenv()
|
||||
|
||||
class Globals {
|
||||
static def baseVersion = "0.10.9"
|
||||
static def mcVersion = "20w20a"
|
||||
static def yarnVersion = "+build.1"
|
||||
static def baseVersion = "0.10.10"
|
||||
static def mcVersion = "20w21a"
|
||||
static def yarnVersion = "+build.2"
|
||||
}
|
||||
|
||||
version = Globals.baseVersion + "+" + (ENV.BUILD_NUMBER ? ("build." + ENV.BUILD_NUMBER) : "local") + "-" + getBranch()
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
archivesBaseName = "fabric-biomes-v1"
|
||||
version = getSubprojectVersion(project, "0.2.3")
|
||||
version = getSubprojectVersion(project, "0.2.4")
|
||||
|
|
|
@ -24,13 +24,13 @@ import org.spongepowered.asm.mixin.injection.At;
|
|||
import org.spongepowered.asm.mixin.injection.ModifyArg;
|
||||
|
||||
import net.minecraft.world.biome.Biome;
|
||||
import net.minecraft.class_5285;
|
||||
import net.minecraft.world.biome.source.MultiNoiseBiomeSource;
|
||||
|
||||
import net.fabricmc.fabric.impl.biome.InternalBiomeData;
|
||||
|
||||
@Mixin(class_5285.class)
|
||||
@Mixin(MultiNoiseBiomeSource.class)
|
||||
public class MixinTheNetherDimension {
|
||||
@ModifyArg(method = "method_28026", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/biome/source/MultiNoiseBiomeSource;method_27986(JLjava/util/List;)Lnet/minecraft/world/biome/source/MultiNoiseBiomeSource;"))
|
||||
@ModifyArg(method = "method_28467", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/biome/source/MultiNoiseBiomeSource;<init>(JLjava/util/List;Ljava/util/Optional;)V"))
|
||||
private static List<Biome> modifyNetherBiomes(List<Biome> list) {
|
||||
// the provided set is immutable, so we construct our own
|
||||
List<Biome> newList = new ArrayList<>(list);
|
||||
|
|
|
@ -16,8 +16,8 @@
|
|||
|
||||
package net.fabricmc.fabric.mixin.biome;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
|
@ -40,11 +40,11 @@ public class MixinVanillaLayeredBiomeSource {
|
|||
@Shadow
|
||||
@Final
|
||||
@Mutable
|
||||
private static Set<Biome> BIOMES;
|
||||
private static List<Biome> BIOMES;
|
||||
|
||||
@Inject(method = "<clinit>", at = @At("RETURN"))
|
||||
private static void cinit(CallbackInfo info) {
|
||||
BIOMES = new HashSet<>(BIOMES);
|
||||
BIOMES = new ArrayList<>(BIOMES);
|
||||
}
|
||||
|
||||
//Called via reflection
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
archivesBaseName = "fabric-content-registries-v0"
|
||||
version = getSubprojectVersion(project, "0.1.5")
|
||||
version = getSubprojectVersion(project, "0.1.6")
|
||||
|
||||
dependencies {
|
||||
compile project(path: ':fabric-api-base', configuration: 'dev')
|
||||
|
|
|
@ -57,7 +57,7 @@ public class MixinFireBlock implements FireBlockHooks {
|
|||
|
||||
if (entry != null) {
|
||||
// TODO: use a (BlockState -> int) with this as the default impl
|
||||
if (block.contains(Properties.WATERLOGGED) && block.get(Properties.WATERLOGGED)) {
|
||||
if (block.method_28498(Properties.WATERLOGGED) && block.get(Properties.WATERLOGGED)) {
|
||||
info.setReturnValue(0);
|
||||
} else {
|
||||
info.setReturnValue(entry.getBurnChance());
|
||||
|
@ -71,7 +71,7 @@ public class MixinFireBlock implements FireBlockHooks {
|
|||
|
||||
if (entry != null) {
|
||||
// TODO: use a (BlockState -> int) with this as the default impl
|
||||
if (block.contains(Properties.WATERLOGGED) && block.get(Properties.WATERLOGGED)) {
|
||||
if (block.method_28498(Properties.WATERLOGGED) && block.get(Properties.WATERLOGGED)) {
|
||||
info.setReturnValue(0);
|
||||
} else {
|
||||
info.setReturnValue(entry.getSpreadChance());
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
archivesBaseName = "fabric-keybindings-v0"
|
||||
version = getSubprojectVersion(project, "0.1.1")
|
||||
version = getSubprojectVersion(project, "0.1.2")
|
||||
|
||||
dependencies {
|
||||
compile project(path: ':fabric-api-base', configuration: 'dev')
|
||||
|
|
|
@ -37,8 +37,8 @@ public class FabricKeyBinding extends KeyBinding {
|
|||
* Returns the configured KeyCode assigned to the KeyBinding from the player's settings.
|
||||
* @return configured KeyCode
|
||||
*/
|
||||
public InputUtil.KeyCode getBoundKey() {
|
||||
return ((KeyCodeAccessor) this).getKeyCode();
|
||||
public InputUtil.Key getBoundKey() {
|
||||
return ((KeyCodeAccessor) this).getBoundKey();
|
||||
}
|
||||
|
||||
public static class Builder {
|
||||
|
|
|
@ -85,8 +85,8 @@ public class KeyBindingRegistryImpl implements KeyBindingRegistry {
|
|||
for (KeyBinding exBinding : fabricKeyBindingList) {
|
||||
if (exBinding == binding) {
|
||||
return false;
|
||||
} else if (exBinding.getId().equals(binding.getId())) {
|
||||
throw new RuntimeException("Attempted to register two key bindings with equal ID: " + binding.getId() + "!");
|
||||
} else if (exBinding.getTranslationKey().equals(binding.getTranslationKey())) {
|
||||
throw new RuntimeException("Attempted to register two key bindings with equal ID: " + binding.getTranslationKey() + "!");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -25,5 +25,5 @@ import net.minecraft.client.util.InputUtil;
|
|||
@Mixin(KeyBinding.class)
|
||||
public interface KeyCodeAccessor {
|
||||
@Accessor
|
||||
InputUtil.KeyCode getKeyCode();
|
||||
InputUtil.Key getBoundKey();
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
archivesBaseName = "fabric-particles-v1"
|
||||
version = getSubprojectVersion(project, "0.1.2")
|
||||
version = getSubprojectVersion(project, "0.1.3")
|
||||
|
||||
dependencies {
|
||||
compile project(path: ':fabric-api-base', configuration: 'dev')
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
|
||||
package net.fabricmc.fabric.api.particle.v1;
|
||||
|
||||
import com.mojang.serialization.Codec;
|
||||
|
||||
import net.minecraft.particle.DefaultParticleType;
|
||||
import net.minecraft.particle.ParticleEffect;
|
||||
import net.minecraft.particle.ParticleType;
|
||||
|
@ -74,6 +76,12 @@ public final class FabricParticleTypes {
|
|||
* @param factory A factory for serializing packet data and string command parameters into a particle effect.
|
||||
*/
|
||||
public static <T extends ParticleEffect> ParticleType<T> complex(boolean alwaysSpawn, ParticleEffect.Factory<T> factory) {
|
||||
return new ParticleType<T>(alwaysSpawn, factory) { };
|
||||
return new ParticleType<T>(alwaysSpawn, factory) {
|
||||
@Override
|
||||
public Codec<T> method_29138() {
|
||||
//TODO fix me
|
||||
return null;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
archivesBaseName = "fabric-registry-sync-v0"
|
||||
version = getSubprojectVersion(project, "0.3.2")
|
||||
version = getSubprojectVersion(project, "0.3.3")
|
||||
|
||||
dependencies {
|
||||
compile project(path: ':fabric-api-base', configuration: 'dev')
|
||||
|
|
|
@ -41,7 +41,6 @@ import net.minecraft.nbt.CompoundTag;
|
|||
import net.minecraft.network.Packet;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.network.PacketByteBuf;
|
||||
import net.minecraft.util.registry.MutableRegistry;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
|
||||
import net.fabricmc.fabric.api.network.PacketContext;
|
||||
|
@ -104,7 +103,7 @@ public final class RegistrySyncManager {
|
|||
}
|
||||
}
|
||||
|
||||
MutableRegistry registry = Registry.REGISTRIES.get(registryId);
|
||||
Registry registry = Registry.REGISTRIES.get(registryId);
|
||||
|
||||
if (c && registry != null) {
|
||||
File file = new File(location, registryId.toString().replace(':', '.').replace('/', '.') + ".csv");
|
||||
|
@ -137,7 +136,7 @@ public final class RegistrySyncManager {
|
|||
continue;
|
||||
}
|
||||
|
||||
MutableRegistry registry = Registry.REGISTRIES.get(registryId);
|
||||
Registry registry = Registry.REGISTRIES.get(registryId);
|
||||
|
||||
if (registry instanceof RemappableRegistry) {
|
||||
CompoundTag registryTag = new CompoundTag();
|
||||
|
@ -189,7 +188,7 @@ public final class RegistrySyncManager {
|
|||
}
|
||||
|
||||
CompoundTag registryTag = mainTag.getCompound(registryId.toString());
|
||||
MutableRegistry registry = Registry.REGISTRIES.get(registryId);
|
||||
Registry registry = Registry.REGISTRIES.get(registryId);
|
||||
|
||||
if (registry instanceof RemappableRegistry) {
|
||||
Object2IntMap<Identifier> idMap = new Object2IntOpenHashMap<>();
|
||||
|
@ -209,7 +208,7 @@ public final class RegistrySyncManager {
|
|||
|
||||
public static void unmap() throws RemapException {
|
||||
for (Identifier registryId : Registry.REGISTRIES.getIds()) {
|
||||
MutableRegistry registry = Registry.REGISTRIES.get(registryId);
|
||||
Registry registry = Registry.REGISTRIES.get(registryId);
|
||||
|
||||
if (registry instanceof RemappableRegistry) {
|
||||
((RemappableRegistry) registry).unmap(registryId.toString());
|
||||
|
|
|
@ -42,6 +42,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
|||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.collection.Int2ObjectBiMap;
|
||||
import net.minecraft.util.registry.SimpleRegistry;
|
||||
import net.minecraft.class_5321;
|
||||
|
||||
import net.fabricmc.fabric.api.event.Event;
|
||||
import net.fabricmc.fabric.api.event.EventFactory;
|
||||
|
@ -123,26 +124,26 @@ public abstract class MixinIdRegistry<T> implements RemappableRegistry, Listenab
|
|||
|
||||
@SuppressWarnings({"unchecked", "ConstantConditions"})
|
||||
@Inject(method = "set", at = @At("HEAD"))
|
||||
public void setPre(int id, Identifier identifier, Object object, CallbackInfoReturnable info) {
|
||||
public void setPre(int id, class_5321<T> registryId, Object object, CallbackInfoReturnable info) {
|
||||
int indexedEntriesId = indexedEntries.getId((T) object);
|
||||
|
||||
if (indexedEntriesId >= 0) {
|
||||
throw new RuntimeException("Attempted to register object " + object + " twice! (at raw IDs " + indexedEntriesId + " and " + id + " )");
|
||||
}
|
||||
|
||||
if (!entries.containsKey(identifier)) {
|
||||
if (!entries.containsKey(registryId.method_29177())) {
|
||||
fabric_isObjectNew = true;
|
||||
} else {
|
||||
T oldObject = entries.get(identifier);
|
||||
T oldObject = entries.get(registryId.method_29177());
|
||||
|
||||
if (oldObject != null && oldObject != object) {
|
||||
int oldId = indexedEntries.getId(oldObject);
|
||||
|
||||
if (oldId != id) {
|
||||
throw new RuntimeException("Attempted to register ID " + identifier + " at different raw IDs (" + oldId + ", " + id + ")! If you're trying to override an item, use .set(), not .register()!");
|
||||
throw new RuntimeException("Attempted to register ID " + registryId + " at different raw IDs (" + oldId + ", " + id + ")! If you're trying to override an item, use .set(), not .register()!");
|
||||
}
|
||||
|
||||
fabric_removeObjectEvent.invoker().onEntryRemoved(oldId, identifier, oldObject);
|
||||
fabric_removeObjectEvent.invoker().onEntryRemoved(oldId, registryId.method_29177(), oldObject);
|
||||
fabric_isObjectNew = true;
|
||||
} else {
|
||||
fabric_isObjectNew = false;
|
||||
|
@ -152,9 +153,9 @@ public abstract class MixinIdRegistry<T> implements RemappableRegistry, Listenab
|
|||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Inject(method = "set", at = @At("RETURN"))
|
||||
public void setPost(int id, Identifier identifier, Object object, CallbackInfoReturnable info) {
|
||||
public void setPost(int id, class_5321<T> registryId, Object object, CallbackInfoReturnable info) {
|
||||
if (fabric_isObjectNew) {
|
||||
fabric_addObjectEvent.invoker().onEntryAdded(id, identifier, object);
|
||||
fabric_addObjectEvent.invoker().onEntryAdded(id, registryId.method_29177(), object);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -44,5 +44,5 @@ include 'fabric-rendering-fluids-v1'
|
|||
include 'fabric-resource-loader-v0'
|
||||
include 'fabric-tag-extensions-v0'
|
||||
include 'fabric-textures-v0'
|
||||
include 'fabric-dimensions-v1'
|
||||
//include 'fabric-dimensions-v1'
|
||||
include 'fabric-tool-attribute-api-v1'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue