added renewableSponges mixins

This commit is contained in:
DeadlyMC committed 2019-06-05 15:52:17 +05:30
1 parent 78eafdcedd
commit 6008c8e4a5
3 files changed
+50 -1

No files matched your search

+1 -1
View File
@@ -113,7 +113,7 @@ public class CarpetSettings
"Counters are global and shared between players, 16 channels available",
"Items counted are destroyed, count up to one stack per tick per hopper")
.isACommand().boolAccelerate().defaultFalse(),
rule("renewableSponges", "experimental feature", "Guardians turn into Elder Guardian when struck by lightning").wip(),
rule("renewableSponges", "experimental feature", "Guardians turn into Elder Guardian when struck by lightning"),
rule("movableTileEntities", "experimental", "Pistons can push tile entities, like hoppers, chests etc.").boolAccelerate().wip(),
rule("desertShrubs", "feature", "Saplings turn into dead shrubs in hot climates and no water access when it attempts to grow into a tree").wip(),
rule("silverFishDropGravel", "experimental", "Silverfish drop a gravel item when breaking out of a block"),
@@ -0,0 +1,48 @@
package carpet.mixins;
import carpet.CarpetSettings;
import net.minecraft.entity.EntityData;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.LightningEntity;
import net.minecraft.entity.SpawnType;
import net.minecraft.entity.mob.ElderGuardianEntity;
import net.minecraft.entity.mob.GuardianEntity;
import net.minecraft.entity.mob.HostileEntity;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import org.spongepowered.asm.mixin.Mixin;
@Mixin(GuardianEntity.class)
public abstract class GuardianEntityMixin extends HostileEntity
{
protected GuardianEntityMixin(EntityType<? extends HostileEntity> entityType_1, World world_1)
{
super(entityType_1, world_1);
}
@Override
public void onStruckByLightning(LightningEntity lightning)
{
if (!this.world.isClient && !this.removed && CarpetSettings.getBool("renewableSponges"))
{
ElderGuardianEntity elderGuardian = new ElderGuardianEntity(EntityType.ELDER_GUARDIAN ,this.world);
elderGuardian.setPositionAndAngles(this.x, this.y, this.z, this.yaw, this.pitch);
elderGuardian.initialize(this.world ,this.world.getLocalDifficulty(new BlockPos(elderGuardian)), SpawnType.EVENT, (EntityData)null, (CompoundTag)null);
elderGuardian.setAiDisabled(this.isAiDisabled());
if (this.hasCustomName())
{
elderGuardian.setCustomName(this.getCustomName());
elderGuardian.setCustomNameVisible(this.isCustomNameVisible());
}
this.world.spawnEntity(elderGuardian);
this.remove();
}
else
{
super.onStruckByLightning(lightning);
}
}
}
+1
View File
@@ -52,6 +52,7 @@
"ServerPlayerInteractionManager_scarpetEventsMixin",
"EntityMixin",
"DirectionMixin",
"GuardianEntityMixin",
"ServerChunkManagerMixin",
"SpawnHelperMixin",