Skip to content

Commit b400a3b

Browse files
copyright disclaimer for DefaultSet.cs
1 parent 5095b02 commit b400a3b

File tree

3 files changed

+35
-49
lines changed

3 files changed

+35
-49
lines changed

fCraft/Portals/PortalHandler.cs

Lines changed: 9 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -14,31 +14,17 @@
1414
//along with this program. If not, see <http://www.gnu.org/licenses/>.
1515

1616
//Copyright (C) <2012> Glenn Mariën (http://project-vanilla.com)
17-
using System;
18-
using System.Collections.Generic;
19-
using System.Linq;
20-
using System.Text;
21-
using ServiceStack.Text;
22-
using System.Collections;
17+
using System;
18+
using System.Collections;
2319

2420
namespace fCraft.Portals {
25-
class PortalHandler {
26-
private static PortalHandler instance;
27-
28-
private PortalHandler() {
29-
// Empty, singleton
30-
}
31-
32-
public static PortalHandler GetInstance() {
33-
if (instance == null) {
34-
instance = new PortalHandler();
35-
Player.Moved += new EventHandler<Events.PlayerMovedEventArgs>(Player_Moved);
36-
Player.JoinedWorld += new EventHandler<Events.PlayerJoinedWorldEventArgs>(Player_JoinedWorld);
37-
Player.PlacedBlock += new EventHandler<Events.PlayerPlacedBlockEventArgs>(Player_PlacedBlock);
38-
PortalDB.StartSaveTask();
39-
}
40-
41-
return instance;
21+
internal static class PortalHandler {
22+
23+
public static void Init() {
24+
Player.Moved += Player_Moved;
25+
Player.JoinedWorld += Player_JoinedWorld;
26+
Player.PlacedBlock += Player_PlacedBlock;
27+
PortalDB.StartSaveTask();
4228
}
4329

4430
static void Player_PlacedBlock(object sender, Events.PlayerPlacedBlockEventArgs e) {

fCraft/System/Server.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@ public static bool StartServer() {
429429
Entity.LoadAll();
430430
DownloadResources();
431431

432-
PortalHandler.GetInstance();
432+
PortalHandler.Init();
433433
PortalDB.Load();
434434
EnvPresets.LoadAll();
435435

fCraft/World/DefaultSet.cs

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
// ProCraft Copyright 2014-2016 Joseph Beauvais <123DMWM@gmail.com>
2+
3+
// Based off code from https://github.com/Hetal728/MCGalaxy/blob/master/MCGalaxy/Blocks/DefaultSet.cs
4+
// which was based off code from https://github.com/UnknownShadow200/ClassicalSharp/blob/master/ClassicalSharp/Blocks/DefaultSet.cs
5+
// As the author of both of these files, I hereby license the code to be freely used without needing to follow the licenses of the aforementioned projects.
26
using System;
37
using System.Text;
48

@@ -13,7 +17,7 @@ public static BlockDefinition MakeCustomBlock(Block b) {
1317
byte raw = (byte)b;
1418
def.BlockID = raw;
1519
def.Name = Name(raw);
16-
def.CollideType = Collide(b);
20+
def.CollideType = (byte)Collide(b);
1721
def.Speed = 1;
1822
def.BlocksLight = BlocksLight(b);
1923

@@ -24,9 +28,9 @@ public static BlockDefinition MakeCustomBlock(Block b) {
2428

2529
def.FullBright = FullBright(b);
2630
def.Shape = Draw(b) == DrawType.Sprite ? (byte)0 : (byte)1;
27-
def.BlockDraw = Draw(b);
28-
if (def.BlockDraw == DrawType.Sprite)
29-
def.BlockDraw = DrawType.Transparent;
31+
DrawType blockDraw = Draw(b);
32+
if (blockDraw == DrawType.Sprite) blockDraw = DrawType.Transparent;
33+
def.BlockDraw = (byte)blockDraw;
3034

3135
def.FogDensity = FogDensity(b);
3236
CustomColor fog = FogColor(b);
@@ -71,7 +75,7 @@ public static CustomColor FogColor(Block b) {
7175
}
7276

7377
/// <summary> Gets the default collide type of a block, see CollideType class. </summary>
74-
public static byte Collide(Block b) {
78+
public static CollideType Collide(Block b) {
7579
if (b >= Block.Water && b <= Block.StillLava)
7680
return CollideType.SwimThrough;
7781
if (b == Block.Snow || b == Block.Air || Draw(b) == DrawType.Sprite)
@@ -125,7 +129,7 @@ public static SoundType StepSound(Block b) {
125129

126130

127131
/// <summary> Gets the default draw type of a block, see Draw class. </summary>
128-
public static byte Draw(Block b) {
132+
public static DrawType Draw(Block b) {
129133
if (b == Block.Air || b == Block.None) return DrawType.Gas;
130134
if (b == Block.Leaves) return DrawType.TransparentThick;
131135

@@ -191,27 +195,23 @@ static void SplitUppercase(StringBuilder buffer, int start, int end) {
191195
36, 37, 16, 11, 57, 50, 38, 80, 81, 82, 83, 84, 51, 54, 86, 58, 53, 52 };
192196
}
193197

194-
public static class DrawType {
195-
public const byte Opaque = 0;
196-
public const byte Transparent = 1;
197-
public const byte TransparentThick = 2; // e.g. leaves render all neighbours
198-
public const byte Translucent = 3;
199-
public const byte Gas = 4;
200-
public const byte Sprite = 5;
198+
public enum DrawType : byte {
199+
Opaque = 0,
200+
Transparent = 1,
201+
TransparentThick = 2, // e.g. leaves render all neighbours
202+
Translucent = 3,
203+
Gas = 4,
204+
Sprite = 5,
201205
}
202206

203-
public static class CollideType {
204-
public const byte WalkThrough = 0; // Gas (usually also used by sprite)
205-
public const byte SwimThrough = 1; // Liquid
206-
public const byte Solid = 2; // Solid
207-
public const byte Ice = 3; // Solid and partially slidable on.
208-
public const byte SlipperyIce = 4; // Solid and fully slidable on.
209-
public const byte LiquidWater = 5; // Water style 'swimming'/'bobbing'
210-
public const byte LiquidLava = 6; // Lava style 'swimming'/'bobbing'
211-
212-
public static bool IsSolid(byte collide) {
213-
return collide >= Solid && collide <= SlipperyIce;
214-
}
207+
public enum CollideType : byte {
208+
WalkThrough = 0, // Gas (usually also used by sprite)
209+
SwimThrough = 1, // Liquid
210+
Solid = 2, // Solid
211+
Ice = 3, // Solid and partially slidable on.
212+
SlipperyIce = 4, // Solid and fully slidable on.
213+
LiquidWater = 5, // Water style 'swimming'/'bobbing'
214+
LiquidLava = 6, // Lava style 'swimming'/'bobbing'
215215
}
216216

217217
public enum SoundType : byte {

0 commit comments

Comments
 (0)