Skip to content

Commit

Permalink
Soul lantern, soul torch, fix boatInfo error
Browse files Browse the repository at this point in the history
Mangrove and cherry boats had wrong plank meta
  • Loading branch information
Roadhog360 committed Mar 21, 2024
1 parent 847fb6c commit 9b2c785
Show file tree
Hide file tree
Showing 27 changed files with 201 additions and 16 deletions.
2 changes: 0 additions & 2 deletions src/main/java/ganymedes01/etfuturum/EtFuturum.java
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,6 @@ public void displayAllReleventItems(List list) {
}
};

static final Map<ItemStack, Integer> DEFAULT_COMPOST_CHANCES = new LinkedHashMap<>();

@EventHandler
public void onConstruction(FMLConstructionEvent event) {
MCLib.init();
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/ganymedes01/etfuturum/ModBlocks.java
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,9 @@ public enum ModBlocks {
IRON_TRAPDOOR(ConfigBlocksItems.enableIronTrapdoor, new BlockIronTrapdoor()),
MAGMA(ConfigBlocksItems.enableMagmaBlock, new BlockMagma()),
BARREL(ConfigBlocksItems.enableBarrel, new BlockBarrel()),
LANTERN(ConfigBlocksItems.enableLantern, new BlockLantern()),
LANTERN(ConfigBlocksItems.enableLantern, new BlockLantern("lantern", 15)),
SOUL_LANTERN(ConfigBlocksItems.enableLantern && ConfigBlocksItems.enableSoulLighting, new BlockLantern("soul_lantern", 10)),
SOUL_TORCH(ConfigBlocksItems.enableSoulLighting, new BlockSoulTorch()),
SMOKER(ConfigBlocksItems.enableSmoker, new BlockSmoker(false)),
LIT_SMOKER(ConfigBlocksItems.enableSmoker, new BlockSmoker(true), null),
BLAST_FURNACE(ConfigBlocksItems.enableBlastFurnace, new BlockBlastFurnace(false)),
Expand Down
10 changes: 5 additions & 5 deletions src/main/java/ganymedes01/etfuturum/ModItems.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,14 @@ public enum ModItems {
ACACIA_CHEST_BOAT(ConfigBlocksItems.enableNewBoats, new ItemNewBoat("minecraft", "acacia", () -> Item.getItemFromBlock(Blocks.planks), 4, true, false)),
DARK_OAK_BOAT(ConfigBlocksItems.enableNewBoats, new ItemNewBoat("minecraft", "dark_oak", () -> Item.getItemFromBlock(Blocks.planks), 5, false, false)),
DARK_OAK_CHEST_BOAT(ConfigBlocksItems.enableNewBoats, new ItemNewBoat("minecraft", "dark_oak", () -> Item.getItemFromBlock(Blocks.planks), 5, true, false)),
CHERRY_BOAT(ConfigBlocksItems.enableNewBoats && ConfigBlocksItems.enableCherryBlocks, new ItemNewBoat("minecraft", "cherry", ModBlocks.WOOD_PLANKS::getItem, 2, false, false)),
CHERRY_CHEST_BOAT(ConfigBlocksItems.enableNewBoats && ConfigBlocksItems.enableCherryBlocks, new ItemNewBoat("minecraft", "cherry", ModBlocks.WOOD_PLANKS::getItem, 2, true, false)),
MANGROVE_OAK_BOAT(ConfigBlocksItems.enableNewBoats && ConfigExperiments.enableMangroveBlocks, new ItemNewBoat("minecraft", "mangrove", ModBlocks.WOOD_PLANKS::getItem, 3, false, false)),
MANGROVE_CHEST_BOAT(ConfigBlocksItems.enableNewBoats && ConfigExperiments.enableMangroveBlocks, new ItemNewBoat("minecraft", "mangrove", ModBlocks.WOOD_PLANKS::getItem, 3, true, false)),
MANGROVE_OAK_BOAT(ConfigBlocksItems.enableNewBoats && ConfigExperiments.enableMangroveBlocks, new ItemNewBoat("minecraft", "mangrove", ModBlocks.WOOD_PLANKS::getItem, 2, false, false)),
MANGROVE_CHEST_BOAT(ConfigBlocksItems.enableNewBoats && ConfigExperiments.enableMangroveBlocks, new ItemNewBoat("minecraft", "mangrove", ModBlocks.WOOD_PLANKS::getItem, 2, true, false)),
CHERRY_BOAT(ConfigBlocksItems.enableNewBoats && ConfigBlocksItems.enableCherryBlocks, new ItemNewBoat("minecraft", "cherry", ModBlocks.WOOD_PLANKS::getItem, 3, false, false)),
CHERRY_CHEST_BOAT(ConfigBlocksItems.enableNewBoats && ConfigBlocksItems.enableCherryBlocks, new ItemNewBoat("minecraft", "cherry", ModBlocks.WOOD_PLANKS::getItem, 3, true, false)),
// BAMBOO_RAFT(ConfigBlocksItems.enableNewBoats, new ItemNewBoat("minecraft", "bamboo", ModBlocks.WOOD_PLANKS::getItem, 4, false, true)),
// BAMBOO_CHEST_RAFT(ConfigBlocksItems.enableNewBoats, new ItemNewBoat("minecraft", "bamboo", ModBlocks.WOOD_PLANKS::getItem, 4, true, true)),

//legacy sign items -- new signs use their ItemBlock at the sign item instead
//legacy sign items -- new signs use their ItemBlock as the sign item instead
ITEM_SIGN_SPRUCE(ConfigBlocksItems.enableSigns, new ItemWoodSign((BlockWoodSign) ModBlocks.SIGN_SPRUCE.get())),
ITEM_SIGN_BIRCH(ConfigBlocksItems.enableSigns, new ItemWoodSign((BlockWoodSign) ModBlocks.SIGN_BIRCH.get())),
ITEM_SIGN_JUNGLE(ConfigBlocksItems.enableSigns, new ItemWoodSign((BlockWoodSign) ModBlocks.SIGN_JUNGLE.get())),
Expand Down
13 changes: 6 additions & 7 deletions src/main/java/ganymedes01/etfuturum/blocks/BlockLantern.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import ganymedes01.etfuturum.EtFuturum;
import ganymedes01.etfuturum.ModBlocks;
import ganymedes01.etfuturum.client.sound.ModSounds;
import ganymedes01.etfuturum.configuration.configs.ConfigSounds;
import ganymedes01.etfuturum.core.utils.Utils;
import ganymedes01.etfuturum.lib.RenderIDs;
import net.minecraft.block.*;
Expand All @@ -16,21 +15,21 @@

public class BlockLantern extends Block {

public BlockLantern() {
public BlockLantern(String name, int lightLevel) {
super(Material.iron);
float r = 0.0625F;
float f = 0.375F;
float f1 = f / 2.0F;
this.setHarvestLevel("pickaxe", 0);
this.setStepSound(ConfigSounds.newBlockSounds ? ModSounds.soundLantern : soundTypeMetal);
Utils.setBlockSound(this, ModSounds.soundLantern);
Utils.setLightLevel(this, lightLevel);
this.setHardness(3.5F);
this.setResistance(3.5F);
this.setLightLevel(1);
this.setLightOpacity(500);
this.setBlockBounds(0.5F - f1, r * 1, 0.5F - f1, 0.5F + f1, r * 7, 0.5F + f1);
this.setBlockName(Utils.getUnlocalisedName("lantern"));
this.setBlockTextureName("lantern");
this.setCreativeTab(EtFuturum.creativeTabBlocks);
this.setBlockName(Utils.getUnlocalisedName(name));
this.setBlockTextureName(name);
}

@Override
Expand Down Expand Up @@ -105,7 +104,7 @@ public void setLanternToAir(World world, int x, int y, int z) {
@Override
@SideOnly(Side.CLIENT)
public String getItemIconName() {
return "lantern";
return getTextureName();
}

@Override
Expand Down
60 changes: 60 additions & 0 deletions src/main/java/ganymedes01/etfuturum/blocks/BlockSoulTorch.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
package ganymedes01.etfuturum.blocks;

import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import ganymedes01.etfuturum.EtFuturum;
import ganymedes01.etfuturum.client.particle.CustomParticles;
import ganymedes01.etfuturum.core.utils.Utils;
import net.minecraft.block.Block;
import net.minecraft.block.BlockTorch;
import net.minecraft.world.World;

import java.util.Random;

public class BlockSoulTorch extends BlockTorch {

public BlockSoulTorch() {
super();
setStepSound(Block.soundTypeWood);
setLightLevel(0.666F);
setBlockName(Utils.getUnlocalisedName("soul_torch"));
setBlockTextureName("soul_torch");
setCreativeTab(EtFuturum.creativeTabBlocks);
}

/**
* A randomly called display update to be able to add particles or other items for display
*/
@SideOnly(Side.CLIENT)
public void randomDisplayTick(World world, int x, int y, int z, Random rand) {
int l = world.getBlockMetadata(x, y, z);
double d0 = (float) x + 0.5F;
double d1 = (float) y + 0.7F;
double d2 = (float) z + 0.5F;
double d3 = 0.2199999988079071D;
double d4 = 0.27000001072883606D;

switch (l) {
case 1:
world.spawnParticle("smoke", d0 - d4, d1 + d3, d2, 0.0D, 0.0D, 0.0D);
CustomParticles.spawnSoulFlame(world, d0 - d4, d1 + d3, d2);
break;
case 2:
world.spawnParticle("smoke", d0 + d4, d1 + d3, d2, 0.0D, 0.0D, 0.0D);
CustomParticles.spawnSoulFlame(world, d0 + d4, d1 + d3, d2);
break;
case 3:
world.spawnParticle("smoke", d0, d1 + d3, d2 - d4, 0.0D, 0.0D, 0.0D);
CustomParticles.spawnSoulFlame(world, d0, d1 + d3, d2 - d4);
break;
case 4:
world.spawnParticle("smoke", d0, d1 + d3, d2 + d4, 0.0D, 0.0D, 0.0D);
CustomParticles.spawnSoulFlame(world, d0, d1 + d3, d2 + d4);
break;
default:
world.spawnParticle("smoke", d0, d1, d2, 0.0D, 0.0D, 0.0D);
CustomParticles.spawnSoulFlame(world, d0, d1, d2);
break;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,16 @@ public static EntityFX spawnCherryLeaf(World world, double x, double y, double z
return spawnParticle(world, particle);
}

public static EntityFX spawnSoulFlame(World world, double x, double y, double z, double mX, double mY, double mZ) {
EntityFX particle = new SoulFlameFX(world, x, y, z, mX, mY, mZ);
return spawnParticle(world, particle);
}

public static EntityFX spawnSoulFlame(World world, double x, double y, double z) {
EntityFX particle = new SoulFlameFX(world, x, y, z);
return spawnParticle(world, particle);
}

protected static EntityFX spawnParticle(World world, EntityFX entityFX) {
if (world.isRemote) {
Minecraft.getMinecraft().effectRenderer.addEffect(entityFX);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public class EtFuturumFXParticle extends EntityFX {
public EtFuturumFXParticle(World world, double x, double y, double z, double mx, double my, double mz, int maxAge,
float scale, int color, String texture, int textures) {
super(world, x, y, z, 0, 0, 0);
rand = new RandomXoshiro256StarStar();
rand = particleRand;
this.textures = textures;
resourceLocations = loadTextures(world, x, y, z, texture == null ? null : new ResourceLocation(texture));
this.posX = x;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
package ganymedes01.etfuturum.client.particle;

import net.minecraft.client.renderer.Tessellator;
import net.minecraft.world.World;

public class SoulFlameFX extends EtFuturumFXParticle {
/**
* the scale of the flame FX
*/
private final float flameScale;

public SoulFlameFX(World world, double x, double y, double z, double mX, double mY, double mZ) {
super(world, x, y, z, mX, mY, mZ, (int) (8.0D / (Math.random() * 0.8D + 0.2D)) + 4, (particleRand.nextFloat() * 0.5F + 0.5F) * 2.0F, 0xFFFFFFFF,
"textures/particle/soul_fire_flame.png", 1);
this.motionX = this.motionX * 0.009999999776482582D + mX;
this.motionY = this.motionY * 0.009999999776482582D + mY;
this.motionZ = this.motionZ * 0.009999999776482582D + mZ;
this.flameScale = this.particleScale;
this.particleRed = this.particleGreen = this.particleBlue = 1.0F;
this.particleMaxAge = (int) (8.0D / (Math.random() * 0.8D + 0.2D)) + 4;
this.noClip = true;
}

public SoulFlameFX(World world, double x, double y, double z) {
this(world, x, y, z, 0, 0, 0);
}

@Override
public void renderParticle(Tessellator tessellator, float partialTicks, float rx, float rxz, float rz,
float ryz, float rxy) {
float f6 = ((float) this.particleAge + partialTicks) / (float) this.particleMaxAge;
this.particleScale = this.flameScale * (1.0F - f6 * f6 * 0.5F);
super.renderParticle(tessellator, partialTicks, rx, rxz, rz, ryz, rxy);
}

public int getBrightnessForRender(float p_70070_1_) {
float f1 = ((float) this.particleAge + p_70070_1_) / (float) this.particleMaxAge;

if (f1 < 0.0F) {
f1 = 0.0F;
}

if (f1 > 1.0F) {
f1 = 1.0F;
}

int i = super.getBrightnessForRender(p_70070_1_);
int j = i & 255;
int k = i >> 16 & 255;
j += (int) (f1 * 15.0F * 16.0F);

if (j > 240) {
j = 240;
}

return j | k << 16;
}

/**
* Gets how bright this entity is.
*/
public float getBrightness(float p_70013_1_) {
float f1 = ((float) this.particleAge + p_70013_1_) / (float) this.particleMaxAge;

if (f1 < 0.0F) {
f1 = 0.0F;
}

if (f1 > 1.0F) {
f1 = 1.0F;
}

float f2 = super.getBrightness(p_70013_1_);
return f2 * f1 + (1.0F - f1);
}

/**
* Called to update the entity's position/logic.
*/
public void onUpdate() {
this.prevPosX = this.posX;
this.prevPosY = this.posY;
this.prevPosZ = this.posZ;

if (this.particleAge++ >= this.particleMaxAge) {
this.setDead();
}

this.moveEntity(this.motionX, this.motionY, this.motionZ);
this.motionX *= 0.9599999785423279D;
this.motionY *= 0.9599999785423279D;
this.motionZ *= 0.9599999785423279D;

if (this.onGround) {
this.motionX *= 0.699999988079071D;
this.motionZ *= 0.699999988079071D;
}
}
}
4 changes: 4 additions & 0 deletions src/main/java/ganymedes01/etfuturum/core/utils/Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -510,4 +510,8 @@ public static boolean hasPotionEffect(ItemStack p_hasEffect_1_) {
List var2 = Items.potionitem.getEffects(p_hasEffect_1_);
return var2 != null && !var2.isEmpty();
}

public static void setLightLevel(Block block, int level) {
block.setLightLevel((float) level / 15F);
}
}
6 changes: 6 additions & 0 deletions src/main/java/ganymedes01/etfuturum/recipes/ModRecipes.java
Original file line number Diff line number Diff line change
Expand Up @@ -690,9 +690,15 @@ ore_dyes[dye], new ItemStack(Blocks.sand, 1, 0), new ItemStack(Blocks.sand, 1, 0

if (!OreDictionary.getOres("nuggetIron").isEmpty()) {
addShapedRecipe(ModBlocks.LANTERN.newItemStack(), "xxx", "xix", "xxx", 'x', "nuggetIron", 'i', Blocks.torch);
addShapedRecipe(ModBlocks.SOUL_LANTERN.newItemStack(), "xxx", "xix", "xxx", 'x', "nuggetIron", 'i', ModBlocks.SOUL_TORCH.get());
} else {
addShapedRecipe(ModBlocks.LANTERN.newItemStack(), "i", "x", 'x', "ingotIron", 'i', Blocks.torch);
addShapedRecipe(ModBlocks.SOUL_LANTERN.newItemStack(), "i", "x", 'x', "ingotIron", 'i', ModBlocks.SOUL_TORCH.get());
}
addShapedRecipe(ModBlocks.SOUL_TORCH.newItemStack(), "i", "x", "s", 'x', "stickWood", 'i', "coal", 's', "soulSand");
addShapedRecipe(ModBlocks.SOUL_TORCH.newItemStack(), "i", "x", "s", 'x', "stickWood", 'i', "coal", 's', "soulSoil");
addShapedRecipe(ModBlocks.SOUL_TORCH.newItemStack(), "i", "x", "s", 'x', "stickWood", 'i', "charcoal", 's', "soulSand");
addShapedRecipe(ModBlocks.SOUL_TORCH.newItemStack(), "i", "x", "s", 'x', "stickWood", 'i', "charcoal", 's', "soulSoil");

addShapedRecipe(ModBlocks.BARREL.newItemStack(), "xsx", "x x", "xsx", 'x', "plankWood", 's', "slabWood");

Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/assets/etfuturum/lang/en_US.lang
Original file line number Diff line number Diff line change
Expand Up @@ -571,6 +571,8 @@ tile.etfuturum.loom.name=Loom
tile.etfuturum.grindstone.name=Grindstone
tile.etfuturum.lectern.name=Lectern
tile.etfuturum.lantern.name=Lantern
tile.etfuturum.soul_lantern.name=Soul Lantern
tile.etfuturum.soul_torch.name=Soul Torch

tile.etfuturum.observer.name=Observer
tile.etfuturum.target.name=Target
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"animation": {
"frametime": 8
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 9b2c785

Please sign in to comment.