Gelatine, jelly, recipes

This commit is contained in:
paulevsGitch 2020-12-07 12:42:32 +03:00
parent 02e99b8cc4
commit eca14bce9b
14 changed files with 58 additions and 7 deletions

View file

@ -8,14 +8,17 @@ import net.minecraft.entity.EntityData;
import net.minecraft.entity.EntityDimensions; import net.minecraft.entity.EntityDimensions;
import net.minecraft.entity.EntityPose; import net.minecraft.entity.EntityPose;
import net.minecraft.entity.EntityType; import net.minecraft.entity.EntityType;
import net.minecraft.entity.ItemEntity;
import net.minecraft.entity.LivingEntity; import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.SpawnReason; import net.minecraft.entity.SpawnReason;
import net.minecraft.entity.attribute.DefaultAttributeContainer; import net.minecraft.entity.attribute.DefaultAttributeContainer;
import net.minecraft.entity.attribute.EntityAttributes; import net.minecraft.entity.attribute.EntityAttributes;
import net.minecraft.entity.damage.DamageSource;
import net.minecraft.entity.data.DataTracker; import net.minecraft.entity.data.DataTracker;
import net.minecraft.entity.data.TrackedData; import net.minecraft.entity.data.TrackedData;
import net.minecraft.entity.data.TrackedDataHandlerRegistry; import net.minecraft.entity.data.TrackedDataHandlerRegistry;
import net.minecraft.entity.mob.WaterCreatureEntity; import net.minecraft.entity.mob.WaterCreatureEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Box; import net.minecraft.util.math.Box;
@ -23,6 +26,7 @@ import net.minecraft.world.LocalDifficulty;
import net.minecraft.world.ServerWorldAccess; import net.minecraft.world.ServerWorldAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
import ru.betterend.registry.EndBiomes; import ru.betterend.registry.EndBiomes;
import ru.betterend.registry.EndItems;
import ru.betterend.util.MHelper; import ru.betterend.util.MHelper;
public class EntityCubozoa extends WaterCreatureEntity { public class EntityCubozoa extends WaterCreatureEntity {
@ -122,9 +126,9 @@ public class EntityCubozoa extends WaterCreatureEntity {
} }
moveTicks = 0; moveTicks = 0;
timer = MHelper.randRange(20, 40, random); timer = MHelper.randRange(20, 40, random);
this.yaw = (float) Math.atan2(moveX, moveZ); this.yaw = MHelper.radiandToDegrees((float) Math.atan2(moveX, moveZ)) - 90;
this.bodyYaw = this.yaw; this.bodyYaw = this.yaw;
this.pitch = (float) Math.asin(-moveY); this.pitch = MHelper.radiandToDegrees((float) Math.asin(-moveY));
} }
moveX *= 0.98; moveX *= 0.98;
moveY *= 0.98; moveY *= 0.98;
@ -132,4 +136,13 @@ public class EntityCubozoa extends WaterCreatureEntity {
this.setVelocity(moveX, moveY, moveZ); this.setVelocity(moveX, moveY, moveZ);
moveTicks ++; moveTicks ++;
} }
@Override
protected void dropLoot(DamageSource source, boolean causedByPlayer) {
int count = random.nextInt(3);
if (count > 0) {
ItemEntity drop = new ItemEntity(world, getX(), getY(), getZ(), new ItemStack(EndItems.GELATINE, count));
this.world.spawnEntity(drop);
}
}
} }

View file

