Skip to content

Commit

Permalink
Fabric events Lifecycle v0 (FabricMC#4)
Browse files Browse the repository at this point in the history
* Created event lifecycle project

 Changes to be committed:
	modified:   build.gradle
	new file:   fabric-events-lifecycle-v0/build.gradle
	new file:   fabric-events-lifecycle-v0/src/main/java/net/fabricmc/fabric/mixin/event/lifecycle/MixinMinecraftClient.java
	new file:   fabric-events-lifecycle-v0/src/main/resources/assets/fabric-events-lifecycle-v0/icon.png
	new file:   fabric-events-lifecycle-v0/src/main/resources/fabric-events-lifecycle-v0.mixins.json
	new file:   fabric-events-lifecycle-v0/src/main/resources/fabric.mod.json
	modified:   settings.gradle

* Created ClientTickCallback

 Changes to be committed:
	new file:   fabric-events-lifecycle-v0/src/main/java/net/fabricmc/fabric/api/event/client/ClientTickCallback.java
	modified:   fabric-events-lifecycle-v0/src/main/java/net/fabricmc/fabric/mixin/event/lifecycle/MixinMinecraftClient.java

* Added ItemTooltipCallback

 Changes to be committed:
	new file:   fabric-events-lifecycle-v0/src/main/java/net/fabricmc/fabric/api/event/client/ItemTooltipCallback.java
	new file:   fabric-events-lifecycle-v0/src/main/java/net/fabricmc/fabric/mixin/event/lifecycle/MixinItem.java
	modified:   fabric-events-lifecycle-v0/src/main/resources/fabric-events-lifecycle-v0.mixins.json

* Added notice

 Changes to be committed:
	modified:   fabric-events-lifecycle-v0/src/main/java/net/fabricmc/fabric/api/event/client/ClientTickCallback.java
	modified:   fabric-events-lifecycle-v0/src/main/java/net/fabricmc/fabric/api/event/client/ItemTooltipCallback.java
	modified:   fabric-events-lifecycle-v0/src/main/java/net/fabricmc/fabric/mixin/event/lifecycle/MixinItem.java
	modified:   fabric-events-lifecycle-v0/src/main/java/net/fabricmc/fabric/mixin/event/lifecycle/MixinMinecraftClient.java

* Added ServerStartCallback

 Changes to be committed:
	new file:   fabric-events-lifecycle-v0/src/main/java/net/fabricmc/fabric/api/event/server/ServerStartCallback.java
	new file:   fabric-events-lifecycle-v0/src/main/java/net/fabricmc/fabric/mixin/event/lifecycle/MixinMinecraftServer.java
	modified:   fabric-events-lifecycle-v0/src/main/resources/fabric-events-lifecycle-v0.mixins.json

* Added ServerStopCallback

 Changes to be committed:
	new file:   fabric-events-lifecycle-v0/src/main/java/net/fabricmc/fabric/api/event/server/ServerStopCallback.java
	modified:   fabric-events-lifecycle-v0/src/main/java/net/fabricmc/fabric/mixin/event/lifecycle/MixinMinecraftServer.java

* Added ServerTickCallback

 Changes to be committed:
	modified:   fabric-events-lifecycle-v0/src/main/java/net/fabricmc/fabric/api/event/server/ServerStopCallback.java
	new file:   fabric-events-lifecycle-v0/src/main/java/net/fabricmc/fabric/api/event/server/ServerTickCallback.java
	modified:   fabric-events-lifecycle-v0/src/main/java/net/fabricmc/fabric/mixin/event/lifecycle/MixinMinecraftServer.java

* Added WorldTickCallback

Time to make more events now!

 Changes to be committed:
	new file:   fabric-events-lifecycle-v0/src/main/java/net/fabricmc/fabric/api/event/world/WorldTickCallback.java
	new file:   fabric-events-lifecycle-v0/src/main/java/net/fabricmc/fabric/mixin/event/lifecycle/MixinWorld.java
	modified:   fabric-events-lifecycle-v0/src/main/resources/fabric-events-lifecycle-v0.mixins.json

* Added ClientStopCallback

 Changes to be committed:
	new file:   fabric-events-lifecycle-v0/src/main/java/net/fabricmc/fabric/api/event/client/ClientStopCallback.java
	modified:   fabric-events-lifecycle-v0/src/main/java/net/fabricmc/fabric/mixin/event/lifecycle/MixinMinecraftClient.java

* Fixed mixin target

 Changes to be committed:
	modified:   fabric-events-lifecycle-v0/src/main/java/net/fabricmc/fabric/mixin/event/lifecycle/MixinMinecraftClient.java

* Added ClientStartCallback

 Changes to be committed:
	new file:   fabric-events-lifecycle-v0/src/main/java/net/fabricmc/fabric/api/event/client/ClientStartCallback.java
	modified:   fabric-events-lifecycle-v0/src/main/java/net/fabricmc/fabric/mixin/event/lifecycle/MixinMinecraftClient.java

* Removed lifecycle events from unfinished

 Changes to be committed:
	deleted:    unfinished/fabric-events-lifecycle-v0/build.gradle
	deleted:    unfinished/fabric-events-lifecycle-v0/src/main/java/net/fabricmc/fabric/api/event/client/ClientTickCallback.java
	deleted:    unfinished/fabric-events-lifecycle-v0/src/main/java/net/fabricmc/fabric/api/event/client/ItemTooltipCallback.java
	deleted:    unfinished/fabric-events-lifecycle-v0/src/main/java/net/fabricmc/fabric/api/event/server/ServerStartCallback.java
	deleted:    unfinished/fabric-events-lifecycle-v0/src/main/java/net/fabricmc/fabric/api/event/server/ServerStopCallback.java
	deleted:    unfinished/fabric-events-lifecycle-v0/src/main/java/net/fabricmc/fabric/api/event/server/ServerTickCallback.java
	deleted:    unfinished/fabric-events-lifecycle-v0/src/main/java/net/fabricmc/fabric/api/event/world/WorldTickCallback.java
	deleted:    unfinished/fabric-events-lifecycle-v0/src/main/java/net/fabricmc/fabric/mixin/event/lifecycle/MixinItemStack.java
	deleted:    unfinished/fabric-events-lifecycle-v0/src/main/java/net/fabricmc/fabric/mixin/event/lifecycle/MixinMinecraftClient.java
	deleted:    unfinished/fabric-events-lifecycle-v0/src/main/java/net/fabricmc/fabric/mixin/event/lifecycle/MixinMinecraftServer.java
	deleted:    unfinished/fabric-events-lifecycle-v0/src/main/java/net/fabricmc/fabric/mixin/event/lifecycle/MixinWorld.java
	deleted:    unfinished/fabric-events-lifecycle-v0/src/main/resources/assets/fabric-events-lifecycle-v0/icon.png
	deleted:    unfinished/fabric-events-lifecycle-v0/src/main/resources/fabric-events-lifecycle-v0.mixins.json
	deleted:    unfinished/fabric-events-lifecycle-v0/src/main/resources/fabric.mod.json

* Added PlayerJoinCallback

 Changes to be committed:
	new file:   fabric-events-lifecycle-v0/src/main/java/net/fabricmc/fabric/api/event/server/PlayerJoinCallback.java
	new file:   fabric-events-lifecycle-v0/src/main/java/net/fabricmc/fabric/mixin/event/lifecycle/MixinPlayerManager.java
	modified:   fabric-events-lifecycle-v0/src/main/resources/fabric-events-lifecycle-v0.mixins.json

* Added EntityKilledCallback

 Changes to be committed:
	new file:   fabric-events-lifecycle-v0/src/main/java/net/fabricmc/fabric/api/event/world/EntityKilledCallback.java
	new file:   fabric-events-lifecycle-v0/src/main/java/net/fabricmc/fabric/mixin/event/lifecycle/MixinEntity.java
	modified:   fabric-events-lifecycle-v0/src/main/resources/fabric-events-lifecycle-v0.mixins.json

* Added LanServerPublishedCallback

 Changes to be committed:
	new file:   fabric-events-lifecycle-v0/src/main/java/net/fabricmc/fabric/api/event/client/LanServerPublishedCallback.java
	new file:   fabric-events-lifecycle-v0/src/main/java/net/fabricmc/fabric/mixin/event/lifecycle/MixinIntegratedServer.java
	modified:   fabric-events-lifecycle-v0/src/main/resources/fabric-events-lifecycle-v0.mixins.json

* Added chunks saved callback

 Changes to be committed:
	new file:   fabric-events-lifecycle-v0/src/main/java/net/fabricmc/fabric/api/event/world/ChunksSavedCallback.java
	new file:   fabric-events-lifecycle-v0/src/main/java/net/fabricmc/fabric/mixin/event/lifecycle/MixinThreadedAnvilChunkStorage.java
	modified:   fabric-events-lifecycle-v0/src/main/resources/fabric-events-lifecycle-v0.mixins.json

* Added EntityHurtCallback

 Changes to be committed:
	new file:   fabric-events-lifecycle-v0/src/main/java/net/fabricmc/fabric/api/event/world/EntityHurtCallback.java
	new file:   fabric-events-lifecycle-v0/src/main/java/net/fabricmc/fabric/mixin/event/lifecycle/MixinDamageTracker.java
	modified:   fabric-events-lifecycle-v0/src/main/resources/fabric-events-lifecycle-v0.mixins.json

* Added DedicatedServerSetupCallback and ServerPlayerTickCallback

 Changes to be committed:
	new file:   fabric-events-lifecycle-v0/src/main/java/net/fabricmc/fabric/api/event/server/DedicatedServerSetupCallback.java
	new file:   fabric-events-lifecycle-v0/src/main/java/net/fabricmc/fabric/api/event/world/ServerPlayerTickCallback.java
	new file:   fabric-events-lifecycle-v0/src/main/java/net/fabricmc/fabric/mixin/event/lifecycle/MixinMinecraftDedicatedServer.java
	new file:   fabric-events-lifecycle-v0/src/main/java/net/fabricmc/fabric/mixin/event/lifecycle/MixinServerPlayerEntity.java
	modified:   fabric-events-lifecycle-v0/src/main/resources/fabric-events-lifecycle-v0.mixins.json

* Updated yarn and applied license header

and temperorily disabled checkstyle

 Changes to be committed:
	modified:   build.gradle
	modified:   fabric-api-base/src/main/java/net/fabricmc/fabric/api/util/NbtType.java
	modified:   fabric-api-base/src/main/java/net/fabricmc/fabric/impl/base/util/ActionResult.java
	modified:   fabric-api-base/src/main/java/net/fabricmc/fabric/impl/base/util/TypedActionResult.java
	modified:   fabric-content-registries-v1/src/main/java/net/fabricmc/fabric/api/content/registries/v1/BlockRegistry.java
	modified:   fabric-content-registries-v1/src/main/java/net/fabricmc/fabric/api/content/registries/v1/ItemRegistry.java
	modified:   fabric-content-registries-v1/src/main/java/net/fabricmc/fabric/impl/content/registries/ContentRegistryImpl.java
	modified:   fabric-content-registries-v1/src/main/java/net/fabricmc/fabric/impl/content/registries/TestMod.java
	modified:   fabric-content-registries-v1/src/main/java/net/fabricmc/fabric/mixin/content/registries/BlockAccessor.java
	modified:   fabric-content-registries-v1/src/main/java/net/fabricmc/fabric/mixin/content/registries/ItemAccessor.java
	modified:   fabric-content-registries-v1/src/main/java/net/fabricmc/fabric/mixin/content/registries/MutableRegistryAccessor.java
	modified:   fabric-content-registries-v1/src/main/java/net/fabricmc/fabric/mixin/content/registries/SimpleRegistryAccessor.java
	modified:   fabric-content-registries-v1/src/main/java/net/fabricmc/fabric/mixin/content/registries/WorldMixin.java
	modified:   fabric-crash-report-info-v1/src/main/java/net/fabricmc/fabric/mixin/crash/report/info/MixinCrashReport.java
	modified:   fabric-events-interaction-v0/src/main/java/net/fabricmc/fabric/impl/util/BlockHitResult.java
	modified:   fabric-events-interaction-v0/src/main/java/net/fabricmc/fabric/impl/util/EntityHitResult.java
	modified:   fabric-events-interaction-v0/src/main/java/net/fabricmc/fabric/mixin/event/interaction/MixinServerPlayerEntity.java
	modified:   fabric-events-lifecycle-v0/src/main/java/net/fabricmc/fabric/api/event/client/ClientStartCallback.java
	modified:   fabric-events-lifecycle-v0/src/main/java/net/fabricmc/fabric/api/event/client/ClientStopCallback.java
	modified:   fabric-events-lifecycle-v0/src/main/java/net/fabricmc/fabric/api/event/client/LanServerPublishedCallback.java
	modified:   fabric-events-lifecycle-v0/src/main/java/net/fabricmc/fabric/api/event/server/DedicatedServerSetupCallback.java
	modified:   fabric-events-lifecycle-v0/src/main/java/net/fabricmc/fabric/api/event/world/ChunksSavedCallback.java
	modified:   fabric-events-lifecycle-v0/src/main/java/net/fabricmc/fabric/api/event/world/EntityHurtCallback.java
	modified:   fabric-events-lifecycle-v0/src/main/java/net/fabricmc/fabric/api/event/world/EntityKilledCallback.java
	modified:   fabric-events-lifecycle-v0/src/main/java/net/fabricmc/fabric/api/event/world/ServerPlayerTickCallback.java
	modified:   fabric-events-lifecycle-v0/src/main/java/net/fabricmc/fabric/mixin/event/lifecycle/MixinDamageTracker.java
	new file:   fabric-events-lifecycle-v0/src/main/java/net/fabricmc/fabric/mixin/event/lifecycle/MixinDedicatedServer.java
	modified:   fabric-events-lifecycle-v0/src/main/java/net/fabricmc/fabric/mixin/event/lifecycle/MixinEntity.java
	modified:   fabric-events-lifecycle-v0/src/main/java/net/fabricmc/fabric/mixin/event/lifecycle/MixinIntegratedServer.java
	deleted:    fabric-events-lifecycle-v0/src/main/java/net/fabricmc/fabric/mixin/event/lifecycle/MixinMinecraftDedicatedServer.java
	modified:   fabric-events-lifecycle-v0/src/main/java/net/fabricmc/fabric/mixin/event/lifecycle/MixinServerPlayerEntity.java
	modified:   fabric-events-lifecycle-v0/src/main/java/net/fabricmc/fabric/mixin/event/lifecycle/MixinThreadedAnvilChunkStorage.java
	modified:   fabric-events-lifecycle-v0/src/main/resources/fabric-events-lifecycle-v0.mixins.json
	modified:   fabric-resource-loader-v0/src/main/java/net/fabricmc/fabric/mixin/resource/loader/MixinKeyedResourceReloadListener.java

* Bumped version

 Changes to be committed:
	modified:   build.gradle

* Re-applyed the checkstyle plugin

 Changes to be committed:
	modified:   build.gradle

* Annotated method, fixed mixin and renamed parameter

 Changes to be committed:
	modified:   fabric-content-registries-v1/src/main/java/net/fabricmc/fabric/mixin/content/registries/WorldMixin.java
	modified:   fabric-events-lifecycle-v0/src/main/java/net/fabricmc/fabric/mixin/event/lifecycle/MixinMinecraftClient.java

* PlayerJoinCallback -> PlayerConnectCallback

 Changes to be committed:
	renamed:    fabric-events-lifecycle-v0/src/main/java/net/fabricmc/fabric/api/event/server/PlayerJoinCallback.java -> fabric-events-lifecycle-v0/src/main/java/net/fabricmc/fabric/api/event/server/PlayerConnectCallback.java
	modified:   fabric-events-lifecycle-v0/src/main/java/net/fabricmc/fabric/mixin/event/lifecycle/MixinPlayerManager.java

* Added RegistryBlockAddedEvent and RegistryItemAddedEvent to content registries

 Changes to be committed:
	modified:   fabric-content-registries-v1/build.gradle
	modified:   fabric-content-registries-v1/src/main/java/net/fabricmc/fabric/api/content/registries/v1/BlockRegistry.java
	modified:   fabric-content-registries-v1/src/main/java/net/fabricmc/fabric/api/content/registries/v1/ItemRegistry.java
	new file:   fabric-content-registries-v1/src/main/java/net/fabricmc/fabric/api/event/registries/v1/RegistryBlockAddedCallback.java
	new file:   fabric-content-registries-v1/src/main/java/net/fabricmc/fabric/api/event/registries/v1/RegistryItemAddedCallback.java
  • Loading branch information
BoogieMonster1O1 authored Jul 9, 2020
1 parent 0ae816a commit 16bfde5
Show file tree
Hide file tree
Showing 53 changed files with 957 additions and 170 deletions.
6 changes: 3 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ plugins {
id 'eclipse'
id 'idea'
id 'maven-publish'
id 'fabric-loom' version '0.2.7-SNAPSHOT' apply false
id 'fabric-loom' version '0.4-SNAPSHOT' apply false
id 'net.minecrell.licenser' version '0.4.1'
id "org.ajoberstar.grgit" version "3.1.1"
id 'com.matthewprenger.cursegradle' version "1.4.0"
Expand All @@ -15,9 +15,9 @@ plugins {
def ENV = System.getenv()

class Globals {
static def baseVersion = "0.1.1"
static def baseVersion = "0.1.2"
static def mcVersion = "1.8.9"
static def yarnVersion = "+build.202005150113"
static def yarnVersion = "+build.202007090605"
}

version = Globals.baseVersion + "-" + getBranch()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,14 @@
package net.fabricmc.fabric.api.util;

import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.Tag;
import net.minecraft.nbt.NbtTag;

/**
* NBT type ID constants. Useful for filtering by value type in a few cases.
*
* <p>For the current list of types, check with {@link Tag#TYPES}.
* <p>For the current list of types, check with {@link NbtTag#TYPES}.
*
* @see CompoundTag#containsKey(String, int)
* @see Tag#idToString(int)
* @see CompoundTag#contains(String, int)
*/
public final class NbtType {
public static final int END = 0;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
* Copyright (c) 2016, 2017, 2018, 2019 FabricMC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package net.fabricmc.fabric.impl.base.util;

public enum ActionResult {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
package net.fabricmc.fabric.impl.base.util;
/*
* Copyright (c) 2016, 2017, 2018, 2019 FabricMC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

import net.minecraft.item.ItemStack;
package net.fabricmc.fabric.impl.base.util;

public class TypedActionResult<T> {
private final ActionResult result;
Expand Down
6 changes: 5 additions & 1 deletion fabric-content-registries-v1/build.gradle
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
archivesBaseName = "fabric-content-registries"
version = getSubprojectVersion(project, "0.1.0")
version = getSubprojectVersion(project, "0.1.1")

dependencies {
compile project(path: ':fabric-api-base', configuration: 'dev')
}
Original file line number Diff line number Diff line change
@@ -1,16 +1,35 @@
/*
* Copyright (c) 2016, 2017, 2018, 2019 FabricMC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package net.fabricmc.fabric.api.content.registries.v1;

import net.minecraft.block.Block;
import net.minecraft.util.Identifier;

import net.fabricmc.fabric.api.event.registries.v1.RegistryBlockAddedCallback;
import net.fabricmc.fabric.impl.content.registries.ContentRegistryImpl;

public final class BlockRegistry {
public static boolean blockIdsSetup = false;

private BlockRegistry() { }
private BlockRegistry() {
}

public static Block register(Identifier id, Block block) {
RegistryBlockAddedCallback.EVENT.invoker().blockAdded(id,block);
return ContentRegistryImpl.registerBlock(id, block);
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,25 @@
/*
* Copyright (c) 2016, 2017, 2018, 2019 FabricMC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package net.fabricmc.fabric.api.content.registries.v1;

import net.minecraft.item.Item;
import net.minecraft.util.Identifier;

import net.fabricmc.fabric.api.event.registries.v1.RegistryItemAddedCallback;
import net.fabricmc.fabric.impl.content.registries.ContentRegistryImpl;

public final class ItemRegistry {
Expand All @@ -12,10 +29,12 @@ private ItemRegistry() {
}

public static Item register(Identifier id, Item item) {
RegistryItemAddedCallback.EVENT.invoker().itemAdded(id,item);
return ContentRegistryImpl.registerItem(id, item);
}

public static Item registerBlockItem(Identifier id, Item item) {
RegistryItemAddedCallback.EVENT.invoker().itemAdded(id,item);
return ContentRegistryImpl.registerItem(id, item);
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package net.fabricmc.fabric.api.event.registries.v1;

import net.minecraft.block.Block;
import net.minecraft.util.Identifier;

import net.fabricmc.fabric.api.event.Event;
import net.fabricmc.fabric.api.event.EventFactory;

public interface RegistryBlockAddedCallback {

Event<RegistryBlockAddedCallback> EVENT = EventFactory.createArrayBacked(RegistryBlockAddedCallback.class, (listeners) -> (id, block) -> {
for (RegistryBlockAddedCallback callback : listeners) {
callback.blockAdded(id,block);
}
});

void blockAdded(Identifier id, Block block);

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package net.fabricmc.fabric.api.event.registries.v1;

import net.minecraft.item.Item;
import net.minecraft.util.Identifier;

import net.fabricmc.fabric.api.event.Event;
import net.fabricmc.fabric.api.event.EventFactory;

public interface RegistryItemAddedCallback {

Event<RegistryItemAddedCallback> EVENT = EventFactory.createArrayBacked(RegistryItemAddedCallback.class, (listeners) -> (id, item) -> {
for (RegistryItemAddedCallback callback : listeners) {
callback.itemAdded(id,item);
}
});

void itemAdded(Identifier id, Item item);

}
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
* Copyright (c) 2016, 2017, 2018, 2019 FabricMC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package net.fabricmc.fabric.impl.content.registries;

import java.util.HashMap;
Expand Down Expand Up @@ -48,7 +64,7 @@ public static Block registerBlock(Identifier id, Block block) {
unsortedBlocks.put(id, block);
Block.REGISTRY.add(unorderedNextBlockId, id, block);

for (BlockState state : block.method_630().method_1228()) {
for (BlockState state : block.getStateManager().method_1228()) {
Block.BLOCK_STATES.set(state, unorderedNextBlockId << 4 | block.getData(state));
}

Expand Down Expand Up @@ -128,7 +144,7 @@ public static void reorderBlockEntries(BiMap<Integer, Identifier> idMap) {
Block block = unsortedBlocks.get(entry.getValue());
Block.REGISTRY.add(entry.getKey(), entry.getValue(), block);

for (BlockState state : block.method_630().method_1228()) {
for (BlockState state : block.getStateManager().method_1228()) {
states.set(state, unorderedNextBlockId << 4 | block.getData(state));
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
* Copyright (c) 2016, 2017, 2018, 2019 FabricMC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package net.fabricmc.fabric.impl.content.registries;

import java.util.UUID;
Expand All @@ -19,20 +35,23 @@ public class TestMod implements ModInitializer {

@Override
public void onInitialize() {

System.out.println("dadawdaw");

if (!a) {
Block block = new Block(Material.DIRT, MaterialColor.YELLOW).setTranslationKey("test:cool_item").setItemGroup(ItemGroup.FOOD);
BlockRegistry.register(new Identifier(block.getTranslationKey()), block);
Item item = new BlockItem(block).setItemGroup(ItemGroup.FOOD);
ItemRegistry.registerBlockItem(new Identifier(block.getTranslationKey()), item);

for (int i = 0; i < 5; i++) {
String s = UUID.randomUUID().toString();
ItemRegistry.register(new Identifier(s), new Item().setTranslationKey(s).setItemGroup(ItemGroup.FOOD));
}

ItemRegistry.register(new Identifier("dada"), new Item().setTranslationKey("dada").setItemGroup(ItemGroup.FOOD));
}

a = true;
// Item.REGISTRY.add(4096, new Identifier("dada"), new Item().setTranslationKey("a:a").setItemGroup(ItemGroup.FOOD));
// Item.REGISTRY.add(4096, new Identifier("dada"), new Item().setTranslationKey("a:a").setItemGroup(ItemGroup.FOOD));
}
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
* Copyright (c) 2016, 2017, 2018, 2019 FabricMC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package net.fabricmc.fabric.mixin.content.registries;

import org.spongepowered.asm.mixin.Mixin;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
* Copyright (c) 2016, 2017, 2018, 2019 FabricMC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package net.fabricmc.fabric.mixin.content.registries;

import java.util.Map;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
* Copyright (c) 2016, 2017, 2018, 2019 FabricMC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package net.fabricmc.fabric.mixin.content.registries;

import java.util.Map;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
* Copyright (c) 2016, 2017, 2018, 2019 FabricMC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package net.fabricmc.fabric.mixin.content.registries;

import java.util.Map;
Expand Down
Loading

0 comments on commit 16bfde5

Please sign in to comment.