mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-17 02:55:17 +00:00
Update mappings, move mod initialization to the async loader.
Signed-off-by: cpw <[email protected]>
This commit is contained in:
35 files changed
+166
-214
No files matched your search
@@ -81,7 +81,7 @@ public class CloudRenderer implements ISelectiveResourceReloadListener
|
||||
public CloudRenderer()
|
||||
{
|
||||
// Resource manager should always be reloadable.
|
||||
((IReloadableResourceManager) mc.getResourceManager()).func_219534_a(this);
|
||||
((IReloadableResourceManager) mc.getResourceManager()).addReloadListener(this);
|
||||
}
|
||||
|
||||
private int getScale()
|
||||
@@ -273,19 +273,19 @@ public class CloudRenderer implements ISelectiveResourceReloadListener
|
||||
public void checkSettings()
|
||||
{
|
||||
boolean newEnabled = ForgeConfig.CLIENT.forgeCloudsEnabled.get()
|
||||
&& mc.gameSettings.func_216842_e() != CloudOption.OFF
|
||||
&& mc.gameSettings.getCloudOption() != CloudOption.OFF
|
||||
&& mc.world != null
|
||||
&& mc.world.dimension.isSurfaceWorld();
|
||||
|
||||
if (isBuilt()
|
||||
&& (!newEnabled
|
||||
|| mc.gameSettings.func_216842_e() != cloudMode
|
||||
|| mc.gameSettings.getCloudOption() != cloudMode
|
||||
|| mc.gameSettings.renderDistanceChunks != renderDistance))
|
||||
{
|
||||
dispose();
|
||||
}
|
||||
|
||||
cloudMode = mc.gameSettings.func_216842_e();
|
||||
cloudMode = mc.gameSettings.getCloudOption();
|
||||
renderDistance = mc.gameSettings.renderDistanceChunks;
|
||||
|
||||
if (newEnabled && !isBuilt())
|
||||
|
||||
@@ -130,14 +130,14 @@ public class ForgeIngameGui extends IngameGui
|
||||
|
||||
if (renderHelmet) renderHelmet(partialTicks);
|
||||
|
||||
if (renderPortal && !mc.player.isPotionActive(Effects.field_76431_k))
|
||||
if (renderPortal && !mc.player.isPotionActive(Effects.NAUSEA))
|
||||
{
|
||||
renderPortal(partialTicks);
|
||||
}
|
||||
|
||||
if (this.mc.field_71442_b.getCurrentGameType() == GameType.SPECTATOR)
|
||||
if (this.mc.playerController.getCurrentGameType() == GameType.SPECTATOR)
|
||||
{
|
||||
if (renderSpectatorTooltip) field_175197_u.renderTooltip(partialTicks);
|
||||
if (renderSpectatorTooltip) spectatorGui.renderTooltip(partialTicks);
|
||||
}
|
||||
else if (!this.mc.gameSettings.hideGUI)
|
||||
{
|
||||
@@ -153,7 +153,7 @@ public class ForgeIngameGui extends IngameGui
|
||||
if (renderBossHealth) renderBossHealth();
|
||||
|
||||
GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
if (this.mc.field_71442_b.shouldDrawHUD() && this.mc.getRenderViewEntity() instanceof PlayerEntity)
|
||||
if (this.mc.playerController.shouldDrawHUD() && this.mc.getRenderViewEntity() instanceof PlayerEntity)
|
||||
{
|
||||
if (renderHealth) renderHealth(this.scaledWidth, this.scaledHeight);
|
||||
if (renderArmor) renderArmor(this.scaledWidth, this.scaledHeight);
|
||||
@@ -170,10 +170,10 @@ public class ForgeIngameGui extends IngameGui
|
||||
{
|
||||
renderExperience(this.scaledWidth / 2 - 91);
|
||||
}
|
||||
if (this.mc.gameSettings.heldItemTooltips && this.mc.field_71442_b.getCurrentGameType() != GameType.SPECTATOR) {
|
||||
if (this.mc.gameSettings.heldItemTooltips && this.mc.playerController.getCurrentGameType() != GameType.SPECTATOR) {
|
||||
this.renderSelectedItem();
|
||||
} else if (this.mc.player.isSpectator()) {
|
||||
this.field_175197_u.renderSelectedItem();
|
||||
this.spectatorGui.renderSelectedItem();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -240,7 +240,7 @@ public class ForgeIngameGui extends IngameGui
|
||||
protected void renderSubtitles()
|
||||
{
|
||||
if (pre(SUBTITLES)) return;
|
||||
this.field_184049_t.render();
|
||||
this.overlaySubtitle.render();
|
||||
post(SUBTITLES);
|
||||
}
|
||||
|
||||
@@ -251,7 +251,7 @@ public class ForgeIngameGui extends IngameGui
|
||||
GlStateManager.blendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO);
|
||||
mc.getProfiler().startSection("bossHealth");
|
||||
GlStateManager.enableBlend();
|
||||
this.field_184050_w.render();
|
||||
this.overlayBoss.render();
|
||||
GlStateManager.disableBlend();
|
||||
mc.getProfiler().endSection();
|
||||
post(BOSSHEALTH);
|
||||
@@ -346,9 +346,9 @@ public class ForgeIngameGui extends IngameGui
|
||||
{
|
||||
if (pre(HOTBAR)) return;
|
||||
|
||||
if (mc.field_71442_b.getCurrentGameType() == GameType.SPECTATOR)
|
||||
if (mc.playerController.getCurrentGameType() == GameType.SPECTATOR)
|
||||
{
|
||||
this.field_175197_u.renderTooltip(partialTicks);
|
||||
this.spectatorGui.renderTooltip(partialTicks);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -438,7 +438,7 @@ public class ForgeIngameGui extends IngameGui
|
||||
if (rowHeight != 10) left_height += 10 - rowHeight;
|
||||
|
||||
int regen = -1;
|
||||
if (player.isPotionActive(Effects.field_76428_l))
|
||||
if (player.isPotionActive(Effects.REGENERATION))
|
||||
{
|
||||
regen = ticks % 25;
|
||||
}
|
||||
@@ -446,8 +446,8 @@ public class ForgeIngameGui extends IngameGui
|
||||
final int TOP = 9 * (mc.world.getWorldInfo().isHardcore() ? 5 : 0);
|
||||
final int BACKGROUND = (highlight ? 25 : 16);
|
||||
int MARGIN = 16;
|
||||
if (player.isPotionActive(Effects.field_76436_u)) MARGIN += 36;
|
||||
else if (player.isPotionActive(Effects.field_82731_v)) MARGIN += 72;
|
||||
if (player.isPotionActive(Effects.POISON)) MARGIN += 36;
|
||||
else if (player.isPotionActive(Effects.WITHER)) MARGIN += 72;
|
||||
float absorbRemaining = absorb;
|
||||
|
||||
for (int i = MathHelper.ceil((healthMax + absorb) / 2.0F) - 1; i >= 0; --i)
|
||||
@@ -520,7 +520,7 @@ public class ForgeIngameGui extends IngameGui
|
||||
int icon = 16;
|
||||
byte background = 0;
|
||||
|
||||
if (mc.player.isPotionActive(Effects.field_76438_s))
|
||||
if (mc.player.isPotionActive(Effects.HUNGER))
|
||||
{
|
||||
icon += 36;
|
||||
background = 13;
|
||||
@@ -574,7 +574,7 @@ public class ForgeIngameGui extends IngameGui
|
||||
GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
GlStateManager.disableBlend();
|
||||
|
||||
if (mc.field_71442_b.gameIsSurvivalOrAdventure())
|
||||
if (mc.playerController.gameIsSurvivalOrAdventure())
|
||||
{
|
||||
super.renderExpBar(x);
|
||||
}
|
||||
@@ -740,7 +740,7 @@ public class ForgeIngameGui extends IngameGui
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.translatef((float) event.getPosX(), (float) event.getPosY(), 0.0F);
|
||||
field_73840_e.render(ticks);
|
||||
persistantChatGUI.render(ticks);
|
||||
GlStateManager.popMatrix();
|
||||
|
||||
post(CHAT);
|
||||
@@ -751,18 +751,18 @@ public class ForgeIngameGui extends IngameGui
|
||||
protected void renderPlayerList(int width, int height)
|
||||
{
|
||||
ScoreObjective scoreobjective = this.mc.world.getScoreboard().getObjectiveInDisplaySlot(0);
|
||||
ClientPlayNetHandler handler = mc.player.field_71174_a;
|
||||
ClientPlayNetHandler handler = mc.player.connection;
|
||||
|
||||
if (mc.gameSettings.keyBindPlayerList.isKeyDown() && (!mc.isIntegratedServerRunning() || handler.getPlayerInfoMap().size() > 1 || scoreobjective != null))
|
||||
{
|
||||
this.field_175196_v.setVisible(true);
|
||||
this.overlayPlayerList.setVisible(true);
|
||||
if (pre(PLAYER_LIST)) return;
|
||||
this.field_175196_v.render(width, this.mc.world.getScoreboard(), scoreobjective);
|
||||
this.overlayPlayerList.render(width, this.mc.world.getScoreboard(), scoreobjective);
|
||||
post(PLAYER_LIST);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.field_175196_v.setVisible(false);
|
||||
this.overlayPlayerList.setVisible(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -394,14 +394,14 @@ public final class ModelLoader extends ModelBakery
|
||||
{
|
||||
if(model.getParentLocation().getPath().equals("builtin/generated"))
|
||||
{
|
||||
model.field_178315_d = field_177606_o;
|
||||
model.parent = MODEL_GENERATED;
|
||||
}
|
||||
else
|
||||
{
|
||||
IUnbakedModel parent = ModelLoaderRegistry.getModelOrLogError(model.getParentLocation(), "Could not load vanilla model parent '" + model.getParentLocation() + "' for '" + model);
|
||||
if(parent instanceof VanillaModelWrapper)
|
||||
{
|
||||
model.field_178315_d = ((VanillaModelWrapper) parent).model;
|
||||
model.parent = ((VanillaModelWrapper) parent).model;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -412,7 +412,7 @@ public final class ModelLoader extends ModelBakery
|
||||
|
||||
ImmutableSet.Builder<ResourceLocation> builder = ImmutableSet.builder();
|
||||
|
||||
if(model == ModelBakery.field_177606_o)
|
||||
if(model == ModelBakery.MODEL_GENERATED)
|
||||
{
|
||||
for(String s : ItemModelGenerator.LAYERS)
|
||||
{
|
||||
@@ -463,12 +463,12 @@ public final class ModelLoader extends ModelBakery
|
||||
tMap.putAll(PerspectiveMapWrapper.getTransforms(state));
|
||||
IModelState perState = new SimpleModelState(ImmutableMap.copyOf(tMap), state.apply(Optional.empty()));
|
||||
|
||||
if(model == ModelBakery.field_177606_o)
|
||||
if(model == ModelBakery.MODEL_GENERATED)
|
||||
{
|
||||
return new ItemLayerModel(bakery, model, format).bake(bakery, bakedTextureGetter, new BasicState(perState, uvlock), format);
|
||||
}
|
||||
TextureAtlasSprite textureatlassprite = bakedTextureGetter.apply(new ResourceLocation(model.resolveTextureName("particle")));
|
||||
if(model == ModelBakery.field_177616_r) return new BuiltInModel(transforms, model.getOverrides(bakery, model, bakedTextureGetter, format), textureatlassprite);
|
||||
if(model == ModelBakery.MODEL_ENTITY) return new BuiltInModel(transforms, model.getOverrides(bakery, model, bakedTextureGetter, format), textureatlassprite);
|
||||
return bakeNormal(bakery, model, perState, state, newTransforms, format, bakedTextureGetter, uvlock);
|
||||
}
|
||||
|
||||
@@ -496,13 +496,13 @@ public final class ModelLoader extends ModelBakery
|
||||
{
|
||||
TextureAtlasSprite textureatlassprite1 = bakedTextureGetter.apply(new ResourceLocation(model.resolveTextureName(e.getValue().texture)));
|
||||
|
||||
if (e.getValue().field_178244_b == null || !TRSRTransformation.isInteger(transformation.getMatrixVec()))
|
||||
if (e.getValue().cullFace == null || !TRSRTransformation.isInteger(transformation.getMatrixVec()))
|
||||
{
|
||||
builder.addGeneralQuad(BlockModel.makeBakedQuad(part, e.getValue(), textureatlassprite1, e.getKey(), new BasicState(transformation, uvLocked)));
|
||||
}
|
||||
else
|
||||
{
|
||||
builder.addFaceQuad(baseState.rotate(e.getValue().field_178244_b), BlockModel.makeBakedQuad(part, e.getValue(), textureatlassprite1, e.getKey(), new BasicState(transformation, uvLocked)));
|
||||
builder.addFaceQuad(baseState.rotate(e.getValue().cullFace), BlockModel.makeBakedQuad(part, e.getValue(), textureatlassprite1, e.getKey(), new BasicState(transformation, uvLocked)));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -546,7 +546,7 @@ public final class ModelLoader extends ModelBakery
|
||||
Maps.newHashMap(this.model.textures), this.model.isAmbientOcclusion(), this.model.isGui3d(), //New Textures man VERY IMPORTANT
|
||||
model.getAllTransforms(), Lists.newArrayList(model.getOverrides()));
|
||||
newModel.name = this.model.name;
|
||||
newModel.field_178315_d = this.model.field_178315_d;
|
||||
newModel.parent = this.model.parent;
|
||||
|
||||
Set<String> removed = Sets.newHashSet();
|
||||
|
||||
@@ -603,7 +603,7 @@ public final class ModelLoader extends ModelBakery
|
||||
return this;
|
||||
}
|
||||
BlockModel newModel = new BlockModel(model.getParentLocation(), model.getElements(), model.textures, value, model.isGui3d(), model.getAllTransforms(), Lists.newArrayList(model.getOverrides()));
|
||||
newModel.field_178315_d = model.field_178315_d;
|
||||
newModel.parent = model.parent;
|
||||
newModel.name = model.name;
|
||||
return new VanillaModelWrapper(location, newModel, uvlock, animation);
|
||||
}
|
||||
@@ -616,7 +616,7 @@ public final class ModelLoader extends ModelBakery
|
||||
return this;
|
||||
}
|
||||
BlockModel newModel = new BlockModel(model.getParentLocation(), model.getElements(), model.textures, model.ambientOcclusion, value, model.getAllTransforms(), Lists.newArrayList(model.getOverrides()));
|
||||
newModel.field_178315_d = model.field_178315_d;
|
||||
newModel.parent = model.parent;
|
||||
newModel.name = model.name;
|
||||
return new VanillaModelWrapper(location, newModel, uvlock, animation);
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ public class ModelLoaderRegistry
|
||||
public static void registerLoader(ICustomModelLoader loader)
|
||||
{
|
||||
loaders.add(loader);
|
||||
((IReloadableResourceManager) Minecraft.getInstance().getResourceManager()).func_219534_a(loader);
|
||||
((IReloadableResourceManager) Minecraft.getInstance().getResourceManager()).addReloadListener(loader);
|
||||
}
|
||||
|
||||
public static boolean loaded(ResourceLocation location)
|
||||
|
||||
@@ -61,7 +61,7 @@ public class BlockInfo
|
||||
{
|
||||
if(cachedTint == tint) return cachedMultiplier;
|
||||
cachedTint = tint;
|
||||
cachedMultiplier = colors.func_216860_a(state, world, blockPos, tint);
|
||||
cachedMultiplier = colors.getColor(state, world, blockPos, tint);
|
||||
return cachedMultiplier;
|
||||
}
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ public enum KeyConflictContext implements IKeyConflictContext
|
||||
@Override
|
||||
public boolean isActive()
|
||||
{
|
||||
return Minecraft.getInstance().field_71462_r != null;
|
||||
return Minecraft.getInstance().currentScreen != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -206,7 +206,7 @@ public class DimensionManager
|
||||
Validate.notNull(overworld, "Cannot Hotload Dim: Overworld is not Loaded!");
|
||||
|
||||
@SuppressWarnings("resource")
|
||||
ServerWorld world = new ServerMultiWorld(overworld, server, server.func_213207_aT(), overworld.func_217485_w(), dim, server.func_213185_aS(), new NoopChunkStatusListener());
|
||||
ServerWorld world = new ServerMultiWorld(overworld, server, server.getBackgroundExecutor(), overworld.getSaveHandler(), dim, server.getProfiler(), new NoopChunkStatusListener());
|
||||
if (!server.isSinglePlayer())
|
||||
world.getWorldInfo().setGameType(server.getGameType());
|
||||
server.forgeGetWorldMap().put(dim, world);
|
||||
@@ -218,7 +218,7 @@ public class DimensionManager
|
||||
|
||||
private static boolean canUnloadWorld(ServerWorld world)
|
||||
{
|
||||
return world.func_217469_z().isEmpty()
|
||||
return world.getForcedChunks().isEmpty()
|
||||
&& world.getPlayers().isEmpty()
|
||||
//&& !world.dimension.getType().shouldLoadSpawn()
|
||||
&& !getData(world.getDimension().getType()).keepLoaded;
|
||||
@@ -274,7 +274,7 @@ public class DimensionManager
|
||||
}
|
||||
try
|
||||
{
|
||||
w.func_217445_a(null, true, true);
|
||||
w.save(null, true, true);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
||||
@@ -237,7 +237,7 @@ public class ForgeHooks
|
||||
public static boolean onPickBlock(RayTraceResult target, PlayerEntity player, World world)
|
||||
{
|
||||
ItemStack result = ItemStack.EMPTY;
|
||||
boolean isCreative = player.playerAbilities.isCreativeMode;
|
||||
boolean isCreative = player.abilities.isCreativeMode;
|
||||
TileEntity te = null;
|
||||
|
||||
if (target.getType() == RayTraceResult.Type.BLOCK)
|
||||
@@ -274,7 +274,7 @@ public class ForgeHooks
|
||||
if (isCreative)
|
||||
{
|
||||
player.inventory.setPickedItemStack(result);
|
||||
Minecraft.getInstance().field_71442_b.sendSlotPacket(player.getHeldItem(Hand.MAIN_HAND), 36 + player.inventory.currentItem);
|
||||
Minecraft.getInstance().playerController.sendSlotPacket(player.getHeldItem(Hand.MAIN_HAND), 36 + player.inventory.currentItem);
|
||||
return true;
|
||||
}
|
||||
int slot = player.inventory.getSlotFor(result);
|
||||
@@ -283,7 +283,7 @@ public class ForgeHooks
|
||||
if (PlayerInventory.isHotbar(slot))
|
||||
player.inventory.currentItem = slot;
|
||||
else
|
||||
Minecraft.getInstance().field_71442_b.pickItem(slot);
|
||||
Minecraft.getInstance().playerController.pickItem(slot);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -431,14 +431,14 @@ public class ForgeHooks
|
||||
return null;
|
||||
|
||||
if (!player.world.isRemote)
|
||||
player.getEntityWorld().func_217376_c(event.getEntityItem());
|
||||
player.getEntityWorld().addEntity(event.getEntityItem());
|
||||
return event.getEntityItem();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static ITextComponent onServerChatEvent(ServerPlayNetHandler net, String raw, ITextComponent comp)
|
||||
{
|
||||
ServerChatEvent event = new ServerChatEvent(net.field_147369_b, raw, comp);
|
||||
ServerChatEvent event = new ServerChatEvent(net.player, raw, comp);
|
||||
if (MinecraftForge.EVENT_BUS.post(event))
|
||||
{
|
||||
return null;
|
||||
|
||||
@@ -20,8 +20,6 @@
|
||||
package net.minecraftforge.common;
|
||||
|
||||
import net.minecraftforge.eventbus.api.IEventBus;
|
||||
import net.minecraftforge.fml.BrandingControl;
|
||||
import net.minecraftforge.fml.DistExecutor;
|
||||
import net.minecraftforge.fml.ExtensionPoint;
|
||||
import net.minecraftforge.fml.FMLWorldPersistenceHook;
|
||||
import net.minecraftforge.fml.ModLoadingContext;
|
||||
@@ -43,13 +41,10 @@ import org.apache.commons.lang3.tuple.Pair;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.data.DataGenerator;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.resources.SimpleReloadableResourceManager;
|
||||
import net.minecraft.world.storage.SaveHandler;
|
||||
import net.minecraft.world.storage.WorldInfo;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.common.data.ForgeBlockTagsProvider;
|
||||
import net.minecraftforge.common.data.ForgeItemTagsProvider;
|
||||
import net.minecraftforge.common.model.animation.CapabilityAnimation;
|
||||
@@ -57,7 +52,6 @@ import net.minecraftforge.energy.CapabilityEnergy;
|
||||
import net.minecraftforge.fml.event.lifecycle.GatherDataEvent;
|
||||
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
|
||||
import net.minecraftforge.items.CapabilityItemHandler;
|
||||
import net.minecraftforge.resource.ISelectiveResourceReloadListener;
|
||||
import net.minecraftforge.fluids.UniversalBucket;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.common.gameevent.PlayerEvent;
|
||||
@@ -143,13 +137,6 @@ public class ForgeMod implements WorldPersistenceHooks.WorldPersistenceHook
|
||||
{
|
||||
VersionChecker.startVersionCheck();
|
||||
}
|
||||
|
||||
// Brandings need to recompute when language changes
|
||||
DistExecutor.runWhenOn(Dist.CLIENT, () -> () -> {
|
||||
Minecraft mc = Minecraft.getInstance();
|
||||
if (mc != null)
|
||||
((SimpleReloadableResourceManager)mc.getResourceManager()).func_219534_a((ISelectiveResourceReloadListener) BrandingControl::clearCaches);
|
||||
});
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -49,7 +49,7 @@ public class ForgeItemTagsProvider extends ItemTagsProvider
|
||||
getBuilder(Tags.Items.DYES_BROWN).add(Items.COCOA_BEANS);
|
||||
getBuilder(Tags.Items.DYES_CYAN).add(Items.CYAN_DYE);
|
||||
getBuilder(Tags.Items.DYES_GRAY).add(Items.GRAY_DYE);
|
||||
getBuilder(Tags.Items.DYES_GREEN).add(Items.field_222079_lj);
|
||||
getBuilder(Tags.Items.DYES_GREEN).add(Items.GREEN_DYE);
|
||||
getBuilder(Tags.Items.DYES_LIGHT_BLUE).add(Items.LIGHT_BLUE_DYE);
|
||||
getBuilder(Tags.Items.DYES_LIGHT_GRAY).add(Items.LIGHT_GRAY_DYE);
|
||||
getBuilder(Tags.Items.DYES_LIME).add(Items.LIME_DYE);
|
||||
@@ -57,9 +57,9 @@ public class ForgeItemTagsProvider extends ItemTagsProvider
|
||||
getBuilder(Tags.Items.DYES_ORANGE).add(Items.ORANGE_DYE);
|
||||
getBuilder(Tags.Items.DYES_PINK).add(Items.PINK_DYE);
|
||||
getBuilder(Tags.Items.DYES_PURPLE).add(Items.PURPLE_DYE);
|
||||
getBuilder(Tags.Items.DYES_RED).add(Items.field_222078_li);
|
||||
getBuilder(Tags.Items.DYES_RED).add(Items.RED_DYE);
|
||||
getBuilder(Tags.Items.DYES_WHITE).add(Items.BONE_MEAL);
|
||||
getBuilder(Tags.Items.DYES_YELLOW).add(Items.field_222081_ls);
|
||||
getBuilder(Tags.Items.DYES_YELLOW).add(Items.YELLOW_DYE);
|
||||
copy(Tags.Blocks.FENCE_GATES, Tags.Items.FENCE_GATES);
|
||||
copy(Tags.Blocks.FENCE_GATES_WOODEN, Tags.Items.FENCE_GATES_WOODEN);
|
||||
copy(Tags.Blocks.FENCES, Tags.Items.FENCES);
|
||||
|
||||
@@ -697,7 +697,7 @@ public interface IForgeBlock
|
||||
*/
|
||||
default boolean shouldCheckWeakPower(BlockState state, IWorldReader world, BlockPos pos, Direction side)
|
||||
{
|
||||
return state.func_215686_e(world, pos);
|
||||
return state.isNormalCube(world, pos);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -807,7 +807,7 @@ public interface IForgeBlock
|
||||
LivingEntity ent = (LivingEntity)entity;
|
||||
f12 = (float) EnchantmentHelper.getRespirationModifier(ent) * 0.2F;
|
||||
|
||||
if (ent.isPotionActive(Effects.field_76427_o))
|
||||
if (ent.isPotionActive(Effects.WATER_BREATHING))
|
||||
{
|
||||
f12 = f12 * 0.3F + 0.6F;
|
||||
}
|
||||
@@ -968,7 +968,7 @@ public interface IForgeBlock
|
||||
{
|
||||
if (entity instanceof EnderDragonEntity)
|
||||
{
|
||||
return !BlockTags.field_219754_W.contains(this.getBlock());
|
||||
return !BlockTags.DRAGON_IMMUNE.contains(this.getBlock());
|
||||
}
|
||||
else if ((entity instanceof WitherEntity) ||
|
||||
(entity instanceof WitherSkullEntity))
|
||||
|
||||
@@ -159,7 +159,7 @@ public interface IForgeEntity extends ICapabilitySerializable<CompoundNBT>
|
||||
*/
|
||||
default EntityClassification getClassification(boolean forSpawnCount)
|
||||
{
|
||||
return getEntity().getType().getClassiciation();
|
||||
return getEntity().getType().getClassification();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -603,7 +603,7 @@ public interface IForgeItem
|
||||
*/
|
||||
default boolean canApplyAtEnchantingTable(ItemStack stack, net.minecraft.enchantment.Enchantment enchantment)
|
||||
{
|
||||
return enchantment.field_77351_y.canEnchantItem(stack.getItem());
|
||||
return enchantment.type.canEnchantItem(stack.getItem());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -111,7 +111,7 @@ public interface IForgeItemStack extends ICapabilitySerializable<CompoundNBT>
|
||||
PlayerEntity entityplayer = context.getPlayer();
|
||||
BlockPos blockpos = context.getPos();
|
||||
CachedBlockInfo blockworldstate = new CachedBlockInfo(context.getWorld(), blockpos, false);
|
||||
if (entityplayer != null && !entityplayer.playerAbilities.allowEdit && !getStack().canPlaceOn(context.getWorld().getTags(), blockworldstate)) {
|
||||
if (entityplayer != null && !entityplayer.abilities.allowEdit && !getStack().canPlaceOn(context.getWorld().getTags(), blockworldstate)) {
|
||||
return ActionResultType.PASS;
|
||||
} else {
|
||||
Item item = getStack().getItem();
|
||||
|
||||
@@ -65,9 +65,9 @@ public interface IForgeWorldType
|
||||
default void onCustomizeButton(Minecraft mc, CreateWorldScreen gui)
|
||||
{
|
||||
if (this == WorldType.FLAT)
|
||||
mc.displayGuiScreen(new CreateFlatWorldScreen(gui, gui.field_146334_a));
|
||||
mc.displayGuiScreen(new CreateFlatWorldScreen(gui, gui.chunkProviderSettingsJson));
|
||||
else if (this == WorldType.BUFFET)
|
||||
mc.displayGuiScreen(new CreateBuffetWorldScreen(gui, gui.field_146334_a));
|
||||
mc.displayGuiScreen(new CreateBuffetWorldScreen(gui, gui.chunkProviderSettingsJson));
|
||||
}
|
||||
|
||||
default boolean handleSlimeSpawnReduction(java.util.Random random, World world)
|
||||
|
||||
@@ -345,7 +345,7 @@ public class ForgeEventFactory
|
||||
if (MinecraftForge.EVENT_BUS.post(event)) return -1;
|
||||
if (event.getResult() == Result.ALLOW)
|
||||
{
|
||||
context.getItem().func_222118_a(1, context.getPlayer(), player -> player.func_213334_d(context.func_221531_n()));
|
||||
context.getItem().damageItem(1, context.getPlayer(), player -> player.sendBreakAnimation(context.getHand()));
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
@@ -372,7 +372,7 @@ public class ForgeEventFactory
|
||||
|
||||
if (event.getResult() == Result.ALLOW)
|
||||
{
|
||||
if (player.playerAbilities.isCreativeMode)
|
||||
if (player.abilities.isCreativeMode)
|
||||
return new ActionResult<ItemStack>(ActionResultType.SUCCESS, stack);
|
||||
|
||||
stack.shrink(1);
|
||||
@@ -567,7 +567,7 @@ public class ForgeEventFactory
|
||||
Result canContinueSleep = evt.getResult();
|
||||
if (canContinueSleep == Result.DEFAULT)
|
||||
{
|
||||
return player.func_213374_dv().map(pos-> {
|
||||
return player.getBedPosition().map(pos-> {
|
||||
BlockState state = player.world.getBlockState(pos);
|
||||
return state.getBlock().isBed(state, player.world, pos, player);
|
||||
}).orElse(false);
|
||||
|
||||
@@ -232,7 +232,7 @@ public class FluidUtil
|
||||
return FluidActionResult.FAILURE;
|
||||
}
|
||||
|
||||
if (player != null && player.playerAbilities.isCreativeMode)
|
||||
if (player != null && player.abilities.isCreativeMode)
|
||||
{
|
||||
FluidActionResult filledReal = tryFillContainer(container, fluidSource, maxAmount, player, doFill);
|
||||
if (filledReal.isSuccess())
|
||||
@@ -300,7 +300,7 @@ public class FluidUtil
|
||||
return FluidActionResult.FAILURE;
|
||||
}
|
||||
|
||||
if (player != null && player.playerAbilities.isCreativeMode)
|
||||
if (player != null && player.abilities.isCreativeMode)
|
||||
{
|
||||
FluidActionResult emptiedReal = tryEmptyContainer(container, fluidDestination, maxAmount, player, doDrain);
|
||||
if (emptiedReal.isSuccess())
|
||||
|
||||
@@ -167,7 +167,7 @@ public class UniversalBucket extends Item
|
||||
}
|
||||
|
||||
// clicked on a block?
|
||||
RayTraceResult rt = func_219968_a(world, player, FluidMode.NONE);
|
||||
RayTraceResult rt = rayTrace(world, player, FluidMode.NONE);
|
||||
|
||||
ActionResult<ItemStack> ret = ForgeEventFactory.onBucketUse(player, world, itemstack, rt);
|
||||
if (ret != null) return ret;
|
||||
@@ -190,7 +190,7 @@ public class UniversalBucket extends Item
|
||||
{
|
||||
// try placing liquid
|
||||
FluidActionResult result = FluidUtil.tryPlaceFluid(player, world, hand, targetPos, itemstack, fluidStack);
|
||||
if (result.isSuccess() && !player.playerAbilities.isCreativeMode)
|
||||
if (result.isSuccess() && !player.abilities.isCreativeMode)
|
||||
{
|
||||
// success!
|
||||
player.addStat(Stats.ITEM_USED.get(this));
|
||||
|
||||
@@ -23,26 +23,14 @@ import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.Lists;
|
||||
import java.util.List;
|
||||
import java.util.function.BiConsumer;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.stream.IntStream;
|
||||
|
||||
import net.minecraft.resources.IResourceManager;
|
||||
import net.minecraftforge.resource.IResourceType;
|
||||
import net.minecraftforge.resource.VanillaResourceType;
|
||||
import net.minecraft.resources.IResourceManagerReloadListener;
|
||||
import net.minecraftforge.versions.forge.ForgeVersion;
|
||||
import net.minecraftforge.versions.mcp.MCPVersion;
|
||||
|
||||
|
||||
import net.minecraft.resources.IResourceManager;
|
||||
import net.minecraftforge.resource.IResourceType;
|
||||
import net.minecraftforge.resource.VanillaResourceType;
|
||||
import net.minecraftforge.versions.forge.ForgeVersion;
|
||||
import net.minecraftforge.versions.mcp.MCPVersion;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.function.BiConsumer;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.stream.IntStream;
|
||||
|
||||
public class BrandingControl
|
||||
{
|
||||
private static List<String> brandings;
|
||||
@@ -86,10 +74,12 @@ public class BrandingControl
|
||||
return "forge";
|
||||
}
|
||||
|
||||
public static void clearCaches(IResourceManager resourceManager, Predicate<IResourceType> resourcePredicate) {
|
||||
if (resourcePredicate.test(VanillaResourceType.LANGUAGES)) {
|
||||
brandings = null;
|
||||
brandingsNoMC = null;
|
||||
}
|
||||
public static IResourceManagerReloadListener resourceManagerReloadListener() {
|
||||
return BrandingControl::onResourceManagerReload;
|
||||
}
|
||||
|
||||
private static void onResourceManagerReload(IResourceManager resourceManager) {
|
||||
brandings = null;
|
||||
brandingsNoMC = null;
|
||||
}
|
||||
}
|
||||
@@ -124,7 +124,6 @@ public class ModLoader
|
||||
}
|
||||
|
||||
public void loadMods() {
|
||||
gatherAndInitializeMods();
|
||||
DistExecutor.runWhenOn(Dist.CLIENT, ()->()-> ConfigTracker.INSTANCE.loadConfigs(ModConfig.Type.CLIENT, FMLPaths.CONFIGDIR.get()));
|
||||
ConfigTracker.INSTANCE.loadConfigs(ModConfig.Type.COMMON, FMLPaths.CONFIGDIR.get());
|
||||
dispatchAndHandleError(LifecycleEventProvider.SETUP);
|
||||
@@ -132,7 +131,7 @@ public class ModLoader
|
||||
dispatchAndHandleError(LifecycleEventProvider.SIDED_SETUP);
|
||||
}
|
||||
|
||||
private void gatherAndInitializeMods() {
|
||||
public void gatherAndInitializeMods() {
|
||||
final ModList modList = ModList.of(loadingModList.getModFiles().stream().map(ModFileInfo::getFile).collect(Collectors.toList()), loadingModList.getMods());
|
||||
if (!this.loadingExceptions.isEmpty()) {
|
||||
throw new LoadingFailedException(loadingExceptions);
|
||||
|
||||
@@ -226,7 +226,7 @@ public class StartupQuery {
|
||||
}
|
||||
|
||||
if (query.isSynchronous()) {
|
||||
while (client.field_71462_r instanceof GuiNotification) {
|
||||
while (client.currentScreen instanceof GuiNotification) {
|
||||
if (Thread.interrupted()) {
|
||||
query.exception = new InterruptedException();
|
||||
throw new RuntimeException();
|
||||
|
||||
@@ -22,18 +22,14 @@ package net.minecraftforge.fml.client;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.resources.DownloadingPackFinder;
|
||||
import net.minecraft.client.resources.ClientResourcePackInfo;
|
||||
import net.minecraft.resources.IReloadableResourceManager;
|
||||
import net.minecraft.resources.ResourcePackList;
|
||||
import net.minecraft.profiler.IProfiler;
|
||||
import net.minecraft.resources.*;
|
||||
import net.minecraft.util.Unit;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.common.ForgeConfig;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.fml.LoadingFailedException;
|
||||
import net.minecraftforge.fml.LogicalSidedProvider;
|
||||
import net.minecraftforge.fml.ModLoader;
|
||||
import net.minecraftforge.fml.ModLoadingWarning;
|
||||
import net.minecraftforge.fml.SidedProvider;
|
||||
import net.minecraftforge.fml.VersionChecker;
|
||||
import net.minecraftforge.fml.*;
|
||||
import net.minecraftforge.fml.client.gui.LoadingErrorScreen;
|
||||
import net.minecraftforge.fml.packs.ResourcePackLoader;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
@@ -43,6 +39,8 @@ import com.mojang.blaze3d.platform.GlStateManager;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.Executor;
|
||||
|
||||
import static net.minecraftforge.fml.loading.LogMarkers.LOADING;
|
||||
|
||||
@@ -61,15 +59,31 @@ public class ClientModLoader
|
||||
SidedProvider.setClient(()->minecraft);
|
||||
LogicalSidedProvider.setClient(()->minecraft);
|
||||
try {
|
||||
ModLoader.get().loadMods();
|
||||
ModLoader.get().gatherAndInitializeMods();
|
||||
} catch (LoadingFailedException e) {
|
||||
MinecraftForge.EVENT_BUS.shutdown();
|
||||
error = e;
|
||||
TEMP_printLoadingExceptions(e);
|
||||
}
|
||||
ResourcePackLoader.loadResourcePacks(defaultResourcePacks);
|
||||
mcResourceManager.addReloadListener(ClientModLoader::onreload);
|
||||
mcResourceManager.addReloadListener(BrandingControl.resourceManagerReloadListener());
|
||||
}
|
||||
|
||||
private static CompletableFuture<Void> onreload(final IFutureReloadListener.IStage stage, final IResourceManager resourceManager, final IProfiler prepareProfiler, final IProfiler executeProfiler, final Executor asyncExecutor, final Executor syncExecutor) {
|
||||
return CompletableFuture.runAsync(runTaskWithCatch(ModLoader.get()::loadMods), syncExecutor).thenCompose(stage::markCompleteAwaitingOthers).thenRunAsync(runTaskWithCatch(ModLoader.get()::finishMods));
|
||||
}
|
||||
|
||||
private static Runnable runTaskWithCatch(Runnable r) {
|
||||
return ()-> {
|
||||
try {
|
||||
r.run();
|
||||
} catch (LoadingFailedException e) {
|
||||
MinecraftForge.EVENT_BUS.shutdown();
|
||||
error = e;
|
||||
}
|
||||
};
|
||||
}
|
||||
public static void end()
|
||||
{
|
||||
try {
|
||||
|
||||
@@ -34,14 +34,14 @@ public class GuiConfirmation extends GuiNotification
|
||||
{
|
||||
this.addButton(new Button(this.width / 2 - 104, this.height - 38, 100, 20, ForgeI18n.parseMessage("gui.yes"), b ->
|
||||
{
|
||||
GuiConfirmation.this.minecraft.field_71462_r = null;
|
||||
GuiConfirmation.this.minecraft.currentScreen = null;
|
||||
query.setResult(true);
|
||||
query.finish();
|
||||
}
|
||||
));
|
||||
this.addButton(new Button(this.width / 2 + 4, this.height - 38, 100, 20, ForgeI18n.parseMessage("gui.no"), b ->
|
||||
{
|
||||
GuiConfirmation.this.minecraft.field_71462_r = null;
|
||||
GuiConfirmation.this.minecraft.currentScreen = null;
|
||||
query.setResult(false);
|
||||
query.finish();
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ public class FMLPlayMessages
|
||||
SpawnEntity(Entity e)
|
||||
{
|
||||
this.entity = e;
|
||||
this.typeId = Registry.field_212629_r.getId(e.getType());
|
||||
this.typeId = Registry.ENTITY_TYPE.getId(e.getType());
|
||||
this.entityId = e.getEntityId();
|
||||
this.uuid = e.getUniqueID();
|
||||
this.posX = e.posX;
|
||||
@@ -143,7 +143,7 @@ public class FMLPlayMessages
|
||||
public static void handle(SpawnEntity msg, Supplier<NetworkEvent.Context> ctx)
|
||||
{
|
||||
ctx.get().enqueueWork(() -> {
|
||||
EntityType<?> type = Registry.field_212629_r.getByValue(msg.typeId);
|
||||
EntityType<?> type = Registry.ENTITY_TYPE.getByValue(msg.typeId);
|
||||
if (type == null)
|
||||
{
|
||||
throw new RuntimeException(String.format("Could not spawn entity (id %d) with unknown type at (%f, %f, %f)", msg.entityId, msg.posX, msg.posY, msg.posZ));
|
||||
@@ -163,7 +163,7 @@ public class FMLPlayMessages
|
||||
|
||||
e.setEntityId(msg.entityId);
|
||||
e.setUniqueId(msg.uuid);
|
||||
world.filter(ClientWorld.class::isInstance).ifPresent(w->((ClientWorld)w).func_217411_a(msg.entityId, e));
|
||||
world.filter(ClientWorld.class::isInstance).ifPresent(w->((ClientWorld)w).addEntity(msg.entityId, e));
|
||||
e.setVelocity(msg.velX / 8000.0, msg.velY / 8000.0, msg.velZ / 8000.0);
|
||||
if (e instanceof IEntityAdditionalSpawnData)
|
||||
{
|
||||
@@ -183,7 +183,7 @@ public class FMLPlayMessages
|
||||
|
||||
OpenContainer(ContainerType<?> id, int windowId, ITextComponent name, PacketBuffer additionalData)
|
||||
{
|
||||
this(Registry.field_218366_G.getId(id), windowId, name, additionalData);
|
||||
this(Registry.MENU.getId(id), windowId, name, additionalData);
|
||||
}
|
||||
|
||||
private OpenContainer(int id, int windowId, ITextComponent name, PacketBuffer additionalData)
|
||||
@@ -223,7 +223,7 @@ public class FMLPlayMessages
|
||||
}
|
||||
|
||||
public final ContainerType<?> getType() {
|
||||
return Registry.field_218366_G.getByValue(this.id);
|
||||
return Registry.MENU.getByValue(this.id);
|
||||
}
|
||||
|
||||
public int getWindowId() {
|
||||
|
||||
@@ -180,7 +180,7 @@ public class NetworkEvent extends Event
|
||||
// Must check ourselves as Minecraft will sometimes delay tasks even when they are received on the client thread
|
||||
// Same logic as ThreadTaskExecutor#runImmediately without the join
|
||||
if (!executor.isOnExecutionThread()) {
|
||||
return executor.func_213165_a(runnable); // Use the internal method so thread check isn't done twice
|
||||
return executor.deferTask(runnable); // Use the internal method so thread check isn't done twice
|
||||
} else {
|
||||
runnable.run();
|
||||
return CompletableFuture.completedFuture(null);
|
||||
@@ -197,7 +197,7 @@ public class NetworkEvent extends Event
|
||||
if (netHandler instanceof ServerPlayNetHandler)
|
||||
{
|
||||
ServerPlayNetHandler netHandlerPlayServer = (ServerPlayNetHandler) netHandler;
|
||||
return netHandlerPlayServer.field_147369_b;
|
||||
return netHandlerPlayServer.player;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -237,21 +237,21 @@ public class PacketDistributor<T> {
|
||||
private Consumer<IPacket<?>> trackingEntity(final Supplier<Entity> entitySupplier) {
|
||||
return p-> {
|
||||
final Entity entity = entitySupplier.get();
|
||||
((ServerChunkProvider)entity.getEntityWorld().getChunkProvider()).func_217218_b(entity, p);
|
||||
((ServerChunkProvider)entity.getEntityWorld().getChunkProvider()).sendToAllTracking(entity, p);
|
||||
};
|
||||
}
|
||||
|
||||
private Consumer<IPacket<?>> trackingEntityAndSelf(final Supplier<Entity> entitySupplier) {
|
||||
return p-> {
|
||||
final Entity entity = entitySupplier.get();
|
||||
((ServerChunkProvider)entity.getEntityWorld().getChunkProvider()).func_217216_a(entity, p);
|
||||
((ServerChunkProvider)entity.getEntityWorld().getChunkProvider()).sendToTrackingAndSelf(entity, p);
|
||||
};
|
||||
}
|
||||
|
||||
private Consumer<IPacket<?>> trackingChunk(final Supplier<Chunk> chunkPosSupplier) {
|
||||
return p -> {
|
||||
final Chunk chunk = chunkPosSupplier.get();
|
||||
((ServerChunkProvider)chunk.getWorld().getChunkProvider()).field_217237_a.func_219097_a(chunk.getPos(), false).forEach(e -> e.connection.sendPacket(p));
|
||||
((ServerChunkProvider)chunk.getWorld().getChunkProvider()).chunkManager.getTrackingPlayers(chunk.getPos(), false).forEach(e -> e.connection.sendPacket(p));
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -195,7 +195,7 @@ public class ItemHandlerHelper
|
||||
entityitem.setPickupDelay(40);
|
||||
entityitem.setMotion(entityitem.getMotion().mul(0, 1, 0));
|
||||
|
||||
world.func_217376_c(entityitem);
|
||||
world.addEntity(entityitem);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -166,7 +166,7 @@ public class ClearableRegistry<T> extends MutableRegistry<T>
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<T> func_218349_b(ResourceLocation p_218349_1_) {
|
||||
return Optional.ofNullable(map.get(p_218349_1_));
|
||||
public Optional<T> getValue(ResourceLocation key) {
|
||||
return Optional.ofNullable(map.get(key));
|
||||
}
|
||||
}
|
||||
@@ -88,6 +88,8 @@ import java.util.stream.Collectors;
|
||||
|
||||
import static net.minecraftforge.registries.ForgeRegistry.REGISTRIES;
|
||||
|
||||
import net.minecraftforge.fml.common.EnhancedRuntimeException.WrappedPrintStream;
|
||||
|
||||
/**
|
||||
* INTERNAL ONLY
|
||||
* MODDERS SHOULD HAVE NO REASON TO USE THIS CLASS
|
||||
|
||||
@@ -71,7 +71,7 @@ class NamespacedDefaultedWrapper<T extends IForgeRegistryEntry<T>> extends Defau
|
||||
|
||||
// Reading Functions
|
||||
@Override
|
||||
public Optional<T> func_218349_b(@Nullable ResourceLocation name)
|
||||
public Optional<T> getValue(@Nullable ResourceLocation name)
|
||||
{
|
||||
return Optional.ofNullable( this.delegate.getRaw(name)); //get without default
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@ class NamespacedWrapper<T extends IForgeRegistryEntry<T>> extends SimpleRegistry
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<T> func_218349_b(@Nullable ResourceLocation name)
|
||||
public Optional<T> getValue(@Nullable ResourceLocation name)
|
||||
{
|
||||
return Optional.ofNullable( this.delegate.getRaw(name)); //get without default
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user