Fandom

Minecraft Mod Custom Stuff Wiki

Fence

175pages on
this wiki
Add New Page
Comments8 Share
FenceExample

This is MY little pool of water.

The fence type functions much like the fencing in vanilla Minecraft, in which it attempts to connect to any nearby blocks. Because fences automatically connect to nearby blocks, they don't need to store this behavior in the save files. As a result, they're one of the various types of blocks that can use Damage Values for variants.

It's important to note that when making a texture for the fence, it will always be in the shape of the default fence. If you wanted to make a fence with other shapes like arches or a simple picket fence, you can try using the pane type.

New Wood Fence (CS2 0.9.10)

2012-10-19 15.27.54

New Fence

newFence_200.js

id = config.getBlockId("newFenceID");
name = "newWoodFence";
displayName[0] = "New Wood Fence";
material = "wood";
hardness[0] = 3.0;
drop[0] = config.getBlockId("newFenceID");
addToCreative[0] = true;
creativeTab = "decorations";
textureFileXP[0] = "/tree_side.png";
textureFileXN[0] = "/tree_side.png";
textureFileYP[0] = "/tree_top.png";
textureFileYN[0] = "/tree_top.png";
textureFileZP[0] = "/tree_side.png";
textureFileZN[0] = "/tree_side.png";

mod.js

config.addBlockIdProperty("newFenceID", 200);
mod.addBlock("newFence_200.js", "fence");

Fence Block Attributes

Required Attributes

Optional Attributes

textureFile and textureIndex
In CS2 versions for 1.4.7 and below, CS2 0.9.9 or below, textureFile was used to specify the texture sheet and textureIndex was used for identifying the specific icon within the texture sheet. If using CS2 0.9.9 or lower, make sure to use both of these attributes.

CS1
Older Examples and Information for Custom Stuff 1.



Example Fence Block

name="Glowing Perimeter Fence";
id=215;
texturefile="terrain.png";
textureindex=105;
type="fence";
material="glass";
stepsound="glass";
hardness=0.3;
resistance=1;
iddropped=215;
opacity=0;
light=15;
movebypiston=true;
harvestlevel=0;
toolclass="pickaxe";

Fence Block Attributes

Below is a table of attributes available to fence-type blocks, including information on notable attributes.



Required Attributes

Optional Attributes

type
This must be set to 'fence' in order for the block to function as a fence.

opacity
Setting this attribute to a low value prevents a rather pronounced visual bug. See Importance of the Opacity Attribute below.

Behavior

FenceBehavior

Custom Stuff fences interacting with each other and with vanilla objects.

Fences will act as though they are roughly 1.5 blocks in height, despite being only a single block tall. This is to prevent most mobs, including players and animals, from simply jumping over them. In this way fences are an effective way to create a barrier that doesn't also block line of sight.

Fences of all types will attempt to connect to blocks adjacent to them. All fences will connect properly to Fence gates. They won't connect to other fences with different block IDs, however they will connect to other damage values of their own ID.

Importance of the Opacity Attribute

FenceOpacity

An example of two fences, one with the default opacity (left) and the correct opacity (right).

When making fences the opacity attribute should always be set to a value of ten or less even if the the material being used is not intrinsically translucent. This is done to prevent a visual 'bug', demonstrated by the picture at left, which causes a shadow on the geometry of the fence and the blocks adjacent to it, regardless of light level. This 'glitch' occurs because Minecraft calculates the light level of the area 'inside' the area block based on what's immediately below it. Because a block with default opacity or high opacity filters out all light. The boundary of the fence block (the box you see when you place your reticule on it) forces the game to calculate the light level as being 0 on the ground beneath the fence. Setting the opacity to a low value fixes this issue. This is also why stairs, slabs, and doors in the vanilla game don't block light entirely even when they logically should.

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.