Skip to content

Commit

Permalink
Fixed some of the server startup crashes
Browse files Browse the repository at this point in the history
  • Loading branch information
GirafiStudios committed Jan 25, 2021
1 parent 5836d0a commit 553464e
Show file tree
Hide file tree
Showing 10 changed files with 18 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public float getExplosionResistance(BlockState state, IBlockReader world, BlockP
}

@Override
public void neighborChanged(@Nonnull BlockState state, @Nonnull World world, @Nonnull BlockPos pos, @Nonnull Block block, @Nonnull BlockPos fromPos, boolean isMoving) { //TODO Use fromPos, to only activate when the facing position is updated
public void neighborChanged(@Nonnull BlockState state, @Nonnull World world, @Nonnull BlockPos pos, @Nonnull Block block, @Nonnull BlockPos fromPos, boolean isMoving) {
super.neighborChanged(state, world, pos, block, fromPos, isMoving);
if (world.getBlockState(pos.offset(state.get(FACING))) == world.getBlockState(fromPos)) {
Block facingBlock = world.getBlockState(fromPos).getBlock();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import com.google.common.collect.Maps;
import com.teammetallurgy.atum.api.God;
import com.teammetallurgy.atum.client.particle.NebuFlameParticle;
import com.teammetallurgy.atum.init.AtumParticles;
import net.minecraft.block.Block;
import net.minecraft.block.SoundType;
Expand All @@ -13,6 +12,7 @@

import javax.annotation.Nullable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

Expand All @@ -21,6 +21,10 @@ public class AtumTorchBlock extends TorchBlock implements INebuTorch {
public static final Map<Block, Block> UNLIT = Maps.newHashMap();
public static final Map<Block, Block> LIT = Maps.newHashMap();

//Flame particles
public static final HashMap<God, IParticleData> GOD_FLAMES = new HashMap<>();
public static final HashMap<IParticleData, God> GODS = new HashMap<>();

public AtumTorchBlock(int lightValue, IParticleData particleType) {
super(Block.Properties.create(Material.MISCELLANEOUS).doesNotBlockMovement().hardnessAndResistance(0.0F).setLightLevel(s -> lightValue).sound(SoundType.WOOD), particleType);
}
Expand All @@ -30,7 +34,7 @@ public AtumTorchBlock(int lightValue) {
}

public AtumTorchBlock(@Nullable God god) {
this(14, god == null ? AtumParticles.NEBU_FLAME : NebuFlameParticle.GOD_FLAMES.get(god));
this(14, god == null ? AtumParticles.NEBU_FLAME : GOD_FLAMES.get(god));
}

public IParticleData getParticleType() {
Expand All @@ -44,6 +48,6 @@ public boolean isNebuTorch() {

@Override
public God getGod() {
return NebuFlameParticle.GODS.get(this.getParticleType());
return GODS.get(this.getParticleType());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@ public boolean isNebuTorch() {

@Override
public God getGod() {
return NebuFlameParticle.GODS.get(this.particleData);
return AtumTorchBlock.GODS.get(this.particleData);
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.teammetallurgy.atum.blocks.machines;

import com.teammetallurgy.atum.api.God;
import com.teammetallurgy.atum.blocks.lighting.AtumTorchBlock;
import com.teammetallurgy.atum.blocks.machines.tileentity.GodforgeTileEntity;
import com.teammetallurgy.atum.client.particle.NebuFlameParticle;
import net.minecraft.block.*;
Expand Down Expand Up @@ -43,7 +44,7 @@ public GodforgeBlock() {
}

@Override
public TileEntity createNewTileEntity(@Nonnull IBlockReader world) { //TODO Add Te
public TileEntity createNewTileEntity(@Nonnull IBlockReader world) {
return new GodforgeTileEntity();
}

Expand Down Expand Up @@ -114,7 +115,7 @@ public void animateTick(BlockState state, @Nonnull World world, @Nonnull BlockPo
double d6 = rand.nextDouble() * 6.0D / 16.0D;
double d7 = axis == Direction.Axis.Z ? (double)direction.getZOffset() * 0.52D : d4;
world.addParticle(ParticleTypes.SMOKE, d0 + d5, d1 + d6, d2 + d7, 0.0D, 0.0D, 0.0D);
world.addParticle(NebuFlameParticle.GOD_FLAMES.get(state.get(GOD)), d0 + d5, d1 + d6, d2 + d7, 0.0D, 0.0D, 0.0D);
world.addParticle(AtumTorchBlock.GOD_FLAMES.get(state.get(GOD)), d0 + d5, d1 + d6, d2 + d7, 0.0D, 0.0D, 0.0D);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
import java.util.HashMap;

public class NebuFlameParticle extends DeceleratingParticle {
public static final HashMap<God, IParticleData> GOD_FLAMES = new HashMap<>();
public static final HashMap<IParticleData, God> GODS = new HashMap<>();

public NebuFlameParticle(ClientWorld world, double x, double y, double z, double motionX, double motionY, double motionZ) {
super(world, x, y, z, motionX, motionY, motionZ);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.teammetallurgy.atum.blocks.beacon.HeartOfRaBlock;
import com.teammetallurgy.atum.init.AtumBlocks;
import com.teammetallurgy.atum.init.AtumEntities;
import com.teammetallurgy.atum.init.AtumItems;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityType;
import net.minecraft.nbt.CompoundNBT;
Expand Down Expand Up @@ -64,7 +65,7 @@ public boolean attackEntityFrom(@Nonnull DamageSource source, float amount) {
if (!this.world.isRemote) {
if (!source.isExplosion()) {
this.world.createExplosion(null, this.getPosX(), this.getPosY(), this.getPosZ(), 3.0F, Explosion.Mode.DESTROY);
this.entityDropItem(AtumBlocks.HEART_OF_RA.asItem(), 1);
this.entityDropItem(AtumItems.HEART_OF_RA.asItem(), 1);
}
}
}
Expand Down
1 change: 0 additions & 1 deletion src/main/java/com/teammetallurgy/atum/init/AtumBlocks.java
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,6 @@ public class AtumBlocks {
public static final Block DEADWOOD_SIGN = registerSign(new AtumStandingSignBlock(AbstractBlock.Properties.create(Material.WOOD).doesNotBlockMovement().hardnessAndResistance(1.0F).sound(SoundType.WOOD), AtumWoodTypes.DEADWOOD), AtumWoodTypes.DEADWOOD);
public static final Block PALM_SCAFFOLDING = registerScaffolding(new AtumScaffoldingBlock(AbstractBlock.Properties.create(Material.MISCELLANEOUS, MaterialColor.SAND).doesNotBlockMovement().sound(SoundType.SCAFFOLDING).variableOpacity()), "palm_scaffolding");
public static final Block DEADWOOD_SCAFFOLDING = registerScaffolding(new AtumScaffoldingBlock(AbstractBlock.Properties.create(Material.MISCELLANEOUS, MaterialColor.SAND).doesNotBlockMovement().sound(SoundType.SCAFFOLDING).variableOpacity()), "deadwood_scaffolding");
public static final Block HEART_OF_RA = AtumItems.HEART_OF_RA;

public static void setBlockInfo() {
((FlowerPotBlock) Blocks.FLOWER_POT).addPlant(PALM_SAPLING.getRegistryName(), () -> POTTED_PALM_SAPLING);
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/teammetallurgy/atum/init/AtumItems.java
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public class AtumItems {
public static final Item SHU_GODSHARD = registerItem(new GodshardItem(God.SHU), "shu_godshard");
public static final Item TEFNUT_GODSHARD = registerItem(new GodshardItem(God.TEFNUT), "tefnut_godshard");
public static final Item IDOL_OF_LABOR = registerItem(new IdolOfLaborItem(), "idol_of_labor");
static final Block HEART_OF_RA = AtumRegistry.registerBlock(new HeartOfRaBlock(), "heart_of_ra");
public static final Block HEART_OF_RA = AtumRegistry.registerBlock(new HeartOfRaBlock(), "heart_of_ra");
public static final BaseBowItem SHORT_BOW = (BaseBowItem) registerItem(new BaseBowItem(new Item.Properties().maxDamage(384)), "short_bow");
public static final Item LIMESTONE_SHOVEL = registerItem(new ShovelItem(AtumMats.LIMESTONE, 1.2F, -3.0F, new Item.Properties().group(Atum.GROUP)), "limestone_shovel");
public static final Item LIMESTONE_PICKAXE = registerItem(new PickaxeItem(AtumMats.LIMESTONE, 1, -2.8F, new Item.Properties().group(Atum.GROUP)), "limestone_pickaxe");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public static void registerTileEntities(RegistryEvent.Register<TileEntityType<?>
registerTileEntity("tar_trap", TileEntityType.Builder.create(TarTrapTileEntity::new, AtumBlocks.TAR_TRAP));
registerTileEntity("smoke_trap", TileEntityType.Builder.create(SmokeTrapTileEntity::new, AtumBlocks.SMOKE_TRAP));
registerTileEntity("arrow_trap", TileEntityType.Builder.create(ArrowTrapTileEntity::new, AtumBlocks.ARROW_TRAP));
registerTileEntity("heart_of_ra", TileEntityType.Builder.create(HeartOfRaTileEntity::new, AtumBlocks.HEART_OF_RA));
registerTileEntity("heart_of_ra", TileEntityType.Builder.create(HeartOfRaTileEntity::new, AtumItems.HEART_OF_RA));
//registerTileEntity("radiant_beacon", TileEntityType.Builder.create(RadiantBeaconTileEntity::new, AtumBlocks.RADIANT_BEACON, AtumBlocks.RADIANT_BEACON_FRAMED));
registerTileEntity("limestone_furnace", TileEntityType.Builder.create(LimestoneFurnaceTileEntity::new, AtumBlocks.LIMESTONE_FURNACE));
registerTileEntity("quern", TileEntityType.Builder.create(QuernTileEntity::new, AtumBlocks.QUERN));
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/teammetallurgy/atum/misc/AtumRegistry.java
Original file line number Diff line number Diff line change
Expand Up @@ -312,8 +312,8 @@ public static BasicParticleType registerParticle(String name) {

public static BasicParticleType registerGodFlame(String name, God god) {
BasicParticleType particleType = registerParticle(name);
NebuFlameParticle.GOD_FLAMES.put(god, particleType);
NebuFlameParticle.GODS.put(particleType, god);
AtumTorchBlock.GOD_FLAMES.put(god, particleType);
AtumTorchBlock.GODS.put(particleType, god);
return particleType;
}
/*
Expand Down

0 comments on commit 553464e

Please sign in to comment.