Skip to content

Commit

Permalink
Merge pull request #68 from emoticone11/1.18.2
Browse files Browse the repository at this point in the history
Removed particle emissions for no-particle torch blocks, other bug fixes
  • Loading branch information
jacobgranberry authored Feb 3, 2024
2 parents 22e190d + 8a0cd73 commit fb38df6
Show file tree
Hide file tree
Showing 47 changed files with 232 additions and 157 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,13 @@
import net.minecraft.core.particles.SimpleParticleType;
import net.minecraft.core.BlockPos;
import net.minecraft.core.particles.ParticleOptions;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.LevelReader;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.TorchBlock;

import java.util.Random;

import com.westeroscraft.westerosblocks.WesterosBlockDef;
import com.westeroscraft.westerosblocks.WesterosBlockLifecycle;
import com.westeroscraft.westerosblocks.WesterosBlockFactory;
Expand All @@ -34,16 +37,10 @@ public Block buildBlockClass(WesterosBlockDef def) {

private WesterosBlockDef def;
private boolean allow_unsupported = false;

private static ParticleOptions getParticle(String typeStr) {
if (typeStr != null && typeStr.contains("no-particle")) {
return new SimpleParticleType(false);
}
return ParticleTypes.FLAME;
}
private boolean no_particle = false;

protected WCTorchBlock(BlockBehaviour.Properties props, WesterosBlockDef def) {
super(props, WCTorchBlock.getParticle(def.getType()));
super(props, ParticleTypes.FLAME);
this.def = def;
String t = def.getType();
if (t != null) {
Expand All @@ -52,6 +49,9 @@ protected WCTorchBlock(BlockBehaviour.Properties props, WesterosBlockDef def) {
if (tok.equals("allow-unsupported")) {
allow_unsupported = true;
}
else if (tok.equals("no-particle")) {
no_particle = true;
}
}
}
}
Expand All @@ -61,6 +61,11 @@ public WesterosBlockDef getWBDefinition() {
return def;
}

@Override
public void animateTick(BlockState state, Level level, BlockPos pos, Random rnd) {
if (!this.no_particle) super.animateTick(state, level, pos, rnd);
}

@Override
public boolean canSurvive(BlockState p_49395_, LevelReader p_49396_, BlockPos p_49397_) {
if (this.allow_unsupported) return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,20 @@
import net.minecraft.core.particles.SimpleParticleType;
import net.minecraft.world.level.LevelReader;
import net.minecraft.world.level.block.WallTorchBlock;
import net.minecraft.world.level.Level;

import java.util.Random;

import com.westeroscraft.westerosblocks.WesterosBlockDef;
import com.westeroscraft.westerosblocks.WesterosBlockLifecycle;

public class WCWallTorchBlock extends WallTorchBlock implements WesterosBlockLifecycle {
private WesterosBlockDef def;
private boolean allow_unsupported = false;

private static ParticleOptions getParticle(String typeStr) {
if (typeStr != null && typeStr.contains("no-particle")) {
return new SimpleParticleType(false);
}
return ParticleTypes.FLAME;
}
private boolean no_particle = false;

protected WCWallTorchBlock(BlockBehaviour.Properties props, WesterosBlockDef def) {
super(props, WCWallTorchBlock.getParticle(def.getType()));
super(props, ParticleTypes.FLAME);
this.def = def;
String t = def.getType();
if (t != null) {
Expand All @@ -33,6 +30,9 @@ protected WCWallTorchBlock(BlockBehaviour.Properties props, WesterosBlockDef def
if (tok.equals("allow-unsupported")) {
allow_unsupported = true;
}
else if (tok.equals("no-particle")) {
no_particle = true;
}
}
}
}
Expand All @@ -42,6 +42,11 @@ public WesterosBlockDef getWBDefinition() {
return def;
}

@Override
public void animateTick(BlockState state, Level level, BlockPos pos, Random rnd) {
if (!this.no_particle) super.animateTick(state, level, pos, rnd);
}

@Override
public boolean canSurvive(BlockState p_49395_, LevelReader p_49396_, BlockPos p_49397_) {
if (this.allow_unsupported) return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@
public class TorchBlockModelExport extends ModelExport {
// Template objects for Gson export of block models
public static class ModelObjectTorch {
public String parent = "minecraft:block/template_torch"; // Use 'torch' model for single texture
public String parent = "westerosblocks:block/untinted/template_torch"; // Use 'torch' model for single texture
public Texture textures = new Texture();
}
public static class ModelObjectTorchWall {
public String parent = "minecraft:block/template_torch_wall"; // Use 'torch_wall' model for single texture
public String parent = "westerosblocks:block/untinted/template_torch_wall"; // Use 'torch_wall' model for single texture
public Texture textures = new Texture();
}
public static class Texture {
Expand Down
48 changes: 32 additions & 16 deletions src/main/resources/WesterosBlocks.json
Original file line number Diff line number Diff line change
Expand Up @@ -6171,7 +6171,8 @@
"all": "wool/black/all"
},
"altTextures": {
"solid": ["wool/black/block"]
"solid": ["wool/black/block"],
"carpet": ["wool/black/noctm"]
}
},
{
Expand All @@ -6192,7 +6193,8 @@
"all": "wool/grey/all"
},
"altTextures": {
"solid": ["wool/grey/block"]
"solid": ["wool/grey/block"],
"carpet": ["wool/grey/noctm"]
}
},
{
Expand All @@ -6213,7 +6215,8 @@
"all": "wool/light_grey/all"
},
"altTextures": {
"solid": ["wool/light_grey/block"]
"solid": ["wool/light_grey/block"],
"carpet": ["wool/light_grey/noctm"]
}
},
{
Expand All @@ -6234,7 +6237,8 @@
"all": "wool/white/all"
},
"altTextures": {
"solid": ["wool/white/block"]
"solid": ["wool/white/block"],
"carpet": ["wool/white/noctm"]
}
},
{
Expand All @@ -6255,7 +6259,8 @@
"all": "wool/dirty_white/all"
},
"altTextures": {
"solid": ["wool/dirty_white/block"]
"solid": ["wool/dirty_white/block"],
"carpet": ["wool/dirty_white/noctm"]
}
},
{
Expand All @@ -6276,7 +6281,8 @@
"all": "wool/light_brown/all"
},
"altTextures": {
"solid": ["wool/light_brown/block"]
"solid": ["wool/light_brown/block"],
"carpet": ["wool/light_brown/noctm"]
}
},
{
Expand All @@ -6297,7 +6303,8 @@
"all": "wool/brown/all"
},
"altTextures": {
"solid": ["wool/brown/block"]
"solid": ["wool/brown/block"],
"carpet": ["wool/brown/noctm"]
}
},
{
Expand All @@ -6318,7 +6325,8 @@
"all": "wool/red/all"
},
"altTextures": {
"solid": ["wool/red/block"]
"solid": ["wool/red/block"],
"carpet": ["wool/red/noctm"]
}
},
{
Expand All @@ -6339,7 +6347,8 @@
"all": "wool/orange/all"
},
"altTextures": {
"solid": ["wool/orange/block"]
"solid": ["wool/orange/block"],
"carpet": ["wool/orange/noctm"]
}
},
{
Expand All @@ -6360,7 +6369,8 @@
"all": "wool/yellow/all"
},
"altTextures": {
"solid": ["wool/yellow/block"]
"solid": ["wool/yellow/block"],
"carpet": ["wool/yellow/noctm"]
}
},
{
Expand All @@ -6381,7 +6391,8 @@
"all": "wool/green/all"
},
"altTextures": {
"solid": ["wool/green/block"]
"solid": ["wool/green/block"],
"carpet": ["wool/green/noctm"]
}
},
{
Expand All @@ -6402,7 +6413,8 @@
"all": "wool/cyan/all"
},
"altTextures": {
"solid": ["wool/cyan/block"]
"solid": ["wool/cyan/block"],
"carpet": ["wool/cyan/noctm"]
}
},
{
Expand All @@ -6423,7 +6435,8 @@
"all": "wool/blue/all"
},
"altTextures": {
"solid": ["wool/blue/block"]
"solid": ["wool/blue/block"],
"carpet": ["wool/blue/noctm"]
}
},
{
Expand All @@ -6444,7 +6457,8 @@
"all": "wool/light_blue/all"
},
"altTextures": {
"solid": ["wool/light_blue/block"]
"solid": ["wool/light_blue/block"],
"carpet": ["wool/light_blue/noctm"]
}
},
{
Expand All @@ -6465,7 +6479,8 @@
"all": "wool/purple/all"
},
"altTextures": {
"solid": ["wool/purple/block"]
"solid": ["wool/purple/block"],
"carpet": ["wool/purple/noctm"]
}
},
{
Expand All @@ -6486,7 +6501,8 @@
"all": "wool/pink/all"
},
"altTextures": {
"solid": ["wool/pink/block"]
"solid": ["wool/pink/block"],
"carpet": ["wool/pink/noctm"]
}
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@
]
},
"textures": {
"txt4": "westerosblocks:block/wool/black/all",
"txt5": "westerosblocks:block/wool/black/all",
"txt2": "westerosblocks:block/wool/black/all",
"txt3": "westerosblocks:block/wool/black/all",
"txt0": "westerosblocks:block/wool/black/all",
"txt1": "westerosblocks:block/wool/black/all",
"particle": "westerosblocks:block/wool/black/all"
"txt4": "westerosblocks:block/wool/black/noctm",
"txt5": "westerosblocks:block/wool/black/noctm",
"txt2": "westerosblocks:block/wool/black/noctm",
"txt3": "westerosblocks:block/wool/black/noctm",
"txt0": "westerosblocks:block/wool/black/noctm",
"txt1": "westerosblocks:block/wool/black/noctm",
"particle": "westerosblocks:block/wool/black/noctm"
},
"elements": [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@
]
},
"textures": {
"txt4": "westerosblocks:block/wool/blue/all",
"txt5": "westerosblocks:block/wool/blue/all",
"txt2": "westerosblocks:block/wool/blue/all",
"txt3": "westerosblocks:block/wool/blue/all",
"txt0": "westerosblocks:block/wool/blue/all",
"txt1": "westerosblocks:block/wool/blue/all",
"particle": "westerosblocks:block/wool/blue/all"
"txt4": "westerosblocks:block/wool/blue/noctm",
"txt5": "westerosblocks:block/wool/blue/noctm",
"txt2": "westerosblocks:block/wool/blue/noctm",
"txt3": "westerosblocks:block/wool/blue/noctm",
"txt0": "westerosblocks:block/wool/blue/noctm",
"txt1": "westerosblocks:block/wool/blue/noctm",
"particle": "westerosblocks:block/wool/blue/noctm"
},
"elements": [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@
]
},
"textures": {
"txt4": "westerosblocks:block/wool/brown/all",
"txt5": "westerosblocks:block/wool/brown/all",
"txt2": "westerosblocks:block/wool/brown/all",
"txt3": "westerosblocks:block/wool/brown/all",
"txt0": "westerosblocks:block/wool/brown/all",
"txt1": "westerosblocks:block/wool/brown/all",
"particle": "westerosblocks:block/wool/brown/all"
"txt4": "westerosblocks:block/wool/brown/noctm",
"txt5": "westerosblocks:block/wool/brown/noctm",
"txt2": "westerosblocks:block/wool/brown/noctm",
"txt3": "westerosblocks:block/wool/brown/noctm",
"txt0": "westerosblocks:block/wool/brown/noctm",
"txt1": "westerosblocks:block/wool/brown/noctm",
"particle": "westerosblocks:block/wool/brown/noctm"
},
"elements": [
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"parent": "minecraft:block/template_torch",
"parent": "westerosblocks:block/untinted/template_torch",
"textures": {
"torch": "westerosblocks:block/lighting/candle"
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"parent": "minecraft:block/template_torch_wall",
"parent": "westerosblocks:block/untinted/template_torch_wall",
"textures": {
"torch": "westerosblocks:block/lighting/candle"
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"parent": "minecraft:block/template_torch",
"parent": "westerosblocks:block/untinted/template_torch",
"textures": {
"torch": "westerosblocks:block/lighting/candle_unlit"
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"parent": "minecraft:block/template_torch_wall",
"parent": "westerosblocks:block/untinted/template_torch_wall",
"textures": {
"torch": "westerosblocks:block/lighting/candle_unlit"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@
]
},
"textures": {
"txt4": "westerosblocks:block/wool/cyan/all",
"txt5": "westerosblocks:block/wool/cyan/all",
"txt2": "westerosblocks:block/wool/cyan/all",
"txt3": "westerosblocks:block/wool/cyan/all",
"txt0": "westerosblocks:block/wool/cyan/all",
"txt1": "westerosblocks:block/wool/cyan/all",
"particle": "westerosblocks:block/wool/cyan/all"
"txt4": "westerosblocks:block/wool/cyan/noctm",
"txt5": "westerosblocks:block/wool/cyan/noctm",
"txt2": "westerosblocks:block/wool/cyan/noctm",
"txt3": "westerosblocks:block/wool/cyan/noctm",
"txt0": "westerosblocks:block/wool/cyan/noctm",
"txt1": "westerosblocks:block/wool/cyan/noctm",
"particle": "westerosblocks:block/wool/cyan/noctm"
},
"elements": [
{
Expand Down
Loading

0 comments on commit fb38df6

Please sign in to comment.