Merge remote-tracking branch 'origin/master'

This commit is contained in:
paulevsGitch 2020-11-29 23:36:06 +03:00
commit a869cc3f9b
23 changed files with 298 additions and 17 deletions

View file

@ -9,6 +9,7 @@ import ru.betterend.client.render.ERenderLayer;
import ru.betterend.interfaces.IRenderTypeable;
import ru.betterend.registry.EndBlockEntityRenders;
import ru.betterend.registry.EndEntitiesRenders;
import ru.betterend.registry.EndModelProviders;
import ru.betterend.registry.EndParticles;
import ru.betterend.registry.EndScreens;
import ru.betterend.util.TranslationHelper;
@ -21,6 +22,7 @@ public class BetterEndClient implements ClientModInitializer {
EndScreens.register();
EndParticles.register();
EndEntitiesRenders.register();
EndModelProviders.register();
if (BetterEnd.isDevEnvironment()) {
TranslationHelper.printMissingNames();

View file

@ -18,6 +18,9 @@ public enum EndArmorMaterial implements ArmorMaterial {
}),
AETERNIUM("aeternium", 40, new int[] { 4, 7, 9, 4 }, 18, SoundEvents.ITEM_ARMOR_EQUIP_NETHERITE, 3.5F, 0.2F, () -> {
return Ingredient.ofItems(EndItems.AETERNIUM_INGOT);
}),
CRYSTALITE("crystalite", 30, new int[] { 3, 6, 8, 3 }, 24, SoundEvents.ITEM_ARMOR_EQUIP_DIAMOND, 1.2F, 0.1F, () -> {
return Ingredient.ofItems(EndItems.TERMINITE_INGOT);
});
private static final int[] BASE_DURABILITY = new int[] { 13, 15, 16, 11 };

View file

@ -1,17 +0,0 @@
package ru.betterend.item.model;
import net.minecraft.client.model.ModelPart;
import net.minecraft.client.render.entity.model.BipedEntityModel;
import net.minecraft.entity.LivingEntity;
public class CrystaliteArmorModel extends BipedEntityModel<LivingEntity> {
public ModelPart helmet;
public ModelPart chestplate;
public ModelPart leggings;
public ModelPart boots;
public CrystaliteArmorModel() {
super(1.0F);
}
}

View file

@ -0,0 +1,81 @@
package ru.betterend.item.model;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import com.google.common.collect.Lists;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.fabricmc.fabric.api.client.rendering.v1.ArmorRenderingRegistry.ModelProvider;
import net.fabricmc.fabric.api.client.rendering.v1.ArmorRenderingRegistry.TextureProvider;
import net.minecraft.client.network.AbstractClientPlayerEntity;
import net.minecraft.client.render.entity.model.BipedEntityModel;
import net.minecraft.entity.EquipmentSlot;
import net.minecraft.entity.LivingEntity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Identifier;
import ru.betterend.BetterEnd;
import ru.betterend.registry.EndItems;
@Environment(EnvType.CLIENT)
public class CrystaliteArmorProvider implements ModelProvider, TextureProvider {
private final static Identifier FIRST_LAYER = BetterEnd.makeID("textures/model/armor/crystalite_layer_1.png");
private final static Identifier SECOND_LAYER = BetterEnd.makeID("textures/model/armor/crystalite_layer_2.png");
private final static CrystaliteHelmetModel HELMET_MODEL = new CrystaliteHelmetModel(1.0F);
private final static CrystaliteChestplateModel CHEST_MODEL = new CrystaliteChestplateModel(1.0F, false);
private final static CrystaliteChestplateModel CHEST_MODEL_SLIM = new CrystaliteChestplateModel(1.0F, true);
private final static CrystaliteLeggingsModel LEGGINGS_MODEL = new CrystaliteLeggingsModel(1.0F);
private final static CrystaliteBootsModel BOOTS_MODEL = new CrystaliteBootsModel(1.0F);
@Override
public @NotNull Identifier getArmorTexture(LivingEntity entity, ItemStack stack, EquipmentSlot slot,
boolean secondLayer, @Nullable String suffix, Identifier defaultTexture) {
if (!isStackValid(stack)) return defaultTexture;
if (secondLayer) return SECOND_LAYER;
return FIRST_LAYER;
}
@Override
public @NotNull BipedEntityModel<LivingEntity> getArmorModel(LivingEntity entity, ItemStack stack,
EquipmentSlot slot, BipedEntityModel<LivingEntity> defaultModel) {
if (!isStackValid(stack)) return defaultModel;
if (entity instanceof AbstractClientPlayerEntity &&
((AbstractClientPlayerEntity) entity).getModel().equals("slim") &&
slot == EquipmentSlot.CHEST) {
return CHEST_MODEL_SLIM;
}
switch(slot) {
case HEAD: {
return new CrystaliteHelmetModel(1.0F);
}
case CHEST: {
return new CrystaliteChestplateModel(1.0F, false);
}
case LEGS: {
return new CrystaliteChestplateModel(1.0F, true);
}
case FEET: {
return new CrystaliteBootsModel(1.0F);
}
default: {
return defaultModel;
}
}
}
public Iterable<Item> getRenderedItems() {
return Lists.newArrayList(EndItems.CRYSTALITE_HELMET, EndItems.CRYSTALITE_CHESTPLATE, EndItems.CRYSTALITE_LEGGINGS, EndItems.CRYSTALITE_BOOTS);
}
private boolean isStackValid(ItemStack stack) {
return stack.getItem() == EndItems.CRYSTALITE_HELMET ||
stack.getItem() == EndItems.CRYSTALITE_CHESTPLATE ||
stack.getItem() == EndItems.CRYSTALITE_LEGGINGS ||
stack.getItem() == EndItems.CRYSTALITE_BOOTS;
}
}

View file

@ -0,0 +1,42 @@
package ru.betterend.item.model;
import java.util.Collections;
import com.google.common.collect.Lists;
import net.minecraft.client.model.ModelPart;
import net.minecraft.client.render.entity.model.BipedEntityModel;
import net.minecraft.entity.LivingEntity;
public class CrystaliteBootsModel extends BipedEntityModel<LivingEntity> {
public ModelPart leftBoot;
public ModelPart rightBoot;
public CrystaliteBootsModel(float scale) {
super(scale);
this.leftBoot = new ModelPart(this, 0, 16);
this.leftBoot.addCuboid(-2.0F, 0.0F, -2.0F, 4.0F, 12.0F, 4.0F, scale + 0.25F);
this.leftBoot.setPivot(1.9F, 12.0F, 0.0F);
this.rightBoot = new ModelPart(this, 0, 16);
this.rightBoot.addCuboid(-2.0F, 0.0F, -2.0F, 4.0F, 12.0F, 4.0F, scale + 0.25F);
this.rightBoot.setPivot(-1.9F, 12.0F, 0.0F);
}
@Override
protected Iterable<ModelPart> getHeadParts() {
return Collections::emptyIterator;
}
@Override
protected Iterable<ModelPart> getBodyParts() {
return Lists.newArrayList(leftBoot, rightBoot);
}
@Override
public void setAngles(LivingEntity livingEntity, float f, float g, float h, float i, float j) {
super.setAngles(livingEntity, f, g, h, i, j);
this.leftBoot.copyPositionAndRotation(leftLeg);
this.rightBoot.copyPositionAndRotation(rightLeg);
}
}

View file

@ -0,0 +1,54 @@
package ru.betterend.item.model;
import java.util.Collections;
import com.google.common.collect.Lists;
import net.minecraft.client.model.ModelPart;
import net.minecraft.client.render.entity.model.BipedEntityModel;
import net.minecraft.entity.LivingEntity;
public class CrystaliteChestplateModel extends BipedEntityModel<LivingEntity> {
public ModelPart leftShoulder;
public ModelPart rightShoulder;
public CrystaliteChestplateModel(float scale, boolean thinArms) {
super(scale);
this.torso = new ModelPart(this, 16, 16);
this.torso.addCuboid(-4.0F, 0.0F, -2.0F, 8.0F, 12.0F, 4.0F, scale);
this.torso.setPivot(0.0F, 0.0F, 0.0F);
if (thinArms) {
this.leftShoulder = new ModelPart(this, 40, 16);
this.leftShoulder.addCuboid(-1.0F, -2.0F, -2.0F, 3.0F, 12.0F, 4.0F, scale + 0.25F);
this.leftShoulder.setPivot(5.0F, 2.5F, 0.0F);
this.rightShoulder = new ModelPart(this, 40, 16);
this.rightShoulder.addCuboid(-2.0F, -2.0F, -12.0F, 3.0F, 12.0F, 4.0F, scale + 0.25F);
this.rightShoulder.setPivot(-5.0F, 2.5F, 10.0F);
} else {
this.leftShoulder = new ModelPart(this, 40, 16);
this.leftShoulder.addCuboid(-1.0F, -2.0F, -2.0F, 4.0F, 12.0F, 4.0F, scale + 0.25F);
this.leftShoulder.setPivot(5.0F, 2.0F, 0.0F);
this.rightShoulder = new ModelPart(this, 40, 16);
this.rightShoulder.addCuboid(-3.0F, -2.0F, -12.0F, 4.0F, 12.0F, 4.0F, scale + 0.25F);
this.rightShoulder.setPivot(-5.0F, 2.0F, 10.0F);
}
}
@Override
protected Iterable<ModelPart> getHeadParts() {
return Collections::emptyIterator;
}
@Override
protected Iterable<ModelPart> getBodyParts() {
return Lists.newArrayList(torso, leftShoulder, rightShoulder);
}
@Override
public void setAngles(LivingEntity livingEntity, float f, float g, float h, float i, float j) {
super.setAngles(livingEntity, f, g, h, i, j);
this.leftShoulder.copyPositionAndRotation(leftArm);
this.rightShoulder.copyPositionAndRotation(rightArm);
}
}

View file

@ -0,0 +1,33 @@
package ru.betterend.item.model;
import java.util.Collections;
import com.google.common.collect.Lists;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.model.ModelPart;
import net.minecraft.client.render.entity.model.BipedEntityModel;
import net.minecraft.entity.LivingEntity;
@Environment(EnvType.CLIENT)
public class CrystaliteHelmetModel extends BipedEntityModel<LivingEntity> {
public CrystaliteHelmetModel(float scale) {
super(scale);
this.helmet = new ModelPart(this, 0, 0);
this.helmet.addCuboid(-4.0F, -8.0F, -4.0F, 8.0F, 8.0F, 8.0F, scale + 0.5F);
this.helmet.setPivot(0.0F, 0.0F, 0.0F);
}
@Override
protected Iterable<ModelPart> getHeadParts() {
return Collections::emptyIterator;
}
@Override
protected Iterable<ModelPart> getBodyParts() {
return Lists.newArrayList(helmet);
}
}

View file

@ -0,0 +1,32 @@
package ru.betterend.item.model;
import java.util.Collections;
import com.google.common.collect.Lists;
import net.minecraft.client.model.ModelPart;
import net.minecraft.client.render.entity.model.BipedEntityModel;
import net.minecraft.entity.LivingEntity;
public class CrystaliteLeggingsModel extends BipedEntityModel<LivingEntity> {
public CrystaliteLeggingsModel(float scale) {
super(scale);
this.rightLeg = new ModelPart(this, 0, 16);
this.rightLeg.addCuboid(-2.0F, 0.0F, -2.0F, 4.0F, 12.0F, 4.0F, scale);
this.rightLeg.setPivot(-1.9F, 12.0F, 0.0F);
this.leftLeg = new ModelPart(this, 0, 16);
this.leftLeg.addCuboid(-2.0F, 0.0F, -2.0F, 4.0F, 12.0F, 4.0F, scale);
this.leftLeg.setPivot(1.9F, 12.0F, 0.0F);
}
@Override
protected Iterable<ModelPart> getHeadParts() {
return Collections::emptyIterator;
}
@Override
protected Iterable<ModelPart> getBodyParts() {
return Lists.newArrayList(rightLeg, leftLeg);
}
}

View file

@ -70,6 +70,10 @@ public class EndItems {
public static final Item AETERNIUM_CHESTPLATE = registerItem("aeternium_chestplate", new ArmorItem(EndArmorMaterial.AETERNIUM, EquipmentSlot.CHEST, makeSettings()));
public static final Item AETERNIUM_LEGGINGS = registerItem("aeternium_leggings", new ArmorItem(EndArmorMaterial.AETERNIUM, EquipmentSlot.LEGS, makeSettings()));
public static final Item AETERNIUM_BOOTS = registerItem("aeternium_boots", new ArmorItem(EndArmorMaterial.AETERNIUM, EquipmentSlot.FEET, makeSettings()));
public static final Item CRYSTALITE_HELMET = registerItem("crystalite_helmet", new ArmorItem(EndArmorMaterial.CRYSTALITE, EquipmentSlot.HEAD, makeSettings()));
public static final Item CRYSTALITE_CHESTPLATE = registerItem("crystalite_chestplate", new ArmorItem(EndArmorMaterial.CRYSTALITE, EquipmentSlot.CHEST, makeSettings()));
public static final Item CRYSTALITE_LEGGINGS = registerItem("crystalite_leggings", new ArmorItem(EndArmorMaterial.CRYSTALITE, EquipmentSlot.LEGS, makeSettings()));
public static final Item CRYSTALITE_BOOTS = registerItem("crystalite_boots", new ArmorItem(EndArmorMaterial.CRYSTALITE, EquipmentSlot.FEET, makeSettings()));
// Tools //
public static final ToolItem TERMINITE_SHOVEL = registerTool("terminite_shovel", new ShovelItem(EndToolMaterial.TERMINITE, 1.5F, -3.0F, makeSettings()));

View file

@ -0,0 +1,17 @@
package ru.betterend.registry;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.fabricmc.fabric.api.client.rendering.v1.ArmorRenderingRegistry;
import ru.betterend.item.model.CrystaliteArmorProvider;
@Environment(EnvType.CLIENT)
public class EndModelProviders {
public final static CrystaliteArmorProvider CRYSTALITE_PROVIDER = new CrystaliteArmorProvider();
public final static void register() {
ArmorRenderingRegistry.registerModel(CRYSTALITE_PROVIDER, CRYSTALITE_PROVIDER.getRenderedItems());
ArmorRenderingRegistry.registerTexture(CRYSTALITE_PROVIDER, CRYSTALITE_PROVIDER.getRenderedItems());
}
}

View file

@ -0,0 +1,6 @@
{
"parent": "minecraft:item/generated",
"textures": {
"layer0": "betterend:item/crystalite_boots"
}
}

View file

@ -0,0 +1,6 @@
{
"parent": "minecraft:item/generated",
"textures": {
"layer0": "betterend:item/crystalite_chestplate"
}
}

View file

@ -0,0 +1,6 @@
{
"parent": "minecraft:item/handheld",
"textures": {
"layer0": "betterend:item/crystalite_hammer"
}
}

View file

@ -0,0 +1,6 @@
{
"parent": "minecraft:item/generated",
"textures": {
"layer0": "betterend:item/crystalite_helmet"
}
}

View file

@ -0,0 +1,6 @@
{
"parent": "minecraft:item/generated",
"textures": {
"layer0": "betterend:item/crystalite_leggings"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 631 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 563 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 252 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 584 B

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 711 B

After

Width:  |  Height:  |  Size: 555 B

Before After
Before After