forked from df-mc/dragonfly
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implemented fire spreading (df-mc#68)
* Add BreakBlockWithoutParticles method * Implemented fire * Added flint and steel sound + Handle fire extinguishing * Fixed falling block entity AABB * Implemented soul sand & soul fire * Lava can now spread fire * Extinguishing a fire now plays the proper sound * Fire spread is now affected by world difficulty * Implemented block collisions & fire damage * Added missing OnFire state * Lava now lights players on fire * Reset fire tick on respawn * Fixed bad copy paste * Implemented fire resistance potions & effect * Implemented crimson & warped wood variants * Commit missing changes * Fixed unreachable panics * Made fire blocks replaceable * Fixed unbreakable fence gates * Fixed falling block entities * Implemented random blocks * Removed code that was not supposed to be committed * Fixed extra space in comment * Fixed sea lanterns dropping self * Added Polished Basalt, Smooth Stone, & Soul Soil * Grammar * Added blue ice, gilded blackstone, basalt generators * Apples drop only from dark oak/oak * Optimized basalt generation * whoops * Implemented shroomlight * Implemented FlammabilityInfo struct * Rename EntityColliding + don't export neighbourFlammable * Added method woodTypeFlammable * Added LavaFlammable field to FlammabilityInfo * Cleanup fire spread logic * Rename neighbourFlammable -> neighboursFlammable * Cleanup entity.Flammable interface * Fixed missing LavaFlammable check * Nether doors & trapdoors are not lava flammable * Display entity on fire state * Fixed fire spread for lava * Cleaned up wood flammability checks * OnFireDuration/SetOnFire now return/accept time.Duration * Move FireDamage/LavaDamage methods to block_internal * Fixed neighbour updates speeding up fire spread * Cleanup + Fire extinguishes with water underneath
- Loading branch information
Showing
55 changed files
with
1,253 additions
and
101 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package block | ||
|
||
// Barrier is a transparent solid block used to create invisible boundaries. | ||
type Barrier struct { | ||
noNBT | ||
transparent | ||
solid | ||
} | ||
|
||
// EncodeItem ... | ||
func (Barrier) EncodeItem() (id int32, meta int16) { | ||
return -161, 0 | ||
} | ||
|
||
// EncodeBlock ... | ||
func (Barrier) EncodeBlock() (name string, properties map[string]interface{}) { | ||
return "minecraft:barrier", nil | ||
} | ||
|
||
// Hash ... | ||
func (Barrier) Hash() uint64 { | ||
return hashBarrier | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
package block | ||
|
||
import ( | ||
"github.com/df-mc/dragonfly/dragonfly/item" | ||
"github.com/df-mc/dragonfly/dragonfly/world" | ||
"github.com/go-gl/mathgl/mgl64" | ||
) | ||
|
||
// Basalt is a type of igneous rock found in the Nether. | ||
type Basalt struct { | ||
noNBT | ||
solid | ||
|
||
// Polished specifies if the basalt is its polished variant. | ||
Polished bool | ||
// Axis is the axis which the basalt faces. | ||
Axis world.Axis | ||
} | ||
|
||
// UseOnBlock ... | ||
func (b Basalt) UseOnBlock(pos world.BlockPos, face world.Face, _ mgl64.Vec3, w *world.World, user item.User, ctx *item.UseContext) (used bool) { | ||
pos, face, used = firstReplaceable(w, pos, face, b) | ||
if !used { | ||
return | ||
} | ||
b.Axis = face.Axis() | ||
|
||
place(w, pos, b, user, ctx) | ||
return placed(ctx) | ||
} | ||
|
||
// BreakInfo ... | ||
func (b Basalt) BreakInfo() BreakInfo { | ||
return BreakInfo{ | ||
Hardness: 1.25, | ||
Harvestable: pickaxeHarvestable, | ||
Effective: pickaxeEffective, | ||
Drops: simpleDrops(item.NewStack(b, 1)), | ||
} | ||
} | ||
|
||
// EncodeItem ... | ||
func (b Basalt) EncodeItem() (id int32, meta int16) { | ||
if b.Polished { | ||
return -235, 0 | ||
} | ||
return -234, 0 | ||
} | ||
|
||
// EncodeBlock ... | ||
func (b Basalt) EncodeBlock() (name string, properties map[string]interface{}) { | ||
if b.Polished { | ||
return "minecraft:polished_basalt", map[string]interface{}{"pillar_axis": b.Axis.String()} | ||
} | ||
return "minecraft:basalt", map[string]interface{}{"pillar_axis": b.Axis.String()} | ||
} | ||
|
||
// Hash ... | ||
func (b Basalt) Hash() uint64 { | ||
return hashBasalt | (uint64(boolByte(b.Polished)) << 32) | (uint64(b.Axis) << 33) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package block | ||
|
||
// TODO: Slipperiness | ||
|
||
// BlueIce is a solid block similar to packed ice. | ||
type BlueIce struct { | ||
noNBT | ||
solid | ||
} | ||
|
||
// LightEmissionLevel ... | ||
func (BlueIce) LightEmissionLevel() uint8 { | ||
return 4 | ||
} | ||
|
||
// BreakInfo ... | ||
func (b BlueIce) BreakInfo() BreakInfo { | ||
return BreakInfo{ | ||
Hardness: 2.8, | ||
Harvestable: alwaysHarvestable, | ||
Effective: pickaxeEffective, | ||
Drops: simpleDrops(), | ||
} | ||
} | ||
|
||
// EncodeItem ... | ||
func (BlueIce) EncodeItem() (id int32, meta int16) { | ||
return -11, 0 | ||
} | ||
|
||
// EncodeBlock ... | ||
func (BlueIce) EncodeBlock() (name string, properties map[string]interface{}) { | ||
return "minecraft:blue_ice", nil | ||
} | ||
|
||
// Hash ... | ||
func (BlueIce) Hash() uint64 { | ||
return hashBlueIce | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package block | ||
|
||
import ( | ||
"github.com/df-mc/dragonfly/dragonfly/item" | ||
"github.com/df-mc/dragonfly/dragonfly/item/tool" | ||
) | ||
|
||
// CryingObsidian is a luminous variant of obsidian that can be used to craft a respawn anchor and produces purple particles when placed. | ||
type CryingObsidian struct { | ||
noNBT | ||
solid | ||
} | ||
|
||
// LightEmissionLevel ... | ||
func (CryingObsidian) LightEmissionLevel() uint8 { | ||
return 10 | ||
} | ||
|
||
// BreakInfo ... | ||
func (c CryingObsidian) BreakInfo() BreakInfo { | ||
return BreakInfo{ | ||
Hardness: 50, | ||
Harvestable: func(t tool.Tool) bool { | ||
return t.ToolType() == tool.TypePickaxe && t.HarvestLevel() == tool.TierDiamond.HarvestLevel | ||
}, | ||
Effective: pickaxeEffective, | ||
Drops: simpleDrops(item.NewStack(c, 1)), | ||
} | ||
} | ||
|
||
// EncodeItem ... | ||
func (CryingObsidian) EncodeItem() (id int32, meta int16) { | ||
return -289, 0 | ||
} | ||
|
||
// EncodeBlock ... | ||
func (CryingObsidian) EncodeBlock() (name string, properties map[string]interface{}) { | ||
return "minecraft:crying_obsidian", nil | ||
} | ||
|
||
// Hash ... | ||
func (CryingObsidian) Hash() uint64 { | ||
return hashCryingObsidian | ||
} |
Oops, something went wrong.