fake players use items properlier
This commit is contained in:
1 parent
6d3376ca7a
commit
368e76fbd7
4 files changed
+38
No files matched your search
@@ -247,6 +247,12 @@ public class EntityPlayerActionPack
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
ItemStack handItem = player.getStackInHand(hand);
|
||||||
|
ActionResult result =player.interactionManager.interactItem(player, player.getServerWorld(), handItem, hand);
|
||||||
|
if (result == ActionResult.SUCCESS)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,29 @@
|
|||||||
|
package carpet.mixins;
|
||||||
|
|
||||||
|
import carpet.patches.EntityPlayerMPFake;
|
||||||
|
import net.minecraft.entity.EntityType;
|
||||||
|
import net.minecraft.entity.thrown.ThrownEnderpearlEntity;
|
||||||
|
import net.minecraft.entity.thrown.ThrownItemEntity;
|
||||||
|
import net.minecraft.network.ClientConnection;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||||
|
|
||||||
|
@Mixin(ThrownEnderpearlEntity.class)
|
||||||
|
public abstract class ThrownEnderpearlEntity_fakePlayersMixin extends ThrownItemEntity
|
||||||
|
{
|
||||||
|
public ThrownEnderpearlEntity_fakePlayersMixin(EntityType<? extends ThrownItemEntity> entityType_1, World world_1)
|
||||||
|
{
|
||||||
|
super(entityType_1, world_1);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Redirect(method = "onCollision", at = @At(
|
||||||
|
value = "INVOKE",
|
||||||
|
target = "Lnet/minecraft/network/ClientConnection;isOpen()Z"
|
||||||
|
))
|
||||||
|
private boolean isConnectionGood(ClientConnection clientConnection)
|
||||||
|
{
|
||||||
|
return clientConnection.isOpen() || getOwner() instanceof EntityPlayerMPFake;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -6,6 +6,7 @@ import net.minecraft.client.network.packet.EntityPositionS2CPacket;
|
|||||||
import net.minecraft.client.network.packet.EntitySetHeadYawS2CPacket;
|
import net.minecraft.client.network.packet.EntitySetHeadYawS2CPacket;
|
||||||
import net.minecraft.client.network.packet.PlayerListS2CPacket;
|
import net.minecraft.client.network.packet.PlayerListS2CPacket;
|
||||||
import net.minecraft.entity.damage.DamageSource;
|
import net.minecraft.entity.damage.DamageSource;
|
||||||
|
import net.minecraft.entity.player.HungerManager;
|
||||||
import net.minecraft.network.NetworkSide;
|
import net.minecraft.network.NetworkSide;
|
||||||
import net.minecraft.text.TranslatableText;
|
import net.minecraft.text.TranslatableText;
|
||||||
import net.minecraft.server.MinecraftServer;
|
import net.minecraft.server.MinecraftServer;
|
||||||
@@ -117,6 +118,7 @@ public class EntityPlayerMPFake extends ServerPlayerEntity
|
|||||||
{
|
{
|
||||||
super.onDeath(cause);
|
super.onDeath(cause);
|
||||||
setHealth(20);
|
setHealth(20);
|
||||||
|
this.hungerManager = new HungerManager();
|
||||||
kill();
|
kill();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -31,6 +31,7 @@
|
|||||||
"VillagerEntity_aiMixin",
|
"VillagerEntity_aiMixin",
|
||||||
|
|
||||||
"ServerWorld_fakePlayersMixin",
|
"ServerWorld_fakePlayersMixin",
|
||||||
|
"ThrownEnderpearlEntity_fakePlayersMixin",
|
||||||
|
|
||||||
"ServerPlayNetworkHandler_coreMixin",
|
"ServerPlayNetworkHandler_coreMixin",
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user