Skip to content

Commit

Permalink
Bump version 10.5.1.
Browse files Browse the repository at this point in the history
Add options (with configs) to improve importing third party models.
Fixes to the Hand Info JSON exporter.
Option to reset importMC. (SHIFT)
Bump iChunUtil dep.
  • Loading branch information
iChun committed Dec 4, 2021
1 parent 270c185 commit 59f397a
Show file tree
Hide file tree
Showing 8 changed files with 143 additions and 23 deletions.
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ apply plugin: 'net.minecraftforge.gradle'
apply plugin: 'eclipse'
apply plugin: 'maven-publish'

version = '10.5.0'
version = '10.5.1'
group = 'tabula'
archivesBaseName = 'Tabula-1.16.5'

Expand Down Expand Up @@ -69,7 +69,7 @@ dependencies {
// that the dep is a ForgeGradle 'patcher' dependency. And it's patches will be applied.
// The userdev artifact is a special name and will get all sorts of transformations applied to it.
minecraft 'net.minecraftforge:forge:1.16.5-36.0.55'
implementation fg.deobf("ichunutil:iChunUtil:10.5.0")
implementation fg.deobf("ichunutil:iChunUtil:10.5.1")

// You may put jars on which you depend on in ./libs or you may define them like so..
// compile "some.group:artifact:version:classifier"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ public class ConfigClient extends ConfigBase

public boolean animateImports = true;

public boolean addEntityTags = true;

public boolean readEmptyNbt = true;

@Prop(min = 0, max = 10)
public int guiMaxDecimals = 2;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import me.ichun.mods.ichunutil.common.module.tabula.formats.ImportList;
import me.ichun.mods.ichunutil.common.module.tabula.project.Project;
import me.ichun.mods.tabula.client.export.ExportList;
import me.ichun.mods.tabula.client.gui.IProjectInfo;
import me.ichun.mods.tabula.client.gui.WorkspaceTabula;
import me.ichun.mods.tabula.client.tabula.Mainframe;
import me.ichun.mods.tabula.common.Tabula;
Expand Down Expand Up @@ -85,6 +86,23 @@ public void nextStep()
}

//Delete all the non-relevant parts
for(Project.Part part : leftParts)
{
if(!(part.parent instanceof Project))
{
part.parent.disown(part);
projectInfo.project.adopt(part);
}
}
for(Project.Part part : rightParts)
{
if(!(part.parent instanceof Project))
{
part.parent.disown(part);
projectInfo.project.adopt(part);
}
}

ArrayList<Project.Part> parts = new ArrayList<>(projectInfo.project.parts);
for(Project.Part part : parts)
{
Expand All @@ -97,7 +115,6 @@ public void nextStep()
for(Project.Part leftPart : leftParts)
{
leftPart.rotAX = 0F;
parent.mainframe.updatePart(leftPart, true);
}

for(Project.Part rightPart : rightParts)
Expand All @@ -108,9 +125,15 @@ public void nextStep()
{
rightPart.showModel = false;
}
}

parent.mainframe.updatePart(rightPart, true);
projectInfo.markProjectDirty();

if(parent.mainframe.origin != null && !parent.mainframe.sessionEnded)
{
parent.mainframe.sendContent("", projectInfo.project.identifier, "", projectInfo.project, (byte)2);
}
parent.projectChanged(IProjectInfo.ChangeType.PARTS);

alignedLeft = new ArrayList<>(leftParts);
alignedRight = new ArrayList<>(rightParts);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import me.ichun.mods.tabula.client.tabula.Mainframe;
import me.ichun.mods.tabula.common.Tabula;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.resources.I18n;
import net.minecraft.util.ResourceLocation;

Expand Down Expand Up @@ -372,6 +373,10 @@ public void openImportProject()

