Chorus plant changes & fixes

This commit is contained in:
paulevsGitch 2021-07-25 07:29:22 +03:00
parent 4b4d4bd5ae
commit b6cf041fc4
10 changed files with 135 additions and 219 deletions

View file

@ -5,20 +5,24 @@ import net.minecraft.resources.ResourceLocation;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.ModifyVariable;
import ru.betterend.BetterEnd;
import ru.betterend.world.generator.GeneratorOptions;
@Mixin(ModelBakery.class)
public abstract class ModelLoaderMixin {
@ModifyVariable(method = "loadModel", ordinal = 2, at = @At(value = "INVOKE"))
public ResourceLocation be_switchModel(ResourceLocation id) {
if (GeneratorOptions.changeChorusPlant() && id.getNamespace().equals("minecraft") && id.getPath()
.startsWith(
"blockstates/") && id
.getPath()
.contains("chorus") && !id.getPath().contains("custom_")) {
id = new ResourceLocation(id.getPath().replace("chorus", "custom_chorus"));
if (GeneratorOptions.changeChorusPlant() && be_changeModel(id)) {
String path = id.getPath().replace("chorus", "custom_chorus");
id = BetterEnd.makeID(path);
}
return id;
}
private boolean be_changeModel(ResourceLocation id) {
return id.getNamespace().equals("minecraft")
&& id.getPath().startsWith("blockstates/")
&& id.getPath().contains("chorus")
&& !id.getPath().contains("custom_");
}
}