Skip to content

Commit

Permalink
Various Fixes (#1024)
Browse files Browse the repository at this point in the history
* Fix loot tables

* Tweak texture

* Fix missing particles

* Fix bug with removing eyes

* Remove shift requirement

* Fixes Loot Tables (#1021)

* Fix missing loot tables

* Add tag

* Rename to PC Screen & Computer

* New block layout template world

* Add infected spark instead of lava particle
  • Loading branch information
WenXin20 authored Sep 16, 2022
1 parent 86cbef5 commit 153521b
Show file tree
Hide file tree
Showing 22 changed files with 54 additions and 12 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
package pokecube.legends.blocks.normalblocks;

import java.util.Random;

import net.minecraft.core.BlockPos;
import net.minecraft.core.particles.ParticleTypes;
import net.minecraft.sounds.SoundEvents;
import net.minecraft.sounds.SoundSource;
import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.effect.MobEffectInstance;
import net.minecraft.world.effect.MobEffects;
Expand All @@ -15,17 +20,20 @@
import net.minecraft.world.level.block.entity.CampfireBlockEntity;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState;
import pokecube.legends.init.ParticleInit;
import pokecube.legends.init.TileEntityInit;
import pokecube.legends.tileentity.InfectedCampfireBlockEntity;

public class InfectedCampfireBlock extends CampfireBlock
{
private final int fireDamage;
private final boolean spawnParticles;

public InfectedCampfireBlock(boolean smoke, int damage, BlockBehaviour.Properties properties)
public InfectedCampfireBlock(boolean particles, int damage, BlockBehaviour.Properties properties)
{
super(smoke, damage, properties);
super(particles, damage, properties);
this.fireDamage = damage;
this.spawnParticles = particles;
}

@Override
Expand Down Expand Up @@ -60,4 +68,26 @@ public <T extends BlockEntity> BlockEntityTicker<T> getTicker(Level world, Block
createTickerHelper(type, TileEntityInit.CAMPFIRE_ENTITY.get(), CampfireBlockEntity::cooldownTick);
}
}

@Override
public void animateTick(BlockState state, Level world, BlockPos pos, Random random)
{
if (state.getValue(LIT))
{
if (random.nextInt(10) == 0)
{
world.playLocalSound((double)pos.getX() + 0.5D, (double)pos.getY() + 0.5D, (double)pos.getZ() + 0.5D,
SoundEvents.CAMPFIRE_CRACKLE, SoundSource.BLOCKS, 0.5F + random.nextFloat(), random.nextFloat() * 0.7F + 0.6F, false);
}

if (this.spawnParticles && random.nextInt(5) == 0)
{
for(int i = 0; i < random.nextInt(1) + 1; ++i)
{
world.addParticle(ParticleInit.INFECTED_SPARK.get(), (double)pos.getX() + 0.5D, (double)pos.getY() + 0.5D,
(double)pos.getZ() + 0.5D, (double)(random.nextFloat() / 2.0F), 5.0E-5D, (double)(random.nextFloat() / 2.0F));
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public BlockState getGrowIntoState(BlockState state, Random random)
@Override
public InteractionResult use(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit)
{
if (state.getValue(EYES) == false && player.isShiftKeyDown())
if (state.getValue(EYES) == true)
{
float f = Mth.randomBetween(world.random, 0.8F, 1.2F);
world.playSound((Player)null, pos, SoundEvents.CAVE_VINES_PICK_BERRIES, SoundSource.BLOCKS, 1.0F, f);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState
@Override
public InteractionResult use(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit)
{
if (state.getValue(EYES) == false && player.isShiftKeyDown())
if (state.getValue(EYES) == true)
{
float f = Mth.randomBetween(world.random, 0.8F, 1.2F);
world.playSound((Player)null, pos, SoundEvents.CAVE_VINES_PICK_BERRIES, SoundSource.BLOCKS, 1.0F, f);
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/pokecube/legends/init/ClientSetupHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import net.minecraft.client.Minecraft;
import net.minecraft.client.particle.FlameParticle;
import net.minecraft.client.particle.LavaParticle;
import net.minecraft.client.particle.SmokeParticle;
import net.minecraft.client.particle.SoulParticle;
import net.minecraft.client.particle.SuspendedTownParticle;
Expand Down Expand Up @@ -197,6 +198,7 @@ public static void registerParticleFactories(final ParticleFactoryRegisterEvent
FlameParticle.Provider::new);
Minecraft.getInstance().particleEngine.register(ParticleInit.INFECTED_SMOKE.get(), SmokeParticle.Provider::new);
Minecraft.getInstance().particleEngine.register(ParticleInit.INFECTED_SOUL.get(), SoulParticle.Provider::new);
Minecraft.getInstance().particleEngine.register(ParticleInit.INFECTED_SPARK.get(), LavaParticle.Provider::new);
Minecraft.getInstance().particleEngine.register(ParticleInit.MUSHROOM.get(),
SuspendedTownParticle.Provider::new);
}
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/pokecube/legends/init/ParticleInit.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ public class ParticleInit
public static final RegistryObject<SimpleParticleType> INFECTED_FIRE_FLAME;
public static final RegistryObject<SimpleParticleType> INFECTED_SMOKE;
public static final RegistryObject<SimpleParticleType> INFECTED_SOUL;
public static final RegistryObject<SimpleParticleType> INFECTED_SPARK;
public static final RegistryObject<SimpleParticleType> MUSHROOM;

static
Expand All @@ -22,6 +23,8 @@ public class ParticleInit

INFECTED_SOUL = PokecubeLegends.PARTICLES.register("infected_soul", () -> new SimpleParticleType(false));

INFECTED_SPARK = PokecubeLegends.PARTICLES.register("infected_spark", () -> new SimpleParticleType(false));

MUSHROOM = PokecubeLegends.PARTICLES.register("mushroom", () -> new SimpleParticleType(false));
}
}
8 changes: 4 additions & 4 deletions src/main/resources/assets/pokecube/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -330,8 +330,8 @@
"block.trade_machine.trade": "Trade",
"block.tm_machine.apply": "Apply",

"block.pokecube.pc_base": "PC Base",
"block.pokecube.pc_top": "PC Top",
"block.pokecube.pc_base": "PC Computer",
"block.pokecube.pc_top": "PC Screen",
"block.pc.autoon": "Auto On",
"block.pc.autooff": "Auto Off",
"block.pc.rename": "Rename",
Expand All @@ -345,8 +345,8 @@
"block.pc.option.release": "Release",
"block.pc.option.confirm": "Confirm",

"msg.pokecube.pc_top.fail": "§cPC Base required below",
"msg.pokecube.pc_base.fail": "§cPC Top required above",
"msg.pokecube.pc_top.fail": "§cPC Computer required below",
"msg.pokecube.pc_base.fail": "§cPC Screen required above",

"block.pokecube.deepslate_fossil_ore": "Deepslate Fossil Ore",
"block.pokecube.fossil_ore": "Fossil Ore",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
"credit": "Made with Blockbench",
"parent": "minecraft:block/slab",
"textures": {
"bottom": "pokecube_legends:block/mirage_planks"
"bottom": "pokecube_legends:block/mirage_planks",
"particle": "pokecube_legends:block/mirage_planks"
},
"elements": [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
"credit": "Made with Blockbench",
"parent": "minecraft:block/slab_top",
"textures": {
"bottom": "pokecube_legends:block/mirage_planks"
"bottom": "pokecube_legends:block/mirage_planks",
"particle": "pokecube_legends:block/mirage_planks"
},
"elements": [
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"textures": [
"pokecube_legends:infected_spark"
]
}
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.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"entries": [
{
"type": "minecraft:item",
"name": "pokecube_legends:temporal_button"
"name": "pokecube_legends:ultra_stone_button"
}
],
"conditions": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"entries": [
{
"type": "minecraft:item",
"name": "pokecube_legends:temporal_pressure_plate"
"name": "pokecube_legends:ultra_stone_pressure_plate"
}
],
"conditions": [
Expand Down
Binary file added template_worlds/block_layout/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added template_worlds/block_layout/level.dat
Binary file not shown.
Binary file added template_worlds/block_layout/region/r.-1.-1.mca
Binary file not shown.
Binary file added template_worlds/block_layout/region/r.-1.0.mca
Binary file not shown.
Binary file added template_worlds/block_layout/region/r.0.-1.mca
Binary file not shown.
Binary file added template_worlds/block_layout/region/r.0.0.mca
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 comments on commit 153521b

Please sign in to comment.