-
Posts
260 -
Joined
-
Last visited
Posts posted by LogicTechCorp
-
-
Following code only spawns a pig.
EntityRegistry.registerModEntity(RobotHelper.class, "robotHelper", 0, this, 64, 1, true); EntityRegistry.registerEgg(RobotHelper.class, mainColor, subColor);
Following code spawns the entity but everytime i load the world from save the entity loads, stays there for 5 sec, then vanish, saving the map loading it again the entity again show up for 5 sec then vanish.
I'm overriding canDespawn and return false, i also tried setting enablePersistence() and forcing age to 0.
int i =EntityRegistry.instance().findGlobalUniqueEntityId(); EntityRegistry.registerGlobalEntityID(RobotHelper.class,"robotHelper",i); EntityRegistry.registerModEntity(RobotHelper.class, "robotHelper", i, this, 64, 1, true); EntityRegistry.registerEgg(RobotHelper.class, mainColor, subColor);
Im sure im the one doing something wrong here, but im clueless at this point to why it is vanishing.
Same thing is happening to me. I have yet to figure out a solution.
-
Your entity is disappearing because you told it to
if(this.ticksExisted >= 6000) { this.setDead(); }
That sets the entity dead after 5 minutes. And the issue still occurs without this piece of code.
-
Sorry to bump but this kind of got buried under the rest of the posts.
-
First, I have an entity that has a grayscale texture and I would like it to transition between two different colors, how would I do this?
Second, when my entity is spawned in, it appears for a few seconds, then disappears for 10-15 seconds and reappears. Is it a current bug in forge or is it something I am doing wrong?
Entity class: https://github.com/LogicTechCorp/SoulMagic/blob/1.9/src/main/java/soulmagic/entity/item/EntitySoul.java
Entity render: https://github.com/LogicTechCorp/SoulMagic/blob/1.9/src/main/java/soulmagic/client/render/entiy/SoulRenderFactory.java
-
I know the best thing to do is to wait for an official MDK but I would like to get right into 1.9. How would I setup a 1.9 workspace with the files from github?
-
How would I set up my build.gradle to allow drone.io and github integration. I would like drone.io to house all of my mod's builds(obfuscated and deobfuscated jars).
-
I have figured it out thanks to one of Jabelar's tutorials, albeit a few issues. One, the entity does not render correctly. It renders the color incorrectly, depending on the side/angle viewed. Two, when looking at the entity it causes the item/block that is in the players hand and items on the floor to turn blue/black.
Client Proxy:
Render Class:
-
You will have to figure out how to draw that using regular OpenGL (maybe a tesselator) and then hook into
@SubscribeEvent(receiveCanceled=false) public void onEvent(RenderGameOverlayEvent.Pre event) {
and call your draw method.
I would like to render it as 3D not a 2D Image. The image is an example of how I would like it to look.
-
I have an entity which I want to render as a sphere. Just like this:
It is a little hard to tell but there is three spheres, The inner purple/blue, the middle dark purple/black and the outer red haze. How would I achieve this?
-
As the title says, How would I add a new biome to the nether? Is it the same as adding one to the surface?
-
I'm worried that AND 2 will mask out the value 1, leaving only 0 or 2.
I think that may be the issue, how would I fix it?
And what about Z-axis rotation? Is "X-axis" a misnomer? Is it really the facing-axis?
I rotate the block depending on whether the side is hit (X or Z axis) or the top/bottom is hit (Y axis).
Are all neutral orientations equivalent? Is there no difference between RIGHT and LEFT sideways reflections?
As for the sideways orientation there is a sideways orientation for each horizontal direction, sideways + north, sideways + east, sideways + south, and sideways + west.
Edit: Renamed neutral to sideways
-
I am using onBlockActivated to rotate the block. It works correctly on all of the blocks except meta four and five. When I cycle the POSITION property it only cycles between up and down instead of up, neutral, and down.
@Override public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY, float hitZ) { if(player.isSneaking()) { if(side.getAxis().isHorizontal()) { world.setBlockState(pos, state.cycleProperty(FACING)); } else { //This cycles the POSITION property world.setBlockState(pos, state.cycleProperty(POSITION)); } } return false; }
-
That looks correct, yes.
When I break the block with meta four and five the game crashes.
Crash:
java.lang.ArrayIndexOutOfBoundsException: 3 at luxcraft.block.BlockReflector.getStateFromMeta(BlockReflector.java:80) at net.minecraft.client.renderer.RenderGlobal.playAuxSFX(RenderGlobal.java:2287) at net.minecraft.world.World.playAuxSFXAtEntity(World.java:3827) at net.minecraft.world.World.playAuxSFX(World.java:3818) at net.minecraft.client.multiplayer.PlayerControllerMP.onPlayerDestroyBlock(PlayerControllerMP.java:159) at net.minecraft.client.multiplayer.PlayerControllerMP.clickBlockCreative(PlayerControllerMP.java:66) at net.minecraft.client.multiplayer.PlayerControllerMP.clickBlock(PlayerControllerMP.java:227) at net.minecraft.client.Minecraft.clickMouse(Minecraft.java:1511) at net.minecraft.client.Minecraft.runTick(Minecraft.java:2118) at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1080) at net.minecraft.client.Minecraft.run(Minecraft.java:380) at net.minecraft.client.main.Main.main(Main.java:116) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) at net.minecraft.launchwrapper.Launch.main(Launch.java:28) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) at GradleStart.main(GradleStart.java:26) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)
Class:
public class BlockReflector extends Block { public static final PropertyEnum POSITION = PropertyEnum.create("position", Position.class); public static final PropertyDirection FACING = PropertyDirection.create("facing", EnumFacing.Plane.HORIZONTAL); public BlockReflector() { super(Material.glass); } @Override public boolean isOpaqueCube() { return false; } @Override public boolean isFullCube() { return false; } @Override public boolean isVisuallyOpaque() { return false; } @Override public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY, float hitZ) { if(player.isSneaking()) { if(side.getAxis().isHorizontal()) { world.setBlockState(pos, state.cycleProperty(FACING)); } else { world.setBlockState(pos, state.cycleProperty(POSITION)); } } return false; } @Override public IBlockState onBlockPlaced(World world, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) { IBlockState state = this.getDefaultState().withProperty(FACING, placer.getHorizontalFacing()); return hitY == 0 ? state.withProperty(POSITION, Position.UP) : hitY == 1 ? state.withProperty(POSITION, Position.DOWN) : state.withProperty(POSITION, Position.NEUTRAL); } @Override public BlockState createBlockState() { return new BlockState(this, POSITION, FACING); } @Override public IBlockState getStateFromMeta(int meta) { return this.getDefaultState().withProperty(POSITION, Position.values()[(meta >> 2)]).withProperty(FACING, EnumFacing.getHorizontal((meta & 3))); } @Override public int getMetaFromState(IBlockState state) { int p = ((Position) state.getValue(POSITION)).ordinal(); int f = state.getValue(FACING).getIndex(); return p << 2 | f; } public enum Position implements IStringSerializable { UP("up"), NEUTRAL("neutral"), DOWN("down"); private final String name; Position(String name) { this.name = name; } @Override public String getName() { return this.name; } } }
-
I have createBlockState but I am not sure how to implement getStateFromMeta and getMetaFromState.
I suggest storing the
FACING
values's horizontal index (
EnumFacing#getHorizontalIndex
, an integer in the range
[0,3]
) in the lower two bits of the metadata and the
POSITION
value's ordinal (
Position#ordinal
, an integer in the range
[0,2]
) or a similar index field in the higher two bits of the metadata. Shift the
POSITION
index left 2 bits (
<<
) then OR (
|
) it with the
FACING
index.
To get the
FACING
value from the metadata, AND (
&
) it with 3 (the maximum index) and use
EnumFacing.getHorizontal
to convert it to an
EnumFacing
. To get the
POSITION
value from the metadata, shift it right 2 bits (
>>
), and it with 2 (the maximum index) and get the
Position
at that index of the array returned by
Potion#values
.
I'll try to implement this myself to provide an example of how it's done.
Is this correct?
@Override public BlockState createBlockState() { return new BlockState(this, POSITION, FACING); } @Override public IBlockState getStateFromMeta(int meta) { return this.getDefaultState().withProperty(POSITION, Position.values()[(meta >> 2)]).withProperty(FACING, EnumFacing.getHorizontal((meta & 3))); } @Override public int getMetaFromState(IBlockState state) { int p = ((Position) state.getValue(POSITION)).ordinal(); int f = state.getValue(FACING).getIndex(); return p << 2 | f; }
-
That should be suitable, but you still need to create the
BlockState
and convert between state and metadata.
I have createBlockState but I am not sure how to implement getStateFromMeta and getMetaFromState.
-
You can probably use an
EnumFacing
property limited to
Plane.HORIZONTAL
for the y-axis rotation and a custom enum property with
UP
,
DOWN
and
SIDEWAYS
values for the x-axis rotation. You can integrate the custom enum with
EnumFacing
and its subclasses if needed.
Would this be suitable?
public class BlockReflector extends Block { public static final PropertyEnum POSITION = PropertyEnum.create("position", Position.class); public static final PropertyDirection FACING = PropertyDirection.create("facing", EnumFacing.Plane.HORIZONTAL); public BlockReflector() { super(Material.glass); } public enum Position implements IStringSerializable { UP("up"), NEUTRAL("neutral"), DOWN("down"); private final String name; Position(String name) { this.name = name; } @Override public String getName() { return this.name; } } }
-
Pretty sure those diagonal side faces are cheated. That is: they're still squares with fully transparent pixels.
Still not sure on the rendering part. I was thinking about using EnumFacing$Plane.Horizontal for NESW, and EnumFacing$Plane.Vertical for up and down but that would leave out sideways. Should I make my own Enum that includes sideways or will it not work correctly?
-
I am trying to implement a block to reflect a light beam. First, the block needs to be placed facing up, down, and sideways along with facing in each direction. How would I implement this? Second, How would I render my block in half on each diagonal?
Example Image:
-
Ah, so they are like different blades or something to that effect that the player carries around in a pouch and swaps at will? Or should the upgrades be more like player abilities that they gain when finding / using special items? E.g. after consuming some kind of power-up the player can then channel that power through their scythe?
The reason I ask is because the implementation can be very different depending on exactly how you want it to play out. If they really are items that can be swapped in and out of the scythe on the fly, then sure, your idea of the implementation is fine, but if you only decided to use a pouch because you weren't sure how to implement your first idea (whatever that may have been), then I think we can do better.
The idea is similar to Thaumcraft's wands and foci.
Wand:
http://thaumcraft-4.wikia.com/wiki/Wands
Foci:
http://thaumcraft-4.wikia.com/wiki/Wand_Foci
Focus Pouch:
http://thaumcraft-4.wikia.com/wiki/Focus_Pouch
Anyway, regardless of how you decide to implement it, changing state (server-side) based on a key press (client-side) will require packets - do you have any experience with those?
I do not have any experience with packets.
-
Right, I understood that's how you intend to implement it, but what exactly are you trying to do in terms of the game? I mean, why does the scythe move an item into the pouch? How are they related?
For example, in my mod I have several projectile weapons that can each use different ammo which can be selected from the player's current inventory, but instead of storing that item in the projectile weapon, I just store the selected ammo type's index and retrieve it when needed.
So, depending on what the relationship of the scythe and pouch is, you may not need to move things, is all I'm trying to say.
To be honest, I really dont see why you would store something in a scythe and what a pouch would have anything to do with it.
The scythe will have a different ability based on the item/upgrade inside, reaping, tilling, healing etc. The pouch is so the player does not have to have their inventory cluttered with multiple upgrades.
-
Exactly what starwarsmace stated.I would opt for not moving anything at all - why not simply have the scythe hold an integer slot index for the pouch item? Or does the item have to exist in the scythe? Perhaps you could describe the concept in a little more detail?
I think what he means is that the scythe inventory is completely unrelated from the pouch inventory. But, when you press a certain key it switches the item that's stored in the scythe, and moves it over the to the end of the pouch. But that first item in the pouch is moved over to the scythe inventory. It then moves over all the original pouch items one slot, so the scythe item is at the end.
-
I have a scythe that can hold one item and a pouch that can hold nine items. I would like to swap the item in the scythe for the first item in the pouch, and move the items in the pouch up a slot and add the item from the scythe to the end. Which would be the best way to do this?
Side Note: I already have the key handler implemented
-
I have an item that has a one slot inventory. I would like to write NBT to the item based on the item in the inventory. How would I do so?
-
I have looked at TGG's tutorials on this and I am still not sure how to do it.
[1.9] Grayscale texture coloring issue
in Modder Support
Posted
I have a Soul entity that uses a grayscale texture. I color the texture depending on which mob it came from. The colors are the exact same as the entity's spawn egg, some of the colors work while other do not. Am I doing something wrong?
Entity:
https://github.com/LogicTechCorp/SoulMagic/blob/1.9/src/main/java/soulmagic/entity/item/EntitySoul.java
Render:
https://github.com/LogicTechCorp/SoulMagic/blob/1.9/src/main/java/soulmagic/client/render/entiy/SoulRenderFactory.java
Soul/Color:
https://github.com/LogicTechCorp/SoulMagic/blob/1.9/src/main/java/soulmagic/api/soul/Soul.java#L24-L48