update to 19w11a

This commit is contained in:
asie 2019-03-14 14:25:54 +01:00
parent cd5a529367
commit 250befa01f
10 changed files with 36 additions and 31 deletions

View file

@ -27,7 +27,7 @@ targetCompatibility = 1.8
archivesBaseName = "fabric"
def baseVersion = "0.2.3"
def mcVersion = "19w08b"
def mcVersion = "19w11a"
def ENV = System.getenv()
version = baseVersion + "." + (ENV.BUILD_NUMBER ?: "local")
@ -38,7 +38,7 @@ minecraft {
dependencies {
minecraft "com.mojang:minecraft:$mcVersion"
mappings "net.fabricmc:yarn:$mcVersion.4"
mappings "net.fabricmc:yarn:$mcVersion.1"
modCompile "net.fabricmc:fabric-loader:0.3.7.109"
}

View file

@ -54,7 +54,7 @@ public final class PlayerStream {
public static Stream<PlayerEntity> world(World world) {
if (world instanceof ServerWorld) {
// noinspection unchecked
return ((Stream<PlayerEntity>) (Stream) ((ServerWorld) world).method_18456().stream());
return ((Stream<PlayerEntity>) (Stream) ((ServerWorld) world).getPlayers().stream());
} else {
throw new RuntimeException("Only supported on ServerWorld!");
}

View file

@ -53,8 +53,8 @@ public class FabricCreativeGuiComponents {
}
@Override
public void onPressed(double double_1, double double_2) {
super.onPressed(double_1, double_2);
public void method_19347(double double_1, double double_2) {
super.method_19347(double_1, double_2);
type.clickConsumer.accept(extensions);
}

View file

@ -18,7 +18,8 @@ package net.fabricmc.fabric.impl.registry;
import net.fabricmc.fabric.api.registry.FlammableBlockRegistry;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
public interface FireBlockHooks {
FlammableBlockRegistry.Entry fabric_getVanillaEntry(Block block);
FlammableBlockRegistry.Entry fabric_getVanillaEntry(BlockState block);
}

View file

@ -90,7 +90,7 @@ public class FlammableBlockRegistryImpl implements FlammableBlockRegistry, Simpl
if (entry != null) {
return entry;
} else {
return ((FireBlockHooks) key).fabric_getVanillaEntry(block);
return ((FireBlockHooks) key).fabric_getVanillaEntry(block.getDefaultState());
}
}

View file

@ -20,7 +20,9 @@ import net.fabricmc.fabric.api.registry.FlammableBlockRegistry;
import net.fabricmc.fabric.impl.registry.FireBlockHooks;
import net.fabricmc.fabric.impl.registry.FlammableBlockRegistryImpl;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.FireBlock;
import net.minecraft.state.property.Properties;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
@ -33,12 +35,12 @@ public class MixinFireBlock implements FireBlockHooks {
private FlammableBlockRegistryImpl fabric_registry;
@Shadow
private int getSpreadChance(Block block_1) {
private int getSpreadChance(BlockState block_1) {
return 0;
}
@Shadow
private int getBurnChance(Block block_1) {
private int getBurnChance(BlockState block_1) {
return 0;
}
@ -48,25 +50,33 @@ public class MixinFireBlock implements FireBlockHooks {
}
@Inject(at = @At("HEAD"), method = "getBurnChance", cancellable = true)
private void getFabricBurnChance(Block block, CallbackInfoReturnable info) {
FlammableBlockRegistry.Entry entry = fabric_registry.getFabric(block);
private void getFabricBurnChance(BlockState block, CallbackInfoReturnable info) {
FlammableBlockRegistry.Entry entry = fabric_registry.getFabric(block.getBlock());
if (entry != null) {
info.setReturnValue(entry.getBurnChance());
info.cancel();
// TODO: use a (BlockState -> int) with this as the default impl
if (block.contains(Properties.WATERLOGGED) && block.get(Properties.WATERLOGGED)) {
info.setReturnValue(0);
} else {
info.setReturnValue(entry.getBurnChance());
}
}
}
@Inject(at = @At("HEAD"), method = "getSpreadChance", cancellable = true)
private void getFabricSpreadChance(Block block, CallbackInfoReturnable info) {
FlammableBlockRegistry.Entry entry = fabric_registry.getFabric(block);
private void getFabricSpreadChance(BlockState block, CallbackInfoReturnable info) {
FlammableBlockRegistry.Entry entry = fabric_registry.getFabric(block.getBlock());
if (entry != null) {
info.setReturnValue(entry.getSpreadChance());
info.cancel();
// TODO: use a (BlockState -> int) with this as the default impl
if (block.contains(Properties.WATERLOGGED) && block.get(Properties.WATERLOGGED)) {
info.setReturnValue(0);
} else {
info.setReturnValue(entry.getSpreadChance());
}
}
}
@Override
public FlammableBlockRegistry.Entry fabric_getVanillaEntry(Block block) {
public FlammableBlockRegistry.Entry fabric_getVanillaEntry(BlockState block) {
return new FlammableBlockRegistry.Entry(getBurnChance(block), getSpreadChance(block));
}
}

View file

@ -72,7 +72,7 @@ public class MixinMinecraftGame {
fabric_modifyResourcePackList(list);
}
@Inject(method = "reloadResources", at = @At(value = "INVOKE", target = "Lnet/minecraft/resource/ReloadableResourceManager;method_18232(Ljava/util/concurrent/Executor;Ljava/util/concurrent/Executor;Ljava/util/concurrent/CompletableFuture;Ljava/util/List;)Lnet/minecraft/resource/ResourceReloadHandler;", ordinal = 0), locals = LocalCapture.CAPTURE_FAILHARD)
@Inject(method = "reloadResources", at = @At(value = "INVOKE", target = "Lnet/minecraft/resource/ReloadableResourceManager;beginMonitoredReload(Ljava/util/concurrent/Executor;Ljava/util/concurrent/Executor;Ljava/util/concurrent/CompletableFuture;Ljava/util/List;)Lnet/minecraft/resource/ResourceReloadMonitor;", ordinal = 0), locals = LocalCapture.CAPTURE_FAILHARD)
public void reloadResources(CallbackInfoReturnable<CompletableFuture> info, CompletableFuture<java.lang.Void> cf, List<ResourcePack> list) {
fabric_modifyResourcePackList(list);
}

View file

@ -35,16 +35,11 @@ import java.util.concurrent.Executor;
@Mixin(ReloadableResourceManagerImpl.class)
public class MixinReloadableResourceManagerImpl {
@Shadow
private List<ResourceReloadListener> field_17935;
@Shadow
private List<ResourceReloadListener> field_17936;
@Shadow
private ResourceType type;
@Inject(at = @At("HEAD"), method = "reload")
public void reload(Executor var1, Executor var2, List<ResourcePack> packs, CompletableFuture future, CallbackInfoReturnable<CompletableFuture> info) {
ResourceManagerHelperImpl.sort(type, field_17935);
ResourceManagerHelperImpl.sort(type, field_17936);
@Inject(at = @At("HEAD"), method = "beginReloadInner")
public void reload(Executor var1, Executor var2, List<ResourceReloadListener> listeners, CompletableFuture future, CallbackInfoReturnable<CompletableFuture> info) {
ResourceManagerHelperImpl.sort(type, listeners);
}
}

View file

@ -25,8 +25,7 @@
"registry.client.MixinMinecraftClient",
"registry.client.MixinParticleManager",
"resources.MixinKeyedResourceReloadListener$Client",
"resources.MixinMinecraftGame",
"resources.MixinReloadableResourceManagerImplClient"
"resources.MixinMinecraftGame"
],
"injectors": {
"defaultRequire": 1

View file

@ -36,10 +36,10 @@ public class ItemGroupMod implements ModInitializer {
Registry.ITEM.add(new Identifier("fabric_test", "itemgroup"), testItem);
//Creates a tab with all items (including ones that dont show in search such as the command block)
FabricItemGroupBuilder.create(new Identifier("fabric", "all")).stacksForDisplay(itemStacks -> Registry.ITEM.forEach(item -> itemStacks.add(new ItemStack(item)))).build();
FabricItemGroupBuilder.create(new Identifier("fabric", "all")).appendItems(itemStacks -> Registry.ITEM.forEach(item -> itemStacks.add(new ItemStack(item)))).build();
//Creates a group with all modded items in
FabricItemGroupBuilder.create(new Identifier("fabric", "modded")).stacksForDisplay(itemStacks -> Registry.ITEM.forEach(item -> {
FabricItemGroupBuilder.create(new Identifier("fabric", "modded")).appendItems(itemStacks -> Registry.ITEM.forEach(item -> {
if(!Registry.ITEM.getId(item).getNamespace().equals("minecraft")){
itemStacks.add(new ItemStack(item));
}