Add HCMovement support. (#517)

This commit is contained in:
primetoxinz 2017-08-26 19:40:51 -04:00 committed by Jared
parent 2dadaf4e81
commit cfb6fd5253
3 changed files with 55 additions and 3 deletions

View file

@ -51,7 +51,7 @@ dependencies {
deobfCompile "mezz.jei:jei_1.12:4.7.2.76" deobfCompile "mezz.jei:jei_1.12:4.7.2.76"
deobfCompile "com.blamejared:MTLib:3.0.0.1" deobfCompile "com.blamejared:MTLib:3.0.0.1"
deobfCompile "cofh:ThermalExpansion:1.12-5.3.3.15:deobf" deobfCompile "cofh:ThermalExpansion:1.12-5.3.3.15:deobf"
deobfCompile "betterwithmods:BetterWithMods:1.12-1.3.7-14" deobfCompile "betterwithmods:BetterWithMods:1.12-2.0.7-100"
deobfCompile "de.ellpeck.actuallyadditions:ActuallyAdditions:1.12-r113" deobfCompile "de.ellpeck.actuallyadditions:ActuallyAdditions:1.12-r113"
} }

View file

@ -1,6 +1,6 @@
#Mon Sep 14 12:28:28 PDT 2015 #Sat Aug 26 16:46:42 EDT 2017
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-2.14-all.zip

View file

@ -0,0 +1,52 @@
package com.blamejared.compat.betterwithmods;
import betterwithmods.module.hardcore.HCMovement;
import com.blamejared.mtlib.helpers.InputHelper;
import com.blamejared.mtlib.utils.BaseUndoable;
import crafttweaker.CraftTweakerAPI;
import crafttweaker.annotations.ModOnly;
import crafttweaker.annotations.ZenRegister;
import crafttweaker.api.item.IItemStack;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import stanhebben.zenscript.annotations.ZenClass;
import stanhebben.zenscript.annotations.ZenMethod;
@ZenClass("mods.betterwithmods.Movement")
@ModOnly("betterwithmods")
@ZenRegister
public class Movement {
@ZenMethod
public static void set(IItemStack input, float speed) {
ItemStack stack = InputHelper.toStack(input);
if (InputHelper.isABlock(stack)) {
Block block = ((ItemBlock) stack.getItem()).getBlock();
IBlockState state = block.getStateFromMeta(stack.getMetadata());
CraftTweakerAPI.apply(new Set(state, speed));
}
}
public static class Set extends BaseUndoable {
private IBlockState state;
private float speed;
protected Set(IBlockState state, float speed) {
super("Set Block HCMovement");
this.state = state;
this.speed = speed;
}
@Override
protected String getRecipeInfo() {
return state.toString() + "->" + speed;
}
@Override
public void apply() {
HCMovement.BLOCK_OVERRIDE_MOVEMENT.put(state, speed);
}
}
}