-
Posts
642 -
Joined
-
Last visited
Everything posted by TheRPGAdventurer
-
Custom GuiButton Texture wont work
TheRPGAdventurer replied to TheRPGAdventurer's topic in Modder Support
what should I put with the 2nd and 4th umm what do we call it again, next to ()? -
package com.TheRPGAdventurer.ROTD.client.gui; import java.io.IOException; import org.lwjgl.input.Keyboard; import org.lwjgl.opengl.GL11; import com.TheRPGAdventurer.ROTD.DragonMounts; import com.TheRPGAdventurer.ROTD.client.inventory.ContainerDragon; import com.TheRPGAdventurer.ROTD.server.entity.EntityTameableDragon; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.client.gui.inventory.GuiInventory; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @SideOnly(Side.CLIENT) public class GuiDragon extends GuiContainer { private static final ResourceLocation texture = new ResourceLocation(DragonMounts.MODID, "textures/gui/dragon.png"); private IInventory playerInventory; private IInventory dragonInv; private EntityTameableDragon dragon; private float mousePosX; private float mousePosY; private LockButton AllowOthers; public static ResourceLocation lockOpen = new ResourceLocation(DragonMounts.MODID, "textures/gui/lock_1.png");; public static ResourceLocation lockLocked = new ResourceLocation(DragonMounts.MODID, "textures/gui/lock_2.png"); private EntityPlayer player; public GuiDragon(IInventory playerInv, EntityTameableDragon dragon) { super(new ContainerDragon(dragon, Minecraft.getMinecraft().player)); this.playerInventory = playerInv; this.dragonInv = dragon.dragonInv; this.player = Minecraft.getMinecraft().player; this.dragon = dragon; this.allowUserInput = false; this.ySize = 214; } /** * Draw the foreground layer for the GuiContainer (everything in front of the * items) */ protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) { float scale = dragon.getScale(); this.fontRenderer.drawString(dragon.hasCustomName() ? dragon.getCustomNameTag() : "Dragon Inventory", 8, 6, dragon.getBreed().getColor()); this.fontRenderer.drawString(dragon.isMale() ? "M" : "FM", 160, 6, dragon.isMale() ? 0x0079be : 0Xff8b8b); } @Override protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) { GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); this.mc.getTextureManager().bindTexture(texture); int x = (this.width - this.xSize) / 2; int y = (this.height - this.ySize) / 2; this.drawTexturedModalRect(x, y, 0, 0, this.xSize, this.ySize); if (dragon.isChested()) { this.drawTexturedModalRect(x + 0, y + 73, 0, 130, 170, 55); } GuiInventory.drawEntityOnScreen(x + 80, y + 65, (int) (13 / dragon.getScale()), x + 51 - this.mousePosX, y + 75 - 50 - this.mousePosY, this.dragon); } @Override public void initGui() { this.buttonList.clear(); Keyboard.enableRepeatEvents(true); buttonList.add(this.AllowOthers = new LockButton(width/2 + 100, height/2 + 16, 50, 3, 3, I18n.format("gui.allowothers", new Object[0]))); super.initGui(); } @Override protected void actionPerformed(GuiButton button) throws IOException { // if(button == AllowOthers) { // dragon.setToAllowedOtherPlayers(!dragon.allowedOtherPlayers()); // } } // public void updateScreen() { // AllowOthers.visible = (player == dragon.getOwner()); // } @Override public void drawScreen(int mouseX, int mouseY, float partialTicks) { this.drawDefaultBackground(); this.mousePosX = mouseX; this.mousePosY = mouseY; super.drawScreen(mouseX, mouseY, partialTicks); this.renderHoveredToolTip(mouseX, mouseY); } static class LockButton extends GuiButton { private boolean isLocked; public LockButton(int buttonId, int x, int y, int i, int j, String buttonText) { super(buttonId, x, y, buttonText); } /** * Draws this button to the screen. */ @Override public void drawButton(Minecraft mc, int parX, int parY, float partialTicks) { if (visible) { boolean isButtonPressed = (parX >= x && parY >= y && parX < x + width && parY < y + height); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); int textureX = 0; int textureY = 0; // if(dragon.allowedOtherPlayers()) { // mc.getTextureManager().bindTexture(lockOpen); // } else { mc.getTextureManager().bindTexture(lockLocked); // } // if (isButtonPressed) // { // textureX += 23; // } // if (!isNextButton) // { // textureY += 13; // } // drawTexturedModalRect(x, y, // this., // 16, 16); drawTexturedModalRect(x, y, 0, 0, 16, 16); } } // @Nullable // @SideOnly(Side.CLIENT) // public net.minecraft.client.renderer.texture.TextureAtlasSprite getBackgroundSprite() { // String name = getSlotTexture(); // return name == null ? null : getBackgroundMap().getAtlasSprite(name); // } } }
-
@SubscribeEvent public void thirdPersonCameraFix(EntityViewRenderEvent.CameraSetup event) { EntityPlayer player = Minecraft.getMinecraft().player; Vec3d vec = player.rayTrace(10, player.ticksExisted).hitVec; Vec3d distToBlock = player.getLook(player.ticksExisted).subtract(vec); if(player.getRidingEntity() instanceof EntityTameableDragon) { float scale = MathX.clamp(((EntityTameableDragon) player.getRidingEntity()).getScale(), 0.1f, 1f); if(Minecraft.getMinecraft().gameSettings.thirdPersonView == 1) { GlStateManager.translate(0F - vec.x, -1.7F - vec.y, -DragonMountsConfig.ThirdPersonZoom * scale - vec.z); } if(Minecraft.getMinecraft().gameSettings.thirdPersonView == 2) { GlStateManager.translate(0F - vec.x, -1.8F - vec.y, DragonMountsConfig.ThirdPersonZoom * scale - vec.z); } } else if(player.getRidingEntity() instanceof EntityCarriage) { if(Minecraft.getMinecraft().gameSettings.thirdPersonView == 1) { GlStateManager.translate(0F - vec.x, -1.8F - vec.y, -10.8 - vec.z); } if(Minecraft.getMinecraft().gameSettings.thirdPersonView == 2) { GlStateManager.translate(0F - vec.x, -1.8F - vec.y, 10.8 - vec.z); } } } } How's this
-
build path errors from updating llibrary
TheRPGAdventurer replied to TheRPGAdventurer's topic in Modder Support
https://pastebin.com/J4DwGxZk crash log -
So i cant use dependencies in build.gradle to add llibrary to my mod so I have to add it in libs folder instead, problem is that when i updated llibrary and deleted the older one MDK is still asking for the old one Description Resource Path Location Type Project '.org.eclipse.jdt.core.external.folders' is missing required library: 'C:\Users\win7\Desktop\MDK\dragonmount 2\dragon mounts 2-1.12.2\libs\llibrary-1.7.9-1.12-dev.jar' .org.eclipse.jdt.core.external.folders Build path Build Path Problem
-
Also away from this I have a new truble is EntityAITasks.EntityAITAskEntry became private? java.lang.BootstrapMethodError: java.lang.IllegalAccessError: Class 'com.TheRPGAdventurer.ROTD.server.entity.helper.DragonBrain' no access to: class 'net.minecraft.entity.ai.EntityAITasks$EntityAITaskEntry' I get this error from this public void clearTasks() { clearTasks(tasks); clearTasks(targetTasks); } public void clearTasks(EntityAITasks tasks) { List<EntityAITaskEntry> taskEntries = new ArrayList<>(tasks.taskEntries); taskEntries.forEach(entry -> tasks.removeTask(entry.action)); }
-
/** * Called when the mob's health reaches 0. */ public void onDeath(DamageSource src) { super.onDeath(src); if (dragonInv != null && !this.world.isRemote && !isEgg()) { for (int i = 0; i < dragonInv.getSizeInventory(); ++i) { ItemStack itemstack = dragonInv.getStackInSlot(i); if (!itemstack.isEmpty()) { this.entityDropItem(itemstack, 0.0F); } } } if(!this.world.isRemote) { if(this.isTamed()) { ItemDragonEssence essence = dragonEssence(); ItemStack essence1 = new ItemStack(essence); essence.setDragonNBT(this, essence1); entityDropItem(essence1, 1); } } }
-
public void setDragonNBT(EntityTameableDragon dragon, ItemStack stack) { NBTTagCompound nbt = stack.getTagCompound(); if (stack.hasTagCompound()) { nbt = stack.getTagCompound(); } else { nbt = new NBTTagCompound(); } stack.setTagCompound(nbt); if(stack.getTagCompound() != null) { nbt.setUniqueId("essenceDragonId", dragon.getUniqueID()); nbt.setUniqueId("essenceOwnerId" , dragon.getOwnerId ()); if(dragon.hasCustomName()) nbt.setString("name", dragon.getCustomNameTag()); } } like this, they drop but they wont spawn
-
somehow it doesnt work when it dies, you can respawn it by right clicking it on the ground public void setDragonNBT(EntityTameableDragon dragon) { ItemStack stack = new ItemStack(this); NBTTagCompound nbt = stack.getTagCompound(); if (stack.hasTagCompound()) { nbt = stack.getTagCompound(); } else { nbt = new NBTTagCompound(); } stack.setTagCompound(nbt); if(stack.getTagCompound() != null) { nbt.setUniqueId("essenceDragonId", dragon.getUniqueID()); nbt.setUniqueId("essenceOwnerId" , dragon.getOwnerId ()); if(dragon.hasCustomName()) nbt.setString("name", dragon.getCustomNameTag()); } }
-
/** * Called when the mob's health reaches 0. */ public void onDeath(DamageSource src) { super.onDeath(src); if (dragonInv != null && !this.world.isRemote && !isEgg()) { for (int i = 0; i < dragonInv.getSizeInventory(); ++i) { ItemStack itemstack = dragonInv.getStackInSlot(i); if (!itemstack.isEmpty()) { this.entityDropItem(itemstack, 0.0F); } } } if(!this.world.isRemote) { if(this.isTamed()) { ItemDragonEssence essence = dragonEssence(); essence.setDragonNBT(this); entityDropItem(new ItemStack(essence), 1); } } } public void setDragonNBT(EntityTameableDragon dragon) { ItemStack stack = new ItemStack(this); NBTTagCompound nbt = stack.getTagCompound(); if (stack.hasTagCompound()) { nbt = stack.getTagCompound(); } else { nbt = new NBTTagCompound(); } stack.setTagCompound(nbt); if(stack.getTagCompound() != null) { nbt.setUniqueId("essenceDragonId", dragon.getUniqueID()); nbt.setUniqueId("essenceOwnerId" , dragon.getOwnerId ()); if(dragon.hasCustomName()) nbt.setString("name", dragon.getCustomNameTag()); } } So if a dragon is tamed and it dies, it will store its uuid and owner uuid so that players can respawn it.
-
public BlockPos onGroundAir() { BlockPos pos = this.getPosition(); // for(int width = 1; width <= this.width / 2; width++) { for(int y = 1; y <= 3.4; y++) { pos = new BlockPos(posX - width + width, posY - y * MathX.clamp(this.getScale(), 0.1, 1), posZ - width + width); } // } return pos; } public boolean onSolidGround() { IBlockState state = world.getBlockState(onGroundAir()); return !state.getMaterial().isSolid(); } I had these two methods, basically they detect if the ground 3.4 blocks below the dragon is Air, if not then the dragon is setFlying to false, basically it detects if the dragon is onGround or not, and I cant use the normal vailla onGround method because they require the dragon to be directly sticking to the block and if at least one block above is blocking it looks silly flying on the ground. I want to do it again but in a bigger area "square" with more blocks around, because the method above is only one line tall and is the middle of the dragon. Ill use it if the area above dragon is bug enough so it is able to fly around. They get stuck flying below the trees. this question is pretty basic.
-
a generic type of “event” i.e. something that happens. when you use the dragon essence and that "something that happens " is when respawning your dragon, I really need some methods for checking the blocks around it and where to call it, also where do I call it, I cant vaguely call it on the entity's class, so its gotta be something in the world