Add Torch Recipe, disable dying on Flames. TBC
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -23,3 +23,5 @@ run
|
||||
|
||||
artifacts
|
||||
ColorGen.java
|
||||
|
||||
Forge/src/generated
|
||||
|
@@ -9,7 +9,6 @@ public class ColoredFlameParticle extends RisingParticle {
|
||||
|
||||
public ColoredFlameParticle(ClientLevel level, double x, double y, double z, double r, double g, double b) {
|
||||
super(level, x, y, z, 0, 0, 0);
|
||||
this.setColor((float) r, (float) g, (float) b);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -17,10 +17,7 @@ import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.core.particles.ParticleTypes;
|
||||
import net.minecraft.core.particles.SimpleParticleType;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.NbtUtils;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.network.chat.MutableComponent;
|
||||
import net.minecraft.sounds.SoundEvents;
|
||||
import net.minecraft.sounds.SoundSource;
|
||||
import net.minecraft.util.RandomSource;
|
||||
@@ -48,10 +45,8 @@ import net.minecraft.world.phys.shapes.CollisionContext;
|
||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public class AdvancedTorchBlock extends HorizontalDirectionalBlock implements DyableBlock, LightableBlock {
|
||||
@@ -59,7 +54,15 @@ public class AdvancedTorchBlock extends HorizontalDirectionalBlock implements Dy
|
||||
public static final BooleanProperty LIT = BlockStateProperties.LIT;
|
||||
public static final EnumProperty<DyeColor> COLOR = EnumProperty.create("color", DyeColor.class);
|
||||
public static final EnumProperty<AttachFace> ATTACH_FACE = EnumProperty.create("face", AttachFace.class, AttachFace.FLOOR, AttachFace.WALL);
|
||||
private static final Map<Direction, VoxelShape> SHAPES = Maps.newEnumMap(ImmutableMap.of(Direction.NORTH, Block.box(5.5D, 2.0D, 11.0D, 10.5D, 12.0D, 16.0D), Direction.SOUTH, Block.box(5.5D, 2.0D, 0.0D, 10.5D, 12.0D, 5.0D), Direction.WEST, Block.box(11.0D, 2.0D, 5.5D, 16.0D, 12.0D, 10.5D), Direction.EAST, Block.box(0.0D, 2.0D, 5.5D, 5.0D, 12.0D, 10.5D), Direction.UP, Block.box(6.0D, 0.0D, 6.0D, 10.0D, 10.0D, 10.0D)));
|
||||
private static final Map<Direction, VoxelShape> SHAPES = Maps.newEnumMap(
|
||||
ImmutableMap.of(
|
||||
Direction.NORTH, Block.box(5.5D, 2.0D, 11.0D, 10.5D, 12.0D, 16.0D),
|
||||
Direction.SOUTH, Block.box(5.5D, 2.0D, 0.0D, 10.5D, 12.0D, 5.0D),
|
||||
Direction.WEST, Block.box(11.0D, 2.0D, 5.5D, 16.0D, 12.0D, 10.5D),
|
||||
Direction.EAST, Block.box(0.0D, 2.0D, 5.5D, 5.0D, 12.0D, 10.5D),
|
||||
Direction.UP, Block.box(6.0D, 0.0D, 6.0D, 10.0D, 10.0D, 10.0D)
|
||||
));
|
||||
|
||||
private final Supplier<SimpleParticleType> particleType;
|
||||
|
||||
private DyeColor color;
|
||||
@@ -188,9 +191,7 @@ public class AdvancedTorchBlock extends HorizontalDirectionalBlock implements Dy
|
||||
double d1 = (double) pos.getY() + 0.7D;
|
||||
double d2 = (double) pos.getZ() + 0.5D;
|
||||
levelIn.addParticle(ParticleTypes.SMOKE, d0, d1, d2, 0.0D, 0.0D, 0.0D);
|
||||
|
||||
// xSpeed, ySpeed and zSpeed here is used to pass color data. This isn't the proper way, but I don't wanna add a bunch of extra code for something so simple
|
||||
levelIn.addParticle(particleType.get(), d0, d1, d2, color.getTextureDiffuseColors()[0], color.getTextureDiffuseColors()[1], color.getTextureDiffuseColors()[2]);
|
||||
levelIn.addParticle(particleType.get(), d0, d1, d2, 0D, 0D, 0D);
|
||||
} else {
|
||||
Direction direction = stateIn.getValue(FACING);
|
||||
double d0 = (double) pos.getX() + 0.5D;
|
||||
@@ -198,9 +199,7 @@ public class AdvancedTorchBlock extends HorizontalDirectionalBlock implements Dy
|
||||
double d2 = (double) pos.getZ() + 0.5D;
|
||||
Direction direction1 = direction.getOpposite();
|
||||
levelIn.addParticle(ParticleTypes.SMOKE, d0 + 0.37D * (double) direction1.getStepX(), d1 + 0.15D, d2 + 0.37D * (double) direction1.getStepZ(), 0.0D, 0.0D, 0.0D);
|
||||
|
||||
// xSpeed, ySpeed and zSpeed here is used to pass color data. This isn't the proper way, but I don't wanna add a bunch of extra code for something so simple
|
||||
levelIn.addParticle(particleType.get(), d0 + 0.37D * (double) direction1.getStepX(), d1 + 0.15D, d2 + 0.37D * (double) direction1.getStepZ(), color.getTextureDiffuseColors()[0], color.getTextureDiffuseColors()[1], color.getTextureDiffuseColors()[2]);
|
||||
levelIn.addParticle(particleType.get(), d0 + 0.37D * (double) direction1.getStepX(), d1 + 0.15D, d2 + 0.37D * (double) direction1.getStepZ(), 0D, 0D, 0D);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,5 +1,9 @@
|
||||
{
|
||||
"block.hyperlighting.advanced_torch": "Advanced Torch (%s)",
|
||||
|
||||
"subtitles.torch_ignite": "Torch Ignite Sound"
|
||||
"subtitles.torch_ignite": "Torch Ignite Sound",
|
||||
|
||||
"cl.hyperlightingconfig.title": "Hyper Lighting Config",
|
||||
"cl.torchconfig.litbydefault": "Lit when Placed",
|
||||
"cl.torchconfig.requirestool": "Requires Torch Lighter"
|
||||
}
|
||||
|
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"textures": [
|
||||
"hyperlighting:colored_flame"
|
||||
"hyperlighting:flames/colored_flame_red"
|
||||
]
|
||||
}
|
||||
|
Binary file not shown.
After Width: | Height: | Size: 541 B |
Binary file not shown.
After Width: | Height: | Size: 600 B |
@@ -0,0 +1,32 @@
|
||||
{
|
||||
"parent": "minecraft:recipes/root",
|
||||
"criteria": {
|
||||
"has_the_recipe": {
|
||||
"conditions": {
|
||||
"recipe": "hyperlighting:advanced_torch"
|
||||
},
|
||||
"trigger": "minecraft:recipe_unlocked"
|
||||
},
|
||||
"wool": {
|
||||
"conditions": {
|
||||
"items": [
|
||||
{
|
||||
"tag": "minecraft:wool"
|
||||
}
|
||||
]
|
||||
},
|
||||
"trigger": "minecraft:inventory_changed"
|
||||
}
|
||||
},
|
||||
"requirements": [
|
||||
[
|
||||
"wool",
|
||||
"has_the_recipe"
|
||||
]
|
||||
],
|
||||
"rewards": {
|
||||
"recipes": [
|
||||
"hyperlighting:advanced_torch"
|
||||
]
|
||||
}
|
||||
}
|
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"type": "minecraft:crafting_shaped",
|
||||
"key": {
|
||||
"X": {
|
||||
"tag": "minecraft:wool"
|
||||
},
|
||||
"Y": {
|
||||
"item": "minecraft:stick"
|
||||
}
|
||||
},
|
||||
"pattern": [
|
||||
" X ",
|
||||
" Y ",
|
||||
" "
|
||||
],
|
||||
"result": {
|
||||
"item": "hyperlighting:advanced_torch"
|
||||
}
|
||||
}
|
@@ -0,0 +1,22 @@
|
||||
package me.hypherionmc.hyperlighting.datagen;
|
||||
|
||||
import net.minecraft.data.DataGenerator;
|
||||
import net.minecraftforge.data.event.GatherDataEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
|
||||
/**
|
||||
* @author HypherionSA
|
||||
* @date 04/08/2022
|
||||
*/
|
||||
@Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD)
|
||||
public class DataGenerators {
|
||||
|
||||
@SubscribeEvent
|
||||
public static void gatherData(GatherDataEvent event) {
|
||||
System.out.println("Running Datagen");
|
||||
DataGenerator generator = event.getGenerator();
|
||||
generator.addProvider(event.includeServer(), new RecipeGenerator(generator));
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,37 @@
|
||||
package me.hypherionmc.hyperlighting.datagen;
|
||||
|
||||
import me.hypherionmc.hyperlighting.common.init.HLBlocks;
|
||||
import net.minecraft.data.DataGenerator;
|
||||
import net.minecraft.data.recipes.FinishedRecipe;
|
||||
import net.minecraft.data.recipes.RecipeProvider;
|
||||
import net.minecraft.data.recipes.ShapedRecipeBuilder;
|
||||
import net.minecraft.tags.ItemTags;
|
||||
import net.minecraft.world.item.Items;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
|
||||
/**
|
||||
* @author HypherionSA
|
||||
* @date 04/08/2022
|
||||
*/
|
||||
public class RecipeGenerator extends RecipeProvider {
|
||||
|
||||
public RecipeGenerator(DataGenerator generator) {
|
||||
super(generator);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void buildCraftingRecipes(Consumer<FinishedRecipe> consumer) {
|
||||
System.out.println("Running Recipe Gen");
|
||||
|
||||
ShapedRecipeBuilder.shaped(HLBlocks.ADVANCED_TORCH)
|
||||
.pattern(" X ")
|
||||
.pattern(" Y ")
|
||||
.pattern(" ")
|
||||
.define('X', ItemTags.WOOL)
|
||||
.define('Y', Items.STICK)
|
||||
.unlockedBy("wool", has(ItemTags.WOOL))
|
||||
.save(consumer);
|
||||
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user