Merge pull request #27 from DeadlyMC/renewableSponges

Completed renewableSponges port
This commit is contained in:
gnembon authored and GitHub committed 2019-06-06 08:08:24 -03:00
commit 2d7e0cbb3d
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", "Counters are global and shared between players, 16 channels available",
"Items counted are destroyed, count up to one stack per tick per hopper") "Items counted are destroyed, count up to one stack per tick per hopper")
.isACommand().boolAccelerate().defaultFalse(), .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(), rule("movableTileEntities", "experimental", "Pistons can push tile entities, like hoppers, chests etc.").boolAccelerate(),
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("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"), 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.CONVERSION, (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", "ServerPlayerInteractionManager_scarpetEventsMixin",
"EntityMixin", "EntityMixin",
"DirectionMixin", "DirectionMixin",
"GuardianEntityMixin",
"ServerChunkManagerMixin", "ServerChunkManagerMixin",
"SpawnHelperMixin", "SpawnHelperMixin",