@ -3,7 +3,10 @@ package ru.betterend.recipe;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.Blocks; import net.minecraft.block.Blocks;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items; import net.minecraft.item.Items;
import net.minecraft.potion.PotionUtil;
import net.minecraft.potion.Potions;
import ru.betterend.recipe.builders.GridRecipe; import ru.betterend.recipe.builders.GridRecipe;
import ru.betterend.registry.EndBlocks; import ru.betterend.registry.EndBlocks;
import ru.betterend.registry.EndItems; import ru.betterend.registry.EndItems;
@ -119,6 +122,20 @@ public class CraftingRecipes {
GridRecipe.make("tail_moss_dye", Items.GRAY_DYE).setList("#").addMaterial('#', EndBlocks.TAIL_MOSS).build(); GridRecipe.make("tail_moss_dye", Items.GRAY_DYE).setList("#").addMaterial('#', EndBlocks.TAIL_MOSS).build();
GridRecipe.make("petal_block", EndBlocks.HYDRALUX_PETAL_BLOCK).setShape("##", "##").addMaterial('#', EndItems.HYDRALUX_PETAL).build(); GridRecipe.make("petal_block", EndBlocks.HYDRALUX_PETAL_BLOCK).setShape("##", "##").addMaterial('#', EndItems.HYDRALUX_PETAL).build();
GridRecipe.make("petal_white_dye", Items.WHITE_DYE).setList("#").addMaterial('#', EndItems.HYDRALUX_PETAL).build(); GridRecipe.make("petal_white_dye", Items.WHITE_DYE).setList("#").addMaterial('#', EndItems.HYDRALUX_PETAL).build();
GridRecipe.make("sweet_berry_jelly", EndItems.SWEET_BERRY_JELLY)
.setList("JWSB")
.addMaterial('J', EndItems.GELATINE)
.addMaterial('W', PotionUtil.setPotion(new ItemStack(Items.POTION), Potions.WATER))
.addMaterial('S', Items.SUGAR).addMaterial('B', Items.SWEET_BERRIES)
.build();
GridRecipe.make("shadow_berry_jelly", EndItems.SHADOW_BERRY_JELLY)
.setList("JWSB").addMaterial('J', EndItems.GELATINE)
.addMaterial('W', PotionUtil.setPotion(new ItemStack(Items.POTION), Potions.WATER))
.addMaterial('S', Items.SUGAR)
.addMaterial('B', EndItems.SHADOW_BERRY_COOKED)
.build();
} }
private static void registerLantern(String name, Block lantern, Block slab) { private static void registerLantern(String name, Block lantern, Block slab) {

View file

@ -1,5 +1,6 @@
package ru.betterend.recipe.builders; package ru.betterend.recipe.builders;
import java.util.Arrays;
import java.util.Map; import java.util.Map;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
@ -71,6 +72,10 @@ public class GridRecipe {
return addMaterial(key, Ingredient.fromTag(value)); return addMaterial(key, Ingredient.fromTag(value));
} }
public GridRecipe addMaterial(char key, ItemStack... value) {
return addMaterial(key, Ingredient.ofStacks(Arrays.stream(value)));
}
public GridRecipe addMaterial(char key, ItemConvertible... values) { public GridRecipe addMaterial(char key, ItemConvertible... values) {
for (ItemConvertible item: values) { for (ItemConvertible item: values) {
exist &= RecipeHelper.exists(item); exist &= RecipeHelper.exists(item);

View file

@ -12,10 +12,10 @@ import net.minecraft.entity.attribute.DefaultAttributeContainer.Builder;
import net.minecraft.entity.mob.HostileEntity; import net.minecraft.entity.mob.HostileEntity;
import net.minecraft.util.registry.Registry; import net.minecraft.util.registry.Registry;
import ru.betterend.BetterEnd; import ru.betterend.BetterEnd;
import ru.betterend.entity.EntityCubozoa;
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.EntityCubozoa;
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;

View file

@ -6,10 +6,10 @@ import net.fabricmc.fabric.api.client.rendereregistry.v1.EntityRendererRegistry;
import net.minecraft.client.render.entity.EntityRenderDispatcher; import net.minecraft.client.render.entity.EntityRenderDispatcher;
import net.minecraft.client.render.entity.MobEntityRenderer; import net.minecraft.client.render.entity.MobEntityRenderer;
import net.minecraft.entity.EntityType; import net.minecraft.entity.EntityType;
import ru.betterend.entity.render.RendererEntityCubozoa;
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.RendererEntityCubozoa;
import ru.betterend.entity.render.RendererEntityShadowWalker; import ru.betterend.entity.render.RendererEntityShadowWalker;
public class EndEntitiesRenders { public class EndEntitiesRenders {

View file

@ -65,6 +65,7 @@ public class EndItems {
public final static Item GLOWING_BULB = registerItem("glowing_bulb"); public final static Item GLOWING_BULB = registerItem("glowing_bulb");
public final static Item CRYSTALLINE_SULPHUR = registerItem("crystalline_sulphur"); public final static Item CRYSTALLINE_SULPHUR = registerItem("crystalline_sulphur");
public final static Item HYDRALUX_PETAL = registerItem("hydralux_petal"); public final static Item HYDRALUX_PETAL = registerItem("hydralux_petal");
public final static Item GELATINE = registerItem("gelatine");
// Armor // // Armor //
public static final Item TERMINITE_HELMET = registerItem("terminite_helmet", new ArmorItem(EndArmorMaterial.TERMINITE, EquipmentSlot.HEAD, makeItemSettings())); public static final Item TERMINITE_HELMET = registerItem("terminite_helmet", new ArmorItem(EndArmorMaterial.TERMINITE, EquipmentSlot.HEAD, makeItemSettings()));
@ -104,6 +105,8 @@ public class EndItems {
public final static Item END_FISH_RAW = registerFood("end_fish_raw", FoodComponents.SALMON); public final static Item END_FISH_RAW = registerFood("end_fish_raw", FoodComponents.SALMON);
public final static Item END_FISH_COOKED = registerFood("end_fish_cooked", FoodComponents.COOKED_SALMON); public final static Item END_FISH_COOKED = registerFood("end_fish_cooked", FoodComponents.COOKED_SALMON);
public final static Item BUCKET_END_FISH = registerItem("bucket_end_fish", new FishBucketItem(EndEntities.END_FISH, Fluids.WATER, makeItemSettings().maxCount(1))); public final static Item BUCKET_END_FISH = registerItem("bucket_end_fish", new FishBucketItem(EndEntities.END_FISH, Fluids.WATER, makeItemSettings().maxCount(1)));
public final static Item SWEET_BERRY_JELLY = registerFood("sweet_berry_jelly", 3, 0.75F);
public final static Item SHADOW_BERRY_JELLY = registerFood("shadow_berry_jelly", 4, 0.75F);
// Other // // Other //
public static final Item ETERNAL_CRYSTAL = registerItem("eternal_crystal", new EternalCrystal()); public static final Item ETERNAL_CRYSTAL = registerItem("eternal_crystal", new EternalCrystal());
@ -177,7 +180,7 @@ public class EndItems {
} }
public static Item registerFood(String name, FoodComponent foodComponent) { public static Item registerFood(String name, FoodComponent foodComponent) {
return registerItem(name, new Item(makeItemSettings().food(foodComponent))); return registerItem(name, new PatternedItem(makeItemSettings().food(foodComponent)));
} }
public static Settings makeItemSettings() { public static Settings makeItemSettings() {

View file

@ -6,6 +6,7 @@ public class MHelper {
public static final float PI2 = (float) (Math.PI * 2); public static final float PI2 = (float) (Math.PI * 2);
private static final int ALPHA = 255 << 24; private static final int ALPHA = 255 << 24;
public static final Random RANDOM = new Random(); public static final Random RANDOM = new Random();
private static final float RAD_TO_DEG = 57.295779513082320876798154814105F;
public static int color(int r, int g, int b) { public static int color(int r, int g, int b) {
return ALPHA | (r << 16) | (g << 8) | b; return ALPHA | (r << 16) | (g << 8) | b;
@ -242,4 +243,8 @@ public class MHelper {
return values; return values;
} }
public static final float radiandToDegrees(float value) {
return value * RAD_TO_DEG;
}
} }

View file

@ -424,5 +424,9 @@
"block.betterend.charnia_red": "Red Charnia", "block.betterend.charnia_red": "Red Charnia",
"entity.betterend.cubozoa": "Cubozoa", "entity.betterend.cubozoa": "Cubozoa",
"item.betterend.spawn_egg_cubozoa": "Cubozoa Spawn Egg" "item.betterend.spawn_egg_cubozoa": "Cubozoa Spawn Egg",
"item.betterend.gelatine": "Gelatine",
"item.betterend.sweet_berry_jelly": "Sweet Berry Jelly",
"item.betterend.shadow_berry_jelly": "Shadow Berry Jelly"
} }

View file

@ -426,5 +426,9 @@
"block.betterend.charnia_red": "Красная чарния", "block.betterend.charnia_red": "Красная чарния",
"entity.betterend.cubozoa": "Кубомедуза", "entity.betterend.cubozoa": "Кубомедуза",
"item.betterend.spawn_egg_cubozoa": "Яйцо призыва кубомедузы" "item.betterend.spawn_egg_cubozoa": "Яйцо призыва кубомедузы",
"item.betterend.gelatine": "Желатин",
"item.betterend.sweet_berry_jelly": "Желе из сладких ягод",
"item.betterend.shadow_berry_jelly": "Желе из теневой ягоды"
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

Before After
Before After

Binary file not shown.

After

Width:  |  Height:  |  Size: 343 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 349 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 365 B