diff options
Diffstat (limited to 'src/main/java')
5 files changed, 184 insertions, 2 deletions
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/e.java b/src/main/java/kr/syeyoung/dungeonsguide/e.java index 3855a5d1..a06d2b29 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/e.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/e.java @@ -11,12 +11,14 @@ import kr.syeyoung.dungeonsguide.events.StompConnectedEvent; import kr.syeyoung.dungeonsguide.features.FeatureRegistry; import kr.syeyoung.dungeonsguide.party.PartyInviteViewer; import kr.syeyoung.dungeonsguide.party.PartyManager; +import kr.syeyoung.dungeonsguide.resources.DGTexturePack; import kr.syeyoung.dungeonsguide.stomp.CloseListener; import kr.syeyoung.dungeonsguide.stomp.StompClient; import kr.syeyoung.dungeonsguide.stomp.StompInterface; import kr.syeyoung.dungeonsguide.utils.AhUtils; import lombok.Getter; import net.minecraft.client.Minecraft; +import net.minecraft.client.resources.IResourcePack; import net.minecraft.command.ICommand; import net.minecraft.launchwrapper.LaunchClassLoader; import net.minecraft.launchwrapper.LogWrapper; @@ -45,6 +47,7 @@ import java.net.URL; import java.security.InvalidAlgorithmParameterException; import java.security.InvalidKeyException; import java.security.NoSuchAlgorithmException; +import java.util.List; import java.util.Map; import java.util.Set; import java.util.concurrent.Executors; @@ -81,6 +84,7 @@ public class e implements c, CloseListener { public void init(FMLInitializationEvent event) { ProgressManager.ProgressBar progressbar = ProgressManager.push("DungeonsGuide", 4); + try { Set<String> invalid = ReflectionHelper.getPrivateValue(LaunchClassLoader.class, (LaunchClassLoader) a.class.getClassLoader(), "invalidClasses"); ((LaunchClassLoader)a.class.getClassLoader()).clearNegativeEntries(Sets.newHashSet("org.slf4j.LoggerFactory")); @@ -141,6 +145,7 @@ public class e implements c, CloseListener { e.printStackTrace(); } + ProgressManager.pop(progressbar); } public void pre(FMLPreInitializationEvent event) { @@ -151,6 +156,13 @@ public class e implements c, CloseListener { } Config.f = configFile; Minecraft.getMinecraft().getFramebuffer().enableStencil(); + + try { + List<IResourcePack> resourcePackList = ReflectionHelper.getPrivateValue(Minecraft.class, Minecraft.getMinecraft(),"defaultResourcePacks"); + resourcePackList.add(new DGTexturePack(authenticator)); + } catch (Throwable t){ + t.printStackTrace(); + } } private void copy(InputStream inputStream, File f) throws IOException { FileOutputStream fos = new FileOutputStream(f); diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/FeatureRegistry.java b/src/main/java/kr/syeyoung/dungeonsguide/features/FeatureRegistry.java index 90732771..2c2916c9 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/FeatureRegistry.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/FeatureRegistry.java @@ -72,12 +72,13 @@ public class FeatureRegistry { public static final FeatureAutoAcceptReparty ETC_AUTO_ACCEPT_REPARTY = register(new FeatureAutoAcceptReparty()); public static final FeatureUpdateAlarm ETC_TEST = register(new FeatureUpdateAlarm()); - public static final SimpleFeature FIX_SPIRIT_BOOTS = register(new SimpleFeature("Fixes", "Spirit Boots Fixer", "Fix Spirit boots messing up with inventory", "fixes.spirit", true)); public static final FeatureDisableMessage FIX_MESSAGES = register(new FeatureDisableMessage()); public static final FeatureCopyMessages ETC_COPY_MSG = register(new FeatureCopyMessages()); + public static final FeaturePenguins ETC_PENGUIN = register(new FeaturePenguins()); + public static final FeatureWarningOnPortal BOSSFIGHT_WARNING_ON_PORTAL = register(new FeatureWarningOnPortal()); public static final SimpleFeature BOSSFIGHT_CHESTPRICE = register(new FeatureChestPrice()); public static final FeatureAutoReparty BOSSFIGHT_AUTOREPARTY = register(new FeatureAutoReparty()); diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/FeaturePenguins.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/FeaturePenguins.java new file mode 100644 index 00000000..f5ae6802 --- /dev/null +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/FeaturePenguins.java @@ -0,0 +1,111 @@ +package kr.syeyoung.dungeonsguide.features.impl.etc; + +import kr.syeyoung.dungeonsguide.SkyblockStatus; +import kr.syeyoung.dungeonsguide.dungeon.DungeonContext; +import kr.syeyoung.dungeonsguide.e; +import kr.syeyoung.dungeonsguide.features.SimpleFeature; +import kr.syeyoung.dungeonsguide.features.listener.PlayerRenderListener; +import net.minecraft.block.Block; +import net.minecraft.client.Minecraft; +import net.minecraft.client.entity.AbstractClientPlayer; +import net.minecraft.client.gui.Gui; +import net.minecraft.client.model.ModelBiped; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.block.model.ItemCameraTransforms; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.item.ItemBlock; +import net.minecraft.item.ItemStack; +import net.minecraft.util.ResourceLocation; +import net.minecraftforge.client.event.RenderPlayerEvent; +import org.lwjgl.opengl.GL11; + + +public class FeaturePenguins extends SimpleFeature implements PlayerRenderListener { + public FeaturePenguins() { + super("ETC", "Penguins", "Awwww", "etc.penguin", false); + } + + + private SkyblockStatus skyblockStatus = e.getDungeonsGuide().getSkyblockStatus(); + private ResourceLocation penguin = new ResourceLocation("iamdg:penguin.png"); + + @Override + public void onEntityRenderPre(RenderPlayerEvent.Pre renderPlayerEvent) { + if (!isEnabled()) return; + renderPlayerEvent.setCanceled(true); + GlStateManager.pushMatrix(); + GlStateManager.translate(renderPlayerEvent.x, renderPlayerEvent.y, renderPlayerEvent.z); + + GlStateManager.rotate(-renderPlayerEvent.renderer.getRenderManager().playerViewY, 0.0f, 1.0f, 0.0f); + + GlStateManager.translate(0.5,2,0); + GlStateManager.scale(-1,-1,-1); + + if (renderPlayerEvent.entityPlayer.isSneaking()) + { + GlStateManager.translate(0.0F, 0.203125F, 0.0F); + } + + Minecraft.getMinecraft().getTextureManager().bindTexture(penguin); + GlStateManager.disableLighting(); + GlStateManager.color(1f, 1f, 1f, 1f); + Gui.drawModalRectWithCustomSizedTexture(0,0,0,0,1,2,1,2); + GlStateManager.bindTexture(0); + GlStateManager.enableLighting(); + GlStateManager.popMatrix(); + + EntityPlayer entitylivingbaseIn = renderPlayerEvent.entityPlayer; + { + ItemStack itemstack = entitylivingbaseIn.getHeldItem(); + + if (itemstack != null) + { + GlStateManager.pushMatrix(); + GlStateManager.translate(renderPlayerEvent.x, renderPlayerEvent.y, renderPlayerEvent.z); + GlStateManager.rotate(-renderPlayerEvent.renderer.getRenderManager().playerViewY, 0.0f, 1.0f, 0.0f); + GlStateManager.translate(-0.3,1.8,0.1); + GlStateManager.scale(0.8,0.8,0.8); + + + if (((EntityPlayer) entitylivingbaseIn).fishEntity != null) + { + itemstack = new ItemStack(Items.fishing_rod, 0); + } + + Item item = itemstack.getItem(); + Minecraft minecraft = Minecraft.getMinecraft(); + + if (item instanceof ItemBlock && Block.getBlockFromItem(item).getRenderType() == 2) + { + GlStateManager.translate(0,0,0.2); + GlStateManager.translate(0.0F, 0.1875F, -0.3125F); + GlStateManager.rotate(20.0F, 1.0F, 0.0F, 0.0F); + GlStateManager.rotate(45.0F, 0.0F, 1.0F, 0.0F); + float f1 = 0.375F; + GlStateManager.scale(-f1, -f1, f1); + } + + if (entitylivingbaseIn.isSneaking()) + { + GlStateManager.translate(0.0F, 0.203125F, 0.0F); + } + + minecraft.getItemRenderer().renderItem(entitylivingbaseIn, itemstack, ItemCameraTransforms.TransformType.THIRD_PERSON); + GlStateManager.popMatrix(); + } + } + + + renderPlayerEvent.renderer.renderName((AbstractClientPlayer) renderPlayerEvent.entityPlayer, renderPlayerEvent.x, renderPlayerEvent.y, renderPlayerEvent.z); + + + } + + @Override + public void onEntityRenderPost(RenderPlayerEvent.Post renderPlayerEvent) { + } + +} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/resources/DGTexturePack.java b/src/main/java/kr/syeyoung/dungeonsguide/resources/DGTexturePack.java new file mode 100644 index 00000000..a845757d --- /dev/null +++ b/src/main/java/kr/syeyoung/dungeonsguide/resources/DGTexturePack.java @@ -0,0 +1,57 @@ +package kr.syeyoung.dungeonsguide.resources; + +import kr.syeyoung.dungeonsguide.a; +import kr.syeyoung.dungeonsguide.b; +import kr.syeyoung.dungeonsguide.e; +import lombok.AllArgsConstructor; +import net.minecraft.client.resources.IResourcePack; +import net.minecraft.client.resources.data.IMetadataSection; +import net.minecraft.client.resources.data.IMetadataSerializer; +import net.minecraft.util.ResourceLocation; + +import java.awt.image.BufferedImage; +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.net.URL; +import java.util.Collections; +import java.util.Set; + +@AllArgsConstructor +public class DGTexturePack implements IResourcePack { + + private b authenticator; + + @Override + public InputStream getInputStream(ResourceLocation location) throws IOException { + InputStream inputStream = this.getClass().getResourceAsStream("/assets/dg/"+location.getResourcePath()); + if (inputStream != null) return inputStream; + return new ByteArrayInputStream(authenticator.d().get("assets/dg/"+location.getResourcePath())); + } + + @Override + public boolean resourceExists(ResourceLocation location) { + return authenticator.d().containsKey("assets/dg/"+location.getResourcePath()) + || this.getClass().getResourceAsStream("/assets/dg/"+location.getResourcePath()) != null; + } + + @Override + public Set<String> getResourceDomains() { + return Collections.singleton("iamdg"); + } + + @Override + public <T extends IMetadataSection> T getPackMetadata(IMetadataSerializer p_135058_1_, String p_135058_2_) throws IOException { + return null; + } + + @Override + public BufferedImage getPackImage() throws IOException { + return new BufferedImage(512,512, BufferedImage.TYPE_INT_RGB); + } + + @Override + public String getPackName() { + return "Dungeons Guide Default Pack"; + } +} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessorBlazeSolver.java b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessorBlazeSolver.java index d8401756..d8764d72 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessorBlazeSolver.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessorBlazeSolver.java @@ -29,6 +29,7 @@ import org.lwjgl.opengl.GL11; import java.awt.*; import java.util.ArrayList; +import java.util.Comparator; import java.util.List; public class RoomProcessorBlazeSolver extends GeneralRoomProcessor { @@ -85,7 +86,7 @@ public class RoomProcessorBlazeSolver extends GeneralRoomProcessor { } if (semi_target != null) { EntityArmorStand finalSemi_target = semi_target; - nextBlaze = blazeList.stream().filter(e -> e.getDistanceSqToEntity(finalSemi_target) < 9).findFirst().orElse(null); + nextBlaze = blazeList.stream().min(Comparator.comparingDouble(e -> e.getDistanceSqToEntity(finalSemi_target))).orElse(null); } next = semi_target; |