diff --git a/build.gradle b/build.gradle index 198353c..b77cd21 100644 --- a/build.gradle +++ b/build.gradle @@ -23,7 +23,7 @@ sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8 minecraft { - version = "1.12.2-14.23.2.2624" + version = "1.12.2-14.23.4.2705" runDir = "run" mappings = "snapshot_20171125" replace "%VERSION%": "${project.version}" @@ -38,7 +38,7 @@ repositories { } dependencies { - deobfCompile "betterwithmods:BetterWithMods:1.12-2.1.8-477" + deobfCompile "betterwithmods:BetterWithMods:1.12-2.1.24-720" deobfCompile "mezz.jei:jei_1.12.2:4.8.3.128" //deobfCompile "com.blamejared:MTLib:3.+" compile files('libs/') diff --git a/src/main/java/betterwithaddons/ClientProxy.java b/src/main/java/betterwithaddons/ClientProxy.java index 8ee4c96..07e9f94 100644 --- a/src/main/java/betterwithaddons/ClientProxy.java +++ b/src/main/java/betterwithaddons/ClientProxy.java @@ -18,15 +18,10 @@ import betterwithmods.manual.api.ManualAPI; import betterwithmods.manual.api.manual.ImageRenderer; import betterwithmods.manual.api.prefab.manual.ItemStackTabIconRenderer; -import betterwithmods.manual.api.prefab.manual.ResourceContentProvider; -import betterwithmods.manual.client.manual.Document; -import betterwithmods.manual.client.manual.provider.BlockImageProvider; -import betterwithmods.manual.client.manual.provider.ItemImageProvider; -import betterwithmods.manual.client.manual.provider.OreDictImageProvider; -import betterwithmods.manual.client.manual.provider.TextureImageProvider; -import betterwithmods.manual.client.manual.segment.JEIRenderSegment; -import betterwithmods.manual.client.manual.segment.JEISegment; import betterwithmods.manual.client.manual.segment.Segment; +import betterwithmods.manual.common.DirectoryDefaultProvider; +import betterwithmods.manual.custom.JEIRenderSegment; +import betterwithmods.manual.custom.JEISegment; import com.google.common.base.Strings; import com.google.common.collect.Maps; import net.minecraft.block.Block; @@ -62,7 +57,6 @@ public class ClientProxy implements IProxy public static ModelResourceLocation ropePostLocation = new ModelResourceLocation(new ResourceLocation(Reference.MOD_ID, "rope_post_knot"), "normal"); static ResourceProxy resourceProxy; - private static Pattern varPattern = Pattern.compile("var:([^\\)]+)"); static { resourceProxy = new ResourceProxy(); @@ -97,35 +91,10 @@ public void init() { registerColorable(ModItems.TEA_CUP); MinecraftForge.EVENT_BUS.register(new ToolShardModelHandler()); - //TODO definition provider - ManualAPI.addProvider(new ResourceContentProvider(Reference.MOD_ID, "docs/")); - ManualAPI.addProvider("", new TextureImageProvider()); - ManualAPI.addProvider("item", new ItemImageProvider()); - ManualAPI.addProvider("block", new BlockImageProvider()); - ManualAPI.addProvider("oredict", new OreDictImageProvider()); - ManualAPI.addTab(new ItemStackTabIconRenderer(new ItemStack(ModBlocks.CHUTE)), "bwm.manual.bwa", "%LANGUAGE%/bwa/index.md"); - String imagePattern = "!\\[([^\\[]*)\\]\\(([^\\)]+)\\)"; - Document.SEGMENT_TYPES.removeIf(mapping -> mapping.pattern.pattern().equals(imagePattern)); - Document.SEGMENT_TYPES.add(1,new Document.PatternMapping(imagePattern, ClientProxy::JEIorVariableSegment)); + ManualAPI.addProvider(new DirectoryDefaultProvider(new ResourceLocation(Reference.MOD_ID, "docs/"))); + ManualAPI.addTab(new ItemStackTabIconRenderer(new ItemStack(ModBlocks.CHUTE)),"bwm.manual.bwa", "%LANGUAGE%/bwa/index.md"); } - private static Segment JEIorVariableSegment(final Segment s, final Matcher m) { - Matcher varMatch = varPattern.matcher(m.group(2)); - if(varMatch.matches()) { - return new VariableSegment(s,varMatch.group(1)); - } - - try { - final ImageRenderer renderer = ManualAPI.imageFor(m.group(2)); - if (renderer != null) { - return new JEIRenderSegment(s, m.group(1), m.group(2), renderer); - } else { - return new JEISegment(s, "No renderer found for: " + m.group(2)); - } - } catch (final Throwable t) { - return new JEISegment(s, Strings.isNullOrEmpty(t.toString()) ? "Unknown error." : t.toString(), m.group(2)); - } - } @Override public void postInit() { diff --git a/src/main/java/betterwithaddons/crafting/recipes/HopperCratingRecipe.java b/src/main/java/betterwithaddons/crafting/recipes/HopperCratingRecipe.java index 21ab31e..56fbd1d 100644 --- a/src/main/java/betterwithaddons/crafting/recipes/HopperCratingRecipe.java +++ b/src/main/java/betterwithaddons/crafting/recipes/HopperCratingRecipe.java @@ -5,75 +5,45 @@ import betterwithmods.common.blocks.tile.SimpleStackHandler; import betterwithmods.common.registry.HopperFilter; import betterwithmods.common.registry.HopperInteractions.HopperRecipe; -import betterwithmods.util.InvUtils; import betterwithmods.util.StackIngredient; import com.google.common.collect.Lists; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.item.EntityItem; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.Ingredient; -import net.minecraft.util.NonNullList; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import java.util.List; -import java.util.stream.Collectors; public class HopperCratingRecipe extends HopperRecipe { - StackIngredient testIngredient; public HopperCratingRecipe(Ingredient input, ItemStack output) { - super(HopperFilter.NONE.getName(), input, output); - testIngredient = StackIngredient.fromIngredient(7,input); + super(HopperFilter.NONE.getName(), StackIngredient.fromIngredient(8, input), output); } @Override - public List getContainers() { + public List getInputContainer() { return Lists.newArrayList(new ItemStack(ModBlocks.BOX)); } - @Override - public List getInputs() { - return super.getInputs().stream().map(stack -> { - ItemStack newStack = stack.copy(); - newStack.setCount(8); - return newStack; - }).collect(Collectors.toList()); - } - - public boolean isCrate(IBlockState state) - { + public boolean isCrate(IBlockState state) { return state.getBlock() == ModBlocks.BOX; } @Override public boolean canCraft(World world, BlockPos pos) { IBlockState crateState = world.getBlockState(pos.down()); - TileEntityFilteredHopper tile = (TileEntityFilteredHopper)world.getTileEntity(pos); - SimpleStackHandler inventory = tile.inventory; - if(!isCrate(crateState)) { + if (!isCrate(crateState)) { return false; } - return InvUtils.consumeItemsInInventory(inventory, testIngredient, true, NonNullList.create()); + return super.canCraft(world, pos); } @Override - public void craft(EntityItem entity, World world, BlockPos pos) { - TileEntityFilteredHopper tile = (TileEntityFilteredHopper)world.getTileEntity(pos); - SimpleStackHandler inventory = tile.inventory; - if(!InvUtils.consumeItemsInInventory(inventory, entity.getItem(), 7, false)) { - return; - } - - InvUtils.ejectStackWithOffset(world, pos.down(1), secondaryOutputs); - - this.onCraft(world, pos, entity); - } - - @Override - public void onCraft(World world, BlockPos pos, EntityItem item) { + public void onCraft(World world, BlockPos pos, EntityItem item, TileEntityFilteredHopper tile) { world.setBlockToAir(pos.down()); - - super.onCraft(world, pos, item); + super.onCraft(world, pos, item, tile); } + } diff --git a/src/main/java/betterwithaddons/interaction/InteractionBWM.java b/src/main/java/betterwithaddons/interaction/InteractionBWM.java index 986a3db..86e4351 100644 --- a/src/main/java/betterwithaddons/interaction/InteractionBWM.java +++ b/src/main/java/betterwithaddons/interaction/InteractionBWM.java @@ -234,7 +234,7 @@ public void init() { String[] dyeOredictTags = new String[]{"White", "Orange", "Magenta", "LightBlue", "Yellow", "Lime", "Pink", "Gray", "LightGray", "Cyan", "Purple", "Blue", "Brown", "Green", "Red", "Black"}; if (HARDCORE_SHEARING) { - BlockBDispenser.ENTITY_COLLECT_REGISTRY.putObject(EntitySheep.class, (world, pos, entity, itemStack) -> { + BlockBDispenser.ENTITY_COLLECT_REGISTRY.putObject(new ResourceLocation("sheep"), (world, pos, entity, itemStack) -> { EntitySheep sheep = (EntitySheep) entity; if (sheep.isShearable(new ItemStack(Items.SHEARS), world, pos)) { return convertShearedWool(sheep.onSheared(new ItemStack(Items.SHEARS), world, pos, 0));