Filter python code to add chestMinecraft modding, besides where it is installed, what are the differences between client and server mods?Hopper Timer only exchanges one item?Can't get “Find Beds” filter to workAll items not removed from brewing stand in automated brewing systemCan I determine 'not 100% charged' using AE2 fuzzy logic upgrades in export buses?Add multiple NBT tag Tags(Java Minecraft 1.14) How to set the probability of nested entries in a loot table?
Radix2 Fast Fourier Transform implemented in C++
Pocket Clarketech
Adding things to bunches of things vs multiplication
Regression when x and y each have uncertainties
Ending a line of dialogue with "?!": Allowed or obnoxious?
Have there ever been other TV shows or Films that told a similiar story to the new 90210 show?
What does a comma signify in inorganic chemistry?
Is a suspension needed to do wheelies?
Tikz: The position of a label change step-wise and not in a continuous way
What if a restaurant suddenly cannot accept credit cards, and the customer has no cash?
Airline power sockets shut down when I plug my computer in. How can I avoid that?
Icon is not displayed in lwc
What was the intention with the Commodore 128?
What should I do if actually I found a serious flaw in someone's PhD thesis and an article derived from that PhD thesis?
Units of measurement, especially length, when body parts vary in size among races
Gofer work in exchange for Letter of Recommendation
Can I submit a paper computer science conference using an alias if using my real name can cause legal trouble in my original country
Which manga depicts Doraemon and Nobita on Easter Island?
Output the list of musical notes
How to open terminal automatically when ubuntu boots up?
How does the illumination of the sky from the sun compare to that of the moon?
Subgroup generated by a subgroup and a conjugate of it
Combinatorial Argument for Exponential and Logarithmic Function Being Inverse
Do I need to start off my book by describing the character's "normal world"?
Filter python code to add chest
Minecraft modding, besides where it is installed, what are the differences between client and server mods?Hopper Timer only exchanges one item?Can't get “Find Beds” filter to workAll items not removed from brewing stand in automated brewing systemCan I determine 'not 100% charged' using AE2 fuzzy logic upgrades in export buses?Add multiple NBT tag Tags(Java Minecraft 1.14) How to set the probability of nested entries in a loot table?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
Does anyone have any sample code for a filter that adds a chest into the selection box?
I am just getting started programming a filter and I am unsure how to go about adding a new empty chest so the rest of my filter can fill it. So how do you add a NEW chest in filter code? I don't want to search for one existing already, I need a new one.
minecraft minecraft-mcedit
add a comment |
Does anyone have any sample code for a filter that adds a chest into the selection box?
I am just getting started programming a filter and I am unsure how to go about adding a new empty chest so the rest of my filter can fill it. So how do you add a NEW chest in filter code? I don't want to search for one existing already, I need a new one.
minecraft minecraft-mcedit
add a comment |
Does anyone have any sample code for a filter that adds a chest into the selection box?
I am just getting started programming a filter and I am unsure how to go about adding a new empty chest so the rest of my filter can fill it. So how do you add a NEW chest in filter code? I don't want to search for one existing already, I need a new one.
minecraft minecraft-mcedit
Does anyone have any sample code for a filter that adds a chest into the selection box?
I am just getting started programming a filter and I am unsure how to go about adding a new empty chest so the rest of my filter can fill it. So how do you add a NEW chest in filter code? I don't want to search for one existing already, I need a new one.
minecraft minecraft-mcedit
minecraft minecraft-mcedit
edited 23 mins ago
pppery
1,5371 gold badge8 silver badges20 bronze badges
1,5371 gold badge8 silver badges20 bronze badges
asked Nov 3 '15 at 15:52
WolfieWolfie
2461 silver badge3 bronze badges
2461 silver badge3 bronze badges
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
After digging into the source for MCE and also source for some of SethBling's filters I managed to whip up some code.
The following functions assume a global object named levelOBJ which is set to the incoming level object in your perform() function. This way you don't have to keep passing level or box.
# Just so I don't have to keep doing the math
def getChunkAt(x, z):
chunk = levelObj.getChunk(x / 16, z / 16)
return chunk
# Creates a TAG_Compound Item (for use with the CreateChestAt function)
def CreateChestItem(itemid, damage=0, count=1, slot=0):
item = TAG_Compound()
item["id"] = TAG_Short(itemid)
item["Damage"] = TAG_Short(damage)
item["Count"] = TAG_Byte(count)
item["Slot"] = TAG_Byte(slot)
return item
# Creates a chest at the specified coords containing the items passed
def CreateChestAt(x, y, z, Items=None, Direction=2, CustomName=""):
levelObj.setBlockAt(x, y, z, 54) # Chest Block (single = 27 slots 0-26), 54 == chest, 146 == Trapped Chest
levelObj.setBlockDataAt(x, y, z, Direction) # 2==N, 3==S, 4==W, 5==E anything else == N
# Now Create Entity Block and add it to the chunk
chunk = getChunkAt(x, z)
chest = TileEntity.Create("Chest")
TileEntity.setpos(chest, (x, y, z))
if Items <> None:
chest["Items"] = Items
if CustomName <> "":
chest["CustomName"] = CustomName
chunk.TileEntities.append(chest)
Then you can use my functions in your filter by calling them as described in the samples below. Below, x,y,z assumes they have been populated by proper coordinates you wish the chest to be placed at.
Also, double chests are simply two side by side chests. Call CreateChestAt twice (two coordinates 1 apart E-W or N-S) to create a double chest. You can create 3 in a row but Minecraft will invalidate the 3rd chest making it inaccessible in-game so pay attention to how you place them.
To Create an empty chest:
CreateChestAt(x, y, z)
To Create a chest with items:
# Build item list (4 Jungle Planks and 11 chests
ChestItems = TAG_List()
ChestItems.append( CreateChestItem(5, 3, 4, 0) )
ChestItems.append( CreateChestItem(54, 0, 11, 1) )
# Make a chest with the items.
CreateChestAt(x, y, z, ChestItems)
Optional parameters of Direction and CustomName can be specified too...
Creates an empty chest facing West named "My Chest"
CreateChestAt(x, y, z, None, 4, "My Chest")
You can click the green check mark to select this as being the correct answer.
– rivermont - Will B.
Apr 28 '16 at 13:13
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "41"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
noCode: true, onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgaming.stackexchange.com%2fquestions%2f241914%2ffilter-python-code-to-add-chest%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
After digging into the source for MCE and also source for some of SethBling's filters I managed to whip up some code.
The following functions assume a global object named levelOBJ which is set to the incoming level object in your perform() function. This way you don't have to keep passing level or box.
# Just so I don't have to keep doing the math
def getChunkAt(x, z):
chunk = levelObj.getChunk(x / 16, z / 16)
return chunk
# Creates a TAG_Compound Item (for use with the CreateChestAt function)
def CreateChestItem(itemid, damage=0, count=1, slot=0):
item = TAG_Compound()
item["id"] = TAG_Short(itemid)
item["Damage"] = TAG_Short(damage)
item["Count"] = TAG_Byte(count)
item["Slot"] = TAG_Byte(slot)
return item
# Creates a chest at the specified coords containing the items passed
def CreateChestAt(x, y, z, Items=None, Direction=2, CustomName=""):
levelObj.setBlockAt(x, y, z, 54) # Chest Block (single = 27 slots 0-26), 54 == chest, 146 == Trapped Chest
levelObj.setBlockDataAt(x, y, z, Direction) # 2==N, 3==S, 4==W, 5==E anything else == N
# Now Create Entity Block and add it to the chunk
chunk = getChunkAt(x, z)
chest = TileEntity.Create("Chest")
TileEntity.setpos(chest, (x, y, z))
if Items <> None:
chest["Items"] = Items
if CustomName <> "":
chest["CustomName"] = CustomName
chunk.TileEntities.append(chest)
Then you can use my functions in your filter by calling them as described in the samples below. Below, x,y,z assumes they have been populated by proper coordinates you wish the chest to be placed at.
Also, double chests are simply two side by side chests. Call CreateChestAt twice (two coordinates 1 apart E-W or N-S) to create a double chest. You can create 3 in a row but Minecraft will invalidate the 3rd chest making it inaccessible in-game so pay attention to how you place them.
To Create an empty chest:
CreateChestAt(x, y, z)
To Create a chest with items:
# Build item list (4 Jungle Planks and 11 chests
ChestItems = TAG_List()
ChestItems.append( CreateChestItem(5, 3, 4, 0) )
ChestItems.append( CreateChestItem(54, 0, 11, 1) )
# Make a chest with the items.
CreateChestAt(x, y, z, ChestItems)
Optional parameters of Direction and CustomName can be specified too...
Creates an empty chest facing West named "My Chest"
CreateChestAt(x, y, z, None, 4, "My Chest")
You can click the green check mark to select this as being the correct answer.
– rivermont - Will B.
Apr 28 '16 at 13:13
add a comment |
After digging into the source for MCE and also source for some of SethBling's filters I managed to whip up some code.
The following functions assume a global object named levelOBJ which is set to the incoming level object in your perform() function. This way you don't have to keep passing level or box.
# Just so I don't have to keep doing the math
def getChunkAt(x, z):
chunk = levelObj.getChunk(x / 16, z / 16)
return chunk
# Creates a TAG_Compound Item (for use with the CreateChestAt function)
def CreateChestItem(itemid, damage=0, count=1, slot=0):
item = TAG_Compound()
item["id"] = TAG_Short(itemid)
item["Damage"] = TAG_Short(damage)
item["Count"] = TAG_Byte(count)
item["Slot"] = TAG_Byte(slot)
return item
# Creates a chest at the specified coords containing the items passed
def CreateChestAt(x, y, z, Items=None, Direction=2, CustomName=""):
levelObj.setBlockAt(x, y, z, 54) # Chest Block (single = 27 slots 0-26), 54 == chest, 146 == Trapped Chest
levelObj.setBlockDataAt(x, y, z, Direction) # 2==N, 3==S, 4==W, 5==E anything else == N
# Now Create Entity Block and add it to the chunk
chunk = getChunkAt(x, z)
chest = TileEntity.Create("Chest")
TileEntity.setpos(chest, (x, y, z))
if Items <> None:
chest["Items"] = Items
if CustomName <> "":
chest["CustomName"] = CustomName
chunk.TileEntities.append(chest)
Then you can use my functions in your filter by calling them as described in the samples below. Below, x,y,z assumes they have been populated by proper coordinates you wish the chest to be placed at.
Also, double chests are simply two side by side chests. Call CreateChestAt twice (two coordinates 1 apart E-W or N-S) to create a double chest. You can create 3 in a row but Minecraft will invalidate the 3rd chest making it inaccessible in-game so pay attention to how you place them.
To Create an empty chest:
CreateChestAt(x, y, z)
To Create a chest with items:
# Build item list (4 Jungle Planks and 11 chests
ChestItems = TAG_List()
ChestItems.append( CreateChestItem(5, 3, 4, 0) )
ChestItems.append( CreateChestItem(54, 0, 11, 1) )
# Make a chest with the items.
CreateChestAt(x, y, z, ChestItems)
Optional parameters of Direction and CustomName can be specified too...
Creates an empty chest facing West named "My Chest"
CreateChestAt(x, y, z, None, 4, "My Chest")
You can click the green check mark to select this as being the correct answer.
– rivermont - Will B.
Apr 28 '16 at 13:13
add a comment |
After digging into the source for MCE and also source for some of SethBling's filters I managed to whip up some code.
The following functions assume a global object named levelOBJ which is set to the incoming level object in your perform() function. This way you don't have to keep passing level or box.
# Just so I don't have to keep doing the math
def getChunkAt(x, z):
chunk = levelObj.getChunk(x / 16, z / 16)
return chunk
# Creates a TAG_Compound Item (for use with the CreateChestAt function)
def CreateChestItem(itemid, damage=0, count=1, slot=0):
item = TAG_Compound()
item["id"] = TAG_Short(itemid)
item["Damage"] = TAG_Short(damage)
item["Count"] = TAG_Byte(count)
item["Slot"] = TAG_Byte(slot)
return item
# Creates a chest at the specified coords containing the items passed
def CreateChestAt(x, y, z, Items=None, Direction=2, CustomName=""):
levelObj.setBlockAt(x, y, z, 54) # Chest Block (single = 27 slots 0-26), 54 == chest, 146 == Trapped Chest
levelObj.setBlockDataAt(x, y, z, Direction) # 2==N, 3==S, 4==W, 5==E anything else == N
# Now Create Entity Block and add it to the chunk
chunk = getChunkAt(x, z)
chest = TileEntity.Create("Chest")
TileEntity.setpos(chest, (x, y, z))
if Items <> None:
chest["Items"] = Items
if CustomName <> "":
chest["CustomName"] = CustomName
chunk.TileEntities.append(chest)
Then you can use my functions in your filter by calling them as described in the samples below. Below, x,y,z assumes they have been populated by proper coordinates you wish the chest to be placed at.
Also, double chests are simply two side by side chests. Call CreateChestAt twice (two coordinates 1 apart E-W or N-S) to create a double chest. You can create 3 in a row but Minecraft will invalidate the 3rd chest making it inaccessible in-game so pay attention to how you place them.
To Create an empty chest:
CreateChestAt(x, y, z)
To Create a chest with items:
# Build item list (4 Jungle Planks and 11 chests
ChestItems = TAG_List()
ChestItems.append( CreateChestItem(5, 3, 4, 0) )
ChestItems.append( CreateChestItem(54, 0, 11, 1) )
# Make a chest with the items.
CreateChestAt(x, y, z, ChestItems)
Optional parameters of Direction and CustomName can be specified too...
Creates an empty chest facing West named "My Chest"
CreateChestAt(x, y, z, None, 4, "My Chest")
After digging into the source for MCE and also source for some of SethBling's filters I managed to whip up some code.
The following functions assume a global object named levelOBJ which is set to the incoming level object in your perform() function. This way you don't have to keep passing level or box.
# Just so I don't have to keep doing the math
def getChunkAt(x, z):
chunk = levelObj.getChunk(x / 16, z / 16)
return chunk
# Creates a TAG_Compound Item (for use with the CreateChestAt function)
def CreateChestItem(itemid, damage=0, count=1, slot=0):
item = TAG_Compound()
item["id"] = TAG_Short(itemid)
item["Damage"] = TAG_Short(damage)
item["Count"] = TAG_Byte(count)
item["Slot"] = TAG_Byte(slot)
return item
# Creates a chest at the specified coords containing the items passed
def CreateChestAt(x, y, z, Items=None, Direction=2, CustomName=""):
levelObj.setBlockAt(x, y, z, 54) # Chest Block (single = 27 slots 0-26), 54 == chest, 146 == Trapped Chest
levelObj.setBlockDataAt(x, y, z, Direction) # 2==N, 3==S, 4==W, 5==E anything else == N
# Now Create Entity Block and add it to the chunk
chunk = getChunkAt(x, z)
chest = TileEntity.Create("Chest")
TileEntity.setpos(chest, (x, y, z))
if Items <> None:
chest["Items"] = Items
if CustomName <> "":
chest["CustomName"] = CustomName
chunk.TileEntities.append(chest)
Then you can use my functions in your filter by calling them as described in the samples below. Below, x,y,z assumes they have been populated by proper coordinates you wish the chest to be placed at.
Also, double chests are simply two side by side chests. Call CreateChestAt twice (two coordinates 1 apart E-W or N-S) to create a double chest. You can create 3 in a row but Minecraft will invalidate the 3rd chest making it inaccessible in-game so pay attention to how you place them.
To Create an empty chest:
CreateChestAt(x, y, z)
To Create a chest with items:
# Build item list (4 Jungle Planks and 11 chests
ChestItems = TAG_List()
ChestItems.append( CreateChestItem(5, 3, 4, 0) )
ChestItems.append( CreateChestItem(54, 0, 11, 1) )
# Make a chest with the items.
CreateChestAt(x, y, z, ChestItems)
Optional parameters of Direction and CustomName can be specified too...
Creates an empty chest facing West named "My Chest"
CreateChestAt(x, y, z, None, 4, "My Chest")
answered Nov 4 '15 at 19:44
WolfieWolfie
2461 silver badge3 bronze badges
2461 silver badge3 bronze badges
You can click the green check mark to select this as being the correct answer.
– rivermont - Will B.
Apr 28 '16 at 13:13
add a comment |
You can click the green check mark to select this as being the correct answer.
– rivermont - Will B.
Apr 28 '16 at 13:13
You can click the green check mark to select this as being the correct answer.
– rivermont - Will B.
Apr 28 '16 at 13:13
You can click the green check mark to select this as being the correct answer.
– rivermont - Will B.
Apr 28 '16 at 13:13
add a comment |
Thanks for contributing an answer to Arqade!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgaming.stackexchange.com%2fquestions%2f241914%2ffilter-python-code-to-add-chest%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown