Update to 1.14.3

This commit is contained in:
Marcel Konrad
2019-06-25 13:57:07 +02:00
parent 7732f02e4e
commit d990f8512b
10 changed files with 34 additions and 31 deletions

View File

@@ -34,7 +34,7 @@ public abstract class ComponentPotion implements IBuilderComponent
{ {
CompoundNBT compound = new CompoundNBT(); CompoundNBT compound = new CompoundNBT();
compound.putByte("Id", (byte) Effect.getIdFromPotion(entry.getKey())); compound.putByte("Id", (byte) Effect.getId(entry.getKey()));
compound.putByte("Amplifier", (byte) (potion.getAmplifier() - 1)); compound.putByte("Amplifier", (byte) (potion.getAmplifier() - 1));
compound.putInt("Duration", Math.min(potion.toTicks(), 1000000)); compound.putInt("Duration", Math.min(potion.toTicks(), 1000000));
compound.putBoolean("Ambient", potion.getAmbient()); compound.putBoolean("Ambient", potion.getAmbient());

View File

@@ -27,7 +27,7 @@ public class ClientEventHandler
@SubscribeEvent @SubscribeEvent
public static void renderWorldLastEvent(RenderWorldLastEvent event) public static void renderWorldLastEvent(RenderWorldLastEvent event)
{ {
if(Config.getSettings().highlightBlocks() && Minecraft.getInstance().world != null && Minecraft.getInstance().getRenderManager().field_217783_c != null) if(Config.getSettings().highlightBlocks() && Minecraft.getInstance().world != null && Minecraft.getInstance().getRenderManager().info != null)
{ {
GlStateManager.pushMatrix(); GlStateManager.pushMatrix();
GlStateManager.disableAlphaTest(); GlStateManager.disableAlphaTest();
@@ -38,7 +38,7 @@ public class ClientEventHandler
GlStateManager.depthMask(false); GlStateManager.depthMask(false);
final double constant = 0.0020000000949949026D; final double constant = 0.0020000000949949026D;
Vec3d projected = Minecraft.getInstance().getRenderManager().field_217783_c.func_216785_c(); Vec3d projected = Minecraft.getInstance().getRenderManager().info.getProjectedView();
double minX = Math.min(BlockHelper.getPos1().getX(), BlockHelper.getPos2().getX()) - constant - projected.x; double minX = Math.min(BlockHelper.getPos1().getX(), BlockHelper.getPos2().getX()) - constant - projected.x;
double minY = Math.min(BlockHelper.getPos1().getY(), BlockHelper.getPos2().getY()) - constant - projected.y; double minY = Math.min(BlockHelper.getPos1().getY(), BlockHelper.getPos2().getY()) - constant - projected.y;

View File

@@ -16,7 +16,7 @@ public class KeyHandler
@SubscribeEvent @SubscribeEvent
public static void keyInputEvent(KeyInputEvent event) public static void keyInputEvent(KeyInputEvent event)
{ {
if(Minecraft.getInstance() != null && Minecraft.getInstance().field_71462_r == null) if(Minecraft.getInstance() != null && Minecraft.getInstance().currentScreen == null)
{ {
if(WorldHandler.KEY_WORLD_HANDLER.isPressed()) if(WorldHandler.KEY_WORLD_HANDLER.isPressed())
{ {

View File

@@ -29,8 +29,8 @@ public class GuiButtonTooltip extends GuiButtonBase
if(!list.isEmpty()) if(!list.isEmpty())
{ {
int tooltipWidth = Minecraft.getInstance().fontRenderer.getStringWidth(this.tooltip) + 9; int tooltipWidth = Minecraft.getInstance().fontRenderer.getStringWidth(this.tooltip) + 9;
int width = Minecraft.getInstance().field_71462_r.width; int width = Minecraft.getInstance().currentScreen.width;
int height = Minecraft.getInstance().field_71462_r.height; int height = Minecraft.getInstance().currentScreen.height;
GuiUtils.drawHoveringText(list, mouseX, mouseY, width, height, tooltipWidth, Minecraft.getInstance().fontRenderer); GuiUtils.drawHoveringText(list, mouseX, mouseY, width, height, tooltipWidth, Minecraft.getInstance().fontRenderer);
} }

View File

@@ -1,8 +1,12 @@
package exopandora.worldhandler.gui.content.impl; package exopandora.worldhandler.gui.content.impl;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import com.google.common.base.Predicates; import com.google.common.base.Predicates;
import com.mojang.brigadier.arguments.ArgumentType;
import com.mojang.brigadier.arguments.BoolArgumentType;
import exopandora.worldhandler.builder.ICommandBuilder; import exopandora.worldhandler.builder.ICommandBuilder;
import exopandora.worldhandler.builder.impl.BuilderGamerule; import exopandora.worldhandler.builder.impl.BuilderGamerule;
@@ -21,7 +25,10 @@ import exopandora.worldhandler.helper.CommandHelper;
import exopandora.worldhandler.util.ActionHandler; import exopandora.worldhandler.util.ActionHandler;
import net.minecraft.client.resources.I18n; import net.minecraft.client.resources.I18n;
import net.minecraft.world.GameRules; import net.minecraft.world.GameRules;
import net.minecraft.world.GameRules.ValueType; import net.minecraft.world.GameRules.IRuleEntryVisitor;
import net.minecraft.world.GameRules.RuleKey;
import net.minecraft.world.GameRules.RuleType;
import net.minecraft.world.GameRules.RuleValue;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.api.distmarker.OnlyIn;
@@ -54,7 +61,18 @@ public class ContentGamerules extends Content
this.builderGamerule.setValue(this.value); this.builderGamerule.setValue(this.value);
}); });
ElementPageList<String> rules = new ElementPageList<String>(x, y, new ArrayList<String>(GameRules.getDefinitions().keySet()), 114, 20, 3, container, new ILogicPageList<String>() Map<String, ArgumentType<?>> map = new HashMap<String, ArgumentType<?>>();
GameRules.func_223590_a(new IRuleEntryVisitor()
{
@Override
public <T extends RuleValue<T>> void func_223481_a(RuleKey<T> rule, RuleType<T> type)
{
map.put(rule.func_223576_a(), type.func_223581_a(null).getType());
}
});
ElementPageList<String> rules = new ElementPageList<String>(x, y, new ArrayList<String>(map.keySet()), 114, 20, 3, container, new ILogicPageList<String>()
{ {
@Override @Override
public String translate(String item) public String translate(String item)
@@ -72,7 +90,7 @@ public class ContentGamerules extends Content
public void onClick(String item) public void onClick(String item)
{ {
ContentGamerules.this.builderGamerule.setRule(item); ContentGamerules.this.builderGamerule.setRule(item);
ContentGamerules.this.booleanValue = GameRules.getDefinitions().get(item).getType().equals(ValueType.BOOLEAN_VALUE); ContentGamerules.this.booleanValue = map.get(item) instanceof BoolArgumentType;
if(ContentGamerules.this.booleanValue) if(ContentGamerules.this.booleanValue)
{ {

View File

@@ -185,7 +185,7 @@ public class ContentSignEditor extends Content
GlStateManager.translatef(container.width / 2 - 8.5F * scale, container.height / 2 - 15 - 8.5F * scale, 0); GlStateManager.translatef(container.width / 2 - 8.5F * scale, container.height / 2 - 15 - 8.5F * scale, 0);
GlStateManager.scalef(scale, scale, scale); GlStateManager.scalef(scale, scale, scale);
Minecraft.getInstance().getItemRenderer().renderItemIntoGUI(new ItemStack(Items.field_222071_kr), 0, 0); Minecraft.getInstance().getItemRenderer().renderItemIntoGUI(new ItemStack(Items.OAK_SIGN), 0, 0);
RenderHelper.disableStandardItemLighting(); RenderHelper.disableStandardItemLighting();
GlStateManager.popMatrix(); GlStateManager.popMatrix();

View File

@@ -271,7 +271,7 @@ public class ContentSummon extends Content
{ {
Effect potion = ForgeRegistries.POTIONS.getValue(location); Effect potion = ForgeRegistries.POTIONS.getValue(location);
if(!potion.equals(Effects.field_76432_h) && !potion.equals(Effects.field_76433_i)) if(!potion.equals(Effects.INSTANT_DAMAGE) && !potion.equals(Effects.INSTANT_HEALTH))
{ {
if(this.potionPage == 0) if(this.potionPage == 0)
{ {

View File

@@ -169,7 +169,7 @@ public class ContentWorldInfo extends Content
{ {
if(Minecraft.getInstance().getIntegratedServer() != null) if(Minecraft.getInstance().getIntegratedServer() != null)
{ {
return Minecraft.getInstance().getIntegratedServer().getWorld(DimensionType.OVERWORLD); return Minecraft.getInstance().getIntegratedServer().getWorld(DimensionType.field_223227_a_);
} }
return Minecraft.getInstance().world; return Minecraft.getInstance().world;

View File

@@ -146,7 +146,7 @@ public class ActionHelper
TranslationTextComponent message = new TranslationTextComponent("worldhandler.error.gui", name); TranslationTextComponent message = new TranslationTextComponent("worldhandler.error.gui", name);
message.setStyle(new Style().setColor(net.minecraft.util.text.TextFormatting.RED)); message.setStyle(new Style().setColor(net.minecraft.util.text.TextFormatting.RED));
Minecraft.getInstance().field_71456_v.addChatMessage(ChatType.SYSTEM, message); Minecraft.getInstance().ingameGUI.addChatMessage(ChatType.SYSTEM, message);
WorldHandler.LOGGER.throwing(e); WorldHandler.LOGGER.throwing(e);
} }
} }
@@ -155,8 +155,8 @@ public class ActionHelper
{ {
if(!CommandHelper.canPlayerIssueCommand() && Config.getSettings().permissionQuery()) if(!CommandHelper.canPlayerIssueCommand() && Config.getSettings().permissionQuery())
{ {
Minecraft.getInstance().field_71456_v.addChatMessage(ChatType.SYSTEM, new StringTextComponent(TextFormatting.RED + I18n.format("worldhandler.permission.refused"))); Minecraft.getInstance().ingameGUI.addChatMessage(ChatType.SYSTEM, new StringTextComponent(TextFormatting.RED + I18n.format("worldhandler.permission.refused")));
Minecraft.getInstance().field_71456_v.addChatMessage(ChatType.SYSTEM, new StringTextComponent(TextFormatting.RED + I18n.format("worldhandler.permission.refused.change", I18n.format("gui.worldhandler.config.key.settings.permission_query")))); Minecraft.getInstance().ingameGUI.addChatMessage(ChatType.SYSTEM, new StringTextComponent(TextFormatting.RED + I18n.format("worldhandler.permission.refused.change", I18n.format("gui.worldhandler.config.key.settings.permission_query"))));
} }
else else
{ {

View File

@@ -13,7 +13,6 @@ import net.minecraft.entity.EntityType;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.potion.Effect; import net.minecraft.potion.Effect;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraft.util.registry.Registry;
import net.minecraft.world.biome.Biome; import net.minecraft.world.biome.Biome;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.api.distmarker.OnlyIn;
@@ -26,7 +25,6 @@ import net.minecraftforge.registries.IForgeRegistryEntry;
public class RegistryHelper public class RegistryHelper
{ {
private static final Map<IForgeRegistry<?>, Function<?, String>> FORGE = new HashMap<IForgeRegistry<?>, Function<?, String>>(); private static final Map<IForgeRegistry<?>, Function<?, String>> FORGE = new HashMap<IForgeRegistry<?>, Function<?, String>>();
private static final Map<Registry<?>, Function<?, String>> VANILLA = new HashMap<Registry<?>, Function<?, String>>();
static static
{ {
@@ -36,7 +34,7 @@ public class RegistryHelper
registerRegistry(ForgeRegistries.BIOMES, Biome::getTranslationKey); registerRegistry(ForgeRegistries.BIOMES, Biome::getTranslationKey);
registerRegistry(ForgeRegistries.ENCHANTMENTS, Enchantment::getName); registerRegistry(ForgeRegistries.ENCHANTMENTS, Enchantment::getName);
registerRegistry(ForgeRegistries.ENTITIES, EntityType::getTranslationKey); registerRegistry(ForgeRegistries.ENTITIES, EntityType::getTranslationKey);
registerRegistry(Registry.field_212623_l, stat -> "stat." + stat.toString().replace(':', '.')); registerRegistry(ForgeRegistries.STAT_TYPES, stat -> "stat." + stat.toString().replace(':', '.'));
} }
private static <T extends ForgeRegistryEntry<T>> void registerRegistry(IForgeRegistry<T> registry, Function<T, String> mapper) private static <T extends ForgeRegistryEntry<T>> void registerRegistry(IForgeRegistry<T> registry, Function<T, String> mapper)
@@ -44,11 +42,6 @@ public class RegistryHelper
FORGE.put(registry, mapper); FORGE.put(registry, mapper);
} }
private static <T> void registerRegistry(Registry<T> registry, Function<T, String> mapper)
{
VANILLA.put(registry, mapper);
}
@Nullable @Nullable
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public static <T> String translate(ResourceLocation resource) public static <T> String translate(ResourceLocation resource)
@@ -61,14 +54,6 @@ public class RegistryHelper
} }
} }
for(Registry<?> registry : VANILLA.keySet())
{
if(registry.containsKey(resource))
{
return ((Function<T, String>) VANILLA.get(registry)).apply((T) registry.getOrDefault(resource));
}
}
return null; return null;
} }