Skip to content

Commit

Permalink
v3.0.24
Browse files Browse the repository at this point in the history
  • Loading branch information
AzureZhen committed Sep 5, 2022
1 parent 564121c commit 4c81f50
Show file tree
Hide file tree
Showing 38 changed files with 35 additions and 91 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.23
v3.0.24

- Fixed Extended Entity Render of armor - DerToaster
- Code clean up
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ geckolib_core_version=1.0.4a

# Quilt
quilt_mappings=24
loader_version=0.17.3
loader_version=0.17.5-beta.1
qsl_version=1.1.0-beta.26+1.18.2
quilted_fapi_version=1.0.0-beta.24+0.58.0

# Mod Properties
mod_version=3.0.23
mod_version=3.0.24
maven_group=software.bernie.geckolib
archives_base_name=geckolib-quilt-1.18
5 changes: 1 addition & 4 deletions src/main/java/software/bernie/example/ClientListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@
import org.quiltmc.loader.api.ModContainer;
import org.quiltmc.loader.api.QuiltLoader;
import org.quiltmc.qsl.base.api.entrypoint.client.ClientModInitializer;
import org.quiltmc.qsl.networking.api.ServerPlayNetworking;
import org.quiltmc.qsl.networking.api.client.ClientPlayNetworking;

import io.netty.buffer.Unpooled;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.fabricmc.fabric.api.client.rendering.v1.BlockEntityRendererRegistry;
import net.fabricmc.fabric.api.client.rendering.v1.EntityRendererRegistry;
import net.fabricmc.fabric.api.networking.v1.ServerPlayNetworking;
import net.fabricmc.fabric.impl.blockrenderlayer.BlockRenderLayerMapImpl;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.render.RenderLayer;
Expand Down Expand Up @@ -49,10 +49,8 @@
import software.bernie.geckolib3q.renderers.geo.GeoArmorRenderer;
import software.bernie.geckolib3q.renderers.geo.GeoItemRenderer;

