Comments (4)
I should also mention that the code that is supposed to prevent this from happening in ItemBucket doesn't actually work because getMovingObjectPositionFromPlayer() always returns an EnumMovingObjectType.TILE. The code at the bottom pertaining to cows is never called. The actual code for milking cows is in EntityCow, and suffers from similar issues of onItemRightClick() being called with odd results at times depending on what is behind the cow when the right click happened.
from minecraftforge.
Sorry its been a while, but, can you double check this. Returning false from IEntityInteractHandler.onEntityInteract should prevent any further processing from happening.
from minecraftforge.
It can't prevent further processing because the processing continues from Minecraft.clickMouse() two levels above the IEntityInteractHandler call. Below is the relevant code.
This line handles the entity interaction and ultimately results in calling the handler:
this.playerController.interactWithEntity(this.thePlayer, this.objectMouseOver.entityHit);
But it has no return value. And item right clicks are sent at the bottom after the first IF-ELSE block from this line:
if (var10 != null && this.playerController.sendUseItem(this.thePlayer, this.theWorld, var10))
So no processing does not stop if you return false. The item right click is still sent regardless.
if (this.objectMouseOver == null)
{
if (par1 == 0 && this.playerController.isNotCreative())
{
this.leftClickCounter = 10;
}
}
else if (this.objectMouseOver.typeOfHit == EnumMovingObjectType.ENTITY)
{
if (par1 == 0)
{
this.playerController.attackEntity(this.thePlayer, this.objectMouseOver.entityHit);
}
if (par1 == 1)
{
this.playerController.interactWithEntity(this.thePlayer, this.objectMouseOver.entityHit);
}
}
else if (this.objectMouseOver.typeOfHit == EnumMovingObjectType.TILE)
{
int var4 = this.objectMouseOver.blockX;
int var5 = this.objectMouseOver.blockY;
int var6 = this.objectMouseOver.blockZ;
int var7 = this.objectMouseOver.sideHit;
if (par1 == 0)
{
this.playerController.clickBlock(var4, var5, var6, this.objectMouseOver.sideHit);
}
else
{
int var9 = var3 != null ? var3.stackSize : 0;
if (this.playerController.onPlayerRightClick(this.thePlayer, this.theWorld, var3, var4, var5, var6, var7))
{
var2 = false;
this.thePlayer.swingItem();
}
if (var3 == null)
{
return;
}
if (var3.stackSize == 0)
{
this.thePlayer.inventory.mainInventory[this.thePlayer.inventory.currentItem] = null;
}
else if (var3.stackSize != var9 || this.playerController.isInCreativeMode())
{
this.entityRenderer.itemRenderer.func_9449_b();
}
}
}
if (var2 && par1 == 1)
{
ItemStack var10 = this.thePlayer.inventory.getCurrentItem();
if (var10 != null && this.playerController.sendUseItem(this.thePlayer, this.theWorld, var10))
{
this.entityRenderer.itemRenderer.func_9450_c();
}
}
from minecraftforge.
From looking at the code, I'd say its fixed. I'll let you know if I still have issues in the future.
from minecraftforge.
Related Issues (20)
- Compatibility Issues of Forge with Docker in IPv6 Environment HOT 2
- [1.20.4] Forge crashes loading the singleplayer world list screen with no mods installed HOT 5
- How can I runClient, runData without internet HOT 1
- [1.20.1] Config key correcting from default to default HOT 2
- Crash when starting game HOT 1
- [1.20.4] DatapackBuiltinEntriesProvider from #9848 causes issues with forge registries HOT 2
- minecraft crashing HOT 1
- Issue with SleepFinishedTimeEvent in 1.19.2 HOT 5
- Game crash in Chinese path HOT 4
- My forge modpack won't load the worlds HOT 1
- World gen stucks at 100% HOT 1
- [1.20.4] ClasspathLocator is no longer disabled in production env, causing OptiFine to crash while installing in the classpath HOT 6
- Shears on trapwire drops string instead of deactivating it HOT 1
- Item method shouldCauseBlockBreakReset does not work when itemStack::hurt HOT 2
- "Saving World" is not rendered with Forge
- Some "Falling Blocks" are not rendered with the "Fabulous!" mode.
- `java.lang.IllegalStateException: Duplicate key` in github action build with `Task :reobfJar`
- [Bug] Minecraft version json file offer a wrong value of path HOT 1
- [1.20.1] `forge_data` Rendering Bugs
- java.lang.IllegalStateException: renderisystem called from wrong thread HOT 1
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 minecraftforge.