Skip to content

Commit

Permalink
1.16 update
Browse files Browse the repository at this point in the history
  • Loading branch information
LemmaEOF committed Jun 26, 2020
1 parent 43de863 commit 62048f0
Show file tree
Hide file tree
Showing 18 changed files with 52 additions and 46 deletions.
14 changes: 7 additions & 7 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
plugins {
id "com.jfrog.artifactory" version "4.9.0"
id "maven-publish"
id "fabric-loom" version "0.2.7-SNAPSHOT"
id "fabric-loom" version "0.4-SNAPSHOT"
}

def minecraftVersion = "1.15.2"
def yarnMappings = "1.15.2+build.3:v2"
def loaderVersion = "0.7.8+build.184"
def minecraftVersion = "1.16.1"
def yarnMappings = "1.16.1+build.9:v2"
def loaderVersion = "0.8.8+build.202"

archivesBaseName = "cotton"
version = "1.0.3"
version = "1.0.4"
group = "io.github.cottonmc.cotton"

sourceCompatibility = 1.8
Expand All @@ -35,7 +35,7 @@ dependencies {
minecraft "com.mojang:minecraft:$minecraftVersion"
mappings "net.fabricmc:yarn:$yarnMappings"
modImplementation "net.fabricmc:fabric-loader:$loaderVersion"
modImplementation "net.fabricmc.fabric-api:fabric-api:0.11.1+build.312-1.15"
modImplementation "net.fabricmc.fabric-api:fabric-api:0.14.0+build.371-1.16"

// `modApi`s below are for the dev env
def modules = ["player-events", "logging", "config", "datapack", "commons", "cauldron"]
Expand All @@ -44,7 +44,7 @@ dependencies {
include "io.github.cottonmc.cotton:cotton-$module:+"
}
modApi ("io.github.cottonmc:Jankson-Fabric:2.0.1+j1.2.0") { transitive = false }
modApi ("io.github.cottonmc:LibCD:2.3.0+1.15.2") { transitive = false }
modImplementation "io.github.cottonmc:LibCD:2.5.0+1.16.1"
include "io.github.cottonmc:Jankson-Fabric:2.0.1+j1.2.0"

compileOnly ("com.google.code.findbugs:jsr305:3.0.2") { transitive = false }
Expand Down
4 changes: 2 additions & 2 deletions modules/cotton-cauldron/build.gradle
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
plugins {
id "com.jfrog.artifactory" version "4.9.0"
id "fabric-loom" version "0.2.7-SNAPSHOT"
id "fabric-loom" version "0.4-SNAPSHOT"
id "maven-publish"
}
version = "1.0.3"
version = "1.0.4"

ext {
module_dependencies = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
import net.minecraft.fluid.Fluid;
import net.minecraft.item.ItemStack;
import net.minecraft.state.property.Properties;
import net.minecraft.util.DefaultedList;
import net.minecraft.util.Hand;
import net.minecraft.util.collection.DefaultedList;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
import net.minecraft.item.ItemStack;
import net.minecraft.tag.FluidTags;
import net.minecraft.util.ActionResult;
import net.minecraft.util.DefaultedList;
import net.minecraft.util.Hand;
import net.minecraft.util.collection.DefaultedList;
import net.minecraft.util.hit.BlockHitResult;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,14 @@
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.fluid.Fluid;
import net.minecraft.item.ItemStack;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.sound.SoundCategory;
import net.minecraft.stat.Stats;
import net.minecraft.util.Hand;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
import net.minecraft.util.registry.Registry;
import net.minecraft.world.World;

Expand Down Expand Up @@ -184,13 +186,17 @@ public void spawnEntity(String entityType) {
BlockPos pos = context.getPos();
EntityType<?> type = Registry.ENTITY_TYPE.get(new Identifier(entityType));
if (type.equals(EntityType.LIGHTNING_BOLT) && world instanceof ServerWorld) {
LightningEntity lightning = new LightningEntity(world, pos.getX(), pos.getY(), pos.getZ(), false);
((ServerWorld)world).addLightning(lightning);
LightningEntity lightning = EntityType.LIGHTNING_BOLT.create(world);
lightning.method_29495(Vec3d.ofBottomCenter(pos));
if (context.getPlayer() instanceof ServerPlayerEntity) {
lightning.setChanneler((ServerPlayerEntity)context.getPlayer());
}
world.spawnEntity(lightning);
} else {
Entity entity = type.create(world);
if (entity == null) return;
if (type.getCategory() == EntityCategory.MONSTER) {
((MobEntity)entity).initialize(world, world.getLocalDifficulty(pos), SpawnType.EVENT, null, null);
if (type.getSpawnGroup() == SpawnGroup.MONSTER) {
((MobEntity)entity).initialize(world, world.getLocalDifficulty(pos), SpawnReason.EVENT, null, null);
}
entity.setPos(pos.getX()+0.5, pos.getY()+1, pos.getZ()+0.5);
world.spawnEntity(entity);
Expand Down
6 changes: 3 additions & 3 deletions modules/cotton-commons/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
id "com.jfrog.artifactory" version "4.9.0"
id "fabric-loom" version "0.2.7-SNAPSHOT"
id "fabric-loom" version "0.4-SNAPSHOT"
id "maven-publish"
}

Expand All @@ -15,6 +15,6 @@ apply from: "../module-base.gradle"


dependencies {
modImplementation "net.fabricmc.fabric-api:fabric-item-groups-v0:0.1.4+b7f9825de4"
modImplementation "net.fabricmc.fabric-api:fabric-tag-extensions-v0:0.1.2+b7f9825de4"
modImplementation "net.fabricmc.fabric-api:fabric-item-groups-v0:0.2.0+0121bd900c"
modImplementation "net.fabricmc.fabric-api:fabric-tag-extensions-v0:0.2.7+a4c57d8e02"
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,6 @@
import io.github.cottonmc.cotton.config.ConfigManager;
import io.github.cottonmc.cotton.logging.ModLogger;
import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.client.itemgroup.FabricItemGroupBuilder;
import net.minecraft.block.Blocks;
import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Identifier;

public class CottonCommons implements ModInitializer {

Expand Down
2 changes: 1 addition & 1 deletion modules/cotton-config/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
id "com.jfrog.artifactory" version "4.9.0"
id "fabric-loom" version "0.2.7-SNAPSHOT"
id "fabric-loom" version "0.4-SNAPSHOT"
id "maven-publish"
}

Expand Down
8 changes: 4 additions & 4 deletions modules/cotton-datapack/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
id "com.jfrog.artifactory" version "4.9.0"
id "fabric-loom" version "0.2.7-SNAPSHOT"
id "fabric-loom" version "0.4-SNAPSHOT"
id "maven-publish"
}

Expand All @@ -10,12 +10,12 @@ ext {
];
}

version = "1.0.1";
version = "1.0.4";
apply from: "../module-base.gradle"

dependencies {
modImplementation "net.fabricmc.fabric-api:fabric-api-base:0.1.2+b7f9825d95"
modImplementation "net.fabricmc.fabric-api:fabric-commands-v0:0.1.2+b7f9825de4"
modImplementation "net.fabricmc.fabric-api:fabric-api-base:0.1.3+12a8474c02"
modImplementation "net.fabricmc.fabric-api:fabric-command-api-v1:1.0.8+5ce5339802"

testImplementation "org.junit.jupiter:junit-jupiter-api:5.4.1"
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:5.4.1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import io.github.cottonmc.cotton.datapack.recipe.CottonRecipes;
import io.github.cottonmc.cotton.datapack.recipe.RecipeUtil;
import io.github.cottonmc.cotton.datapack.virtual.PackPrinterCommand;
import net.fabricmc.fabric.api.registry.CommandRegistry;
import net.fabricmc.fabric.api.command.v1.CommandRegistrationCallback;
import io.github.cottonmc.cotton.logging.ModLogger;
import net.fabricmc.api.ModInitializer;
import net.fabricmc.loader.api.FabricLoader;
Expand All @@ -32,7 +32,7 @@ public void onInitialize() {
RecipeUtil.init(config);

//register the command that prints out the virtual data and resource packs.
CommandRegistry.INSTANCE.register(false, new PackPrinterCommand());
CommandRegistrationCallback.EVENT.register((commandDispatcher, b) -> new PackPrinterCommand().accept(commandDispatcher) );

// EXAMPLE CODE START

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import java.io.File;
import java.io.FileFilter;
import java.util.Map;
import java.util.function.Consumer;
import java.util.function.Supplier;

public class GlobalResourcePackProvider implements ResourcePackProvider {
Expand All @@ -20,7 +21,7 @@ public GlobalResourcePackProvider() {
this.packsFolder = new File(FabricLoader.getInstance().getGameDirectory(), "datapacks");
}

public <T extends ResourcePackProfile> void register(Map<String, T> packMap, ResourcePackProfile.Factory<T> factory) {
public <T extends ResourcePackProfile> void register(Consumer<T> packConsumer, ResourcePackProfile.Factory<T> factory) {
if (!this.packsFolder.isDirectory()) {
this.packsFolder.mkdirs();
}
Expand All @@ -30,9 +31,9 @@ public <T extends ResourcePackProfile> void register(Map<String, T> packMap, Res

for(File file : files) {
String name = "global/" + file.getName();
T container = ResourcePackProfile.of(name, false, this.createResourcePack(file), factory, ResourcePackProfile.InsertionPosition.TOP);
T container = ResourcePackProfile.of(name, false, this.createResourcePack(file), factory, ResourcePackProfile.InsertionPosition.TOP, ResourcePackSource.method_29486("global"));
if (container != null) {
packMap.put(name, container);
packConsumer.accept(container);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

import java.util.Map;
import java.util.function.Consumer;

/*
Virtual resource packs are injected here to get them in before scanning,
Expand All @@ -19,10 +20,10 @@
public class MixinClientBuiltinResourcePackProvider {
@Inject(method = "register", at = @At("RETURN"))
private <T extends ResourcePackProfile> void addVirtualPacks(
Map<String, T> registry, ResourcePackProfile.Factory<T> factory, CallbackInfo info
Consumer<T> consumer, ResourcePackProfile.Factory<T> factory, CallbackInfo info
) {
VirtualResourcePackManager.INSTANCE
.getCreatorForType(ResourceType.CLIENT_RESOURCES)
.register(registry, factory);
.register(consumer, factory);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public ProductRemovalPredicate(ItemStack stack) {

@Override
public boolean test(Recipe<?> t) {
return ItemStack.areEqualIgnoreDamage(t.getOutput(), product);
return ItemStack.areEqual(t.getOutput(), product);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@
import com.google.common.collect.MultimapBuilder;
import net.minecraft.resource.ResourcePackProfile;
import net.minecraft.resource.ResourcePackProvider;
import net.minecraft.resource.ResourcePackSource;
import net.minecraft.resource.ResourceType;
import net.minecraft.util.Identifier;

import java.util.*;
import java.util.function.Consumer;

/**
* Manages virtual resource packs. See {@link #addPack(VirtualResourcePack, Collection)} for registering packs.
Expand All @@ -23,7 +25,7 @@ public enum VirtualResourcePackManager {
public ResourcePackProvider getCreatorForType(ResourceType type) {
return new ResourcePackProvider() {
@Override
public <T extends ResourcePackProfile> void register(Map<String, T> map, ResourcePackProfile.Factory<T> factory) {
public <T extends ResourcePackProfile> void register(Consumer<T> packConsumer, ResourcePackProfile.Factory<T> factory) {
for (PackContainer packContainer : packs.get(type)) {
VirtualResourcePack pack = packContainer.getPack();
ClientResourcePackMode clientPackMode = packContainer.getClientPackMode();
Expand All @@ -33,10 +35,11 @@ public <T extends ResourcePackProfile> void register(Map<String, T> map, Resourc
type == ResourceType.CLIENT_RESOURCES && clientPackMode == ClientResourcePackMode.ALWAYS_ENABLED,
() -> pack,
factory,
ResourcePackProfile.InsertionPosition.TOP
ResourcePackProfile.InsertionPosition.TOP,
ResourcePackSource.method_29486("virtual")
);
if (container != null) {
map.put(id, container);
packConsumer.accept(container);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion modules/cotton-logging/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
id "com.jfrog.artifactory" version "4.9.0"
id "fabric-loom" version "0.2.7-SNAPSHOT"
id "fabric-loom" version "0.4-SNAPSHOT"
id "maven-publish"
}
version = "1.0.0-rc.4";
Expand Down
4 changes: 2 additions & 2 deletions modules/cotton-player-events/build.gradle
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
plugins {
id "com.jfrog.artifactory" version "4.9.0"
id "fabric-loom" version "0.2.7-SNAPSHOT"
id "fabric-loom" version "0.4-SNAPSHOT"
id "maven-publish"
}
version = "1.0.2";
apply from: "../module-base.gradle"

dependencies {
modImplementation "net.fabricmc.fabric-api:fabric-api-base:0.1.2+b7f9825de4"
modImplementation "net.fabricmc.fabric-api:fabric-api-base:0.1.3+12a8474c02"
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import net.minecraft.util.ActionResult;
import net.minecraft.util.profiler.Profiler;

@Deprecated
public interface PlayerDamageCallback {
//TODO: priority system instead, voting is bad
public static final Event<PlayerDamageCallback> EVENT = EventFactory.createArrayBacked(PlayerDamageCallback.class,
Expand Down
7 changes: 3 additions & 4 deletions modules/module-base.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
def minecraftVersion = "1.15.2"
def yarnMappings = "1.15.2+build.3:v2"
def loaderVersion = "0.7.8+build.184"
def minecraftVersion = "1.16.1"
def yarnMappings = "1.16.1+build.9:v2"
def loaderVersion = "0.8.8+build.202"

//Publishing details
if (rootProject.file("../../private.gradle").exists()) {
Expand Down Expand Up @@ -50,7 +50,6 @@ dependencies {
break;
case "libcd":
dependencyString = "io.github.cottonmc:LibCD:"+modversion;
shouldCarry = false
break;
default:
break;
Expand Down

0 comments on commit 62048f0

Please sign in to comment.