Skip to content

Commit

Permalink
t
Browse files Browse the repository at this point in the history
  • Loading branch information
Lithewings committed Jul 19, 2024
2 parents d0d6bec + a21bed4 commit cf2ff93
Show file tree
Hide file tree
Showing 30 changed files with 752 additions and 238 deletions.
12 changes: 10 additions & 2 deletions src/main/java/com/equilibrium/MITEequilibrium.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,26 @@

import com.equilibrium.entity.ModEntities;
import com.equilibrium.entity.mob.TestZombieEntity;
import com.equilibrium.event.BreakBlockEvent;
import com.equilibrium.item.Ingots;
import com.equilibrium.item.ModItemGroup;
import com.equilibrium.item.ModItems;
import com.equilibrium.item.Tools;
import com.equilibrium.util.LootTableModifier;
import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.event.player.PlayerBlockBreakEvents;
import net.fabricmc.fabric.api.object.builder.v1.entity.FabricDefaultAttributeRegistry;
import net.minecraft.enchantment.Enchantments;
import net.minecraft.loot.context.LootContextTypes;
import net.minecraft.registry.RegistryWrapper;
import net.minecraft.util.Identifier;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import static com.equilibrium.entity.ModEntities.TEST_ZOMBIE;
import static com.equilibrium.entity.ModEntities.registerModEntities;
import static com.equilibrium.util.LootTableModifier.modifierLootTables;

import static com.equilibrium.worldgen.ModOreGenerator.registerModOre;


