This commit is contained in:
modmuss50 2020-04-22 17:59:17 +01:00
parent 526cfc4b2f
commit 2fd224ca63
26 changed files with 80 additions and 86 deletions
build.gradle
fabric-biomes-v1
build.gradle
src/main/java/net/fabricmc/fabric/mixin/biome
fabric-commands-v0
build.gradle
src/main/java/net/fabricmc/fabric/mixin/command
fabric-dimensions-v1
fabric-item-groups-v0
build.gradle
src/main/java/net/fabricmc/fabric
fabric-object-builders-v0
build.gradle
src/main/java/net/fabricmc/fabric
fabric-registry-sync-v0
build.gradle
src/main
java/net/fabricmc/fabric/mixin/registry/sync
resources
fabric-rendering-v1
build.gradle
src/main/java/net/fabricmc/fabric
api/client/rendering/v1
mixin/client/rendering
fabric-resource-loader-v0
build.gradle
src/main/java/net/fabricmc/fabric/mixin/resource/loader
fabric-tag-extensions-v0
build.gradle
src/main/java/net/fabricmc/fabric/mixin/tag/extension

View file

@ -12,8 +12,8 @@ plugins {
def ENV = System.getenv()
class Globals {
static def baseVersion = "0.6.1"
static def mcVersion = "20w16a"
static def baseVersion = "0.6.2"
static def mcVersion = "20w17a"
static def yarnVersion = "+build.1"
}

View file

@ -1,2 +1,2 @@
archivesBaseName = "fabric-biomes-v1"
version = getSubprojectVersion(project, "0.2.1")
version = getSubprojectVersion(project, "0.2.2")

View file

@ -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.Mixin;
import org.spongepowered.asm.mixin.injection.At;
@ -30,11 +30,11 @@ import net.fabricmc.fabric.impl.biome.InternalBiomeData;
@Mixin(TheNetherDimension.class)
public class MixinTheNetherDimension {
@ModifyArg(method = "createChunkGenerator", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/biome/source/MultiNoiseBiomeSourceConfig;withBiomes(Ljava/util/Set;)Lnet/minecraft/world/biome/source/MultiNoiseBiomeSourceConfig;"))
protected Set<Biome> modifyNetherBiomes(Set<Biome> set) {
@ModifyArg(method = "createChunkGenerator", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/biome/source/MultiNoiseBiomeSourceConfig;withBiomes(Ljava/util/List;)Lnet/minecraft/world/biome/source/MultiNoiseBiomeSourceConfig;"))
protected List<Biome> modifyNetherBiomes(List<Biome> list) {
// the provided set is immutable, so we construct our own
Set<Biome> newSet = new HashSet<>(set);
newSet.addAll(InternalBiomeData.getNetherBiomes());
return newSet;
List<Biome> newList = new ArrayList<>(list);
newList.addAll(InternalBiomeData.getNetherBiomes());
return newList;
}
}

View file

@ -1,5 +1,5 @@
archivesBaseName = "fabric-commands-v0"
version = getSubprojectVersion(project, "0.1.4")
version = getSubprojectVersion(project, "0.1.5")
dependencies {
compile project(path: ':fabric-api-base', configuration: 'dev')

View file

@ -32,13 +32,14 @@ import net.minecraft.server.command.CommandManager;
import net.minecraft.server.dedicated.MinecraftDedicatedServer;
import net.minecraft.world.level.storage.LevelStorage;
import net.minecraft.util.UserCache;
import net.minecraft.class_5219;
import net.fabricmc.fabric.impl.command.CommandRegistryImpl;
@Mixin(MinecraftDedicatedServer.class)
public abstract class MixinMinecraftDedicatedServer extends MinecraftServer {
public MixinMinecraftDedicatedServer(LevelStorage.Session session, Proxy proxy, DataFixer dataFixer, CommandManager commandManager, MinecraftSessionService minecraftSessionService, GameProfileRepository gameProfileRepository, UserCache userCache, WorldGenerationProgressListenerFactory worldGenerationProgressListenerFactory) {
super(session, proxy, dataFixer, commandManager, minecraftSessionService, gameProfileRepository, userCache, worldGenerationProgressListenerFactory);
public MixinMinecraftDedicatedServer(LevelStorage.Session session, class_5219 arg, Proxy proxy, DataFixer dataFixer, CommandManager commandManager, MinecraftSessionService minecraftSessionService, GameProfileRepository gameProfileRepository, UserCache userCache, WorldGenerationProgressListenerFactory worldGenerationProgressListenerFactory) {
super(session, arg, proxy, dataFixer, commandManager, minecraftSessionService, gameProfileRepository, userCache, worldGenerationProgressListenerFactory);
}
@Inject(method = "setupServer", at = @At("HEAD"))

View file

@ -1,5 +1,5 @@
archivesBaseName = "fabric-dimensions-v1"
version = getSubprojectVersion(project, "0.3.3")
version = getSubprojectVersion(project, "0.4.0")
dependencies {
compile project(path: ':fabric-api-base', configuration: 'dev')

View file

@ -31,7 +31,6 @@ import net.minecraft.util.Identifier;
import net.minecraft.network.PacketByteBuf;
import net.minecraft.util.registry.Registry;
import net.minecraft.world.dimension.DimensionType;
import net.minecraft.world.level.LevelProperties;
import net.fabricmc.fabric.api.dimension.v1.FabricDimensionType;
import net.fabricmc.fabric.api.network.ServerSidePacketRegistry;
@ -135,9 +134,9 @@ public class DimensionIdsFixer {
}
}
public static Packet<?> createPacket(LevelProperties levelProperties) {
public static Packet<?> createPacket(DimensionIdsHolder dimensionIdsHolder) {
PacketByteBuf buf = new PacketByteBuf(Unpooled.buffer());
buf.writeCompoundTag(((DimensionIdsHolder) levelProperties).fabric_getDimensionIds());
buf.writeCompoundTag(dimensionIdsHolder.fabric_getDimensionIds());
return ServerSidePacketRegistry.INSTANCE.toPacket(ID, buf);
}

View file

@ -26,7 +26,7 @@ import net.fabricmc.fabric.impl.dimension.DimensionRemapException;
@Mixin(LevelStorage.class)
public abstract class MixinLevelStorage {
@ModifyArg(method = "readLevelProperties(Ljava/io/File;Lcom/mojang/datafixers/DataFixer;)Lnet/minecraft/world/level/LevelProperties;", at = @At(value = "INVOKE", target = "Lorg/apache/logging/log4j/Logger;error(Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)V", remap = false), index = 2)
@ModifyArg(method = "readLevelProperties(Ljava/io/File;Lcom/mojang/datafixers/DataFixer;)Lnet/minecraft/class_5219;", at = @At(value = "INVOKE", target = "Lorg/apache/logging/log4j/Logger;error(Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)V", remap = false), index = 2)
private static Object disableRecovery(Object e) {
if (e instanceof DimensionRemapException) {
throw (DimensionRemapException) e;

View file

@ -27,6 +27,7 @@ import net.minecraft.server.network.ServerPlayerEntity;
import net.fabricmc.fabric.impl.dimension.DimensionIdsFixer;
import net.fabricmc.fabric.impl.dimension.FabricDimensionInternals;
import net.fabricmc.fabric.impl.dimension.DimensionIdsHolder;
@Mixin(PlayerManager.class)
public abstract class MixinPlayerManager {
@ -39,7 +40,9 @@ public abstract class MixinPlayerManager {
// No need to send the packet if the player is using the same game instance (dimension types are static)
if (!player.server.isSinglePlayer() || !conn.isLocal() || FabricDimensionInternals.DEBUG) {
player.networkHandler.sendPacket(DimensionIdsFixer.createPacket(player.world.getLevelProperties()));
if (player.world.getLevelProperties() instanceof DimensionIdsHolder) {
player.networkHandler.sendPacket(DimensionIdsFixer.createPacket((DimensionIdsHolder) player.world.getLevelProperties()));
}
}
}
}

View file

@ -21,8 +21,8 @@ import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.world.level.LevelProperties;
import net.minecraft.world.level.UnmodifiableLevelProperties;
import net.minecraft.class_5217;
import net.fabricmc.fabric.impl.dimension.DimensionIdsHolder;
@ -30,7 +30,7 @@ import net.fabricmc.fabric.impl.dimension.DimensionIdsHolder;
public abstract class MixinUnmodifiableLevelProperties implements DimensionIdsHolder {
@Shadow
@Final
private LevelProperties properties;
private class_5217 properties;
/**
* Delegates to the main level properties.

View file

@ -1,5 +1,5 @@
archivesBaseName = "fabric-item-groups-v0"
version = getSubprojectVersion(project, "0.1.10")
version = getSubprojectVersion(project, "0.1.12")
dependencies {
compile project(path: ':fabric-api-base', configuration: 'dev')

View file

@ -25,8 +25,11 @@ import com.mojang.blaze3d.systems.RenderSystem;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.screen.ingame.CreativeInventoryScreen;
import net.minecraft.client.gui.widget.ButtonWidget;
import net.minecraft.client.resource.language.I18n;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.item.ItemGroup;
import net.minecraft.text.LiteralText;
import net.minecraft.text.Text;
import net.minecraft.text.TranslatableText;
import net.minecraft.util.Identifier;
public class FabricCreativeGuiComponents {
@ -52,7 +55,7 @@ public class FabricCreativeGuiComponents {
}
@Override
public void render(int mouseX, int mouseY, float float_1) {
public void render(MatrixStack matrixStack, int mouseX, int mouseY, float float_1) {
this.visible = extensions.fabric_isButtonVisible(type);
this.active = extensions.fabric_isButtonEnabled(type);
@ -61,23 +64,23 @@ public class FabricCreativeGuiComponents {
minecraftClient.getTextureManager().bindTexture(BUTTON_TEX);
RenderSystem.disableLighting();
RenderSystem.color4f(1F, 1F, 1F, 1F);
this.drawTexture(this.x, this.y, (type == Type.NEXT ? 12 : 0), (active ? 0 : 12), 12, 12);
this.drawTexture(matrixStack, this.x, this.y, (type == Type.NEXT ? 12 : 0), (active ? 0 : 12), 12, 12);
if (mouseX >= this.x && mouseY >= this.y && mouseX < this.x + this.width && mouseY < this.y + this.height) {
gui.renderTooltip(I18n.translate("fabric.gui.creativeTabPage", extensions.fabric_currentPage() + 1, ((ItemGroup.GROUPS.length - 12) / 9) + 2), mouseX, mouseY);
gui.renderTooltip(matrixStack, new TranslatableText("fabric.gui.creativeTabPage", extensions.fabric_currentPage() + 1, ((ItemGroup.GROUPS.length - 12) / 9) + 2), mouseX, mouseY);
}
}
}
}
public enum Type {
NEXT(">", CreativeGuiExtensions::fabric_nextPage),
PREVIOUS("<", CreativeGuiExtensions::fabric_previousPage);
NEXT(new LiteralText(">"), CreativeGuiExtensions::fabric_nextPage),
PREVIOUS(new LiteralText("<"), CreativeGuiExtensions::fabric_previousPage);
String text;
Text text;
Consumer<CreativeGuiExtensions> clickConsumer;
Type(String text, Consumer<CreativeGuiExtensions> clickConsumer) {
Type(Text text, Consumer<CreativeGuiExtensions> clickConsumer) {
this.text = text;
this.clickConsumer = clickConsumer;
}

View file

@ -25,6 +25,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import net.minecraft.client.gui.screen.ingame.AbstractInventoryScreen;
import net.minecraft.client.gui.screen.ingame.CreativeInventoryScreen;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.screen.ScreenHandler;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.item.ItemGroup;
@ -134,7 +135,7 @@ public abstract class MixinCreativePlayerInventoryGui extends AbstractInventoryS
}
@Inject(method = "renderTabTooltipIfHovered", at = @At("HEAD"), cancellable = true)
private void method_2471(ItemGroup itemGroup, int mx, int my, CallbackInfoReturnable<Boolean> info) {
private void renderTabTooltipIfHovered(MatrixStack matrixStack, ItemGroup itemGroup, int mx, int my, CallbackInfoReturnable<Boolean> info) {
if (!fabric_isGroupVisible(itemGroup)) {
info.setReturnValue(false);
}
@ -148,7 +149,7 @@ public abstract class MixinCreativePlayerInventoryGui extends AbstractInventoryS
}
@Inject(method = "renderTabIcon", at = @At("HEAD"), cancellable = true)
private void method_2468(ItemGroup itemGroup, CallbackInfo info) {
private void renderTabIcon(MatrixStack matrixStack, ItemGroup itemGroup, CallbackInfo info) {
if (!fabric_isGroupVisible(itemGroup)) {
info.cancel();
}

View file

@ -1,5 +1,5 @@
archivesBaseName = "fabric-object-builders"
version = getSubprojectVersion(project, "0.2.5")
version = getSubprojectVersion(project, "0.3.0")
dependencies {
compile project(path: ':fabric-api-base', configuration: 'dev')

View file

@ -42,8 +42,8 @@ public class FabricEntityTypeBuilder<T extends Entity> {
private final EntityType.EntityFactory<T> function;
private boolean saveable = true;
private boolean summonable = true;
private int trackingDistance = -1;
private int updateIntervalTicks = -1;
private int trackingDistance = 5;
private int updateIntervalTicks = 3;
private Boolean alwaysUpdateVelocity;
private boolean immuneToFire = false;
private int maxDespawnDistance = 128;

View file

@ -22,34 +22,13 @@ import net.minecraft.entity.EntityDimensions;
import net.minecraft.entity.EntityType;
public class FabricEntityType<T extends Entity> extends EntityType<T> {
private final int maxTrackDistance, trackTickInterval;
private final Boolean alwaysUpdateVelocity;
public FabricEntityType(EntityType.EntityFactory<T> factory, EntityCategory category, boolean bl, boolean summonable, boolean fireImmune, boolean spawnableFarFromPlayer, int i, int j, EntityDimensions entityDimensions, int maxTrackDistance, int trackTickInterval, Boolean alwaysUpdateVelocity) {
super(factory, category, bl, summonable, fireImmune, spawnableFarFromPlayer, i, j, entityDimensions);
this.maxTrackDistance = maxTrackDistance;
this.trackTickInterval = trackTickInterval;
super(factory, category, bl, summonable, fireImmune, spawnableFarFromPlayer, i, j, entityDimensions, (maxTrackDistance + 15) / 16, trackTickInterval);
this.alwaysUpdateVelocity = alwaysUpdateVelocity;
}
@Override
public int getMaxTrackDistance() {
if (maxTrackDistance != -1) {
return (maxTrackDistance + 15) / 16;
}
return super.getMaxTrackDistance();
}
@Override
public int getTrackTickInterval() {
if (trackTickInterval != -1) {
return trackTickInterval;
}
return super.getTrackTickInterval();
}
@Override
public boolean alwaysUpdateVelocity() {
if (alwaysUpdateVelocity != null) {

View file

@ -1,5 +1,5 @@
archivesBaseName = "fabric-registry-sync-v0"
version = getSubprojectVersion(project, "0.2.10")
version = getSubprojectVersion(project, "0.3.0")
dependencies {
compile project(path: ':fabric-api-base', configuration: 'dev')

View file

@ -21,9 +21,12 @@ import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.Unique;
@ -34,27 +37,30 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.NbtIo;
import net.minecraft.world.WorldSaveHandler;
import net.minecraft.world.level.LevelProperties;
import net.minecraft.class_5219;
import net.minecraft.world.level.storage.LevelStorage;
import net.fabricmc.fabric.impl.registry.sync.RegistrySyncManager;
import net.fabricmc.fabric.impl.registry.sync.RemapException;
import net.fabricmc.fabric.impl.registry.sync.RemappableRegistry;
@Mixin(WorldSaveHandler.class)
public class MixinWorldSaveHandler {
@Mixin(LevelStorage.Session.class)
public class MixinLevelStorageSession {
@Unique
private static final int FABRIC_ID_REGISTRY_BACKUPS = 3;
@Unique
private static Logger FABRIC_LOGGER = LogManager.getLogger();
@Shadow
public File worldDir;
private static Logger FABRIC_LOGGER = LogManager.getLogger("FabricRegistrySync");
@Unique
private CompoundTag fabric_lastSavedIdMap = null;
@Shadow
@Final
private Path directory;
@Unique
private boolean fabric_readIdMapFile(File file) throws IOException, RemapException {
FABRIC_LOGGER.debug("Reading registry data from " + file.toString());
if (file.exists()) {
FileInputStream fileInputStream = new FileInputStream(file);
CompoundTag tag = NbtIo.readCompressed(fileInputStream);
@ -71,7 +77,7 @@ public class MixinWorldSaveHandler {
@Unique
private File fabric_getWorldIdMapFile(int i) {
return new File(new File(worldDir, "data"), "fabricRegistry" + ".dat" + (i == 0 ? "" : ("." + i)));
return new File(new File(directory.toFile(), "data"), "fabricRegistry" + ".dat" + (i == 0 ? "" : ("." + i)));
}
@Unique
@ -102,6 +108,7 @@ public class MixinWorldSaveHandler {
}
}
FABRIC_LOGGER.debug("Saving registry data to " + file.toString());
FileOutputStream fileOutputStream = new FileOutputStream(file);
NbtIo.writeCompressed(newIdMap, fileOutputStream);
fileOutputStream.close();
@ -113,9 +120,9 @@ public class MixinWorldSaveHandler {
}
}
@Inject(method = "saveWorld", at = @At("HEAD"))
public void saveWorld(LevelProperties levelProperties, CompoundTag compoundTag, CallbackInfo info) {
if (!worldDir.exists()) {
@Inject(method = "method_27426", at = @At("HEAD"))
public void saveWorld(class_5219 levelProperties, CompoundTag compoundTag, CallbackInfo info) {
if (!Files.exists(directory)) {
return;
}
@ -123,8 +130,8 @@ public class MixinWorldSaveHandler {
}
// TODO: stop double save on client?
@Inject(method = "readProperties", at = @At("HEAD"))
public void readWorldProperties(CallbackInfoReturnable<LevelProperties> callbackInfo) {
@Inject(method = "readLevelProperties", at = @At("HEAD"))
public void readWorldProperties(CallbackInfoReturnable<class_5219> callbackInfo) {
// Load
for (int i = 0; i < FABRIC_ID_REGISTRY_BACKUPS; i++) {
FABRIC_LOGGER.trace("[fabric-registry-sync] Loading Fabric registry [file " + (i + 1) + "/" + (FABRIC_ID_REGISTRY_BACKUPS + 1) + "]");

View file

@ -7,7 +7,7 @@
"MixinIdList",
"MixinIdRegistry",
"MixinPlayerManager",
"MixinWorldSaveHandler"
"MixinLevelStorageSession"
],
"client": [
"client.MixinBlockColorMap",

View file

@ -1,5 +1,5 @@
archivesBaseName = "fabric-rendering-v1"
version = getSubprojectVersion(project, "0.1.1")
version = getSubprojectVersion(project, "1.0.0")
dependencies {
compile project(path: ':fabric-api-base', configuration: 'dev')

View file

@ -16,20 +16,23 @@
package net.fabricmc.fabric.api.client.rendering.v1;
import net.minecraft.client.util.math.MatrixStack;
import net.fabricmc.fabric.api.event.Event;
import net.fabricmc.fabric.api.event.EventFactory;
public interface HudRenderCallback {
Event<HudRenderCallback> EVENT = EventFactory.createArrayBacked(HudRenderCallback.class, (listeners) -> (delta) -> {
Event<HudRenderCallback> EVENT = EventFactory.createArrayBacked(HudRenderCallback.class, (listeners) -> (matrixStack, delta) -> {
for (HudRenderCallback event : listeners) {
event.onHudRender(delta);
event.onHudRender(matrixStack, delta);
}
});
/**
* Called after rendering the whole hud, which is displayed in game, in a world.
*
* @param matrixStack the matrixStack
* @param tickDelta Progress for linearly interpolating between the previous and current game state
*/
void onHudRender(float tickDelta);
void onHudRender(MatrixStack matrixStack, float tickDelta);
}

View file

@ -21,6 +21,7 @@ import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.client.gui.hud.InGameHud;
import net.fabricmc.fabric.api.client.rendering.v1.HudRenderCallback;
@ -28,7 +29,7 @@ import net.fabricmc.fabric.api.client.rendering.v1.HudRenderCallback;
@Mixin(InGameHud.class)
public class MixinInGameHud {
@Inject(method = "render", at = @At(value = "RETURN", shift = At.Shift.BY, by = -6))
public void render(float tickDelta, CallbackInfo callbackInfo) {
HudRenderCallback.EVENT.invoker().onHudRender(tickDelta);
public void render(MatrixStack matrixStack, float tickDelta, CallbackInfo callbackInfo) {
HudRenderCallback.EVENT.invoker().onHudRender(matrixStack, tickDelta);
}
}

View file

@ -1,2 +1,2 @@
archivesBaseName = "fabric-resource-loader-v0"
version = getSubprojectVersion(project, "0.1.13")
version = getSubprojectVersion(project, "0.1.14")

View file

@ -16,8 +16,6 @@
package net.fabricmc.fabric.mixin.resource.loader;
import java.io.File;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
@ -28,7 +26,6 @@ import net.minecraft.resource.ResourcePackManager;
import net.minecraft.resource.ResourcePackProfile;
import net.minecraft.resource.ResourceType;
import net.minecraft.server.MinecraftServer;
import net.minecraft.world.level.LevelProperties;
import net.fabricmc.fabric.impl.resource.loader.ModResourcePackCreator;
@ -38,7 +35,7 @@ public class MixinMinecraftServer {
private ResourcePackManager<ResourcePackProfile> dataPackManager;
@Inject(method = "loadWorldDataPacks", at = @At(value = "INVOKE", target = "Lnet/minecraft/resource/ResourcePackManager;registerProvider(Lnet/minecraft/resource/ResourcePackProvider;)V", ordinal = 1))
public void appendFabricDataPacks(File file, LevelProperties properties, CallbackInfo info) {
public void appendFabricDataPacks(CallbackInfo info) {
dataPackManager.registerProvider(new ModResourcePackCreator(ResourceType.SERVER_DATA));
}
}

View file

@ -1,5 +1,5 @@
archivesBaseName = "fabric-tag-extensions-v0"
version = getSubprojectVersion(project, "0.2.3")
version = getSubprojectVersion(project, "0.2.4")
dependencies {
compile project(path: ':fabric-api-base', configuration: 'dev')

View file

@ -36,7 +36,7 @@ import net.fabricmc.fabric.impl.tag.extension.FabricTagHooks;
@Mixin(Tag.Builder.class)
public class MixinTagBuilder<T> implements FabricTagBuilder<T> {
@Shadow
private List<Tag.class_5145> entries;
private List<Tag.TrackedEntry> entries;
@Unique
private int fabric_clearCount;