-
Posts
13 -
Joined
-
Last visited
-
Days Won
1
Everything posted by UndeadMonkey
-
Hello, I'm making an Halo mod with the goal to achieve the scope of the games universe in Minecraft. I've made over 63 models for this project alone but I haven't managed to implement any of them to Minecraft yet but with your help I could make this project come to life. My vision for this mod is to have auto generated structures from wich factions like the covenant, banished and flood will spawn from. Each faction is hostile to one another and will attack each other and other mobs on sight. Each faction will grow increasingly stronger as you kill them or by naturally leveling up as they spread. Theirs an arsenal of weapons you can pick up from said faction to give them a taste of their own medicine. My priority is on adding the covenant first as each faction will be added step by step. Here's what I've done so far :
-
I'm trying to create a custom vehicle that can hover around. Copy pasted the boats code as a base, am I on the right track ? package net.undeadmonkey.entity.custom; import net.minecraft.BlockUtil; import net.minecraft.core.Direction; import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataSerializers; import net.minecraft.network.syncher.SynchedEntityData; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.*; import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.vehicle.Boat; import net.minecraft.world.level.GameRules; import net.minecraft.world.level.Level; import net.minecraft.world.level.gameevent.GameEvent; import net.minecraft.world.phys.Vec3; public class HaloGhostEntity extends Boat { private static final EntityDataAccessor<Integer> DATA_ID_HURT = SynchedEntityData.defineId(Boat.class, EntityDataSerializers.INT); private static final EntityDataAccessor<Integer> DATA_ID_HURTDIR = SynchedEntityData.defineId(Boat.class, EntityDataSerializers.INT); private static final EntityDataAccessor<Float> DATA_ID_DAMAGE = SynchedEntityData.defineId(Boat.class, EntityDataSerializers.FLOAT); private static final EntityDataAccessor<Boolean> DATA_ID_HOVER_LEFT = SynchedEntityData.defineId(Boat.class, EntityDataSerializers.BOOLEAN); private static final EntityDataAccessor<Boolean> DATA_ID_HOVER_RIGHT = SynchedEntityData.defineId(Boat.class, EntityDataSerializers.BOOLEAN); public static final int HOVER_LEFT = 0; public static final int HOVER_RIGHT = 1; private static final int TIME_TO_EJECT = 60; private static final float HOVER_SPEED = ((float)Math.PI / 8F); public static final double HOVER_SOUND_TIME = (double)((float)Math.PI / 4F); private final float[] hoverPositions = new float[2]; private float invFriction; private float outOfControlTicks; private float deltaRotation; private int lerpSteps; private double lerpX; private double lerpY; private double lerpZ; private double lerpTo; private double lerpYRot; private double lerpXRot; private boolean inputLeft; private boolean inputRight; private boolean inputUp; private boolean inputDown; private float landFriction; private HaloGhostEntity.Status status; private HaloGhostEntity.Status oldStatus; private double lastYd; private boolean isAboveBubbleColumn; private boolean bubbleColumnDirectionIsDown; private float bubbleMultiplier; private float bubbleAngle; private float bubbleAngleO; public HaloGhostEntity(EntityType<? extends HaloGhostEntity> p_38290_, Level p_38291_) { super(p_38290_, p_38291_); } public HaloGhostEntity(Level p_38293_, double p_38294_, double p_38295_, double p_38296_) { this((EntityType<? extends HaloGhostEntity>) EntityType.BOAT, p_38293_); this.setPos(p_38294_, p_38295_, p_38296_); this.xo = p_38294_; this.yo = p_38295_; this.zo = p_38296_; } protected float getEyeHeight(Pose pPose, EntityDimensions pSize) { return pSize.height; } protected Entity.MovementEmission getMovementEmission() { return Entity.MovementEmission.NONE; } protected void defineSynchedData() { this.entityData.define(DATA_ID_HURT, 0); this.entityData.define(DATA_ID_HURTDIR, 1); this.entityData.define(DATA_ID_DAMAGE, 5.0f); this.entityData.define(DATA_ID_HOVER_LEFT, false); this.entityData.define(DATA_ID_HOVER_RIGHT,false); } public boolean canCollideWith(Entity pEntity) { return canVehicleCollide(this, pEntity); } public static boolean canVehicleCollide(Entity p_38324_, Entity p_38325_) { return (p_38325_.canBeCollidedWith() || p_38325_.isPushable()) && !p_38324_.isPassengerOfSameVehicle(p_38325_); } public boolean canBeCollidedWith() { return true; } public boolean isPushable() { return true; } protected Vec3 getRelativePortalPosition(Direction.Axis pAxis, BlockUtil.FoundRectangle pPortal) { return LivingEntity.resetForwardDirectionOfRelativePortalPosition(super.getRelativePortalPosition(pAxis, pPortal)); } public double getPassengersRidingOffset() { return -0.1D; } public boolean hurt(DamageSource pSource, float pAmount) { if (this.isInvulnerableTo(pSource)) { return false; } else if (!this.level.isClientSide && !this.isRemoved()) { this.setHurtDir(-this.getHurtDir()); this.setHurtTime(10); this.setDamage(this.getDamage() + pAmount * 10.0F); this.markHurt(); this.gameEvent(GameEvent.ENTITY_DAMAGED, pSource.getEntity()); boolean flag = pSource.getEntity() instanceof Player && ((Player)pSource.getEntity()).getAbilities().instabuild; if (flag || this.getDamage() > 40.0F) { if (!flag && this.level.getGameRules().getBoolean(GameRules.RULE_DOENTITYDROPS)) { this.spawnAtLocation(this.getDropItem()); } this.discard(); } return true; } else { return true; } } public void push(Entity pEntity) { if (pEntity instanceof Boat) { if (pEntity.getBoundingBox().minY < this.getBoundingBox().maxY) { super.push(pEntity); } } else if (pEntity.getBoundingBox().minY <= this.getBoundingBox().minY) { super.push(pEntity); } public void animateHurt() { this.setHurtDir(-this.getHurtDir()); this.setHurtTime(10); this.setDamage(this.getDamage() * 11.0F); } } }
-
There are many functions I want to implement like a scroll bar and custom player inventory linked to my container gui.
-
My issue is that it doesn't function like what the textures display.
-
-
Wich code feature ?
-
package com.undeadmonkey.residentevilmod.client.screen; import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.systems.RenderSystem; import com.undeadmonkey.residentevilmod.ResidentevilMod; import com.undeadmonkey.residentevilmod.common.container.ItemBoxContainer; import net.minecraft.client.gui.screen.inventory.ContainerScreen; import net.minecraft.entity.player.PlayerInventory; import net.minecraft.util.ResourceLocation; import net.minecraft.util.text.ITextComponent; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; @OnlyIn(Dist.CLIENT) public class ItemBoxScreen extends ContainerScreen<ItemBoxContainer> { private static final ResourceLocation ITEM_BOX_GUI = new ResourceLocation(ResidentevilMod.MOD_ID, "textures/gui/item_box.png"); public ItemBoxScreen(ItemBoxContainer screenContainer, PlayerInventory inv, ITextComponent titleIn) { super(screenContainer, inv, titleIn); this.guiLeft = 0; this.guiTop = 0; this.xSize = 176; this.ySize = 176; } @Override public void render(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) { this.renderBackground(matrixStack); super.render(matrixStack, mouseX, mouseY, partialTicks); this.renderHoveredTooltip(matrixStack, mouseX, mouseY); } @Override protected void drawGuiContainerForegroundLayer(MatrixStack matrixStack, int x, int y) { this.font.func_243248_b(matrixStack, this.playerInventory.getDisplayName(), (float) this.playerInventoryTitleX, (float) this.playerInventoryTitleX, 4210752); } @SuppressWarnings("deprecation") @Override protected void drawGuiContainerBackgroundLayer(MatrixStack matrixStack, float partialTicks, int mouseX, int mouseY) { RenderSystem.color4f(1f, 1f, 1f, 1f); this.minecraft.textureManager.bindTexture(ITEM_BOX_GUI); int x = (this.width - this.xSize) / 2; int y = (this.height - this.ySize) / 2; this.blit(matrixStack, x, y, 0, 0, this.xSize, this.ySize); } }
-
This my GUI for reference, the players inventory is on the right, if there's no hot bar on display that's intentional, the container inventory window is on the left, on the bottom left there's a large black screen wich is supposed to be a typewriter. How do I make it function like intended ?