Expand Down Expand Up @@ -56,9 +64,9 @@ public void onInitialize() {
registerModEntities();


modifierLootTables();



PlayerBlockBreakEvents.AFTER.register(new BreakBlockEvent());

LOGGER.info("Hello Fabric world!");
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/equilibrium/MITEequilibriumClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@


import com.equilibrium.client.render.entity.InvisibleStalker;
import com.equilibrium.client.render.entity.ZombieEntityRendererTransparent;
import com.equilibrium.client.render.entity.TestZombie;
import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.fabric.api.client.rendering.v1.EntityRendererRegistry;

Expand All @@ -16,7 +16,7 @@ public void onInitializeClient() {
//将注册的实体和模型结合起来


EntityRendererRegistry.register(TEST_ZOMBIE, ZombieEntityRendererTransparent::new);
EntityRendererRegistry.register(TEST_ZOMBIE, TestZombie::new);
EntityRendererRegistry.register(INVISIBLE_STALKER, InvisibleStalker::new);


Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com.equilibrium.client.render.entity;

import com.equilibrium.client.render.entity.model.TransparentZombieEntityModelAbstractZombieModel;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.render.entity.EntityRendererFactory;
import net.minecraft.entity.mob.ZombieEntity;

@Environment(EnvType.CLIENT)
public abstract class AbstractZombieEntityRenderer <T extends ZombieEntity, M extends TransparentZombieEntityModelAbstractZombieModel<T>> extends BipedEntityRenderer<T, M> {


protected AbstractZombieEntityRenderer(EntityRendererFactory.Context ctx, M bodyModel, M legsArmorModel, M bodyArmorModel) {
super(ctx, bodyModel, 0.5F);

}


protected boolean isShaking(T zombieEntity) {
return super.isShaking(zombieEntity) || zombieEntity.isConvertingInWater();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,18 @@
import net.minecraft.client.render.entity.feature.ElytraFeatureRenderer;
import net.minecraft.client.render.entity.feature.HeadFeatureRenderer;
import net.minecraft.client.render.entity.feature.HeldItemFeatureRenderer;
import net.minecraft.client.render.entity.model.BipedEntityModel;
import net.minecraft.entity.mob.MobEntity;

@Environment(EnvType.CLIENT)
public abstract class TransparentBipedEntityRenderer<T extends MobEntity, M extends TransparentBipedEntityModel<T>> extends MobEntityRenderer<T, M> {
public TransparentBipedEntityRenderer(EntityRendererFactory.Context ctx, M model, float shadowRadius) {
public abstract class BipedEntityRenderer<T extends MobEntity, M extends TransparentBipedEntityModel<T>> extends MobEntityRenderer<T, M> {
public BipedEntityRenderer(EntityRendererFactory.Context ctx, M model, float shadowRadius) {
this(ctx, model, shadowRadius, 1.0F, 1.0F, 1.0F);
}

public TransparentBipedEntityRenderer(EntityRendererFactory.Context ctx, M model, float shadowRadius, float scaleX, float scaleY, float scaleZ) {
public BipedEntityRenderer(EntityRendererFactory.Context ctx, M model, float shadowRadius, float scaleX, float scaleY, float scaleZ) {
super(ctx, model, shadowRadius);
this.addFeature(new HeadFeatureRenderer<>(this, ctx.getModelLoader(), scaleX, scaleY, scaleZ, ctx.getHeldItemRenderer()));
this.addFeature(new ElytraFeatureRenderer<>(this, ctx.getModelLoader()));
this.addFeature(new HeldItemFeatureRenderer<>(this, ctx.getHeldItemRenderer()));
}
}
}
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
package com.equilibrium.client.render.entity;

import com.equilibrium.client.render.entity.model.SZombieEntityModel;
import com.equilibrium.client.render.entity.model.TransparentZombieEntityModelAbstractZombieModel;
import net.minecraft.client.render.entity.EntityRendererFactory;
import net.minecraft.client.render.entity.model.EntityModelLayer;
import net.minecraft.client.render.entity.model.EntityModelLayers;
import net.minecraft.client.render.entity.model.ZombieEntityModel;
import net.minecraft.entity.mob.ZombieEntity;
import net.minecraft.util.Identifier;

public class InvisibleStalker extends TransparentZombieEntityRenderer<ZombieEntity, ZombieEntityModel<ZombieEntity>> {
public class InvisibleStalker extends AbstractZombieEntityRenderer<ZombieEntity, TransparentZombieEntityModelAbstractZombieModel<ZombieEntity>> {
private static final Identifier TEXTURE = Identifier.of("miteequilibrium","textures/entity/invisible_stalker.png");

public Identifier getTexture(ZombieEntity zombieEntity) {
Expand All @@ -21,7 +20,7 @@ public InvisibleStalker(EntityRendererFactory.Context context) {

public InvisibleStalker(EntityRendererFactory.Context ctx, EntityModelLayer layer, EntityModelLayer legsArmorLayer, EntityModelLayer bodyArmorLayer) {
super(
ctx, new ZombieEntityModel<>(ctx.getPart(layer)), new ZombieEntityModel<>(ctx.getPart(legsArmorLayer)), new ZombieEntityModel<>(ctx.getPart(bodyArmorLayer))
ctx, new TransparentZombieEntityModelAbstractZombieModel<>(ctx.getPart(layer)),new TransparentZombieEntityModelAbstractZombieModel<>(ctx.getPart(layer)), new TransparentZombieEntityModelAbstractZombieModel<>(ctx.getPart(layer))
);

}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.equilibrium.client.render.entity;

import com.equilibrium.client.render.entity.model.SZombieEntityModel;
import com.equilibrium.client.render.entity.model.TransparentZombieEntityModelAbstractZombieModel;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.render.entity.EntityRendererFactory;
Expand All @@ -10,20 +10,20 @@
import net.minecraft.util.Identifier;

@Environment(EnvType.CLIENT)
public class ZombieEntityRendererTransparent extends TransparentZombieEntityRenderer<ZombieEntity, SZombieEntityModel<ZombieEntity>> {
public class TestZombie extends AbstractZombieEntityRenderer<ZombieEntity, TransparentZombieEntityModelAbstractZombieModel<ZombieEntity>> {


private static final Identifier TEXTURE = Identifier.ofVanilla("textures/entity/player/wide/steve.png");
public Identifier getTexture(ZombieEntity zombieEntity) {
return TEXTURE;
}
public ZombieEntityRendererTransparent(EntityRendererFactory.Context context) {
public TestZombie(EntityRendererFactory.Context context) {
this(context, EntityModelLayers.ZOMBIE, EntityModelLayers.ZOMBIE_INNER_ARMOR, EntityModelLayers.ZOMBIE_OUTER_ARMOR);

}
public ZombieEntityRendererTransparent(EntityRendererFactory.Context ctx, EntityModelLayer layer, EntityModelLayer legsArmorLayer, EntityModelLayer bodyArmorLayer) {
public TestZombie(EntityRendererFactory.Context ctx, EntityModelLayer layer, EntityModelLayer legsArmorLayer, EntityModelLayer bodyArmorLayer) {
super(
ctx, new SZombieEntityModel<>(ctx.getPart(layer)), new SZombieEntityModel<>(ctx.getPart(legsArmorLayer)), new SZombieEntityModel<>(ctx.getPart(bodyArmorLayer))
ctx, new TransparentZombieEntityModelAbstractZombieModel<>(ctx.getPart(layer)), new TransparentZombieEntityModelAbstractZombieModel<>(ctx.getPart(layer)), new TransparentZombieEntityModelAbstractZombieModel<>(ctx.getPart(layer))
);
}

Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package com.equilibrium.client.render.entity.model;



import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.model.ModelPart;
Expand Down
Loading

0 comments on commit cf2ff93

Please sign in to comment.