mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-18 03:25:02 +00:00
Better Brush Controls
This commit is contained in:
1 parent
3bd3a125b6
commit
8b1fdc5132
3 files changed
+32
-10
No files matched your search
@@ -30,6 +30,7 @@ import noppes.npcs.controllers.PlayerDataController;
|
||||
import noppes.npcs.controllers.ScriptController;
|
||||
import noppes.npcs.controllers.data.*;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
import noppes.npcs.items.ItemNpcTool;
|
||||
import noppes.npcs.quests.QuestItem;
|
||||
import noppes.npcs.scripted.NpcAPI;
|
||||
|
||||
@@ -154,6 +155,11 @@ public class ScriptPlayerEventHandler {
|
||||
if(event.getPlayer() == null || event.getPlayer().worldObj == null)
|
||||
return;
|
||||
|
||||
if(event.getPlayer().getHeldItem() != null && event.getPlayer().getHeldItem().getItem() instanceof ItemNpcTool){
|
||||
event.setCanceled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
if(!event.getPlayer().worldObj.isRemote && event.world instanceof WorldServer) {
|
||||
PlayerDataScript handler = ScriptController.Instance.playerScripts;
|
||||
IPlayer scriptPlayer = (IPlayer) NpcAPI.Instance().getIEntity(event.getPlayer());
|
||||
|
||||
@@ -115,7 +115,7 @@ public class QuestTrackingComponent extends HudComponent {
|
||||
GL11.glScalef(effectiveScale, effectiveScale, effectiveScale);
|
||||
|
||||
// Draw background (semi-transparent).
|
||||
drawRect(0, 0, overlayWidth, overlayHeight, 0x40FFFFFF);
|
||||
drawRect(0, 0, overlayWidth, overlayHeight, 0x40000000);
|
||||
|
||||
int currentY = 5;
|
||||
currentY = renderTextBlock(questTitleLines, currentY, textAlign, 0xFFFFFF);
|
||||
|
||||
@@ -31,7 +31,7 @@ public class ItemNpcTool extends Item {
|
||||
|
||||
// Define our tool types based on metadata:
|
||||
// meta 0: Hammer, meta 1: Paintbrush, meta 2: Wrench
|
||||
public static final String[] toolTypes = new String[] {"hammer", "paintbrush", "wrench"};
|
||||
public static final String[] toolTypes = new String[] {"hammer", "paintbrush"};
|
||||
public static String BRUSH_COLOR_TAG = "BrushColor";
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@@ -84,7 +84,7 @@ public class ItemNpcTool extends Item {
|
||||
if(world.isRemote)
|
||||
return stack;
|
||||
|
||||
if(isPaintbrush(stack) && !player.isSneaking()){
|
||||
if(isPaintbrush(stack) && player.isSneaking()){
|
||||
if(CustomNpcsPermissions.hasPermission(player, CustomNpcsPermissions.PAINTBRUSH_GUI)){
|
||||
NoppesUtil.requestOpenGUI(EnumGuiType.Paintbrush);
|
||||
}
|
||||
@@ -107,13 +107,7 @@ public class ItemNpcTool extends Item {
|
||||
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
if(tile instanceof TileColorable) {
|
||||
if(player.isSneaking()){
|
||||
int color = ((TileColorable) tile).color;
|
||||
PacketClient.sendClient(new ColorBrushPacket(color));
|
||||
}
|
||||
else {
|
||||
PacketClient.sendClient(new ColorSetPacket(x, y, z));
|
||||
}
|
||||
PacketClient.sendClient(new ColorSetPacket(x, y, z));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -121,6 +115,28 @@ public class ItemNpcTool extends Item {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean onBlockStartBreak(ItemStack itemstack, int x, int y, int z, EntityPlayer player)
|
||||
{
|
||||
if(!player.worldObj.isRemote)
|
||||
return true;
|
||||
|
||||
if(isPaintbrush(itemstack)) {
|
||||
Block block = player.worldObj.getBlock(x, y, z);
|
||||
if(block instanceof BlockTallLamp || block instanceof BlockBanner){
|
||||
int meta = player.worldObj.getBlockMetadata(x, y, z);
|
||||
if(meta >= 7)
|
||||
y--;
|
||||
}
|
||||
|
||||
TileEntity tile = player.worldObj.getTileEntity(x, y, z);
|
||||
if(tile instanceof TileColorable) {
|
||||
int color = ((TileColorable) tile).color;
|
||||
PacketClient.sendClient(new ColorBrushPacket(color));
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static boolean isPaintbrush(ItemStack itemStack){
|
||||
return itemStack.getItemDamage() == 1;
|
||||
|
||||
Reference in new issue
Block a user