use of mod.azure.doom.entity.projectiles.MeatHookEntity in project MCDoom by AzureDoom.
the class ClientPlayNetworkHandlerMixin method onEntitySpawn.
@Inject(method = "onEntitySpawn", at = @At("TAIL"))
private void onEntitySpawn(EntitySpawnS2CPacket packet, CallbackInfo callbackInfo) {
EntityType<?> type = packet.getEntityTypeId();
double x = packet.getX();
double y = packet.getY();
double z = packet.getZ();
PersistentProjectileEntity entity = null;
if (type == ProjectilesEntityRegister.MEATHOOOK_ENTITY)
entity = new MeatHookEntity(world, x, y, z);
if (entity != null) {
Entity owner = world.getEntityById(packet.getEntityData());
if (owner != null)
entity.setOwner(owner);
int id = packet.getId();
entity.updateTrackedPosition(x, y, z);
entity.refreshPositionAfterTeleport(x, y, z);
entity.setPitch((float) (packet.getPitch() * 360) / 256f);
entity.setYaw((float) (packet.getYaw() * 360) / 256f);
entity.setId(id);
entity.setUuid(packet.getUuid());
world.addEntity(id, entity);
}
}
use of mod.azure.doom.entity.projectiles.MeatHookEntity in project MCDoom by AzureDoom.
the class SuperShotgun method use.
@Override
public TypedActionResult<ItemStack> use(World world, PlayerEntity user, Hand hand) {
ItemStack stack = user.getOffHandStack();
if (stack.getDamage() < (stack.getMaxDamage() - 2)) {
if (!world.isClient && stack.getItem() instanceof SuperShotgun) {
if (!((PlayerProperties) user).hasMeatHook()) {
MeatHookEntity hookshot = new MeatHookEntity(world, user);
hookshot.setProperties(stack, DoomMod.config.weapons.max_meathook_distance, 10, user.getPitch(), user.getYaw(), 0f, 1.5f);
hookshot.getDataTracker().set(MeatHookEntity.FORCED_YAW, user.getYaw());
world.spawnEntity(hookshot);
}
((PlayerProperties) user).setHasMeatHook(!((PlayerProperties) user).hasMeatHook());
}
}
return super.use(world, user, hand);
}
Aggregations