Skip to content

Commit

Permalink
Fix y in firestone item
Browse files Browse the repository at this point in the history
  • Loading branch information
Edivad99 committed Oct 15, 2023
1 parent e6b3020 commit a7e0334
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/main/java/mods/railcraft/world/item/FirestoneItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import java.util.List;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import mods.railcraft.Translations;
import mods.railcraft.world.entity.FirestoneItemEntity;
import net.minecraft.ChatFormatting;
Expand Down Expand Up @@ -86,7 +85,7 @@ public void inventoryTick(ItemStack stack, Level level, Entity entity, int slotI
public static boolean trySpawnFire(Level level, BlockPos pos, ItemStack stack, Entity entity) {
boolean spawnedFire = false;
for (int i = 0; i < stack.getCount(); i++) {
spawnedFire |= spawnFire(level, pos, entity);
spawnedFire |= spawnFire(level, pos);
}
if (spawnedFire && stack.isDamageableItem()
&& stack.getDamageValue() < stack.getMaxDamage() - 1) {
Expand All @@ -97,10 +96,10 @@ public static boolean trySpawnFire(Level level, BlockPos pos, ItemStack stack, E
return spawnedFire;
}

public static boolean spawnFire(Level level, BlockPos pos, @Nullable Entity entity) {
public static boolean spawnFire(Level level, BlockPos pos) {
var random = level.getRandom();
int x = pos.getX() - 5 + random.nextInt(12);
int y = pos.getY() - 5 + random.nextInt(12);
int y = pos.getY() + random.nextInt(12);
int z = pos.getZ() - 5 + random.nextInt(12);

y = Mth.clamp(y, level.getMinBuildHeight() + 2, level.getMaxBuildHeight() - 1);
Expand Down

0 comments on commit a7e0334

Please sign in to comment.