public void openImportMCProject()
{
if(Screen.hasShiftDown())
{
WindowImportMCProject.resetHasInit();
}
Window<?> window = new WindowImportMCProject(getWorkspace());
getWorkspace().openWindowInCenter(window, 0.4D, 0.8D);
window.init();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.mojang.blaze3d.matrix.MatrixStack;
import me.ichun.mods.ichunutil.client.gui.bns.Workspace;
import me.ichun.mods.ichunutil.client.gui.bns.window.Window;
import me.ichun.mods.ichunutil.client.gui.bns.window.WindowPopup;
import me.ichun.mods.ichunutil.client.gui.bns.window.constraint.Constraint;
import me.ichun.mods.ichunutil.client.gui.bns.window.view.View;
import me.ichun.mods.ichunutil.client.gui.bns.window.view.element.*;
Expand Down Expand Up @@ -34,10 +35,13 @@
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.fluid.Fluid;
import net.minecraft.item.crafting.RecipeManager;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.profiler.EmptyProfiler;
import net.minecraft.resources.IResource;
import net.minecraft.scoreboard.Scoreboard;
import net.minecraft.tags.ITagCollectionSupplier;
import net.minecraft.tags.TagCollectionManager;
import net.minecraft.tags.TagRegistryManager;
import net.minecraft.tileentity.TileEntityType;
import net.minecraft.util.Direction;
import net.minecraft.util.ResourceLocation;
Expand Down Expand Up @@ -65,6 +69,7 @@
public class WindowImportMCProject extends Window<WorkspaceTabula>
{
public static final ArrayList<ModelInfo> MODELS = new ArrayList<>();

public static class ModelInfo
implements Comparable<ModelInfo>
{
Expand Down Expand Up @@ -127,6 +132,11 @@ public void originEntity(Class<? extends Entity> aClass)
}

private static boolean hasInit;
public static void resetHasInit()
{
hasInit = false;
}

public static void initModels()
{
if(!hasInit)
Expand Down Expand Up @@ -236,7 +246,7 @@ public void setSpawnAngle(float angle)
{

}
}, World.OVERWORLD, DimensionType.OVERWORLD_TYPE, () -> EmptyProfiler.INSTANCE, false, false, 0L) {
}, World.OVERWORLD, DimensionType.OVERWORLD_TYPE, () -> EmptyProfiler.INSTANCE, true, false, 0L) {
@Override
public DynamicRegistries func_241828_r()
{
Expand Down Expand Up @@ -309,7 +319,25 @@ public Biome getNoiseBiomeRaw(int x, int y, int z)
}
};

Map<EntityType<?>, EntityRenderer<?>> renderers = Minecraft.getInstance().getRenderManager().renderers;
Minecraft mc = Minecraft.getInstance();

//More hackery: Should fix errors with Tags eg in DungeonMobs
if(Tabula.configClient.addEntityTags && mc.world == null)
{
ITagCollectionSupplier oriManager = TagCollectionManager.getManager();
ITagCollectionSupplier itagcollectionsupplier = ITagCollectionSupplier.getTagCollectionSupplier(oriManager.getBlockTags(), oriManager.getItemTags(), oriManager.getFluidTags(), oriManager.getEntityTypeTags());
itagcollectionsupplier = ITagCollectionSupplier.reinjectOptionalTags(itagcollectionsupplier);

TagCollectionManager.setManager(itagcollectionsupplier);
net.minecraftforge.common.ForgeTagHandler.reinjectOptionalTagsCustomTypes();

TagRegistryManager.fetchTags(itagcollectionsupplier);

TagCollectionManager.setManager(oriManager);
}

Map<EntityType<?>, EntityRenderer<?>> renderers = mc.getRenderManager().renderers;
boolean[] errored = new boolean[] { false };
renderers.forEach((entityType, entityRenderer) -> {
try
{
Expand All @@ -318,7 +346,24 @@ public Biome getNoiseBiomeRaw(int x, int y, int z)
{
instance = entityType.create(worldInstance);
}
catch(Throwable ignored){}
catch(Throwable e)
{
errored[0] = true;
e.printStackTrace();
}

if(Tabula.configClient.readEmptyNbt && instance != null)
{
try
{
instance.read(new CompoundNBT());
}
catch(Throwable e)
{
errored[0] = true;
e.printStackTrace();
}
}

ResourceLocation texLoc = null;
if(entityRenderer instanceof HorseRenderer)
Expand All @@ -333,12 +378,13 @@ public Biome getNoiseBiomeRaw(int x, int y, int z)
{
texLoc = RenderHelper.getEntityTexture(entityRenderer, instance);
}
catch(Throwable ignored)
catch(Throwable e)
{
errored[0] = true;
e.printStackTrace();
}
}


if(texLoc == null)
{
try
Expand All @@ -360,8 +406,10 @@ public Biome getNoiseBiomeRaw(int x, int y, int z)
clz = clz.getSuperclass();
}
}
catch(Throwable ignored)
catch(Throwable e)
{
errored[0] = true;
e.printStackTrace();
}
}
}
Expand Down Expand Up @@ -425,7 +473,11 @@ public Biome getNoiseBiomeRaw(int x, int y, int z)
clz = clz.getSuperclass();
}
}
catch(Throwable ignored){}
catch(Throwable e)
{
errored[0] = true;
e.printStackTrace();
}

