forked from TAIGA/TAIGA
added modifier key to right click actions of traits, now requires default LCONTROL to be pressed. fixes #112
Signed-off-by: Giovanni Harting <539@idlegandalf.com>
This commit is contained in:
9
src/main/java/com/sosnitzka/taiga/Keybindings.java
Normal file
9
src/main/java/com/sosnitzka/taiga/Keybindings.java
Normal file
@@ -0,0 +1,9 @@
|
||||
package com.sosnitzka.taiga;
|
||||
|
||||
import net.minecraft.client.settings.KeyBinding;
|
||||
import org.lwjgl.input.Keyboard;
|
||||
|
||||
public class Keybindings {
|
||||
public static KeyBinding altKey = new KeyBinding("key.taiga.alt_action", Keyboard.KEY_LCONTROL, "TAIGA");
|
||||
|
||||
}
|
@@ -58,6 +58,7 @@ public class TAIGA {
|
||||
@EventHandler
|
||||
public void init(FMLInitializationEvent e) {
|
||||
proxy.registerModels(); // Registers models on the client side
|
||||
proxy.regsiterKeyBindings();
|
||||
|
||||
Fluids.registerfromItem(); // Registers some special smeltery recipes (not alloying)
|
||||
GameRegistry.registerWorldGenerator(WorldGen.getInstance(), 100); // Generates ores
|
||||
|
@@ -17,6 +17,7 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.client.model.ModelLoader;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fml.client.registry.ClientRegistry;
|
||||
import slimeknights.mantle.client.book.repository.FileRepository;
|
||||
import slimeknights.tconstruct.library.book.TinkerBook;
|
||||
import slimeknights.tconstruct.library.client.MaterialRenderInfo;
|
||||
@@ -27,6 +28,7 @@ import javax.annotation.Nonnull;
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
import static com.sosnitzka.taiga.Fluids.*;
|
||||
import static com.sosnitzka.taiga.Keybindings.altKey;
|
||||
import static com.sosnitzka.taiga.MaterialTraits.*;
|
||||
import static slimeknights.mantle.client.book.BookLoader.registerPageType;
|
||||
|
||||
@@ -41,6 +43,11 @@ public class ClientProxy extends CommonProxy {
|
||||
Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0, new ModelResourceLocation(item.getRegistryName(), "inventory"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void regsiterKeyBindings() {
|
||||
ClientRegistry.registerKeyBinding(altKey);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerModels() {
|
||||
Field[] itemFields = Items.class.getDeclaredFields();
|
||||
|
@@ -27,4 +27,8 @@ public class CommonProxy {
|
||||
|
||||
public void registerBookPages() {
|
||||
}
|
||||
|
||||
public void regsiterKeyBindings() {
|
||||
|
||||
}
|
||||
}
|
||||
|
@@ -16,6 +16,8 @@ import slimeknights.tconstruct.library.utils.TagUtil;
|
||||
import slimeknights.tconstruct.library.utils.TinkerUtil;
|
||||
import slimeknights.tconstruct.library.utils.ToolHelper;
|
||||
|
||||
import static com.sosnitzka.taiga.Keybindings.altKey;
|
||||
|
||||
|
||||
public class TraitBerserk extends TraitProgressiveStats {
|
||||
|
||||
@@ -53,11 +55,10 @@ public class TraitBerserk extends TraitProgressiveStats {
|
||||
NBTTagCompound root = TagUtil.getTagSafe(tool);
|
||||
StatNBT distributed = getBonus(root);
|
||||
if (data.active) {
|
||||
TagUtil.setEnchantEffect(root, true);
|
||||
if (entity instanceof FakePlayer) {
|
||||
return;
|
||||
}
|
||||
if (entity.ticksExisted % TICK_PER_STAT > 0) {
|
||||
if (!TagUtil.hasEnchantEffect(root))
|
||||
TagUtil.setEnchantEffect(root, true);
|
||||
|
||||
if (entity instanceof FakePlayer || entity.ticksExisted % TICK_PER_STAT != 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -69,7 +70,10 @@ public class TraitBerserk extends TraitProgressiveStats {
|
||||
ToolHelper.damageTool(tool, 1, player);
|
||||
TagUtil.setToolTag(root, stat.get());
|
||||
setBonus(root, distributed);
|
||||
} else TagUtil.setEnchantEffect(root, false);
|
||||
} else {
|
||||
if (TagUtil.hasEnchantEffect(root))
|
||||
TagUtil.setEnchantEffect(root, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,7 +81,7 @@ public class TraitBerserk extends TraitProgressiveStats {
|
||||
public void onRightClickItem(PlayerInteractEvent.RightClickItem event) {
|
||||
World w = event.getWorld();
|
||||
ItemStack tool = event.getEntityPlayer().getHeldItemMainhand();
|
||||
if (!w.isRemote && TinkerUtil.hasTrait(TagUtil.getTagSafe(tool), identifier)) {
|
||||
if (!w.isRemote && TinkerUtil.hasTrait(TagUtil.getTagSafe(tool), identifier) && altKey.isKeyDown()) {
|
||||
NBTTagCompound tag = TagUtil.getExtraTag(tool);
|
||||
Utils.GeneralNBTData data = Utils.GeneralNBTData.read(tag);
|
||||
NBTTagCompound root = TagUtil.getTagSafe(tool);
|
||||
@@ -99,7 +103,6 @@ public class TraitBerserk extends TraitProgressiveStats {
|
||||
TagUtil.setExtraTag(root, tag);
|
||||
data.write(tag);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -23,6 +23,8 @@ import slimeknights.tconstruct.library.utils.TagUtil;
|
||||
import slimeknights.tconstruct.library.utils.TinkerUtil;
|
||||
import slimeknights.tconstruct.library.utils.ToolHelper;
|
||||
|
||||
import static com.sosnitzka.taiga.Keybindings.altKey;
|
||||
|
||||
|
||||
public class TraitCatcher extends AbstractTrait {
|
||||
|
||||
@@ -81,7 +83,7 @@ public class TraitCatcher extends AbstractTrait {
|
||||
World w = event.getWorld();
|
||||
BlockPos pos = event.getEntityPlayer().getPosition();
|
||||
ItemStack tool = event.getEntityPlayer().getHeldItemMainhand();
|
||||
if (!w.isRemote && TinkerUtil.hasTrait(TagUtil.getTagSafe(tool), identifier)) {
|
||||
if (!w.isRemote && TinkerUtil.hasTrait(TagUtil.getTagSafe(tool), identifier) && altKey.isKeyDown()) {
|
||||
NBTTagCompound tag = TagUtil.getExtraTag(tool);
|
||||
Data data = Data.read(tag);
|
||||
if (!data.mobClass.isEmpty()) {
|
||||
|
@@ -24,7 +24,6 @@ public class TraitHollow extends AbstractTrait {
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onHit(ItemStack tool, EntityLivingBase player, EntityLivingBase target, float damage, boolean
|
||||
isCritical) {
|
||||
|
@@ -18,7 +18,6 @@ public class TraitMelting extends AbstractTrait {
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
}
|
||||
|
||||
|
||||
@SubscribeEvent
|
||||
public void blockbreak(BlockEvent.BreakEvent e) {
|
||||
Block b = e.getWorld().getBlockState(e.getPos()).getBlock();
|
||||
|
@@ -15,8 +15,6 @@ import static com.google.common.collect.Lists.newArrayList;
|
||||
|
||||
|
||||
public class TraitMutate extends AbstractTrait {
|
||||
|
||||
|
||||
public TraitMutate() {
|
||||
super(TraitMutate.class.getSimpleName().toLowerCase().substring(5), TextFormatting.YELLOW);
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
@@ -37,7 +35,6 @@ public class TraitMutate extends AbstractTrait {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -12,7 +12,6 @@ import slimeknights.tconstruct.library.utils.ToolHelper;
|
||||
|
||||
|
||||
public class TraitNatureBound extends AbstractTrait {
|
||||
|
||||
public TraitNatureBound() {
|
||||
super("naturebound", TextFormatting.GREEN);
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
|
@@ -1,5 +1,6 @@
|
||||
package com.sosnitzka.taiga.traits;
|
||||
|
||||
import com.sosnitzka.taiga.Keybindings;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.init.Blocks;
|
||||
@@ -28,7 +29,7 @@ public class TraitPorted extends AbstractTrait {
|
||||
@SubscribeEvent
|
||||
public void onItemRightClick(PlayerInteractEvent.RightClickItem e) {
|
||||
ItemStack tool = e.getEntityPlayer().getHeldItemMainhand();
|
||||
if (TinkerUtil.hasTrait(TagUtil.getTagSafe(tool), identifier))
|
||||
if (TinkerUtil.hasTrait(TagUtil.getTagSafe(tool), identifier) && Keybindings.altKey.isKeyDown())
|
||||
teleport(e.getEntityPlayer(), e.getWorld());
|
||||
}
|
||||
|
||||
|
@@ -1,5 +1,6 @@
|
||||
package com.sosnitzka.taiga.traits;
|
||||
|
||||
import com.sosnitzka.taiga.Keybindings;
|
||||
import com.sosnitzka.taiga.util.Utils;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -61,11 +62,11 @@ public class TraitTantrum extends AbstractTrait {
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void RightClickItem(PlayerInteractEvent.RightClickItem event) {
|
||||
public void rightClickItem(PlayerInteractEvent.RightClickItem event) {
|
||||
World w = event.getWorld();
|
||||
BlockPos pos = event.getPos();
|
||||
ItemStack tool = event.getEntityPlayer().getHeldItemMainhand();
|
||||
if (!w.isRemote && TinkerUtil.hasTrait(TagUtil.getTagSafe(tool), identifier)) {
|
||||
if (!w.isRemote && TinkerUtil.hasTrait(TagUtil.getTagSafe(tool), identifier) && Keybindings.altKey.isKeyDown()) {
|
||||
NBTTagCompound tag = TagUtil.getExtraTag(tool);
|
||||
Data data = Data.read(tag);
|
||||
if (data.amount > 1f) {
|
||||
|
@@ -1,5 +1,6 @@
|
||||
package com.sosnitzka.taiga.traits;
|
||||
|
||||
import com.sosnitzka.taiga.Keybindings;
|
||||
import com.sosnitzka.taiga.util.Utils;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.init.Blocks;
|
||||
@@ -55,7 +56,7 @@ public class TraitWhirl extends AbstractTrait {
|
||||
public void onRightClickItem(PlayerInteractEvent.RightClickItem event) {
|
||||
World w = event.getWorld();
|
||||
ItemStack tool = event.getEntityPlayer().getHeldItemMainhand();
|
||||
if (!w.isRemote && TinkerUtil.hasTrait(TagUtil.getTagSafe(tool), identifier)) {
|
||||
if (!w.isRemote && TinkerUtil.hasTrait(TagUtil.getTagSafe(tool), identifier) && Keybindings.altKey.isKeyDown()) {
|
||||
NBTTagCompound tag = TagUtil.getExtraTag(tool);
|
||||
Utils.GeneralNBTData data = Utils.GeneralNBTData.read(tag);
|
||||
if ((int) data.radius >= 1) {
|
||||
|
@@ -351,8 +351,8 @@ modifier.whirl.name=Whirl
|
||||
modifier.whirl.desc=§oLike a sponge!§r\nRemove water at a gained radius.
|
||||
modifier.souleater.name=Soul Eater
|
||||
modifier.souleater.desc=§oKill a lot, be a veteran§r\nIf you kill a lot of enemies, your weapon will get stronger.
|
||||
modifier.beserk.name=BESERK
|
||||
modifier.beserk.desc=§oBecome the Hulk!§r\nActivate the life consumption and be three times faster and stronger.
|
||||
modifier.berserk.name=BESERK
|
||||
modifier.berserk.desc=§oBecome the Hulk!§r\nActivate the life consumption and be three times faster and stronger.
|
||||
modifier.tantrum.name=Tantrum
|
||||
modifier.tantrum.desc=§oCast an explosion!§r\nIf you activate the stacked explosion you won't get hurt.
|
||||
modifier.decay.name=Decay
|
||||
@@ -366,4 +366,6 @@ modifier.crushing.desc=WIP
|
||||
|
||||
gui.taiga_configuration.mainTitle=TAIGA Configuration
|
||||
itemGroup.taiga_block=TAIGA Blocks
|
||||
itemGroup.taiga_item=TAIGA Items
|
||||
itemGroup.taiga_item=TAIGA Items
|
||||
|
||||
key.taiga.alt_action=Mod Tool
|
Reference in New Issue
Block a user