Merge remote-tracking branch 'origin/1.14.x' into 1.14.x

This commit is contained in:
cpw committed 2019-06-21 22:42:33 -04:00
commit 83a0dc2ef9
17 files changed
+116 -38

No files matched your search

@@ -371,7 +371,7 @@ public class ForgeHooksClient
MinecraftForge.EVENT_BUS.post(new EntityViewRenderEvent.RenderFogEvent(fogRenderer, renderer, info, partial, mode, distance));
}
public static void onModelBake(ModelManager modelManager, Map<ModelResourceLocation, IBakedModel> modelRegistry, ModelLoader modelLoader)
public static void onModelBake(ModelManager modelManager, Map<ResourceLocation, IBakedModel> modelRegistry, ModelLoader modelLoader)
{
MinecraftForge.EVENT_BUS.post(new ModelBakeEvent(modelManager, modelRegistry, modelLoader));
modelLoader.onPostBakeEvent(modelRegistry);
@@ -24,6 +24,7 @@ import java.util.Map;
import net.minecraft.client.renderer.model.IBakedModel;
import net.minecraft.client.renderer.model.ModelManager;
import net.minecraft.client.renderer.model.ModelResourceLocation;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.model.ModelLoader;
/**
@@ -34,10 +35,10 @@ import net.minecraftforge.client.model.ModelLoader;
public class ModelBakeEvent extends net.minecraftforge.eventbus.api.Event
{
private final ModelManager modelManager;
private final Map<ModelResourceLocation, IBakedModel> modelRegistry;
private final Map<ResourceLocation, IBakedModel> modelRegistry;
private final ModelLoader modelLoader;
public ModelBakeEvent(ModelManager modelManager, Map<ModelResourceLocation, IBakedModel> modelRegistry, ModelLoader modelLoader)
public ModelBakeEvent(ModelManager modelManager, Map<ResourceLocation, IBakedModel> modelRegistry, ModelLoader modelLoader)
{
this.modelManager = modelManager;
this.modelRegistry = modelRegistry;
@@ -49,7 +50,7 @@ public class ModelBakeEvent extends net.minecraftforge.eventbus.api.Event
return modelManager;
}
public Map<ModelResourceLocation, IBakedModel> getModelRegistry()
public Map<ResourceLocation, IBakedModel> getModelRegistry()
{
return modelRegistry;
}
@@ -33,6 +33,11 @@ public class RenderGameOverlayEvent extends Event
{
return partialTicks;
}
public MainWindow getWindow()
{
return window;
}
public ElementType getType()
{
@@ -66,17 +71,20 @@ public class RenderGameOverlayEvent extends Event
}
private final float partialTicks;
private final MainWindow window;
private final ElementType type;
public RenderGameOverlayEvent(float partialTicks, MainWindow resolution)
public RenderGameOverlayEvent(float partialTicks, MainWindow window)
{
this.partialTicks = partialTicks;
this.window = window;
this.type = null;
}
private RenderGameOverlayEvent(RenderGameOverlayEvent parent, ElementType type)
{
this.partialTicks = parent.getPartialTicks();
this.window = parent.getWindow();
this.type = type;
}
@@ -943,7 +943,7 @@ public final class ModelLoader extends ModelBakery
/**
* Internal, do not use.
*/
public void onPostBakeEvent(Map<ModelResourceLocation, IBakedModel> modelRegistry)
public void onPostBakeEvent(Map<ResourceLocation, IBakedModel> modelRegistry)
{
IBakedModel missingModel = modelRegistry.get(MODEL_MISSING);
for(Map.Entry<ResourceLocation, Exception> entry : loadingExceptions.entrySet())
@@ -0,0 +1,13 @@
package net.minecraftforge.common.extensions;
import javax.annotation.Nullable;
import net.minecraft.entity.Entity;
public interface IForgeSelectionContext
{
default @Nullable Entity getEntity()
{
return null;
}
}
+2
View File
@@ -80,3 +80,5 @@ net/minecraft/world/storage/loot/LootEntryEmpty.<init>(II[Lnet/minecraft/world/s
net/minecraft/world/storage/loot/LootEntryItem.<init>(Lnet/minecraft/item/Item;II[Lnet/minecraft/world/storage/loot/functions/LootFunction;[Lnet/minecraft/world/storage/loot/conditions/LootCondition;Ljava/lang/String;)V=|p_i46644_1_,p_i46644_2_,p_i46644_3_,p_i46644_4_,p_i46644_5_,entryName
net/minecraft/world/storage/loot/LootEntryTable.<init>(Lnet/minecraft/util/ResourceLocation;II[Lnet/minecraft/world/storage/loot/conditions/LootCondition;Ljava/lang/String;)V=|p_i46639_1_,p_i46639_2_,p_i46639_3_,p_i46639_4_,entryName
net/minecraft/world/storage/loot/LootPool.<init>([Lnet/minecraft/world/storage/loot/LootEntry;[Lnet/minecraft/world/storage/loot/conditions/LootCondition;Lnet/minecraft/world/storage/loot/RandomValueRange;Lnet/minecraft/world/storage/loot/RandomValueRange;Ljava/lang/String;)V=|p_i46643_1_,p_i46643_2_,p_i46643_3_,p_i46643_4_
net/minecraft/util/shapes/EntitySelectionContext.<init>(Lnet/minecraft/entity/Entity;ZDLnet/minecraft/item/Item;)V=|entity,p_i51181_1_,p_i51181_2_,p_i51181_4_
@@ -40,8 +40,8 @@ import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
import net.minecraftforge.registries.ObjectHolder;
import net.minecraftforge.eventbus.api.SubscribeEvent;
@Mod(MaterialFogColorTest.MODID)
@Mod.EventBusSubscriber
//@Mod(MaterialFogColorTest.MODID)
//@Mod.EventBusSubscriber
public class MaterialFogColorTest
{
static final String MODID = "fog_color_in_material_test";
@@ -42,7 +42,7 @@ public class PathNodeTypeTest
@ObjectHolder(BLOCK_ID)
private static final Block TEST_BLOCK = null;
private static Block TEST_BLOCK = null;
@SubscribeEvent
public static void register(RegistryEvent.Register<Block> event)
@@ -32,7 +32,7 @@ import java.util.Arrays;
import java.util.Collections;
import java.util.List;
@Mod("client_command_test")
//@Mod("client_command_test")
public class ClientCommandTest
{
/*
@@ -25,35 +25,37 @@ import com.google.common.collect.ImmutableMap;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.model.IBakedModel;
import net.minecraft.client.renderer.model.ModelBakery;
import net.minecraft.client.renderer.model.ModelResourceLocation;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.client.event.ModelBakeEvent;
import net.minecraftforge.client.model.BasicState;
import net.minecraftforge.client.model.IModel;
import net.minecraftforge.client.model.ModelLoaderRegistry;
import net.minecraftforge.common.model.TRSRTransformation;
import net.minecraftforge.fml.common.Mod;
//@Mod(modid = BlockstateRetextureTest.MODID, name = "BlockstateRetextureTest", version = BlockstateRetextureTest.VERSION, acceptableRemoteVersions = "*", clientSideOnly = true)
@Mod(BlockstateRetextureTest.MODID)
public class BlockstateRetextureTest
{
public static final String MODID = "forge_blockstate_retexture_test";
public static final String VERSION = "1.0";
static final boolean ENABLED = false;
static final boolean ENABLED = true;
private static ResourceLocation fenceName = new ResourceLocation("minecraft", "fence");
private static ModelResourceLocation fenceLocation = new ModelResourceLocation(fenceName, "east=true,north=false,south=false,west=true");
private static ResourceLocation fenceName = new ResourceLocation("minecraft", "oak_fence");
private static ModelResourceLocation fenceLocation = new ModelResourceLocation(fenceName, "east=true,north=false,south=false,waterlogged=false,west=true");
private static ResourceLocation stoneName = new ResourceLocation("minecraft", "stone");
private static ModelResourceLocation stoneLocation = new ModelResourceLocation(stoneName, "normal");
private static ModelResourceLocation stoneLocation = new ModelResourceLocation(stoneName, "");
private static Function<ResourceLocation, TextureAtlasSprite> textureGetter = location ->
{
assert location != null;
return Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite(location.toString());
return Minecraft.getInstance().getTextureMap().getAtlasSprite(location.toString());
};
//@Mod.EventBusSubscriber(modid = MODID, value = Side.CLIENT)
@Mod.EventBusSubscriber(modid = MODID, value = Dist.CLIENT)
public static class ClientEvents
{
@net.minecraftforge.eventbus.api.SubscribeEvent
@@ -64,16 +66,16 @@ public class BlockstateRetextureTest
return;
}
IModel fence = ModelLoaderRegistry.getModelOrLogError(fenceLocation, "Error loading fence model");
IModel stone = ModelLoaderRegistry.getModelOrLogError(stoneLocation, "Error loading planks model");
IModel retexturedFence = fence.retexture(ImmutableMap.of("texture", "blocks/log_oak"));
IModel retexturedStone = stone.retexture(ImmutableMap.of("all", "blocks/diamond_block"));
IModel<?> fence = ModelLoaderRegistry.getModelOrLogError(fenceLocation, "Error loading fence model");
IModel<?> stone = ModelLoaderRegistry.getModelOrLogError(stoneLocation, "Error loading stone model");
IModel<?> retexturedFence = fence.retexture(ImmutableMap.of("texture", "blocks/log_oak"));
IModel<?> retexturedStone = stone.retexture(ImmutableMap.of("all", "blocks/diamond_block"));
IBakedModel fenceResult = retexturedFence.bake(fence.getDefaultState(), DefaultVertexFormats.BLOCK, textureGetter);
IBakedModel stoneResult = retexturedStone.bake(stone.getDefaultState(), DefaultVertexFormats.BLOCK, textureGetter);
IBakedModel fenceResult = retexturedFence.bake(event.getModelLoader(), textureGetter, new BasicState(fence.getDefaultState(), true), DefaultVertexFormats.ITEM);
IBakedModel stoneResult = retexturedStone.bake(event.getModelLoader(), textureGetter, new BasicState(stone.getDefaultState(), true), DefaultVertexFormats.ITEM);
event.getModelRegistry().putObject(fenceLocation, fenceResult);
event.getModelRegistry().putObject(stoneLocation, stoneResult);
event.getModelRegistry().put(fenceLocation, fenceResult);
event.getModelRegistry().put(stoneLocation, ModelLoaderRegistry.getMissingModel().bake(event.getModelLoader(), textureGetter, new BasicState(TRSRTransformation.identity(), false), DefaultVertexFormats.ITEM));
}
}
}
+2
View File
@@ -5,6 +5,8 @@ loaderVersion="[2.0,)"
modId="forgedebugmodeldata"
#[[mods]]
# modId="forgedebugmodelloaderregistry"
[[mods]]
modId="forge_blockstate_retexture_test"
[[mods]]
modId="containertypetest"
[[mods]]