Skip to content

Instantly share code, notes, and snippets.

View pollend's full-sized avatar
:octocat:
working on random stuff

Michael Pollind pollend

:octocat:
working on random stuff
View GitHub Profile
package org.terasology.MyModule.blocks;
import com.google.common.collect.ImmutableSet;
import gnu.trove.map.TByteObjectMap;
import gnu.trove.map.hash.TByteObjectHashMap;
import org.terasology.entitySystem.entity.EntityRef;
import org.terasology.entitySystem.event.ReceiveEvent;
import org.terasology.entitySystem.systems.BaseComponentSystem;
import org.terasology.entitySystem.systems.RegisterMode;
import org.terasology.entitySystem.systems.RegisterSystem;
@pollend
pollend / started.md
Last active December 1, 2017 00:32
Hugo and Webpack
package org.terasology.Sample.blocks;
import gnu.trove.map.TByteObjectMap;
import gnu.trove.map.hash.TByteObjectHashMap;
import org.terasology.math.Side;
import org.terasology.math.SideBitFlag;
import org.terasology.math.geom.Vector3i;
import org.terasology.naming.Name;
import org.terasology.registry.In;
import org.terasology.world.WorldProvider;
@In
private BlockManager blockManager;
...
PathFamily family = (PathFamily)blockManager.getBlockFamily("Rails:rails");
Block block = family.getBlockByConnection( SideBitFlag.getSides(Side.LEFT,Side.RIGHT));
// do something with block
/*
* Copyright 2017 MovingBlocks
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@pollend
pollend / BlockFamilyContrast.md
Created December 2, 2017 17:15 — forked from Steampunkery/BlockFamilyContrast.md
A compare & contrast of the new and old BlockFamily systems of Terasology

What is a BlockFamily?

A block family is a group, or family (hence the name) of blocks. What this means is there are an arbitrary number of blocks that are grouped together because they are similar. For example, there is a RomanColumn family which consists of a cap block, a base block and a middle block. These blocks are separate blocks with different textures, and they can also have distinct shapes (although RomanColumns are all cubes), but they share a *.block file. A block family is created with the "rotation" tag in v1 block families and the "family" tag in v2 block families. For more information about v1 block families and v2 block families, look here. This gist aims to compare and contrast the block family versions and add some documentation as well.

Definition

What I'm referring to as old block families are the current block families in the master Terasology repo as of the time of writing (Friday, December 1 2017). [Example of ol

Description

BlockFamilies was built as a way to organize blocks of a certain type together. For instance, a fence block can be connected to nothing or up to four cardinal directions and every other combination in between. A block family is defined in the .block file using the rotation flag and the value is the associated family that will be used to represent the block family. Some default families that come with the base engine includes: freeform, horizontal,attachedToSurface, and fullRotation

Usage

*.block

{
 "rotation": "attachedToSurface",
13:43:55.583 [main] INFO o.t.logic.console.ConsoleImpl - [CONSOLE] Welcome to the wonderful world of Terasology!
Type 'help' to see a list with available commands or 'help <commandName>' for command details.
Text parameters do not need quotes, unless containing spaces. No commas between parameters.
You can use auto-completion by typing a partial command then hitting [tab] - examples:
gh + [tab] => 'ghost'
help gh + [tab] => 'help ghost' (can auto complete commands fed to help)
giv + [tab] => 'give givePermission' (use [tab] again to cycle between choices)
lS + [tab] => 'listShapes' (camel casing abbreviated commands)
/*
* Copyright 2015 MovingBlocks
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software