Update mappings to 09/21 snapshots.

Conflict with getMatrix in ITransformation, so renamed to getMatrixVec.
This commit is contained in:
LexManos committed 2018-09-22 03:40:22 -07:00
1 parent 5ed03945a0
commit 94e1a8e0a4
210 files changed
+1052 -978

No files matched your search

@@ -67,7 +67,7 @@ public class BakedItemModel implements IBakedModel
@Override public ItemOverrideList getOverrides() { return overrides; }
@Override
public List<BakedQuad> func_200117_a(@Nullable IBlockState state, @Nullable EnumFacing side, Random rand)
public List<BakedQuad> getQuads(@Nullable IBlockState state, @Nullable EnumFacing side, Random rand)
{
if (side == null)
{
@@ -105,7 +105,7 @@ public class BakedItemModel implements IBakedModel
}
@Override
public List<BakedQuad> func_200117_a (@Nullable IBlockState state, @Nullable EnumFacing side, Random rand)
public List<BakedQuad> getQuads (@Nullable IBlockState state, @Nullable EnumFacing side, Random rand)
{
if(side == null)
{
@@ -43,9 +43,9 @@ public abstract class BakedModelWrapper<T extends IBakedModel> implements IBaked
}
@Override
public List<BakedQuad> func_200117_a(@Nullable IBlockState state, @Nullable EnumFacing side, Random rand)
public List<BakedQuad> getQuads(@Nullable IBlockState state, @Nullable EnumFacing side, Random rand)
{
return originalModel.func_200117_a(state, side, rand);
return originalModel.getQuads(state, side, rand);
}
@Override
@@ -68,9 +68,9 @@ final class FancyMissingModel implements IUnbakedModel
m.m33 = 1;
m.setTranslation(new Vector3f(1, 1 + 1f / 0x100, 0));
return new SimpleModelFontRenderer(
Minecraft.getMinecraft().gameSettings,
Minecraft.getInstance().gameSettings,
font,
Minecraft.getMinecraft().getTextureManager(),
Minecraft.getInstance().getTextureManager(),
false,
m,
format
@@ -92,15 +92,15 @@ final class FancyMissingModel implements IUnbakedModel
this.missingModel = missingModel;
this.message = message;
}
@Override
public Collection<ResourceLocation> func_209559_a(Function<ResourceLocation, IUnbakedModel> p_209559_1_, Set<String> p_209559_2_)
public Collection<ResourceLocation> getTextures(Function<ResourceLocation, IUnbakedModel> modelGetter, Set<String> missingTextureErrors)
{
return ImmutableList.of(font2);
}
@Override
public Collection<ResourceLocation> getOverrideLocations()
public Collection<ResourceLocation> getOverrideLocations()
{
return Collections.emptyList();
}
@@ -145,7 +145,7 @@ final class FancyMissingModel implements IUnbakedModel
}
@Override
public List<BakedQuad> func_200117_a(@Nullable IBlockState state, @Nullable EnumFacing side, Random rand)
public List<BakedQuad> getQuads(@Nullable IBlockState state, @Nullable EnumFacing side, Random rand)
{
if (side == null)
{
@@ -161,16 +161,16 @@ final class FancyMissingModel implements IUnbakedModel
}
for (int y = 0; y < splitLines.size(); y++)
{
fontRenderer.func_211126_b(splitLines.get(y), 0, ((y - splitLines.size() / 2f) * fontRenderer.FONT_HEIGHT) + 0x40, 0xFF00FFFF);
fontRenderer.drawString(splitLines.get(y), 0, ((y - splitLines.size() / 2f) * fontRenderer.FONT_HEIGHT) + 0x40, 0xFF00FFFF);
}
ImmutableList.Builder<BakedQuad> builder = ImmutableList.builder();
builder.addAll(missingModel.func_200117_a (state, side, rand));
builder.addAll(missingModel.getQuads (state, side, rand));
builder.addAll(fontRenderer.build());
quads = builder.build();
}
return quads;
}
return missingModel.func_200117_a (state, side, rand);
return missingModel.getQuads (state, side, rand);
}
@Override
@@ -186,7 +186,7 @@ final class FancyMissingModel implements IUnbakedModel
public TextureAtlasSprite getParticleTexture() { return fontTexture; }
@Override
public ItemOverrideList getOverrides() { return ItemOverrideList.NONE; }
public ItemOverrideList getOverrides() { return ItemOverrideList.EMPTY; }
@Override
public Pair<? extends IBakedModel, Matrix4f> handlePerspective(ItemCameraTransforms.TransformType cameraTransformType)
@@ -230,9 +230,9 @@ final class FancyMissingModel implements IUnbakedModel
}
if (big != this.big)
{
return Pair.of(otherModel, transform.getMatrix());
return Pair.of(otherModel, transform.getMatrixVec());
}
return Pair.of(this, transform.getMatrix());
return Pair.of(this, transform.getMatrixVec());
}
}
}
@@ -31,14 +31,14 @@ import net.minecraft.util.ResourceLocation;
public interface ICustomModelLoader extends ISelectiveResourceReloadListener
{
@Override
void func_195410_a(IResourceManager resourceManager);
void onResourceManagerReload(IResourceManager resourceManager);
@Override
default void onResourceManagerReload(IResourceManager resourceManager, Predicate<IResourceType> resourcePredicate)
{
if (resourcePredicate.test(VanillaResourceType.MODELS))
{
func_195410_a(resourceManager);
onResourceManagerReload(resourceManager);
}
}
@@ -43,7 +43,7 @@ import net.minecraftforge.common.model.animation.IClip;
public interface IModel<T extends IModel<T>>
{
@Nullable
IBakedModel bake(Function<ResourceLocation, IUnbakedModel> p_209558_1_, Function<ResourceLocation, TextureAtlasSprite> p_209558_2_, IModelState state, boolean uvlock, VertexFormat format);
IBakedModel bake(Function<ResourceLocation, IUnbakedModel> modelGetter, Function<ResourceLocation, TextureAtlasSprite> spriteGetter, IModelState state, boolean uvlock, VertexFormat format);
/*
* Default state this model will be baked with.
@@ -64,7 +64,7 @@ public final class ItemLayerModel implements IUnbakedModel
public ItemLayerModel(ImmutableList<ResourceLocation> textures)
{
this(textures, ItemOverrideList.NONE);
this(textures, ItemOverrideList.EMPTY);
}
public ItemLayerModel(ImmutableList<ResourceLocation> textures, ItemOverrideList overrides)
@@ -75,7 +75,7 @@ public final class ItemLayerModel implements IUnbakedModel
public ItemLayerModel(ModelBlock model)
{
this(getTextures(model), model.func_209568_a(model, ModelLoader.defaultModelGetter(), ModelLoader.defaultTextureGetter()));
this(getTextures(model), model.getOverrides(model, ModelLoader.defaultModelGetter(), ModelLoader.defaultTextureGetter()));
}
private static ImmutableList<ResourceLocation> getTextures(ModelBlock model)
@@ -87,17 +87,17 @@ public final class ItemLayerModel implements IUnbakedModel
}
return builder.build();
}
@Override
public Collection<ResourceLocation> func_209559_a(Function<ResourceLocation, IUnbakedModel> p_209559_1_, Set<String> p_209559_2_)
public Collection<ResourceLocation> getTextures(Function<ResourceLocation, IUnbakedModel> modelGetter, Set<String> missingTextureErrors)
{
return textures;
}
@Override
public Collection<ResourceLocation> getOverrideLocations()
public Collection<ResourceLocation> getOverrideLocations()
{
return Collections.emptyList();
return Collections.emptyList();
}
@Override
@@ -117,9 +117,9 @@ public final class ItemLayerModel implements IUnbakedModel
}
return new ItemLayerModel(builder.build(), overrides);
}
@Override
public IBakedModel bake(Function<ResourceLocation, IUnbakedModel> p_209558_1_, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter, IModelState state, boolean p_209558_4_, VertexFormat format) {
public IBakedModel bake(Function<ResourceLocation, IUnbakedModel> modelGetter, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter, IModelState state, boolean uvlock, VertexFormat format) {
ImmutableList.Builder<BakedQuad> builder = ImmutableList.builder();
Optional<TRSRTransformation> transform = state.apply(Optional.empty());
for(int i = 0; i < textures.size(); i++)
@@ -136,8 +136,8 @@ public final class ItemLayerModel implements IUnbakedModel
{
ImmutableList.Builder<BakedQuad> builder = ImmutableList.builder();
int uMax = sprite.getIconWidth();
int vMax = sprite.getIconHeight();
int uMax = sprite.getWidth();
int vMax = sprite.getHeight();
FaceData faceData = new FaceData(uMax, vMax);
boolean translucent = false;
@@ -343,8 +343,8 @@ public final class ItemLayerModel implements IUnbakedModel
{
final float eps = 1e-2f;
int width = sprite.getIconWidth();
int height = sprite.getIconHeight();
int width = sprite.getWidth();
int height = sprite.getHeight();
float x0 = (float) u / width;
float y0 = (float) v / height;
@@ -424,7 +424,7 @@ public final class ItemLayerModel implements IUnbakedModel
vec.y = y;
vec.z = z;
vec.w = 1;
transform.get().getMatrix().transform(vec);
transform.get().getMatrixVec().transform(vec);
builder.put(e, vec.x, vec.y, vec.z, vec.w);
}
else
@@ -455,7 +455,7 @@ public final class ItemLayerModel implements IUnbakedModel
INSTANCE;
@Override
public void func_195410_a(IResourceManager resourceManager) {}
public void onResourceManagerReload(IResourceManager resourceManager) {}
@Override
public boolean accepts(ResourceLocation modelLocation)
@@ -80,8 +80,8 @@ public final class ItemTextureQuadConverter
*/
public static List<UnpackedBakedQuad> convertTextureHorizontal(VertexFormat format, TRSRTransformation transform, TextureAtlasSprite template, TextureAtlasSprite sprite, float z, EnumFacing facing, int color, int tint)
{
int w = template.getIconWidth();
int h = template.getIconHeight();
int w = template.getWidth();
int h = template.getHeight();
float wScale = 16f / (float)w;
float hScale = 16f / (float)h;
List<UnpackedBakedQuad> quads = Lists.newArrayList();
@@ -93,7 +93,7 @@ public final class ItemTextureQuadConverter
for (int x = 0; x < w; x++)
{
// current pixel
boolean isVisible = !template.func_195662_a(0, x, y);
boolean isVisible = !template.isPixelTransparent(0, x, y);
// no current quad but found a new one
if (start < 0 && isVisible)
@@ -111,7 +111,7 @@ public final class ItemTextureQuadConverter
{
for (int i = 0; i < w; i++)
{
if (template.func_195662_a(0, i, y) != template.func_195662_a(0, i, endY))
if (template.isPixelTransparent(0, i, y) != template.isPixelTransparent(0, i, endY))
{
sameRow = false;
break;
@@ -158,8 +158,8 @@ public final class ItemTextureQuadConverter
*/
public static List<UnpackedBakedQuad> convertTextureVertical(VertexFormat format, TRSRTransformation transform, TextureAtlasSprite template, TextureAtlasSprite sprite, float z, EnumFacing facing, int color, int tint)
{
int w = template.getIconWidth();
int h = template.getIconHeight();
int w = template.getWidth();
int h = template.getHeight();
float wScale = 16f / (float)w;
float hScale = 16f / (float)h;
List<UnpackedBakedQuad> quads = Lists.newArrayList();
@@ -171,7 +171,7 @@ public final class ItemTextureQuadConverter
for (int y = 0; y < h; y++)
{
// current pixel
boolean isVisible = !sprite.func_195662_a(0, x, y);
boolean isVisible = !sprite.isPixelTransparent(0, x, y);
// no current quad but found a new one
if (start < 0 && isVisible)
@@ -189,7 +189,7 @@ public final class ItemTextureQuadConverter
{
for (int i = 0; i < h; i++)
{
if (sprite.func_195662_a(0, x, i) != sprite.func_195662_a(0, endX, i))
if (sprite.isPixelTransparent(0, x, i) != sprite.isPixelTransparent(0, endX, i))
{
sameColumn = false;
break;
@@ -305,7 +305,7 @@ public final class ItemTextureQuadConverter
vec.y = y;
vec.z = z;
vec.w = 1;
transform.getMatrix().transform(vec);
transform.getMatrixVec().transform(vec);
builder.put(e, vec.x, vec.y, vec.z, vec.w);
}
break;
@@ -111,7 +111,7 @@ public final class ModelDynBucket implements IUnbakedModel
}
@Override
public Collection<ResourceLocation> func_209559_a(Function<ResourceLocation, IUnbakedModel> p_209559_1_, Set<String> p_209559_2_)
public Collection<ResourceLocation> getTextures(Function<ResourceLocation, IUnbakedModel> modelGetter, Set<String> missingTextureErrors)
{
ImmutableSet.Builder<ResourceLocation> builder = ImmutableSet.builder();
@@ -160,7 +160,7 @@ public final class ModelDynBucket implements IUnbakedModel
// build base (insidest)
IBakedModel model = (new ItemLayerModel(ImmutableList.of(baseLocation))).bake(modelGetter, bakedTextureGetter, state, uvlock, format);
random.setSeed(42);
builder.addAll(model.func_200117_a(null, null, random));
builder.addAll(model.getQuads(null, null, random));
particleSprite = model.getParticleTexture();
}
if (liquidLocation != null && fluidSprite != null)
@@ -260,7 +260,7 @@ public final class ModelDynBucket implements IUnbakedModel
{
try
{
return Minecraft.getMinecraft().func_195551_G().func_199002_a(resourceLocation);
return Minecraft.getInstance().getResourceManager().getResource(resourceLocation);
}
catch (IOException ignored)
{
@@ -298,7 +298,7 @@ public final class ModelDynBucket implements IUnbakedModel
}
@Override
public void func_195410_a(IResourceManager resourceManager)
public void onResourceManagerReload(IResourceManager resourceManager)
{
// no need to clear cache since we create a new model instance
}
@@ -331,7 +331,7 @@ public final class ModelDynBucket implements IUnbakedModel
private BucketBaseSprite(IResource resource)
{
super(resource.func_199029_a(), getSizeInfo(resource), resource.func_199028_a(AnimationMetadataSection.field_195817_a));
super(resource.getLocation(), getSizeInfo(resource), resource.getMetadata(AnimationMetadataSection.SERIALIZER));
}
/* TODO Custom TAS
@@ -373,7 +373,7 @@ public final class ModelDynBucket implements IUnbakedModel
private BucketCoverSprite(IResource resource)
{
super(resource.func_199029_a(), getSizeInfo(resource), resource.func_199028_a(AnimationMetadataSection.field_195817_a));
super(resource.getLocation(), getSizeInfo(resource), resource.getMetadata(AnimationMetadataSection.SERIALIZER));
}
/* TODO Custom TAS
@@ -404,7 +404,7 @@ public final class ModelDynBucket implements IUnbakedModel
IResource mask = getResource(new ResourceLocation(ForgeVersion.MOD_ID, "textures/items/vanilla_bucket_cover_mask.png"))
) {
// use the alpha mask if it fits, otherwise leave the cover texture blank
if (empty != null && mask != null && Objects.equals(empty.func_199026_d(), mask.func_199026_d()) &&
if (empty != null && mask != null && Objects.equals(empty.getPackName(), mask.getPackName()) &&
alphaMask.getIconWidth() == width && alphaMask.getIconHeight() == height)
{
final int[][] oldPixels = sprite.getFrameTextureData(0);
@@ -437,7 +437,7 @@ public final class ModelDynBucket implements IUnbakedModel
private BakedDynBucketOverrideHandler() {}
@Override
public IBakedModel func_209581_a(IBakedModel originalModel, ItemStack stack, @Nullable World world, @Nullable EntityLivingBase entity)
public IBakedModel getModelWithOverrides(IBakedModel originalModel, ItemStack stack, @Nullable World world, @Nullable EntityLivingBase entity)
{
return FluidUtil.getFluidContained(stack)
.map(fluidStack -> {
@@ -450,7 +450,7 @@ public final class ModelDynBucket implements IUnbakedModel
{
IUnbakedModel parent = model.parent.process(ImmutableMap.of("fluid", name));
Function<ResourceLocation, TextureAtlasSprite> textureGetter;
textureGetter = location -> Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite(location.toString());
textureGetter = location -> Minecraft.getInstance().getTextureMap().getAtlasSprite(location.toString());
IBakedModel bakedModel = parent.bake(ModelLoader.defaultModelGetter(), textureGetter, new SimpleModelState(model.transforms), false, model.format);
model.cache.put(name, bakedModel);
@@ -79,13 +79,13 @@ public final class ModelFluid implements IUnbakedModel
}
@Override
public Collection<ResourceLocation> func_209559_a(Function<ResourceLocation, IUnbakedModel> modelGetter, Set<String> p_209559_2_)
public Collection<ResourceLocation> getTextures(Function<ResourceLocation, IUnbakedModel> modelGetter, Set<String> missingTextureErrors)
{
return fluid.getOverlay() != null
? ImmutableSet.of(fluid.getStill(), fluid.getFlowing(), fluid.getOverlay())
: ImmutableSet.of(fluid.getStill(), fluid.getFlowing());
}
@Override
public Collection<ResourceLocation> getOverrideLocations() {
return Collections.emptyList();
@@ -112,7 +112,7 @@ public final class ModelFluid implements IUnbakedModel
INSTANCE;
@Override
public void func_195410_a(IResourceManager resourceManager) {}
public void onResourceManagerReload(IResourceManager resourceManager) {}
@Override
public boolean accepts(ResourceLocation modelLocation)
@@ -229,7 +229,7 @@ public final class ModelFluid implements IUnbakedModel
}
@Override
public List<BakedQuad> func_200117_a(@Nullable IBlockState state, @Nullable EnumFacing side, Random rand)
public List<BakedQuad> getQuads(@Nullable IBlockState state, @Nullable EnumFacing side, Random rand)
{
if (side != null && state instanceof IExtendedBlockState)
{
@@ -255,10 +255,10 @@ public final class ModelFluid implements IUnbakedModel
key <<= 1;
key |= 1;
return modelCache.getUnchecked(key).func_200117_a(state, side, rand);
return modelCache.getUnchecked(key).getQuads(state, side, rand);
}
return super.func_200117_a(state, side, rand);
return super.getQuads(state, side, rand);
}
}
@@ -432,7 +432,7 @@ public final class ModelFluid implements IUnbakedModel
if(transformation.isPresent() && !transformation.get().isIdentity())
{
Vector4f vec = new Vector4f(data);
transformation.get().getMatrix().transform(vec);
transformation.get().getMatrixVec().transform(vec);
vec.get(data);
}
builder.put(e, data);
@@ -484,7 +484,7 @@ public final class ModelFluid implements IUnbakedModel
}
@Override
public List<BakedQuad> func_200117_a(@Nullable IBlockState state, @Nullable EnumFacing side, Random rand)
public List<BakedQuad> getQuads(@Nullable IBlockState state, @Nullable EnumFacing side, Random rand)
{
return side == null ? ImmutableList.of() : faceQuads.get(side);
}
@@ -492,7 +492,7 @@ public final class ModelFluid implements IUnbakedModel
@Override
public ItemOverrideList getOverrides()
{
return ItemOverrideList.NONE;
return ItemOverrideList.EMPTY;
}
@Override
@@ -162,45 +162,45 @@ public final class ModelLoader extends ModelBakery
return bakedRegistry;
isLoading = true;
missingModel = ModelLoaderRegistry.getMissingModel();
stateModels.put(MODEL_MISSING, missingModel);
final Set<ResourceLocation> textures = Sets.newHashSet(ModelLoaderRegistry.getTextures());
textures.remove(MissingTextureSprite.func_195675_b());
textures.remove(MissingTextureSprite.getLocation());
textures.addAll(LOCATIONS_BUILTIN_TEXTURES);
textureMap.func_195426_a(resourceManager, textures);
textureMap.stitch(resourceManager, textures);
field_209607_C.forEach((p_209602_2_, p_209602_3_) -> {
p_209602_3_.getValidStates().forEach((p_209601_3_) -> {
this.func_209594_a(map, BlockModelShapes.func_209553_a(p_209602_2_, p_209601_3_));
this.getUnbakedModel(map, BlockModelShapes.getModelLocation(p_209602_2_, p_209601_3_));
});
});
for(ResourceLocation resourcelocation : Item.REGISTRY.getKeys()) {
this.func_209594_a(map, new ModelResourceLocation(resourcelocation, "inventory"));
this.getUnbakedModel(map, new ModelResourceLocation(resourcelocation, "inventory"));
}
this.func_209594_a(map, new ModelResourceLocation("minecraft:trident_in_hand#inventory"));
this.getUnbakedModel(map, new ModelResourceLocation("minecraft:trident_in_hand#inventory"));
Set<String> set = Sets.<String>newLinkedHashSet();
Set<ResourceLocation> set1 = (Set)map.values().stream().<ResourceLocation>flatMap((p_209595_2_) -> {
return p_209595_2_.func_209559_a(this::func_209597_a, set).stream();
return p_209595_2_.getTextures(this::getUnbakedModel, set).stream();
}).collect(Collectors.toSet());
set1.addAll(LOCATIONS_BUILTIN_TEXTURES);
set.forEach((p_209588_0_) -> {
LOGGER.warn("Unable to resolve texture reference: {}", (Object)p_209588_0_);
});
this.textureMap.func_195426_a(this.resourceManager, set1);
this.textureMap.stitch(this.resourceManager, set1);
map.forEach((p_209599_1_, p_209599_2_) -> {
IBakedModel ibakedmodel = p_209599_2_.func_209558_a(this::func_209597_a, this.textureMap::func_195424_a, ModelRotation.X0_Y0, false);
IBakedModel ibakedmodel = p_209599_2_.bake(this::getUnbakedModel, this.textureMap::getSprite, ModelRotation.X0_Y0, false);
if (ibakedmodel != null) {
this.bakedRegistry.putObject(p_209599_1_, ibakedmodel);
}
});
return this.bakedRegistry;
IBakedModel missingBaked = missingModel.bake(defaultModelGetter(), defaultTextureGetter(), missingModel.getDefaultState(), false, DefaultVertexFormats.ITEM);
Map<IUnbakedModel, IBakedModel> bakedModels = Maps.newHashMap();
HashMultimap<IUnbakedModel, ModelResourceLocation> models = HashMultimap.create();
@@ -356,8 +356,8 @@ public final class ModelLoader extends ModelBakery
private final class VanillaModelWrapper implements IUnbakedModel
{
private final FaceBakery faceBakery = new FaceBakery();
private final FaceBakery faceBakery = new FaceBakery();
private final ResourceLocation location;
private final ModelBlock model;
private final boolean uvlock;
@@ -390,9 +390,9 @@ public final class ModelLoader extends ModelBakery
}
return ImmutableSet.copyOf(set);
}
@Override
public Collection<ResourceLocation> func_209559_a(Function<ResourceLocation, IUnbakedModel> p_209559_1_, Set<String> p_209559_2_)
public Collection<ResourceLocation> getTextures(Function<ResourceLocation, IUnbakedModel> modelGetter, Set<String> missingTextureErrors)
{
// setting parent here to make textures resolve properly
if(model.getParentLocation() != null)
@@ -471,7 +471,7 @@ public final class ModelLoader extends ModelBakery
{
return new ItemLayerModel(model).bake(modelGetter, bakedTextureGetter, perState, uvlock, format);
}
if(model == ModelBakery.MODEL_ENTITY) return new BuiltInModel(transforms, model.func_209568_a(model, modelGetter, bakedTextureGetter));
if(model == ModelBakery.MODEL_ENTITY) return new BuiltInModel(transforms, model.getOverrides(model, modelGetter, bakedTextureGetter));
return bakeNormal(model, perState, state, newTransforms, format, modelGetter, bakedTextureGetter, uvlock);
}
@@ -479,7 +479,7 @@ public final class ModelLoader extends ModelBakery
{
final TRSRTransformation baseState = modelState.apply(Optional.empty()).orElse(TRSRTransformation.identity());
TextureAtlasSprite particle = bakedTextureGetter.apply(new ResourceLocation(model.resolveTextureName("particle")));
SimpleBakedModel.Builder builder = (new SimpleBakedModel.Builder(model, model.func_209568_a(model, modelGetter, bakedTextureGetter))).setTexture(particle);
SimpleBakedModel.Builder builder = (new SimpleBakedModel.Builder(model, model.getOverrides(model, modelGetter, bakedTextureGetter))).setTexture(particle);
for(int i = 0; i < model.getElements().size(); i++)
{
if(modelState.apply(Optional.of(Models.getHiddenModelPart(ImmutableList.of(Integer.toString(i))))).isPresent())
@@ -499,7 +499,7 @@ public final class ModelLoader extends ModelBakery
{
TextureAtlasSprite textureatlassprite1 = bakedTextureGetter.apply(new ResourceLocation(model.resolveTextureName(e.getValue().texture)));
if (e.getValue().cullFace == null || !TRSRTransformation.isInteger(transformation.getMatrix()))
if (e.getValue().cullFace == null || !TRSRTransformation.isInteger(transformation.getMatrixVec()))
{
builder.addGeneralQuad(ModelBlock.makeBakedQuad(part, e.getValue(), textureatlassprite1, e.getKey(), transformation, uvLocked));
}
@@ -510,12 +510,12 @@ public final class ModelLoader extends ModelBakery
}
}
return new PerspectiveMapWrapper(builder.makeBakedModel(), perState)
return new PerspectiveMapWrapper(builder.build(), perState)
{
private final ItemOverrideList overrides = new AnimationItemOverrideList(VanillaModelWrapper.this, modelState, format, bakedTextureGetter, super.getOverrides());
@Override
public List<BakedQuad> func_200117_a(@Nullable IBlockState state, @Nullable EnumFacing side, Random rand)
public List<BakedQuad> getQuads(@Nullable IBlockState state, @Nullable EnumFacing side, Random rand)
{
if(state instanceof IExtendedBlockState)
{
@@ -526,11 +526,11 @@ public final class ModelLoader extends ModelBakery
IExtendedBlockState newExState = (IExtendedBlockState) exState.withProperty(Properties.AnimationProperty, null);
if(newState != null)
{
return VanillaModelWrapper.this.bake(modelGetter, bakedTextureGetter, new ModelStateComposition(modelState, newState), uvlock, format).func_200117_a(newExState, side, rand);
return VanillaModelWrapper.this.bake(modelGetter, bakedTextureGetter, new ModelStateComposition(modelState, newState), uvlock, format).getQuads(newExState, side, rand);
}
}
}
return super.func_200117_a(state, side, rand);
return super.getQuads(state, side, rand);
}
@Override
@@ -675,7 +675,7 @@ public final class ModelLoader extends ModelBakery
ModelLoaderRegistry.getModelOrMissing(location);
}
//FMLLog.getLogger().error("Exception resolving indirect dependencies for model" + loc, e);
textures.addAll(model.func_209559_a(ModelLoader.defaultModelGetter(), new HashSet<>())); // Kick this, just in case.
textures.addAll(model.getTextures(ModelLoader.defaultModelGetter(), new HashSet<>())); // Kick this, just in case.
models.add(model);
@@ -703,15 +703,15 @@ public final class ModelLoader extends ModelBakery
this.models = models;
this.defaultState = defaultState;
}
@Override
public Collection<ResourceLocation> getOverrideLocations()
public Collection<ResourceLocation> getOverrideLocations()
{
return ImmutableList.copyOf(locations);
}
@Override
public Collection<ResourceLocation> func_209559_a(Function<ResourceLocation, IUnbakedModel> p_209559_1_, Set<String> p_209559_2_)
public Collection<ResourceLocation> getTextures(Function<ResourceLocation, IUnbakedModel> modelGetter, Set<String> missingTextureErrors)
{
return ImmutableSet.copyOf(textures);
}
@@ -734,7 +734,7 @@ public final class ModelLoader extends ModelBakery
IUnbakedModel model = models.get(i);
builder.add(model.bake(modelGetter, bakedTextureGetter, MultiModelState.getPartState(state, model, i), uvlock, format), variants.get(i).getWeight());
}
return builder.func_209614_a();
return builder.build();
}
@Override
@@ -757,7 +757,7 @@ public final class ModelLoader extends ModelBakery
for(int i = 0; i < this.variants.size(); i++)
{
IUnbakedModel retextured = this.models.get(i).retexture(textures);
modelTextures.addAll(retextured.func_209559_a(ModelLoader.defaultModelGetter(), new HashSet<>()));
modelTextures.addAll(retextured.getTextures(ModelLoader.defaultModelGetter(), new HashSet<>()));
retexturedModels.add(retextured);
builder.add(Pair.of(retextured, this.variants.get(i).getState()));
}
@@ -850,7 +850,7 @@ public final class ModelLoader extends ModelBakery
// NOOP, handled in loader
@Override
public void func_195410_a(IResourceManager resourceManager) {}
public void onResourceManagerReload(IResourceManager resourceManager) {}
@Override
public boolean accepts(ResourceLocation modelLocation)
@@ -887,17 +887,17 @@ public final class ModelLoader extends ModelBakery
return "VanillaLoader.INSTANCE";
}
}
// Temporary to compile things
public static final class White {
public static final ResourceLocation LOCATION = new ResourceLocation("white");
public static final TextureAtlasSprite INSTANCE = MissingTextureSprite.func_195677_a();
public static final ResourceLocation LOCATION = new ResourceLocation("white");
public static final TextureAtlasSprite INSTANCE = MissingTextureSprite.getSprite();
}
/**
* 16x16 pure white sprite.
*/
/*/ TODO Custom TAS
/*/ TODO Custom TAS
public static final class White extends TextureAtlasSprite
{
public static final ResourceLocation LOCATION = new ResourceLocation("white");
@@ -955,7 +955,7 @@ public final class ModelLoader extends ModelBakery
*/
public void onPostBakeEvent(IRegistry<ModelResourceLocation, IBakedModel> modelRegistry)
{
IBakedModel missingModel = modelRegistry.getObject(MODEL_MISSING);
IBakedModel missingModel = modelRegistry.get(MODEL_MISSING);
for(Map.Entry<ResourceLocation, Exception> entry : loadingExceptions.entrySet())
{
// ignoring pure ResourceLocation arguments, all things we care about pass ModelResourceLocation
@@ -963,23 +963,23 @@ public final class ModelLoader extends ModelBakery
{
LOGGER.debug(MODELLOADING, ()-> new ModelLoaderErrorMessage((ModelResourceLocation)entry.getKey(), entry.getValue()));
final ModelResourceLocation location = (ModelResourceLocation)entry.getKey();
final IBakedModel model = modelRegistry.getObject(location);
final IBakedModel model = modelRegistry.get(location);
if(model == null)
{
modelRegistry.putObject(location, missingModel);
modelRegistry.put(location, missingModel);
}
}
}
for(ModelResourceLocation missing : missingVariants)
{
IBakedModel model = modelRegistry.getObject(missing);
IBakedModel model = modelRegistry.get(missing);
if(model == null || model == missingModel)
{
LOGGER.debug(MODELLOADING, ()-> new ModelLoaderErrorMessage(missing, null));
}
if(model == null)
{
modelRegistry.putObject(missing, missingModel);
modelRegistry.put(missing, missingModel);
}
}
loadingExceptions.clear();
@@ -1047,7 +1047,7 @@ public final class ModelLoader extends ModelBakery
{
for (Entry<Pair<IRegistryDelegate<Item>, Integer>, ModelResourceLocation> e : customModels.entrySet())
{
mesher.func_199311_a(e.getKey().getLeft().get(), e.getValue());
mesher.register(e.getKey().getLeft().get(), e.getValue());
}
}
*/
@@ -1058,10 +1058,10 @@ public final class ModelLoader extends ModelBakery
@Override
public TextureAtlasSprite apply(ResourceLocation location)
{
return Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite(location.toString());
return Minecraft.getInstance().getTextureMap().getAtlasSprite(location.toString());
}
}
private static final Function<ResourceLocation, IUnbakedModel> DEFAULT_MODEL_GETTER = ModelLoaderRegistry::getModelOrMissing;
/**
@@ -1071,10 +1071,10 @@ public final class ModelLoader extends ModelBakery
{
return DefaultTextureGetter.INSTANCE;
}
public static Function<ResourceLocation, IUnbakedModel> defaultModelGetter()
{
return DEFAULT_MODEL_GETTER;
return DEFAULT_MODEL_GETTER;
}
protected static enum VariantLoader implements ICustomModelLoader
@@ -1090,7 +1090,7 @@ public final class ModelLoader extends ModelBakery
// NOOP, handled in loader
@Override
public void func_195410_a(IResourceManager resourceManager) {}
public void onResourceManagerReload(IResourceManager resourceManager) {}
@Override
public boolean accepts(ResourceLocation modelLocation)
@@ -1101,7 +1101,7 @@ public final class ModelLoader extends ModelBakery
@Override
public IUnbakedModel loadModel(ResourceLocation modelLocation) throws Exception
{
return loader.func_209597_a(modelLocation);
return loader.getUnbakedModel(modelLocation);
}
@Override
@@ -79,7 +79,7 @@ public class ModelLoaderRegistry
public static void registerLoader(ICustomModelLoader loader)
{
loaders.add(loader);
((IReloadableResourceManager) Minecraft.getMinecraft().func_195551_G()).func_199006_a(loader);
((IReloadableResourceManager) Minecraft.getInstance().getResourceManager()).addReloadListener(loader);
}
public static boolean loaded(ResourceLocation location)
@@ -174,7 +174,7 @@ public class ModelLoaderRegistry
{
throw new LoaderException(String.format("Loader %s returned null while loading model %s", accepted, location));
}
textures.addAll(model.func_209559_a(ModelLoader.defaultModelGetter(), new HashSet<>()));
textures.addAll(model.getTextures(ModelLoader.defaultModelGetter(), new HashSet<>()));
}
finally
{
@@ -237,7 +237,7 @@ public class ModelLoaderRegistry
{
//IModel model = new FancyMissingModel(ExceptionUtils.getStackTrace(cause).replaceAll("\\t", " "));
IUnbakedModel model = new FancyMissingModel(getMissingModel(), location.toString());
textures.addAll(model.func_209559_a(null, null));
textures.addAll(model.getTextures(null, null));
return model;
}
@@ -77,7 +77,7 @@ public final class MultiLayerModel implements IUnbakedModel
}
@Override
public Collection<ResourceLocation> func_209559_a(Function<ResourceLocation, IUnbakedModel> p_209559_1_, Set<String> p_209559_2_)
public Collection<ResourceLocation> getTextures(Function<ResourceLocation, IUnbakedModel> modelGetter, Set<String> missingTextureErrors)
{
return Collections.emptyList();
}
@@ -154,7 +154,7 @@ public final class MultiLayerModel implements IUnbakedModel
}
@Override
public List<BakedQuad> func_200117_a(@Nullable IBlockState state, @Nullable EnumFacing side, Random rand)
public List<BakedQuad> getQuads(@Nullable IBlockState state, @Nullable EnumFacing side, Random rand)
{
BlockRenderLayer layer = MinecraftForgeClient.getRenderLayer();
if (layer == null)
@@ -162,12 +162,12 @@ public final class MultiLayerModel implements IUnbakedModel
ImmutableList.Builder<BakedQuad> builder = ImmutableList.builder();
for (IBakedModel model : models.values())
{
builder.addAll(model.func_200117_a(state, side, rand));
builder.addAll(model.getQuads(state, side, rand));
}
return builder.build();
}
// assumes that child model will handle this state properly. FIXME?
return models.getOrDefault(Optional.of(layer), missing).func_200117_a(state, side, rand);
return models.getOrDefault(Optional.of(layer), missing).getQuads(state, side, rand);
}
@Override
@@ -209,7 +209,7 @@ public final class MultiLayerModel implements IUnbakedModel
@Override
public ItemOverrideList getOverrides()
{
return ItemOverrideList.NONE;
return ItemOverrideList.EMPTY;
}
}
@@ -218,7 +218,7 @@ public final class MultiLayerModel implements IUnbakedModel
INSTANCE;
@Override
public void func_195410_a(IResourceManager resourceManager) {}
public void onResourceManagerReload(IResourceManager resourceManager) {}
@Override
public boolean accepts(ResourceLocation modelLocation)
@@ -63,7 +63,7 @@ import com.google.common.collect.Sets;
public final class MultiModel implements IUnbakedModel
{
private static final Logger LOGGER = LogManager.getLogger();
private static final class Baked implements IBakedModel
{
private final ResourceLocation location;
@@ -76,7 +76,7 @@ public final class MultiModel implements IUnbakedModel
private final ItemOverrideList overrides = new ItemOverrideList()
{
@Override
public IBakedModel func_209581_a(IBakedModel originalModel, ItemStack stack, @Nullable World world, @Nullable EntityLivingBase entity)
public IBakedModel getModelWithOverrides(IBakedModel originalModel, ItemStack stack, @Nullable World world, @Nullable EntityLivingBase entity)
{
if(originalModel != Baked.this)
{
@@ -87,7 +87,7 @@ public final class MultiModel implements IUnbakedModel
if(base != null)
{
newBase = base.getOverrides().func_209581_a(base, stack, world, entity);
newBase = base.getOverrides().getModelWithOverrides(base, stack, world, entity);
if(base != newBase)
{
dirty = true;
@@ -96,7 +96,7 @@ public final class MultiModel implements IUnbakedModel
ImmutableMap.Builder<String, IBakedModel> builder = ImmutableMap.builder();
for(Map.Entry<String, IBakedModel> entry : parts.entrySet())
{
IBakedModel newPart = entry.getValue().getOverrides().func_209581_a(entry.getValue(), stack, world, entity);
IBakedModel newPart = entry.getValue().getOverrides().getModelWithOverrides(entry.getValue(), stack, world, entity);
builder.put(entry.getKey(), newPart);
if(entry.getValue() != newPart)
{
@@ -188,16 +188,16 @@ public final class MultiModel implements IUnbakedModel
}
@Override
public List<BakedQuad> func_200117_a(@Nullable IBlockState state, @Nullable EnumFacing side, Random rand)
public List<BakedQuad> getQuads(@Nullable IBlockState state, @Nullable EnumFacing side, Random rand)
{
ImmutableList.Builder<BakedQuad> quads = ImmutableList.builder();
if (base != null)
{
quads.addAll(base.func_200117_a(state, side, rand));
quads.addAll(base.getQuads(state, side, rand));
}
for (IBakedModel bakedPart : parts.values())
{
quads.addAll(bakedPart.func_200117_a(state, side, rand));
quads.addAll(bakedPart.getQuads(state, side, rand));
}
return quads.build();
}
@@ -207,7 +207,7 @@ public final class MultiModel implements IUnbakedModel
{
Pair<Baked, TRSRTransformation> p = transforms.get(cameraTransformType);
if (p == null) return Pair.of(this, null);
return Pair.of(p.getLeft(), p.getRight().getMatrix());
return Pair.of(p.getLeft(), p.getRight().getMatrixVec());
}
@Override
@@ -247,9 +247,9 @@ public final class MultiModel implements IUnbakedModel
{
this(location, base, ImmutableMap.copyOf(parts));
}
@Override
public Collection<ResourceLocation> getOverrideLocations()
public Collection<ResourceLocation> getOverrideLocations()
{
Set<ResourceLocation> deps = Sets.newHashSet();
@@ -261,17 +261,17 @@ public final class MultiModel implements IUnbakedModel
return deps;
}
@Override
public Collection<ResourceLocation> func_209559_a(Function<ResourceLocation, IUnbakedModel> modelGetter, Set<String> missingTextures)
public Collection<ResourceLocation> getTextures(Function<ResourceLocation, IUnbakedModel> modelGetter, Set<String> missingTextures)
{
Set<ResourceLocation> deps = Sets.newHashSet();
if (base != null)
deps.addAll(base.func_209559_a(modelGetter, missingTextures));
deps.addAll(base.getTextures(modelGetter, missingTextures));
for (Pair<IUnbakedModel, IModelState> pair : parts.values())
deps.addAll(pair.getLeft().func_209559_a(modelGetter, missingTextures));
deps.addAll(pair.getLeft().getTextures(modelGetter, missingTextures));
return deps;
}
@@ -88,7 +88,7 @@ public class PerspectiveMapWrapper implements IBakedModel
TRSRTransformation tr = transforms.getOrDefault(cameraTransformType, TRSRTransformation.identity());
if (!tr.isIdentity())
{
return Pair.of(model, TRSRTransformation.blockCornerToCenter(tr).getMatrix());
return Pair.of(model, TRSRTransformation.blockCornerToCenter(tr).getMatrixVec());
}
return Pair.of(model, null);
}
@@ -98,7 +98,7 @@ public class PerspectiveMapWrapper implements IBakedModel
TRSRTransformation tr = state.apply(Optional.of(cameraTransformType)).orElse(TRSRTransformation.identity());
if (!tr.isIdentity())
{
return Pair.of(model, TRSRTransformation.blockCornerToCenter(tr).getMatrix());
return Pair.of(model, TRSRTransformation.blockCornerToCenter(tr).getMatrixVec());
}
return Pair.of(model, null);
}
@@ -110,7 +110,7 @@ public class PerspectiveMapWrapper implements IBakedModel
@Override public TextureAtlasSprite getParticleTexture() { return parent.getParticleTexture(); }
@SuppressWarnings("deprecation")
@Override public ItemCameraTransforms getItemCameraTransforms() { return parent.getItemCameraTransforms(); }
@Override public List<BakedQuad> func_200117_a(@Nullable IBlockState state, @Nullable EnumFacing side, Random rand) { return parent.func_200117_a(state, side, rand); }
@Override public List<BakedQuad> getQuads(@Nullable IBlockState state, @Nullable EnumFacing side, Random rand) { return parent.getQuads(state, side, rand); }
@Override public ItemOverrideList getOverrides() { return parent.getOverrides(); }
@Override
@@ -47,10 +47,10 @@ public enum Animation
{
if (worldRef == null || worldRef.get() != world)
{
epochTime = world.getTotalWorldTime();
epochTime = world.getGameTime();
worldRef = new WeakReference<>(world);
}
return (world.getTotalWorldTime() - epochTime + tickProgress) / 20;
return (world.getGameTime() - epochTime + tickProgress) / 20;
}
/**
@@ -65,7 +65,7 @@ public final class AnimationItemOverrideList extends ItemOverrideList
}
@Override
public IBakedModel func_209581_a(IBakedModel originalModel, ItemStack stack, @Nullable World world, @Nullable EntityLivingBase entity)
public IBakedModel getModelWithOverrides(IBakedModel originalModel, ItemStack stack, @Nullable World world, @Nullable EntityLivingBase entity)
{
return stack.getCapability(CapabilityAnimation.ANIMATION_CAPABILITY, null)
.map(asm ->
@@ -78,12 +78,12 @@ public final class AnimationItemOverrideList extends ItemOverrideList
}
if(world == null)
{
w = Minecraft.getMinecraft().world;
w = Minecraft.getInstance().world;
}
return asm.apply(Animation.getWorldTime(world, Animation.getPartialTickTime())).getLeft();
})
// TODO where should uvlock data come from?
.map(state -> model.bake(ModelLoader.defaultModelGetter(), bakedTextureGetter, new ModelStateComposition(state, this.state), false, format))
.orElseGet(() -> super.func_209581_a(originalModel, stack, world, entity));
.orElseGet(() -> super.getModelWithOverrides(originalModel, stack, world, entity));
}
}
@@ -82,7 +82,7 @@ public class AnimationModelBase<T extends Entity> extends ModelBase implements I
RenderHelper.disableStandardItemLighting();
GlStateManager.pushMatrix();
GlStateManager.rotate(180, 0, 0, 1);
GlStateManager.rotatef(180, 0, 0, 1);
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder builder = tessellator.getBuffer();
builder.begin(GL11.GL_QUADS, DefaultVertexFormats.BLOCK);
@@ -95,7 +95,7 @@ public class AnimationModelBase<T extends Entity> extends ModelBase implements I
boolean empty = true;
Random random = new Random();
random.setSeed(42);
List<BakedQuad> quads = bakedModel.func_200117_a(null, null, random);
List<BakedQuad> quads = bakedModel.getQuads(null, null, random);
if(!quads.isEmpty())
{
lighter.updateBlockInfo();
@@ -108,7 +108,7 @@ public class AnimationModelBase<T extends Entity> extends ModelBase implements I
for(EnumFacing side : EnumFacing.values())
{
random.setSeed(42);
quads = bakedModel.func_200117_a(null, side, random);
quads = bakedModel.getQuads(null, side, random);
if(!quads.isEmpty())
{
if(empty) lighter.updateBlockInfo();
@@ -56,13 +56,13 @@ public class AnimationTESR<T extends TileEntity> extends FastTESR<T> implements
{
return;
}
if(blockRenderer == null) blockRenderer = Minecraft.getMinecraft().getBlockRendererDispatcher();
if(blockRenderer == null) blockRenderer = Minecraft.getInstance().getBlockRendererDispatcher();
BlockPos pos = te.getPos();
IWorldReader world = MinecraftForgeClient.getRegionRenderCache(te.getWorld(), pos);
IBlockState state = world.getBlockState(pos);
if(state.getBlock().getBlockState().getProperties().contains(Properties.StaticProperty))
if(state.getBlock().getStateContainer().getProperties().contains(Properties.StaticProperty))
{
state = state.func_206870_a(Properties.StaticProperty, false);
state = state.with(Properties.StaticProperty, false);
}
if(state instanceof IExtendedBlockState)
{
@@ -76,12 +76,12 @@ public class AnimationTESR<T extends TileEntity> extends FastTESR<T> implements
handleEvents(te, time, pair.getRight());
// TODO: caching?
IBakedModel model = blockRenderer.getBlockModelShapes().getModelForState(exState.getClean());
IBakedModel model = blockRenderer.getBlockModelShapes().getModel(exState.getClean());
IExtendedBlockState animState = (IExtendedBlockState) exState.withProperty(Properties.AnimationProperty, pair.getLeft());
renderer.setTranslation(x - pos.getX(), y - pos.getY(), z - pos.getZ());
blockRenderer.getBlockModelRenderer().func_199324_a(world, model, animState, pos, renderer, false, new Random(), 42);
blockRenderer.getBlockModelRenderer().renderModel(world, model, animState, pos, renderer, false, new Random(), 42);
});
}
}
@@ -34,7 +34,7 @@ import net.minecraft.tileentity.TileEntity;
public abstract class FastTESR<T extends TileEntity> extends TileEntityRenderer<T>
{
@Override
public final void func_199341_a(T te, double x, double y, double z, float partialTicks, int destroyStage)
public final void render(T te, double x, double y, double z, float partialTicks, int destroyStage)
{
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder buffer = tessellator.getBuffer();
@@ -71,8 +71,8 @@ import com.google.gson.annotations.SerializedName;
public class ModelBlockAnimation
{
private static final Logger LOGGER = LogManager.getLogger();
private static final Logger LOGGER = LogManager.getLogger();
private final ImmutableMap<String, ImmutableMap<String, float[]>> joints;
private final ImmutableMap<String, MBClip> clips;
private transient ImmutableMultimap<Integer, MBJointWeight> jointIndexMap;
@@ -534,7 +534,7 @@ public class ModelBlockAnimation
if(trOp.isPresent() && !trOp.get().isIdentity())
{
float w = info.getWeights().get(i)[0];
tmp = trOp.get().getMatrix();
tmp = trOp.get().getMatrixVec();
tmp.mul(w);
m.add(tmp);
weight += w;
@@ -557,9 +557,9 @@ public class ModelBlockAnimation
{
try
{
try (IResource resource = manager.func_199002_a(armatureLocation))
try (IResource resource = manager.getResource(armatureLocation))
{
ModelBlockAnimation mba = mbaGson.fromJson(new InputStreamReader(resource.func_199027_b(), StandardCharsets.UTF_8), ModelBlockAnimation.class);
ModelBlockAnimation mba = mbaGson.fromJson(new InputStreamReader(resource.getInputStream(), StandardCharsets.UTF_8), ModelBlockAnimation.class);
//String json = mbaGson.toJson(mba);
return mba;
}
@@ -98,8 +98,8 @@ import com.google.gson.JsonParser;
public enum B3DLoader implements ICustomModelLoader
{
INSTANCE;
private static final Logger LOGGER = LogManager.getLogger();
private static final Logger LOGGER = LogManager.getLogger();
private IResourceManager manager;
@@ -112,7 +112,7 @@ public enum B3DLoader implements ICustomModelLoader
}
@Override
public void func_195410_a(IResourceManager manager)
public void onResourceManagerReload(IResourceManager manager)
{
this.manager = manager;
cache.clear();
@@ -136,17 +136,17 @@ public enum B3DLoader implements ICustomModelLoader
{
try
{
resource = manager.func_199002_a(file);
resource = manager.getResource(file);
}
catch(FileNotFoundException e)
{
if(modelLocation.getPath().startsWith("models/block/"))
resource = manager.func_199002_a(new ResourceLocation(file.getNamespace(), "models/item/" + file.getPath().substring("models/block/".length())));
resource = manager.getResource(new ResourceLocation(file.getNamespace(), "models/item/" + file.getPath().substring("models/block/".length())));
else if(modelLocation.getPath().startsWith("models/item/"))
resource = manager.func_199002_a(new ResourceLocation(file.getNamespace(), "models/block/" + file.getPath().substring("models/item/".length())));
resource = manager.getResource(new ResourceLocation(file.getNamespace(), "models/block/" + file.getPath().substring("models/item/".length())));
else throw e;
}
B3DModel.Parser parser = new B3DModel.Parser(resource.func_199027_b());
B3DModel.Parser parser = new B3DModel.Parser(resource.getInputStream());
B3DModel model = parser.parse();
cache.put(file, model);
}
@@ -365,7 +365,7 @@ public enum B3DLoader implements ICustomModelLoader
@Override
public TRSRTransformation getInvBindPose()
{
Matrix4f m = new TRSRTransformation(node.getPos(), node.getRot(), node.getScale(), null).getMatrix();
Matrix4f m = new TRSRTransformation(node.getPos(), node.getRot(), node.getScale(), null).getMatrixVec();
m.invert();
TRSRTransformation pose = new TRSRTransformation(m);
@@ -452,17 +452,17 @@ public enum B3DLoader implements ICustomModelLoader
if(path.endsWith(".png")) path = path.substring(0, path.length() - ".png".length());
return path;
}
@Override
public Collection<ResourceLocation> func_209559_a(Function<ResourceLocation, IUnbakedModel> p_209559_1_, Set<String> p_209559_2_)
public Collection<ResourceLocation> getTextures(Function<ResourceLocation, IUnbakedModel> modelGetter, Set<String> missingTextureErrors)
{
return Collections2.filter(textures.values(), loc -> !loc.getPath().startsWith("#"));
}
@Override
public Collection<ResourceLocation> getOverrideLocations()
public Collection<ResourceLocation> getOverrideLocations()
{
return Collections.emptyList();
return Collections.emptyList();
}
@Override
@@ -647,7 +647,7 @@ public enum B3DLoader implements ICustomModelLoader
}
@Override
public List<BakedQuad> func_200117_a(@Nullable IBlockState state, @Nullable EnumFacing side, Random rand)
public List<BakedQuad> getQuads(@Nullable IBlockState state, @Nullable EnumFacing side, Random rand)
{
if(side != null) return ImmutableList.of();
IModelState modelState = this.state;
@@ -723,7 +723,7 @@ public enum B3DLoader implements ICustomModelLoader
@Override
public Matrix4f apply(Node<?> node)
{
return global.compose(localCache.getUnchecked(node)).getMatrix();
return global.compose(localCache.getUnchecked(node)).getMatrixVec();
}
});
for(Face f : faces)
@@ -834,7 +834,7 @@ public enum B3DLoader implements ICustomModelLoader
public ItemOverrideList getOverrides()
{
// TODO handle items
return ItemOverrideList.NONE;
return ItemOverrideList.EMPTY;
}
}
}
@@ -58,7 +58,7 @@ public enum OBJLoader implements ICustomModelLoader {
}
@Override
public void func_195410_a(IResourceManager resourceManager)
public void onResourceManagerReload(IResourceManager resourceManager)
{
this.manager = resourceManager;
cache.clear();
@@ -82,14 +82,14 @@ public enum OBJLoader implements ICustomModelLoader {
{
try
{
resource = manager.func_199002_a(file);
resource = manager.getResource(file);
}
catch (FileNotFoundException e)
{
if (modelLocation.getPath().startsWith("models/block/"))
resource = manager.func_199002_a(new ResourceLocation(file.getNamespace(), "models/item/" + file.getPath().substring("models/block/".length())));
resource = manager.getResource(new ResourceLocation(file.getNamespace(), "models/item/" + file.getPath().substring("models/block/".length())));
else if (modelLocation.getPath().startsWith("models/item/"))
resource = manager.func_199002_a(new ResourceLocation(file.getNamespace(), "models/block/" + file.getPath().substring("models/item/".length())));
resource = manager.getResource(new ResourceLocation(file.getNamespace(), "models/block/" + file.getPath().substring("models/item/".length())));
else throw e;
}
OBJModel.Parser parser = new OBJModel.Parser(resource, manager);
@@ -83,8 +83,8 @@ import com.google.common.collect.Maps;
public class OBJModel implements IUnbakedModel
{
private static final Logger LOGGER = LogManager.getLogger();
private static final Logger LOGGER = LogManager.getLogger();
//private Gson GSON = new GsonBuilder().create();
private MaterialLibrary matLib;
private final ResourceLocation modelLocation;
@@ -103,7 +103,7 @@ public class OBJModel implements IUnbakedModel
}
@Override
public Collection<ResourceLocation> func_209559_a(Function<ResourceLocation, IUnbakedModel> p_209559_1_, Set<String> p_209559_2_)
public Collection<ResourceLocation> getTextures(Function<ResourceLocation, IUnbakedModel> modelGetter, Set<String> missingTextureErrors)
{
Iterator<Material> materialIterator = this.matLib.materials.values().iterator();
List<ResourceLocation> textures = Lists.newArrayList();
@@ -116,11 +116,11 @@ public class OBJModel implements IUnbakedModel
}
return textures;
}
@Override
public Collection<ResourceLocation> getOverrideLocations()
public Collection<ResourceLocation> getOverrideLocations()
{
return Collections.emptyList();
return Collections.emptyList();
}
@Override
@@ -216,8 +216,8 @@ public class OBJModel implements IUnbakedModel
public Parser(IResource from, IResourceManager manager) throws IOException
{
this.manager = manager;
this.objFrom = from.func_199029_a();
this.objStream = new InputStreamReader(from.func_199027_b(), StandardCharsets.UTF_8);
this.objFrom = from.getLocation();
this.objStream = new InputStreamReader(from.getInputStream(), StandardCharsets.UTF_8);
this.objReader = new BufferedReader(objStream);
}
@@ -517,7 +517,7 @@ public class OBJModel implements IUnbakedModel
String domain = from.getNamespace();
if (!path.contains("/"))
path = from.getPath().substring(0, from.getPath().lastIndexOf("/") + 1) + path;
mtlStream = new InputStreamReader(manager.func_199002_a(new ResourceLocation(domain, path)).func_199027_b(), StandardCharsets.UTF_8);
mtlStream = new InputStreamReader(manager.getResource(new ResourceLocation(domain, path)).getInputStream(), StandardCharsets.UTF_8);
mtlReader = new BufferedReader(mtlStream);
String currentLine = "";
@@ -857,7 +857,7 @@ public class OBJModel implements IUnbakedModel
public Face bake(TRSRTransformation transform)
{
Matrix4f m = transform.getMatrix();
Matrix4f m = transform.getMatrixVec();
Matrix3f mn = null;
Vertex[] vertices = new Vertex[verts.length];
// Normal[] normals = norms != null ? new Normal[norms.length] : null;
@@ -1318,7 +1318,7 @@ public class OBJModel implements IUnbakedModel
// FIXME: merge with getQuads
@Override
public List<BakedQuad> func_200117_a(IBlockState blockState, EnumFacing side, Random rand)
public List<BakedQuad> getQuads(IBlockState blockState, EnumFacing side, Random rand)
{
if (side != null) return ImmutableList.of();
if (quads == null)
@@ -1598,7 +1598,7 @@ public class OBJModel implements IUnbakedModel
@Override
public ItemOverrideList getOverrides()
{
return ItemOverrideList.NONE;
return ItemOverrideList.EMPTY;
}
}
@@ -60,7 +60,7 @@ public class BlockInfo
{
if(cachedTint == tint) return cachedMultiplier;
cachedTint = tint;
cachedMultiplier = colors.colorMultiplier(state, world, blockPos, tint);
cachedMultiplier = colors.getColor(state, world, blockPos, tint);
return cachedMultiplier;
}
@@ -52,7 +52,7 @@ public class ForgeBlockModelRenderer extends BlockModelRenderer
}
@Override
public boolean func_199325_c(IWorldReader world, IBakedModel model, IBlockState state, BlockPos pos, BufferBuilder buffer, boolean checkSides, Random rand, long seed)
public boolean renderModelFlat(IWorldReader world, IBakedModel model, IBlockState state, BlockPos pos, BufferBuilder buffer, boolean checkSides, Random rand, long seed)
{
if(ForgeMod.forgeLightPipelineEnabled)
{
@@ -68,12 +68,12 @@ public class ForgeBlockModelRenderer extends BlockModelRenderer
}
else
{
return super.func_199325_c(world, model, state, pos, buffer, checkSides, rand, seed);
return super.renderModelFlat(world, model, state, pos, buffer, checkSides, rand, seed);
}
}
@Override
public boolean func_199326_b(IWorldReader world, IBakedModel model, IBlockState state, BlockPos pos, BufferBuilder buffer, boolean checkSides, Random rand, long seed)
public boolean renderModelSmooth(IWorldReader world, IBakedModel model, IBlockState state, BlockPos pos, BufferBuilder buffer, boolean checkSides, Random rand, long seed)
{
if(ForgeMod.forgeLightPipelineEnabled)
{
@@ -89,7 +89,7 @@ public class ForgeBlockModelRenderer extends BlockModelRenderer
}
else
{
return super.func_199326_b(world, model, state, pos, buffer, checkSides, rand, seed);
return super.renderModelSmooth(world, model, state, pos, buffer, checkSides, rand, seed);
}
}
@@ -99,7 +99,7 @@ public class ForgeBlockModelRenderer extends BlockModelRenderer
lighter.setState(state);
lighter.setBlockPos(pos);
boolean empty = true;
List<BakedQuad> quads = model.func_200117_a(state, null, rand);
List<BakedQuad> quads = model.getQuads(state, null, rand);
if(!quads.isEmpty())
{
lighter.updateBlockInfo();
@@ -111,7 +111,7 @@ public class ForgeBlockModelRenderer extends BlockModelRenderer
}
for(EnumFacing side : EnumFacing.values())
{
quads = model.func_200117_a(state, side, rand);
quads = model.getQuads(state, side, rand);
if(!quads.isEmpty())
{
if(!checkSides || Block.shouldSideBeRendered(state, world, pos, side))
@@ -43,4 +43,4 @@ public abstract class TransformerConsumer implements IVertexConsumer {
}
protected abstract float[] transform(int element, float... data);
}
}
@@ -180,8 +180,8 @@ public class UnpackedBakedQuad extends BakedQuad
}
if(contractUVs)
{
float tX = texture.getIconWidth() / (texture.getMaxU() - texture.getMinU());
float tY = texture.getIconHeight() / (texture.getMaxV() - texture.getMinV());
float tX = texture.getWidth() / (texture.getMaxU() - texture.getMinU());
float tY = texture.getHeight() / (texture.getMaxV() - texture.getMinV());
float tS = tX > tY ? tX : tY;
float ep = 1f / (tS * 0x100);
int uve = 0;
@@ -235,4 +235,4 @@ public class UnpackedBakedQuad extends BakedQuad
return new UnpackedBakedQuad(unpackedData, tint, orientation, texture, applyDiffuseLighting, format);
}
}
}
}
@@ -109,7 +109,7 @@ public class VertexLighterFlat extends QuadGatheringTransformer
private static VertexFormat withNormal(VertexFormat format)
{
if (format == null || format.func_207751_b()) return format;
if (format == null || format.hasNormal()) return format;
return new VertexFormat(format).addElement(NORMAL_4F);
}