Actually fail CI if generation fails (#30)

* Actually fail unit tests if generation fails

* Do not fail fast

* Fix 1.8.9 spam

* Fix 1.8.9 generation

* Fix 1.8.9 generation

* Fix entity generation on 4 versions

* Fix projectile thrown package

* Disable 1.17 recipe generator
This commit is contained in:
Alex
2024-10-27 15:07:25 +01:00
committed by GitHub
parent 91251bcf06
commit b8e0215b2a
12 changed files with 173 additions and 143 deletions
@@ -65,6 +65,8 @@ public class BlockCollisionShapesDataGenerator implements IDataGenerator {
for (BlockState state : block.getStateManager().getBlockStates().reverse()) {
List<Box> boxes = new ArrayList<>();
try {
// Fix needed for StairsBlock because it requires the state of the block to be set
DGU.getWorld().setBlockState(BlockPos.ORIGIN, state);
block.appendCollisionBoxes(DGU.getWorld(), BlockPos.ORIGIN, state, ENTITY_BOX, boxes, null);
} catch (Exception e) {
e.printStackTrace();
@@ -120,6 +120,8 @@ public class BlocksDataGenerator implements IDataGenerator {
}
private static String boundingBox(Block block, BlockState state) {
// Fix needed for StairsBlock because it requires the state of the block to be set
DGU.getWorld().setBlockState(BlockPos.ORIGIN, state);
if (block.getCollisionBox(DGU.getWorld(), BlockPos.ORIGIN, state) == null) {
return "empty";
}
@@ -5,6 +5,7 @@ import com.google.gson.JsonObject;
import dev.u9g.minecraftdatagenerator.mixin.EntityTypeAccessor;
import dev.u9g.minecraftdatagenerator.util.DGU;
import dev.u9g.minecraftdatagenerator.util.Registries;
import net.minecraft.block.Blocks;
import net.minecraft.entity.*;
import net.minecraft.entity.mob.AmbientEntity;
import net.minecraft.entity.mob.HostileEntity;
@@ -14,6 +15,7 @@ import net.minecraft.entity.passive.AnimalEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.projectile.FishingBobberEntity;
import net.minecraft.entity.projectile.Projectile;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Identifier;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -31,6 +33,10 @@ public class EntitiesDataGenerator implements IDataGenerator {
entityDesc.addProperty("id", id);
entityDesc.addProperty("internalId", id);
entityDesc.addProperty("name", Objects.requireNonNull(registryKey).getPath());
if (entity instanceof ItemEntity itemEntity) {
// Same as 1.9.4
itemEntity.setItemStack(new ItemStack(Blocks.STONE));
}
String displayName = entity != null ? entity.getTranslationKey() : null;
if (displayName != null && !displayName.startsWith("entity.")) {
entityDesc.addProperty("displayName", displayName);