mirror of
https://github.com/FabricMC/fabric.git
synced 2025-04-21 11:20:55 -04:00
20w20a
This commit is contained in:
parent
8dcfcb1e89
commit
6d41837a96
19 changed files with 81 additions and 66 deletions
build.gradle
fabric-biomes-v1
fabric-dimensions-v1
build.gradle
src/main/java/net/fabricmc/fabric
fabric-events-interaction-v0
build.gradle
src/main/java/net/fabricmc/fabric/mixin/event/interaction
fabric-loot-tables-v1
build.gradle
src/main/java/net/fabricmc/fabric
fabric-object-builder-api-v1
build.gradle
src/main/java/net/fabricmc/fabric
fabric-object-builders-v0
|
@ -12,8 +12,8 @@ plugins {
|
|||
def ENV = System.getenv()
|
||||
|
||||
class Globals {
|
||||
static def baseVersion = "0.10.8"
|
||||
static def mcVersion = "20w19a"
|
||||
static def baseVersion = "0.10.9"
|
||||
static def mcVersion = "20w20a"
|
||||
static def yarnVersion = "+build.1"
|
||||
}
|
||||
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
archivesBaseName = "fabric-biomes-v1"
|
||||
version = getSubprojectVersion(project, "0.2.2")
|
||||
version = getSubprojectVersion(project, "0.2.3")
|
||||
|
|
|
@ -24,14 +24,14 @@ import org.spongepowered.asm.mixin.injection.At;
|
|||
import org.spongepowered.asm.mixin.injection.ModifyArg;
|
||||
|
||||
import net.minecraft.world.biome.Biome;
|
||||
import net.minecraft.world.dimension.TheNetherDimension;
|
||||
import net.minecraft.class_5285;
|
||||
|
||||
import net.fabricmc.fabric.impl.biome.InternalBiomeData;
|
||||
|
||||
@Mixin(TheNetherDimension.class)
|
||||
@Mixin(class_5285.class)
|
||||
public class MixinTheNetherDimension {
|
||||
@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) {
|
||||
@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;"))
|
||||
private static List<Biome> modifyNetherBiomes(List<Biome> list) {
|
||||
// the provided set is immutable, so we construct our own
|
||||
List<Biome> newList = new ArrayList<>(list);
|
||||
newList.addAll(InternalBiomeData.getNetherBiomes());
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
archivesBaseName = "fabric-dimensions-v1"
|
||||
version = getSubprojectVersion(project, "0.4.1")
|
||||
version = getSubprojectVersion(project, "0.4.2")
|
||||
|
||||
dependencies {
|
||||
compile project(path: ':fabric-api-base', configuration: 'dev')
|
||||
|
|
|
@ -60,7 +60,7 @@ public final class FabricDimensionType extends DimensionType {
|
|||
*/
|
||||
private FabricDimensionType(String suffix, String saveDir, Builder builder) {
|
||||
// Pass an arbitrary raw id that does not map to any vanilla dimension. That id should never get used.
|
||||
super(3, suffix, saveDir, builder.factory, builder.skyLight, builder.biomeAccessStrategy);
|
||||
super(3, suffix, saveDir, builder.factory, builder.skyLight, false, false, builder.biomeAccessStrategy);
|
||||
this.defaultPlacement = builder.defaultPlacer;
|
||||
}
|
||||
|
||||
|
|
|
@ -17,15 +17,22 @@
|
|||
package net.fabricmc.fabric.mixin.dimension;
|
||||
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.dimension.Dimension;
|
||||
import net.minecraft.world.dimension.DimensionType;
|
||||
|
||||
@Mixin(World.class)
|
||||
public abstract class MixinWorld {
|
||||
@Shadow
|
||||
public abstract Dimension getDimension();
|
||||
|
||||
@Shadow
|
||||
private int ambientDarkness;
|
||||
|
||||
/* World.isDay() and World.isNight() enable the day-night cycle as well as some entity behavior
|
||||
* (such as bees). In vanilla, these methods are hardcoded to only work in the overworld. This
|
||||
* redirector pretends that all dimensions with a visible sky are DimensionType.OVERWORLD, which
|
||||
|
@ -35,8 +42,17 @@ public abstract class MixinWorld {
|
|||
* customizable for modded dimensions. It is already used for time checking in other places
|
||||
* such as clocks.
|
||||
*/
|
||||
@Redirect(method = {"isDay", "isNight"}, at = @At(value = "INVOKE", target = "Lnet/minecraft/world/dimension/Dimension;getType()Lnet/minecraft/world/dimension/DimensionType;"))
|
||||
private DimensionType replaceCustomDimensionsWithOverworld(Dimension dimension) {
|
||||
return dimension.hasVisibleSky() ? DimensionType.OVERWORLD : dimension.getType();
|
||||
@Inject(method = "isDay", at = @At("HEAD"), cancellable = true)
|
||||
private void isDay(CallbackInfoReturnable<Boolean> infoReturnable) {
|
||||
if (getDimension().hasVisibleSky()) {
|
||||
infoReturnable.setReturnValue(ambientDarkness < 4);
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(method = "isNight", at = @At("HEAD"), cancellable = true)
|
||||
private void isNight(CallbackInfoReturnable<Boolean> infoReturnable) {
|
||||
if (getDimension().hasVisibleSky()) {
|
||||
infoReturnable.setReturnValue(!(ambientDarkness < 4));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
archivesBaseName = "fabric-events-interaction-v0"
|
||||
version = getSubprojectVersion(project, "0.3.0")
|
||||
version = getSubprojectVersion(project, "0.3.1")
|
||||
|
||||
dependencies {
|
||||
compile project(path: ':fabric-api-base', configuration: 'dev')
|
||||
|
|
|
@ -24,7 +24,6 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
|||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
import net.minecraft.network.packet.s2c.play.BlockUpdateS2CPacket;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.server.network.ServerPlayerEntity;
|
||||
import net.minecraft.server.network.ServerPlayerInteractionManager;
|
||||
|
@ -62,7 +61,7 @@ public class MixinServerPlayerInteractionManager {
|
|||
}
|
||||
|
||||
@Inject(at = @At("HEAD"), method = "interactBlock", cancellable = true)
|
||||
public void interactBlock(PlayerEntity player, World world, ItemStack stack, Hand hand, BlockHitResult blockHitResult, CallbackInfoReturnable<ActionResult> info) {
|
||||
public void interactBlock(ServerPlayerEntity player, World world, ItemStack stack, Hand hand, BlockHitResult blockHitResult, CallbackInfoReturnable<ActionResult> info) {
|
||||
ActionResult result = UseBlockCallback.EVENT.invoker().interact(player, world, hand, blockHitResult);
|
||||
|
||||
if (result != ActionResult.PASS) {
|
||||
|
@ -73,7 +72,7 @@ public class MixinServerPlayerInteractionManager {
|
|||
}
|
||||
|
||||
@Inject(at = @At("HEAD"), method = "interactItem", cancellable = true)
|
||||
public void interactItem(PlayerEntity player, World world, ItemStack stack, Hand hand, CallbackInfoReturnable<ActionResult> info) {
|
||||
public void interactItem(ServerPlayerEntity player, World world, ItemStack stack, Hand hand, CallbackInfoReturnable<ActionResult> info) {
|
||||
TypedActionResult<ItemStack> result = UseItemCallback.EVENT.invoker().interact(player, world, hand);
|
||||
|
||||
if (result.getResult() != ActionResult.PASS) {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
archivesBaseName = "fabric-loot-tables-v1"
|
||||
version = getSubprojectVersion(project, "0.1.6")
|
||||
version = getSubprojectVersion(project, "0.1.7")
|
||||
|
||||
dependencies {
|
||||
compile project(path: ':fabric-api-base', configuration: 'dev')
|
||||
|
|
|
@ -36,5 +36,5 @@ public interface FabricLootPool {
|
|||
List<LootEntry> getEntries();
|
||||
List<LootCondition> getConditions();
|
||||
List<LootFunction> getFunctions();
|
||||
LootTableRange getRollsRange();
|
||||
LootTableRange getRolls();
|
||||
}
|
||||
|
|
|
@ -34,26 +34,26 @@ public class FabricLootPoolBuilder extends LootPool.Builder {
|
|||
}
|
||||
|
||||
@Override
|
||||
public FabricLootPoolBuilder withRolls(LootTableRange range) {
|
||||
super.withRolls(range);
|
||||
public FabricLootPoolBuilder rolls(LootTableRange range) {
|
||||
super.rolls(range);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FabricLootPoolBuilder withEntry(LootEntry.Builder<?> entry) {
|
||||
super.withEntry(entry);
|
||||
public FabricLootPoolBuilder with(LootEntry.Builder<?> entry) {
|
||||
super.with(entry);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FabricLootPoolBuilder withCondition(LootCondition.Builder condition) {
|
||||
super.withCondition(condition);
|
||||
public FabricLootPoolBuilder conditionally(LootCondition.Builder condition) {
|
||||
super.conditionally(condition);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FabricLootPoolBuilder withFunction(LootFunction.Builder function) {
|
||||
super.withFunction(function);
|
||||
public FabricLootPoolBuilder apply(LootFunction.Builder function) {
|
||||
super.apply(function);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -86,7 +86,7 @@ public class FabricLootPoolBuilder extends LootPool.Builder {
|
|||
* Copies the entries, conditions and functions of the {@code pool} to this
|
||||
* builder.
|
||||
*
|
||||
* <p>If {@code copyRolls} is true, the {@link FabricLootPool#getRollsRange rolls} of the pool are also copied.
|
||||
* <p>If {@code copyRolls} is true, the {@link FabricLootPool#getRolls rolls} of the pool are also copied.
|
||||
*/
|
||||
public FabricLootPoolBuilder copyFrom(LootPool pool, boolean copyRolls) {
|
||||
FabricLootPool extendedPool = (FabricLootPool) pool;
|
||||
|
@ -95,7 +95,7 @@ public class FabricLootPoolBuilder extends LootPool.Builder {
|
|||
extended.getEntries().addAll(extendedPool.getEntries());
|
||||
|
||||
if (copyRolls) {
|
||||
withRolls(extendedPool.getRollsRange());
|
||||
rolls(extendedPool.getRolls());
|
||||
}
|
||||
|
||||
return this;
|
||||
|
|
|
@ -35,20 +35,20 @@ public class FabricLootSupplierBuilder extends LootTable.Builder {
|
|||
}
|
||||
|
||||
@Override
|
||||
public FabricLootSupplierBuilder withPool(LootPool.Builder pool) {
|
||||
super.withPool(pool);
|
||||
public FabricLootSupplierBuilder pool(LootPool.Builder pool) {
|
||||
super.pool(pool);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FabricLootSupplierBuilder withType(LootContextType type) {
|
||||
super.withType(type);
|
||||
public FabricLootSupplierBuilder type(LootContextType type) {
|
||||
super.type(type);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FabricLootSupplierBuilder withFunction(LootFunction.Builder function) {
|
||||
super.withFunction(function);
|
||||
public FabricLootSupplierBuilder apply(LootFunction.Builder function) {
|
||||
super.apply(function);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -90,7 +90,7 @@ public class FabricLootSupplierBuilder extends LootTable.Builder {
|
|||
extended.getFunctions().addAll(extendedSupplier.getFunctions());
|
||||
|
||||
if (copyType) {
|
||||
withType(extendedSupplier.getType());
|
||||
type(extendedSupplier.getType());
|
||||
}
|
||||
|
||||
return this;
|
||||
|
|
|
@ -52,7 +52,7 @@ public class MixinLootManager {
|
|||
manager, (LootManager) (Object) this, id, builder, (s) -> newSuppliers.put(id, s)
|
||||
);
|
||||
|
||||
newSuppliers.computeIfAbsent(id, (i) -> builder.create());
|
||||
newSuppliers.computeIfAbsent(id, (i) -> builder.build());
|
||||
});
|
||||
|
||||
tables = ImmutableMap.copyOf(newSuppliers);
|
||||
|
|
|
@ -63,5 +63,5 @@ public abstract class MixinLootPool implements FabricLootPool {
|
|||
|
||||
@Accessor
|
||||
@Override
|
||||
public abstract LootTableRange getRollsRange();
|
||||
public abstract LootTableRange getRolls();
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
archivesBaseName = "fabric-object-builder-api-v1"
|
||||
version = getSubprojectVersion(project, "1.3.0")
|
||||
version = getSubprojectVersion(project, "1.3.1")
|
||||
|
||||
dependencies {
|
||||
compile project(path: ':fabric-api-base', configuration: 'dev')
|
||||
|
|
|
@ -20,7 +20,7 @@ import org.apache.logging.log4j.LogManager;
|
|||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityCategory;
|
||||
import net.minecraft.entity.SpawnGroup;
|
||||
import net.minecraft.entity.EntityDimensions;
|
||||
import net.minecraft.entity.EntityType;
|
||||
|
||||
|
@ -34,7 +34,7 @@ import net.fabricmc.fabric.impl.object.builder.FabricEntityType;
|
|||
*/
|
||||
public class FabricEntityTypeBuilder<T extends Entity> {
|
||||
private static final Logger LOGGER = LogManager.getLogger();
|
||||
private final EntityCategory category;
|
||||
private final SpawnGroup spawnGroup;
|
||||
private final EntityType.EntityFactory<T> function;
|
||||
private boolean saveable = true;
|
||||
private boolean summonable = true;
|
||||
|
@ -45,35 +45,35 @@ public class FabricEntityTypeBuilder<T extends Entity> {
|
|||
private boolean spawnableFarFromPlayer;
|
||||
private EntityDimensions dimensions = EntityDimensions.changing(-1.0f, -1.0f);
|
||||
|
||||
protected FabricEntityTypeBuilder(EntityCategory category, EntityType.EntityFactory<T> function) {
|
||||
this.category = category;
|
||||
protected FabricEntityTypeBuilder(SpawnGroup spawnGroup, EntityType.EntityFactory<T> function) {
|
||||
this.spawnGroup = spawnGroup;
|
||||
this.function = function;
|
||||
this.spawnableFarFromPlayer = category == EntityCategory.CREATURE || category == EntityCategory.MISC;
|
||||
this.spawnableFarFromPlayer = spawnGroup == SpawnGroup.CREATURE || spawnGroup == SpawnGroup.MISC;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an entity type builder.
|
||||
*
|
||||
* @param category the entity category
|
||||
* @param spawnGroup the entity spawn group
|
||||
* @param <T> the type of entity
|
||||
*
|
||||
* @return a new entity type builder
|
||||
*/
|
||||
public static <T extends Entity> FabricEntityTypeBuilder<T> create(EntityCategory category) {
|
||||
return new FabricEntityTypeBuilder<>(category, (t, w) -> null);
|
||||
public static <T extends Entity> FabricEntityTypeBuilder<T> create(SpawnGroup spawnGroup) {
|
||||
return new FabricEntityTypeBuilder<>(spawnGroup, (t, w) -> null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an entity type builder.
|
||||
*
|
||||
* @param category the entity category
|
||||
* @param spawnGroup the entity spawn group
|
||||
* @param function the entity function used to create this entity
|
||||
* @param <T> the type of entity
|
||||
*
|
||||
* @return a new entity type builder
|
||||
*/
|
||||
public static <T extends Entity> FabricEntityTypeBuilder<T> create(EntityCategory category, EntityType.EntityFactory<T> function) {
|
||||
return new FabricEntityTypeBuilder<>(category, function);
|
||||
public static <T extends Entity> FabricEntityTypeBuilder<T> create(SpawnGroup spawnGroup, EntityType.EntityFactory<T> function) {
|
||||
return new FabricEntityTypeBuilder<>(spawnGroup, function);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -170,7 +170,7 @@ public class FabricEntityTypeBuilder<T extends Entity> {
|
|||
// TODO: Flesh out once modded datafixers exist.
|
||||
}
|
||||
|
||||
EntityType<T> type = new FabricEntityType<T>(this.function, this.category, this.saveable, this.summonable, this.fireImmune, this.spawnableFarFromPlayer, dimensions, trackingDistance, updateIntervalTicks, alwaysUpdateVelocity);
|
||||
EntityType<T> type = new FabricEntityType<T>(this.function, this.spawnGroup, this.saveable, this.summonable, this.fireImmune, this.spawnableFarFromPlayer, dimensions, trackingDistance, updateIntervalTicks, alwaysUpdateVelocity);
|
||||
|
||||
return type;
|
||||
}
|
||||
|
|
|
@ -17,15 +17,15 @@
|
|||
package net.fabricmc.fabric.impl.object.builder;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityCategory;
|
||||
import net.minecraft.entity.SpawnGroup;
|
||||
import net.minecraft.entity.EntityDimensions;
|
||||
import net.minecraft.entity.EntityType;
|
||||
|
||||
public class FabricEntityType<T extends Entity> extends EntityType<T> {
|
||||
private final Boolean alwaysUpdateVelocity;
|
||||
|
||||
public FabricEntityType(EntityType.EntityFactory<T> factory, EntityCategory category, boolean bl, boolean summonable, boolean fireImmune, boolean spawnableFarFromPlayer, EntityDimensions entityDimensions, int maxTrackDistance, int trackTickInterval, Boolean alwaysUpdateVelocity) {
|
||||
super(factory, category, bl, summonable, fireImmune, spawnableFarFromPlayer, entityDimensions, (maxTrackDistance + 15) / 16, trackTickInterval);
|
||||
public FabricEntityType(EntityType.EntityFactory<T> factory, SpawnGroup spawnGroup, boolean bl, boolean summonable, boolean fireImmune, boolean spawnableFarFromPlayer, EntityDimensions entityDimensions, int maxTrackDistance, int trackTickInterval, Boolean alwaysUpdateVelocity) {
|
||||
super(factory, spawnGroup, bl, summonable, fireImmune, spawnableFarFromPlayer, entityDimensions, (maxTrackDistance + 15) / 16, trackTickInterval);
|
||||
this.alwaysUpdateVelocity = alwaysUpdateVelocity;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
archivesBaseName = "fabric-object-builders"
|
||||
version = getSubprojectVersion(project, "0.5.1")
|
||||
version = getSubprojectVersion(project, "0.5.2")
|
||||
|
||||
dependencies {
|
||||
compile project(path: ':fabric-api-base', configuration: 'dev')
|
||||
|
|
|
@ -19,7 +19,7 @@ package net.fabricmc.fabric.api.entity;
|
|||
import java.util.function.Function;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityCategory;
|
||||
import net.minecraft.entity.SpawnGroup;
|
||||
import net.minecraft.entity.EntityDimensions;
|
||||
import net.minecraft.entity.EntityType;
|
||||
import net.minecraft.world.World;
|
||||
|
@ -31,24 +31,24 @@ import net.minecraft.world.World;
|
|||
public class FabricEntityTypeBuilder<T extends Entity> {
|
||||
private final net.fabricmc.fabric.api.object.builder.v1.entity.FabricEntityTypeBuilder<T> delegate;
|
||||
|
||||
protected FabricEntityTypeBuilder(EntityCategory category, EntityType.EntityFactory<T> function) {
|
||||
this.delegate = net.fabricmc.fabric.api.object.builder.v1.entity.FabricEntityTypeBuilder.create(category, function);
|
||||
protected FabricEntityTypeBuilder(SpawnGroup spawnGroup, EntityType.EntityFactory<T> function) {
|
||||
this.delegate = net.fabricmc.fabric.api.object.builder.v1.entity.FabricEntityTypeBuilder.create(spawnGroup, function);
|
||||
}
|
||||
|
||||
public static <T extends Entity> FabricEntityTypeBuilder<T> create(EntityCategory category) {
|
||||
return new FabricEntityTypeBuilder<>(category, (t, w) -> null);
|
||||
public static <T extends Entity> FabricEntityTypeBuilder<T> create(SpawnGroup spawnGroup) {
|
||||
return new FabricEntityTypeBuilder<>(spawnGroup, (t, w) -> null);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link FabricEntityTypeBuilder#create(EntityCategory, EntityType.EntityFactory)}
|
||||
* @deprecated Use {@link FabricEntityTypeBuilder#create(SpawnGroup, EntityType.EntityFactory)}
|
||||
*/
|
||||
@Deprecated
|
||||
public static <T extends Entity> FabricEntityTypeBuilder<T> create(EntityCategory category, Function<? super World, ? extends T> function) {
|
||||
return create(category, (t, w) -> function.apply(w));
|
||||
public static <T extends Entity> FabricEntityTypeBuilder<T> create(SpawnGroup spawnGroup, Function<? super World, ? extends T> function) {
|
||||
return create(spawnGroup, (t, w) -> function.apply(w));
|
||||
}
|
||||
|
||||
public static <T extends Entity> FabricEntityTypeBuilder<T> create(EntityCategory category, EntityType.EntityFactory<T> function) {
|
||||
return new FabricEntityTypeBuilder<>(category, function);
|
||||
public static <T extends Entity> FabricEntityTypeBuilder<T> create(SpawnGroup spawnGroup, EntityType.EntityFactory<T> function) {
|
||||
return new FabricEntityTypeBuilder<>(spawnGroup, function);
|
||||
}
|
||||
|
||||
public FabricEntityTypeBuilder<T> disableSummon() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue