diff --git a/minecraft/1.11.2/build.gradle b/minecraft/1.11.2/build.gradle index fe98abd66..86a50ea88 100644 --- a/minecraft/1.11.2/build.gradle +++ b/minecraft/1.11.2/build.gradle @@ -10,13 +10,16 @@ archivesBaseName = "NOVA-Core-Wrapper-MC1.11.2" configurations { fatJar compile.extendsFrom fatJar + // Exclude slf4j-log4j from tests (we use slf4j-simple) + testRuntime.exclude module: 'slf4j-log4j12' + testRuntime.exclude module: 'log4j-slf4j-impl' } dependencies { fatJar project(":") + fatJar 'org.apache.logging.log4j:log4j-slf4j-impl:2.0-beta9' testCompile project(path: ':', configuration: 'wrapperTests') - fatJar 'org.slf4j:slf4j-log4j12:1.7.10' testCompile "junit:junit:4.12" testCompile 'org.assertj:assertj-core:3.0.0' testRuntime 'org.slf4j:slf4j-simple:1.7.10' diff --git a/minecraft/1.11.2/src/main/java/nova/core/wrapper/mc/forge/v1_11_2/wrapper/block/BlockConverter.java b/minecraft/1.11.2/src/main/java/nova/core/wrapper/mc/forge/v1_11_2/wrapper/block/BlockConverter.java index d8981fa89..b18066a34 100644 --- a/minecraft/1.11.2/src/main/java/nova/core/wrapper/mc/forge/v1_11_2/wrapper/block/BlockConverter.java +++ b/minecraft/1.11.2/src/main/java/nova/core/wrapper/mc/forge/v1_11_2/wrapper/block/BlockConverter.java @@ -24,7 +24,6 @@ import com.google.common.collect.HashBiMap; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.init.Blocks; -import net.minecraft.item.Item; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.common.FMLCommonHandler; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; @@ -38,7 +37,7 @@ import nova.core.nativewrapper.NativeConverter; import nova.core.wrapper.mc.forge.v1_11_2.launcher.ForgeLoadable; import nova.core.wrapper.mc.forge.v1_11_2.launcher.NovaMinecraft; -import nova.core.wrapper.mc.forge.v1_11_2.util.ModCreativeTab; +import nova.core.wrapper.mc.forge.v1_11_2.wrapper.CategoryConverter; import nova.core.wrapper.mc.forge.v1_11_2.wrapper.block.backward.BWBlock; import nova.core.wrapper.mc.forge.v1_11_2.wrapper.block.backward.BWBlockFactory; import nova.core.wrapper.mc.forge.v1_11_2.wrapper.block.forward.FWBlock; @@ -158,8 +157,7 @@ private void registerNovaBlock(BlockFactory blockFactory) { blockWrapper.setCreativeTab(first.get()); } else { Optional item = category.item; - ModCreativeTab tab = new ModCreativeTab(category.name, item.isPresent() ? Game.natives().toNative(item.get()) : Item.getItemFromBlock(blockWrapper)); - blockWrapper.setCreativeTab(tab); + blockWrapper.setCreativeTab(CategoryConverter.instance().toNative(category, blockWrapper)); } } diff --git a/minecraft/1.11.2/src/main/java/nova/core/wrapper/mc/forge/v1_11_2/wrapper/block/backward/BWBlockFactory.java b/minecraft/1.11.2/src/main/java/nova/core/wrapper/mc/forge/v1_11_2/wrapper/block/backward/BWBlockFactory.java index fa1497f7c..e247d5c1c 100644 --- a/minecraft/1.11.2/src/main/java/nova/core/wrapper/mc/forge/v1_11_2/wrapper/block/backward/BWBlockFactory.java +++ b/minecraft/1.11.2/src/main/java/nova/core/wrapper/mc/forge/v1_11_2/wrapper/block/backward/BWBlockFactory.java @@ -19,6 +19,7 @@ */ package nova.core.wrapper.mc.forge.v1_11_2.wrapper.block.backward; +import net.minecraft.block.Block; import nova.core.block.BlockFactory; /** @@ -26,7 +27,14 @@ */ public class BWBlockFactory extends BlockFactory { - public BWBlockFactory(net.minecraft.block.Block block) { - super(net.minecraft.block.Block.REGISTRY.getNameForObject(block).toString(), () -> new BWBlock(block), factory -> {}); + private final Block block; + + public BWBlockFactory(Block block) { + super(Block.REGISTRY.getNameForObject(block).toString(), () -> new BWBlock(block), factory -> {}); + this.block = block; + } + + public Block getBlock() { + return block; } } diff --git a/minecraft/1.11.2/src/main/java/nova/core/wrapper/mc/forge/v1_11_2/wrapper/block/forward/FWBlock.java b/minecraft/1.11.2/src/main/java/nova/core/wrapper/mc/forge/v1_11_2/wrapper/block/forward/FWBlock.java index 4a2829da5..07525855c 100644 --- a/minecraft/1.11.2/src/main/java/nova/core/wrapper/mc/forge/v1_11_2/wrapper/block/forward/FWBlock.java +++ b/minecraft/1.11.2/src/main/java/nova/core/wrapper/mc/forge/v1_11_2/wrapper/block/forward/FWBlock.java @@ -81,8 +81,7 @@ public class FWBlock extends net.minecraft.block.Block { public BlockPos lastExtendedStatePos; private Map harvestedBlocks = new HashMap<>(); - private static Material getMcMaterial(BlockFactory factory) { - Block dummy = factory.build(); + private static Material getMcMaterial(Block dummy) { if (dummy.components.has(BlockProperty.Opacity.class) || dummy.components.has(BlockProperty.Replaceable.class)) { // TODO allow color selection return new ProxyMaterial(MapColor.GRAY, @@ -94,10 +93,13 @@ private static Material getMcMaterial(BlockFactory factory) { } public FWBlock(BlockFactory factory) { - //TODO: Hack build() method - super(getMcMaterial(factory)); + this(factory, factory.build()); + } + + private FWBlock(BlockFactory factory, Block dummy) { + super(getMcMaterial(dummy)); this.factory = factory; - this.dummy = factory.build(); + this.dummy = dummy; if (dummy.components.has(BlockProperty.BlockSound.class)) { this.blockSoundType = new FWBlockSound(dummy.components.get(BlockProperty.BlockSound.class)); } else {