Skip to content

Commit

Permalink
fix Conflict
Browse files Browse the repository at this point in the history
- fix carpet conflict
  • Loading branch information
MORIMORI0317 committed Jul 3, 2022
1 parent 7c90a20 commit 48f9370
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import net.minecraft.world.Difficulty;
import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.MobSpawnType;
import net.minecraft.world.entity.boss.wither.WitherBoss;
import net.minecraft.world.entity.monster.Monster;
Expand All @@ -22,9 +23,7 @@
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.*;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;

Expand Down Expand Up @@ -55,16 +54,34 @@ public abstract class WitherBossMixin extends Monster implements BEWitherBoss {
@Shadow
@Final
private ServerBossEvent bossEvent;


@Shadow
public abstract void performRangedAttack(int i, double d, double e, double f, boolean bl);

private static final EntityDataAccessor<Boolean> DATA_ID_FORCED_POWER = SynchedEntityData.defineId(WitherBoss.class, EntityDataSerializers.BOOLEAN);
private static final EntityDataAccessor<Boolean> DATA_ID_DEATH = SynchedEntityData.defineId(WitherBoss.class, EntityDataSerializers.BOOLEAN);

protected WitherBossMixin(EntityType<? extends Monster> entityType, Level level) {
super(entityType, level);
}

@Redirect(method = "performRangedAttack(ILnet/minecraft/world/entity/LivingEntity;)V", at = @At(value = "INVOKE", target = "Ljava/util/Random;nextFloat()F", remap = false, ordinal = 0))
private float injected(Random instance) {
return 0f;
/* @Redirect(method = "performRangedAttack(ILnet/minecraft/world/entity/LivingEntity;)V", at = @At(value = "INVOKE", target = "Ljava/util/Random;nextFloat()F", remap = false, ordinal = 0))
private float injected(Random instance) {
return 0f;
}
*/
/*@ModifyConstant(method = "performRangedAttack(ILnet/minecraft/world/entity/LivingEntity;)V", constant = @Constant(floatValue = 0.001f))
private float performRangedAttack(float value) {
return 1f;
}*/

@Inject(method = "performRangedAttack(ILnet/minecraft/world/entity/LivingEntity;)V", at = @At("HEAD"), cancellable = true)
private void performRangedAttack(int i, LivingEntity livingEntity, CallbackInfo ci) {
if (i == 0) {
this.performRangedAttack(i, livingEntity.getX(), livingEntity.getY() + (double) livingEntity.getEyeHeight() * 0.5, livingEntity.getZ(), true);
ci.cancel();
}
}

@Inject(method = "isPowered", at = @At("RETURN"), cancellable = true)
Expand Down
1 change: 1 addition & 0 deletions common/src/main/resources/bestylewither-common.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"required": true,
"package": "net.morimori0317.bestylewither.mixin",
"compatibilityLevel": "JAVA_17",
"minVersion": "0.8",
"client": [
"client.EnergySwirlLayerMixin",
"client.LivingEntityRendererMixin",
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ enabled_platforms=fabric,forge

archives_base_name=bestylewither
mod_display_name=BEStyleWither
mod_version=1.1
mod_version=1.2
maven_group=net.morimori0317

fabric_loader_version=0.14.7
Expand Down

0 comments on commit 48f9370

Please sign in to comment.