tangled
alpha
login
or
join now
codexarchonic.nekoweb.org
/
ProjectInfinity
0
fork
atom
Inspired by 2020's April Fools' 20w14infinite Snapshot, this mod brings endless randomly generated dimensions into Minecraft.
0
fork
atom
overview
issues
6
pulls
pipelines
remove redundant creeper mechanic
Lera Riemann
1 year ago
706ebb1b
b60b4f08
-39
1 changed file
expand all
collapse all
unified
split
common
src
main
java
net
lerariemann
infinity
entity
custom
ChaosCreeper.java
-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
12
-
import net.minecraft.entity.player.PlayerEntity;
13
13
-
import net.minecraft.item.ItemStack;
14
14
-
import net.minecraft.item.Items;
15
12
import net.minecraft.nbt.NbtCompound;
16
16
-
import net.minecraft.particle.DustParticleEffect;
17
13
import net.minecraft.registry.Registry;
18
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
23
-
import net.minecraft.sound.SoundEvents;
24
18
import net.minecraft.text.Text;
25
25
-
import net.minecraft.util.ActionResult;
26
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
39
-
import org.joml.Vector3f;
40
31
41
32
import java.util.ArrayList;
42
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
124
-
}
125
125
-
126
126
-
protected ActionResult interactMob(PlayerEntity player, Hand hand) {
127
127
-
ItemStack itemStack = player.getStackInHand(hand);
128
128
-
if (itemStack.isOf(Items.WATER_BUCKET)) {
129
129
-
if (!this.getWorld().isClient) {
130
130
-
this.ignite_backwards();
131
131
-
if (!player.getAbilities().creativeMode) player.setStackInHand(hand, new ItemStack(Items.BUCKET, itemStack.getCount()));
132
132
-
}
133
133
-
return ActionResult.success(this.getWorld().isClient);
134
134
-
}
135
135
-
return super.interactMob(player, hand);
136
136
-
}
137
137
-
138
138
-
public void ignite_backwards() {
139
139
-
World w = this.getWorld();
140
140
-
if (!w.isClient()) {
141
141
-
RegistryEntry<Biome> entry = this.getWorld().getBiomeAccess().getBiome(this.getBlockPos());
142
142
-
Optional<RegistryKey<Biome>> s = entry.getKey();
143
143
-
s.ifPresent(biomeRegistryKey -> this.setBiome(biomeRegistryKey.getValue().toString()));
144
144
-
int cl = entry.value().getFoliageColor();
145
145
-
this.setColor(cl);
146
146
-
float b = (cl%256)/256.0f;
147
147
-
float g = ((cl >> 8)%256)/256.0f;
148
148
-
float r = ((cl >> 16)%256)/256.0f;
149
149
-
((ServerWorld)w).spawnParticles(new DustParticleEffect(new Vector3f(r, g, b), 1.0f), this.getX(),
150
150
-
this.getBodyY(0.5), this.getZ(), 30, 0.5, 0.5, 0.5, 0.2);
151
151
-
this.playSound(SoundEvents.AMBIENT_UNDERWATER_EXIT, 1.0f, 0.5f);
152
152
-
}
153
114
}
154
115
155
116
public void blow_up() {