Inspired by 2020's April Fools' 20w14infinite Snapshot, this mod brings endless randomly generated dimensions into Minecraft.

remove redundant creeper mechanic

-39
-39
common/src/main/java/net/lerariemann/infinity/entity/custom/ChaosCreeper.java
··· 9 9 import net.minecraft.entity.data.TrackedData; 10 10 import net.minecraft.entity.data.TrackedDataHandlerRegistry; 11 11 import net.minecraft.entity.mob.CreeperEntity; 12 - import net.minecraft.entity.player.PlayerEntity; 13 - import net.minecraft.item.ItemStack; 14 - import net.minecraft.item.Items; 15 12 import net.minecraft.nbt.NbtCompound; 16 - import net.minecraft.particle.DustParticleEffect; 17 13 import net.minecraft.registry.Registry; 18 - import net.minecraft.registry.RegistryKey; 19 14 import net.minecraft.registry.RegistryKeys; 20 15 import net.minecraft.registry.entry.RegistryEntry; 21 16 import net.minecraft.server.MinecraftServer; 22 17 import net.minecraft.server.world.ServerWorld; 23 - import net.minecraft.sound.SoundEvents; 24 18 import net.minecraft.text.Text; 25 - import net.minecraft.util.ActionResult; 26 - import net.minecraft.util.Hand; 27 19 import net.minecraft.util.Identifier; 28 20 import net.minecraft.util.math.BlockBox; 29 21 import net.minecraft.util.math.ChunkSectionPos; ··· 36 28 import net.minecraft.world.chunk.Chunk; 37 29 import net.minecraft.world.chunk.ChunkStatus; 38 30 import org.jetbrains.annotations.Nullable; 39 - import org.joml.Vector3f; 40 31 41 32 import java.util.ArrayList; 42 - import java.util.Optional; 43 33 44 34 public class ChaosCreeper extends CreeperEntity implements TintableEntity { 45 35 public static TrackedData<Integer> color = DataTracker.registerData(ChaosCreeper.class, TrackedDataHandlerRegistry.INTEGER); ··· 121 111 this.setRange(nbt.getFloat("range")); 122 112 this.setColor(nbt.getInt("color")); 123 113 this.setBiome(nbt.getString("biome")); 124 - } 125 - 126 - protected ActionResult interactMob(PlayerEntity player, Hand hand) { 127 - ItemStack itemStack = player.getStackInHand(hand); 128 - if (itemStack.isOf(Items.WATER_BUCKET)) { 129 - if (!this.getWorld().isClient) { 130 - this.ignite_backwards(); 131 - if (!player.getAbilities().creativeMode) player.setStackInHand(hand, new ItemStack(Items.BUCKET, itemStack.getCount())); 132 - } 133 - return ActionResult.success(this.getWorld().isClient); 134 - } 135 - return super.interactMob(player, hand); 136 - } 137 - 138 - public void ignite_backwards() { 139 - World w = this.getWorld(); 140 - if (!w.isClient()) { 141 - RegistryEntry<Biome> entry = this.getWorld().getBiomeAccess().getBiome(this.getBlockPos()); 142 - Optional<RegistryKey<Biome>> s = entry.getKey(); 143 - s.ifPresent(biomeRegistryKey -> this.setBiome(biomeRegistryKey.getValue().toString())); 144 - int cl = entry.value().getFoliageColor(); 145 - this.setColor(cl); 146 - float b = (cl%256)/256.0f; 147 - float g = ((cl >> 8)%256)/256.0f; 148 - float r = ((cl >> 16)%256)/256.0f; 149 - ((ServerWorld)w).spawnParticles(new DustParticleEffect(new Vector3f(r, g, b), 1.0f), this.getX(), 150 - this.getBodyY(0.5), this.getZ(), 30, 0.5, 0.5, 0.5, 0.2); 151 - this.playSound(SoundEvents.AMBIENT_UNDERWATER_EXIT, 1.0f, 0.5f); 152 - } 153 114 } 154 115 155 116 public void blow_up() {