Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import copy
- import random
- import string
- import uuid
- import json
- import glob
- import os, sys
- import fnmatch
- import math
- import uuid
- import pymclevel.box
- from numpy import zeros, fromiter, append
- from copy import deepcopy
- from random import randrange
- from pymclevel import mclevel
- from pymclevel import MCSchematic
- from pymclevel import nbt
- from pymclevel.materials import alphaMaterials
- from pymclevel import TAG_Compound, TAG_Int, TAG_Int_Array, TAG_Short, TAG_Byte, TAG_String, TAG_Float, TAG_Double, TAG_List, TAG_Long
- from pymclevel import TileEntity, Entity
- import mcplatform
- import directories
- displayName = "Create Entities"
- inputs = (
- ("Entity: id", ("string", "width=200")),
- )
- entity_dictionary = {
- "Creeper":{
- "id":TAG_String("minecraft:creeper"),
- "Attributes":{
- 0:{
- "Name":TAG_String("minecraft:speed"),
- "Base":TAG_Double(0.00)
- },
- 1:{
- "Name":TAG_String("minecraft:follow"),
- "Base":TAG_Double(16.00)
- },
- 2:{
- "Name":TAG_String("minecraft:health"),
- "Base":TAG_Double(20.00),
- },
- 3:{
- "Name":TAG_String("minecraft:health"),
- "Base":TAG_Double(20.00)
- },
- 4:{
- "Name":TAG_String("minecraft:horse"),
- "Base":TAG_Double(0.00)
- },
- 5:{
- "Name":TAG_String("minecraft:zombie"),
- "Base":TAG_Double(20.00)
- },
- 6:{
- "Name":TAG_String("minecraft:knockback"),
- "Base":TAG_Double(0.00)
- },
- 7:{
- "Name":TAG_String("minecraft:swimming"),
- "Base":TAG_Double(0.00)
- }
- },
- "Motion":TAG_List([TAG_Int(20), TAG_Int(20)]),
- "Armor":TAG_List([TAG_Compound(), TAG_Compound(), TAG_Compound(), TAG_Compound()]),
- "Arms":TAG_List([TAG_Compound(), TAG_Compound()]),
- "ItemDropChance":["Head", "Feet", "Legs", "Chest", "LeftArm", "RightArm"],
- "Health":TAG_Int(20),
- "Powered":TAG_Byte(0),
- "CustomName":TAG_String(""),
- "CustomNameIsVisible":TAG_Byte(0)
- }}
- def getListTags():
- if isinstance(entity_json[tag], (TAG_List)):
- for tags in entity_json[tag]:
- if isinstance(entity_json[tag][tags], (TAG_Compound)):
- entity_json[tag].append(TAG_Compound())
- entity[tag] = entity_json[tag]
- def getBaseTags():
- #Gets Byte Tags, Short Tags, Int Tags, Long Tags, String Tags Handling acts like ints & floats
- if isinstance(entity_json[tag], (TAG_String, TAG_Long, TAG_Int, TAG_Byte, TAG_Short)):
- entity[tag] = entity_json[tag]
- return entity
- def createEntityAt(level, ent_id, x, y, z):
- entity = TAG_Compound()
- entity["Pos"] = TAG_List([TAG_Double(x),TAG_Double(y),TAG_Double(z)])
- for tag in entity_json:
- if isinstance(entity_json[tag], (TAG_List)):
- getListTags()
- getBaseTags()
- return entity
- def perform(level, box, options):
- mc = level.gamePlatform
- entity_json = entity_dictionary[options["Entity: id"]]
- for x in xrange(box.minx, box.maxx):
- for y in xrange(box.miny, box.maxy):
- for z in xrange(box.minz, box.maxz):
- chunk = level.getChunk(x / 16, z / 16)
- chunk.Entities.append(createEntity(level, options["Entity: id"], x+0.5, y, z+0.5))
Add Comment
Please, Sign In to add comment