forked from FabricMC/fabric
Merge branch 'snapshot/1.14.3'
This commit is contained in:
commit
dd6c927b12
11 changed files with 28 additions and 27 deletions
|
@ -12,7 +12,7 @@ plugins {
|
||||||
def ENV = System.getenv()
|
def ENV = System.getenv()
|
||||||
|
|
||||||
def baseVersion = "0.3.0"
|
def baseVersion = "0.3.0"
|
||||||
def mcVersion = "1.14.2"
|
def mcVersion = "1.14.3"
|
||||||
def yarnVersion = "+build.1"
|
def yarnVersion = "+build.1"
|
||||||
|
|
||||||
def getSubprojectVersion(project, version) {
|
def getSubprojectVersion(project, version) {
|
||||||
|
@ -182,7 +182,7 @@ curseforge {
|
||||||
project {
|
project {
|
||||||
id = '306612'
|
id = '306612'
|
||||||
changelog = 'A changelog can be found at https://github.com/FabricMC/fabric/commits/master'
|
changelog = 'A changelog can be found at https://github.com/FabricMC/fabric/commits/master'
|
||||||
releaseType = 'beta'
|
releaseType = 'alpha'
|
||||||
addGameVersion '1.14-Snapshot'
|
addGameVersion '1.14-Snapshot'
|
||||||
mainArtifact(file("${project.buildDir}/libs/${archivesBaseName}-${version}.jar")) {
|
mainArtifact(file("${project.buildDir}/libs/${archivesBaseName}-${version}.jar")) {
|
||||||
displayName = "[$mcVersion] Fabric API $baseVersion build $ENV.BUILD_NUMBER"
|
displayName = "[$mcVersion] Fabric API $baseVersion build $ENV.BUILD_NUMBER"
|
||||||
|
|
|
@ -105,12 +105,12 @@ public final class FabricItemGroupBuilder {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void appendItems(DefaultedList<ItemStack> stacks) {
|
public void appendStacks(DefaultedList<ItemStack> stacks) {
|
||||||
if (stacksForDisplay != null) {
|
if (stacksForDisplay != null) {
|
||||||
stacksForDisplay.accept(stacks);
|
stacksForDisplay.accept(stacks);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
super.appendItems(stacks);
|
super.appendStacks(stacks);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,7 @@ import net.minecraft.client.gui.screen.ingame.CreativeInventoryScreen;
|
||||||
import net.minecraft.container.Container;
|
import net.minecraft.container.Container;
|
||||||
import net.minecraft.entity.player.PlayerInventory;
|
import net.minecraft.entity.player.PlayerInventory;
|
||||||
import net.minecraft.item.ItemGroup;
|
import net.minecraft.item.ItemGroup;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.text.Text;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.Shadow;
|
import org.spongepowered.asm.mixin.Shadow;
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
@ -34,7 +34,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||||
@Mixin(CreativeInventoryScreen.class)
|
@Mixin(CreativeInventoryScreen.class)
|
||||||
public abstract class MixinCreativePlayerInventoryGui extends AbstractInventoryScreen implements CreativeGuiExtensions {
|
public abstract class MixinCreativePlayerInventoryGui extends AbstractInventoryScreen implements CreativeGuiExtensions {
|
||||||
|
|
||||||
public MixinCreativePlayerInventoryGui(Container container_1, PlayerInventory playerInventory_1, Component textComponent_1) {
|
public MixinCreativePlayerInventoryGui(Container container_1, PlayerInventory playerInventory_1, Text textComponent_1) {
|
||||||
super(container_1, playerInventory_1, textComponent_1);
|
super(container_1, playerInventory_1, textComponent_1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,10 +16,13 @@
|
||||||
|
|
||||||
package net.fabricmc.fabric.mixin.loot;
|
package net.fabricmc.fabric.mixin.loot;
|
||||||
|
|
||||||
|
import com.google.common.collect.ImmutableMap;
|
||||||
|
import com.google.gson.JsonObject;
|
||||||
import net.fabricmc.fabric.api.loot.v1.event.LootTableLoadingCallback;
|
import net.fabricmc.fabric.api.loot.v1.event.LootTableLoadingCallback;
|
||||||
import net.fabricmc.fabric.api.loot.v1.FabricLootSupplierBuilder;
|
import net.fabricmc.fabric.api.loot.v1.FabricLootSupplierBuilder;
|
||||||
import net.minecraft.resource.ResourceManager;
|
import net.minecraft.resource.ResourceManager;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
|
import net.minecraft.util.profiler.Profiler;
|
||||||
import net.minecraft.world.loot.LootManager;
|
import net.minecraft.world.loot.LootManager;
|
||||||
import net.minecraft.world.loot.LootSupplier;
|
import net.minecraft.world.loot.LootSupplier;
|
||||||
import org.spongepowered.asm.mixin.Final;
|
import org.spongepowered.asm.mixin.Final;
|
||||||
|
@ -34,10 +37,10 @@ import java.util.Map;
|
||||||
|
|
||||||
@Mixin(LootManager.class)
|
@Mixin(LootManager.class)
|
||||||
public class MixinLootManager {
|
public class MixinLootManager {
|
||||||
@Shadow @Final private Map<Identifier, LootSupplier> suppliers;
|
@Shadow private Map<Identifier, LootSupplier> suppliers;
|
||||||
|
|
||||||
@Inject(method = "apply", at = @At("RETURN"))
|
@Inject(method = "method_20712", at = @At("RETURN"))
|
||||||
private void apply(ResourceManager manager, CallbackInfo info) {
|
private void apply(Map<Identifier, JsonObject> objectMap, ResourceManager manager, Profiler profiler, CallbackInfo info) {
|
||||||
Map<Identifier, LootSupplier> newSuppliers = new HashMap<>();
|
Map<Identifier, LootSupplier> newSuppliers = new HashMap<>();
|
||||||
|
|
||||||
suppliers.forEach((id, supplier) -> {
|
suppliers.forEach((id, supplier) -> {
|
||||||
|
@ -51,8 +54,6 @@ public class MixinLootManager {
|
||||||
newSuppliers.computeIfAbsent(id, (i) -> builder.create());
|
newSuppliers.computeIfAbsent(id, (i) -> builder.create());
|
||||||
});
|
});
|
||||||
|
|
||||||
for (Identifier id : newSuppliers.keySet()) {
|
suppliers = ImmutableMap.copyOf(newSuppliers);
|
||||||
suppliers.put(id, newSuppliers.get(id));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -88,7 +88,7 @@ public final class ToolManager {
|
||||||
|
|
||||||
private static int getMiningLevel(ItemStack stack) {
|
private static int getMiningLevel(ItemStack stack) {
|
||||||
if (stack.getItem() instanceof ToolItem) {
|
if (stack.getItem() instanceof ToolItem) {
|
||||||
return ((ToolItem) stack.getItem()).getType().getMiningLevel();
|
return ((ToolItem) stack.getItem()).getMaterial().getMiningLevel();
|
||||||
} else {
|
} else {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -102,7 +102,7 @@ public final class ToolManager {
|
||||||
if (entry != null) {
|
if (entry != null) {
|
||||||
Item item = stack.getItem();
|
Item item = stack.getItem();
|
||||||
for (int i = 0; i < entry.tags.length; i++) {
|
for (int i = 0; i < entry.tags.length; i++) {
|
||||||
if (item.matches(entry.tags[i])) {
|
if (item.isIn(entry.tags[i])) {
|
||||||
return TriState.of(getMiningLevel(stack) >= entry.tagLevels[i]);
|
return TriState.of(getMiningLevel(stack) >= entry.tagLevels[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,5 +23,5 @@ import org.spongepowered.asm.mixin.gen.Accessor;
|
||||||
@Mixin(MiningToolItem.class)
|
@Mixin(MiningToolItem.class)
|
||||||
public interface MiningToolItemAccessor {
|
public interface MiningToolItemAccessor {
|
||||||
@Accessor
|
@Accessor
|
||||||
float getBlockBreakingSpeed();
|
float getMiningSpeed();
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,12 +41,12 @@ public abstract class MixinItemStack {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Inject(at = @At("HEAD"), method = "getBlockBreakingSpeed", cancellable = true)
|
@Inject(at = @At("HEAD"), method = "getMiningSpeed", cancellable = true)
|
||||||
public void getBlockBreakingSpeed(BlockState state, CallbackInfoReturnable<Float> info) {
|
public void getBlockBreakingSpeed(BlockState state, CallbackInfoReturnable<Float> info) {
|
||||||
if (this.getItem() instanceof MiningToolItemAccessor) {
|
if (this.getItem() instanceof MiningToolItemAccessor) {
|
||||||
TriState triState = ToolManager.handleIsEffectiveOn((ItemStack) (Object) this, state);
|
TriState triState = ToolManager.handleIsEffectiveOn((ItemStack) (Object) this, state);
|
||||||
if (triState != TriState.DEFAULT) {
|
if (triState != TriState.DEFAULT) {
|
||||||
info.setReturnValue(triState.get() ? ((MiningToolItemAccessor) this.getItem()).getBlockBreakingSpeed() : 1.0F);
|
info.setReturnValue(triState.get() ? ((MiningToolItemAccessor) this.getItem()).getMiningSpeed() : 1.0F);
|
||||||
info.cancel();
|
info.cancel();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@ package net.fabricmc.fabric.api.entity;
|
||||||
import net.fabricmc.fabric.impl.entity.FabricEntityType;
|
import net.fabricmc.fabric.impl.entity.FabricEntityType;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.EntityCategory;
|
import net.minecraft.entity.EntityCategory;
|
||||||
import net.minecraft.entity.EntitySize;
|
import net.minecraft.entity.EntityDimensions;
|
||||||
import net.minecraft.entity.EntityType;
|
import net.minecraft.entity.EntityType;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
|
@ -44,7 +44,7 @@ public class FabricEntityTypeBuilder<T extends Entity> {
|
||||||
private int updateIntervalTicks = -1;
|
private int updateIntervalTicks = -1;
|
||||||
private Boolean alwaysUpdateVelocity;
|
private Boolean alwaysUpdateVelocity;
|
||||||
private boolean immuneToFire = false;
|
private boolean immuneToFire = false;
|
||||||
private EntitySize size = EntitySize.resizeable(-1.0f, -1.0f);
|
private EntityDimensions size = EntityDimensions.changing(-1.0f, -1.0f);
|
||||||
|
|
||||||
protected FabricEntityTypeBuilder(EntityCategory category, EntityType.EntityFactory<T> function) {
|
protected FabricEntityTypeBuilder(EntityCategory category, EntityType.EntityFactory<T> function) {
|
||||||
this.category = category;
|
this.category = category;
|
||||||
|
@ -83,15 +83,15 @@ public class FabricEntityTypeBuilder<T extends Entity> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated Use {@link FabricEntityTypeBuilder#size(EntitySize)}
|
* @deprecated Use {@link FabricEntityTypeBuilder#size(EntityDimensions)}
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public FabricEntityTypeBuilder<T> size(float width, float height) {
|
public FabricEntityTypeBuilder<T> size(float width, float height) {
|
||||||
this.size = EntitySize.resizeable(width, height);
|
this.size = EntityDimensions.changing(width, height);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public FabricEntityTypeBuilder<T> size(EntitySize size) {
|
public FabricEntityTypeBuilder<T> size(EntityDimensions size) {
|
||||||
this.size = size;
|
this.size = size;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,14 +19,14 @@ package net.fabricmc.fabric.impl.entity;
|
||||||
import com.mojang.datafixers.types.Type;
|
import com.mojang.datafixers.types.Type;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.EntityCategory;
|
import net.minecraft.entity.EntityCategory;
|
||||||
import net.minecraft.entity.EntitySize;
|
import net.minecraft.entity.EntityDimensions;
|
||||||
import net.minecraft.entity.EntityType;
|
import net.minecraft.entity.EntityType;
|
||||||
|
|
||||||
public class FabricEntityType<T extends Entity> extends EntityType<T> {
|
public class FabricEntityType<T extends Entity> extends EntityType<T> {
|
||||||
private final int maxTrackDistance, trackTickInterval;
|
private final int maxTrackDistance, trackTickInterval;
|
||||||
private final Boolean alwaysUpdateVelocity;
|
private final Boolean alwaysUpdateVelocity;
|
||||||
|
|
||||||
public FabricEntityType(EntityFactory<T> entityType$EntityFactory_1, EntityCategory entityCategory_1, boolean boolean_1, boolean boolean_2, boolean boolean_3, Type<?> type_1, EntitySize entitySize_1, int maxTrackDistance, int trackTickInterval, Boolean alwaysUpdateVelocity) {
|
public FabricEntityType(EntityFactory<T> entityType$EntityFactory_1, EntityCategory entityCategory_1, boolean boolean_1, boolean boolean_2, boolean boolean_3, Type<?> type_1, EntityDimensions entitySize_1, int maxTrackDistance, int trackTickInterval, Boolean alwaysUpdateVelocity) {
|
||||||
super(entityType$EntityFactory_1, entityCategory_1, boolean_1, boolean_2, boolean_3, type_1, entitySize_1);
|
super(entityType$EntityFactory_1, entityCategory_1, boolean_1, boolean_2, boolean_3, type_1, entitySize_1);
|
||||||
this.maxTrackDistance = maxTrackDistance;
|
this.maxTrackDistance = maxTrackDistance;
|
||||||
this.trackTickInterval = trackTickInterval;
|
this.trackTickInterval = trackTickInterval;
|
||||||
|
|
|
@ -20,7 +20,7 @@ import net.fabricmc.api.ClientModInitializer;
|
||||||
import net.fabricmc.fabric.api.network.ClientSidePacketRegistry;
|
import net.fabricmc.fabric.api.network.ClientSidePacketRegistry;
|
||||||
import net.minecraft.client.MinecraftClient;
|
import net.minecraft.client.MinecraftClient;
|
||||||
import net.minecraft.client.network.ClientPlayerEntity;
|
import net.minecraft.client.network.ClientPlayerEntity;
|
||||||
import net.minecraft.network.chat.TextComponent;
|
import net.minecraft.text.LiteralText;
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ public class FabricRegistryClientInit implements ClientModInitializer {
|
||||||
LOGGER.error("Registry remapping failed!", e);
|
LOGGER.error("Registry remapping failed!", e);
|
||||||
MinecraftClient.getInstance().execute(() -> {
|
MinecraftClient.getInstance().execute(() -> {
|
||||||
((ClientPlayerEntity) ctx.getPlayer()).networkHandler.getClientConnection().disconnect(
|
((ClientPlayerEntity) ctx.getPlayer()).networkHandler.getClientConnection().disconnect(
|
||||||
new TextComponent("Registry remapping failed: " + e.getMessage())
|
new LiteralText("Registry remapping failed: " + e.getMessage())
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -35,7 +35,7 @@ public final class BlockItemTracker implements RegistryEntryAddedCallback<Item>
|
||||||
@Override
|
@Override
|
||||||
public void onEntryAdded(int rawId, Identifier id, Item object) {
|
public void onEntryAdded(int rawId, Identifier id, Item object) {
|
||||||
if (object instanceof BlockItem) {
|
if (object instanceof BlockItem) {
|
||||||
((BlockItem) object).registerBlockItemMap(Item.BLOCK_ITEM_MAP, object);
|
((BlockItem) object).appendBlocks(Item.BLOCK_ITEMS, object);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue