WIP: infusion

This commit is contained in:
Aleksey 2020-11-08 10:48:25 +03:00
parent a1593730f1
commit 163b2881ba
8 changed files with 38 additions and 16 deletions

View file

@ -12,7 +12,7 @@ import ru.betterend.blocks.basis.BlockPillar;
import ru.betterend.blocks.basis.BlockSlab; import ru.betterend.blocks.basis.BlockSlab;
import ru.betterend.blocks.basis.BlockStairs; import ru.betterend.blocks.basis.BlockStairs;
import ru.betterend.blocks.basis.BlockStoneButton; import ru.betterend.blocks.basis.BlockStoneButton;
import ru.betterend.blocks.basis.BlockStoneLantern; //import ru.betterend.blocks.basis.BlockStoneLantern;
import ru.betterend.blocks.basis.BlockStonePressurePlate; import ru.betterend.blocks.basis.BlockStonePressurePlate;
import ru.betterend.blocks.basis.BlockWall; import ru.betterend.blocks.basis.BlockWall;
import ru.betterend.recipe.CraftingRecipes; import ru.betterend.recipe.CraftingRecipes;
@ -33,7 +33,7 @@ public class StoneMaterial {
public final Block button; public final Block button;
public final Block pressure_plate; public final Block pressure_plate;
public final Block pedestal; public final Block pedestal;
public final Block lantern; //public final Block lantern;
public final Block bricks; public final Block bricks;
public final Block brick_stairs; public final Block brick_stairs;
@ -53,7 +53,7 @@ public class StoneMaterial {
button = EndBlocks.registerBlock(name + "_button", new BlockStoneButton(stone)); button = EndBlocks.registerBlock(name + "_button", new BlockStoneButton(stone));
pressure_plate = EndBlocks.registerBlock(name + "_plate", new BlockStonePressurePlate(stone)); pressure_plate = EndBlocks.registerBlock(name + "_plate", new BlockStonePressurePlate(stone));
pedestal = EndBlocks.registerBlock(name + "_pedestal", new EndPedestal(stone)); pedestal = EndBlocks.registerBlock(name + "_pedestal", new EndPedestal(stone));
lantern = EndBlocks.registerBlock(name + "_lantern", new BlockStoneLantern(stone)); //lantern = EndBlocks.registerBlock(name + "_lantern", new BlockStoneLantern(stone));
bricks = EndBlocks.registerBlock(name + "_bricks", new BlockBase(material)); bricks = EndBlocks.registerBlock(name + "_bricks", new BlockBase(material));
brick_stairs = EndBlocks.registerBlock(name + "_bricks_stairs", new BlockStairs(bricks)); brick_stairs = EndBlocks.registerBlock(name + "_bricks_stairs", new BlockStairs(bricks));
@ -76,7 +76,7 @@ public class StoneMaterial {
GridRecipe.make(name + "_button", button).setList("#").addMaterial('#', stone).setGroup("end_stone_buttons").build(); GridRecipe.make(name + "_button", button).setList("#").addMaterial('#', stone).setGroup("end_stone_buttons").build();
GridRecipe.make(name + "_pressure_plate", pressure_plate).setShape("##").addMaterial('#', stone).setGroup("end_stone_plates").build(); GridRecipe.make(name + "_pressure_plate", pressure_plate).setShape("##").addMaterial('#', stone).setGroup("end_stone_plates").build();
GridRecipe.make(name + "_lantern", lantern).setShape("S", "#", "S").addMaterial('#', EndItems.CRYSTAL_SHARDS).addMaterial('S', slab, brick_slab).setGroup("end_stone_lanterns").build(); //GridRecipe.make(name + "_lantern", lantern).setShape("S", "#", "S").addMaterial('#', EndItems.CRYSTAL_SHARDS).addMaterial('S', slab, brick_slab).setGroup("end_stone_lanterns").build();
CraftingRecipes.registerPedestal(name + "_pedestal", pedestal, slab, pillar); CraftingRecipes.registerPedestal(name + "_pedestal", pedestal, slab, pillar);

View file

@ -103,7 +103,7 @@ public class CraftingRecipes {
GridRecipe.make("shadow_berry_seeds", EndBlocks.SHADOW_BERRY).setList("#").setOutputCount(4).addMaterial('#', EndItems.SHADOW_BERRY_RAW).build(); GridRecipe.make("shadow_berry_seeds", EndBlocks.SHADOW_BERRY).setList("#").setOutputCount(4).addMaterial('#', EndItems.SHADOW_BERRY_RAW).build();
GridRecipe.make("purple_polypore_dye", Items.PURPLE_DYE).setList("#").addMaterial('#', EndBlocks.PURPLE_POLYPORE).build(); GridRecipe.make("purple_polypore_dye", Items.PURPLE_DYE).setList("#").addMaterial('#', EndBlocks.PURPLE_POLYPORE).build();
GridRecipe.make("end_stone_lantern", EndBlocks.LANTERN_END_STONE).setShape("S", "#", "S").addMaterial('#', EndItems.CRYSTAL_SHARDS).addMaterial('S', Blocks.END_STONE_BRICK_SLAB).setGroup("end_stone_lanterns").build(); //GridRecipe.make("end_stone_lantern", EndBlocks.LANTERN_END_STONE).setShape("S", "#", "S").addMaterial('#', EndItems.CRYSTAL_SHARDS).addMaterial('S', Blocks.END_STONE_BRICK_SLAB).setGroup("end_stone_lanterns").build();
} }
public static void registerPedestal(String name, Block pedestal, Block slab, Block pillar) { public static void registerPedestal(String name, Block pedestal, Block slab, Block pillar) {

View file

@ -217,16 +217,37 @@ public class InfusionRecipe implements Recipe<InfusionRitual> {
public InfusionRecipe fromTag(CompoundTag tag) { public InfusionRecipe fromTag(CompoundTag tag) {
Identifier id = new Identifier(tag.getString("id")); Identifier id = new Identifier(tag.getString("id"));
InfusionRecipe recipe = new InfusionRecipe(id); InfusionRecipe recipe = new InfusionRecipe(id);
CompoundSerializer<Ingredient> inputSerializer = this.toSerializer(recipe.input);
recipe.input = inputSerializer.fromTag(tag.getCompound("input"));
recipe.output = ItemStack.fromTag(tag.getCompound("output"));
recipe.time = tag.getInt("time");
CompoundTag catalysts = tag.getCompound("catalysts");
for(int i = 0; i < recipe.catalysts.length; i++) {
String key = Integer.toString(i);
CompoundSerializer<Ingredient> cataSerializer = this.toSerializer(recipe.catalysts[i]);
recipe.catalysts[i] = cataSerializer.fromTag(catalysts.getCompound(key));
}
return recipe; return recipe;
} }
public CompoundTag toTag(InfusionRecipe recipe, CompoundTag tag) { public CompoundTag toTag(InfusionRecipe recipe, CompoundTag tag) {
CompoundSerializer<?> inputSerializer = CompoundSerializer.class.cast(recipe.input); CompoundSerializer<?> inputSerializer = this.toSerializer(recipe.input);
tag.put("input", inputSerializer.toTag(new CompoundTag())); tag.put("input", inputSerializer.toTag(new CompoundTag()));
tag.put("output", recipe.output.toTag(new CompoundTag())); tag.put("output", recipe.output.toTag(new CompoundTag()));
tag.putInt("time", recipe.time);
CompoundTag catalysts = new CompoundTag();
for(int i = 0; i < recipe.catalysts.length; i++) {
String key = Integer.toString(i);
CompoundSerializer<?> cataSerializer = this.toSerializer(recipe.catalysts[i]);
catalysts.put(key, cataSerializer.toTag(new CompoundTag()));
}
tag.put("catalysts", catalysts);
return tag; return tag;
} }
@SuppressWarnings("unchecked")
private CompoundSerializer<Ingredient> toSerializer(Ingredient ingredient) {
return CompoundSerializer.class.cast(ingredient);
}
} }
} }

View file

@ -51,7 +51,7 @@ import ru.betterend.blocks.basis.BlockGlowingFur;
import ru.betterend.blocks.basis.BlockLeaves; import ru.betterend.blocks.basis.BlockLeaves;
import ru.betterend.blocks.basis.BlockOre; import ru.betterend.blocks.basis.BlockOre;
import ru.betterend.blocks.basis.BlockSimpleLeaves; import ru.betterend.blocks.basis.BlockSimpleLeaves;
import ru.betterend.blocks.basis.BlockStoneLantern; //import ru.betterend.blocks.basis.BlockStoneLantern;
import ru.betterend.blocks.basis.BlockVine; import ru.betterend.blocks.basis.BlockVine;
import ru.betterend.blocks.basis.BlockWallMushroom; import ru.betterend.blocks.basis.BlockWallMushroom;
import ru.betterend.blocks.basis.BlockWallPlant; import ru.betterend.blocks.basis.BlockWallPlant;
@ -157,7 +157,7 @@ public class EndBlocks {
public static final Block ENDER_BLOCK = registerBlock("ender_block", new EnderBlock()); public static final Block ENDER_BLOCK = registerBlock("ender_block", new EnderBlock());
public static final Block AURORA_CRYSTAL = registerBlock("aurora_crystal", new AuroraCrystalBlock()); public static final Block AURORA_CRYSTAL = registerBlock("aurora_crystal", new AuroraCrystalBlock());
public static final Block LANTERN_END_STONE = registerBlock("lantern_end_stone", new BlockStoneLantern(Blocks.END_STONE)); //public static final Block LANTERN_END_STONE = registerBlock("lantern_end_stone", new BlockStoneLantern(Blocks.END_STONE));
// Blocks With Entity // // Blocks With Entity //
public static final Block END_STONE_SMELTER = registerBlock("end_stone_smelter", new EndStoneSmelter()); public static final Block END_STONE_SMELTER = registerBlock("end_stone_smelter", new EndStoneSmelter());

View file

@ -15,7 +15,7 @@ import ru.betterend.BetterEnd;
import ru.betterend.entity.EntityDragonfly; import ru.betterend.entity.EntityDragonfly;
import ru.betterend.entity.EntityEndFish; import ru.betterend.entity.EntityEndFish;
import ru.betterend.entity.EntityEndSlime; import ru.betterend.entity.EntityEndSlime;
import ru.betterend.entity.EntityShadowWalker; //import ru.betterend.entity.EntityShadowWalker;
import ru.betterend.util.MHelper; import ru.betterend.util.MHelper;
import ru.betterend.util.SpawnHelper; import ru.betterend.util.SpawnHelper;
@ -23,12 +23,12 @@ public class EndEntities {
public static final EntityType<EntityDragonfly> DRAGONFLY = register("dragonfly", SpawnGroup.AMBIENT, 0.6F, 0.5F, EntityDragonfly::new, EntityDragonfly.createMobAttributes(), true, MHelper.color(32, 42, 176), MHelper.color(115, 225, 249)); public static final EntityType<EntityDragonfly> DRAGONFLY = register("dragonfly", SpawnGroup.AMBIENT, 0.6F, 0.5F, EntityDragonfly::new, EntityDragonfly.createMobAttributes(), true, MHelper.color(32, 42, 176), MHelper.color(115, 225, 249));
public static final EntityType<EntityEndSlime> END_SLIME = register("end_slime", SpawnGroup.MONSTER, 2F, 2F, EntityEndSlime::new, EntityEndSlime.createMobAttributes(), false, MHelper.color(28, 28, 28), MHelper.color(99, 11, 99)); public static final EntityType<EntityEndSlime> END_SLIME = register("end_slime", SpawnGroup.MONSTER, 2F, 2F, EntityEndSlime::new, EntityEndSlime.createMobAttributes(), false, MHelper.color(28, 28, 28), MHelper.color(99, 11, 99));
public static final EntityType<EntityEndFish> END_FISH = register("end_fish", SpawnGroup.WATER_AMBIENT, 0.5F, 0.5F, EntityEndFish::new, EntityEndFish.createMobAttributes(), true, MHelper.color(3, 50, 76), MHelper.color(120, 206, 255)); public static final EntityType<EntityEndFish> END_FISH = register("end_fish", SpawnGroup.WATER_AMBIENT, 0.5F, 0.5F, EntityEndFish::new, EntityEndFish.createMobAttributes(), true, MHelper.color(3, 50, 76), MHelper.color(120, 206, 255));
public static final EntityType<EntityShadowWalker> SHADOW_WALKER = register("shadow_walker", SpawnGroup.MONSTER, 0.6F, 1.95F, EntityShadowWalker::new, EntityShadowWalker.createMobAttributes(), true, MHelper.color(30, 30, 30), MHelper.color(5, 5, 5)); //public static final EntityType<EntityShadowWalker> SHADOW_WALKER = register("shadow_walker", SpawnGroup.MONSTER, 0.6F, 1.95F, EntityShadowWalker::new, EntityShadowWalker.createMobAttributes(), true, MHelper.color(30, 30, 30), MHelper.color(5, 5, 5));
public static void register() { public static void register() {
SpawnHelper.restrictionLand(END_SLIME, EntityEndSlime::canSpawn); SpawnHelper.restrictionLand(END_SLIME, EntityEndSlime::canSpawn);
SpawnHelper.restrictionWater(END_FISH, EntityEndFish::canSpawn); SpawnHelper.restrictionWater(END_FISH, EntityEndFish::canSpawn);
SpawnHelper.restrictionLand(SHADOW_WALKER, HostileEntity::canSpawnInDark); //SpawnHelper.restrictionLand(SHADOW_WALKER, HostileEntity::canSpawnInDark);
} }
protected static <T extends Entity> EntityType<T> register(String name, SpawnGroup group, float width, float height, EntityFactory<T> entity) { protected static <T extends Entity> EntityType<T> register(String name, SpawnGroup group, float width, float height, EntityFactory<T> entity) {

View file

@ -6,7 +6,7 @@ import net.minecraft.entity.EntityType;
import ru.betterend.entity.render.RendererEntityDragonfly; import ru.betterend.entity.render.RendererEntityDragonfly;
import ru.betterend.entity.render.RendererEntityEndFish; import ru.betterend.entity.render.RendererEntityEndFish;
import ru.betterend.entity.render.RendererEntityEndSlime; import ru.betterend.entity.render.RendererEntityEndSlime;
import ru.betterend.entity.render.RendererEntityShadowWalker; //import ru.betterend.entity.render.RendererEntityShadowWalker;
public class EndEntitiesRenders { public class EndEntitiesRenders {
@ -14,7 +14,7 @@ public class EndEntitiesRenders {
register(EndEntities.DRAGONFLY, RendererEntityDragonfly.class); register(EndEntities.DRAGONFLY, RendererEntityDragonfly.class);
register(EndEntities.END_SLIME, RendererEntityEndSlime.class); register(EndEntities.END_SLIME, RendererEntityEndSlime.class);
register(EndEntities.END_FISH, RendererEntityEndFish.class); register(EndEntities.END_FISH, RendererEntityEndFish.class);
register(EndEntities.SHADOW_WALKER, RendererEntityShadowWalker.class); //register(EndEntities.SHADOW_WALKER, RendererEntityShadowWalker.class);
} }
private static void register(EntityType<?> type, Class<? extends MobEntityRenderer<?, ?>> renderer) { private static void register(EntityType<?> type, Class<? extends MobEntityRenderer<?, ?>> renderer) {

View file

@ -32,7 +32,7 @@ public class BiomeShadowForest extends EndBiome {
.addFeature(EndFeatures.TAIL_MOSS) .addFeature(EndFeatures.TAIL_MOSS)
.addFeature(EndFeatures.TAIL_MOSS_WOOD) .addFeature(EndFeatures.TAIL_MOSS_WOOD)
.addStructureFeature(ConfiguredStructureFeatures.END_CITY) .addStructureFeature(ConfiguredStructureFeatures.END_CITY)
.addMobSpawn(EndEntities.SHADOW_WALKER, 80, 2, 4) //.addMobSpawn(EndEntities.SHADOW_WALKER, 80, 2, 4)
.addMobSpawn(EntityType.ENDERMAN, 40, 1, 4) .addMobSpawn(EntityType.ENDERMAN, 40, 1, 4)
.addMobSpawn(EntityType.PHANTOM, 1, 1, 2)); .addMobSpawn(EntityType.PHANTOM, 1, 1, 2));
} }

View file

@ -26,6 +26,7 @@
"BoneMealItemMixin", "BoneMealItemMixin",
"SlimeEntityMixin", "SlimeEntityMixin",
"BrewingAccessor", "BrewingAccessor",
"IngredientMixin",
"EntityMixin" "EntityMixin"
], ],
"injectors": { "injectors": {