@SuppressWarnings("deprecation")
public class ClientListener implements ClientModInitializer {

@SuppressWarnings({ "unchecked" })
@Override
public void onInitializeClient(ModContainer mod) {
if (QuiltLoader.isDevelopmentEnvironment() && !GeckoLibMod.DISABLE_IN_DEV) {
Expand Down Expand Up @@ -92,7 +90,6 @@ public static void onPacket(MinecraftClient context, PacketByteBuf byteBuf) {
float pitch = (byteBuf.readByte() * 360) / 256.0F;
float yaw = (byteBuf.readByte() * 360) / 256.0F;
context.execute(() -> {
@SuppressWarnings("resource")
ClientWorld world = MinecraftClient.getInstance().world;
Entity entity = type.create(world);
if (entity != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ public BotariumTileEntity(BlockPos pos, BlockState state) {
super(TileRegistry.BOTARIUM_TILE, pos, state);
}

@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 @@ -24,7 +24,6 @@ public Identifier getTextureResource(GeoExampleEntity entity) {
return new Identifier(GeckoLib.ModID, "textures/model/entity/bat.png");
}

@SuppressWarnings({ "unchecked", "rawtypes" })
@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.geckolib3q.GeckoLib;
import software.bernie.geckolib3q.model.AnimatedGeoModel;

@SuppressWarnings("rawtypes")
public class ReplacedCreeperModel extends AnimatedGeoModel {
@Override
public Identifier getModelResource(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(EntityRendererFactory.Context renderManager) {
super(renderManager, 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(EntityRendererFactory.Context ctx) {
super(ctx, new ReplacedCreeperModel(), new ReplacedCreeperEntity());
GeoReplacedEntityRenderer.registerReplacedEntity(ReplacedCreeperEntity.class, this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import software.bernie.geckolib3q.renderers.geo.GeoLayerRenderer;
import software.bernie.geckolib3q.renderers.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
Expand All @@ -19,12 +18,10 @@ public class GeoExampleLayer extends GeoLayerRenderer {
// 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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ public void registerControllers(AnimationData data) {
data.addAnimationController(controller);
}

@SuppressWarnings("resource")
private <ENTITY extends IAnimatable> void customListener(CustomInstructionKeyframeEvent<ENTITY> event) {
final ClientPlayerEntity player = MinecraftClient.getInstance().player;
if (player != null) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package software.bernie.example.item;

import net.fabricmc.fabric.api.networking.v1.PlayerLookup;
import org.quiltmc.qsl.networking.api.PlayerLookup;

import net.minecraft.client.MinecraftClient;
import net.minecraft.client.network.ClientPlayerEntity;
import net.minecraft.entity.player.PlayerEntity;
Expand All @@ -25,7 +26,6 @@
import software.bernie.geckolib3q.network.ISyncable;
import software.bernie.geckolib3q.util.GeckoLibUtil;

@SuppressWarnings("deprecation")
public class JackInTheBoxItem extends Item implements IAnimatable, ISyncable {
public AnimationFactory factory = new AnimationFactory(this);
private static final String controllerName = "popupController";
Expand All @@ -42,7 +42,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 @@ -55,7 +54,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 @@ -83,13 +81,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
5 changes: 2 additions & 3 deletions src/main/java/software/bernie/example/item/PistolItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

import java.util.List;

import net.fabricmc.fabric.api.networking.v1.PlayerLookup;
import org.quiltmc.qsl.networking.api.PlayerLookup;

import net.minecraft.client.item.TooltipContext;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
Expand Down Expand Up @@ -30,7 +31,6 @@
import software.bernie.geckolib3q.network.ISyncable;
import software.bernie.geckolib3q.util.GeckoLibUtil;

@SuppressWarnings("deprecation")
public class PistolItem extends Item implements IAnimatable, ISyncable {

public AnimationFactory factory = new AnimationFactory(this);
Expand Down Expand Up @@ -99,7 +99,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 @@ -78,7 +78,6 @@ public EntityRegistryBuilder<E> dimensions(EntityDimensions size) {
return this;
}

@SuppressWarnings({ "unchecked" })
public EntityType<E> build() {
EntityType.Builder<E> entityBuilder = EntityType.Builder.create(this.entityFactory, this.category)
.setDimensions(this.dimensions.width, this.dimensions.height);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package software.bernie.example.registry;

import net.fabricmc.fabric.api.client.itemgroup.FabricItemGroupBuilder;
import org.quiltmc.qsl.item.group.api.QuiltItemGroup;

import net.minecraft.entity.EquipmentSlot;
import net.minecraft.item.ArmorMaterials;
import net.minecraft.item.BlockItem;
Expand All @@ -13,11 +14,10 @@
import software.bernie.example.item.PotatoArmorItem;
import software.bernie.geckolib3q.GeckoLib;

@SuppressWarnings("deprecation")
public class ItemRegistry {

public static ItemGroup geckolibItemGroup = FabricItemGroupBuilder
.create(new Identifier(GeckoLib.ModID, "geckolib_examples"))
public static ItemGroup geckolibItemGroup = QuiltItemGroup
.builder(new Identifier(GeckoLib.ModID, "geckolib_examples"))
.icon(() -> new ItemStack(ItemRegistry.JACK_IN_THE_BOX)).build();

public static final JackInTheBoxItem JACK_IN_THE_BOX = RegistryUtils.registerItem("jackintheboxitem",
Expand Down
32 changes: 15 additions & 17 deletions src/main/java/software/bernie/geckolib3q/GeckoLib.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,38 +10,36 @@

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.quiltmc.qsl.resource.loader.api.ResourceLoader;
import org.quiltmc.qsl.resource.loader.api.reloader.IdentifiableResourceReloader;

import net.fabricmc.fabric.api.resource.IdentifiableResourceReloadListener;
import net.fabricmc.fabric.api.resource.ResourceManagerHelper;
import net.minecraft.resource.ResourceManager;
import net.minecraft.resource.ResourceType;
import net.minecraft.util.Identifier;
import net.minecraft.util.profiler.Profiler;
import software.bernie.geckolib3q.resource.GeckoLibCache;

@SuppressWarnings("deprecation")
public class GeckoLib {
public static final Logger LOGGER = LogManager.getLogger();
public static final String ModID = "geckolib3q";
public static boolean hasInitialized;

public static void initialize() {
if (!hasInitialized) {
ResourceManagerHelper.get(ResourceType.CLIENT_RESOURCES)
.registerReloadListener(new IdentifiableResourceReloadListener() {
@Override
public Identifier getFabricId() {
return new Identifier(GeckoLib.ModID, "models");
}
ResourceLoader.get(ResourceType.CLIENT_RESOURCES).registerReloader(new IdentifiableResourceReloader() {
@Override
public Identifier getQuiltId() {
return new Identifier(GeckoLib.ModID, "models");
}

@Override
public CompletableFuture<Void> reload(Synchronizer synchronizer, ResourceManager manager,
Profiler prepareProfiler, Profiler applyProfiler, Executor prepareExecutor,
Executor applyExecutor) {
return GeckoLibCache.getInstance().reload(synchronizer, manager, prepareProfiler,
applyProfiler, prepareExecutor, applyExecutor);
}
});
@Override
public CompletableFuture<Void> reload(Synchronizer synchronizer, ResourceManager manager,
Profiler prepareProfiler, Profiler applyProfiler, Executor prepareExecutor,
Executor applyExecutor) {
return GeckoLibCache.getInstance().reload(synchronizer, manager, prepareProfiler, applyProfiler,
prepareExecutor, applyExecutor);
}
});
}
hasInitialized = true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

public class PatchouliCompat {

@SuppressWarnings({ "resource", "unlikely-arg-type" })
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 @@ -50,7 +50,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 @@ -28,7 +28,6 @@
import net.minecraft.util.Identifier;
import software.bernie.geckolib3q.ArmorRenderingRegistryImpl;

@SuppressWarnings("rawtypes")
@Mixin({ ArmorFeatureRenderer.class })
@Environment(EnvType.CLIENT)
public abstract class MixinArmorFeatureRenderer extends FeatureRenderer {
Expand All @@ -40,7 +39,6 @@ public abstract class MixinArmorFeatureRenderer extends FeatureRenderer {
@Unique
private EquipmentSlot gl_storedSlot;

@SuppressWarnings({ "unchecked" })
public MixinArmorFeatureRenderer(FeatureRendererContext context) {
super(context);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,9 @@

public abstract class AnimatedGeoModel<T extends IAnimatable> extends GeoModelProvider<T>
implements IAnimatableModel<T>, IAnimatableModelProvider<T> {
@SuppressWarnings("rawtypes")
private final AnimationProcessor animationProcessor;
private GeoModel currentModel;

@SuppressWarnings("rawtypes")
protected AnimatedGeoModel() {
this.animationProcessor = new AnimationProcessor(this);
}
Expand All @@ -46,7 +44,6 @@ public void registerBone(GeoBone bone) {
}
}

@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
public void setLivingAnimations(T entity, Integer uniqueID, AnimationEvent customPredicate) {
// Each animation has it's own collection of animations (called the
Expand Down Expand Up @@ -78,7 +75,6 @@ public void setLivingAnimations(T entity, Integer uniqueID, AnimationEvent custo
}
}

@SuppressWarnings("rawtypes")
@Override
public AnimationProcessor getAnimationProcessor() {
return this.animationProcessor;
Expand All @@ -88,7 +84,6 @@ public void registerModelRenderer(IBone modelRenderer) {
animationProcessor.registerModelRenderer(modelRenderer);
}

@SuppressWarnings("unchecked")
@Override
public Animation getAnimation(String name, IAnimatable animatable) {
AnimationFile animation = GeckoLibCache.getInstance().getAnimations()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ public boolean isInitialized() {
return !this.getAnimationProcessor().getModelRendererList().isEmpty();
}

@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
public void setLivingAnimations(T entity, Integer uniqueID, @Nullable AnimationEvent customPredicate) {
// Each animation has it's own collection of animations (called the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,14 @@

import org.quiltmc.loader.api.ModContainer;
import org.quiltmc.qsl.base.api.entrypoint.client.ClientModInitializer;
import org.quiltmc.qsl.networking.api.PacketSender;
import org.quiltmc.qsl.networking.api.client.ClientPlayNetworking;

import net.fabricmc.fabric.api.client.networking.v1.ClientPlayNetworking;
import net.fabricmc.fabric.api.networking.v1.PacketSender;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.network.ClientPlayNetworkHandler;
import net.minecraft.network.PacketByteBuf;
import software.bernie.geckolib3q.GeckoLib;

@SuppressWarnings("deprecation")
public class ClientPackets implements ClientModInitializer {

public static void registerClientPackets() {
Expand Down
Loading

0 comments on commit 4c81f50

Please sign in to comment.