mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
some usability improvements
This commit is contained in:
parent
ec84179e3f
commit
65ae9b45ab
@ -520,11 +520,11 @@ public abstract class BlockDummyable extends BlockContainer implements ICustomBl
|
||||
}
|
||||
|
||||
@Override
|
||||
public void pasteSettings(NBTTagCompound nbt, int index, World world, int x, int y, int z) {
|
||||
public void pasteSettings(NBTTagCompound nbt, int index, World world, EntityPlayer player, int x, int y, int z) {
|
||||
int[] pos = findCore(world, x, y, z);
|
||||
TileEntity tile = world.getTileEntity(pos[0], pos[1], pos[2]);
|
||||
if (tile instanceof ICopiable)
|
||||
((ICopiable) tile).pasteSettings(nbt, index, world, pos[0], pos[1], pos[2]);
|
||||
((ICopiable) tile).pasteSettings(nbt, index, world, player, pos[0], pos[1], pos[2]);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -4,8 +4,11 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.blocks.IAnalyzable;
|
||||
import com.hbm.extprop.HbmPlayerProps;
|
||||
import com.hbm.handler.HbmKeybinds;
|
||||
import com.hbm.inventory.fluid.FluidType;
|
||||
import com.hbm.items.machine.IItemFluidIdentifier;
|
||||
import com.hbm.items.machine.ItemFluidIDMulti;
|
||||
import com.hbm.tileentity.network.TileEntityPipeBaseNT;
|
||||
|
||||
import api.hbm.fluid.IPipeNet;
|
||||
@ -14,6 +17,7 @@ import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
@ -36,13 +40,24 @@ public class FluidDuctBase extends BlockContainer implements IBlockFluidDuct, IA
|
||||
IItemFluidIdentifier id = (IItemFluidIdentifier) player.getHeldItem().getItem();
|
||||
FluidType type = id.getType(world, x, y, z, player.getHeldItem());
|
||||
|
||||
if(!player.isSneaking()) {
|
||||
if(!HbmPlayerProps.getData(player).getKeyPressed(HbmKeybinds.EnumKeybind.TOOL_CTRL) && !player.isSneaking()) {
|
||||
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
|
||||
if(te instanceof TileEntityPipeBaseNT) {
|
||||
TileEntityPipeBaseNT pipe = (TileEntityPipeBaseNT) te;
|
||||
|
||||
|
||||
if(HbmPlayerProps.getData(player).getKeyPressed(HbmKeybinds.EnumKeybind.TOOL_ALT)) {
|
||||
Item item = player.getHeldItem().getItem();
|
||||
if (item instanceof ItemFluidIDMulti) {
|
||||
if (id.getType(world, x, y, z, player.getHeldItem()) != pipe.getType()) {
|
||||
ItemFluidIDMulti.setType(player.getHeldItem(), pipe.getType(), true);
|
||||
world.playSoundAtEntity(player, "random.orb", 0.25F, 0.75F);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(pipe.getType() != type) {
|
||||
pipe.setType(type);
|
||||
return true;
|
||||
@ -51,9 +66,21 @@ public class FluidDuctBase extends BlockContainer implements IBlockFluidDuct, IA
|
||||
} else {
|
||||
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
|
||||
|
||||
if(te instanceof TileEntityPipeBaseNT) {
|
||||
TileEntityPipeBaseNT pipe = (TileEntityPipeBaseNT) te;
|
||||
|
||||
if(HbmPlayerProps.getData(player).getKeyPressed(HbmKeybinds.EnumKeybind.TOOL_ALT)) {
|
||||
Item item = player.getHeldItem().getItem();
|
||||
if (item instanceof ItemFluidIDMulti) {
|
||||
if (id.getType(world, x, y, z, player.getHeldItem()) != pipe.getType()) {
|
||||
ItemFluidIDMulti.setType(player.getHeldItem(), pipe.getType(), true);
|
||||
world.playSoundAtEntity(player, "random.orb", 0.25F, 0.75F);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
changeTypeRecursively(world, x, y, z, pipe.getType(), type, 64);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -24,7 +24,9 @@ public class HbmKeybinds {
|
||||
public static KeyBinding reloadKey = new KeyBinding(category + ".reload", Keyboard.KEY_R, category);
|
||||
public static KeyBinding dashKey = new KeyBinding(category + ".dash", Keyboard.KEY_LSHIFT, category);
|
||||
public static KeyBinding trainKey = new KeyBinding(category + ".trainInv", Keyboard.KEY_R, category);
|
||||
public static KeyBinding copyToolAlt = new KeyBinding(category + ".copyTool", Keyboard.KEY_LMENU, category);
|
||||
public static KeyBinding copyToolAlt = new KeyBinding(category + ".copyToolAlt", Keyboard.KEY_LMENU, category);
|
||||
|
||||
public static KeyBinding copyToolCtrl = new KeyBinding(category + ".copyToolCtrl", Keyboard.KEY_LCONTROL, category);
|
||||
|
||||
public static KeyBinding craneUpKey = new KeyBinding(category + ".craneMoveUp", Keyboard.KEY_UP, category);
|
||||
public static KeyBinding craneDownKey = new KeyBinding(category + ".craneMoveDown", Keyboard.KEY_DOWN, category);
|
||||
@ -45,6 +47,7 @@ public class HbmKeybinds {
|
||||
ClientRegistry.registerKeyBinding(craneRightKey);
|
||||
ClientRegistry.registerKeyBinding(craneLoadKey);
|
||||
ClientRegistry.registerKeyBinding(copyToolAlt);
|
||||
ClientRegistry.registerKeyBinding(copyToolCtrl);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
@ -78,6 +81,7 @@ public class HbmKeybinds {
|
||||
CRANE_LEFT,
|
||||
CRANE_RIGHT,
|
||||
CRANE_LOAD,
|
||||
COPY_TOOL
|
||||
TOOL_ALT,
|
||||
TOOL_CTRL
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,6 +2,7 @@ package com.hbm.interfaces;
|
||||
|
||||
import com.hbm.util.Either;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
@ -10,7 +11,7 @@ public interface ICopiable {
|
||||
|
||||
NBTTagCompound getSettings(World world, int x, int y, int z);
|
||||
|
||||
void pasteSettings(NBTTagCompound nbt, int index, World world, int x, int y, int z);
|
||||
void pasteSettings(NBTTagCompound nbt, int index, World world, EntityPlayer player, int x, int y, int z);
|
||||
|
||||
default String getSettingsSourceID(Either<TileEntity, Block> self) {
|
||||
Block block = self.isLeft() ? self.left().getBlockType() : self.right();
|
||||
|
||||
@ -20,7 +20,6 @@ import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class ItemSettingsTool extends Item {
|
||||
@ -32,14 +31,18 @@ public class ItemSettingsTool extends Item {
|
||||
|
||||
if(((EntityPlayer) entity).getHeldItem() == stack && stack.hasTagCompound()) {
|
||||
EntityPlayer player = ((EntityPlayer) entity);
|
||||
int delay = stack.stackTagCompound.getInteger("inputDelay");
|
||||
delay++;
|
||||
displayInfo = stack.stackTagCompound.getTagList("displayInfo", 10);
|
||||
|
||||
if (HbmPlayerProps.getData(player).getKeyPressed(HbmKeybinds.EnumKeybind.COPY_TOOL)) {
|
||||
if (HbmPlayerProps.getData(player).getKeyPressed(HbmKeybinds.EnumKeybind.TOOL_ALT) && delay > 4) {
|
||||
int index = stack.stackTagCompound.getInteger("copyIndex") + 1;
|
||||
if(index > displayInfo.tagCount() - 1) index = 0;
|
||||
stack.stackTagCompound.setInteger("copyIndex", index);
|
||||
delay = 0;
|
||||
}
|
||||
|
||||
stack.stackTagCompound.setInteger("inputDelay", delay);
|
||||
if(world.getTotalWorldTime() % 5 != 0) return;
|
||||
|
||||
if(displayInfo.tagCount() > 0){
|
||||
@ -75,6 +78,7 @@ public class ItemSettingsTool extends Item {
|
||||
stack.stackTagCompound = copiable.getSettings(world, x, y, z);
|
||||
stack.stackTagCompound.setString("tileName", copiable.getSettingsSourceID(schrodinger));
|
||||
stack.stackTagCompound.setInteger("copyIndex", 0);
|
||||
stack.stackTagCompound.setInteger("inputDelay", 0);
|
||||
String[] info = copiable.infoForDisplay(world, x, y, z);
|
||||
if(info != null) {
|
||||
NBTTagList displayInfo = new NBTTagList();
|
||||
@ -95,7 +99,7 @@ public class ItemSettingsTool extends Item {
|
||||
|
||||
} else if(stack.hasTagCompound()) {
|
||||
int index = stack.stackTagCompound.getInteger("copyIndex");
|
||||
copiable.pasteSettings(stack.stackTagCompound, index, world, x, y, z);
|
||||
copiable.pasteSettings(stack.stackTagCompound, index, world, player, x, y, z);
|
||||
}
|
||||
|
||||
return !world.isRemote;
|
||||
|
||||
@ -2113,7 +2113,8 @@ public class ClientProxy extends ServerProxy {
|
||||
case CRANE_LEFT: return HbmKeybinds.craneLeftKey.getIsKeyPressed();
|
||||
case CRANE_RIGHT: return HbmKeybinds.craneRightKey.getIsKeyPressed();
|
||||
case CRANE_LOAD: return HbmKeybinds.craneLoadKey.getIsKeyPressed();
|
||||
case COPY_TOOL: return HbmKeybinds.copyToolAlt.getIsKeyPressed();
|
||||
case TOOL_ALT: return HbmKeybinds.copyToolAlt.getIsKeyPressed();
|
||||
case TOOL_CTRL: return HbmKeybinds.copyToolCtrl.getIsKeyPressed();
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
@ -3,6 +3,7 @@ package com.hbm.tileentity;
|
||||
import com.hbm.interfaces.IControlReceiver;
|
||||
|
||||
import com.hbm.interfaces.ICopiable;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@ -66,7 +67,7 @@ public interface IControlReceiverFilter extends IControlReceiver, ICopiable {
|
||||
}
|
||||
|
||||
@Override
|
||||
default void pasteSettings(NBTTagCompound nbt, int index, World world, int x, int y, int z) {
|
||||
default void pasteSettings(NBTTagCompound nbt, int index, World world, EntityPlayer player, int x, int y, int z) {
|
||||
TileEntity tile = (TileEntity) this;
|
||||
IInventory inv = (IInventory) this;
|
||||
NBTTagList items = nbt.getTagList("items", 10);
|
||||
|
||||
@ -5,6 +5,7 @@ import com.hbm.interfaces.ICopiable;
|
||||
import com.hbm.inventory.fluid.Fluids;
|
||||
import com.hbm.inventory.fluid.tank.FluidTank;
|
||||
import com.hbm.util.BobMathUtil;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
@ -40,7 +41,7 @@ public interface IFluidCopiable extends ICopiable {
|
||||
}
|
||||
|
||||
@Override
|
||||
default void pasteSettings(NBTTagCompound nbt, int index, World world, int x, int y, int z) {
|
||||
default void pasteSettings(NBTTagCompound nbt, int index, World world, EntityPlayer player, int x, int y, int z) {
|
||||
if(getTankToPaste() != null) {
|
||||
int[] ids = nbt.getIntArray("fluidID");
|
||||
if(ids.length > 0) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user