Skip to content

Commit

Permalink
Update dev version of forge and adjust our model data generation for …
Browse files Browse the repository at this point in the history
…buckets to use forge's model builder instead of our hacked together limited one
  • Loading branch information
pupnewfster committed Nov 2, 2020
1 parent 524b6cf commit 0397a17
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 67 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ org.gradle.jvmargs=-Xmx3G
minecraft_version=1.16.3
mappings_version=20201028-1.16.3
loader_version=34
forge_version=34.1.40
forge_version=34.1.42
mod_version=10.0.15
#This determines the minimum version of forge required to use Mekanism
# Only bump it whenever we need access to a feature in forge that is not available in earlier versions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,14 @@

import javax.annotation.Nonnull;
import mekanism.api.providers.IItemProvider;
import mekanism.client.model.builder.BucketModelBuilder;
import mekanism.common.registration.impl.FluidRegistryObject;
import net.minecraft.data.DataGenerator;
import net.minecraft.item.BucketItem;
import net.minecraft.resources.ResourcePackType;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.model.generators.ItemModelBuilder;
import net.minecraftforge.client.model.generators.ItemModelProvider;
import net.minecraftforge.client.model.generators.ModelFile.UncheckedModelFile;
import net.minecraftforge.client.model.generators.loaders.DynamicBucketModelBuilder;
import net.minecraftforge.common.data.ExistingFileHelper;

public abstract class BaseItemModelProvider extends ItemModelProvider {
Expand Down Expand Up @@ -77,20 +76,9 @@ protected ItemModelBuilder handheld(IItemProvider itemProvider, ResourceLocation

//Note: This isn't the best way to do this in terms of model file validation, but it works
protected void registerBucket(FluidRegistryObject<?, ?, ?, ?> fluidRO) {
BucketItem bucket = fluidRO.getBucket();
ResourceLocation outputLoc = extendWithFolder(bucket.getRegistryName());
if (generatedModels.containsKey(outputLoc)) {
throw new RuntimeException("Model with output loc: '" + outputLoc + "' has already been registered");
}
ItemModelBuilder modelBuilder = new BucketModelBuilder(outputLoc, existingFileHelper, fluidRO.getStillFluid().getRegistryName())
.parent(new UncheckedModelFile(new ResourceLocation("forge", "item/bucket")));
generatedModels.put(outputLoc, modelBuilder);
}

protected ResourceLocation extendWithFolder(ResourceLocation rl) {
if (rl.getPath().contains("/")) {
return rl;
}
return new ResourceLocation(rl.getNamespace(), folder + "/" + rl.getPath());
getBuilder(fluidRO.getBucket().getRegistryName().getPath())
.parent(new UncheckedModelFile(new ResourceLocation("forge", "item/bucket")))
.customLoader(DynamicBucketModelBuilder::begin)
.fluid(fluidRO.getStillFluid());
}
}

This file was deleted.

This file was deleted.

0 comments on commit 0397a17

Please sign in to comment.