Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
import net.minecraft.block.Block;

import net.ornithemc.osl.blocks.api.BlockEvents;
import net.ornithemc.osl.blocks.impl.block.BlockStateRegistryFixer;
import net.ornithemc.osl.core.api.util.NamespacedIdentifier;
import net.ornithemc.osl.core.api.util.NamespacedIdentifiers;
import net.ornithemc.osl.registries.api.registry.DefaultedRegistry;
import net.ornithemc.osl.registries.api.registry.Registry;
import net.ornithemc.osl.registries.api.registry.RegistryKeys;
Expand Down Expand Up @@ -78,6 +80,7 @@ public static <T extends Block> T register(int id, NamespacedIdentifier key, T b

public static void init() {
SyncedRegistries.register(RegistryKeys.BLOCK);
SyncedRegistries.registerFixer(RegistryKeys.BLOCK, NamespacedIdentifiers.from("blockstate"), new BlockStateRegistryFixer());
}

public static void unlock() {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package net.ornithemc.osl.blocks.impl.block;

import net.minecraft.block.Block;

import net.ornithemc.osl.blocks.api.BlockRegistry;
import net.ornithemc.osl.blockstates.api.block.state.BlockState;
import net.ornithemc.osl.registries.api.registry.sync.IdFixer;

public class BlockStateRegistryFixer implements IdFixer {

@Override
public void apply() {
Block.STATE_REGISTRY.clear();

for (Block block : BlockRegistry.REGISTRY) {
int blockId = BlockRegistry.getId(block);

for (BlockState state : block.stateDefinition().all()) {
int metadata = block.getMetadataFromState(state);
int stateId = blockId << 4 | metadata;

Block.STATE_REGISTRY.put(state, stateId);
}
}
}
}

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,7 @@
import net.minecraft.entity.living.mob.monster.EndermanEntity;

import net.ornithemc.osl.blocks.api.BlockRegistry;
import net.ornithemc.osl.blocks.api.block.BlockExtension;
import net.ornithemc.osl.blocks.impl.BlockRegistryImpl;
import net.ornithemc.osl.blocks.impl.BlocksMixinPlugin;
import net.ornithemc.osl.blocks.impl.block.AirBlock;
import net.ornithemc.osl.blocks.impl.block.BlockPostInit;
import net.ornithemc.osl.core.api.util.NamespacedIdentifier;
import net.ornithemc.osl.core.api.util.NamespacedIdentifiers;
Expand All @@ -24,7 +21,7 @@
import net.ornithemc.osl.registries.api.registry.sync.BooleanArrayMapper;

@Mixin(Block.class)
public class BlockMixin implements BlockExtension {
public class BlockMixin {

@Shadow
private String key;
Expand All @@ -37,10 +34,6 @@ public class BlockMixin implements BlockExtension {
)
private static void osl$blocks$unlockBlockRegistry(CallbackInfo ci) {
BlockRegistryImpl.unlock();

if (!BlocksMixinPlugin.AIR_BLOCK_EXISTS) {
Block.REGISTRY.register(0, "air", new AirBlock());
}
}

@Inject(
Expand Down Expand Up @@ -92,9 +85,4 @@ public class BlockMixin implements BlockExtension {
public String toString() {
return "Block{" + BlockRegistryImpl.getIdentifier((Block) (Object) this) + "}";
}

@Override
public boolean isAir() {
return false;
}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
"osl-text-components": "\u003e\u003d0.1.0-",
"osl-networking": "\u003e\u003d0.10.0",
"osl-networking-impl": "\u003e\u003d0.2.0",
"osl-registries": "\u003e\u003d0.1.0"
"osl-registries": "\u003e\u003d0.1.0",
"osl-blockstates": "\u003e\u003d0.1.0-"
},
"name": "OSL Blocks",
"description": "Blocks API and events.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,5 @@ transitive-accessible method net/minecraft/block/Block setKey (Ljava/lang/String
transitive-accessible method net/minecraft/block/Block setCreativeModeTab (Lnet/minecraft/item/CreativeModeTab;)Lnet/minecraft/block/Block;
transitive-accessible method net/minecraft/block/Block setSpriteName (Ljava/lang/String;)Lnet/minecraft/block/Block;

transitive-inject-interface net/minecraft/block/Block net/ornithemc/osl/blocks/impl/block/BlockExtensionImpl
transitive-inject-interface net/minecraft/block/Blocks net/ornithemc/osl/blocks/impl/block/BlocksExtensionImpl

accessible field net/minecraft/entity/living/mob/monster/EndermanEntity HOLDABLE_BLOCKS [Z

Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,8 @@
"minVersion": "0.8",
"package": "net.ornithemc.osl.blocks.impl.mixin",
"compatibilityLevel": "JAVA_8",
"plugin": "net.ornithemc.osl.blocks.impl.BlocksMixinPlugin",
"mixins": [
"common.AirBlockMixin",
"common.BlockMixin",
"common.BlocksMixin",
"common.EndermanEntityMixin",
"common.FireBlockMixin",
"common.StatsMixin"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import net.minecraft.block.Block;
import net.minecraft.block.state.BlockState;

import net.ornithemc.osl.blocks.api.BlockRegistry;
import net.ornithemc.osl.registries.api.registry.sync.IdFixer;
import net.ornithemc.osl.registries.impl.access.Clearable;
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,12 @@
import net.minecraft.block.Block;

import net.ornithemc.osl.blocks.api.BlockRegistry;
import net.ornithemc.osl.blocks.api.block.BlockExtension;
import net.ornithemc.osl.blocks.impl.BlockRegistryImpl;
import net.ornithemc.osl.core.api.util.NamespacedIdentifier;
import net.ornithemc.osl.core.impl.util.Util;

@Mixin(Block.class)
public class BlockMixin implements BlockExtension {
public class BlockMixin {

@Shadow
private String key;
Expand Down Expand Up @@ -59,9 +58,4 @@ public class BlockMixin implements BlockExtension {
}
}
}

@Override
public boolean isAir() {
return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
"osl-text-components": "\u003e\u003d0.1.0-",
"osl-networking": "\u003e\u003d0.10.0",
"osl-networking-impl": "\u003e\u003d0.2.0",
"osl-registries": "\u003e\u003d0.1.0"
"osl-registries": "\u003e\u003d0.1.0",
"osl-blockstates": "\u003e\u003d0.1.0-"
},
"name": "OSL Blocks",
"description": "Blocks API and events.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,3 @@ transitive-accessible method net/minecraft/block/Block setTicksRandomly (Z)Lnet/
transitive-accessible method net/minecraft/block/Block setKey (Ljava/lang/String;)Lnet/minecraft/block/Block;
transitive-accessible method net/minecraft/block/Block disableStats ()Lnet/minecraft/block/Block;
transitive-accessible method net/minecraft/block/Block setCreativeModeTab (Lnet/minecraft/item/CreativeModeTab;)Lnet/minecraft/block/Block;

transitive-inject-interface net/minecraft/block/Block net/ornithemc/osl/blocks/impl/block/BlockExtensionImpl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"package": "net.ornithemc.osl.blocks.impl.mixin",
"compatibilityLevel": "JAVA_8",
"mixins": [
"common.AirBlockMixin",
"common.BlockMixin",
"common.StatsMixin"
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import net.minecraft.block.Block;
import net.minecraft.block.state.BlockState;

import net.ornithemc.osl.blocks.api.BlockRegistry;
import net.ornithemc.osl.registries.api.registry.sync.IdFixer;
import net.ornithemc.osl.registries.impl.access.Clearable;
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,12 @@
import net.minecraft.block.Block;

import net.ornithemc.osl.blocks.api.BlockRegistry;
import net.ornithemc.osl.blocks.api.block.BlockExtension;
import net.ornithemc.osl.blocks.impl.BlockRegistryImpl;
import net.ornithemc.osl.core.api.util.NamespacedIdentifier;
import net.ornithemc.osl.core.impl.util.Util;

@Mixin(Block.class)
public class BlockMixin implements BlockExtension {
public class BlockMixin {

@Shadow
private String key;
Expand Down Expand Up @@ -59,9 +58,4 @@ public class BlockMixin implements BlockExtension {
}
}
}

@Override
public boolean isAir() {
return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
"osl-text-components": "\u003e\u003d0.1.0-",
"osl-networking": "\u003e\u003d0.10.0",
"osl-networking-impl": "\u003e\u003d0.2.0",
"osl-registries": "\u003e\u003d0.1.0"
"osl-registries": "\u003e\u003d0.1.0",
"osl-blockstates": "\u003e\u003d0.1.0-"
},
"name": "OSL Blocks",
"description": "Blocks API and events.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,3 @@ transitive-accessible method net/minecraft/block/Block setTicksRandomly (Z)Lnet/
transitive-accessible method net/minecraft/block/Block setKey (Ljava/lang/String;)Lnet/minecraft/block/Block;
transitive-accessible method net/minecraft/block/Block disableStats ()Lnet/minecraft/block/Block;
transitive-accessible method net/minecraft/block/Block setCreativeModeTab (Lnet/minecraft/item/CreativeModeTab;)Lnet/minecraft/block/Block;

transitive-inject-interface net/minecraft/block/Block net/ornithemc/osl/blocks/impl/block/BlockExtensionImpl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
"compatibilityLevel": "JAVA_8",
"plugin": "net.ornithemc.osl.blocks.impl.BlocksMixinPlugin",
"mixins": [
"common.AirBlockMixin",
"common.BlockMixin",
"common.StatsMixin"
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
"osl-text-components": "\u003e\u003d0.1.0-",
"osl-networking": "\u003e\u003d0.10.0",
"osl-networking-impl": "\u003e\u003d0.2.0",
"osl-registries": "\u003e\u003d0.1.0"
"osl-registries": "\u003e\u003d0.1.0",
"osl-blockstates": "\u003e\u003d0.1.0-"
},
"name": "OSL Blocks",
"description": "Blocks API and events.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
"osl-text-components": "\u003e\u003d0.1.0-",
"osl-networking": "\u003e\u003d0.10.0",
"osl-networking-impl": "\u003e\u003d0.2.0",
"osl-registries": "\u003e\u003d0.1.0"
"osl-registries": "\u003e\u003d0.1.0",
"osl-blockstates": "\u003e\u003d0.1.0-"
},
"name": "OSL Blocks",
"description": "Blocks API and events.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
"osl-text-components": "\u003e\u003d0.1.0-",
"osl-networking": "\u003e\u003d0.10.0",
"osl-networking-impl": "\u003e\u003d0.2.0",
"osl-registries": "\u003e\u003d0.1.0"
"osl-registries": "\u003e\u003d0.1.0",
"osl-blockstates": "\u003e\u003d0.1.0-"
},
"name": "OSL Blocks",
"description": "Blocks API and events.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,4 @@ public interface BlockExtension {
DefaultedRegistry<Block> REGISTRY = BlockRegistryImpl.REGISTRY;
int AUTO_ASSIGN_ID = -172;

/**
* @return whether this block is air.
*/
boolean isAir();

/**
* @return whether this block is the same as the given block.
*/
boolean is(Block block);

}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import net.ornithemc.osl.blocks.api.BlockEvents;
import net.ornithemc.osl.blocks.impl.block.BlockIdFixer;
import net.ornithemc.osl.blocks.impl.block.BlockStateRegistryFixer;
import net.ornithemc.osl.core.api.util.NamespacedIdentifier;
import net.ornithemc.osl.core.api.util.NamespacedIdentifiers;
import net.ornithemc.osl.registries.api.registry.DefaultedRegistry;
Expand Down Expand Up @@ -88,6 +89,7 @@ public static <T extends Block> T register(int id, NamespacedIdentifier key, T b
public static void init() {
SyncedRegistries.register(RegistryKeys.BLOCK);
SyncedRegistries.registerFixer(RegistryKeys.BLOCK, NamespacedIdentifiers.from("block/id"), new BlockIdFixer());
SyncedRegistries.registerFixer(RegistryKeys.BLOCK, NamespacedIdentifiers.from("blockstate"), new BlockStateRegistryFixer());
}

public static void unlock() {
Expand Down
Loading
Loading