Skip to content

Commit

Permalink
v3.0.90
Browse files Browse the repository at this point in the history
  • Loading branch information
AzureZhen committed Sep 5, 2022
1 parent 736aeb5 commit 5e48243
Show file tree
Hide file tree
Showing 34 changed files with 23 additions and 66 deletions.
4 changes: 2 additions & 2 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
v3.0.89
v3.0.90

- Fixed Extended Entity Render of armor - DerToaster
- Code clean up
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ fabric_version=0.42.0+1.16


# Mod Properties
mod_version=3.0.89
mod_version=3.0.90
maven_group = software.bernie.geckolib
archives_base_name = geckolib-fabric-1.16.5
repsyUrl=https://repo.repsy.io/mvn/gandiber/geckolib
2 changes: 0 additions & 2 deletions src/main/java/software/bernie/example/ClientListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@

public class ClientListener implements ClientModInitializer {

@SuppressWarnings("unchecked")
@Override
public void onInitializeClient() {
if (FabricLoader.getInstance().isDevelopmentEnvironment() && !GeckoLibMod.DISABLE_IN_DEV) {
Expand Down Expand Up @@ -77,7 +76,6 @@ public void onInitializeClient() {
}

public static class EntityPacketOnClient {
@SuppressWarnings("resource")
@Environment(EnvType.CLIENT)
public static void onPacket(MinecraftClient context, PacketByteBuf byteBuf) {
EntityType<?> type = Registry.ENTITY_TYPE.get(byteBuf.readVarInt());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ public BotariumTileEntity() {
super(TileRegistry.BOTARIUM_TILE);
}

@SuppressWarnings("unchecked")
private <E extends BlockEntity & IAnimatable> PlayState predicate(AnimationEvent<E> event) {
event.getController().transitionLengthTicks = 0;
event.getController().setAnimation(new AnimationBuilder().addAnimation("Botarium.anim.deploy", true));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ public FertilizerTileEntity() {
super(TileRegistry.FERTILIZER);
}

@SuppressWarnings("unchecked")
private <E extends BlockEntity & IAnimatable> PlayState predicate(AnimationEvent<E> event) {
event.getController().transitionLengthTicks = 0;
if (event.getAnimatable().getWorld().isRaining()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ public Identifier getTextureLocation(GeoExampleEntity entity) {
return new Identifier(GeckoLib.ModID, "textures/model/entity/bat.png");
}

@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
public void setLivingAnimations(GeoExampleEntity entity, Integer uniqueID, AnimationEvent customPredicate) {
super.setLivingAnimations(entity, uniqueID, customPredicate);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import software.bernie.geckolib3.GeckoLib;
import software.bernie.geckolib3.model.AnimatedGeoModel;

@SuppressWarnings("rawtypes")
public class ReplacedCreeperModel extends AnimatedGeoModel {
@Override
public Identifier getModelLocation(Object object) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

public class LERenderer extends GeoEntityRenderer<LEEntity> {

@SuppressWarnings("unchecked")
public LERenderer(EntityRenderDispatcher renderDispatcher) {
super(renderDispatcher, new LEModel());
this.addLayer(new GeoExampleLayer(this));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

public class ReplacedCreeperRenderer extends GeoReplacedEntityRenderer<ReplacedCreeperEntity> {

@SuppressWarnings("unchecked")
public ReplacedCreeperRenderer(EntityRenderDispatcher renderManager) {
super(renderManager, new ReplacedCreeperModel(), new ReplacedCreeperEntity());
GeoReplacedEntityRenderer.registerReplacedEntity(ReplacedCreeperEntity.class, this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,16 @@
import software.bernie.geckolib3.renderer.geo.GeoLayerRenderer;
import software.bernie.geckolib3.renderer.geo.IGeoRenderer;

@SuppressWarnings("rawtypes")
public class GeoExampleLayer extends GeoLayerRenderer {
// A resource location for the texture of the layer. This will be applied onto pre-existing cubes on the model
private static final Identifier LAYER = new Identifier(GeckoLib.ModID, "textures/entity/le_glasses.png");
// A resource location for the model of the entity. This model is put on top of the normal one, which is then given the texture
private static final Identifier MODEL = new Identifier(GeckoLib.ModID, "geo/le.geo.json");

@SuppressWarnings("unchecked")
public GeoExampleLayer(IGeoRenderer<?> entityRendererIn) {
super(entityRendererIn);
}

@SuppressWarnings("unchecked")
@Override
public void render(MatrixStack matrixStackIn, VertexConsumerProvider bufferIn, int packedLightIn, Entity entityLivingBaseIn, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch) {
RenderLayer cameo = RenderLayer.getArmorCutoutNoCull(LAYER);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ private <P extends Item & IAnimatable> PlayState predicate(AnimationEvent<P> eve

@Override
public void registerControllers(AnimationData data) {
@SuppressWarnings({ "unchecked", "rawtypes" })
AnimationController<JackInTheBoxItem> controller = new AnimationController(this, controllerName, 20,
this::predicate);

Expand All @@ -54,7 +53,6 @@ public void registerControllers(AnimationData data) {
data.addAnimationController(controller);
}

@SuppressWarnings("resource")
private <ENTITY extends IAnimatable> void soundListener(SoundKeyframeEvent<ENTITY> event) {
// The animation for the jackinthebox has a sound keyframe at time 0:00.
// As soon as that keyframe gets hit this method fires and it starts playing the
Expand Down Expand Up @@ -85,13 +83,11 @@ public TypedActionResult<ItemStack> use(World world, PlayerEntity user, Hand han
return super.use(world, user, hand);
}

@SuppressWarnings("resource")
@Override
public void onAnimationSync(int id, int state) {
if (state == ANIM_OPEN) {
// Always use GeckoLibUtil to get AnimationControllers when you don't have
// access to an AnimationEvent
@SuppressWarnings("rawtypes")
final AnimationController controller = GeckoLibUtil.getControllerForID(this.factory, id, controllerName);

if (controller.getAnimationState() == AnimationState.Stopped) {
Expand Down
1 change: 0 additions & 1 deletion src/main/java/software/bernie/example/item/PistolItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ public <P extends Item & IAnimatable> PlayState predicate(AnimationEvent<P> even
return PlayState.CONTINUE;
}

@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public void registerControllers(AnimationData data) {
data.addAnimationController(new AnimationController(this, controllerName, 1, this::predicate));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ private <P extends IAnimatable> PlayState predicate(AnimationEvent<P> event) {

// All you need to do here is add your animation controllers to the
// AnimationData
@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
public void registerControllers(AnimationData data) {
data.addAnimationController(new AnimationController(this, "controller", 20, this::predicate));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ public EntityRegistryBuilder<E> dimensions(EntityDimensions size) {
return this;
}

@SuppressWarnings("deprecation")
public EntityType<E> build() {
EntityType.Builder<E> entityBuilder = EntityType.Builder.create(this.entityFactory, this.category)
.setDimensions(this.dimensions.width, this.dimensions.height);
Expand All @@ -86,7 +85,8 @@ public EntityType<E> build() {
}
if (this.alwaysUpdateVelocity && this.updateIntervalTicks != 0 & this.trackingDistance != 0) {
FabricEntityTypeBuilder.create(this.category, this.entityFactory).dimensions(this.dimensions)
.trackable(this.trackingDistance, this.updateIntervalTicks, this.alwaysUpdateVelocity).build();
.trackedUpdateRate(updateIntervalTicks).trackRangeBlocks(trackingDistance)
.forceTrackedVelocityUpdates(alwaysUpdateVelocity).build();
}

EntityType<E> entityType = Registry.register(Registry.ENTITY_TYPE, name, entityBuilder.build(name.getPath()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

public class PatchouliCompat {

@SuppressWarnings("resource")
public static void patchouliLoaded(MatrixStack matrixStackIn) {
Class<GuiBook> patchouli = GuiBook.class;
boolean screen = MinecraftClient.getInstance().inGameHud.equals(patchouli);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ private JsonObject loadFile(Identifier location, ResourceManager manager) {
return JsonHelper.deserialize(GSON, content, JsonObject.class);
}

@SuppressWarnings("deprecation")
public static String getResourceAsString(Identifier location, ResourceManager manager) {
try (InputStream inputStream = manager.getResource(location).getInputStream()) {
return IOUtils.toString(inputStream);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,13 @@ public GeoArmorItem(ArmorMaterial materialIn, EquipmentSlot slot, Settings build
super(materialIn, slot, builder);
}

@SuppressWarnings("unchecked")
@Environment(EnvType.CLIENT)
public BipedEntityModel<LivingEntity> getArmorModel(LivingEntity entityLiving, ItemStack itemStack,
EquipmentSlot armorSlot, BipedEntityModel<LivingEntity> _default) {
return GeoArmorRenderer.getRenderer(this.getClass()).applyEntityStats(_default).applySlot(armorSlot)
.setCurrentItem(entityLiving, itemStack, armorSlot, _default);
}

@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public Identifier getArmorTexture(LivingEntity entity, ItemStack stack, EquipmentSlot slot,
Identifier defaultTexture) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
package software.bernie.geckolib3.mixins.fabric;

import java.util.Map;
import java.util.Objects;

import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;

import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.render.VertexConsumerProvider;
Expand All @@ -13,21 +26,8 @@
import net.minecraft.item.ArmorItem;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Identifier;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
import software.bernie.geckolib3.ArmorRenderingRegistryImpl;

import java.util.Map;
import java.util.Objects;

@SuppressWarnings({ "rawtypes", "unchecked" })
@Mixin({ ArmorFeatureRenderer.class })
@Environment(EnvType.CLIENT)
public abstract class MixinArmorFeatureRenderer extends FeatureRenderer {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
import software.bernie.geckolib3.util.AnimationTicker;
import software.bernie.geckolib3.util.MolangUtils;

@SuppressWarnings({ "rawtypes", "unchecked" })
public abstract class AnimatedGeoModel<T extends IAnimatable> extends GeoModelProvider<T>
implements IAnimatableModel<T>, IAnimatableModelProvider<T> {
private final AnimationProcessor animationProcessor;
Expand Down Expand Up @@ -61,7 +60,8 @@ public void setLivingAnimations(T entity, Integer uniqueID, AnimationEvent custo

AnimationEvent<T> predicate;
if (customPredicate == null) {
predicate = new AnimationEvent<T>(entity, 0, 0, (float) (manager.tick - lastGameTickTime), false, Collections.emptyList());
predicate = new AnimationEvent<T>(entity, 0, 0, (float) (manager.tick - lastGameTickTime), false,
Collections.emptyList());
} else {
predicate = customPredicate;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import software.bernie.geckolib3.core.manager.AnimationData;
import software.bernie.geckolib3.resource.GeckoLibCache;

@SuppressWarnings({ "rawtypes", "unchecked" })
public abstract class AnimatedTickingGeoModel<T extends IAnimatable & IAnimationTickable> extends AnimatedGeoModel<T> {
public AnimatedTickingGeoModel() {
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,6 @@ protected void moveAndRotateMatrixToMatchBone(MatrixStack stack, GeoBone bone) {
stack.multiply(Vec3f.POSITIVE_Z.getDegreesQuaternion(bone.getRotationZ()));
}

@SuppressWarnings("unchecked")
protected void handleArmorRenderingForBone(GeoBone bone, MatrixStack stack, VertexConsumer bufferIn,
int packedLightIn, int packedOverlayIn, Identifier currentTexture) {
final ItemStack armorForBone = this.getArmorForBone(bone.getName(), currentEntityBeingRendered);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
import software.bernie.geckolib3.model.AnimatedGeoModel;
import software.bernie.geckolib3.util.GeoUtils;

@SuppressWarnings({ "rawtypes", "unchecked" })
public abstract class GeoArmorRenderer<T extends ArmorItem & IAnimatable> extends BipedEntityModel
implements IGeoRenderer<T> {
private static final Map<Class<? extends ArmorItem>, GeoArmorRenderer> renderers = new ConcurrentHashMap<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import software.bernie.geckolib3.core.util.Color;
import software.bernie.geckolib3.geo.render.built.GeoModel;
import software.bernie.geckolib3.model.AnimatedGeoModel;
@SuppressWarnings({ "rawtypes", "unchecked" })

public abstract class GeoBlockRenderer<T extends BlockEntity & IAnimatable> extends BlockEntityRenderer
implements IGeoRenderer<T> {
static {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@
import software.bernie.geckolib3.util.AnimationUtils;
import software.bernie.geckolib3.util.RenderUtils;

@SuppressWarnings({ "unchecked" })
public abstract class GeoEntityRenderer<T extends LivingEntity & IAnimatable> extends EntityRenderer<T>
implements IGeoRenderer<T> {
static {
Expand Down Expand Up @@ -99,7 +98,6 @@ private static float getFacingAngle(Direction facingIn) {
}
}

@SuppressWarnings("resource")
@Override
public void render(T entity, float entityYaw, float partialTicks, MatrixStack stack,
VertexConsumerProvider bufferIn, int packedLightIn) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import software.bernie.geckolib3.geo.render.built.GeoModel;
import software.bernie.geckolib3.model.AnimatedGeoModel;
import software.bernie.geckolib3.util.GeckoLibUtil;
@SuppressWarnings({ "rawtypes", "unchecked" })

public class GeoItemRenderer<T extends Item & IAnimatable>
implements IGeoRenderer<T>, BuiltinItemRendererRegistry.DynamicItemRenderer {
private static final Map<Class<? extends Item>, GeoItemRenderer> renderers = new ConcurrentHashMap<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ public RenderLayer getRenderType(Identifier textureLocation) {
return RenderLayer.getEntityCutout(textureLocation);
}

@SuppressWarnings("unchecked")
public GeoModelProvider<T> getEntityModel() {
return this.entityRenderer.getGeoModelProvider();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import software.bernie.geckolib3.model.provider.data.EntityModelData;
import software.bernie.geckolib3.util.AnimationUtils;

@SuppressWarnings({ "unchecked" })
public class GeoProjectilesRenderer<T extends Entity & IAnimatable> extends EntityRenderer<T>
implements IGeoRenderer<T> {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
import software.bernie.geckolib3.model.AnimatedGeoModel;
import software.bernie.geckolib3.model.provider.data.EntityModelData;

@SuppressWarnings({ "rawtypes", "unchecked" })
public abstract class GeoReplacedEntityRenderer<T extends IAnimatable> extends EntityRenderer implements IGeoRenderer {
private final AnimatedGeoModel<IAnimatable> modelProvider;
private final T animatable;
Expand Down Expand Up @@ -80,7 +79,6 @@ public void render(Entity entityIn, float entityYaw, float partialTicks, MatrixS
this.render(entityIn, this.animatable, entityYaw, partialTicks, matrixStackIn, bufferIn, packedLightIn);
}

@SuppressWarnings("resource")
public void render(Entity entity, IAnimatable animatable, float entityYaw, float partialTicks, MatrixStack stack,
VertexConsumerProvider bufferIn, int packedLightIn) {
this.currentAnimatable = animatable;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ default void renderCube(GeoCube cube, MatrixStack stack, VertexConsumer bufferIn
}
}

@SuppressWarnings("rawtypes")
GeoModelProvider getGeoModelProvider();

Identifier getTextureLocation(T instance);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,11 @@ public static double convertSecondsToTicks(double seconds) {
/**
* Gets the renderer for an entity
*/
@SuppressWarnings("unchecked")
public static <T extends Entity> EntityRenderer<T> getRenderer(T entity) {
EntityRenderDispatcher renderManager = MinecraftClient.getInstance().getEntityRenderDispatcher();
return (EntityRenderer<T>) renderManager.getRenderer(entity);
}

@SuppressWarnings("rawtypes")
public static <T extends Entity> GeoModelProvider getGeoModelForEntity(T entity) {
EntityRenderer<T> entityRenderer = getRenderer(entity);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,11 @@ public static boolean stackHasIDTag(ItemStack stack) {
return stack.hasTag() && stack.getTag().contains(GECKO_LIB_ID_NBT, 3);
}

@SuppressWarnings("rawtypes")
public static AnimationController getControllerForStack(AnimationFactory factory, ItemStack stack,
String controllerName) {
return getControllerForID(factory, getIDFromStack(stack), controllerName);
}

@SuppressWarnings("rawtypes")
public static AnimationController getControllerForID(AnimationFactory factory, Integer id, String controllerName) {
return factory.getOrCreateAnimationData(id).getAnimationControllers().get(controllerName);
}
Expand Down
Loading

0 comments on commit 5e48243

Please sign in to comment.