if(entityRenderer instanceof LivingRenderer)
{
Expand Down Expand Up @@ -453,7 +505,11 @@ public Biome getNoiseBiomeRaw(int x, int y, int z)
clz = clz.getSuperclass();
}
}
catch(Throwable ignored){}
catch(Throwable e)
{
errored[0] = true;
e.printStackTrace();
}

//we have the texture. let's get all the models now.
try
Expand All @@ -473,7 +529,10 @@ public Biome getNoiseBiomeRaw(int x, int y, int z)
if(model != null)
{
ModelInfo info = new ModelInfo(texLoc1, model, layer);
info.origin = texLoc1.getNamespace();
if(texLoc1 != null)
{
info.origin = texLoc1.getNamespace();
}
if(!MODELS.contains(info))
{
MODELS.add(info);
Expand All @@ -485,11 +544,19 @@ public Biome getNoiseBiomeRaw(int x, int y, int z)
clz = clz.getSuperclass();
}
}
catch(Throwable ignored){}
catch(Throwable e)
{
errored[0] = true;
e.printStackTrace();
}
}
}
}
catch(Throwable ignored){}
catch(Throwable e)
{
errored[0] = true;
e.printStackTrace();
}
});

Map<TileEntityType<?>, TileEntityRenderer<?>> tileRenderers = TileEntityRendererDispatcher.instance.renderers;
Expand Down Expand Up @@ -522,9 +589,10 @@ else if(RenderMaterial.class.isAssignableFrom(f.getType()))
clz = clz.getSuperclass();
}
}
catch(Throwable ignored)
catch(Throwable e)
{
ignored.printStackTrace();
errored[0] = true;
e.printStackTrace();
}


Expand Down Expand Up @@ -563,7 +631,11 @@ else if(ModelRenderer.class.isAssignableFrom(f.getType()))
clz = clz.getSuperclass();
}
}
catch(Throwable ignored){}
catch(Throwable e)
{
errored[0] = true;
e.printStackTrace();
}

if(rendererIsModel)
{
Expand All @@ -575,7 +647,11 @@ else if(ModelRenderer.class.isAssignableFrom(f.getType()))
}
}
}
catch(Throwable ignored){}
catch(Throwable e)
{
errored[0] = true;
e.printStackTrace();
}
});

ModelInfo playerInfo = new ModelInfo(new ResourceLocation("textures/entity/steve.png"), new PlayerModel<>(0F, false), Minecraft.getInstance().getRenderManager().skinMap.get("default"));
Expand Down Expand Up @@ -607,6 +683,11 @@ else if(ModelRenderer.class.isAssignableFrom(f.getType()))
strings.add(info.model.getClass().getSimpleName() + " - " + info.source.getClass().getSimpleName() + (info.origin != null ? " - " + info.origin : ""));
return strings;
});

if(errored[0] && mc.currentScreen instanceof WorkspaceTabula)
{
WindowPopup.popup((WorkspaceTabula)mc.currentScreen, 0.5D, 180, null, I18n.format("window.importMC.errored"));
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -916,6 +916,8 @@ public ProjectInfo(@Nonnull Mainframe mainframe, Project project)
}
}
}

createState();
}

public void tick()
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/META-INF/mods.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ issueTrackerURL="https://github.com/iChun/Tabula/issues"
[[dependencies.tabula]]
modId="ichunutil"
mandatory=true
versionRange="[10.5.0,11)"
versionRange="[10.5.1,11)"
ordering="NONE"
side="BOTH"
Loading

0 comments on commit 59f397a

Please sign in to comment.