Comments (10)
Yeah, that sounds good, I'll probably have some sort of dropdown to select whether to allow taking it off for players, entities, none, and both.
from nobreak.
I have no idea how to work with inventory code, and as I probably won't be using it myself since I rarely PVP, I'll discontinue this. If you want to try to make it work, feel free to send a PR. The area where you'd add stuff would be in NBEvents.kt, in the area with the it.player?.let tick@{ player ->
and the comment.
from nobreak.
The thing about this situation, is that if your armor was already really low, you're almost guaranteed to be in a PV(P/E) situation, in which case it's rather problematic if the mod were to take off your armor. This could be "fixed" by making it automatically put on a new set, but at that point it's cheating. I'm not sure of any alternatives that would make this viable.
from nobreak.
Yeah, putting on a new set would be out of scope.
I'm thinking more like PvE fights when having e.g. thorns 3 on armor items and one would rather take a bigger damage (or even die and walk back) than lose a well-enchanted, mendable item.
In PvP this would mean that your opponent gets your armor, which may or may not be desirable (e.g. maybe they'll sell you that item back instead of having to recreate it), depending on the situation.
And obviously this would be opt-in.
Edit: perhaps even detect the damage source and only do this for non-player entities.
from nobreak.
To be honest, I'm not sure I want to mess with the code for manipulating the inventory, as it seems to be incredibly "low-level", as in you have to manually send packets each time you click a slot.
Code example from Tweakeroo:
private static void swapItemToHand(PlayerEntity player, Hand hand, int slotNumber) {
if (slotNumber != -1 && player.currentScreenHandler == player.playerScreenHandler) {
MinecraftClient mc = MinecraftClient.getInstance();
ScreenHandler container = player.playerScreenHandler;
if (hand == Hand.MAIN_HAND) {
int currentHotbarSlot = player.getInventory().selectedSlot;
Slot slot = container.getSlot(slotNumber);
if (slot != null && isHotbarSlot(slot)) {
player.getInventory().selectedSlot = slotNumber - 36;
mc.getNetworkHandler().sendPacket(new UpdateSelectedSlotC2SPacket(player.getInventory().selectedSlot));
} else {
mc.interactionManager.clickSlot(container.syncId, slotNumber, currentHotbarSlot, SlotActionType.SWAP, mc.player);
}
} else if (hand == Hand.OFF_HAND) {
int currentHotbarSlot = player.getInventory().selectedSlot;
// Swap the requested slot to the current hotbar slot
mc.interactionManager.clickSlot(container.syncId, slotNumber, currentHotbarSlot, SlotActionType.SWAP, mc.player);
// Swap the requested item from the hotbar slot to the offhand
mc.interactionManager.clickSlot(container.syncId, 45, currentHotbarSlot, SlotActionType.SWAP, mc.player);
// Swap the original item back to the hotbar slot
mc.interactionManager.clickSlot(container.syncId, slotNumber, currentHotbarSlot, SlotActionType.SWAP, mc.player);
}
}
}
from nobreak.
I'll go ahead and publish a new release as soon as I implement a setting to toggle attacking your own pets, as well as one for attacking neutral until provoked mobs.
from nobreak.
..nevermind, it seems there's some sort of issue with the return value for using an item on a block and attacking entities, I'll won't release it for now as using items or attacking entities is literally impossible.
Overall status report: Mining blocks and the blacklist work correctly, but attacking entities and using items on blocks is utterly broken, and I have no idea why.
from nobreak.
There's now a new workflow that has the latest JAR with the testing features, I'll also make one for disabling the entity and use features so you can use that in the meantime until I can eventually fix this (as in multiple days, or weeks, etc.)
Edit: here is the new workflow with the specified features disabled.
from nobreak.
To be honest, I'm not sure I want to mess with the code for manipulating the inventory, as it seems to be incredibly "low-level", as in you have to manually send packets each time you click a slot.
But it would only take one shift-click in this mod? I can see Tweakaroo is doing 3 clicks here.
from nobreak.
To be honest, I'm not sure I want to mess with the code for manipulating the inventory, as it seems to be incredibly "low-level", as in you have to manually send packets each time you click a slot.
But it would only take one shift-click in this mod? I can see Tweakaroo is doing 3 clicks here.
Good point, I only focused on the individual complexity of a single line, so I'll just write a minor wrapper to make it less ugly.
from nobreak.
Related Issues (8)
- tool blacklist? HOT 4
- Default options are modified HOT 2
- Blacklist has confusing UX HOT 7
- Other items HOT 7
- Crash on 2.1.0 HOT 2
- Option for enchanted tools only HOT 5
- Configuration HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nobreak.