Sublight/Ion engine is voided after removing rocket from launch pad
GalaxinTM opened this issue ยท 2 comments
Do not remove this template, without it your issue will not be considered!
Please fill in the form below:
- Minecraft version: 1.12.2
- Galacticraft version: 4.0.6
- GalaxySpace version: 2.1.4
- AsmodeusCore version (for 2.0.1 version and above): 1.0.2
- Side (Single player (SSP), Multiplayer (SMP), or SSP opened to LAN (LAN)): SMP
- Other add-ons: MorePlanets, GalacticraftTweaker
Description of the issue:
The rocket engine (Ion or Sublight) is voided after placing down and removing the rocket. It's good that the rocket keeps its engine after going to space like it normally does, but for the engine to be voided simply after removing it from the launch pad is a big problem.
What should happen:
- Engine should be preserved when launching, landing, and when removing the rocket
What happens instead:
- The engine gets voided only when you remove the rocket from the launching pad, so you're forced to place the rocket once and never change its position.
Screenshot/Video:
compress.mp4
Attached log file (or url on pastebin.com):
I barely know anything about minecraft modding and how to use github in general, but I've dug into the code and found the code snippet
public List<ItemStack> getItemsDropped(List<ItemStack> droppedItems)
{
super.getItemsDropped(droppedItems);
ItemStack rocket = new ItemStack(GSItems.ROCKET_TIER_6, 1, this.rocketType.getIndex());
rocket.setTagCompound(new NBTTagCompound());
rocket.getTagCompound().setInteger("RocketFuel", this.fuelTank.getFluidAmount());
droppedItems.add(rocket);
return droppedItems;
}
This snippet does not account for the rocket engine being used in the rocket. It's missing a measure that accounts for the engine_type
used.
It affects rockets tier 4 and 5, as they can also have an Ion engine to boost their speed
I made a temporary fix using crafttweaker and zenutils
import mods.zenutils.event.EntityRemoveEvent;
import crafttweaker.world.IBlockPos;
events.onEntityRemove(function(event as EntityRemoveEvent){
val entity = event.entity;
val world = entity.world;
if (("galacticraftcore:rocket_tier_4".matches(entity.definition.id) || "galacticraftcore:rocket_tier_5".matches(entity.definition.id) || "galacticraftcore:rocket_tier_6".matches(entity.definition.id)) && !world.isRemote() && 512 > entity.y) {
if (entity.getNBT().engine_type == 3) {
world.spawnEntity(<galaxyspace:rocket_modules:6>.createEntityItem(world, entity.position3f as IBlockPos)); // thanks friendlyhj
} else if (entity.getNBT().engine_type == 1) {
world.spawnEntity(<galaxyspace:rocket_modules:4>.createEntityItem(world, entity.position3f as IBlockPos));
}
}
});